Files
SluijsensandClaude Sonnet 5.5 aa843a5675 Contactformulier: cms-client (validatie, reducer, client, hook), formulier in stijl B en beschikbaarheid
Headless pakket src/cms-client met importgrens, formulier dat pas verschijnt als de API antwoordt
(anders blijft de mailto-knop), honeypot, idempotentie, token-vernieuwing en property-based tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-10 13:13:24 +01:00

1.6 KiB

NFR Design Patterns — contact-form (U4)

Pattern Where Purpose
Progressive enhancement ContactPanel + useContactAvailability form only when the API answers 200; mailto otherwise
Fail closed to a safe fallback client/hook any unexpected response or error ends in the failure state with the mail address
Idempotent retry hook + Idempotency-Key a retry never creates a second message
Pure core / thin shell validateContact, reducer, mapApiErrors testable without DOM or network (PBT)
Honeypot + server token hook + API bots learn nothing; no client clock
Request timeout client AbortController 10 s so the UI never hangs in sending
Data minimisation in telemetry analytics calls events without data; no values in logs
Single token refresh client expired handled once, then generic failure (no loops)
Layout reservation ContactPanel minimum height keeps the page stable when upgrading from mailto to form

Misuse / abuse scenarios considered

  1. A bot fills every field including the honeypot: silent success on the client, the server drops or stores it as spam.
  2. Rapid repeated submits (double click, flaky network): ignored while sending; same idempotency key on retry.
  3. Visitor tampers with the token: the API answers expired; one refresh, then failure.
  4. Very large input pasted: client length errors; the API answers 413, message "Je bericht is te groot."
  5. API unavailable or deliberately closed (switches): the form never appears or falls back to mailto; no console spam.