"use client"; import { useEffect, useState } from "react"; import { content } from "@/lib/content"; const CONSENT_STORAGE_KEY = "core-consent-choice"; type ConsentChoice = "accepted" | "declined"; /** * Cookie / consent banner — the one deliberate JavaScript-only exception to the * whole-site no-JS contract (`notes/consent-banner.md` + engineering.md F4 * Known-deferred). It gates nothing else: with JS disabled it does not render, * and that is acceptable because there is no consent to capture and no * analytics to gate. The banner's `mode: "default-banner"` analytics consent is * handled by the analytics bus (`hydrogen-analytics`); this is the app-owned * dismiss/persist UI layered on top. */ export function ConsentBanner() { const [choice, setChoice] = useState(null); const [mounted, setMounted] = useState(false); useEffect(() => { setMounted(true); try { const stored = localStorage.getItem(CONSENT_STORAGE_KEY); if (stored === "accepted" || stored === "declined") { setChoice(stored); } } catch { // localStorage may be unavailable; treat as no prior choice. } }, []); if (!mounted || choice !== null) return null; const persist = (value: ConsentChoice) => { setChoice(value); try { localStorage.setItem(CONSENT_STORAGE_KEY, value); } catch { // Ignore storage failures. } }; return (

{content.consent.message}{" "} {content.consent.privacyPolicy}

); }