1import{d6 as y,t as k,kq as N,r as n,kk as b,j as e,bN as v,ae as w}from"./index-B31rP-tR.js";function S(){const[h]=y(),{profile:o,isLoading:u}=k(),{accounts:l,isLoading:m}=N(),[p,a]=n.useState("loading"),[j,i]=n.useState(null),x=n.useRef(!1),f=h.get("seats"),c=f?Number.parseInt(f,10):NaN,d=Number.isFinite(c)&&c>0?c:null,r=(o==null?void 0:o.activeTeamId)??null,s=n.useMemo(()=>{if(d)return d;if(!r)return 1;const t=l.filter(g=>g.team_id===r&&(g.onboarding_status??"")!=="disconnected").length;return Math.max(1,t)},[d,l,r]);return n.useEffect(()=>{if(!x.current&&!(u||m)){if(!r){a("error"),i("We couldn't identify your workspace. Open the pricing page to choose a plan.");return}x.current=!0,a("redirecting"),b(r,{quantity:s,billingInterval:"month"}).then(t=>{if(t.success){window.location.href=t.data.url;return}a("error"),i(t.error)}).catch(t=>{a("error"),i(t instanceof Error?t.message:"Unexpected error.")})}},[u,m,r,s]),e.jsx("div",{className:"flex flex-1 items-center justify-center px-4 py-16",children:e.jsx("div",{className:"w-full max-w-md rounded-2xl border bg-card p-8 text-center shadow-sm",children:p==="error"?e.jsxs(e.Fragment,{children:[e.jsx("h1",{className:"text-xl font-semibold text-foreground",children:"We couldn't start checkout"}),e.jsx("p",{className:"mt-3 text-sm text-muted-foreground",children:j??"Please try again from the pricing page."}),e.jsx(v,{to:`/pricing?seats=${s}`,className:"mt-6 inline-flex items-center justify-center rounded-xl bg-primary px-5 py-2.5 text-sm font-semibold text-primary-foreground hover:bg-primary/90",children:"Go to pricing"})]}):e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center justify-center",children:e.jsx(w,{className:"h-8 w-8 animate-spin text-primary"})}),e.jsx("h1",{className:"mt-6 text-xl font-semibold text-foreground",children:"Redirecting to checkoutâ¦"}),e.jsxs("p",{className:"mt-3 text-sm text-muted-foreground",children:["Reserving ",s," LinkedIn sender",s===1?"":"s"," for your workspace. You can change this on the Stripe page."]})]})})})}export{S as default};
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.