// site/consent-banner.jsx — GDPR consent banner. // (Filename intentionally avoids "cookie" so ad/content blockers don't drop it.) // Stores choice in localStorage under 'showtime-cookie-consent'. // Values: 'all' | 'essential'. No value = not yet decided → show banner. // Future tracker scripts should check useCookieConsent() before loading. const CONSENT_KEY = 'showtime-cookie-consent'; function readConsent() { try { return localStorage.getItem(CONSENT_KEY); } catch (e) { return 'essential'; } } function writeConsent(value) { try { localStorage.setItem(CONSENT_KEY, value); } catch (e) {} } function useCookieConsent() { const [consent, setConsent] = React.useState(() => readConsent()); const decide = React.useCallback((value) => { writeConsent(value); setConsent(value); if (value === 'all' && typeof window.grantAnalyticsConsent === 'function') { window.grantAnalyticsConsent(); } }, []); return { consent, decide }; } function CookieBanner() { const { consent, decide } = useCookieConsent(); const t = useT(); if (consent !== null) return null; return (

{t('cookie.body')}{' '} {t('cookie.policy')}

); } Object.assign(window, { useCookieConsent, CookieBanner });