1import{_ as z}from"./k96fQixy.js";import{j as U,u as I,aa as T,x as C,y as A,b as N,H as Y,o as i,U as r,V as t,m as l,K as n,a4 as u,$,W as f,X as v,a9 as B,r as h,f as b,ab as E,n as M}from"./vz5Qp00s.js";import{u as P}from"./DVPO9ewL.js";import"./DlAUqK2U.js";const W={class:"container flex min-h-[60vh] items-center justify-center py-16"},R={class:"w-full max-w-lg rounded-2xl border border-system-neutral-grey-40 bg-system-base-white p-8 text-center shadow-sm sm:p-12"},V={key:0,class:"flex flex-col items-center gap-4 py-6"},H={class:"mx-auto flex size-20 items-center justify-center rounded-full bg-ui-green-10/10"},D={class:"body-2 mt-3 text-text-grey-10"},F={class:"font-medium text-text-dark-blue-10"},G={class:"mx-auto flex size-20 items-center justify-center rounded-full bg-product-orange-20/10"},J={class:"mt-10 flex flex-col items-center justify-center gap-3 sm:flex-row"},L={class:"mx-auto flex size-20 items-center justify-center rounded-full bg-system-neutral-grey-40"},O={class:"mx-auto flex size-20 items-center justify-center rounded-full bg-ui-red-10/10"},K={class:"body-2 mt-3 text-text-grey-10"},X={class:"mt-10 flex flex-col items-center justify-center gap-3 sm:flex-row"},se=U({__name:"[inviteId]",setup(q){I({title:"Join Team",description:"Accept your Pro Sound Effects team invitation.",robots:"noindex, nofollow"});const _=T(),m=C(),k=A(),w=P(),{signOut:S}=N(),g=b(()=>String(_.params.inviteId??"").trim()),s=h("loading"),a=h(null),x=b(()=>m.teamName||"");async function p(){if(s.value="loading",a.value=null,!g.value||g.value.length>200){a.value="Invalid invitation link. Please check the link and try again.",s.value="error";return}const y=k.accessToken?.trim();if(!y){a.value="You must be signed in to join a team.",s.value="error";return}try{const o=E().public.apiBase||"https://api.prosoundeffects.com";switch(await $fetch(`/v1/account/join-team/${encodeURIComponent(g.value)}`,{baseURL:o,method:"POST",headers:{Authorization:`Bearer ${y}`,"Content-Type":"application/json"},body:{},credentials:"include",timeout:3e4})){case"Success":try{await m.fetchUserData(y)}catch{}w.success(m.teamName?`You've joined ${m.teamName}!`:"You've joined the team!"),await M("/account",{replace:!0});return;case"AlreadyTeamMember":s.value="alreadyMember";return;case"AlreadyUsed":s.value="alreadyUsed";return;case"WrongUserExisting":case"WrongUserNotExisting":s.value="wrongUser";return;default:a.value="We couldnât process this invitation. Please try again.",s.value="error";return}}catch(e){const o=e.statusCode;o===404?a.value="Invitation not found. It may have expired.":o===403?a.value="You do not have permission to join this team.":o===400?a.value="Invalid invitation link.":o&&o>=500?a.value="Server error. Please try again shortly.":e instanceof Error&&e.message.includes("timeout")?a.value="Connection timeout. Check your internet and try again.":a.value=e instanceof Error?e.message:"An unexpected error occurred.",s.value="error"}}async function j(){if(typeof sessionStorage<"u")try{sessionStorage.setItem("postSignInUrl",`/join-team/${g.value}`)}catch{}await S()}return Y(p),(y,e)=>{const o=z,d=$,c=B;return i(),r("div",W,[t("div",R,[l(s)==="loading"?(i(),r("div",V,[n(o),e[0]||(e[0]=t("p",{class:"body-2 text-text-grey-10"},"Joining teamâ¦",-1))])):l(s)==="alreadyMember"?(i(),r(u,{key:1},[t("div",H,[n(d,{name:"lucide:check",class:"size-10 text-ui-green-10","aria-hidden":""})]),e[3]||(e[3]=t("h1",{class:"heading-4 mt-6 text-text-dark-blue-10"},"You're already on this team",-1)),t("p",D,[l(x)?(i(),r(u,{key:0},[e[1]||(e[1]=f(" You're already a member of ",-1)),t("span",F,v(l(x)),1),e[2]||(e[2]=f(". Head to your account to get started. ",-1))],64)):(i(),r(u,{key:1},[f(" You're already a member of this team. Head to your account to get started. ")],64))]),n(c,{class:"mt-10",size:"xs",label:"Go to Account",to:"/account","show-icon":""})],64)):l(s)==="wrongUser"?(i(),r(u,{key:2},[t("div",G,[n(d,{name:"lucide:user-x",class:"size-10 text-product-orange-20","aria-hidden":""})]),e[4]||(e[4]=t("h1",{class:"heading-4 mt-6 text-text-dark-blue-10"},"Wrong account signed in",-1)),e[5]||(e[5]=t("p",{class:"body-2 mt-3 text-text-grey-10"}," This invitation was sent to a different email address. Sign out and sign back in using the email the invite was sent to. ",-1)),t("div",J,[n(c,{size:"xs",label:"Sign out and try again",onClick:j}),n(c,{size:"xs",label:"Cancel",variant:"ghost",to:"/"})])],64)):l(s)==="alreadyUsed"?(i(),r(u,{key:3},[t("div",L,[n(d,{name:"lucide:clock",class:"size-10 text-text-grey-20","aria-hidden":""})]),e[6]||(e[6]=t("h1",{class:"heading-4 mt-6 text-text-dark-blue-10"},"Invitation already used",-1)),e[7]||(e[7]=t("p",{class:"body-2 mt-3 text-text-grey-10"}," This invitation has already been accepted. If you think this is a mistake, please contact your team administrator. ",-1)),n(c,{class:"mt-10",size:"xs",label:"Go to Account",variant:"secondary",to:"/account"})],64)):(i(),r(u,{key:4},[t("div",O,[n(d,{name:"lucide:triangle-alert",class:"size-10 text-ui-red-10","aria-hidden":""})]),e[8]||(e[8]=t("h1",{class:"heading-4 mt-6 text-text-dark-blue-10"}
1,"Something went wrong",-1)),t("p",K,v(l(a)||"We couldnât process this invitation. Please try again."),1),t("div",X,[n(c,{size:"xs",label:"Try again",onClick:p}),n(c,{size:"xs",label:"Contact support",variant:"ghost",to:"/contact-sales"})])],64))])])}}});export{se as default}; 2//# sourceMappingURL=CsCkoai8.js.map
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.