Skip to main content
Introducing packages.sweber.dev
All posts
Release2 min read

Inverse 0.3.0 released

The withdrawal and cancellation buttons now work on every website, not only in React: one script tag for WordPress, Shopify themes and static sites. Plus Dutch, Spanish and Polish, and in Inverse Pro a ledger in PostgreSQL or SQLite.

By Seya Weber

Inverse 0.3.0 is out. @sweberdev/inverse and @sweberdev/inverse-react are on npm under the MIT licence, and the Pro packages are updated on GitHub Packages for licence holders. Nothing breaks: 0.2.0 code keeps working as it is.

One script tag, no React

Most shops and company sites do not run React. The new module @sweberdev/inverse/ui renders the same accessible two-step flow as the React DeclarationFlow, with labels, linked error messages, focus handling and a receipt announced to screen readers. It posts to the same handler endpoint.

On WordPress, in a Shopify theme or on a static page you only need the markup and one script:

<div data-inverse-form="withdrawal" data-endpoint="https://example.com/api/inverse"></div>
<a data-inverse-link="withdrawal" href="/widerruf"></a>

<script src="https://cdn.jsdelivr.net/npm/@sweberdev/inverse@0.3/dist/inverse.global.js" defer></script>

The script (about 9.5 kB gzipped, all languages included) mounts every marked form and fills empty footer links with the statutory label. The language follows data-locale or the page's lang. In a bundler, call it yourself:

import { mountCancellationForm } from "@sweberdev/inverse/ui"

const form = mountCancellationForm(document.querySelector("#kuendigen")!, {
  endpoint: "/api/inverse",
  locale: "de",
})

The new guide Plain HTML, WordPress and Shopify walks through it.

Dutch, Spanish and Polish

Forms, error messages, the receipt e-mail and the downloadable copy now also come in nl, es and pl, with dates in the local format. The two withdrawal button labels use the official wording of Article 11a of the directive in each language. The other texts are our translation: have a native speaker or your lawyer check them before going live. inverse check recognises the new labels.

Inverse Pro 0.3.0

  • Ledger in your database. postgresStore() and sqliteStore() keep the tamper-evident ledger in PostgreSQL or SQLite through any driver (pg, Neon, PGlite, node:sqlite, better-sqlite3, Bun). The table is append-only and created on first use, two server instances cannot fork the chain, and verification, evidence sheets and retention work as before.

Update

pnpm add @sweberdev/inverse@^0.3.0 @sweberdev/inverse-react@^0.3.0

Inverse Pro is available on the package page, from CHF 19 a month, and is part of the Compliance Bundle.

Package in this post

Inverse

The withdrawal button (§ 356a BGB) and the cancellation button (§ 312k BGB) for Next.js and React, with the two-step flow, the receipt e-mail and a page check.

pnpm add @sweberdev/inverse @sweberdev/inverse-react
View package

Related posts

Release

Inverse 0.1.0 released

The withdrawal button (§ 356a BGB) and the cancellation button (§ 312k BGB) for Next.js and React: statutory labels, the two-step flow, the receipt e-mail and a page check. MIT, no backend.

Inverse
Release

Inverse 0.2.0 released

Inverse now runs on Express, Fastify and the Next.js Pages Router, can rate-limit scripted submissions, shows how many days are left to withdraw, and lets signed-in customers pick their contract. Pro adds a retention period for the ledger and audit runs that report what got worse.

Inverse