{"version":3,"file":"AuthPluginOverrides.3uLYnbMe.mjs","names":["useSyncExternalStore","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/KVMq3qgDwyoa1wzhwZZz/HHSIJq9900GK06u0IKgr/AuthPluginOverrides.js"],"sourcesContent":["// AuthPluginOverrides.tsx\n// Auto-generated by Auth Plugin v1.0.0\n// Do not edit manually -- changes will be overwritten on plugin update.\nimport{jsx as _jsx,jsxs as _jsxs,Fragment as _Fragment}from\"react/jsx-runtime\";import{forwardRef,useRef,useSyncExternalStore}from\"react\";// ---------------------------------------------------------------------------\n// AuthPlugin Store Reader\n// ---------------------------------------------------------------------------\n/**\n * Reads a value from the window.AuthPlugin store with reactive updates.\n * Falls back safely when AuthPlugin is not loaded (e.g., Framer canvas).\n */function useAuthPluginStore(selector,fallback){const subscribe=callback=>{const ap=window.AuthPlugin;if(ap&&typeof ap.subscribe===\"function\"){return ap.subscribe(callback);}// No AuthPlugin loaded (canvas preview) -- listen for auth change event\nconst handler=()=>callback();window.addEventListener(\"ap-auth-change\",handler);return()=>window.removeEventListener(\"ap-auth-change\",handler);};const getSnapshot=()=>{const ap=window.AuthPlugin;if(ap){try{return selector(ap.store)??fallback;}catch{return fallback;}}// Relay not loaded yet — check localStorage directly to prevent flash\ntry{const key=`ap:${window.location.hostname}:session`;const raw=localStorage.getItem(key);if(raw){const session=JSON.parse(raw);const identity=session?.identity||null;const access={grants:identity?.ap_grants||[],labels:identity?.ap_labels||[],tiers:[]};return selector({identity,session,access})??fallback;}}catch{}return fallback;};return useSyncExternalStore(subscribe,getSnapshot,()=>fallback);}/**\n * Returns the current identity from the AuthPlugin store, or null.\n */function useIdentity(){return useAuthPluginStore(store=>store.identity,null);}/**\n * Returns the current access object from the AuthPlugin store.\n */function useAccess(){return useAuthPluginStore(store=>store.access,{grants:[],labels:[],tiers:[]});}// ---------------------------------------------------------------------------\n// Tier hierarchy for ShowWithTier comparisons\n// ---------------------------------------------------------------------------\nconst TIER_ORDER={free:0,starter:1,pro:2,enterprise:3};// ---------------------------------------------------------------------------\n// Hidden helper — uses CSS :has() to collapse the Framer container wrapper\n// ---------------------------------------------------------------------------\nfunction HiddenPlaceholder(){const hideId=useRef(`ap-h-${Math.random().toString(36).slice(2,8)}`).current;return /*#__PURE__*/_jsxs(_Fragment,{children:[/*#__PURE__*/_jsx(\"style\",{children:`div:has(> .${hideId}) { display: none !important; }`}),/*#__PURE__*/_jsx(\"div\",{className:hideId})]});}// ---------------------------------------------------------------------------\n// VISIBILITY OVERRIDES\n// ---------------------------------------------------------------------------\n/**\n * ShowWhenAuthenticated\n * Shows the wrapped frame only when an identity exists in the session.\n */export function ShowWhenAuthenticated(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const identity=useIdentity();if(!identity)return /*#__PURE__*/_jsx(HiddenPlaceholder,{});return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}/**\n * ShowWhenGuest\n * Shows the wrapped frame only when the user is NOT authenticated.\n */export function ShowWhenGuest(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const identity=useIdentity();if(identity)return /*#__PURE__*/_jsx(HiddenPlaceholder,{});return /*#__PURE__*/_jsx(Component,{ref:ref,...props});});}/* [FUTURE SCOPE] — Grant, Label, Tier & License overrides hidden until ready\n\nexport function ShowWithGrant(Component: ComponentType<any>): ComponentType<any> {\n    return forwardRef<any, any>((props, ref) => {\n        const identity = useIdentity()\n        const access = useAccess()\n        const grantId = props?.grantId\n        const hasGrant = useMemo(() => {\n            if (!identity || !grantId) return false\n            return access.grants.includes(grantId)\n        }, [identity, access, grantId])\n        if (!hasGrant) return <HiddenPlaceholder />\n        return <Component ref={ref} {...props} />\n    })\n}\n\nexport function ShowWithLabel(Component: ComponentType<any>): ComponentType<any> {\n    return forwardRef<any, any>((props, ref) => {\n        const identity = useIdentity()\n        const access = useAccess()\n        const labelName = props?.labelName\n        const hasLabel = useMemo(() => {\n            if (!identity || !labelName) return false\n            return access.labels.includes(labelName)\n        }, [identity, access, labelName])\n        if (!hasLabel) return <HiddenPlaceholder />\n        return <Component ref={ref} {...props} />\n    })\n}\n\nexport function ShowWithTier(Component: ComponentType<any>): ComponentType<any> {\n    return forwardRef<any, any>((props, ref) => {\n        const identity = useIdentity()\n        const tierName = props?.tierName\n        const meetsTier = useMemo(() => {\n            if (!identity || !tierName) return false\n            const userTier = identity.tier\n            if (!userTier) return false\n            const userLevel = TIER_ORDER[userTier.name] ?? userTier.level ?? 0\n            const requiredLevel = TIER_ORDER[tierName] ?? 0\n            return userLevel >= requiredLevel\n        }, [identity, tierName])\n        if (!meetsTier) return <HiddenPlaceholder />\n        return <Component ref={ref} {...props} />\n    })\n}\n\nexport function HideWithGrant(Component: ComponentType<any>): ComponentType<any> {\n    return forwardRef<any, any>((props, ref) => {\n        const identity = useIdentity()\n        const access = useAccess()\n        const grantId = props?.grantId\n        const hasGrant = useMemo(() => {\n            if (!identity || !grantId) return false\n            return access.grants.includes(grantId)\n        }, [identity, access, grantId])\n        if (hasGrant) return <HiddenPlaceholder />\n        return <Component ref={ref} {...props} />\n    })\n}\n\nexport function HideWithLabel(Component: ComponentType<any>): ComponentType<any> {\n    return forwardRef<any, any>((props, ref) => {\n        const identity = useIdentity()\n        const access = useAccess()\n        const labelName = props?.labelName\n        const hasLabel = useMemo(() => {\n            if (!identity || !labelName) return false\n            return access.labels.includes(labelName)\n        }, [identity, access, labelName])\n        if (hasLabel) return <HiddenPlaceholder />\n        return <Component ref={ref} {...props} />\n    })\n}\n\nexport function ShowWithLicense(Component: ComponentType<any>): ComponentType<any> {\n    return forwardRef<any, any>((props, ref) => {\n        const identity = useIdentity()\n        const variantId = props?.variantId\n        const hasLicense = useMemo(() => {\n            if (!identity || !variantId) return false\n            const licenses = identity.licenses\n            if (!Array.isArray(licenses)) return false\n            return licenses.some((l: any) => l.variant_id === variantId && l.status === \"active\")\n        }, [identity, variantId])\n        if (!hasLicense) return <HiddenPlaceholder />\n        return <Component ref={ref} {...props} />\n    })\n}\n\nexport function HideWithLicense(Component: ComponentType<any>): ComponentType<any> {\n    return forwardRef<any, any>((props, ref) => {\n        const identity = useIdentity()\n        const variantId = props?.variantId\n        const hasLicense = useMemo(() => {\n            if (!identity || !variantId) return false\n            const licenses = identity.licenses\n            if (!Array.isArray(licenses)) return false\n            return licenses.some((l: any) => l.variant_id === variantId && l.status === \"active\")\n        }, [identity, variantId])\n        if (hasLicense) return <HiddenPlaceholder />\n        return <Component ref={ref} {...props} />\n    })\n}\n\n[FUTURE SCOPE] */// ---------------------------------------------------------------------------\n// DATA INJECTION OVERRIDES\n// ---------------------------------------------------------------------------\n/**\n * IdentityName\n * Injects the identity's full name as the \"text\" prop.\n * Returns null when no identity is present.\n */export function IdentityName(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const identity=useIdentity();if(!identity)return /*#__PURE__*/_jsx(HiddenPlaceholder,{});return /*#__PURE__*/_jsx(Component,{ref:ref,...props,text:identity.name??\"\"});});}/**\n * IdentityEmail\n * Injects the identity's email address as the \"text\" prop.\n * Returns null when no identity is present.\n */export function IdentityEmail(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const identity=useIdentity();if(!identity)return /*#__PURE__*/_jsx(HiddenPlaceholder,{});return /*#__PURE__*/_jsx(Component,{ref:ref,...props,text:identity.email??\"\"});});}// ---------------------------------------------------------------------------\n// ACTION OVERRIDES\n// ---------------------------------------------------------------------------\n/**\n * TriggerSignOut\n * Wires the onClick handler to call AuthPlugin.auth.dismiss(\"/\"),\n * signing the user out and redirecting to the homepage.\n * Returns null when no identity is present (no sign-out button\n * needed for anonymous visitors).\n */export function TriggerSignOut(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const identity=useIdentity();if(!identity)return /*#__PURE__*/_jsx(HiddenPlaceholder,{});const handleSignOut=()=>{const ap=window.AuthPlugin;if(ap&&ap.auth&&typeof ap.auth.dismiss===\"function\"){ap.auth.dismiss(\"/\");}};return /*#__PURE__*/_jsx(Component,{ref:ref,...props,onClick:handleSignOut});});}\nexport const __FramerMetadata__ = {\"exports\":{\"ShowWhenGuest\":{\"type\":\"reactHoc\",\"name\":\"ShowWhenGuest\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"TriggerSignOut\":{\"type\":\"reactHoc\",\"name\":\"TriggerSignOut\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"IdentityName\":{\"type\":\"reactHoc\",\"name\":\"IdentityName\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ShowWhenAuthenticated\":{\"type\":\"reactHoc\",\"name\":\"ShowWhenAuthenticated\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"IdentityEmail\":{\"type\":\"reactHoc\",\"name\":\"IdentityEmail\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AuthPluginOverrides.map"],"mappings":"4JASG,SAAS,EAAmB,EAAS,EAAS,CAE6R,OAAOA,EAFnR,GAAU,CAAC,IAAM,EAAG,EAAO,WAAW,GAAG,GAAI,OAAO,EAAG,WAAY,WAAY,OAAO,EAAG,UAAU,CAAQ,EAC7K,IAAM,MAAY,EAAS,EAAoD,OAAlD,EAAO,iBAAiB,iBAAiB,CAAO,MAAY,EAAO,oBAAoB,iBAAiB,CAAO,CAAE,MAAwB,CAAC,IAAM,EAAG,EAAO,WAAW,GAAG,EAAI,GAAG,CAAC,OAAO,EAAS,EAAG,KAAK,GAAG,CAAS,MAAM,CAAC,OAAO,CAAS,CACxQ,GAAG,CAAC,IAAM,EAAI,MAAM,EAAO,SAAS,SAAS,UAAgB,EAAI,aAAa,QAAQ,CAAG,EAAE,GAAG,EAAI,CAAC,IAAM,EAAQ,KAAK,MAAM,CAAG,EAAQ,EAAS,GAAS,UAAU,KAA2F,OAAO,EAAS,CAAC,WAAS,UAAQ,OAAA,CAA1G,OAAO,GAAU,WAAW,CAAC,EAAE,OAAO,GAAU,WAAW,CAAC,EAAE,MAAM,CAAC,CAA0C,CAAC,CAAC,GAAG,CAAS,CAAC,MAAM,CAAC,CAAC,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