'use client' import { useEffect, useState } from 'react' // Gate for internal/developer-only navigation (template/catalog management, corpus // curation, engine internals, admin tooling). Customers must NEVER see these. // // Until per-tenant RBAC lands, "internal" = our own environments (macmini / // localhost) or an explicit per-browser opt-in. Public customer domains hide it // by default (safe). Override per browser via localStorage `bp_internal_ui` = // '1' (force show) / '0' (force hide, e.g. to preview the customer view). // When real role-based auth arrives, swap only this hook's body. export function useInternalUI(): boolean { const [show, setShow] = useState(false) useEffect(() => { try { const flag = localStorage.getItem('bp_internal_ui') if (flag === '1') { setShow(true); return } if (flag === '0') { setShow(false); return } const h = window.location.hostname setShow(h === 'macmini' || h === 'localhost' || h === '127.0.0.1' || h.endsWith('.local')) } catch { setShow(false) } }, []) return show }