Files
SlpSoftware/aidlc-docs/features/redesign-modern-timetravel/inception/application-design/services.md
T
SluijsensandClaude Sonnet 5.5 1047c738b5 AI-DLC: inception en ontwerp voor redesign B/E met contactformulier
Requirements, application design (incl. concept-API-contract voor het contactformulier), units en functional design voor U1.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-09 21:06:25 +01:00

27 lines
1.8 KiB
Markdown

# Services
## Frontend services
### ThemeService (inside ThemeProvider)
- Reads/writes mode in localStorage key `slp-software-mode` (guarded try/catch); never writes the variant. Applies `data-variant`/`data-mode`. Migration: ignore the old `slp-software-theme` key.
### OfferingsService (usePackagesQuery)
- `GET /api/v1/offerings` via TanStack Query; later replaced by `cms-client/offerings`.
### ContactService (cms-client/contact)
Orchestration of one submission:
1. On first focus (or mount), `getToken()` fetches the server-signed timestamp token and captcha info.
2. `useContactForm` validates on blur / submit; honeypot filled → no request, show success (silent drop).
3. Submit sends `POST /api/v1/contact-messages` with `Idempotency-Key`.
4. `202` → `sent`; `400` token expired → refetch token and retry once; `400` field errors → map to fields; `429` → `failed` with retry-after message; other → `failed` (input kept).
5. No PII in logs, Sentry breadcrumbs or analytics events (Sentry `beforeBreadcrumb`/`beforeSend` scrub for the form route).
### Observability
- Existing Sentry and Umami remain. Umami event for form outcome without field data (`contact-sent`, `contact-failed`).
## Backend services (SlpModularCms, by `SLS Software - CMS`)
- **ContactMessageService**: validate → store (status `new`) → send mail best-effort via `IEmailSender` → update `mailStatus`.
- **ContactTokenService**: issues and verifies HMAC-signed timestamp tokens (site-bound).
- **SpamGuard**: honeypot, minimum elapsed time from the token, optional captcha verification (Friendly Captcha), identical 202 response on spam.
- **RetentionJob**: deletes messages older than the configured retention (12 months).
- **RateLimiting**: extends `AddCmsRateLimiting` with policy `ContactForm`; needs `ForwardedHeaders:KnownProxies` for the real client IP.