PageSourceSearch

https://blmn.ai/assets/TeamInvite-C_CRehR3.js

js blmn.ai collected 2026-10-05 12:49:37 UTC 5,255 bytes, 1 lines download raw bytes

1import{u as _,k as L,r as c,j as e}from"./framework-vendor-B93SNr2c.js";import{u as B}from"./auth-vendor-F3mG6bnJ.js";import{g as y}from"./lazyWithRetry-CVIkRV-o.js";import{B as N,o as b}from"./marketingRoutes-CKpHVsu_.js";import"./i18n-vendor-D1L2vq_h.js";import"./vendor-DnjmYnSI.js";import"./preload-helper-BXl3LOEh.js";import"./i18n-en-VbnK5yfZ.js";function C(o,i){const t=typeof o?.state=="string"?o.state:"",a=typeof i=="string"?i.trim().toUpperCase():"";return t==="expired"||a==="INVITE_EXPIRED"?{message:"This invitation has expired.",actionLabel:"Back To App",terminal:!0}:t==="revoked"||a==="INVITE_NOT_PENDING"?{message:"This invitation was revoked by the team owner.",actionLabel:"Back To App",terminal:!0}:t==="accepted"?{message:"This invitation has already been accepted.",actionLabel:"Back To App",terminal:!0}:t==="already_joined"?{message:"You are already a member of this team.",actionLabel:"Open Team Settings",terminal:!0}:t==="already_in_team"||a==="ALREADY_IN_TEAM"?{message:"You already belong to a different team and cannot accept this invite.",actionLabel:"Back To App",terminal:!0}:a==="INVITE_EMAIL_MISMATCH"?{message:"This invite is tied to a different email address. Sign in with the invited email to join this team.",actionLabel:"Back To App",terminal:!0}:a==="TEAM_SEAT_LIMIT_REACHED"?{message:"This team has no open paid seats right now. Ask the owner to add seats, then try again.",actionLabel:"Back To App",terminal:!0}:a==="PENDING_TEAM_CHECKOUT"?{message:"This account has a Team checkout pending. Finish or cancel that checkout before accepting this invitation.",actionLabel:"Back To App",terminal:!0}:a==="INVITE_NOT_FOUND"||a==="TEAM_NOT_FOUND"?{message:"This invite link is no longer valid.",actionLabel:"Back To App",terminal:!0}:i&&t==="pending"?{message:String(i),actionLabel:"Accept Invite",terminal:!1}:t==="pending"?{message:"You can join this team now.",actionLabel:"Accept Invite",terminal:!1}:i?{message:String(i),actionLabel:"Back To App",terminal:!0}:{message:"Invite not found.",actionLabel:"Back To App",terminal:!0}}function F({onAccepted:o}){const i=_(),{inviteId:t}=L(),{isAuthenticated:a,isLoading:w,loginWithRedirect:E,getAccessTokenSilently:d,user:r}=B(),[l,h]=c.useState(null),[f,x]=c.useState(!1),[v,T]=c.useState(!1),[k,m]=c.useState("");c.useEffect(()=>{if(!a||!t)return;let n=!1;return(async()=>{x(!0),m("");try{const s=await y(d),u="",A=new URL(`${u}/api/team/invites/${encodeURIComponent(t)}`,window.location.origin);typeof r?.email=="string"&&r.email.trim()&&A.searchParams.set("email",r.email.trim());const g=await fetch(A.toString(),{headers:{Authorization:`Bearer ${s}`}}),I=await g.json().catch(()=>({}));if(!g.ok)throw new Error(I?.error||`Failed to load invite (${g.status})`);n||h(I?.invite||null)}catch(s){n||(h(null),m(String(s?.message||s)))}finally{n||x(!1)}})(),()=>{n=!0}},[t,a,d,r?.email]);const j=async()=>{if(t){T(!0),m("");try{const n=await y(d),s=await fetch(`/api/team/invites/${encodeURIComponent(t)}/accept`,{method:"POST",headers:{Authorization:`Bearer ${n}`,"Content-Type":"application/json"},body:JSON.stringify(r?.email?{email:r.email}:{})}),u=await s.json().catch(()=>({}));if(!s.ok)throw new Error(u?.error||`Failed to accept invite (${s.status})`);typeof o=="function"&&await o(),i(b("team","/subscribe",{joined:"true"}),{replace:!0})}catch(n){m(String(n?.message||n).trim())}finally{T(!1)}}},p=C(l,k);return w?e.jsx("div",{className:"py-20 text-center text-neutral-300",children:"Loading invite..."}):a?e.jsx("div",{className:"mx-auto flex max-w-2xl flex-col gap-6 px-4 py-16 text-white",children:e.jsxs("div",{className:"glass-field rounded-2xl p-8 text-center",children:[e.jsx("p",{className:"text-xs uppercase tracking-[0.16em] text-white/60",children:"Team Invite"}),e.jsx("h1",{className:"mt-2 text-3xl font-light",children:l?.team?.name||"Invitation"}),f?e.jsx("p",{className:"mt-4 text-sm text-neutral-300",children:"Loading invite details..."}):null,f?null:e.jsxs(e.Fragment,{children:[e.jsx("p",{className:"mt-4 text-sm text-neutral-300",children:p.message}),l?.expiresAt?e.jsxs("p",{className:"mt-2 text-xs text-neutral-400",children:["Expires at: ",new Date(Number(l.expiresAt||0)*1e3).toLocaleStr
1ing()]}):null,p.terminal?e.jsx(N,{onClick:()=>i(l?.state==="already_joined"?b("team"):"/"),variant:"primary",size:"lg",className:"mt-6 btn-gradient-outline bg-transparent text-sm",children:p.actionLabel}):e.jsx(N,{disabled:v,onClick:()=>{j()},variant:"secondary",size:"lg",className:"mt-6 text-sm",children:v?"Joining...":"Accept Invite"})]})]})}):e.jsx("div",{className:"mx-auto flex max-w-2xl flex-col gap-6 px-4 py-16 text-center text-white",children:e.jsxs("div",{className:"glass-field rounded-2xl p-8",children:[e.jsx("h1",{className:"text-2xl font-light",children:"Team Invite"}),e.jsx("p",{className:"mt-3 text-sm text-neutral-300",children:"Sign in to review and accept this team invitation."}),e.jsx("button",{type:"button",onClick:()=>E({authorizationParams:{redirect_uri:`${window.location.origin}/team/invite/${t}`}}),className:"mt-6 inline-flex items-center justify-center rounded-full px-5 py-3 text-sm btn-gradient-outline text-white",style:{backgroundColor:"transparent"},children:"Sign In To Continue"})]})})}export{F 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.