PageSourceSearch

https://whisperai.com/assets/InviteAccept-6VPpxoCL.js

js whisperai.com collected 2026-10-01 11:43:27 UTC 5,524 bytes, 1 lines download raw bytes

1import{e as A,u as S,r as x,j as e}from"./react-vendor-jUbs3Udp.js";import{a as q,u as C,b as R}from"./query-vendor-DSnlNft5.js";import{e as M,C as v,b as f,c as g,d as j,f as E,B as b,a as I}from"./index-gcDjpmFZ.js";import{s as D}from"./DashboardSidebar-CbdnWOF0.js";import{L as k,T as K,s as P,ac as Q}from"./icons-Cjebwm3l.js";import"./ui-vendor-DDR7ojRs.js";import"./contactSupport-CwuPj557.js";import"./popover-C3oBq2Al.js";import"./types-BlXWDmgE.js";import"./http.utils-DNrENna9.js";import"./tiers-YplZptYu.js";import"./constants-BVJMwbx9.js";import"./recorderFlow-DOtFBzHR.js";import"./recording-recap-BTFCYBoG.js";import"./select-DvkV6m6v.js";import"./dialog-dt1PUCaT.js";import"./textarea-ykfa7rqe.js";import"./LanguageSelectMenu-BOReM651.js";import"./transcription-prompts-B85WaLJ-.js";import"./code-switching-languages-Bj022q8w.js";import"./languages-B8khCth8.js";import"./transcription-languages-BinpD4Nf.js";import"./alert-CrwcSQF1.js";import"./alert-dialog-DHzlVJJ2.js";import"./media-types-BOFpRQIT.js";import"./index.browser-Ce0qSQcm.js";import"./collapsible-C0L5KfTJ.js";import"./index-DzUVWpsq.js";(function(){try{var s=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};s.SENTRY_RELEASE={id:"2156d85cf031d709fa1b379f59bedaa6c159aa65"};var i=new s.Error().stack;i&&(s._sentryDebugIds=s._sentryDebugIds||{},s._sentryDebugIds[i]="42760e01-51ed-4023-9f69-ae56bf231196",s._sentryDebugIdIdentifier="sentry-dbid-42760e01-51ed-4023-9f69-ae56bf231196")}catch{}})();function pe(){const[,s]=A("/invite/:token"),i=s?.token??"",[,o]=S(),u=q(),{toast:T}=M(),[y,w]=x.useState(null),t=C({queryKey:["/api/v2/invites",i,"preview"],queryFn:async()=>(await I("GET",`/api/v2/invites/${i}/preview`)).json(),enabled:!!i,retry:!1}),l=C({queryKey:["/api/v2/auth/user"],retry:!1}),r=R({mutationFn:async()=>(await I("POST",`/api/v2/invites/${i}/accept`)).json(),onSuccess:async a=>{D(a.organizationId),await Promise.all([u.invalidateQueries({queryKey:["/api/v2/auth/user"]}
1),u.invalidateQueries({queryKey:["/api/v2/orgs"]}),u.invalidateQueries({queryKey:["/api/v2/account/usage"]})]),T({title:"Invite accepted",description:"Welcome to the team!"}),o("/dashboard")},onError:a=>{const h=a?.message?.replace(/^\d+:\s*/,"")??"Could not accept invite";try{const L=JSON.parse(h);w(L.error??h)}catch{w(h)}}}),d=!!l.data?.id,p=l.data?.email,m=d&&!!t.data&&!!p&&p.toLowerCase()!==t.data.email.toLowerCase();if(x.useEffect(()=>{if(t.isLoading||l.isLoading||!t.data?.live||d)return;const N=`${t.data.userExists?"/signin":"/signup"}?inviteToken=${encodeURIComponent(i)}&email=${encodeURIComponent(t.data.email)}`;o(N)},[t.data,t.isLoading,l.isLoading,d,i,o]),x.useEffect(()=>{d&&t.data?.live&&(m||r.isPending||r.isSuccess||r.isError||r.mutate())},[d,t.data?.live,m]),!i)return e.jsx(c,{children:e.jsx("p",{children:"Missing invite token."})});if(t.isLoading)return e.jsx(c,{children:e.jsx(k,{className:"w-6 h-6 animate-spin text-slate-400"})});if(t.isError||!t.data)return e.jsx(c,{children:e.jsxs(v,{className:"max-w-md w-full",children:[e.jsx(f,{children:e.jsxs(g,{className:"flex items-center gap-2 text-slate-900",children:[e.jsx(K,{className:"w-5 h-5 text-amber-500"})," Invite not found"]})}),e.jsx(j,{className:"text-sm text-slate-600",children:"We couldn't find that invite. The link may be incorrect or the invite may have been revoked. Ask the team owner to send a new one."})]})});const n=t.data;if(!n.live){const a=n.acceptedAt?"This invite has already been accepted.":n.revokedAt?"This invite was revoked by the team owner.":"This invite has expired.";return e.jsx(c,{children:e.jsxs(v,{className:"max-w-md w-full",children:[e.jsxs(f,{children:[e.jsx(g,{children:"Invite no longer valid"}),e.jsx(E,{children:a})]}),e.jsx(j,{children:e.jsx(b,{variant:"outline",onClick:()=>o("/dashboard"),"data-testid":"button-go-dashboard",children:"Go to dashboard"})})]})})}return e.jsx(c,{children:e.jsxs(v,{className:"max-w-md w-full","data-testid":"card-invite-preview",children:[e.jsx(f,{children:e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx("div",{className:"w-10 h-10 rounded-lg bg-indigo-50 flex items-center justify-center",children:e.jsx(P,{className:"w-5 h-5 text-indigo-600"})}),e.jsxs("div",{children:[e.jsx(g,{className:"text-lg",children:n.organizationName}),e.jsxs(E,{children:["You've been invited as a ",n.role]})]})]})}),e.jsxs(j,{className:"space-y-3",children:[e.jsxs("p",{className:"text-sm text-slate-600",children:["Invite sent to ",e.jsx("strong",{className:"text-slate-900",children:n.email}),"."]}),m&&e.jsxs("div",{className:"rounded-md bg-amber-50 border border-amber-200 p-3 text-sm text-amber-900",children:["You're signed in as ",e.jsx("strong",{children:p}),", which doesn't match this invite. Sign out and sign in with ",e.jsx("strong",{children:n.email})," to accept."]}),y&&e.jsx("div",{className:"rounded-md bg-red-50 border border-red-200 p-3 text-sm text-red-900",children:y}),e.jsxs("div",{className:"flex gap-2 pt-2",children:[e.jsxs(b,{onClick:()=>r.mutate(),disabled:r.isPending||!!m,"data-testid":"button-accept-invite",children:[r.isPending?e.jsx(k,{className:"w-4 h-4 mr-2 animate-spin"}):e.jsx(Q,{className:"w-4 h-4 mr-2"}),"Accept invite"]}),e.jsx(b,{variant:"outline",onClick:()=>o("/dashboard"),"data-testid":"button-decline",children:"Maybe later"})]})]})]})})}function c({children:s}){return e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-slate-50 p-4",children:s})}export{pe 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.