// ============================================================ // Monarch — Bannière de consentement cookies (RGPD / CNIL) // Autonome : se monte tout seul. Stocke le choix dans localStorage. // window.monarchCookiesOpen() -> rouvre le panneau de réglages // ============================================================ (function () { const { useState, useEffect } = React; const C = { blanc: "#FFFFFF", albatre: "#FAF9F6", encre: "#1B1D1C", ardoise: "#5B7C99", ardoiseF: "#3D5468", sauge: "#5C6F5C", saugeF: "#48584A", gris: "#737373", grisC: "#9A9A95", trait: "#E4E1DA" }; const SERIF = "'Fraunces', Georgia, serif"; const BODY = "'Archivo', system-ui, sans-serif"; const KEY = "monarch.cookies.v1"; function readChoice() { try { return JSON.parse(localStorage.getItem(KEY) || "null"); } catch (e) { return null; } } function writeChoice(obj) { const data = Object.assign({ date: new Date().toISOString() }, obj); try { localStorage.setItem(KEY, JSON.stringify(data)); } catch (e) {} applyConsent(data); window.dispatchEvent(new CustomEvent("monarch-consent", { detail: data })); } // Point d'ancrage pour activer/désactiver des scripts tiers (analytics…) selon le choix. function applyConsent(data) { window.MONARCH_CONSENT = data; // Exemple : if (data.analytics) { /* charger la mesure d'audience */ } } function CookieBanner() { const [choice, setChoice] = useState(() => readChoice()); const [settings, setSettings] = useState(false); const [analytics, setAnalytics] = useState(true); useEffect(() => { const c = readChoice(); if (c) applyConsent(c); window.monarchCookiesOpen = () => { const cur = readChoice(); setAnalytics(cur ? !!cur.analytics : true); setSettings(true); setChoice(null); }; }, []); if (choice && !settings) return null; const acceptAll = () => { setChoice({ essential: true, analytics: true }); writeChoice({ essential: true, analytics: true }); setSettings(false); }; const refuseAll = () => { setChoice({ essential: true, analytics: false }); writeChoice({ essential: true, analytics: false }); setSettings(false); }; const saveCustom = () => { const v = { essential: true, analytics }; setChoice(v); writeChoice(v); setSettings(false); }; const btnPrimary = { fontFamily: BODY, fontSize: 14, fontWeight: 600, color: "#fff", background: C.sauge, border: "none", borderRadius: 2, padding: "12px 22px", cursor: "pointer" }; const btnGhost = { fontFamily: BODY, fontSize: 14, fontWeight: 600, color: C.encre, background: "transparent", border: `1px solid ${C.trait}`, borderRadius: 2, padding: "12px 22px", cursor: "pointer" }; return (
Cookies & confidentialité

Votre vie privée, notre priorité

Ce site utilise des cookies strictement nécessaires à son fonctionnement, et — avec votre accord — une mesure d'audience anonyme pour améliorer nos contenus. Aucune donnée n'est cédée à des tiers.

{settings &&
setAnalytics((a) => !a)} />
}
{!settings && } {settings && }
); } function Row({ title, desc, checked, onToggle, locked }) { return (
{title}
{desc}
); } // montage autonome function mount() { let host = document.getElementById("monarch-cookie-root"); if (!host) { host = document.createElement("div"); host.id = "monarch-cookie-root"; document.body.appendChild(host); } ReactDOM.createRoot(host).render(); } if (document.readyState === "loading") document.addEventListener("DOMContentLoaded", mount); else mount(); window.MonarchCookieBanner = CookieBanner; })();