PageSourceSearch

https://voxprep.ai/assets/AcceptInvite-Cc6CB_SW.js

js voxprep.ai collected 2026-10-05 13:57:42 UTC 3,924 bytes, 6 lines download raw bytes

1import{J as j,u as k,a as I,c as N,g as y,r,e as w,s as C,j as e,N as S,B as o,L as g}from"./index-BWIthYLv.js";import{L as T}from"./loader-circle-C9-7JLDD.js";import{U as _}from"./users-CaavJg7r.js";import{C as A}from"./circle-check-DALdbxsK.js";/**
2 * @license lucide-react v0.462.0 - ISC
3 *
4 * This source code is licensed under the ISC license.
5 * See the LICENSE file in the root directory of this source tree.
6 */const L=j("CircleX",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);function R(){const{t}=k(),{user:m,loading:l}=I(),i=N(),[v]=y(),a=v.get("token")||"",[s,n]=r.useState("loading"),[b,p]=r.useState(""),[u,f]=r.useState(""),x=r.useRef(!1);return w("Accept Workspace Invitation | VoxPrep","Join your team workspace on VoxPrep."),r.useEffect(()=>{if(!l){if(!a){n("error"),p(t("acceptInvite.noToken","This invitation link is invalid."));return}if(!m){try{localStorage.setItem("voxprep_pending_invite",a)}catch{}n("need-auth");return}x.current||(x.current=!0,(async()=>{n("loading");const{data:c,error:h}=await C.rpc("accept_workspace_invite",{_token:a});if(h){n("error"),p(h.message||t("acceptInvite.failed","We couldn't accept this invitation."));return}const d=Array.isArray(c)?c[0]:c;f((d==null?void 0:d.workspace_name)||"");try{localStorage.removeItem("voxprep_pending_invite")}catch{}n("success")})())}},[m,l,a,t]),r.useEffect(()=>{if(s!=="success")return;const c=window.setTimeout(()=>i("/dashboard",{replace:!0}),1500);return()=>clearTimeout(c)},[s,i]),e.jsxs("div",{className:"min-h-screen bg-background",children:[e.jsx(S,{}),e.jsx("div",{className:"max-w-md mx-auto px-4 py-24 text-center",children:e.jsxs("div",{className:"rounded-2xl border border-border bg-card p-8",children:[s==="loading"&&e.jsxs(e.Fragment,{children:[e.jsx(T,{className:"h-10 w-10 animate-spin text-primary mx-auto mb-4"}),e.jsx("p",{className:"text-muted-foreground",children:t("acceptInvite.processing","Processing your invitation…")})]}),s==="need-auth"&&e.jsxs(e.Fragment,{children:[e.jsx(_,{className:"h-10 w-10 text-primary mx-auto mb-4"}),e.jsx("h1",{className:"text-xl font-bold mb-2",children:t("acceptInvite.signInTitle","Sign in to join the workspace")}),e.jsx("p",{className:"text-muted-foreground mb-5",children:t("acceptInvite.signInSub","Sign in or create an account with the email this invite was sent to.")}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(o,{asChild:!0,className:"bg-primary text-primary-foreground hover:bg-primary/90",children:e.jsx(g,{to:`/sign-in?next=${encodeURIComponent(`/accept-invite?token=${a}`)}`,children:t("acceptInvite.signIn","Sign in")})}),e.jsx(o,{asChild:!0,variant:"outline",children:e.jsx(g,{to:`/sign-up?next=${encodeURIComponent(`/accept-invite?token=${a}`)}`,children:t("acceptInvite.signUp","Create account")})})]})]}),s==="success"&&e.jsxs(e.Fragment,{children:[e.jsx(A,{className:"h-10 w-10 text-primary mx-auto mb-4"}),e.jsx("h1",{className:"text-xl font-bold mb-2",children:t("acceptInvite.successTitle","You're in!")}),e.jsx("p",{className:"text-muted-foreground mb-5",children:u?t("acceptInvite.successNamed","You've joined the {{name}} workspace and now share its credit pool.",{name:u}):t("acceptInvite.success","You've joined the workspace and now share its credit pool.")}),e.jsx(o,{onClick:()=>i("/dashboard"),className:"bg-primary text-primary-foreground hover:bg-primary/90",children:t("acceptInvite.goDashboard","Go to dashboard")})]}),s==="error"&&e.jsxs(e.Fragment,{children:[e.jsx(L,{className:"h-10 w-10 text-destructive mx-auto mb-4"}),e.jsx("h1",{className:"text-xl font-bold mb-2",children:t("acceptInvite.errorTitle","Invitation problem")}),e.jsx("p",{className:"text-muted-foreground mb-5",children:b}),e.jsx(o,{onClick:()=>i("/dashboard"),variant:"outline",children:t("acceptInvite.goDashboard","Go to dashboard")})]})]})})]})}export{R 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.