1import{J as g,K as p,ez as f,u as j,r as l,s as k,aD as N,j as e,a1 as d,S as y,B as n,L as o,e as w,d as b}from"./index-D91jw-Fp.js";const v=g({method:"POST"}).handler(p("2caa077b91516f82955ebcdf081ba087b3dcdb70ac95c1257ba14ad757e42cc0"));function C(){const{session_id:i}=f.useSearch(),m=j(v),[s,a]=l.useState({kind:"loading"}),[c,u]=l.useState(0);return l.useEffect(()=>{let r=!1;return(async()=>{const{data:h}=await k.auth.getUser();if(!r){if(h?.user){a({kind:"logged_in"});return}if(!i){a({kind:"error",message:"Missing checkout reference."});return}try{const t=await m({data:{sessionId:i,environment:N()}});if(r)return;t.status==="ready"?a({kind:"ready",email:t.email,orgName:t.orgName,setupLink:t.setupLink}):t.status==="provisioning"||t.status==="processing"?(a({kind:"provisioning",email:t.email}),c<15&&setTimeout(()=>u(x=>x+1),2e3)):a({kind:"error",message:"We couldn't find your purchase. Try the link in your email, or contact [email protected]."})}catch(t){if(r)return;a({kind:"error",message:t?.message??"Something went wrong loading your purchase."})}}})(),()=>{r=!0}},[i,c]),e.jsx("div",{className:"min-h-screen flex items-center justify-center p-6",children:e.jsxs("div",{className:"max-w-md w-full text-center space-y-6 border rounded-xl p-8 bg-card",children:[s.kind==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"h-12 w-12 text-primary mx-auto animate-spin"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Confirming your payment"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"One moment, we're setting up your workspace."})]})]}),s.kind==="provisioning"&&e.jsxs(e.Fragment,{children:[e.jsx(d,{className:"h-12 w-12 text-primary mx-auto animate-spin"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Setting up your workspace"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:["Payment received",s.email?` for ${s.email}`:"",". This takes about ten seconds."]}),e.jsx("p",{className:"text-xs text-muted-foreground mt-3",children:"If this screen doesn't update, refresh the page, or check your email for a setup link."})]})]}),s.kind==="ready"&&e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"h-14 w-14 text-primary mx-auto"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:s.orgName?`${s.org
1Name} is ready`:"Your workspace is ready"}),e.jsxs("p",{className:"text-muted-foreground mt-2",children:["Set a password for ",e.jsx("span",{className:"font-medium text-foreground",children:s.email})," and you're in."]})]}),s.setupLink?e.jsx("a",{href:s.setupLink,className:"block",children:e.jsx(n,{size:"lg",className:"w-full",children:"Set password and open workspace"})}):e.jsx(n,{asChild:!0,size:"lg",className:"w-full",children:e.jsx(o,{to:"/sign-in",children:"Go to sign in"})}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"We also emailed you the same link. Either one works."}),e.jsxs("p",{className:"text-xs text-muted-foreground",children:["Stuck?"," ",e.jsx("a",{className:"underline",href:"mailto:[email protected]",children:"[email protected]"})]})]}),s.kind==="logged_in"&&e.jsxs(e.Fragment,{children:[e.jsx(w,{className:"h-14 w-14 text-primary mx-auto"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"Payment complete"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:"Your subscription is being activated. Access updates within a few seconds."})]}),e.jsx(n,{asChild:!0,className:"w-full",children:e.jsx(o,{to:"/",children:"Go to dashboard"})})]}),s.kind==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(b,{className:"h-12 w-12 text-amber-500 mx-auto"}),e.jsxs("div",{children:[e.jsx("h1",{className:"text-2xl font-semibold",children:"We hit a snag"}),e.jsx("p",{className:"text-muted-foreground mt-2",children:s.message})]}),e.jsx(n,{asChild:!0,className:"w-full",children:e.jsx(o,{to:"/sign-in",children:"Go to sign in"})})]})]})})}export{C as component};
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.