1import{u as T,a as A,h as U,r as c,j as e,V as F,C as I,c as y,M as p,bU as $}from"./index-DTlGp7Od.js";import{a as B}from"./authApi-CAwSzJa9.js";import{G as N}from"./iconBase-PeQVmnlB.js";import{F as z}from"./index-CB0cFuU5.js";import{getStoreUrlForPlatform as G}from"./Login-BHbHOrk9.js";import"./microsoft_logo-NKtKlqOc.js";import"./lastSignInMethod-CCOCyfh9.js";function w(a){return N({attr:{viewBox:"0 0 1024 1024"},child:[{tag:"path",attr:{d:"M512 1024c-69.1 0-136.2-13.5-199.3-40.2C251.7 958 197 921 150 874c-47-47-84-101.7-109.8-162.7C13.5 648.2 0 581.1 0 512c0-19.9 16.1-36 36-36s36 16.1 36 36c0 59.4 11.6 117 34.6 171.3 22.2 52.4 53.9 99.5 94.3 139.9 40.4 40.4 87.5 72.2 139.9 94.3C395 940.4 452.6 952 512 952c59.4 0 117-11.6 171.3-34.6 52.4-22.2 99.5-53.9 139.9-94.3 40.4-40.4 72.2-87.5 94.3-139.9C940.4 629 952 571.4 952 512c0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 0 0-94.3-139.9 437.71 437.71 0 0 0-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.2C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3s-13.5 136.2-40.2 199.3C958 772.3 921 827 874 874c-47 47-101.8 83.9-162.7 109.7-63.1 26.8-130.2 40.3-199.3 40.3z"},child:[]}]})(a)}function Y(a){return N({attr:{viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},child:[{tag:"path",attr:{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"},child:[]}]})(a)}const q=()=>e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"mb-6 flex justify-center",children:e.jsx(w,{className:"h-16 w-16 animate-spin text-primary"})}),e.jsx("h4",{className:"text-2xl font-medium mb-2",children:"Verifying Your Account"}),e.jsx("p",{className:"text-muted-foreground text-sm",children:"Please wait while we verify your email address..."})]}),O=({redirectMessage:a})=>e.jsxs("div",{className:"text-center py-12",children:[e.jsx("div",{className:"mb-6 flex justify-center",children:e.jsx(z,{className:"h-16 w-16 text-green-500"})}),e.jsx("h4",{className:"text-2xl font-medium mb-2",children:"Account Verified Successfully!"}),e.jsx("p",{className:"text-muted-foreground mb-4 text-sm",children:"Your email has been verified"}),e.jsxs("div",{className:"flex items-center justify-center gap-2",children:[e.jsx(w,{className:"h-4 w-4 animate-spin text-primary"}),e.jsx("p",{className:"text-sm text-muted-foreground",children:a})]})]}),H=({errorMessage:a,onLogin:r,onSignup:o})=>e.jsxs("div",{className:"text-center py-8",children:[e.jsx("div",{className:"mb-6 flex justify-center",children:e.jsx(Y,{className:"h-16 w-16 text-red-500"})}),e.jsx("h4",{className:"text-2xl font-medium mb-2",children:"Verification Failed"}),e.jsx("p",{className:"text-muted-foreground mb-6 text-sm px-4",children:a||"Unable to verify your account"}),e.jsxs("div",{className:"space-y-3 max-w-sm mx-auto px-4",children:[e.jsx(y,{onClick:r,className:"w-full",children:"Go to Login"}),e.jsx(y,{onClick:o,variant:"outline",className:"w-full",children:"Sign Up Again"}),e.jsxs("p",{className:"text-xs text-muted-foreground mt-4",children:["Need help?"," ",e.jsx("a",{href:"mailto:[email protected]",className:"text-primary hover:underline",children:"Contact Support"})]})]})]}),te=()=>{const a=T(),[r]=A(),{login:o}=U(),[n,i]=c.useState("pending"),[S,v]=c.useState(!1),[C,x]=c.useState(""),[k,b]=c.useState(""),j=r.get("source")==="mobile",P=`${F}/login.svg`;return c.useEffect(()=>{const L=async t=>{i("success");try{await o(t);const s=t?.data?.data?.user?.id,d=(t?.data?.data?.user?.user_products||[]).map(g=>g.product.name);if((j||t?.data?.source==="mobile")&&s&&p){const g=t?.data?.state,_=p?`${p}oauth/callback`:"commander://oauth/callback",M=`${$}/auth/callback/mobile`,h=new URLSearchParams({redirect_uri:_,user_id:s,state:g??""}),f=G();f&&(f.includes("apple.com")?h.set("app_store_url",f):h.set("play_store_url",f)),b("Redirecting to the Commander app..."),setTimeout(()=>{window.location.href=`${M}?${h.toString()}`},1e3);return}let u="/dashboard",m="Redirecting to dashboard...";d.includes("CommanderAI")?t?.data?.data?.user?.onboarding_complete?(u="/dashboard",m="Redirecting to dashboard..."):(u="/onboarding",m="Redirecting to complete your setup..."):d.includes("CommanderExpo")&&(u="/expo/home",m="Redirecting to Commander Expo..."),b(m),setTimeout(()=>{a(u)},2500)}catch(s){console.error("Failed to set auth state after verification:",s),i("error"),x("Failed to complete login. Please try logging in manually.")}},R=t=>{i("error");let s="An error occurred during verification";t?.response?.data?.message?s=t.response.data.message:t?.message&&(s=t.message),s.toLowerCase().includes("expired")?s="This verification link has expired. Please request a new one.":s.toLowerCase().includes("already verified")?s="This account has already been verified. You can login now.":s.toLowerCase().includes("invalid")&&(s="This verification link is invali
1d or has been used."),x(s)},V=async()=>{const t=r.get("u"),s=r.get("t");if(!t||!s){i("error"),x("Invalid verification link. Required parameters are missing.");return}v(!0),i("verifying");try{const d={status:200,data:await B.verifySignup(t,s,r.get("source")),message:"Email verified successfully"};L(d)}catch(l){console.error("Verification error occurred",l),R(l)}finally{v(!1)}},E=setTimeout(()=>{V()},500);return()=>clearTimeout(E)},[o,a,r.get,j]),e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-background p-4",style:{backgroundImage:`url(${P})`,backgroundSize:"cover",backgroundPosition:"center",backgroundColor:"black"},children:e.jsx("div",{className:"w-full max-w-md",children:e.jsxs("div",{className:"bg-card rounded-lg shadow-lg p-8",children:[e.jsx("div",{className:"text-center flex flex-col items-center",children:e.jsx("div",{className:"mb-4 fill-black dark:fill-white",children:e.jsx(I,{})})}),n==="verifying"&&e.jsx(q,{}),n==="success"&&e.jsx(O,{redirectMessage:k}),(n==="error"||n==="pending")&&!S&&e.jsx(H,{errorMessage:C,onLogin:()=>a("/login"),onSignup:()=>a("/signup")})]})})})};export{te as default}; 2//# sourceMappingURL=VerifySignup-B8vogvsP.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.