1import{f as e,c as a,r as i,l as t,L as o,M as n,bz as s,v as r,m as l,n as u,p as c,V as d,e as m,j as v,bA as g,bB as p}from"#entry";import{P as y}from"./CrK_MUeO.js";import{u as f}from"./inpFMjNm.js";import{V as h}from"./Bpq7MrYI.js";import{B as k,c as b,r as x,x as w,aG as z,ay as j,aw as _,$ as C,av as A,R as G,aq as P,az as T,aH as S,U as Y,C as $}from"./nX7w3--X.js";import"./CzuCJjyz.js";import"./CFQTgrnx.js";const N={key:0,class:"d-flex flex-column align-center py-16"},I={key:1,class:"d-flex flex-column align-center py-16"},E={class:"text-body-1"},M={key:2,class:"d-flex flex-column align-center text-center py-12"},U={class:"text-body-1 text-medium-emphasis mb-6"},V={key:3,class:"d-flex flex-column align-center text-center"},q={class:"text-h4 font-weight-bold primary--text mb-3"},B={class:"text-body-1 mb-2"},D={class:"text-body-2 text-medium-emphasis mb-6"},J={key:4,class:"d-flex flex-column align-center text-center py-12"},L={class:"text-h5 font-weight-bold mb-2"},O={class:"text-body-1 text-medium-emphasis mb-6"},W=k({__name:"[token]",setup(k){const{setSEO:W}=f();W({title:"Join Your Organization",description:"Claim your organizationâs Giving Compass Pro seat.",noIndex:!0});const H=e(),R=a(),F=i(),K=t(),Q=o(),X=b((()=>String(H.params.token??""))),Z=x("loading"),ee=x(null),ae=x([]),ie=x(null),te=x(!1),oe=x(!1),ne=b((()=>ae.value.map((e=>`@${e}`)).join(" or ")));function se(e,a){const i=e?.data?.detail;return"string"==typeof i?i:Array.isArray(i)?i.map((e=>e.msg)).join("; "):e?.message||a}async function re(){if(Z.value="loading",!X.value)return Z.value="not_found",Z.value;const{data:e,error:a}=await Q.checkInviteToken(X.value);return a||!e?(Z.value="error",Z.value):(ee.value=e.orgName,ae.value=e.allowedDomains??[],Z.value=e.valid?"open":e.status,Z.value)}async function le(){ie.value=null,oe.value=!1,Z.value="joining";const{data:e,error:a}=await Q.joinViaInviteLink(X.value);if(a){const e=n(a);return 403!==e&&404!==e&&409!==e&&410!==e||s(),404===e||410===e?void(await re()):403===e?(await re(),void(ie.value=se(a,`This link is limited to ${ne.value||"specific"} email addresses.`))):409===e?void("open"===await re()&&(ie.value="Your account is already associated with an enterprise organization, so it can't claim a seat here.",oe.value=!0)):void("open"===await re()&&(ie.value=se(a,"Something went wrong joining. Please try again.")))}if(e){if("pending"===e.status)return s(),ee.value=e.orgName,void(Z.value="pending");s(),e.permissionsUpdated&&await R.refreshAuthToken(),R.isEnterpriseMember||await R.syncTokenUntilEnterpriseMember(),R.previewExpiresAt=null,R.previewGrantType="enterprise",F.showSnackbar({message:`Welcome to ${e.orgName} â you now have Giving Compass Pro access.`,color:"success",timeout:6e3}),await r("/")}else Z.value="error"}w((async()=>{await re(),"open"===Z.value&&R.isAuthenticated&&(R.hasPaidSubscription||await le())}));const ue=async()=>{if(!te.value){te.value=!0;try{if(K.trackSignupClick("enterprise","enterprise_join_landing"),R.isAuthenticated)return void(await le());g({token:X.value}),await p(X.value)}finally{te.value=!1}}},ce=b((()=>{switch(Z.value){case"not_found":return{icon:"mdi-link-off",title:"This link isn't valid",body:"Double-check the link you were given, or ask your organization for a new one."};case"revoked":return{icon:"mdi-link-off",title:"This link is no longer active",body:"Your organization has replaced or revoked this invite link â ask them for the current one."};case"org_disabled":return{icon:"mdi-pause-circle-outline",title:"This organization is paused",body:"New members can't join right now. Please check with your organization."};case"org_full":return{icon:"mdi-account-group-outline",title:"No seats available",body:"Your organization is out of seats. Ask them to free one up or add more."};default:return{icon:"mdi-alert-circle-outline",title:"Something went wrong",body:"We couldn't check your invite link. Please try again."}}}));return(e,a)=>(_(),z(y,null,{default:j((()=>[C(l,{fluid:""},{default:j((()=>[C(u,{"max-width":"600",class:"mx-auto"},{default:j((()=>["loading"===Z.value?(_(),A("div",N,[C(c,{indeterminate:"",color:"primary"})])):"joining"===Z.value?(_(),A("div",I,[C(c,{indeterminate:"",color:"primary",class:"mb-4"}),G("p",E,"Adding you to "+P(ee.value||"your organization")+"â¦",1)])):"pending"===Z.value?(_(),A("div",M,[C(d,{icon:"mdi-email-check-outline",size:"64",color:"primary",class:"mb-4"}),a[1]||(a[1]=G("h1",{class:"text-h5 font-weight-bold mb-2"},"Almost there â verify your email",-1)),G("p",U," Your seat"+P(ee.value?` in ${ee.value}
1`:"")+" is reserved. Check your inbox for the verification email, then sign back in â your Giving Compass Pro access activates automatically. ",1),C(m,{color:"primary",variant:"text",class:"text-none",to:"/"},{default:j((()=>[...a[0]||(a[0]=[T(" Go to Giving Compass ",-1)])])),_:1})])):"open"===Z.value?(_(),A("div",V,[a[2]||(a[2]=G("img",{src:v,alt:"Giving Compass",class:"mb-8",width:"100"},null,-1)),G("h1",q,P(ee.value?`You're invited to join ${ee.value}`:"You're invited to join your organization"),1),G("p",B,P(ee.value||"Your organization")+" is giving you full Giving Compass Pro access â our AI giving assistant, nonprofit research, and the full learning center â at no cost to you. ",1),G("p",D,[ae.value.length?(_(),A(Y,{key:0},[T(" Sign up with your "+P(ne.value)+" email address to claim your seat. ",1)],64)):(_(),A(Y,{key:1},[T(" Create your account (or sign in) to claim your seat. No payment details required. ")],64))]),ie.value?(_(),z(h,{key:0,type:"warning",variant:"tonal",density:"compact",class:"mb-6 text-left"},{default:j((()=>[T(P(ie.value),1)])),_:1})):S("",!0),C(m,{rounded:"",color:"primary",size:"large",variant:"elevated",disabled:oe.value,loading:te.value,onClick:ue},{default:j((()=>[T(P($(R).isAuthenticated?`Join ${ee.value||"your organization"}`:"Get started"),1)])),_:1},8,["disabled","loading"])])):(_(),A("div",J,[C(d,{icon:ce.value.icon,size:"64",color:"grey",class:"mb-4"},null,8,["icon"]),G("h1",L,P(ce.value.title),1),G("p",O,P(ce.value.body),1),"error"===Z.value?(_(),z(m,{key:0,color:"primary",variant:"outlined",class:"text-none",onClick:re},{default:j((()=>[C(d,{icon:"mdi-refresh",start:""}),a[3]||(a[3]=T(" Try again ",-1))])),_:1})):(_(),z(m,{key:1,color:"primary",variant:"text",class:"text-none",to:"/"},{default:j((()=>[...a[4]||(a[4]=[T(" Go to Giving Compass ",-1)])])),_:1}))]))])),_:1})])),_:1})])),_:1}))}});export{W 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.