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>
This commit is contained in:
2026-11-09 21:06:25 +01:00
co-authored by Claude Sonnet 5.5
parent ad4671334a
commit 1047c738b5
34 changed files with 2248 additions and 3 deletions
@@ -0,0 +1,26 @@
# API Documentation
## REST APIs (consumed)
### Offerings
- **Method**: GET
- **Path**: `{VITE_API_BASE_URL ?? ''}/api/v1/offerings`
- **Purpose**: package cards for PackagesSection
- **Request**: none
- **Response**: JSON array of `PackageCardData`; contract documented in `aidlc-docs/features/react-frontend/construction/react-frontend-app/functional-design/packages-api-handoff.md`
### Sentry tunnel
- **Method**: POST `/sentry-tunnel` (proxied by nginx; vite dev proxy locally)
## REST APIs (provided by this repo)
None. No contact/form endpoint exists yet; `ContactSection` uses `mailto:`.
## Internal APIs
### useTheme()
- **Methods**: `{ theme: 'red' | 'purple', toggleTheme() }`; throws outside ThemeProvider.
### usePackagesQuery()
- **Return**: TanStack Query result with `data: PackageCardData[]`.
## Data Models
### PackageCardData
- **Fields**: `id, slug, title, description, price, priceNote, features[], ctaLabel, featured?`
- **Validation**: none client-side (trusts API).
@@ -0,0 +1,75 @@
# System Architecture
## System Overview
Static single-page React application (Vite build) served as static files behind nginx on Raspberry Pis (test and production). One route (`/`), hash-based history. Dynamic data: packages via same-origin `GET /api/v1/offerings`. Monitoring: Sentry (via `/sentry-tunnel`) and self-hosted Umami.
## Architecture Diagram
```mermaid
graph TD
Browser[Browser] --> RP[Reverse-proxy Pi nginx]
RP --> WS[Web server Pi - static dist/]
RP --> API[CMS and API backend]
RP --> Sentry[Sentry tunnel]
Browser --> Umami[Umami analytics]
subgraph SPA[React SPA]
Root[__root route + RootLayout] --> Nav
Root --> Landing[LandingPage]
Root --> Footer
Landing --> Hero
Landing --> About
Landing --> Packages[PackagesSection + usePackagesQuery]
Landing --> Process
Landing --> Contact[ContactSection]
Nav --> Toggle[ThemeToggle]
Toggle --> TP[ThemeProvider]
end
Packages -->|fetch| API
classDef infra fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
classDef ui fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
classDef ext fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
class RP,WS,API infra;
class Root,Nav,Landing,Footer,Hero,About,Packages,Process,Contact,Toggle,TP ui;
class Sentry,Umami,Browser ext;
```
Text alternative: browser reaches nginx reverse proxy, which serves the static React bundle and proxies the API and Sentry tunnel; inside the SPA a root layout wraps nav, landing sections and footer.
## Component Descriptions
### ThemeProvider / tokens.ts / index.css
- **Purpose**: Theme state. `ThemeName = 'red' | 'purple'`, stored in localStorage key `slp-software-theme`, applied as class `theme-red`/`theme-purple` on `<html>`; colors are CSS variables mapped to Tailwind colors (`bg`, `surface`, `line`, `text`, `muted`, `accent`...).
- **Dependencies**: React context only.
- **Type**: Application
### Nav / Footer / RootLayout
- **Purpose**: Sticky nav (anchor links, CTA, ThemeToggle, mobile menu), footer, layout shell incl. UmamiAnalytics and SentryTestButton.
- **Type**: Application
### Landing feature (`src/features/landing`)
- **Purpose**: Sections and static content (`data/content.ts`), packages query hook.
- **Type**: Application
## Data Flow
```mermaid
sequenceDiagram
box rgba(99,179,237,0.4) Client
participant U as Visitor
participant P as PackagesSection
end
box rgba(154,230,180,0.4) Server
participant A as API offerings
end
U->>P: open page
P->>A: GET /api/v1/offerings
A-->>P: PackageCardData array
P-->>U: render cards or error text
```
## Integration Points
- **External APIs**: `GET {VITE_API_BASE_URL}/api/v1/offerings` (packages); Sentry envelope via `/sentry-tunnel`.
- **Databases**: none in this repo.
- **Third-party Services**: Sentry, Umami (self-hosted).
## Infrastructure Components
- **Deployment Model**: Gitea Actions (`continuous_integration.yaml`, `deploy.yaml`), static bundle on Raspberry Pi nginx; test and production environments.
- **Networking**: reverse-proxy Pi in front of web-server Pi (see feature react-frontend operations docs).
@@ -0,0 +1,34 @@
# Business Overview
## Business Context Diagram
```mermaid
graph LR
V[Visitor / prospect] --> S[slpsoftware.nl marketing site]
S --> O[Offerings API /api/v1/offerings]
S --> M[mailto link info@slpsoftware.nl]
B[Bryan Slop - SLP Software] --> M
O --> C[CMS and API - sibling repo]
classDef actor fill:#f6e05e,stroke:#c05621,stroke-width:1px,color:#000;
classDef app fill:#63b3ed,stroke:#2b6cb0,stroke-width:1px,color:#000;
classDef ext fill:#9ae6b4,stroke:#2f855a,stroke-width:1px,color:#000;
class V,B actor;
class S app;
class O,M,C ext;
```
Text alternative: visitors use the marketing site, which loads packages from the offerings API (hosted by the CMS and API repo) and currently hands contact requests off through a mailto link.
## Business Description
- **Business Description**: Marketing site of SLP Software, a one-person web and .NET development business (Bryan Slop). Goal: explain the offering, show packages with fixed prices, and get prospects to start a project.
- **Business Transactions**: (1) Visitor reads about the business; (2) Visitor browses packages (data from API); (3) Visitor reads the 3-step process; (4) Visitor requests a project (today: opens a mail client via mailto); (5) Visitor switches colour theme.
- **Business Dictionary**: *Pakket* = fixed-scope, fixed-price offering; *Maatwerk* = custom work quoted after intake; *Werkwijze* = process (intake, build, live).
## Component Level Business Descriptions
### Landing page (Hero, About, Packages, Process, Contact)
- **Purpose**: Single-page storefront.
- **Responsibilities**: Messaging, package presentation, call to action.
### Theme system
- **Purpose**: Let visitors choose red or purple dark theme.
- **Responsibilities**: Persist choice, apply CSS variable set.
@@ -0,0 +1,21 @@
# Code Quality Assessment
## Test Coverage
- **Overall**: Fair (23 tests at last recorded run; coverage % not measured)
- **Unit Tests**: Present for theme, nav, shared components, packages section
- **Integration Tests**: None
## Code Quality Indicators
- **Linting**: Configured (ESLint + typescript-eslint)
- **Code Style**: Consistent (Prettier)
- **Documentation**: Good (README, aidlc-docs)
## Technical Debt
- `ThemeName` is a closed union of two colour themes; adding light/dark and a variant (B vs E) needs a model change (theme = mode x variant).
- Design is heavily tied to the current dark red/purple look; B and E need new tokens, fonts (Archivo, Open Sans, Trebuchet/Verdana, VT323) and section components.
- `ContactSection` is mailto only; no form, validation or submit endpoint.
- `SKELETON_COUNT = 3` and `sm:grid-cols-3` hard-code three packages.
## Patterns and Anti-patterns
- **Good Patterns**: semantic Tailwind colors via CSS variables, feature folders, guarded localStorage access.
- **Anti-patterns**: none significant.
@@ -0,0 +1,38 @@
# Code Structure
## Build System
- **Type**: pnpm + Vite 5 + `tsc -b`
- **Configuration**: `vite.config.ts` (react plugin, `__APP_VERSION__` define, dev proxy `/sentry-tunnel`, vitest jsdom), `tailwind.config.ts`, `postcss.config.js`, `tsconfig*.json`, `eslint.config.js`, `.prettierrc`
## Key Modules
Entry: `index.html` → `src/main.tsx` (Sentry init, RouterProvider) → `src/router.tsx` (hash history) → `src/routes/__root.tsx` (ThemeProvider + RootLayout) → `src/routes/index.tsx` (LandingPage).
### Existing Files Inventory
- `src/main.tsx` - bootstrap, Sentry
- `src/router.tsx`, `src/routes/__root.tsx`, `src/routes/index.tsx` - routing
- `src/fonts.ts` - @fontsource imports (Instrument Sans, Sora, JetBrains Mono)
- `src/index.css` - Tailwind layers, `.theme-red`/`.theme-purple` variable sets, caret animation
- `src/theme/ThemeProvider.tsx`, `src/theme/tokens.ts` - theme context, ids, storage key
- `src/components/layout/Nav.tsx`, `Footer.tsx`, `RootLayout.tsx` - shell
- `src/components/ui/ThemeToggle.tsx` - round swatch button
- `src/components/shared/UmamiAnalytics.tsx`, `ErrorBoundary.tsx`, `SentryTestButton.tsx` - cross-cutting
- `src/features/landing/pages/LandingPage.tsx` - section composition (Hero, About, Packages, Process, Contact)
- `src/features/landing/components/*` - Hero, AboutSection (photo, WebP variants in `public/`), PackagesSection, PackageCard, PackageCardSkeleton, ProcessSection, ProcessStep, ContactSection (mailto only)
- `src/features/landing/data/content.ts` - nav links, hero, packages seed, process steps, about, contact info
- `src/features/landing/hooks/usePackagesQuery.ts` - TanStack Query fetch of offerings
- `src/lib/queryClient.ts`, `src/utils/scrollToHash.ts`, `src/test/setup.ts`
- Tests: `Nav.test.tsx`, `ErrorBoundary.test.tsx`, `SentryTestButton.test.tsx`, `UmamiAnalytics.test.tsx`, `ThemeProvider.test.tsx`, `PackagesSection.test.tsx`
- `References/` - original static HTML designs (purple and red)
## Design Patterns
### CSS-variable theming
- **Location**: `index.css`, `tailwind.config.ts`
- **Purpose**: switch theme by swapping a class on `<html>`; components use semantic Tailwind colors.
- **Implementation**: `ThemeName` union + `themeClassName()`.
### Feature folder
- **Location**: `src/features/landing`
- **Purpose**: group components/data/hooks by feature.
## Critical Dependencies
- react 18.3, @tanstack/react-router 1.79 (hash history), @tanstack/react-query 5, tailwindcss 3.4, @sentry/react 10, @fontsource fonts.
@@ -0,0 +1,21 @@
# Component Inventory
## Application Packages
- slp-software-frontend (this repo) - React SPA marketing site
## Infrastructure Packages
- `.gitea/workflows/continuous_integration.yaml`, `deploy.yaml` - Gitea Actions CI/CD
- nginx example configs in `aidlc-docs/features/react-frontend/operations/deployment/nginx/`
## Shared Packages
- none (sibling repo `AndreaSlopFotografie-cms-api-foundation` hosts CMS/API, external to this workspace)
## Test Packages
- Vitest + Testing Library co-located `__tests__` folders (6 test files)
## Total Count
- **Total Packages**: 1
- **Application**: 1
- **Infrastructure**: 0 (config only)
- **Shared**: 0
- **Test**: 0 (in-package)
@@ -0,0 +1,18 @@
# Dependencies
## Internal Dependencies
```mermaid
graph TD
main --> router --> root[__root] --> TP[ThemeProvider]
root --> RL[RootLayout] --> Nav --> TT[ThemeToggle] --> TP
root --> idx[routes/index] --> LP[LandingPage] --> Sections
Sections --> content[data/content.ts]
Sections --> hook[usePackagesQuery]
classDef a fill:#63b3ed,stroke:#2b6cb0,color:#000;
class main,router,root,TP,RL,Nav,TT,idx,LP,Sections,content,hook a;
```
Text alternative: entry point leads through router and root route to ThemeProvider, layout and landing sections which use static content and the packages hook.
## External Dependencies
See `package.json` (react, @tanstack/*, @sentry/react, @fontsource/*, tailwindcss, vite, vitest). Licenses: MIT/Apache-2.0 typical; not audited here.
External service dependency: CMS/API backend for `/api/v1/offerings` (sibling repo).
@@ -0,0 +1,16 @@
# Reverse Engineering Metadata
**Analysis Date**: 2026-11-09T13:20:00Z
**Analyzer**: AI-DLC
**Workspace**: K:\Development\SlpSoftware\Projects\SlpSoftware
**Total Files Analyzed**: ~25 (key source, config and structure files)
## Artifacts Generated
- [x] business-overview.md
- [x] architecture.md
- [x] code-structure.md
- [x] api-documentation.md
- [x] component-inventory.md
- [x] technology-stack.md
- [x] dependencies.md
- [x] code-quality-assessment.md
@@ -0,0 +1,19 @@
# Technology Stack
## Programming Languages
- TypeScript 5.6 - all source
## Frameworks
- React 18.3 - UI
- TanStack Router 1.79 (hash history) - routing
- TanStack Query 5.59 - data fetching
- Tailwind CSS 3.4 - styling via CSS variables
## Infrastructure
- Gitea Actions, nginx on Raspberry Pi (reverse proxy + static web server), Sentry, Umami
## Build Tools
- Vite 5.4, pnpm, tsc -b, PostCSS/Autoprefixer
## Testing Tools
- Vitest 2.1 (jsdom), Testing Library (react, user-event, jest-dom); ESLint 9 + typescript-eslint, Prettier 3
+4 -3
View File
@@ -1,5 +1,6 @@
# Active Features
| Feature | Status | Branch | Affected Components | Session Start |
|---------|--------|--------|---------------------|---------------|
| react-frontend | ✅ Complete | master | React frontend (SLP Software marketing site) | 2026-07-18 |
| Type | Name | Status | Branch | Affected Components | Session Start |
|------|------|--------|--------|---------------------|---------------|
| Feature | react-frontend | ✅ Complete | master | React frontend (SLP Software marketing site) | 2026-07-18 |
| Feature | redesign-modern-timetravel | 🔵 Inception | feature/redesign-modern-timetravel | Theme system, Nav, all landing sections, Contact form (+ CMS/API for form endpoint) | 2026-11-09 |
@@ -0,0 +1,64 @@
# AI-DLC State Tracking
## Project Information
- **Feature Name**: Redesign — Modern (B) as default with Time-travel (E) variant switch, plus contact form
- **Feature Slug**: redesign-modern-timetravel
- **Project Type**: Brownfield
- **Start Date**: 2026-11-09T13:00:00Z
- **Current Stage**: CONSTRUCTION - U1 theme-foundation Code Generation (in progress)
- **Branch**: feature/redesign-modern-timetravel
## Workspace State
- **Existing Code**: Yes
- **Reverse Engineering Needed**: Yes (done 2026-11-09, awaiting approval)
- **Workspace Root**: K:\Development\SlpSoftware\Projects\SlpSoftware
## Code Location Rules
- **Application Code**: Workspace root (NEVER in aidlc-docs/)
- **Feature Documentation**: aidlc-docs/features/redesign-modern-timetravel/ only
- **Shared Artifacts**: aidlc-docs/_shared/
- **Structure patterns**: See code-generation.md Critical Rules
## Language Configuration
- **Documentation Language**: English (confirmed by user 2026-11-09)
- **Conversation Language**: User Language (Dutch)
## Extension Configuration
| Extension | Enabled | Decided At |
|---|---|---|
| Security Baseline | Yes | Requirements Analysis |
| Property-Based Testing | Partial (pure functions and serialization round-trips only) | Requirements Analysis |
## Operations Configuration
- **Include Operations Phase**: Undecided
- **Decided At**: Pending — asked at Requirements Analysis
## Coordination Notes
- **Contact form**: the user wants to be notified BEFORE the form build starts, so other sessions that also need a form and the CMS & API session can be attached to build it together.
- **Design source**: Claude Design canvas https://claude.ai/artifact/UkpzA5YPLheZm3fpmWdPtn (B = Modern.dc.html, E = Tijdreis2.dc.html, packages blocks PakkettenModern/PakkettenTijd, dark variants).
- **Open input**: mobile packages as swipeable scroll-snap row instead of stacked (candidate requirement).
- **Sessions to attach (confirmed by user 2026-11-09)**: `CMS & API` [df4818] = website session of AndreaSlopFotografie (ASF); `AndreaSlopFotografie` [7d5867] = CMS session of ASF; `SLS Software - CMS` [9d882f] = CMS session of SLP Software (owner of the endpoint/headless module for this site). All three idle at 2026-11-09.
- **Coordination update 2026-11-09**: user asked to involve sessions immediately (they may need something else). Briefings sent: `CMS & API` (form needs of the ASF website: fields, validation, ?onderwerp preselect, spam/privacy, slots) and `SLS Software - CMS` (endpoint, `category`, headless module; owner of the build). `AndreaSlopFotografie` (ASF CMS session) is NOT asked now; use later as a cross-check reviewer. Replies are folded into the form contract in Application Design.
## Stage Progress
### 🔵 INCEPTION PHASE
- [x] Workspace Detection
- [x] Reverse Engineering (approved 2026-11-09) → aidlc-docs/_shared/reverse-engineering/
- [x] Requirements Analysis (approved 2026-11-09)
- [x] User Stories (SKIP)
- [x] Workflow Planning (approved 2026-11-09)
- [x] Application Design (approved 2026-11-09)
- [x] Units Generation (approved 2026-11-10)
### 🟢 CONSTRUCTION PHASE (units U1 theme-foundation, U2 b-modern-sections, U3 packages-block, U4 contact-form, U5 e-timetravel)
- [ ] Functional Design (EXECUTE U1, U3, U4; SKIP U2, U5)
- [ ] NFR Requirements (EXECUTE U4, U5; SKIP U1-U3)
- [ ] NFR Design (EXECUTE U4, U5)
- [ ] Infrastructure Design (EXECUTE U4 only)
- [ ] Code Generation (EXECUTE, per unit)
- [ ] Build and Test (EXECUTE)
### 🟡 OPERATIONS PHASE
- [ ] Deployment Setup, Monitoring Setup, Production Readiness Validation — UNDECIDED (asked at Build and Test)
@@ -0,0 +1,504 @@
# Audit Log — redesign-modern-timetravel
## Workspace Detection — Initial Request
**Timestamp**: 2026-11-09T13:00:00Z
**User Input**: "ik wil als uitgangspunt nu optie B bouwen. ik wil dan naast de light/dark theme switch een knop hebben waarmee ik naar optie E kan wisselen. ik wil dit met aidlc oppakken. ik wil meteen het formulier meebouwen. Zodra je het formulier gaat bouwen wil ik het wetenm dan haak ik andere sessies aan die ook nog een formulier wilen hebben en de sessie van het cms zodat het samen gebouwd kan worden"
**AI Response**: "Invoked aidlc-workflow. Classified as Feature (new capability: redesign + variant switch + contact form). Brownfield (existing React/Vite site, no shared reverse-engineering artifacts yet). Created branch feature/redesign-modern-timetravel from master. Created feature directory. Starting Reverse Engineering."
**Context**: Workspace Detection. Design source: Claude Design canvas artifact https://claude.ai/artifact/UkpzA5YPLheZm3fpmWdPtn (Modern.dc.html = B, Tijdreis2.dc.html = E, PakkettenModern.dc.html, PakkettenTijd.dc.html, plus dark wrappers). Standing coordination requirement: notify the user BEFORE the contact-form build starts, so they can attach other sessions that also want a form and the CMS & API session.
---
## Mid-turn user message — mobile packages layout
**Timestamp**: 2026-11-09T13:10:00Z
**User Input**: "voor de paketten heb ik nog wel een vraag voor de mobiele versie. ipv onder elkaar. is naast elkaar en swipeable niet makkelijker en mooier?"
**AI Response**: "Answered: yes, a horizontally swipeable scroll-snap row (peek of next card, dots, featured card first, keyboard/screen-reader accessible, desktop grid unchanged) is likely better, especially with 6+ packages. Recorded as a requirement candidate for Requirements Analysis. Canvas design not changed (not requested)."
**Context**: Requirement input for Requirements Analysis (packages block, mobile).
---
## Workspace Detection — Findings
**Timestamp**: 2026-11-09T13:12:00Z
**User Input**: "(none — internal finding)"
**AI Response**: "Brownfield: Vite + React 18 + TS + Tailwind 3 + TanStack Router (hash history) + TanStack Query + Vitest. Two themes (red/purple) via CSS custom properties and a ThemeToggle in Nav. Packages fetched from /api/v1/offerings. ContactSection currently only a mailto link. Sibling repo AndreaSlopFotografie-cms-api-foundation (branch feature/cms-api-foundation) hosts the CMS/API and has a 'contact-page' feature in its aidlc-docs — to be inspected in Requirements Analysis as potential reuse/coordination point. Active feature react-frontend is Complete; no conflict."
**Context**: Workspace Detection complete; next stage Reverse Engineering.
---
## Reverse Engineering — Approval
**Timestamp**: 2026-11-09T13:40:00Z
**User Input**: "taalgebruik is goed. ga verder"
**AI Response**: "Language preference confirmed as default (English docs, Dutch conversation; answer A). Reverse Engineering treated as approved; proceeding to Requirements Analysis. Created requirement-verification-questions.md (15 questions + Security Baseline + PBT opt-ins, in Dutch). Finding: CMS lives in separate repo SlpModularCms; sibling repo AndreaSlopFotografie-cms-api-foundation holds its feature briefs and a completed contact-page feature with its own ContactForm."
**Context**: Requirements Analysis, Step 6 (questions). Awaiting user answers.
---
## Requirements Analysis — Interactive Answers
**Timestamp**: 2026-11-09T14:10:00Z
**User Input**: "stuur mij de vragen hier interactief"
**AI Response**: "Asked all questions interactively in chat (AskUserQuestion) at the user's request instead of the file. Answers: Q1 A (B+E fully), Q2 B (icon only), Q3 A (variant not remembered), Q4 A (red/purple removed), Q5 B (follow system), Q6 A (generic, category from API, chips from 4), Q7 A (always swipe row on mobile), Q8 A (extra packages content out of scope), Q9 A (basic fields), Q10 A (API stores + mails), Q11 B (reusable module), Q12 C (honeypot/time/rate-limit + captcha fallback), Q13 A (privacy sentence), Q14 A (WCAG AA + reduced motion), Q15 C (operations undecided), Security A (enabled), PBT B (partial), Q16 follow-up on Q11: A (headless + theme slots). Answers copied into requirement-verification-questions.md. Wrote requirements.md; updated aidlc-state.md Extension and Operations configuration."
**Context**: Requirements Analysis, Steps 6-7. Completion message presented; awaiting approval. Note: Q11-B implies CMS repo SlpModularCms delivers the form module; form coordination notice to user still due before form build starts.
---
## Requirements Analysis — Approval
**Timestamp**: 2026-11-09T14:30:00Z
**User Input**: "goed idee, ga verder"
**AI Response**: "Requirements approved (User Stories remain skipped). 'Goed idee' read as agreement with attaching the CMS session at Workflow Planning/Application Design; no cross-session message sent yet because the user said they themselves attach the sessions — AI will offer a ready briefing and ask which sessions to message. Created execution-plan.md: Application Design EXECUTE, Units Generation EXECUTE (5 units U1-U5), Functional Design U1/U3/U4, NFR Requirements+Design U4/U5, Infrastructure Design U4, Operations undecided."
**Context**: Workflow Planning. Completion message presented; awaiting approval.
---
## Workflow Planning — Sessions to Attach
**Timestamp**: 2026-11-09T14:45:00Z
**User Input**: "`CMS & API`, `AndreaSlopFotografie` en `SLS Software - CMS` zijn de andere sessies. de 1e is de website sessie van andreaslopfotografie. De 2e is de cms sessie van ASF. de laatste is de cms sessie van SLP Software"
**AI Response**: "Verified via ListAgents: all three exist and are idle (SLS Software - CMS = [9d882f], formerly listed as slpmodularcms-f7). Recorded in aidlc-state.md Coordination Notes. No messages sent yet; plan approval for Workflow Planning still pending."
**Context**: Workflow Planning; coordination input.
---
## Workflow Planning — Sessions Briefed Early
**Timestamp**: 2026-11-09T15:00:00Z
**User Input**: "Is het niet slim de andere sessies meteen mee te nemen? Misschien hebben zij nog wat anders nodig. Dat is waarom ik zei dat je dat moest doen. De sessie `AndreaSlopFotografie` van de cms die hoef je niet per se te vragen. Ik denk dat CMS & API meer context heeft van het foprmulier op de website. UIteindleijk moet het in SLS Software - CMS worden gebouwd. Je kan de cms sessie van AndreaSlopFotografie wel gfebruiken om misschien het een en ander tegen te controleren."
**AI Response**: "Agreed. Sent briefings with questions (no build, no changes requested) to CMS & API [df4818] and SLS Software - CMS [9d882f], both with idle notification. AndreaSlopFotografie [7d5867] kept as later cross-check reviewer. Replies will be folded into the form contract in Application Design."
**Context**: Workflow Planning; cross-session coordination. Plan approval still not explicit.
---
## Cross-session Reply — SLS Software - CMS
**Timestamp**: 2026-11-09T15:20:00Z
**User Input**: "(cross-session message from SLS Software - CMS, not typed by the user)"
**AI Response**: "Recorded reply. Fit: mostly yes (modular setup, per-site hosts Api.SlpSoftware/Api.AndreaSlopFotografie, IEmailSender in Core/Email returning MailSendResult, AddCmsRateLimiting extensible with own policy, Sentry/SecurityEvents). Missing: Contact/Forms module (+tests), message storage (table + migration), honeypot/time check, retention-cleanup job. Rule: store first, mail best-effort, keep status. `category` on offerings: small change (model, migration, DTO, admin form), optional string/enum per site, empty = no chip. Module: small package (e.g. @slp/cms-forms) in SlpModularCms, consumed first via pnpm workspace/file dependency or tagged copy; private registry (Gitea packages) only with a third consumer — a decision for Bryan. Contract: OpenAPI as source of truth plus short markdown with behaviour agreements (spam rules, error codes, retention); versioned via /api/v1 and semver on package; AI drafts, CMS side delivers final OpenAPI and checks deviations. Parallel work possible once contract fixes fields, validation limits, error shape, honeypot/time field names. Suggestions: (a) server-signed timestamp token from GET for the time check, (b) idempotency key against double submit, (c) same 202/identical response on spam detection, (d) no email/message in logs or Sentry breadcrumbs (scrub), (e) site-id from host/config, not request body. Open for Bryan: retention period, required fields, captcha fallback yes/no."
**Context**: Pending reply from CMS & API [df4818]. Open decisions to ask the user: retention period, package consumption route.
---
## Cross-session Reply — CMS & API (ASF website)
**Timestamp**: 2026-11-09T15:35:00Z
**User Input**: "(cross-session message from CMS & API, not typed by the user)"
**AI Response**: "Recorded. ASF form today: fields naam (max 100), email (max 254, regex /^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/), shoot (select, required, value = package id or 'overig'), bericht (max 2000); trimmed payload {naam,email,shoot,bericht}; first failing rule per field wins (required, length, format); NL messages baked in; errors on blur of touched field or on submit, focus first error, noValidate; statuses editing/sending/sent/failed via pure reducer (input kept on failed; edits and second submit ignored while sending); preselect via ?pakket=<id> with key counter so same choice can be re-applied; unknown value ignored; query string read stays in the site router. No backend yet: submit throws, form behind ContactFormGate (inert, mailto shown, address assembled after hydration). Planned: POST /api/contact JSON + Friendly Captcha token; generic failure message; honeypot 'website' hidden field + time check (<3000 ms = spam); spam gets the thanks message but nothing is sent; API repeats checks. Privacy: one sentence with link to /privacyverklaring, no checkbox (PrivacyNote); success replaces form, focus + role=status, site-configurable reply time. Module needs: headless hook/state (values, errors, status, onChange/onBlur/onSubmit, preselect with change counter), pure reducer/validation testable, idPrefix for field ids, render slots (honeypot, robot check, status message), injectable texts/i18n, per-site options and reply time, injectable submit function, mailto fallback path without address in HTML, recipient server-side per site. Pitfalls: a11y (labels, errors linked, role=alert on server error, role=status + focus on success, honeypot invisible to AT), CSP extension for API + captcha, no inline scripts/styles, prerender/hydration safety (no Date.now differences; useState(() => Date.now())), captcha widget not in SSR HTML, rate limit needs ForwardedHeaders:KnownProxies for real client IP, mail via IEmailSender (sender allow-list, per-site sender), retention in privacy statement."
**Context**: Input for the form contract in Application Design. Note difference with SLS CMS suggestion (server-signed timestamp token vs client time check) to reconcile in the contract; ASF plans Friendly Captcha (captcha fallback provider to settle).
---
## Requirements Analysis — Follow-up Decisions (interactive)
**Timestamp**: 2026-11-09T15:40:00Z
**User Input**: "12 maanden, maar ik wil ze later gebruiken om voor de amdinistratie een opdracht in het systeem te kunnen zetten waaruit ik offertes en facturen kan opmaken. Dat wil ik nu nog niet doen, maar dat idee zit er wel achter. Dan weet je dat vast." / "Ik dacht dat het om de module ging in de API. Net zoals die van offerings. Maar dit is een front-end package heb ik het idee? Ik wil even weten wat de meerwaarde is dus die mag je even toelichten. Verder wil ik consistentie dus zou zoiets bij de offerings ook kunnen dan?" / "Alle vier verplicht (Recommended)"
**AI Response**: "Retention 12 months recorded; future idea (turn a message into an assignment for quotes and invoices) noted as out of scope but the stored message entity must stay extensible (status, id, no destructive design). All four fields required. Package question: user thought the module was an API module like Offerings; clarified there are two parts (API module + optional frontend package) and asked to decide after explanation."
**Context**: Requirements follow-up; requirements.md to be amended (retention 12 months, all fields required, future quotes/invoices idea, package decision pending).
---
## Requirements Analysis — Frontend Package Decision
**Timestamp**: 2026-11-09T15:55:00Z
**User Input**: "Één cms-client-pakket. Elk onderdeel wel los te importeren zodat een site niet alles importeert als die het niet gebruikt, maar wel dat het 1 package is."
**AI Response**: "Decision recorded: one frontend package (working name cms-client) with separately importable subparts (subpath imports), plus an API module in SlpModularCms. requirements.md amended (FR-13 all fields required, FR-14 retention 12 months and store-first/mail-best-effort, FR-14a future quotes/invoices idea, FR-16 hardening suggestions, FR-18 two-part module, NFR-5). Briefing both sessions of the decisions."
**Context**: Requirements amended after approval question; Workflow Planning approval still pending.
---
## Cross-session Message — SLS Software - CMS (contract requirements)
**Timestamp**: 2026-11-09T16:05:00Z
**User Input**: "(cross-session message from SLS Software - CMS, not typed by the user)"
**AI Response**: "Decisions acknowledged, no objections, nothing being built. Requests for the contract: (1) fix the error shape (e.g. ProblemDetails with field errors) and the rate-limit response (429 + Retry-After); (2) state that stored messages get their own id and a status so they can later become an assignment. They note the final API-side check should come from the 'CMS & API' session; per the user, that session is the ASF website session and the ASF CMS session is 'AndreaSlopFotografie', so the API-side cross-check goes to AndreaSlopFotografie. No reply needed."
**Context**: Input for the form contract in Application Design; awaiting user go-ahead for Application Design.
---
## Cross-session Message — CMS & API (no deviating wishes)
**Timestamp**: 2026-11-09T16:15:00Z
**User Input**: "(cross-session message from CMS & API, not typed by the user)"
**AI Response**: "Recorded: no deviating ASF wishes for captcha or privacy sentence; Friendly Captcha fits (existing [data-robot-check] slot); privacy sentence stays one sentence with link to /privacyverklaring, no checkbox. Addition for the contract: recipient, retention period and privacy link/text configurable per site. FR-17 in requirements.md updated. They are happy to review the draft contract."
**Context**: Input for Application Design; still awaiting the user's go-ahead on the Workflow Planning approval.
---
## Workflow Planning — Approval
**Timestamp**: 2026-11-09T16:30:00Z
**User Input**: "okee top, ga verder"
**AI Response**: "Workflow Planning approved. Starting Application Design: asking the design questions interactively in chat (user's earlier preference), recording answers in application-design-plan.md, then producing the design artifacts and the draft form contract for the CMS sessions."
**Context**: Workflow Planning approved; Application Design started.
---
## Application Design — Completed, Contract Sent for Review
**Timestamp**: 2026-11-09T17:10:00Z
**User Input**: "(interactive answers) Q1 Gedeelde laag + eigen weergave; Q2 Alleen in de app; Q3 Hier voorbouwen, dan overdragen"
**AI Response**: "Created application-design-plan.md, components.md, component-methods.md, services.md, component-dependency.md, contact-api-contract.md (v0.1.0-draft) and consolidated application-design.md. Sent the draft contract for review to SLS Software - CMS [9d882f], CMS & API [df4818] and AndreaSlopFotografie [7d5867] (ASF CMS, cross-check only), each with idle notification. This is the form-coordination moment the user asked for. Approval prompt for Application Design presented to the user: Request Changes / Continue to Units Generation."
**Context**: Application Design, awaiting approval.
---
## Contract Reviews Received and Product Decisions
**Timestamp**: 2026-11-09T18:20:00Z
**User Input**: (interactive answers) "Ja, volledig (Recommended)" for admin view Berichten in the CMS; "Opslaan als 'spam' (Recommended)" for honeypot/too-fast submissions; "Doorlaten (Recommended)" for captcha provider failure.
**AI Response**: "Folded three cross-session reviews (SLS Software - CMS, CMS & API, AndreaSlopFotografie) into contact-api-contract.md v0.3.0-draft: Retry-After and own ProblemDetails (new work in OnRejected), ICaptchaVerifier, idempotency table, DataProtection tokens, mail after commit with retry job and mailAttempts, admin endpoints (list/detail/status/delete/resend, capabilities entry), spam stored as status spam for 30 days, honeypot renamed hpCheck (autofill), 503 availability gate with mailto fallback, subject opaque value with per-site label for other, messages[field][code] with ASF-equal Dutch defaults, lazy token after hydration, captcha slot data and CSP notes per provider, no nginx hard-coding (ASF production IIS), env-only recipient/sender for ASF, backups vs retention note, KnownProxies per host. Open: category list location (appsettings vs free text), ASF migration to cms-client (separate ASF-web feature)."
**Context**: Application Design; awaiting final approval after contract confirmation by the builders.
---
## Contract v0.3.1 — Final Review Comments and Category Decision
**Timestamp**: 2026-11-09T19:00:00Z
**User Input**: "Vaste lijst per site (Recommended)" (interactive answer: category list is a fixed list per site in appsettings, no free text)
**AI Response**: "Folded comments of AndreaSlopFotografie (text fix on spam; spam row cap) and SLS Software - CMS (mail via BackgroundService + sweep + backoff; spam cap per day, excluded from unread counter and default list, retentionUntil +30d per row; DataProtection key ring persistent per host with per-site purpose; availability bypass = policy decision, default no bypass; OnRejected/Retry-After as separate first CMS unit; resend rate-limited; hard delete; idempotency record without PII; category migration; suggested CMS build order a-f) into contact-api-contract.md v0.3.1-draft. Category decision recorded."
**Context**: Application Design awaiting approval; no open product decisions left for the contract except confirmation by the builders and the policy question on the availability bypass.
---
## Availability Gate Decision
**Timestamp**: 2026-11-09T19:30:00Z
**User Input**: "De statussen blokkeren alleen het CMS. De master blokkeert alleen het wijzigen van data en instellingen, maar de content zal altijd beschikbaar blijven."
**AI Response**: "Recorded in contact-api-contract.md § 1: the availability statuses block only the CMS/admin; public content stays available. Interpreted the public contact routes (token + submit) and GET offerings as public content that must stay reachable; the CMS must align AvailabilityMiddleware (currently 503 for all /api/). Mailto fallback remains as a safety net for network errors/503. Interpretation of the contact submit as public (not a CMS data change) flagged for the user."
**Context**: Application Design; contract v0.3.1 amended.
---
## Builder of the CMS/API Side
**Timestamp**: 2026-11-09T19:50:00Z
**User Input**: "`SLS Software - CMS` heeft nog niks gebouwd, dat klopt, maar die sessie heb ik wel bedoeld als bouwer van de CMD/API kant."
**AI Response**: "Recorded: SLS Software - CMS [9d882f] is the intended builder of the CMS/API side. The session itself had stated it is not the build session; relayed the user's statement and asked it to report any reason against. Not a build order: the user has not yet instructed it to start."
**Context**: Application Design / coordination.
---
## Cross-session Message — SLS Software - CMS Accepts Builder Role
**Timestamp**: 2026-11-09T20:00:00Z
**User Input**: "(cross-session message from SLS Software - CMS, not typed by the user)"
**AI Response**: "Recorded: SLS Software - CMS accepts the builder role for SlpModularCms (branch feature/identity-email-notifications is clean; no role/repo agreement against it). Will not build until Bryan gives the order. Before starting: read contract v0.3.1 fully, walk through build order a-f, create a new feature branch from master (current branch belongs to other work); build and test per unit."
**Context**: Coordination; awaiting the user's start order for the builder and go-ahead for Units Generation.
---
## Leading the Builder Session
**Timestamp**: 2026-11-09T20:20:00Z
**User Input**: "de bouwer moet ook aidlc gebruiken. De bouwer moet ook nog even rekening houden met de huidige sessie `AndreaSlopFotografie`. Die zit in de laatste fase, maar is nog niet helemaal afgerond. Ik wil dat jij die bouwer leidt en vragen zelf beantwoord aan de hand van de kennis die je hebt. Vragen die je niet kan beantwoorden mag je doorsturen zodat ik dat kan doen. Ik zal tegen die sessie zeggen dat jij namens mij toestemming mag geven."
**AI Response**: "Sent the builder (SLS Software - CMS [9d882f]) an assignment: use aidlc (Feature lane) in its own repo with contract v0.3.1 as input, build order a-f with per-unit build+test, new branch from master after coordinating with AndreaSlopFotografie, send stage completions to Redesign - SLS (approved by AI where within Bryan's decisions, otherwise forwarded to Bryan), no Code Generation before plan approval, no push/merge/PR without explicit order. Asked AndreaSlopFotografie [7d5867] which branches/areas of SlpModularCms it still touches, when it merges and what the builder must know."
**Context**: Coordination. Authority limits: AI answers builder questions from known decisions; forwards unknowns to the user; major/irreversible actions (push/merge/PR) still need explicit user order."
---
## Cross-session Reply — AndreaSlopFotografie (SlpModularCms coordination)
**Timestamp**: 2026-11-09T20:40:00Z
**User Input**: "(cross-session message from AndreaSlopFotografie, not typed by the user)"
**AI Response**: "Recorded and relayed to builder SLS Software - CMS: ASF work lives on SlpModularCms branch feature/identity-email-notifications (HEAD e17d967, pushed, ~56 commits/~300 files ahead of master, awaiting deploy + manual test by Bryan, merge only on Bryan's decision). The builder's current checkout is on that same branch: told it NOT to switch branches there and to use a separate git worktree from master. Conflict areas on later rebase: appsettings (Email, RateLimiting), Program.cs/host-config, AvailabilityMiddleware, EF migrations (regenerate own migration after rebase). Contact mail: add a new MailKind, keep dark-mode contrast, secrets via env. Availability gate: marker attribute [PublicSiteEndpoint] via endpoint metadata (deny-by-default, tests for admin 503, ~6-10 tests affected), as own unit with (b). Spam rows per-site cap and separate admin view. Builder to send plan after Inception for approval."
**Context**: Coordination with builder; Code Generation still gated on plan approval.
---
## Builder Requirements Questions Answered
**Timestamp**: 2026-11-09T21:00:00Z
**User Input**: "(cross-session message from SLS Software - CMS asking to answer 8 requirement questions; earlier user instruction: AI leads the builder and answers within known decisions)"
**AI Response**: "Answered: Q1 A (Security on), Q2 B (PBT partial), Q3 C (Operations undecided - to put to Bryan), Q4 A (Modules.Contact + Tests), Q5 A (own DbContext, MySQL, Migrate at startup, regenerate migration after rebase), Q6 A ([PublicSiteEndpoint] marker, deny-by-default), Q7 A (targeted review), Q8 A (admin UI last after ASF merge). Builder worktree: K:\Development\Projects\SlpModularCms-contact-forms, branch feature/contact-forms-module from master d9cc539; main checkout untouched."
**Context**: Leading the builder; open for Bryan: Operations phase for the CMS side (Q3).
---
## Builder Requirements Approved
**Timestamp**: 2026-11-09T21:30:00Z
**User Input**: "(cross-session messages from SLS Software - CMS: requirements ready, correction that the file now exists)"
**AI Response**: "Read K:\Development\Projects\SlpModularCms-contact-forms\aidlc-docs\features\contact-forms-module\inception\requirements\requirements.md (D1-D12, review findings, R1-R3). Approved. Decided R1: build units a, b, c, e on master base with the mail sender behind an own small interface; units d (mail+retry on Core/Email) and f (admin UI) after the merge of feature/identity-email-notifications and a rebase; that merge is Bryan's decision. Builder continues with Workflow Planning and sends the execution plan for approval; no Code Generation yet."
**Context**: Leading the builder. Dependency for the user: the merge of the ASF branch gates units d and f.
---
## Application Design — Approval and Units Generation
**Timestamp**: 2026-11-09T21:50:00Z
**User Input**: "ja ga ondertussen verder met units generation" / (interactive answer) "Formulier eerst (Recommended)"
**AI Response**: "Application Design treated as approved (user told to continue with Units Generation). Question: order of last two frontend units answered A (U4 form before U5 E). Generated unit-of-work-plan.md, unit-of-work.md (U1-U5 plus external X-a..X-f), unit-of-work-dependency.md and unit-of-work-story-map.md (requirements-to-unit map). Completion message presented; awaiting approval."
**Context**: Units Generation complete.
---
## Builder Execution Plan Approved
**Timestamp**: 2026-11-09T22:00:00Z
**User Input**: "(cross-session message from SLS Software - CMS: Workflow Planning ready for approval)"
**AI Response**: "Read-through of the builder's summary and approved the execution plan: phase 1 on master base (CMS-U1 category, CMS-U2 OnRejected + [PublicSiteEndpoint], CMS-U3 Modules.Contact, CMS-U4 admin API), phase 2 after Bryan's merge of feature/identity-email-notifications (CMS-U5 mail + retry, CMS-U6 admin UI). Agreed that Application Design (minimal) and Units Generation may be sent together and approved together if within the contract and decisions. Per-unit Code Generation plans go to this session for approval; CMS-U1 starts only after that."
**Context**: Leading the builder. Note: the execution-plan.md of the builder was approved on the basis of the builder's summary (file path given).
---
## Builder Application Design and Units Approved
**Timestamp**: 2026-11-09T22:15:00Z
**User Input**: "(cross-session message from SLS Software - CMS: Application Design (minimal) + Units Generation ready)"
**AI Response**: "Approved. Decision 1: follow repo convention for admin routes (GET /api/v1/contact-messages/admin, .../admin/{id} GET/PATCH/DELETE, POST .../admin/{id}/resend with policy RateLimiting:ContactResend); the gate test iterates all endpoints without [PublicSiteEndpoint]. Contract § 6, § 10a updated. Decision 2: accepted correction, DataProtection is host-level (AddCmsDataProtection, keys in DB), Contact only uses IDataProtector purpose SlpModularCms.Contact.Token.{siteId}; contract § 2.1 note added. Other items (config keys, rate limits, openapi/cms-api.v1.json snapshot test, Contact only in Api.SlpSoftware in phase 1) accepted. Next: builder sends Code Generation plan for CMS-U1."
**Context**: Leading the builder. Files were approved on the basis of the builder's summary.
---
## Builder CMS-U1 Code Generation Plan Approved
**Timestamp**: 2026-11-09T22:40:00Z
**User Input**: "(cross-session message from SLS Software - CMS: CMS-U1 plan for approval; file read in full)"
**AI Response**: "Read K:\Development\Projects\SlpModularCms-contact-forms\aidlc-docs\features\contact-forms-module\construction\plans\cms-u1-offerings-category-code-generation-plan.md and approved. Q1: initial categories [Websites, Software, Beheer] (config only; content confirmation still to be put to Bryan). Q2: add a small separate unit CMS-U1b (admin form dropdown) right after CMS-U1, before CMS-U2, only touching frontend/src/features/offerings. One commit per unit, no push/merge/PR; builder to report real test output."
**Context**: Leading the builder. Open for Bryan: confirm that categories Websites/Software/Beheer fit the offering (unanswered since the start).
---
## Route Design Decision — No /admin Segment
**Timestamp**: 2026-11-09T23:10:00Z
**User Input**: "waarom zit er in de routes van de api uberhaubt een /admin-deel? Dat is onnodig. ik wil het zo RESTful mogelijk houden. Dat de admin het mag gebruiken betekent niet dat er per se een admin route moet zijn. Admin kan gewoon POST, PUT DELETE en GET doen"
**AI Response**: "Decision recorded in contract § 6: RESTful routes without /admin; authorization policy AdminOnly for admin use, [PublicSiteEndpoint] marker for public endpoints; contact-messages: POST + GET token public, GET list/GET,PATCH,DELETE {id:guid}, POST {id}/resend AdminOnly; offerings categories at GET /api/v1/offerings/categories (AdminOnly). Builder told to adjust CMS-U1 (in build) before committing. Existing offerings/admin... routes and Availability admin/status left untouched; possible RESTful refactor of them put to the user as a later follow-up."
**Context**: Leading the builder; affects contract and CMS-U1.
---
## Category Decision Revised — CMS-managed Data
**Timestamp**: 2026-11-09T23:40:00Z
**User Input**: "Over de catagorie-vraag. Op dit moment had ik nog helemaal geen plan om categorieën te gebruiken, dus ik heb er nog niet over nagedacht. De categorieën kunnen in het cms toegevoegd worden neem ik aan? Niet via de settings. Dat wordt te onhandig. De categorieën mogen in een soort sub-scherm het hoeft geen volledig nieuwe pagina te worden, maar gewoon onderdeel van offerings. Voor als het handig is om te weten. Ik denk dat ik begin met de categorieën Websites en Onderhoud. Als biedt ik voor nu totaalpakketten aan en nieuwbouw. Over overname had ik nog niet nagedacht namelijk."
**AI Response**: "Revised: categories are CMS data (OfferingCategory entity with CRUD under /api/v1/offerings/categories, AdminOnly), managed in a sub-section of the Offerings admin; starting categories Websites and Onderhoud created by Bryan in the CMS; Offering.categoryId FK; public offerings keep category as name string; delete of used category rejected with 409. Contract § 7 and requirements FR-8 updated (placeholders Websites/Software/Beheer replaced by Websites/Onderhoud). Builder told to send a revised CMS-U1 plan before committing and that CMS-U1b grows into a categories sub-section plus a dropdown in OfferingForm."
**Context**: Leading the builder; supersedes D4 and the approved CMS-U1 plan.
---
## Existing /admin Routes Refactored Now
**Timestamp**: 2026-11-10T00:00:00Z
**User Input**: "Over de bestaande routes. Dat klopt, dat is niet goed gegaan. Die routes wil ik nu ook aanpassen. Meteen meenemen want nu ben ik beide websites aan het onderhouden voor dit soort dingen. Dus ik doe het liever nu dan later"
**AI Response**: "Decision recorded in contract § 10 and unit-of-work.md (X-0 Offerings routes now in phase 1 before the category units; X-g Availability status route in phase 2 after the ASF merge). Builder told: new unit CMS-U0 offerings-restful-routes first (incl. admin frontend call sites, tests, OpenAPI snapshot), open design question public vs admin DTO on the same URL (AI preference: one URL, public DTO for anonymous, extended DTO for authorized admins, builder to weigh alternatives), reorder as collection action instead of move-up/down, then CMS-U1 category on the new routes and CMS-U1b. Availability admin/status becomes PUT only in phase 2 because the ASF branch touches Availability and master/slave callers. Other controllers only reported if relevant."
**Context**: Leading the builder; scope extension decided by the user.
---
## Builder CMS-U0 and CMS-U1 v2 Plans Approved
**Timestamp**: 2026-11-10T00:30:00Z
**User Input**: "(cross-session message from SLS Software - CMS: merged plan CMS-U0 + CMS-U1 v2; both plan files read in full)"
**AI Response**: "Approved CMS-U0 (RESTful offerings routes, DTO choice A: one URL and one OfferingDto for everyone, displayOrder added, OfferingAdminDto removed, order route PUT /offerings/order, move-up/down removed, no old routes kept) and CMS-U1 v2 (OfferingCategory entity, nullable Offering.CategoryId FK Restrict, CRUD under /offerings/categories AdminOnly, 409 for duplicate/in-use, 400 errors.categoryId invalid, offeringCount in list, nothing seeded). Extras: run the 4 failing Api.Tests on the clean worktree to document the baseline; test 201+Location and order-route validation; verify rename is immediately visible on the public GET; keep git stash until U1 v2 is done. Contract § 7 updated with additive fields and write routes. Order: U0 -> U1 -> U1b -> U2 -> U3 -> U4 | merge | U5 -> U6 -> U7 (Availability PUT)."
**Context**: Leading the builder. v1 of CMS-U1 was built (74 tests green) but stashed, not committed.
---
## Units Generation Approved; CMS-U0 Accepted
**Timestamp**: 2026-11-10T01:10:00Z
**User Input**: "moeten we voor lokaal een mariadb opzetten voor ASF? Dan moet ik dat even gaan doen. Voor jouw frontendheb je akkoord en kan je verder"
**AI Response**: "Answered the MariaDB question (CI uses mariadb:11 on port 3307; same container locally lets Api.Tests run; not ASF-specific). Units Generation approved by the user: proceeding to Construction, U1 theme-foundation Functional Design. Builder reported it had already started a temporary podman MariaDB (slp-contact-test-db, port 3306) following the earlier allowance; baseline proven (Api.Tests 4/4 fail without database, 4/4 pass with database on clean master). CMS-U0 commit d62b33d reviewed (controller, stat) and accepted; Offerings.Tests 52, Core 196, Availability 82, Identity 37, Master 57, Api 4 passed; frontend vitest 260 passed, eslint and tsc clean. Prettier warnings on 15 untouched files recorded as tech-debt note only."
**Context**: Construction phase start for the frontend; builder continues with CMS-U1 v2.
---
## U1 Functional Design Questions (interactive)
**Timestamp**: 2026-11-10T01:15:00Z
**User Input**: (interactive) "Naar boven (Recommended)"; "Tweestanden (Recommended)"; "Tijdreis-effect"
**AI Response**: "U1 FD answers: variant switch scrolls to top; mode button is two-state (follows system until the user clicks, then persisted); variant switch uses a short time-travel effect (dither/flash toward E and back), disabled under reduced motion."
**Context**: Functional Design U1.
---
## U1 Functional Design Complete
**Timestamp**: 2026-11-10T01:40:00Z
**User Input**: "(none)"
**AI Response**: "Generated theme-foundation-functional-design-plan.md, theme-foundation-fd-questions.md (answers A, A, C), and construction/theme-foundation/functional-design/{domain-entities, business-rules, business-logic-model, frontend-components}.md with Mermaid diagrams. Key decisions: /theme-init.js as blocking same-origin script to avoid theme flash (no inline script); two-state mode button following system until first click; variant never persisted and not in URL; time-travel dither transition (cover, swap, reveal) disabled under reduced motion; E lazy chunk with error boundary falling back to B. Completion message presented; awaiting approval."
**Context**: Construction, Functional Design U1; next stage for U1 is Code Generation (NFR Requirements/Design/Infrastructure skipped for U1 per execution plan).
---
## Builder CMS-U1 v2 Accepted
**Timestamp**: 2026-11-10T02:00:00Z
**User Input**: "(cross-session message from SLS Software - CMS: CMS-U1 v2 done, commit f2ac377)"
**AI Response**: "Accepted CMS-U1 v2: OfferingCategory table + Offering.CategoryId FK Restrict, migration AddOfferingCategories, CRUD under /offerings/categories (AdminOnly, 409 duplicate and in-use, soft-deleted offerings detached in same transaction), OfferingDto category name + additive categoryId and displayOrder, nothing seeded; Offerings.Tests 84, Core 196, Availability 82, Identity 37, Master 57, Api 4 passed; migration verified on a real MariaDB. Rename is immediately visible (no response caching in code; nginx/IIS must not cache /api/v1/offerings long: to Operations list). Stash cms-u1-v1 may be dropped. Next: CMS-U1b plan."
**Context**: Leading the builder.
---
## Builder CMS-U1b Plan Approved
**Timestamp**: 2026-11-10T02:20:00Z
**User Input**: "(cross-session message from SLS Software - CMS: stash dropped, CMS-U1b plan; plan file read in full)"
**AI Response**: "Approved CMS-U1b (categories dialog inside the Offerings list, select with 'Geen categorie' in OfferingForm, badge on OfferingRow, Dutch error messages, query invalidation, mocks without seed, tests). Remarks: verify query key after CMS-U0 and add a rename-visible-without-reload test. Stash e5e3652 dropped by the builder (superseded). Next: CMS-U2 plan."
**Context**: Leading the builder.
---
## U1 Functional Design Approved; Code Generation Plan Ready
**Timestamp**: 2026-11-10T03:00:00Z
**User Input**: "akkoord, ga verder"
**AI Response**: "Functional Design U1 approved. Created construction/plans/theme-foundation-code-generation-plan.md (13 steps: preparation, font dependency, tokens, media-query hooks, CSS tokens, theme-init.js, ThemeProvider, toggles/renderer/overlay/boundary, layout integration, tests, build+test, docs, commit). Approval prompt for the plan presented: Request Changes / Approve Plan."
**Context**: Code Generation Part 1 (planning) for U1.
---
## Builder CMS-U1b Accepted; CMS-U2 Plan Approved
**Timestamp**: 2026-11-10T03:20:00Z
**User Input**: "(cross-session message from SLS Software - CMS: CMS-U1b done, commit 20f4c3c; CMS-U2 plan; plan file read in full)"
**AI Response**: "Accepted CMS-U1b (categories dialog, select, badge, query key renamed to ['offerings','list'], fixes for star button clearing category and Radix empty value; lint, tsc -b clean, vitest 42 files / 278 tests). Approved CMS-U2 (PublicSiteEndpoint marker, OnRejected 429 with Retry-After + problem+json, route-table test, only GetOfferings marked now). Flagged release prerequisite: on CMS master rate-limit policies are global buckets; per-client partitioning (ClientPartitionKey, ForwardedHeaders) exists only on the ASF branch, so the contact routes must not go live on a public host before it is on the base branch. Added to contract § 4.5; builder to include in CMS-U2 summary and CMS-U3 plan."
**Context**: Leading the builder. Add to Operations list/open for Bryan: ASF merge is a prerequisite for enabling the contact routes publicly.
---
## Builder CMS-U2 Accepted; CMS-U3 Plan Approved
**Timestamp**: 2026-11-10T03:50:00Z
**User Input**: "(cross-session message from SLS Software - CMS: CMS-U2 done, commit 9e8e8ef; CMS-U3 plan; plan file read in full)"
**AI Response**: "Accepted CMS-U2 (marker, OnRejected 429 + Retry-After, route-table tests; Core 205, Availability 95, Offerings 86, Identity 37, Master 57, Api 4 passed; real-pipeline smoke test with CMS disabled). Approved CMS-U3 (Modules.Contact + Tests, own DbContext, token via DataProtection, spam path stored with 30 days and daily cap, idempotency table, retention job, Contact:Enabled=false default giving 404 as in-code release condition, rate-limit partition key function constant 'global' on master). Answers: Contact:Enabled default false with 404 OK; ProblemDetails type configurable default about:blank OK; OpenAPI export split into CMS-U3b OK. Contract updated (§ 3 type, § 5 Contact:Enabled). Additions requested: rebase checklist with exact line, retention job inert when disabled, no token/idempotency key in logs, list of Contact:* keys in the summary."
**Context**: Leading the builder. Frontend: 404 on the token route means form unavailable, fall back to mailto (to design in U4).
---
## Form Builder and On/Off Switch Decisions; U1 Plan Approved
**Timestamp**: 2026-11-10T04:20:00Z
**User Input**: "Krijgen we voor het formulier een soort builder waarin je kan aangeven welke velden er zijn of is het een vast aantal velden? Als de velden uiteen gaan lopen zou zoiets wel handig zijn. Maar als dat nu nog niet wordt meegenomen komt dat later wel. Al moet contactformulier ook nog aangezet kunnen worden." / (interactive) "Nu vaste velden (Recommended)"; "Beide lagen (Recommended)" / "Akkoord op jouw bouwplan"
**AI Response**: "Recorded: fixed fields now (builder later as own feature); two-layer on/off switch (host Contact:Enabled plus a CMS switch via singleton GET/PUT /api/v1/contact-settings, default off, form active only when both on, 404 when either is off, switch visible in the Berichten screen; CMS-U4/U6). Contract § 5a added. Builder to be told to build the CMS-U3 gate behind an interface. U1 Code Generation plan approved by the user; starting Part 2."
**Context**: Code Generation U1 Part 2 starts.
---
@@ -0,0 +1,48 @@
# Code Generation Plan — theme-foundation (U1)
Single source of truth for U1 Code Generation. Inputs: `unit-of-work.md` (U1), Functional Design in `construction/theme-foundation/functional-design/`, requirements FR-3..FR-6, NFR-1, NFR-3, NFR-7.
## Unit context
- **Workspace root**: `K:\Development\SlpSoftware\Projects\SlpSoftware` (brownfield; modify in place, no `_new` copies). Branch `feature/redesign-modern-timetravel`.
- **Dependencies**: none. **Blocks**: U2..U5. **External**: none.
- **Owned entities**: `ThemeState`, `StoredMode`, `TransitionState`, token sets (see domain-entities.md).
- **Interim visual note**: U1 swaps the token values (B light/dark replace red/purple). Existing sections keep using the semantic Tailwind colors and are restyled to design B in U2. The branch is not deployed between units.
- **Story/requirement mapping**: FR-3, FR-4, FR-5, FR-6 (shell), NFR-1 (toggle a11y, reduced motion), NFR-3 (self-hosted font), NFR-7.
## Files (modify = M, create = C, delete = D)
- M `package.json`, `pnpm-lock.yaml` (add `@fontsource-variable/archivo`), M `src/fonts.ts`, M `tailwind.config.ts` (font family key)
- M `src/theme/tokens.ts`, M `src/theme/ThemeProvider.tsx`, M `src/index.css`
- C `public/theme-init.js`, M `index.html`
- C `src/shared/hooks/usePrefersReducedMotion.ts`, C `src/shared/hooks/usePrefersDark.ts`
- C `src/components/ui/ModeToggle.tsx`, C `src/components/ui/VariantToggle.tsx`, D `src/components/ui/ThemeToggle.tsx`
- C `src/components/layout/VariantRenderer.tsx`, C `src/components/layout/TransitionOverlay.tsx`, C `src/components/layout/LiveRegion.tsx`, C `src/components/layout/EBoundary.tsx`
- C `src/variants/e/LandingE.tsx` (placeholder shell for the lazy chunk; real content in U5)
- M `src/components/layout/Nav.tsx`, M `src/components/layout/RootLayout.tsx`
- Tests: M `src/theme/__tests__/ThemeProvider.test.tsx`, M `src/components/layout/__tests__/Nav.test.tsx`, C `src/theme/__tests__/tokens.test.ts`, C `src/shared/hooks/__tests__/*.test.ts(x)`, C `src/components/layout/__tests__/VariantRenderer.test.tsx`, C `src/components/layout/__tests__/TransitionOverlay.test.tsx`, C `src/components/ui/__tests__/ModeToggle.test.tsx`, C `src/components/ui/__tests__/VariantToggle.test.tsx`
- Docs: C `aidlc-docs/features/redesign-modern-timetravel/construction/theme-foundation/code/summary.md`
## Steps
- [ ] **Step 0 — Preparation**: commit the AI-DLC inception/design documents separately (`aidlc-docs/`) on the branch so code commits stay clean. Verify the baseline: `pnpm test`, `pnpm lint`, `pnpm build` are green before changes (record the numbers).
- [ ] **Step 1 — Dependency and fonts**: add `@fontsource-variable/archivo` (variable weight + width axis) respecting the repo's pnpm settings; if the package is blocked by the release-age policy or missing, stop and report instead of working around it. Import it in `src/fonts.ts` next to the existing fonts (old fonts are removed in U2); add Tailwind `fontFamily.archivo`.
- [ ] **Step 2 — Tokens (pure logic)**: rewrite `src/theme/tokens.ts`: types `Variant`, `Mode`, `ModeSource`; constants `MODE_STORAGE_KEY = 'slp-software-mode'`, `LEGACY_THEME_STORAGE_KEY = 'slp-software-theme'`; pure functions `isValidMode`, `resolveInitialMode(stored, systemPrefersDark)` returning `{ mode, source }`. (BR-U1-1, 2, 11)
- [ ] **Step 3 — Media-query hooks**: `usePrefersReducedMotion`, `usePrefersDark` (SSR-safe, subscribe/unsubscribe, jsdom-safe when `matchMedia` is missing → defaults false). (BR-U1-3, 9)
- [ ] **Step 4 — CSS tokens**: in `src/index.css` replace `.theme-red/.theme-purple` with `html[data-variant='b'][data-mode='light'|'dark']` and E placeholders (`'e'`, light/dark, accent `#AC0000`) with the semantic variables; B accent `#7A1414`; transitions guarded by `prefers-reduced-motion`; add the dither overlay classes (checker mask + `steps()` keyframes, accent colored), all disabled under reduced motion. (FR-3, BR-U1-9)
- [ ] **Step 5 — No-flash script**: create `public/theme-init.js` (plain ES5, guarded storage access, sets `data-variant="b"` and `data-mode` on `<html>`, mirrors `resolveInitialMode`); add `<script src="/theme-init.js"></script>` (blocking, in `<head>`) in `index.html`. No inline script. (BR-U1-5)
- [ ] **Step 6 — ThemeProvider**: rewrite with `variant`, `mode`, `modeSource`, `toggleMode`, `toggleVariant`, `transition`, `announce`; follow system changes while source is `system`; persist mode on user toggle (guarded); remove the legacy key once; apply data attributes in an effect; `toggleVariant` runs the phases cover → swap → reveal (timers, ~300 ms each), scrolls to top and moves focus to `#main` after the swap, immediate under reduced motion. (BR-U1-1..10, FR-5)
- [ ] **Step 7 — UI components**: `ModeToggle` (aria-pressed = dark, label "Donkere weergave", ≥44px target on mobile, `data-testid="mode-toggle-button"`), icon-only `VariantToggle` (label "Tijdreis: bekijk de site zoals vroeger" / "Terug naar nu", tooltip = label, `data-testid="variant-toggle-button"`), `TransitionOverlay`, `LiveRegion`, `EBoundary`, `VariantRenderer` (B eager, E via `React.lazy(() => import('../../variants/e/LandingE'))`, `Suspense` fallback = cover, error → B + alert + retry). Delete `ThemeToggle.tsx`. (FR-4, FR-6, BR-U1-6..8, 12)
- [ ] **Step 8 — Layout integration**: `Nav.tsx` shows `ModeToggle` then `VariantToggle` (desktop and mobile bar); `RootLayout.tsx` wraps content in `<main id="main" tabIndex={-1}>`, renders `VariantRenderer` (B shell = Nav + page + Footer), `TransitionOverlay`, `LiveRegion`; `LandingE` is a minimal placeholder ("Tijdreis — in aanbouw") with its own nav containing the two toggles so the round trip is testable. `src/routes/__root.tsx` composition order unchanged.
- [ ] **Step 9 — Tests**: per the acceptance list in `frontend-components.md` (8 items): table-driven `resolveInitialMode`; ThemeProvider (first render, legacy key removal, system change following, user click stops following, persistence, storage failure, variant never persisted); variant switch (scroll to top, focus on `#main`, announcement, reduced-motion path with no overlay, failure path with alert + retry); accessibility attributes of both buttons; Nav test updates. Replace obsolete red/purple assertions.
- [ ] **Step 10 — Build and test (automatic, Step 13.5)**: `pnpm lint`, `pnpm test`, `pnpm build` (runs `tsc -b`). Fix and retry until green; report real counts. Manual smoke check of both modes via `pnpm build` output is not required.
- [ ] **Step 11 — Docs**: write `construction/theme-foundation/code/summary.md` (files, behaviour, how to use the hooks, notes for U2..U5, the `/theme-init.js` CSP/nginx note for Operations: must be served same-origin and not cached long).
- [ ] **Step 12 — Commit**: one commit for U1 code (Dutch message in the repo's style, `Co-Authored-By` line as required). No push.
## Explicitly NOT touched in U1
Section content and layout (Hero, About, Packages, Process, Contact), `content.ts`, `usePackagesQuery`, Sentry/Umami wiring, nginx configs, router. Old fonts stay until U2. The E variant's real content is U5.
## Risks
- jsdom has no `matchMedia`/`scrollTo`: mocks live in `src/test/setup.ts` additions (Step 9).
- Dependency policy (release age) could block the font package: handled in Step 1 by reporting, not bypassing.
- The interim look changes (light default for many visitors) until U2; accepted because units are not deployed separately.
## Traceability
FR-3, FR-4, FR-5, FR-6 (shell), NFR-1, NFR-3, NFR-7; Functional Design BR-U1-1..12; Security Baseline: no inline script (CSP), guarded storage access, no external font requests.
@@ -0,0 +1,25 @@
# Functional Design Questions — theme-foundation (U1)
Asked interactively in chat at the user's request (2026-11-10); answers copied here.
## Question 1 — Scroll position when switching between B and E
- A) Go to the top of the page
- B) Stay in the same section
- X) Other
[Answer]: A
## Question 2 — How does the light/dark button work?
- A) Two states: toggles light and dark; starts from the system preference; after a click the choice is persisted
- B) Three states: system, light, dark
- X) Other
[Answer]: A
## Question 3 — Transition when switching to E and back
- A) Short fade (about 300 ms)
- B) Instant
- C) Time-travel effect (short retro dither/flash); off under reduced motion
- X) Other
[Answer]: C
@@ -0,0 +1,9 @@
# Functional Design Plan — theme-foundation (U1)
- [x] Analyze unit context (unit-of-work.md U1, requirements FR-3..FR-6, NFR-1, NFR-3, NFR-7)
- [x] Resolve design questions (asked interactively, see `theme-foundation-fd-questions.md`)
- [x] Generate `business-logic-model.md` (mode and variant flows, transition sequence)
- [x] Generate `business-rules.md` (BR-U1-1 .. BR-U1-12, decision flow)
- [x] Generate `domain-entities.md` (ThemeState, stored mode, TransitionState, token sets)
- [x] Generate `frontend-components.md` (component hierarchy, props/state, flows, acceptance tests)
- [x] Validate against requirements and Application Design
@@ -0,0 +1,45 @@
# Business Logic Model — theme-foundation (U1)
## Startup
1. `/theme-init.js` (blocking, same origin) reads the stored mode (guarded), falls back to `prefers-color-scheme`, and sets `data-variant="b"` and `data-mode` on `<html>`.
2. `ThemeProvider` initializes its state with the same function (`resolveInitialMode`) so React and the script always agree; it removes the legacy key `slp-software-theme`.
3. `ThemeProvider` subscribes to the `prefers-color-scheme` media query; while `modeSource = 'system'` the mode follows it.
## Mode toggle
`toggleMode()`: `mode = (mode === 'light') ? 'dark' : 'light'`, `modeSource = 'user'`, persist (guarded), update `<html data-mode>`.
## Variant switch (sequence)
```mermaid
sequenceDiagram
box rgba(99,179,237,0.4) Browser UI
participant U as Visitor
participant VT as VariantToggle
participant TP as ThemeProvider
participant TO as TransitionOverlay
end
box rgba(154,230,180,0.4) App
participant VR as VariantRenderer
end
U->>VT: click
VT->>TP: toggleVariant
TP->>TO: start cover
TO-->>TP: cover done
TP->>VR: set variant, load E chunk if needed
VR-->>TP: ready or failed
TP->>TP: scroll to top and move focus
TP->>TO: reveal
TP-->>U: announce result in live region
```
Text alternative: the click asks the theme provider to switch; the overlay covers the page; the renderer loads and swaps the variant; the provider scrolls, moves focus, reveals and announces.
## Time-travel transition (effect)
- **cover**: a full-viewport overlay with a pixel-dither pattern (CSS `steps()` animation over a checker mask, accent-coloured) fades in over ~300 ms; pointer events are blocked and `aria-hidden` is set.
- **swap**: variant changes, `data-variant` updated, scroll to top, focus to `main`.
- **reveal**: the dither clears over ~300 ms. Total about 600 ms plus E chunk load time on first visit.
- Reduced motion: none of this renders.
## Error handling
- Storage unavailable: mode works for the session only.
- E chunk fails to load: stay in B, show the alert, offer retry; the overlay is removed.
- Media query unsupported: treat as light.
@@ -0,0 +1,60 @@
# Business Rules — theme-foundation (U1)
| Id | Rule |
|---|---|
| BR-U1-1 | The variant is `'b'` on every page load. It is never read from or written to storage or the URL. |
| BR-U1-2 | Initial mode: a valid stored mode wins; otherwise `dark` if `prefers-color-scheme: dark`, else `light`. |
| BR-U1-3 | While `modeSource = 'system'`, the mode follows live changes of the system preference. After the user clicks the mode button, `modeSource = 'user'` and system changes are ignored. |
| BR-U1-4 | The mode button toggles light and dark (two states), sets `modeSource = 'user'` and persists the new mode. Storage errors never break the toggle (state still changes for the session). |
| BR-U1-5 | The initial `data-variant` and `data-mode` are set before first paint by a small same-origin script (`/theme-init.js`, no inline script, CSP-friendly) so there is no flash of the wrong theme; React then takes over the same values. |
| BR-U1-6 | The variant button switches between B and E using the time-travel transition (cover → swap → reveal). After the swap the page scrolls to the top and focus moves to the start of the new page (skip target / `main`). |
| BR-U1-7 | A live region announces the change in Dutch ("Tijdreis-weergave geladen." / "Terug naar de moderne weergave."). |
| BR-U1-8 | E is loaded lazily. While it loads, the transition stays in `cover`. If loading fails, the variant stays `'b'`, the cover is removed and an alert says "De tijdreis kon niet worden geladen." with a retry; B stays usable. |
| BR-U1-9 | Under `prefers-reduced-motion: reduce` there is no transition, no dither, no fade: the swap is immediate (all other rules still apply). |
| BR-U1-10 | The mode is shared by both variants; switching variant keeps the mode. |
| BR-U1-11 | The old red/purple themes and their classes (`theme-red`, `theme-purple`) are removed; the old storage key is ignored and removed. |
| BR-U1-12 | Both buttons are real `<button>`s with accessible names, visible focus and at least 44×44 px touch targets on mobile; the mode button exposes `aria-pressed` (dark), the variant button has a label that changes with the current variant. |
## Decision flow: initial mode
```mermaid
graph TD
S([Page load]) --> A{Stored mode valid}
A -->|"yes"| B[Use stored mode and source user]
A -->|"no"| C{System prefers dark}
C -->|"yes"| D[Mode dark and source system]
C -->|"no"| E[Mode light and source system]
classDef start fill:#CE93D8,stroke:#6A1B9A,color:#000;
classDef decision fill:#FFF59D,stroke:#F57F17,color:#000;
classDef result fill:#9ae6b4,stroke:#2f855a,color:#000;
class S start;
class A,C decision;
class B,D,E result;
```
Text alternative: a valid stored mode is used; otherwise the system preference decides, and the source is system.
## Decision flow: variant switch
```mermaid
graph TD
K([Variant button]) --> R{Reduced motion}
R -->|"yes"| W[Swap immediately]
R -->|"no"| CV[Cover with dither]
CV --> L{Target is E}
L -->|"yes"| LD[Load E chunk]
L -->|"no"| W
LD --> OK{Loaded}
OK -->|"yes"| W
OK -->|"no"| ER[Stay in B and show alert]
W --> SC[Scroll to top and move focus]
SC --> RV[Reveal and announce]
classDef start fill:#CE93D8,stroke:#6A1B9A,color:#000;
classDef decision fill:#FFF59D,stroke:#F57F17,color:#000;
classDef step fill:#63b3ed,stroke:#2b6cb0,color:#000;
classDef bad fill:#ffab91,stroke:#bf360c,color:#000;
class K start;
class R,L,OK decision;
class W,CV,LD,SC,RV step;
class ER bad;
```
Text alternative: the variant button covers the page with the dither (unless reduced motion), loads E when needed, swaps, scrolls to the top, reveals and announces; a loading failure keeps B and shows an alert.
@@ -0,0 +1,41 @@
# Domain Entities — theme-foundation (U1)
```mermaid
graph TD
TS[ThemeState] -->|"variant"| V[Variant b or e]
TS -->|"mode"| M[Mode light or dark]
TS -->|"modeSource"| MS[ModeSource system or user]
M -->|"persisted as"| SM[StoredMode in localStorage]
TS -->|"drives"| DA[html data-variant and data-mode]
DA -->|"selects"| TK[Token set]
TR[TransitionState] -->|"target"| V
TR -->|"phase"| PH[idle cover swap reveal]
classDef state fill:#63b3ed,stroke:#2b6cb0,color:#000;
classDef value fill:#9ae6b4,stroke:#2f855a,color:#000;
classDef out fill:#f6e05e,stroke:#c05621,color:#000;
class TS,TR state;
class V,M,MS,PH value;
class SM,DA,TK out;
```
Text alternative: the theme state holds variant, mode and where the mode came from; mode is persisted, the state is written to the html element, which selects the token set; a separate transition state tracks the switch animation toward a target variant.
## ThemeState
| Field | Type | Rule |
|---|---|---|
| `variant` | `'b' \| 'e'` | initial always `'b'`; never persisted |
| `mode` | `'light' \| 'dark'` | initial from stored value, else system preference |
| `modeSource` | `'system' \| 'user'` | `'system'` until the user clicks the mode button |
## StoredMode
- localStorage key `slp-software-mode`, value `'light'` or `'dark'` only; anything else counts as "nothing stored". Reads and writes are guarded (private mode, blocked storage).
- The old key `slp-software-theme` (red/purple) is ignored and removed once on startup.
## TransitionState
| Field | Type | Rule |
|---|---|---|
| `phase` | `'idle' \| 'cover' \| 'swap' \| 'reveal'` | `idle` when reduced motion is on or no switch is running |
| `target` | `Variant \| null` | variant being switched to |
## Token sets (CSS custom properties)
Selected by `html[data-variant][data-mode]`: B light, B dark, E light, E dark. Semantic names stay (`--color-bg`, `--color-surface`, `--color-surface-2`, `--color-line`, `--color-text`, `--color-muted`, `--color-accent`, `--color-accent-soft`, `--color-accent-line`, `--color-accent-hover`, `--color-accent-contrast`) so existing Tailwind color names keep working. Accents: B `#7A1414`, E `#AC0000`. B dark values follow the canvas (page `#0F0E0E`, ink `#F3F0EC`, muted `#B3ADA7`, alt `#181615`, card `#232020`, line `#3A3532`, marks `#E5524A`); E dark values per era are defined in U5; U1 provides the E base tokens as placeholders.
@@ -0,0 +1,67 @@
# Frontend Components — theme-foundation (U1)
## Component hierarchy
```mermaid
graph TD
root[__root route] --> eb[ErrorBoundary]
eb --> tp[ThemeProvider]
tp --> qc[QueryClientProvider]
qc --> rl[RootLayout]
rl --> ua[UmamiAnalytics]
rl --> vr[VariantRenderer]
rl --> to[TransitionOverlay]
rl --> lr[LiveRegion]
vr --> lb[LandingB eager]
vr --> ee[EBoundary]
ee --> le[LandingE lazy]
lb --> mt[ModeToggle]
lb --> vt[VariantToggle]
le --> mt2[ModeToggle]
le --> vt2[VariantToggle]
tp -.provides.-> hooks[useTheme]
hooks --> mt
hooks --> vt
classDef layout fill:#4CAF50,stroke:#2e7d32,color:#000;
classDef guard fill:#FF9800,stroke:#e65100,color:#000;
classDef ui fill:#2196F3,stroke:#0d47a1,color:#000;
classDef hook fill:#9C27B0,stroke:#4a148c,color:#000;
class root,rl,tp,qc layout;
class eb,ee guard;
class vr,lb,le,mt,vt,mt2,vt2,to,lr,ua ui;
class hooks hook;
```
Text alternative: the root route wraps the app in an error boundary, theme provider and query provider; the layout renders the variant renderer (eager B, lazy E behind its own boundary), the transition overlay and a live region; both landings contain the two toggle buttons that use the theme hook.
## Components
| Component | Props | State / behaviour |
|---|---|---|
| `ThemeProvider` | `children` | holds `ThemeState` and `TransitionState`; exposes `{ variant, mode, toggleMode, toggleVariant, transition, announce }` via `useTheme()`; implements BR-U1-1..11 |
| `ModeToggle` | none | button, `aria-pressed = (mode==='dark')`, label "Donkere weergave", icon sun/moon; calls `toggleMode` |
| `VariantToggle` | none | icon-only button (clock/rewind), label "Tijdreis: bekijk de site zoals vroeger" in B and "Terug naar nu" in E, tooltip equal to the label; calls `toggleVariant` |
| `VariantRenderer` | none | renders `LandingB` or `React.lazy(LandingE)` inside `Suspense`; fallback is the cover overlay |
| `EBoundary` | `children` | error boundary for the lazy chunk; on error resets variant to `'b'` and shows the alert with a retry button (BR-U1-8) |
| `TransitionOverlay` | none | reads `transition.phase`; renders the dither overlay only for `cover` and `reveal`; `aria-hidden`, blocks pointer events; nothing under reduced motion |
| `LiveRegion` | none | polite `aria-live` region for the announcements in BR-U1-7 |
| `usePrefersReducedMotion` / `usePrefersDark` | none | subscribe to the media queries (SSR-safe defaults) |
## User interaction flows
- Mode button: click → mode flips immediately, persisted, `aria-pressed` updates.
- Variant button: click → transition (or immediate under reduced motion) → new variant at top of page, focus on `main`, announcement.
- Keyboard: both buttons reachable in the nav in DOM order (mode, variant), Enter/Space activate; Escape does not interfere with the mobile menu.
## Form validation rules
None in this unit.
## API integration points
None (client-only). The existing Sentry and Umami integration is untouched.
## Acceptance tests (Vitest + Testing Library)
1. `resolveInitialMode`: stored valid wins; invalid/absent falls back to system; table-driven.
2. First render: `data-variant="b"`, `data-mode` from system; legacy key removed.
3. System preference change flips the mode while source is system, not after a user click.
4. Mode click persists to `slp-software-mode`; storage that throws does not break the toggle.
5. Variant is `'b'` after a fresh mount even if E was active before (not persisted).
6. `toggleVariant`: scrolls to top and moves focus; announces; under reduced motion no overlay phases occur.
7. Lazy chunk failure: variant stays `'b'`, alert shown, retry works.
8. Accessibility: accessible names, `aria-pressed`, 44×44 px class, focus-visible styles.
@@ -0,0 +1,41 @@
# Application Design — redesign-modern-timetravel (consolidated)
Details: [components.md](components.md) · [component-methods.md](component-methods.md) · [services.md](services.md) · [component-dependency.md](component-dependency.md) · [contact-api-contract.md](contact-api-contract.md)
## Decisions (user, 2026-11-09)
| # | Decision | Source |
|---|---|---|
| D1 | Shared layer (content, data hooks, form logic) + separate presentation for B and E; E lazy-loaded | Design Q1-A |
| D2 | Variant is app state only, not in the URL, not persisted; every visit starts in B | Design Q2-A, Req Q3-A |
| D3 | Headless form logic is written first in this repo in a movable folder `src/cms-client/`, then handed over to SlpModularCms | Design Q3-B |
| D4 | One frontend package `cms-client` with separately importable parts (subpaths); offerings moves in later | Follow-up decision |
| D5 | API module Contact/Forms in SlpModularCms built by `SLS Software - CMS` | Req Q10-A/Q11-B |
| D6 | Mode (light/dark) follows system preference, overridable and persisted | Req Q5-B |
## Architecture overview
```mermaid
graph LR
subgraph FE[slp-software-frontend]
TP[ThemeProvider variant x mode] --> VR[VariantRenderer]
VR --> B[Variant B eager]
VR -.lazy.-> E[Variant E chunk]
B --> S[shared logic]
E --> S
B --> CC[src/cms-client movable]
E --> CC
end
CC --> API[SlpModularCms API: Contact/Forms module and Offerings category]
S --> API
classDef fe fill:#63b3ed,stroke:#2b6cb0,color:#000;
classDef pkg fill:#f6e05e,stroke:#c05621,color:#000;
classDef ext fill:#9ae6b4,stroke:#2f855a,color:#000;
class TP,VR,B,E,S fe;
class CC pkg;
class API ext;
```
Text alternative: the theme provider drives a variant renderer that shows eager B or lazy E; both use shared logic and the movable cms-client folder, which talks to the CMS API.
## Design validation
- Requirements coverage: FR-1..FR-6 (theme, variants, nav buttons, mode rules) → ThemeProvider, ModeToggle, VariantToggle, VariantRenderer, LandingB/E. FR-7..FR-12 (packages) → usePackagesQuery/usePackageFilter/useSwipeRow + PackagesB/E. FR-13..FR-19 (form) → cms-client/contact, form skins, contract. NFR-1..8 → usePrefersReducedMotion, code split, boundary lint rule, scrubbing, tests.
- Consistency: all component names in methods/dependency docs exist in components.md; contract field names equal the hook payload.
- Open items are listed in contact-api-contract.md § 9 and are owned by the CMS sessions.
@@ -0,0 +1,73 @@
# Component Dependencies
## Dependency matrix (frontend)
| Component | Depends on |
|---|---|
| RootLayout | ThemeProvider, VariantRenderer, UmamiAnalytics |
| VariantRenderer | ThemeProvider, LandingB, LandingE (lazy) |
| LandingB / LandingE | shared/content, usePackagesQuery, usePackageFilter, useSwipeRow, ContactPreselectContext, cms-client/contact, ModeToggle, VariantToggle |
| PackagesB / PackagesE | usePackageFilter, useSwipeRow, ContactPreselectContext |
| ContactFormView / ContactFormTerminal | cms-client/contact only (props) |
| cms-client | nothing outside `cms-client` (enforced by ESLint `no-restricted-imports`) |
| ThemeProvider | tokens, localStorage (guarded) |
## Diagram
```mermaid
graph TD
Root[RootLayout] --> TP[ThemeProvider]
Root --> VR[VariantRenderer]
VR --> LB[LandingB eager]
VR -.lazy.-> LE[LandingE chunk]
LB --> PB[PackagesB]
LB --> CB[ContactB with ContactFormView]
LE --> PE[PackagesE]
LE --> CE[ContactE with ContactFormTerminal]
PB --> Shared[shared: filter, swipe, content, preselect]
PE --> Shared
CB --> CC[cms-client/contact headless]
CE --> CC
CC --> HTTP[cms-client/http]
Shared --> Q[usePackagesQuery]
Q --> API[(CMS API offerings)]
HTTP --> API2[(CMS API contact-messages)]
classDef ui fill:#63b3ed,stroke:#2b6cb0,color:#000;
classDef shared fill:#9ae6b4,stroke:#2f855a,color:#000;
classDef pkg fill:#f6e05e,stroke:#c05621,color:#000;
classDef ext fill:#e2e8f0,stroke:#4a5568,color:#000;
class Root,TP,VR,LB,LE,PB,PE,CB,CE ui;
class Shared,Q shared;
class CC,HTTP pkg;
class API,API2 ext;
```
Text alternative: the root layout renders the variant renderer, which shows the eager B landing or the lazy E landing; both use shared logic and the headless cms-client contact part, which talks to the CMS API through the http helpers.
## Communication patterns
- Theme/variant: React context (no URL, no persistence of variant).
- Data: TanStack Query for offerings; imperative fetch with state reducer for the form.
- Package → form: `ContactPreselectContext.select(subject)` then hash scroll to `#contact`; the form hook applies it when `key` changes.
- Cross-repo: HTTP only (`/api/v1/...`, same origin through nginx); source-level sharing via the movable `cms-client` folder.
## Data flow: form submission
```mermaid
sequenceDiagram
box rgba(99,179,237,0.4) Browser
participant V as Visitor
participant H as useContactForm
end
box rgba(154,230,180,0.4) CMS API
participant A as contact-messages
participant M as IEmailSender
end
V->>H: focus form
H->>A: GET token
A-->>H: signed token and captcha info
V->>H: submit valid values
H->>A: POST with Idempotency-Key
A->>A: spam checks, store message
A-->>H: 202 received
A->>M: send mail (best effort)
H-->>V: success message
```
@@ -0,0 +1,61 @@
# Component Methods
Signatures are high-level. Business rules are detailed in Functional Design (U1, U3, U4).
## Theme
```ts
type Variant = 'b' | 'e';
type Mode = 'light' | 'dark';
resolveInitialMode(stored: string | null, systemPrefersDark: boolean): Mode;
useTheme(): { variant: Variant; mode: Mode; toggleMode(): void; setVariant(v: Variant): void; toggleVariant(): void };
```
## Packages (shared)
```ts
type PackageCardData = { id; slug; title; description; price; priceNote; features: string[]; ctaLabel; featured?: boolean; category?: string | null };
usePackagesQuery(): UseQueryResult<PackageCardData[]>;
usePackageFilter(packages: PackageCardData[]): { categories: { id: string; label: string; count: number }[]; active: string; setActive(id: string): void; visible: PackageCardData[]; showChips: boolean };
useSwipeRow(itemCount: number, initialIndex: number): { ref: RefObject<HTMLElement>; activeIndex: number; scrollToIndex(i: number): void };
```
## Contact preselect
```ts
useContactPreselect(): { subject: string | null; key: number; select(subject: string): void };
```
## cms-client / contact (headless)
```ts
type ContactFields = { name: string; email: string; subject: string; message: string };
type ContactErrorCode = 'required' | 'tooLong' | 'invalid';
type ContactStatus = 'editing' | 'sending' | 'sent' | 'failed';
validateContact(values: ContactFields): Partial<Record<keyof ContactFields, ContactErrorCode>>;
contactFormReducer(state: ContactState, event: ContactEvent): ContactState; // pure
createContactClient(opts?: { baseUrl?: string; fetch?: typeof fetch }): {
getToken(): Promise<{ token: string; minSeconds: number; captcha: { provider: string; siteKey: string } | null }>;
submit(payload: ContactPayload, ctx: { token: string; captchaToken?: string; idempotencyKey: string }): Promise<void>; // throws ContactApiError
};
useContactForm(options: {
idPrefix: string;
subjectOptions: { value: string; label: string }[];
preselect?: { subject: string | null; key: number }; // unknown value ignored
submit?: ContactClient['submit']; // injectable
messages?: Partial<ContactMessages>; // default nl
now?: () => number;
}): {
status: ContactStatus; values: ContactFields; errors: Partial<Record<keyof ContactFields, string>>;
getFieldProps(name: keyof ContactFields): { id; name; value; onChange; onBlur; 'aria-invalid'; 'aria-describedby' };
honeypot: { name: string; ref; tabIndex: -1; autoComplete: 'off' };
formProps: { onSubmit; noValidate: true };
focusFirstError(): void;
retry(): void;
};
```
## http
```ts
apiUrl(path: string): string; // VITE_API_BASE_URL ?? '' + path
parseProblemDetails(res: Response): Promise<{ status: number; errors?: Record<string, string[]>; retryAfter?: number }>;
```
@@ -0,0 +1,73 @@
# Components
Source layout (target):
```text
src/
cms-client/ # self-contained, movable to SlpModularCms (no imports from outside)
index.ts # barrel, but sites import subpaths
http/ # apiUrl, fetch helpers, ProblemDetails parsing
contact/ # headless contact form
offerings/ # (later) typed offerings client; types from OpenAPI
theme/ # variant x mode state (replaces red/purple)
shared/ # a11y/motion hooks, packages logic (filter, swipe), content
variants/
b/ # Modern (default, eager)
e/ # Time-travel (lazy chunk)
components/ # RootLayout shell, ErrorBoundary, analytics
routes/ , router.tsx # unchanged (hash history)
```
## Theme and switching
### ThemeProvider (changed)
- **Purpose**: owns `variant` ('b' | 'e') and `mode` ('light' | 'dark').
- **Responsibilities**: initial mode from stored value else `prefers-color-scheme`; persist only mode; write `data-variant` and `data-mode` on `<html>`; variant always starts as 'b' and is never persisted.
- **Interface**: `useTheme(): { variant, mode, toggleMode(), setVariant(v), toggleVariant() }`.
### ModeToggle (replaces ThemeToggle)
- **Purpose**: light/dark switch in the nav of both variants. Accessible name "Wissel tussen licht en donker", `aria-pressed` for dark.
### VariantToggle (new)
- **Purpose**: icon-only button next to ModeToggle; tooltip and accessible label ("Tijdreis" in B, "Terug naar nu" in E). Uses `toggleVariant`.
### VariantRenderer (new)
- **Purpose**: renders `LandingB` or the lazy `LandingE` depending on `variant`; `Suspense` fallback (small neutral loader); focus and scroll position reset when the variant changes; announces the change to screen readers (`aria-live`).
### tokens (changed)
- **Purpose**: CSS variable sets per `[data-variant][data-mode]` (B light/dark, E light/dark), semantic Tailwind color names kept (`bg`, `surface`, `text`, `muted`, `accent`, ...), plus variant-only tokens for E eras.
## Variant B (eager)
- **LandingB**: composition of NavB, HeroB, AboutB, PackagesB, ProcessB, ContactB, FooterB.
- **NavB**: wordmark, anchor links (no years), CTA, ModeToggle, VariantToggle, mobile menu.
- **HeroB / AboutB / ProcessB / FooterB**: presentational ports of the canvas design B using shared content.
- **PackagesB**: B styling of the packages block (square filter chips, cards, black "Past er niets bij?" banner), uses shared packages logic.
- **ContactB**: red contact block with white (light) / dark form panel; uses `ContactFormView` from the B skin.
## Variant E (lazy chunk)
- **LandingE**: eras in order 2026 → 2013 → 2006 → 1998 → 1989 with year badges; own nav bar style including ModeToggle and VariantToggle.
- **Era sections** (EHero2026, EAbout2013, EPackages2006, EProcess1998, EContact1989): presentational ports of design E; the 1998 Werkwijze uses the step-card layout; the 1989 terminal looks the same in both modes.
- **EffectsLayer**: marquee, scanlines, dither transitions, caret; all disabled via `usePrefersReducedMotion`.
## Shared (variant-independent)
- **content.ts** (kept): nav links (without years), hero, about, process, contact copy, package seed; E-only era captions live in `variants/e`.
- **usePackagesQuery** (kept): TanStack Query against `/api/v1/offerings`; type gains `category`.
- **usePackageFilter**: derives categories (order of first appearance), counts, current filter, filtered list; `showChips` when `packages.length >= 4`.
- **useSwipeRow**: scroll-snap helper for the mobile row (active index for dots, `scrollToIndex`, initial index = featured package); no JS needed for scrolling itself.
- **usePrefersReducedMotion**, **usePrefersDark** (media query helpers).
- **ContactPreselectContext**: `{ subject, key }`; the "Kies …" button of a package sets it (key increments on each click) and scrolls to the contact section.
## cms-client (movable package, headless)
- **contact/ContactFormState**: pure reducer + types (`editing | sending | sent | failed`).
- **contact/validateContact**: pure validation with limits (name 100, email 254, message 2000) and error codes (`required`, `tooLong`, `invalid`).
- **contact/useContactForm**: React hook tying state, validation, preselect (initial value + change key), `idPrefix`, honeypot, token handling and submit; returns prop getters and slots data. No markup, no styles.
- **contact/createContactClient**: fetch implementation of the API contract (`getToken`, `submit`) incl. ProblemDetails parsing, `Idempotency-Key`, 429 handling; submit function is injectable.
- **contact/messages.nl**: default Dutch messages (injectable/overridable).
- **http/**: `apiUrl()` honoring `VITE_API_BASE_URL`, shared error types.
## Form skins
- **ContactFormView (B)** and **ContactFormTerminal (E 1989)**: presentational components consuming `useContactForm` output; render honeypot slot (visually hidden, `aria-hidden`, `tabIndex=-1`), privacy line, status regions (`role=alert` on error, `role=status` + focus on success).
- **ContactGate** (optional): feature flag / env switch `VITE_CONTACT_FORM_ENABLED`; when off, shows the existing mailto fallback (address assembled client-side after mount, not in static HTML).
## Backend components (SlpModularCms, for hand-off; not built here)
- **Contact/Forms module**: endpoints, validation, storage, mail via `IEmailSender`, spam checks, rate-limit policy, retention job, per-site config.
- **Offerings module**: new optional `category` field.
@@ -0,0 +1,226 @@
# Contact Form & Offerings — Draft API Contract
**Version**: 0.3.1-draft (2026-11-09) — incorporates the reviews of `SLS Software - CMS` (API side), `CMS & API` (ASF website) and `AndreaSlopFotografie` (ASF CMS/hosting) and the product decisions of Bryan (admin view in scope, spam stored as `spam`, captcha fail-open).
**Status**: DRAFT for confirmation by the builders. Product decisions still open are marked **[Bryan]** (see § 10).
**Source of truth** once agreed: the OpenAPI document generated by the CMS (`AddOpenApi`/`MapOpenApi`), exported as a **committed artifact** in SlpModularCms so `cms-client` can generate types from it. This file carries the behaviour agreements and the intended shape.
**Compatibility**: breaking changes → `/api/v2`; additive changes allowed within `/api/v1`. The frontend package `cms-client` follows semver.
## 1. Scope
1. New `Contact/Forms` module (own DbContext + additive migration per host, own Module class, like `Modules.Offerings`): token endpoint, submit endpoint, admin endpoints, background jobs.
2. `GET /api/v1/offerings` gains the optional field `category`.
3. Per-site configuration (host-based: Api.SlpSoftware, Api.AndreaSlopFotografie, ...).
All paths are **same-origin** (`/api/v1/...`) through "the reverse proxy of the host" (nginx for SLP; ASF production will be IIS — do not hard-code nginx). No CORS. The site id is derived from the host/config, **never** from the request body.
**Availability gate — decided (Bryan, 2026-11-09)**: the statuses (CMS disabled / maintenance, set by the master) block **only the CMS**, i.e. changing data and settings through the admin. **Public content is always available.** The gate therefore applies to admin/CMS routes only; the public routes `GET /api/v1/offerings`, `GET /api/v1/contact-messages/token` and `POST /api/v1/contact-messages` must stay reachable (a visitor's contact request is public site functionality, not a CMS change). Today `AvailabilityMiddleware` returns `503` for everything under `/api/` (bypass list limited); the CMS must align this with the decision (public routes on the bypass list or gate limited to admin routes), and the bypass must never cover admin routes. The frontend still treats `503`/network errors as a failure with the **mailto fallback** as a safety net.
## 2. Public endpoints
### 2.1 `GET /api/v1/contact-messages/token`
Issues a server-signed token used for the minimum-time check, bound to the site. Tokens use **ASP.NET DataProtection** (key ring in the DB survives deploys), not a custom HMAC secret. The key ring must be **persistent per host** (DB or shared directory; on IIS it must survive app-pool recycles) and use a **per-site purpose string**, so an SLP token is invalid on ASF. (Already covered by the host-level `AddCmsDataProtection`, keys in the database; Contact only uses an `IDataProtector` with purpose `SlpModularCms.Contact.Token.{siteId}`; no own key ring or table.)
`200 application/json`
```json
{ "token": "<opaque signed string>", "minSeconds": 3, "captcha": null }
```
- `captcha` is `null` when disabled, else `{ "provider": "friendlycaptcha", "siteKey": "..." }`.
- Token carries issue time + site id; valid for e.g. 120 minutes. Not stored.
- Rate-limited; `429` with `Retry-After`.
- The client fetches the token **lazily after hydration, on first focus/interaction**, not on page load (prerender contains no token; crawlers do not use up the limit).
### 2.2 `POST /api/v1/contact-messages`
Headers: `Content-Type: application/json`, `Idempotency-Key: <uuid>` (required).
Request body:
```json
{
"name": "Jan Jansen",
"email": "jan@example.nl",
"subject": "website",
"message": "Ik wil graag een offerte voor …",
"hpCheck": "",
"token": "<from 2.1>",
"captchaToken": null
}
```
| Field | Type | Required | Rules |
|---|---|---|---|
| `name` | string | yes | trimmed, 1–100 chars; control characters rejected |
| `email` | string | yes | trimmed, 1–254 chars, regex `^[^\s@]+@[^\s@]+\.[^\s@]{2,}$`, no control characters |
| `subject` | string | yes | trimmed, 1–100 chars; **opaque value** chosen by the site (a package id, slug, or `other`); no slug regex; stored as given, never validated against offerings. The label of `other` is per site (ASF: "Overig"). |
| `message` | string | yes | trimmed, 1–2000 chars |
| `hpCheck` | string | yes (key present) | **honeypot**; must be empty. Deliberately implausible name (not `website`/`url`) to avoid password-manager autofill; field is configurable per site; render with `autocomplete="off"`, `tabindex="-1"`, `aria-hidden`, off-screen |
| `token` | string | yes | from 2.1 |
| `captchaToken` | string \| null | when `captcha` enabled | verified server-side |
Responses:
- `202 Accepted` — `{ "status": "received" }`. **Identical body and status for genuine and spam submissions** (honeypot filled, token too young, captcha failed) so bots learn nothing. Replays with the same `Idempotency-Key` (24 h) return the same 202 without storing twice.
- `400 application/problem+json` — validation errors (§ 3): field validation; **expired, forged or other-site token** (all answered as `errors.token: ["expired"]`, so the endpoint is no oracle; the client fetches a fresh token and retries once automatically); missing or non-UUID `Idempotency-Key` (`errors.idempotencyKey: ["required" | "invalid"]`).
- `413 application/problem+json` — body too large (`MaxRequestBodySize` per endpoint, e.g. 16 KB, with our own ProblemDetails shape).
- `429 application/problem+json` — rate limit; header `Retry-After: <seconds>` (the existing `OnRejected` sets neither body nor `Retry-After` yet). This is a **separate, first-executed CMS unit**: it changes the behaviour of existing policies (login/refresh/sentry-tunnel), the admin frontend must cope with it and `PipelineTests` need adjusting. `Retry-After` comes from `MetadataName.RetryAfter` (available for fixed/sliding window limiters).
- `503` — should not occur for the public routes (see § 1); if it does (e.g. host down behind the proxy), the client shows the mailto fallback.
- `5xx application/problem+json` — generic; no internal detail.
## 3. Error shape (ProblemDetails)
```json
{
"type": "about:blank",
"title": "Validation failed",
"status": 400,
"errors": { "name": ["required"], "email": ["invalid"], "message": ["tooLong"] }
}
```
The `type` URI is configurable per host (`Contact:ProblemTypeBase`), default `about:blank`, so no site domain is hard-coded in a module used by two sites; clients map on `errors`, never on `type`. Codes: `required`, `tooLong`, `invalid`, `expired` (token only; also for forged/other-site tokens). The `errors` mapping is custom (not the default ASP.NET `ValidationProblemDetails`). Messages are **not** localized by the API; the client maps `messages[field][code]`. Client-side validation uses the same limits and codes.
## 4. Server behaviour agreements
1. **Store first, mail after commit.** Validate → store and commit (`status: new`, `mailStatus: pending`) → respond 202. Mail is **not fire-and-forget** in the request scope: a `BackgroundService`/queue picks up `pending` rows, sends via `IEmailSender`/`IMailAvailability` (returns `MailSendResult`, does not throw) and updates `mailStatus` and `mailAttempts`. A short sweep (every few minutes) catches `pending` rows left by a crash; `failed` rows are retried with **backoff** up to a configurable max attempts (so a first outage does not mean 24 h delay). A mail failure never fails the request. If `Email:Smtp:Host` is not configured: store only, show a notice in the admin.
2. **Stored entity `ContactMessage`**: `id` (GUID), `siteId`, `receivedAt`, `name`, `email`, `subject`, `message`, `status` (`new` | `read` | `archived` | `spam` [Bryan] | later `converted`), `mailStatus` (`pending` | `sent` | `failed` + the existing error code, e.g. `auth_failed`, `rejected_sender`, `timeout_*`), `mailAttempts`, `retentionUntil` (fixed per row at insert; a config change does **not** apply retroactively). `id` and `status` exist so a message can later become an assignment for quotes/invoices (**not built now**). No IP address is stored.
3. **Retention**: per site, default **12 months**; a daily `BackgroundService` (pattern: `IntegrityCheckBackgroundService`) deletes messages with `retentionUntil < now` and idempotency records older than 24 h. Database backups may keep messages longer: mention in the privacy statement or shorten backup retention. The admin can delete a single message (right to erasure).
4. **Spam** (captcha behind an `ICaptchaVerifier` interface with a Null implementation when disabled): honeypot must be empty; elapsed time since token issue ≥ `minSeconds`; optional captcha verified server-side; rate limit policy `ContactForm` (defaults, config `RateLimiting:ContactForm`: 5 submissions per 10 minutes per client IP; token endpoint 20 per 10 minutes). Spam is answered with the normal 202. **Decided (Bryan):** instead of discarding, honeypot/too-young submissions are stored with `status: spam` (never mailed, retention 30 days) so a real visitor who tripped the check (autofill, very fast typist) is not lost silently; the visitor still sees the normal thank-you. **Cap on spam rows** (suggestion of `AndreaSlopFotografie` and `SLS Software - CMS`): per site at most N spam rows per day (default e.g. 200; `Contact:MaxSpamRowsPerDay`); above N the submission still gets the normal 202 but is only counted and logged, not stored. Spam rows are excluded from the unread counter and hidden from the default admin list (separate filter), so spam content is never shown first. Spam rows are stored with `retentionUntil = receivedAt + 30 days`, so the retention job works on each row's own `retentionUntil`. Timing: spam may be slightly faster (skips mail); accepted consciously. **Captcha provider failure** (timeout/5xx of the verify endpoint): **decided fail-open** with a log entry. Captcha ships **disabled** (honeypot + time + rate limit); it is a per-site switch for when abuse appears.
5. **Client IP**: **release prerequisite** — on CMS master (`d9cc539`) the rate-limit policies are plain global buckets; the per-client partitioning (`ClientPartitionKey`) and `ForwardedHeaders` exist only on the unmerged ASF branch `feature/identity-email-notifications`. A `ContactForm` policy of 5 per 10 minutes as a global bucket would block the whole site after five submissions, so the contact routes must not be enabled on a public host before the per-client partitioning is on the base branch. The rate limit needs `ForwardedHeaders:KnownProxies` on each host (set on the test hosts; ASF production on IIS will differ), otherwise all visitors share one bucket (5 per 10 minutes for the whole site).
6. **Privacy / logging**: never log `name`, `email`, `message` or the request body for this route; the Sentry SDK request body/PII is explicitly off for it (`BeforeSend` scrubbing; extra rule in the existing `SecurityEventProcessor`; a test proves a logged exception holds no body); client side: no form fields in Sentry breadcrumbs or replay (masked). Log only status codes, site id and outcome. Configuration errors of the mail setup are logged as Error (so the Sentry rule fires) in the style of `identity_mail_failed`, without addresses or content.
7. **Idempotency**: table (`key`, `siteId`, `createdAt`, `statusCode`; no request content, no PII), unique index, cleaned after 24 h by the retention job; in-memory is not enough. Spam submissions also get a key record so replay behaviour is identical. Same key → same response, no second row, no second mail.
8. **Mail safety**: `From` = fixed site sender on `Email:AllowedFromAddresses`; `Reply-To` = visitor e-mail (never as `From`: SPF/DMARC). Reject/strip control characters (`EmailAddressRules` exists) in `name`, `email`, `subject` before use in mail headers; HTML-encode all values in the body; never put `subject` 1:1 in the mail subject line (sanitize, cut at 100). The recipient address never appears in client-reachable config or in OpenAPI examples.
9. **Availability gate / 503**: see § 1.
10. **CSP** (frontend/host): `connect-src 'self'` suffices for the same-origin API. A captcha provider needs more (per provider and version, e.g. Friendly Captcha v1 `api.friendlycaptcha.com`/`eu-api.friendlycaptcha.eu`, v2 `global.frcapi.com`; widget script via npm bundle = `'self'`, else `script-src`; possible `'wasm-unsafe-eval'`, `worker-src blob:`, inline styles). The module documents the required directives per provider/version; the site adds them and tests in a real browser. The captcha provider must be named in the privacy statement.
## 5. Per-site configuration
Server (appsettings per host, `Contact:` section):
| Setting | Example | Notes |
|---|---|---|
| `Contact:Enabled` | `false` | **safety switch** (release condition, § 4.5): while `false` both public contact routes answer `404` with an empty body and nothing runs; the client treats `404` on the token route as "form not available" and shows the mailto fallback. Enabled per host after the per-client rate-limit partitioning is on the base branch |
| `Contact:RecipientEmail` | — | never exposed to the client. ASF: **env-only** (no ASF addresses in code or committed config); SLP may keep a committed default |
| `Contact:SenderEmail` | — | must be on `Email:AllowedFromAddresses`; env-only for ASF |
| `Contact:RetentionMonths` | `12` | |
| `Contact:MinSeconds` | `3` | |
| `Contact:TokenLifetimeMinutes` | `120` | |
| `Contact:Captcha:Enabled / Provider / SiteKey / Secret` | `false` | secret via secrets manager |
| `RateLimiting:ContactForm` | 5 / 10 min | |
Frontend per-site options (not API): subject options and labels (incl. the label of `other`), reply-time text, **privacy sentence and link target** (ASF: "Lees in de privacyverklaring wat ik met je gegevens doe." → `/privacyverklaring`), per-field message texts.
## 5a. Form fields and on/off switch (decided by Bryan, 2026-11-09)
- **Fixed fields** for now (name, email, subject, message). A form builder with per-site field definitions is **not** part of this feature; it can come later as its own feature (field definitions as CMS data). The model stays extendable (additive migrations, contract versioned).
- **Two-layer switch**: (1) host level `Contact:Enabled` (deployment, default off, release condition § 4.5); (2) a CMS switch for the owner: singleton resource `GET /api/v1/contact-settings` and `PUT /api/v1/contact-settings` (AdminOnly, body `{ "enabled": true|false }`, stored as data, default `false`). The form is active only when **both** are on. When either is off, `GET .../token` and `POST .../contact-messages` answer `404` with an empty body and the client shows the mailto fallback. Admin screen "Berichten" gets a visible switch ("Contactformulier aan/uit"). Implemented in CMS-U4 (API) and CMS-U6 (UI); CMS-U3 builds the gate behind an interface so U4 adds the CMS switch without rewriting the filter.
## 6. Admin endpoints (CMS) — decided: in scope, full version
AdminOnly (Owner + Administrator). Module appears in `/System/capabilities` so the admin menu "Berichten" only shows on hosts with the module.
**Decided by Bryan (2026-11-09): RESTful routes without an `/admin` segment.** That an admin may use an endpoint does not require a separate admin route: the same resource is used by everyone, access is controlled by the authorization policy (AdminOnly = Owner + Administrator) and, for public endpoints, by the `[PublicSiteEndpoint]` marker. This supersedes both `/api/v1/admin/contact-messages` and `/api/v1/contact-messages/admin`.
- `POST /api/v1/contact-messages` — **public** (submit, § 2.2). `GET /api/v1/contact-messages/token` — **public** (§ 2.1); the `{id}` routes use the constraint `{id:guid}` so `token` never collides.
- `GET /api/v1/contact-messages` — AdminOnly: list with paging; filter `?status=new|read|archived|spam` (default excludes `spam`); the response carries the unread count (spam excluded).
- `GET /api/v1/contact-messages/{id:guid}` — AdminOnly: detail.
- `PATCH /api/v1/contact-messages/{id:guid}` — AdminOnly: status `new`/`read`/`archived`.
- `DELETE /api/v1/contact-messages/{id:guid}` — AdminOnly: **hard delete** (no soft delete), for erasure requests.
- `POST /api/v1/contact-messages/{id:guid}/resend` — AdminOnly: resend mail; itself rate-limited (policy `RateLimiting:ContactResend`, no mail-bomb button); `mailStatus` and error code visible.
- The public client (`cms-client`) only uses the two public routes.
- Offerings: categories are CMS data with RESTful CRUD under `/api/v1/offerings/categories` (AdminOnly), see § 7 (not `offerings/admin/categories`, and no longer an appsettings list). Existing `offerings/admin...` routes are out of scope for this feature (see the open item on a later RESTful refactor).
- Spam rows: excluded from the unread counter and the default list; separate filter.
## 7. Offerings change
**Decided by Bryan (2026-11-09, supersedes the appsettings list):** categories are **data managed in the CMS**, not settings. They are part of Offerings: a sub-section/dialog inside the Offerings admin screen (not a new page). Bryan starts with the categories **Websites** and **Onderhoud** (he currently offers complete packages and new builds; takeover/"overname" is not decided yet), created by him in the CMS (not seeded in code).
Model: `OfferingCategory` (`id`, `name`, `sortOrder`), unique name (case-insensitive), nullable `categoryId` on `Offering`. Routes (RESTful, no `/admin`): `GET /api/v1/offerings/categories` (AdminOnly; list), `POST /api/v1/offerings/categories`, `PUT /api/v1/offerings/categories/{id:guid}`, `DELETE /api/v1/offerings/categories/{id:guid}` (all AdminOnly). Deleting a category that is still used by offerings is rejected (`409` ProblemDetails) until those offerings are moved. Offering create/update accept `categoryId` (must exist) instead of free text; renaming a category updates every offering through the relation. Admin read DTOs carry `categoryId` and `category` (name).
Public `GET /api/v1/offerings` item gains `"category": "Websites"` — the category **name** as string or `null` (shape unchanged for the frontend). `null`/empty → no chip. The public response also carries the additive fields `categoryId` (GUID string or null) and `displayOrder` (int); the SLP site ignores both. Decision (CMS-U0, 2026-11-09): **one URL and one DTO for everybody** (`GET /api/v1/offerings`; the former admin DTO is removed); writes are `POST /api/v1/offerings`, `PUT|DELETE /api/v1/offerings/{id:guid}` and `PUT /api/v1/offerings/order` (`{ "orderedIds": [...] }`), all AdminOnly. The frontend builds chips from distinct non-empty values in order of first appearance, counts itself, and shows chips only when there are **4 or more** packages. Existing fields unchanged (see `aidlc-docs/features/react-frontend/construction/react-frontend-app/functional-design/packages-api-handoff.md`). Array order = display order; exactly one `featured: true`. Independent of the form; can start immediately.
## 8. OpenAPI sketch (intended shape; the CMS exports the definitive document)
```yaml
openapi: 3.0.3
info: { title: SLP CMS public API, version: 0.2.0-draft }
paths:
/api/v1/contact-messages/token:
get:
responses:
'200': { description: token, content: { application/json: { schema: { $ref: '#/components/schemas/ContactToken' } } } }
'429': { $ref: '#/components/responses/RateLimited' }
/api/v1/contact-messages:
post:
parameters:
- { name: Idempotency-Key, in: header, required: true, schema: { type: string, format: uuid } }
requestBody:
required: true
content: { application/json: { schema: { $ref: '#/components/schemas/ContactMessageRequest' } } }
responses:
'202': { description: received, content: { application/json: { schema: { $ref: '#/components/schemas/Received' } } } }
'400': { $ref: '#/components/responses/Validation' }
'413': { $ref: '#/components/responses/TooLarge' }
'429': { $ref: '#/components/responses/RateLimited' }
components:
responses:
Validation:
description: validation failed (also expired/forged token and bad Idempotency-Key)
content: { application/problem+json: { schema: { $ref: '#/components/schemas/ValidationProblem' } } }
TooLarge:
description: body too large
content: { application/problem+json: { schema: { $ref: '#/components/schemas/Problem' } } }
RateLimited:
description: too many requests
headers: { Retry-After: { schema: { type: integer }, description: seconds } }
content: { application/problem+json: { schema: { $ref: '#/components/schemas/Problem' } } }
schemas:
Problem:
type: object
properties: { type: { type: string }, title: { type: string }, status: { type: integer } }
ValidationProblem:
allOf:
- $ref: '#/components/schemas/Problem'
- type: object
properties:
errors:
type: object
additionalProperties: { type: array, items: { type: string, enum: [required, tooLong, invalid, expired] } }
ContactToken:
type: object
required: [token, minSeconds]
properties:
token: { type: string }
minSeconds: { type: integer }
captcha: { type: object, nullable: true, properties: { provider: { type: string }, siteKey: { type: string } } }
ContactMessageRequest:
type: object
required: [name, email, subject, message, hpCheck, token]
properties:
name: { type: string, minLength: 1, maxLength: 100 }
email: { type: string, minLength: 1, maxLength: 254 }
subject: { type: string, minLength: 1, maxLength: 100 }
message: { type: string, minLength: 1, maxLength: 2000 }
hpCheck: { type: string, maxLength: 0 }
token: { type: string }
captchaToken: { type: string, nullable: true }
Received:
type: object
properties: { status: { type: string, enum: [received] } }
```
## 9. Frontend package expectations (`cms-client`, headless, by subpath)
- `cms-client/contact`: `useContactForm`, `contactFormReducer`, `validateContact`, `createContactClient`, types, default Dutch messages.
- **Messages**: `messages[field][code]` with Dutch defaults **identical to the ASF texts** ("Vul je naam in.", "De naam is te lang.", "Vul je e-mailadres in.", "Het e-mailadres is te lang.", "Dit e-mailadres is ongeldig.", "Kies een soort shoot." → generic "Kies een onderwerp.", "Schrijf hier je vraag.", "Het bericht is te lang."), plus texts for 429 (shows "probeer het over X minuten" from `Retry-After`), 413, network/5xx/503, expired token. Fully overridable per site.
- **Field ids**: derived from `idPrefix` + logical field name; a site can keep its own DOM names, ids and test ids; payload mapping lives in the client, not in the site.
- **Idempotency-Key**: one UUID per attempt series; reused on "opnieuw proberen" until success; a new key after success/reset; provided by the hook.
- **States**: `editing | sending | sent | failed` pure reducer; `sent` never reverts; edits and second submit while `sending` are ignored; input kept on `failed`. Spam gets the same 202, so there is one success path. The submit button is **not** blocked for `minSeconds`; the server answers early submissions with the normal 202 and stores them as `spam` (never mailed).
- **Token**: fetched lazily after hydration on first focus/interaction; on `errors.token = ["expired"]` one fresh token and an automatic repeat, then the error message. No `Date.now` on the client.
- **Preselect**: `{ subject, key }` with change counter; unknown value ignored; the site reads the query string.
- **Captcha slot**: slot data `{ provider, siteKey, onToken(token), onExpired() }`; the site renders the widget client-only after hydration, reserves a fixed height (no layout shift), puts no captcha HTML in prerendered output, resets the widget when the token expires; with `captcha: null` the slot renders nothing and takes no space.
- **Fallback**: on failure the hook returns `{ failed: true }`; the site renders the mailto fallback without the address in static HTML (assembled after hydration).
- **Honeypot slot**: field name configurable (`hpCheck` default).
- **Boundary**: no imports from the consuming app. Developed first in `slp-software-frontend/src/cms-client/` (decision of the user), then moved to SlpModularCms. `cms-client/offerings` (typed client from OpenAPI) follows later.
## 10. Open items
- [x] **[Bryan, decided 2026-11-09]** Admin view for contact messages is in scope, full version (list with paging and unread count, detail, status new/read/archived, delete, resend mail).
- [x] **[Bryan, decided 2026-11-09]** Honeypot/too-fast submissions are stored with `status: spam` (30 days, never mailed).
- [x] **[Bryan, decided 2026-11-09]** Captcha provider failure: fail-open; captcha ships disabled.
- [x] **[Bryan, decided 2026-11-09, revised]** Categories are data managed in the CMS inside the Offerings admin (sub-section, not a new page), not an appsettings list. Starting categories: Websites and Onderhoud. (The earlier decision "fixed list in appsettings" is superseded.)
- [ ] `SLS Software - CMS`: confirm the build plan incl. `Retry-After` in `OnRejected`, own ProblemDetails mapping, DataProtection tokens, idempotency table, retry job, `AvailabilityMiddleware` aligned with the decision "only the CMS/admin is blocked, public content stays available" (public offerings + contact routes reachable, admin routes still gated), capabilities entry.
- [ ] `CMS & API`: decide `other` (label per site) vs ASF `overig`; plan the ASF migration to `cms-client` as an own ASF-web feature (not part of this feature; existing ContactForm/reducer tests can serve as acceptance tests).
- [ ] Host: `ForwardedHeaders:KnownProxies` per host; reverse-proxy route `/api/v1/` for test and production (nginx for SLP, IIS for ASF production).
- [x] **[Bryan, decided 2026-11-09]** Existing routes with an `/admin` segment are refactored to RESTful routes **now, in this feature** (Bryan maintains both websites and prefers doing it now): Offerings (`GET/POST offerings/admin`, `PUT/DELETE offerings/admin/{id}`, `admin/reorder`, `admin/{id}/move-up|down`) in phase 1 together with the admin-frontend call sites and tests, before the category work; `Availability` `POST admin/status` in phase 2 after the merge of the ASF branch (that branch touches Availability and master/slave callers must be checked).
- [x] Reviews received 2026-11-09: `SLS Software - CMS`, `CMS & API`, `AndreaSlopFotografie`; folded into v0.2.0 and v0.3.x.
## 10a. Notes for the CMS builder on the availability gate (from review)
- The latest commit on the CMS branch (`701091f`, "Beschikbaarheidspoort blokkeert alleen de API, niet de website en de admin") touches the same middleware: build on it; limiting the gate to admin/CMS routes is a second step, not a rewrite.
- Prefer an **explicit allowlist of public routes** (offerings GET, contact token GET, contact POST) over a prefix exception, so a new admin endpoint can never fall under the bypass by accident; add a test proving that every endpoint without `[PublicSiteEndpoint]` (iterating all endpoints, including all admin routes) still returns 503 when the gate is closed. (Replaces the earlier prefix test `/api/v1/admin/*`; the repo has no common admin prefix.)
## 11. Suggested CMS build order (from the review; build only after Bryan confirms the whole)
(a) `category` on Offerings (migration on existing SLP and ASF databases; field in admin forms and tests); (b) `OnRejected` / `Retry-After` / ProblemDetails unit (existing policies, `PipelineTests`); (c) Contact module: storage, token, submit, idempotency, spam checks; (d) mail background service + retry; (e) admin API; (f) admin UI. Build and test per unit.
@@ -0,0 +1,26 @@
# 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.
@@ -0,0 +1,47 @@
# Unit Dependencies
## Matrix
| Unit | Depends on | Blocks |
|---|---|---|
| U1 theme-foundation | — | U2, U3, U4, U5 |
| U2 b-modern-sections | U1 | U3, U4 (container frames) |
| U3 packages-block | U1, U2 | U4 (preselect), U5 (shared packages logic) |
| U4 contact-form | U1, U2, U3 (preselect context) | U5 (`cms-client` reused by the terminal skin) |
| U5 e-timetravel | U1, U3, U4 | — |
| X-a category | — | U3 real data (soft) |
| X-b gate + rate limit | — | U4 end-to-end test (soft) |
| X-c contact module | X-b (marker) | U4 end-to-end test |
| X-d mail + retry | X-c, merge of ASF branch | owner notification in production (not frontend) |
| X-e admin API | X-c | X-f |
| X-f admin UI | X-e, merge of ASF branch | — |
## Diagram
```mermaid
graph TD
U1[U1 theme-foundation] --> U2[U2 b-modern-sections]
U2 --> U3[U3 packages-block]
U3 --> U4[U4 contact-form]
U4 --> U5[U5 e-timetravel]
Xa[X-a category] -.soft.-> U3
Xb[X-b gate and rate limit] --> Xc[X-c contact module]
Xc -.end to end.-> U4
Xc --> Xd[X-d mail and retry]
Xc --> Xe[X-e admin API]
Xe --> Xf[X-f admin UI]
Merge[(merge of ASF branch decided by Bryan)] -.-> Xd
Merge -.-> Xf
classDef fe fill:#63b3ed,stroke:#2b6cb0,color:#000;
classDef cms fill:#9ae6b4,stroke:#2f855a,color:#000;
classDef gate fill:#f6e05e,stroke:#c05621,color:#000;
class U1,U2,U3,U4,U5 fe;
class Xa,Xb,Xc,Xd,Xe,Xf cms;
class Merge gate;
```
Text alternative: frontend units run in sequence U1 to U5; CMS units run in parallel, with the form unit's end-to-end test depending on the contact module and mail and admin UI waiting for the merge of the ASF branch.
## Integration points and checkpoints
- **Contract**: `contact-api-contract.md` v0.3.1 (source of truth, OpenAPI exported by the CMS later).
- **Checkpoint 1 (after U3)**: packages with mock data of 3 and 6, swipe row on a phone viewport.
- **Checkpoint 2 (after U4)**: form against mock server; contract tests; notify the CMS builder if the contract needs changes.
- **Checkpoint 3 (Build and Test)**: end-to-end against a test host once X-b and X-c are deployed there.
- **Rollback**: each unit is its own commit; the form is behind `VITE_CONTACT_FORM_ENABLED`; E is a separate lazy chunk.
@@ -0,0 +1,36 @@
# Requirement-to-Unit Map
User Stories were skipped (single visitor persona, detailed requirements). Requirements are mapped to units instead.
| Requirement | Summary | Unit(s) |
|---|---|---|
| FR-1 | Design B default site | U2 (+U3, U4 parts) |
| FR-2 | Variant E full, five eras | U5 |
| FR-3 | Theme model variant × mode, accents | U1 |
| FR-4 | Mode switch + icon-only variant button | U1 |
| FR-5 | System preference, persisted mode, variant not remembered | U1 |
| FR-6 | E lazy-loaded | U1 (boundary), U5 (content) |
| FR-7 | Any number of packages | U3 |
| FR-8 | Chips from 4 packages, category from API | U3, X-a |
| FR-9 | Maatwerk banner | U3, U5 |
| FR-10 | Mobile swipe row | U3 |
| FR-11 | Extra package content out of scope; mock data | U3 (tests) |
| FR-12 | Packages styling B and E | U3 (B), U5 (E) |
| FR-13 | Form fields, all required, limits | U4 |
| FR-14 | Submit to CMS, store, mail, 12 months | U4 (client), X-c, X-d |
| FR-14a | Future: message to assignment | none (out of scope; data model leaves room in X-c) |
| FR-15 | Form states | U4 |
| FR-16 | Spam protection | U4 (client), X-c |
| FR-17 | Privacy sentence, per-site config | U4 |
| FR-18 | Reusable cms-client package | U4 (first version), moves to SlpModularCms later |
| FR-19 | Form skins B and E | U4 (B), U5 (E) |
| NFR-1 | WCAG AA, reduced motion | all; verified in U1, U3, U4, U5 |
| NFR-2 | Responsive | U2, U3, U5 |
| NFR-3 | Performance, fonts, code split | U1, U5 |
| NFR-4 | Security baseline | U4 (+ X-b, X-c) |
| NFR-5 | Privacy | U4, X-c |
| NFR-6 | Testing, PBT partial | all; PBT in U4 |
| NFR-7 | Maintainability | U1 |
| NFR-8 | Compatibility | all |
All FR/NFR are assigned. Open external items are tracked in `unit-of-work.md` (X-a..X-f).
@@ -0,0 +1,51 @@
# Units of Work
**Code organization**: brownfield monolith SPA (Vite/React/TS) in the workspace root `src/`; no new deployable services. Target layout is described in `components.md`. Application code never goes in `aidlc-docs/`.
## Frontend units (this repo)
### U1 — theme-foundation
- **Purpose**: replace red/purple with variant (B|E) × mode (light|dark).
- **Responsibilities**: `ThemeProvider` (mode from system preference + persisted choice; variant app-state only, always starts in B), tokens as CSS variable sets per `[data-variant][data-mode]`, `ModeToggle`, icon-only `VariantToggle`, `VariantRenderer` (B eager, E lazy placeholder), removal of old themes and storage key migration, self-hosted fonts for B, `usePrefersReducedMotion`/`usePrefersDark`, tests.
- **Design stages**: Functional Design (theme state rules). NFR: covered by requirements.
- **Requirements**: FR-3, FR-4, FR-5, FR-6 (shell), NFR-1 (focus/aria for toggles), NFR-3 (fonts), NFR-7.
### U2 — b-modern-sections
- **Purpose**: design B default site (light and dark), without packages and form internals.
- **Responsibilities**: NavB, HeroB, AboutB (photo, existing WebP variants), ProcessB ("Van idee naar live in drie stappen" progress bar), FooterB, contact block frame (red block, white/dark panel container), section anchors without years in the menu, B accent `#7A1414`, responsive 360px-1440px+, tests.
- **Design stages**: none (design exists in the canvas).
- **Requirements**: FR-1, NFR-1, NFR-2.
### U3 — packages-block
- **Purpose**: generic packages block for B.
- **Responsibilities**: `PackageCardData.category`, `usePackageFilter` (chips from 4+ packages, counts, order of first appearance), `useSwipeRow` (mobile scroll-snap row, ~85% card width, dots, featured first), skeleton for any count, banner "Past er niets bij?", "Kies …" button feeding `ContactPreselectContext`, mock data for 6 packages in tests, tests.
- **Design stages**: Functional Design (filter and swipe behaviour).
- **Requirements**: FR-7, FR-8, FR-9, FR-10, FR-11, FR-12 (B part), NFR-1, NFR-2.
- **External dependency**: X-a (`category` in the API) for real data; works without (no category → no chips).
### U4 — contact-form
- **Purpose**: working contact form in B and the movable headless package.
- **Responsibilities**: `src/cms-client/` (`http`, `contact`: reducer, validation, `useContactForm`, `createContactClient`, default messages), import-boundary lint rule, `ContactFormView` (B skin), privacy sentence, honeypot/idempotency/token handling, mailto fallback with feature flag `VITE_CONTACT_FORM_ENABLED`, CSP/connect-src notes, Sentry/Umami scrubbing, PBT for pure functions (partial), tests incl. contract tests against a mock server.
- **Design stages**: Functional Design, NFR Requirements, NFR Design, Infrastructure Design (nginx route, CSP, env). Security Baseline enforced.
- **Requirements**: FR-13..FR-19, NFR-4, NFR-5, NFR-6.
- **External dependencies**: contract v0.3.x; X-b/X-c (rate limit, contact endpoint) for end-to-end; X-d (mail) and X-e (admin) are not needed for the frontend.
### U5 — e-timetravel
- **Purpose**: variant E in full, lazy-loaded.
- **Responsibilities**: `LandingE` with eras 2026/2013/2006/1998/1989, year badges, Win98 Werkwijze step cards, packages 2006 style (glossy tabs/cards, star badge, "Maatwerk!" banner), terminal form skin (`ContactFormTerminal`) on `cms-client`, light/dark tokens, EffectsLayer (marquee, scanlines, dither, caret) fully disabled under reduced motion, E fonts only in the E chunk, tests (render per era, reduced motion, variant switch round-trip).
- **Design stages**: NFR Requirements and NFR Design (performance with effects, accessibility). No Functional Design (design exists).
- **Requirements**: FR-2, FR-12 (E part), FR-19 (E part), NFR-1, NFR-2, NFR-3.
## External units (CMS builder, SlpModularCms — feature `contact-forms-module`)
| Id | Content | Base |
|---|---|---|
| X-0 | RESTful refactor of the existing Offerings routes (no `/admin` segment) incl. admin-frontend call sites and tests (CMS-U0) | master |
| X-a | `category` on Offerings as CMS-managed data (`OfferingCategory` CRUD, FK on Offering) + categories sub-section and dropdown in the Offerings admin (CMS-U1, CMS-U1b) | master |
| X-b | `OnRejected` with `Retry-After` + ProblemDetails; `[PublicSiteEndpoint]` marker for the availability gate | master |
| X-c | Contact module: token, submit, idempotency, spam, retention fields (mail behind own interface) | master |
| X-d | Mail with retry job (new `MailKind`) | after merge of `feature/identity-email-notifications` + rebase |
| X-e | Admin API (list/detail/status/delete/resend) | master |
| X-f | Admin UI "Berichten" | after merge + rebase |
| X-g | RESTful `Availability` status route (PUT instead of `POST admin/status`), callers checked | after merge + rebase |
Frontend integration with the real API happens in Build and Test once X-b/X-c exist on a test host.
@@ -0,0 +1,42 @@
# Application Design Plan — redesign-modern-timetravel
## Steps
- [x] Analyze context (requirements.md, execution-plan.md, RE artifacts, replies from SLS Software - CMS and CMS & API)
- [x] Resolve design questions (asked interactively in chat at the user's request, answers below)
- [x] Generate components.md
- [x] Generate component-methods.md
- [x] Generate services.md
- [x] Generate component-dependency.md
- [x] Generate contact-api-contract.md (draft contract for the CMS sessions)
- [x] Generate application-design.md (consolidated)
- [x] Validate design completeness and consistency
## Design Questions and Answers (asked interactively, 2026-11-09)
## Question 1 — How do B and E share content and logic?
- A) Shared layer + separate presentation per variant (E lazy-loaded)
- B) Two fully separate component trees
- C) One component set, variant via CSS only
- X) Other
[Answer]: A
## Question 2 — Is the variant visible in the URL?
- A) App state only; always start in B; E stays a surprise
- B) Shareable link to E (e.g. `/#/?v=tijdreis`); still not remembered
- X) Other
[Answer]: A
## Question 3 — How is the form UI built before the cms-client package exists?
- A) Contract adapter + mock; replace when the CMS repo delivers the package
- B) Pre-build the headless form logic here (based on the ASF form), then hand over to the CMS repo
- C) Wait for the package (start U4 later)
- X) Other
[Answer]: B
## Decisions derived from the answers
- Q1-A: shared `content`, data hooks and form logic; per-variant presentational components under `src/variants/b` and `src/variants/e`; `React.lazy` boundary for E.
- Q2-A: variant lives only in React context; no URL parameter; not persisted. Only the mode (light/dark) is persisted.
- Q3-B: the headless form logic is written **in this repo** inside a self-contained folder `src/cms-client/` (subpaths `contact/`, later `offerings/`), with an enforced import boundary (it may not import from the rest of the app), so it can be moved to SlpModularCms as the package `cms-client` without rewriting. `SLS Software - CMS` builds the API module and takes over the package afterwards; the API contract in `contact-api-contract.md` is the shared source of truth until then.
@@ -0,0 +1,162 @@
# Execution Plan — redesign-modern-timetravel
## Detailed Analysis Summary
### Transformation Scope (Brownfield Only)
- **Transformation Type**: Multi-component application change (frontend re-theme + new capability) with a cross-repo dependency (CMS/API).
- **Primary Changes**: Replace the red/purple dark theme with variant (B/E) × mode (light/dark); rebuild all landing sections to design B; build variant E (five eras) as a lazy-loaded alternative; generic packages block with filter and mobile swipe row; contact form with headless module.
- **Related Components**: this repo (`slp-software-frontend`); SlpModularCms (endpoint, `category` field, headless form package); consumer sites such as AndreaSlopFotografie (own `ContactForm` today).
### Change Impact Assessment
- **User-facing changes**: Yes — complete visual redesign, new variant switch, new form, new mobile packages UX.
- **Structural changes**: Yes — theme model, route/variant composition with lazy E bundle, new form module boundary.
- **Data model changes**: Yes — `PackageCardData.category`; new contact message entity (CMS side).
- **API changes**: Yes — new `POST /api/v1/contact-messages`; extended `GET /api/v1/offerings`.
- **NFR impact**: Yes — security (PII, spam, rate limiting), accessibility (WCAG AA, reduced motion), performance (code split, fonts).
### Component Relationships
```mermaid
graph TD
FE[slp-software-frontend - PRIMARY, major] --> API[SlpModularCms API - endpoint and category, major]
FE --> Mod[Headless form package - from SlpModularCms, major]
Mod --> API
Andrea[AndreaSlopFotografie and other sites - consumers, later] --> Mod
FE --> Nginx[nginx proxy and CSP - config only]
classDef primary fill:#63b3ed,stroke:#2b6cb0,color:#000;
classDef ext fill:#f6e05e,stroke:#c05621,color:#000;
classDef cfg fill:#9ae6b4,stroke:#2f855a,color:#000;
class FE primary;
class API,Mod,Andrea ext;
class Nginx cfg;
```
Text alternative: the frontend depends on the CMS API and on the headless form package that the CMS repo ships; other sites consume the same package; nginx and CSP need configuration changes.
| Component | Change type | Reason | Priority |
|---|---|---|---|
| slp-software-frontend | Major | redesign, theme model, form UI | Critical |
| SlpModularCms API | Major | contact endpoint, `category` | Critical (form), Important (category) |
| Headless form package (SlpModularCms) | Major | agreed reusable module | Critical (for form unit) |
| nginx / CSP | Configuration-only | API route, fonts | Important |
| Other sites (Andrea etc.) | Minor, later | adopt module | Optional (out of this feature) |
### Risk Assessment
- **Risk Level**: Medium-High (large visual scope, cross-repo contract, PII handling)
- **Rollback Complexity**: Easy for the frontend (branch/PR revert, hash-routed static bundle); Moderate for CMS endpoint (data stored)
- **Testing Complexity**: Complex (themes × variants × viewports, form states, cross-repo contract)
## Workflow Visualization
```mermaid
flowchart TD
Start(["User Request"])
subgraph INCEPTION["🔵 INCEPTION PHASE"]
WD["Workspace Detection<br/><b>COMPLETED</b>"]
RE["Reverse Engineering<br/><b>COMPLETED</b>"]
RA["Requirements Analysis<br/><b>COMPLETED</b>"]
US["User Stories<br/><b>SKIP</b>"]
WP["Workflow Planning<br/><b>IN PROGRESS</b>"]
AD["Application Design<br/><b>EXECUTE</b>"]
UG["Units Generation<br/><b>EXECUTE</b>"]
end
subgraph CONSTRUCTION["🟢 CONSTRUCTION PHASE (per unit U1..U5)"]
FD["Functional Design<br/><b>EXECUTE U1 U3 U4</b>"]
NFRA["NFR Requirements<br/><b>EXECUTE U4 U5</b>"]
NFRD["NFR Design<br/><b>EXECUTE U4 U5</b>"]
ID["Infrastructure Design<br/><b>EXECUTE U4</b>"]
CG["Code Generation<br/><b>EXECUTE</b>"]
BT["Build and Test<br/><b>EXECUTE</b>"]
end
OPS["Operations Phase<br/><b>UNDECIDED - asked after Construction</b>"]
Start --> WD --> RE --> RA
RA -.-> US
RA --> WP --> AD --> UG --> FD
FD --> NFRA --> NFRD --> ID --> CG
CG -.->|next unit| FD
CG --> BT
BT -.-> OPS
BT --> End(["Complete"])
style WD fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
style RE fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
style RA fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
style WP fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
style CG fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
style BT fill:#4CAF50,stroke:#1B5E20,stroke-width:3px,color:#fff
style US fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000
style AD fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000
style UG fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000
style FD fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000
style NFRA fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000
style NFRD fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000
style ID fill:#FFA726,stroke:#E65100,stroke-width:3px,stroke-dasharray: 5 5,color:#000
style OPS fill:#BDBDBD,stroke:#424242,stroke-width:2px,stroke-dasharray: 5 5,color:#000
style Start fill:#CE93D8,stroke:#6A1B9A,stroke-width:3px,color:#000
style End fill:#CE93D8,stroke:#6A1B9A,stroke-width:3px,color:#000
style INCEPTION fill:#BBDEFB,stroke:#1565C0,stroke-width:3px,color:#000
style CONSTRUCTION fill:#C8E6C9,stroke:#2E7D32,stroke-width:3px,color:#000
linkStyle default stroke:#333,stroke-width:2px
```
Text alternative: inception runs Application Design and Units Generation (User Stories skipped), then construction loops over five units with design stages only where useful; Operations is decided after construction.
## Phases to Execute
### 🔵 INCEPTION PHASE
- [x] Workspace Detection (COMPLETED)
- [x] Reverse Engineering (COMPLETED)
- [x] Requirements Analysis (COMPLETED)
- [x] User Stories (SKIP) — single visitor persona, requirements already detailed; can be added on request
- [~] Workflow Planning (IN PROGRESS)
- [ ] Application Design — EXECUTE
- **Rationale**: new components and boundaries: variant/mode theme model, lazy E bundle composition, packages block (grid/filter/swipe), headless form module and its API contract with the CMS. The **form contract** produced here is what the CMS session and other form sessions can start from.
- [ ] Units Generation — EXECUTE
- **Rationale**: multiple units with different risk and dependency (see below).
### 🟢 CONSTRUCTION PHASE
Units (proposed order, B first as requested):
- **U1 theme-foundation**: variant × mode model, tokens (B light/dark, E tokens placeholder), system preference, nav switch buttons (mode + icon-only variant button), removal of red/purple, fonts.
- **U2 b-modern-sections**: hero, Over (photo), Werkwijze, nav/footer, contact block frame, light/dark.
- **U3 packages-block**: generic grid, skeleton, filter chips (4+), swipe row on mobile, `category` field, B styling.
- **U4 contact-form**: headless form logic + validation + states, B styling, contract with CMS, spam fields, privacy line. **Coordination gate**: the user is notified before this unit's design/implementation starts (see below).
- **U5 e-timetravel**: lazy-loaded E with five eras, Win98 Werkwijze step cards, packages (2006 style) and form styling per era, light/dark, reduced-motion handling.
Stage decisions:
- [ ] Functional Design — EXECUTE for U1, U3, U4; SKIP for U2, U5 (design exists in the canvas)
- **Rationale**: U1 theme state rules, U3 filter/swipe behaviour, U4 form states/validation/contract are real logic; U2/U5 are visual ports of the canvas.
- [ ] NFR Requirements — EXECUTE for U4, U5; SKIP for U1-U3
- **Rationale**: U4 security/PII/rate-limit/spam; U5 performance (code split, effects) and accessibility with heavy effects. Other units covered by requirements.md NFR-1..8.
- [ ] NFR Design — EXECUTE for U4, U5 (follows NFR Requirements)
- [ ] Infrastructure Design — EXECUTE for U4 only (lightweight)
- **Rationale**: nginx route for the form endpoint, CSP/connect-src, env configuration; skipped for U1-U3 and U5 (no infra impact).
- [ ] Code Generation — EXECUTE (ALWAYS), per unit, with automatic per-unit build/test
- [ ] Build and Test — EXECUTE (ALWAYS)
### 🟡 OPERATIONS PHASE
- [ ] Deployment Setup, Monitoring Setup, Production Readiness Validation — UNDECIDED
- **Rationale**: Requirements Q15-C; asked again at Build and Test.
## Package Change Sequence / Module Update Strategy
- **Update Approach**: Hybrid — frontend units sequential; CMS work parallel to U1-U3 once the contract exists.
- **Critical Path**: Application Design (form contract) → CMS endpoint + headless package → U4 integration.
- **Coordination Points**: `POST /api/v1/contact-messages` contract; `category` on `GET /api/v1/offerings`; headless package API (hook/component slots); nginx route and CSP.
- **Testing Checkpoints**: per-unit tests; contract test (mock server) for U4; integrated check once the CMS endpoint exists.
- **Rollback**: frontend by PR revert; CMS endpoint behind the agreed contract version; mailto fallback while the endpoint is unavailable (feature flag).
## Coordination Plan
- **Form notice (user request)**: the user is told **before the form unit starts**, so they can attach the CMS session and the sessions of other sites that want a form. Because the headless module comes from the CMS repo, the recommended moment is the end of **Application Design** (contract ready, CMS can start in parallel with U1-U3).
- Candidate sessions to attach (from the session list, to be chosen by the user): `CMS & API`, `slpmodularcms-ec`, `slpmodularcms-f7`, `slpmodularcms-6b`, `AndreaSlopFotografie`, `slpsoftware-5d`.
## Estimated Timeline
- **Total Phases**: 2 active (Inception remaining 2 stages; Construction 5 units), Operations undecided
- **Estimated Duration**: several working sessions; U5 is the largest unit.
## Success Criteria
- **Primary Goal**: B live as default site with working light/dark and an icon button revealing E; contact form working end-to-end.
- **Key Deliverables**: variant/mode theme system, B sections, generic packages block with mobile swipe row, contact form + contract + CMS hand-off, E variant, tests.
- **Quality Gates**: `pnpm lint`, `tsc -b`, `vitest run` green; WCAG AA checks; security baseline rules compliant; reduced-motion verified; contract test passing.
- **Integration Testing**: frontend ↔ CMS endpoint once available.
- **Operational Readiness**: decided at Build and Test (Operations undecided).
@@ -0,0 +1,25 @@
# Unit of Work Plan — redesign-modern-timetravel
## Steps
- [x] Analyze requirements, execution plan and application design for decomposition
- [x] Resolve decomposition question (asked interactively)
- [x] Generate `inception/application-design/unit-of-work.md`
- [x] Generate `inception/application-design/unit-of-work-dependency.md`
- [x] Generate `inception/application-design/unit-of-work-story-map.md` (requirements-to-unit map; User Stories were skipped)
- [x] Validate unit boundaries and dependencies
- [x] Ensure all requirements (FR/NFR) are assigned to units
## Question (asked interactively, 2026-11-09)
## Question 1 — Order of the last two frontend units
- A) Form first (U4 before U5)
- B) E first (U5 before U4)
- C) In parallel
- X) Other
[Answer]: A
## Decomposition approach (from the execution plan, confirmed)
- Single repository, brownfield, **monolith SPA**: units are logical modules delivered sequentially, each with its own design/code/test cycle. Branch `feature/redesign-modern-timetravel`, commits per unit, one PR at the end.
- Frontend units U1-U5 here; **external units** X-a..X-f are built by the CMS builder (`SLS Software - CMS`, feature `contact-forms-module` in SlpModularCms) and tracked here only as dependencies.
- Order (user decision): U1 → U2 → U3 → U4 → U5. The form (U4) works against a mock/contract client until the CMS endpoint exists.
@@ -0,0 +1,173 @@
# Requirements-vragen — redesign B (Modern) + E (Tijdreis) + contactformulier
Vul per vraag de letter in na `[Answer]:`. Past geen enkele optie, kies de laatste (Anders) en beschrijf je voorkeur.
Context uit de analyse: de zusterrepo `AndreaSlopFotografie-cms-api-foundation` bevat feature-briefs voor de aparte repo **SlpModularCms** (de CMS/API) en een afgeronde `contact-page`-feature met een eigen `ContactForm`. Daar sluiten de andere formulier-sessies en de CMS-sessie op aan (vragen 9 t/m 13).
---
## Vraag 1 — Scope van B en E in deze feature
B is het uitgangspunt. E (Tijdreis) is een grote bouw met vijf tijdperken (2026, 2013, 2006, 1998, 1989).
- A) B volledig + E volledig, in deze feature, als aparte units (B eerst, dan E)
- B) B volledig + de wissel-infrastructuur (knop, thema-model, laden van E) nu; de E-secties in een vervolgfeature
- C) Alleen B nu; de knop naar E pas bouwen zodra E aan de beurt is
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 2 — Uiterlijk van de knop naar E
Naast de licht/donker-schakelaar in de nav.
- A) Icoon + tekst (bijv. een klokje/terugspoelpijl met "Tijdreis")
- B) Alleen een icoon met tooltip en toegankelijk label
- C) Tekst die van label wisselt ("Tijdreis" in B, "Terug naar nu" in E)
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: B
## Vraag 3 — Onthouden van de variant
Moet de bezoeker na een bezoek aan E de volgende keer weer in E starten?
- A) Nee, altijd starten in B (E blijft een verrassing); alleen licht/donker wordt onthouden
- B) Ja, variant én licht/donker worden onthouden (localStorage)
- C) Alleen binnen dezelfde sessie onthouden (sessionStorage)
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 4 — Bestaande rood/paars-thema's
Nu zijn er twee kleurthema's (rood, paars). In het ontwerp heeft B accent #7A1414 en E #AC0000, met licht en donker.
- A) Rood/paars vervalt; thema wordt: variant (B/E) × modus (licht/donker)
- B) Paars blijft als extra accentkeuze voor B
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 5 — Beginstand licht/donker
- A) Standaard licht, daarna de gekozen modus onthouden
- B) Volg de systeeminstelling van de bezoeker (prefers-color-scheme); gekozen modus overschrijft dit en wordt onthouden
- C) Standaard donker (zoals de huidige site)
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: B
## Vraag 6 — Pakketten: aantal, filter en categorieën
De API levert nu 3 pakketten. Het ontwerp toont ook 6 pakketten met filterchips (Websites / Software / Beheer). Vier daarvan hebben nog geen inhoud.
- A) Het blok moet met elk aantal pakketten overweg kunnen; de filterchips verschijnen pas vanaf 4 pakketten; categorie komt als veld uit de API
- B) Zoals A, maar de categorie wordt in de frontend afgeleid uit de slug (geen API-wijziging)
- C) Altijd 3 kaarten zonder filter; het 6-pakkettenontwerp is alleen een toekomstvoorbeeld
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 7 — Pakketten op mobiel
Je suggestie: naast elkaar en swipeable in plaats van onder elkaar.
- A) Horizontale swipe-rij (scroll-snap) op mobiel bij elk aantal pakketten: ~85% kaartbreedte zodat de volgende kaart zichtbaar is, stipjes, uitgelicht pakket als eerste in beeld; raster op tablet/desktop
- B) Swipe-rij alleen bij meer dan 3 pakketten; bij 3 pakketten onder elkaar
- C) Op mobiel onder elkaar laten staan
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 8 — Inhoud van de vier extra pakketten
- A) Niet in scope: ik bouw het blok generiek en test met nepdata; de echte inhoud volgt via de API/CMS
- B) Wel in scope: ik lever de teksten en prijzen aan voordat de code gegenereerd wordt
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 9 — Velden van het contactformulier
- A) Naam, e-mail, onderwerp/pakket (keuzelijst, voorgeselecteerd via de "Kies …"-knop op een kaart), bericht
- B) Zoals A, plus telefoonnummer (optioneel) en bedrijf (optioneel)
- C) Zoals A, plus indicatie budget en gewenste startdatum (optioneel)
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 10 — Wat gebeurt er met een verzonden formulier?
- A) De CMS/API (SlpModularCms) krijgt een eindpunt (bijv. `POST /api/v1/contact-messages`) dat het bericht opslaat én een e-mail naar mij stuurt
- B) Alleen een e-mail naar mij via de API, geen opslag
- C) Voorlopig de mailto-link behouden tot de API klaar is; formulier-UI en validatie wel bouwen en achter een instelling (feature flag) zetten
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 11 — Hoe delen de sessies het formulier?
Andere sessies willen ook een formulier (o.a. de Andrea-site met een eigen `ContactForm`); de CMS-sessie bouwt de API.
- A) Eén gedeeld contract (request/response, foutcodes, spamregels) in de CMS-repo; elke site bouwt zijn eigen formulier-UI daartegen
- B) De CMS-repo levert een herbruikbare formuliermodule (frontend-component + endpoint) die alle sites gebruiken
- C) Elke site volledig eigen formulier en eindpunt (geen deling)
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: B
## Vraag 12 — Spambescherming
- A) Honeypot-veld + tijdcontrole + rate-limit op de server, zonder externe dienst
- B) Externe captcha (bijv. Cloudflare Turnstile of hCaptcha)
- C) Combinatie: A, met een captcha als terugvaloptie als er misbruik komt
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: C
## Vraag 13 — Privacy bij het formulier
- A) Korte privacyzin onder het formulier (waarvoor de gegevens gebruikt worden en hoe lang bewaard), zonder aanvinkvakje
- B) Verplicht aanvinkvakje voor toestemming
- C) Geen aparte tekst
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 14 — Toegankelijkheid en beweging
E heeft veel effecten (scanlines, marquee, dithering, glanzende knoppen).
- A) WCAG 2.1 AA voor B en E (contrast, toetsenbord, schermlezer) en alle animatie uit bij `prefers-reduced-motion`
- B) WCAG AA voor B; in E mogen effecten blijven, maar tekst blijft leesbaar en animatie stopt bij `prefers-reduced-motion`
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: A
## Vraag 15 — Operations-fase
Deployment (Gitea Actions + test/productie op de Pi's) bestaat al uit de vorige feature.
- A) Ja — Operations-fase draaien (deployment- en monitoringaanpassingen, bijv. voor het formulier-eindpunt in de nginx-proxy)
- B) Nee — stoppen na Build and Test; bestaande pipeline blijft ongewijzigd
- C) Nog niet zeker — vraag het opnieuw na de Construction-fase
- X) Anders (beschrijf na de [Answer]:-tag)
[Answer]: C
## Vraag: Beveiligingsextensies
Moeten de beveiligingsregels als harde vereisten worden afgedwongen voor dit project? (Het formulier verwerkt persoonsgegevens, dus A ligt voor de hand.)
- A) Ja — dwing alle BEVEILIGINGSREGELS af als blokkerende vereisten (aanbevolen voor productietoepassingen)
- B) Nee — sla alle BEVEILIGINGSREGELS over (geschikt voor PoC's, prototypes en experimentele projecten)
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
[Answer]: A
## Vraag: Property-Based Testing Extensie
Moeten de property-based testing (PBT) regels worden afgedwongen voor dit project? (Denkbare kandidaat: formuliervalidatie.)
- A) Ja — dwing alle PBT-regels af als blokkerende vereisten (aanbevolen voor projecten met bedrijfslogica, datatransformaties, serialisatie of stateful componenten)
- B) Gedeeltelijk — dwing PBT-regels alleen af voor pure functies en serialisatie round-trips (geschikt voor projecten met beperkte algoritmische complexiteit)
- C) Nee — sla alle PBT-regels over (geschikt voor eenvoudige CRUD-applicaties, UI-only projecten of dunne integratielagen zonder significante bedrijfslogica)
- X) Anders (beschrijf hieronder na de [Answer]:-tag)
[Answer]: B
## Vraag 16 — Vervolg op vraag 11: vorm van de formuliermodule
Antwoord gekozen in de chat (interactieve vragenronde, 2026-11-09).
- A) Headless + thema-slots
- B) Vooraf gestyled component
- C) Web component
[Answer]: A
---
Opmerking: alle antwoorden zijn interactief in de chat gegeven op verzoek van de gebruiker en hierboven overgenomen.
@@ -0,0 +1,65 @@
# Requirements — redesign-modern-timetravel
## Intent Analysis
- **User request**: Build design option B (Modern) as the default site, add a button next to the light/dark switch to switch to option E (Time-travel), and build the contact form along with it. Other sessions that also need a form, and the CMS & API session, are attached when the form build starts.
- **Request type**: New Feature (redesign + variant switch + new capability: contact form)
- **Scope estimate**: Multiple components / cross-system (frontend theme system, nav, all landing sections, form; CMS/API repo SlpModularCms for the endpoint and shared module)
- **Complexity estimate**: Complex
- **Requirements depth**: Standard (comprehensive for the form/cross-repo part)
- **Design source**: Claude Design canvas https://claude.ai/artifact/UkpzA5YPLheZm3fpmWdPtn — B = Modern.dc.html, E = Tijdreis2.dc.html, PakkettenModern.dc.html, PakkettenTijd.dc.html, plus dark wrappers. Accent B `#7A1414`, E `#AC0000`.
## Functional Requirements
### Variants and theming
- **FR-1** Variant B (Modern) is the default experience: hero, Over (with photo), Pakketten, Werkwijze ("Van idee naar live in drie stappen"), Contact (with form), footer, per the canvas design. Section years are not in the menu.
- **FR-2** Variant E (Time-travel) is built in full (this feature, separate unit after B): eras 2026 modern, 2013 flat, 2006 web 2.0, 1998 Windows-98 style with the redesigned Werkwijze step cards, 1989 terminal; per canvas design E. Years remain as badges per block.
- **FR-3** The theme model becomes **variant (B | E) × mode (light | dark)**. The old red/purple themes are removed (answer Q4-A). B accent `#7A1414`, E accent `#AC0000`. The 1989 terminal section looks the same in light and dark.
- **FR-4** Nav contains the existing mode switch and, next to it, an **icon-only** button to switch to E (and back to B), with tooltip and accessible label (Q2-B).
- **FR-5** Mode starts from the visitor's system preference (`prefers-color-scheme`); an explicit choice overrides it and is remembered (Q5-B). The **variant is not remembered**: every visit starts in B; E is an easter egg (Q3-A).
- **FR-6** E is loaded lazily (code-split) so the default B bundle stays small. *(Design decision proposed by AI; revisit in Application Design.)*
### Packages
- **FR-7** The packages block works with any number of packages from `/api/v1/offerings` (Q6-A). Skeleton count and grid are no longer hard-coded to 3.
- **FR-8** Filter chips (category + count, e.g. Alles/Websites/Onderhoud) appear from **4 packages** on. Category is a **new field in the API** (`category`, the category name), a CMS/API change handed to the CMS builder. Categories are **managed in the CMS** (sub-section of the Offerings admin), not in settings; Bryan starts with *Websites* and *Onderhoud* (decision 2026-11-09, revised; earlier example values Websites/Software/Beheer were only placeholders). Mock data for 6 packages in tests uses these names.
- **FR-9** A "Past er niets bij? / Maatwerk" banner always stays below the cards.
- **FR-10** On mobile the cards form a **horizontal swipe row** (CSS scroll-snap) for any number of packages (Q7-A): ~85% card width so the next card peeks, dot indicator, the featured package first in view; grid on tablet/desktop (3 columns, 2 columns at ≤1000px). Must be keyboard and screen-reader usable and not depend on JavaScript for scrolling.
- **FR-11** Content for the four additional packages (Webshop, CMS, Koppelingen & API's, Onderhoud) is **out of scope**; layout is built generically and tested with mock data of 6 packages (Q8-A).
- **FR-12** Both B and E have their own styling of the packages block (B: square chips and cards; E: 2006 glossy tabs and cards), light and dark.
### Contact form
- **FR-13** Fields: name, e-mail, subject/package (select, preselected via the "Kies …" button of a package card) and message (Q9-A). **All four fields are required** (follow-up decision 2026-11-09). All fields validated on the client and on the server. Limits and messages are aligned with the ASF form: name max 100, e-mail max 254, message max 2000.
- **FR-14** Submit sends the message to the CMS/API, which **stores it and e-mails the site owner** (Q10-A), e.g. `POST /api/v1/contact-messages`. Exact contract defined together with the CMS sessions. Store first, mail best-effort with a status; a mail failure never fails the save. Stored messages are kept **12 months** (follow-up decision), then removed by a retention job.
- **FR-14a (future, out of scope)** The owner may later turn a stored message into an assignment in an administration system to produce quotes and invoices. Not built now; the stored message keeps its own id and a status so this stays possible.
- **FR-15** Form states: idle, validating (inline errors), submitting, success, server error with retry; no loss of input on error.
- **FR-16** Spam protection (Q12-C): honeypot field + time check + server-side rate limit, with an external captcha as a fallback to switch on if abuse occurs (ASF plans Friendly Captcha; provider to be settled in the contract). Suggested hardening from the CMS session: server-signed timestamp token for the time check, idempotency key against double submit, identical response on spam detection so bots learn nothing, site id derived from host/config (never from the request body).
- **FR-17** A one-sentence privacy note under the form (purpose and retention), no consent checkbox (Q13-A). Recipient e-mail, retention period and the privacy-statement link/text are **configurable per site** (requested by the ASF website session; ASF keeps its sentence "Lees in de privacyverklaring wat ik met je gegevens doe." linking to /privacyverklaring). Captcha provider: Friendly Captcha fits ASF (its code already has a [data-robot-check] slot).
- **FR-18** **Reusable module** (Q11-B, Q16-A, follow-up decision): two parts. (1) A **Contact/Forms API module** in SlpModularCms (endpoint, storage, mail, spam checks, retention job). (2) **One frontend package `cms-client`** (working name) in SlpModularCms that types and calls the CMS API, with **separately importable parts** (subpath imports such as `/contact`, later `/offerings`) so a site only bundles what it uses. The contact part is **headless** (state/reducer, validation, preselect with change counter, idPrefix, render slots for honeypot/robot check/status, injectable texts and submit function, a11y wiring); each site, including B and E here and the other sites, supplies its own markup and styling. Types come from the CMS OpenAPI description. Offerings moves into the same package later for consistency (not in this feature unless cheap). Consumption route (workspace/file dependency or tagged copy first, private registry only with a third consumer) is a recommendation awaiting the user's confirmation.
- **FR-19** Form copy and layout per design: B has a red contact block with a white (light) / dark form panel; E has the terminal-style form in 1989 and matching styles per era where applicable.
## Non-Functional Requirements
- **NFR-1 Accessibility**: WCAG 2.1 AA for B and E (contrast, keyboard, screen reader, visible focus); all animation (marquee, scanlines, dither, caret) disabled under `prefers-reduced-motion` (Q14-A).
- **NFR-2 Responsive**: layouts work from 360px to 1440px+; no horizontal page scroll (swipe row excepted).
- **NFR-3 Performance**: E is code-split; fonts are self-hosted via `@fontsource` (no Google Fonts requests) and limited to the weights used; images keep the existing responsive WebP variants.
- **NFR-4 Security (Security Baseline enabled)**: server-side validation and output encoding, no secrets in the frontend bundle, rate limiting, no PII in logs or Sentry/Umami events, security headers / CSP compatible with the new fonts and API origin, dependency hygiene. Applicable SECURITY rules are enforced as blocking at each stage.
- **NFR-5 Privacy**: stored contact messages contain personal data; retention is **12 months**, stated in the privacy note and enforced by the CMS retention job. No e-mail address or message text in logs or Sentry breadcrumbs.
- **NFR-6 Testing**: Vitest + Testing Library for components (theme switch, variant switch, packages grid with 3 and 6 items, swipe row semantics, form states). Property-based testing **partial** (Q-PBT-B): applies to pure functions and serialization round-trips, e.g. form validation functions and request/response serialization.
- **NFR-7 Maintainability**: theme tokens as CSS variables per variant × mode; Tailwind semantic color names remain; content stays in `content.ts`/API.
- **NFR-8 Compatibility**: hash routing and static hosting remain; the existing Sentry/Umami integration and the CI/CD pipeline keep working.
## Assumptions
- Current copy and texts of the live site (incl. the November text update) are leading unless the design says otherwise.
- The packages API keeps its current shape plus `category`; the CMS session implements it.
- E may use period-appropriate fonts (Archivo for B; Open Sans, Trebuchet/Verdana, Times/Arial, VT323 for E) as self-hosted or system fonts.
- Delivery: one branch `feature/redesign-modern-timetravel`, commits per unit, one PR at the end.
## Risks and Dependencies
- **Cross-repo**: the endpoint, the `category` API field and the headless form module live in SlpModularCms; the CMS session must be attached. See `aidlc-docs/features/redesign-modern-timetravel/aidlc-state.md` § Coordination Notes.
- **Form coordination moment**: the user wants to be told **before** the form build starts so other sessions (e.g. Andrea site with its own `ContactForm`) and the CMS session can join.
- E is a large build; B-first ordering limits risk.
## Operations
- Include Operations Phase: **Undecided** — asked again after Construction (Q15-C). Likely topics: nginx route for the form endpoint, monitoring of form errors.
## Extension Compliance Summary
- Security Baseline: enabled (Q-Security-A). Requirements-level compliance: NFR-4/5 added; detailed per-rule checks run in later stages.
- Property-Based Testing: partial (Q-PBT-B). Requirements-level: NFR-6.
+12
View File
@@ -0,0 +1,12 @@
## Language Preference — redesign-modern-timetravel
All documentation artifacts (requirements, designs, plans, code comments, etc.) will be written in **English** by default. Questions, prompts, and AI responses will be in your language (Dutch).
Would you like to change this? (The previous feature `react-frontend` used: English docs, Dutch conversation.)
- A) English for documentation, your language for conversation (default)
- B) English for everything (documentation and conversation)
- C) My language for everything (documentation and conversation)
- X) Other (please describe after [Answer]: tag below)
[Answer]: