# 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 ```