{"version":3,"file":"AuthOrderOverride.DooLRIsb.mjs","names":[],"sources":["https:/framerusercontent.com/modules/IPAyPySnBHaaZ1luMLPV/NTK9OnjgESxUsZ8DWVYy/AuthOrderOverride.js"],"sourcesContent":["/**\n * AuthOrderOverride.tsx - Require Auth for Protected Pages\n * v1.0.0\n *\n * Usage: Attach to invisible 1x1 layer on protected pages (/order, /my-reports, etc.)\n *\n * Behavior:\n * - Waits for AuthProvider to initialize\n * - If user not authenticated → redirects to /signin?return={current_url}\n * - If authenticated → does nothing (page loads normally)\n */import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";/**\n * Redirect to /signin if not authenticated\n *\n * Attach this to an invisible layer (1x1px) on any page that requires login.\n * User will be redirected to /signin with a return URL, so after login they\n * come back to the page they tried to access.\n */export function withRequireAuth(Component){return props=>{useEffect(()=>{const checkAuth=()=>{const auth=window.__POKPOK_AUTH__;// Wait for auth to initialize\nif(!auth)return;if(auth.loading)return;// Redirect if not authenticated\nif(!auth.isAuthenticated){const returnUrl=encodeURIComponent(window.location.href);window.location.href=`/signin?return=${returnUrl}`;}};// Check immediately\ncheckAuth();// Listen for auth ready event\nwindow.addEventListener(\"pokpok-auth-ready\",checkAuth);return()=>{window.removeEventListener(\"pokpok-auth-ready\",checkAuth);};},[]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withRequireAuth\":{\"type\":\"reactHoc\",\"name\":\"withRequireAuth\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AuthOrderOverride.map"],"mappings":"2HAgBG,SAAgB,EAAgB,EAAU,CAAC,MAAO,KAAQ,MAAc,CAAC,IAAM,MAAc,CAAC,IAAM,EAAK,EAAO,gBAC/G,MAAe,GAAK,SACrB,CAAC,EAAK,gBAAgB,CAAC,IAAM,EAAU,mBAAmB,EAAO,SAAS,KAAK,CAAC,EAAO,SAAS,KAAK,kBAAkB,MAEnE,OADvD,GAAW,CACX,EAAO,iBAAiB,oBAAoB,EAAU,KAAW,CAAC,EAAO,oBAAoB,oBAAoB,EAAU,GAAK,EAAE,CAAC,CAAqB,EAAK,EAAU,CAAC,GAAG,EAAM,CAAC,uBAVpI,IAA6B"}