Adds the captcha frame hosts to the CSP and handles a widget that cannot load

frame-src gets the three exact Friendly Captcha global hosts (no wildcard).
When the widget errors, is blocked or shows no sign of life, the form says so
and offers the mail button instead of blocking silently. Adds an e2e for the
form with a mocked API, a draft privacy text for approval, and label tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-10 23:27:29 +01:00
co-authored by Claude Sonnet 5.5
parent e09459423f
commit a1444b7b2a
13 changed files with 391 additions and 41 deletions
@@ -0,0 +1,36 @@
# Privacy statement: draft text for the contact form (needs Bryan's approval)
Status: DRAFT. Nothing of this is in the site yet: the page `/privacyverklaring` is still the placeholder "Deze pagina is nog in de maak". The text is site copy in Dutch, so Bryan (and Andrea, as the controller) decide the wording. Items marked **[CHECK]** are facts that must be confirmed before publishing; they are not guessed here.
## What the form sends and stores (from the API contract v0.3.x)
- Sent: name, e-mail address, the chosen shoot (the readable label, e.g. "Newborn"), the message, a signed time token, and (when the captcha is on) the captcha response.
- Stored by the CMS: the four fields, the time of receipt, a status and the mail status. **No IP address is stored** by the contact module (contract section 4.2). Retention period: **[CHECK]** (`retentionUntil` is fixed per message from the server setting; the value for ASF is not decided yet).
- Mail: each message is sent to Andrea's mailbox. **[CHECK]** mail provider and where it processes the data.
- The reply: Andrea answers by e-mail to the address given.
## Captcha (only when switched on)
- Provider: Friendly Captcha (Friendly Captcha GmbH, Germany). Region: the server decides. With the **global** endpoint (free key, tests only) the visitor's IP address can be processed outside the EU; the EU endpoint (`eu`, paid plan) keeps it in the EU. According to the provider the widget uses no cookies and does no tracking (Bryan's note via SLS-Main). **[CHECK]** exactly what the widget sends to the provider (quote the provider's privacy documentation) and whether a processing agreement is needed.
- Commercial use of the free tier is not allowed (Bryan's note): the captcha stays off in production until a paid plan exists, so this paragraph is only published together with the captcha.
## Draft text (Dutch)
### Contactformulier
Als je het contactformulier gebruikt, verwerk ik de gegevens die je invult: je naam, je e-mailadres, de soort shoot waarvoor je interesse hebt en je bericht. Ik gebruik die gegevens alleen om te reageren op je vraag. Het bericht wordt opgeslagen in het beheersysteem van deze website en als e-mail naar mij gestuurd. Je IP-adres wordt daarbij niet bewaard. Ik bewaar je bericht **[CHECK: bewaartermijn]** en verwijder het daarna.
Je kunt me ook gewoon mailen via de knop onder het formulier; dan gebruik je het formulier niet.
### Beveiliging tegen spam
Om spam tegen te gaan gebruikt het formulier een onzichtbaar veld en een korte wachttijd voordat je kunt versturen. **[Alleen bij ingeschakelde captcha:]** Daarnaast controleert de dienst Friendly Captcha (Friendly Captcha GmbH, Duitsland) of je een persoon bent. Volgens de aanbieder gebruikt die controle geen cookies en volgt hij je niet. Daarbij wordt wel je IP-adres naar de dienst gestuurd. **[Bij het gratis `global`-endpoint kan dat buiten de EU verwerkt worden; bij het EU-endpoint blijft het binnen de EU. Kies de zin die past.]** **[CHECK: welke gegevens deze dienst precies ontvangt, dit uit hun privacyinformatie overnemen]**
### Je rechten
Je kunt me vragen welke gegevens ik van je heb, ze te laten corrigeren of verwijderen. Mail daarvoor naar het adres onder het formulier.
## Where it appears
1. `PrivacyNote` under the form already links to `/privacyverklaring`; no change to that line is needed.
2. The page `routes/privacyverklaring.tsx` still has to be written; this draft is the part about the form. A full privacy statement (analytics: Umami without cookies, Sentry, hosting) is a separate piece of content.
## Questions for Bryan (via SLP Software - SLS - Main)
1. Retention period of contact messages for ASF (server setting `retentionUntil`).
2. Is Andrea the controller, and which contact address goes into the text?
3. Approve the wording, or change it.
4. The privacy page is still a placeholder: should the full privacy page be a separate feature, and is the form allowed to go live (test only) before it exists?
@@ -17,7 +17,7 @@ Order matters: steps 1-2 can start with the current package (without captcha); t
- [x] **9. Final package** (after SLS-Main's message): replace `src/cms-client/` by the final version (captcha slot, `initialSubject`); re-run boundary and package tests.
- [x] **10. CaptchaWidget**: new lazy chunk `src/components/ContactForm/CaptchaWidget.tsx` using `@friendlycaptcha/sdk` (`createWidget`, `startMode: focus`, `language: nl`, `apiEndpoint` per Bryan's host choice); complete -> `setCaptchaToken(response)`; expire/error -> `setCaptchaToken(null)` and `reset()`; `destroy()` on unmount; reserved height; add the pinned dependency (check `minimumReleaseAge` rules of pnpm). Tests with a fake SDK: expired token not sent, error resets, unsupported or missing provider keeps the gate, submit blocked with message until solved.
- [x] **11. Preselect with `initialSubject`**: Panel passes the remembered preselect to the form, the form to the hook; test "Boek..." before the form is mounted.
- [ ] **12. Privacy text**: PrivacyNote and the privacy page name the captcha provider and what the form stores (wording needs Bryan's approval; draft goes to SLS-Main for routing).
- [x] **12. Privacy text (draft, for Bryan's approval; not in the site)**: PrivacyNote and the privacy page name the captcha provider and what the form stores (wording needs Bryan's approval; draft goes to SLS-Main for routing).
- [ ] **13. PBT and e2e**: fast-check properties (PBT-02/03/07/08/09) for the label/payload mapping and trim; e2e with a mocked `/api` route: token 200 -> form, 404 -> gate, 202 success, 400 expired -> retry, prerendered HTML check; extend `noJs` e2e (gate and mail button without JS).
- [ ] **14. Documentation**: update `LAYOUT.md` if the contact block changes; README note for the copied package (source and sync rule); `aidlc-docs` code summary.
- [ ] **15. Automatic build and test (Step 13.5)**: `pnpm` typecheck, lint, unit tests, e2e where available, build and prerender; fix and repeat; report any decision only Bryan can make.