// customizer.jsx — operator-controlled branding + live code injection. // Loaded after data.jsx (needs window.useSiteSetting), before components.jsx. const { useEffect: useEffectCz } = React; /* ───────────────────────────────────────────────────────────── Branding — every operator-editable label/copy with safe defaults ──────────────────────────────────────────────────────────── */ const BRANDING_DEFAULTS = { brand_word_1: "sara", brand_word_2: "slot", brand_strip_pre: "Malaysia's", brand_strip_accent: "Trusted", brand_strip_post: "Online Gaming Platform", login_label: "Log Masuk", register_label: "Daftar", default_theme: "gold", theme_fab_enabled: true, shop_eyebrow: "Drop · 05.2026", shop_title: "NEW DROPS", promo_title: "PROMOTIONS", promo_sub: "Boost every spin — fresh drops every week.", chat_welcome: "Selamat Datang ke", chat_brand: "SARASLOT", }; window.BRANDING_DEFAULTS = BRANDING_DEFAULTS; function useBranding() { const q = window.useSiteSetting ? window.useSiteSetting("branding") : { data: null }; const value = (q.data && q.data.value) || {}; return { ...BRANDING_DEFAULTS, ...value }; } window.useBranding = useBranding; /* ───────────────────────────────────────────────────────────── CustomCodeInjector — injects operator CSS / head HTML / JS / body HTML. The anon role can only READ site_settings; only admins can WRITE, so the injected code is always operator-authored (same trust model as a CMS "custom code" box). Mount once near the root of the app. ──────────────────────────────────────────────────────────── */ function CustomCodeInjector() { const q = window.useSiteSetting ? window.useSiteSetting("custom_code") : { data: null }; const cfg = (q.data && q.data.value) || null; const enabled = cfg && cfg.enabled !== false; const key = cfg ? JSON.stringify(cfg) : ""; useEffectCz(() => { const ids = ["bo-custom-css", "bo-custom-head", "bo-custom-js"]; const cleanup = () => ids.forEach((id) => { const el = document.getElementById(id); if (el) el.remove(); }); if (!enabled) { cleanup(); return cleanup; } // CSS let style = document.getElementById("bo-custom-css"); if (!style) { style = document.createElement("style"); style.id = "bo-custom-css"; document.head.appendChild(style); } style.textContent = cfg.css || ""; // Raw head HTML (meta/link). Note: