{"version":3,"file":"DescopeWebComponent.BcfKIff1.mjs","names":["useRef"],"sources":["https:/framerusercontent.com/modules/5ySB0SBwFAsTPLTuHstG/fM536OEmtdU8DVTEYpnV/DescopeWebComponent.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef}from\"react\";const DescopeLogin=()=>{const containerRef=useRef(null);const projectId=\"P36yQD57gOtVPFmq0C3lkHZ5HaRs\"// replace with your Descope Project ID\n;const flowId=\"sign-in-magic-link\"// replace with your Descope Flow ID\n;useEffect(()=>{// Dynamically load Descope scripts\nconst loadScripts=async()=>{const loadScript=src=>new Promise((resolve,reject)=>{const script=document.createElement(\"script\");script.src=src;script.async=true;script.onload=resolve;script.onerror=reject;document.head.appendChild(script);});try{await loadScript(\"https://descopecdn.com/npm/@descope/web-component@3.21.0/dist/index.js\");await loadScript(\"https://descopecdn.com/npm/@descope/web-js-sdk@1.16.0/dist/index.umd.js\");const sdk=window.Descope({projectId:projectId,persistTokens:true,autoRefresh:true});const sessionToken=sdk.getSessionToken();const notValidToken=sessionToken?sdk.isJwtExpired(sessionToken):true;if(!sessionToken||notValidToken){const container=containerRef.current;if(container&&!container.querySelector(\"descope-wc\")){container.innerHTML=`<descope-wc project-id=\"${projectId}\" flow-id=\"${flowId}\"></descope-wc>`;const wcElement=container.querySelector(\"descope-wc\");wcElement.addEventListener(\"success\",()=>{sdk.refresh();});wcElement.addEventListener(\"error\",err=>{console.error(\"Descope error:\",err);});}}}catch(error){console.error(\"Error loading Descope scripts\",error);}};loadScripts();},[]);return /*#__PURE__*/_jsx(\"div\",{children:/*#__PURE__*/_jsx(\"div\",{ref:containerRef})});};function App(){return /*#__PURE__*/_jsx(\"div\",{className:\"App\",children:/*#__PURE__*/_jsx(DescopeLogin,{})});}export default App;\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"App\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./DescopeWebComponent.map"],"mappings":"uIAG8rC,SAAS,GAAK,CAAC,OAAoB,EAAK,MAAM,CAAC,UAAU,MAAM,SAAsB,EAAK,EAAa,EAAE,CAAC,CAAC,CAAC,0BAH/vC,IAAoC,CAAM,MAAiB,CAAC,IAAM,EAAaA,EAAO,KAAK,CAAO,EAAU,+BAG88B,OADpmC,MAAc,EACG,SAAS,CAAC,IAAM,EAAW,GAAK,IAAI,SAAS,EAAQ,IAAS,CAAC,IAAM,EAAO,SAAS,cAAc,SAAS,CAAC,EAAO,IAAI,EAAI,EAAO,MAAM,GAAK,EAAO,OAAO,EAAQ,EAAO,QAAQ,EAAO,SAAS,KAAK,YAAY,EAAO,EAAG,CAAC,GAAG,CAAC,MAAM,EAAW,yEAAyE,CAAC,MAAM,EAAW,0EAA0E,CAAC,IAAM,EAAI,EAAO,QAAQ,CAAW,YAAU,cAAc,GAAK,YAAY,GAAK,CAAC,CAAO,EAAa,EAAI,iBAAiB,CAAO,EAAc,EAAa,EAAI,aAAa,EAAa,CAAC,GAAK,GAAG,CAAC,GAAc,EAAc,CAAC,IAAM,EAAU,EAAa,QAAQ,GAAG,GAAW,CAAC,EAAU,cAAc,aAAa,CAAC,CAAC,EAAU,UAAU,2BAA2B,EAAU,8CAAqC,IAAM,EAAU,EAAU,cAAc,aAAa,CAAC,EAAU,iBAAiB,cAAc,CAAC,EAAI,SAAS,EAAG,CAAC,EAAU,iBAAiB,QAAQ,GAAK,CAAC,QAAQ,MAAM,iBAAiB,EAAI,EAAG,SAAU,EAAM,CAAC,QAAQ,MAAM,gCAAgC,EAAM,KAAiB,EAAG,EAAE,CAAC,CAAqB,EAAK,MAAM,CAAC,SAAsB,EAAK,MAAM,CAAC,IAAI,EAAa,CAAC,CAAC,CAAC,IAAgI"}