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

Inverse 0.4.0 released

Inverse now catches double clicks, so a declaration sent twice is stored and confirmed once. Inverse Pro adds a weekly team digest of refunds and contract ends that are due, and audit reports that print to PDF and export to CSV.

By Seya Weber

Inverse 0.4.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.3.0 code keeps working as it is.

What is in 0.4.0

  • Duplicate protection. People click twice, reload the confirmation page or retry on a slow connection. With dedupe: { windowMs } the handler answers an identical declaration with the first result, so you store one record and send one receipt. E-mail addresses are compared case-insensitively. It is off by default and works in createInverseHandler, createNodeHandler and the script-tag forms that post to them.
import { createInverseHandler } from "@sweberdev/inverse";

export const POST = createInverseHandler({
  company,
  onDeclaration,
  sendReceipt,
  dedupe: { windowMs: 10 * 60_000 },
  rateLimit: { max: 10 },
});
pnpm add @sweberdev/inverse@^0.4.0 @sweberdev/inverse-react@^0.4.0

Docs: packages.sweber.dev/inverse/docs. Try the flows in the demo.

Inverse Pro 0.4.0

  • Team digest. teamDigest(records) builds one e-mail a week with everything that needs doing: refunds that are due after a withdrawal (14 days after receipt), contracts that end in the next two weeks, cancellations whose end date was not sent yet, and all declarations received in the period. Run it from a cron job with the records from your ledger. dueItems() returns the same list as data for your back office.
  • Reports for clients. The audit's HTML report now has a print stylesheet, so Print → Save as PDF gives an A4 report to attach to an offer. inverse-audit --csv overview.csv writes one row per site with the verdict and both button targets, for agencies that track all client sites in a spreadsheet.

Inverse Pro is available on the package page, from CHF 19 a month.

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
Release

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.

Inverse