PageSourceSearch

https://agda.com.au/wp-content/themes/agda/dist/frontend/assets/join-DN-07ij1.js

js agda.com.au collected 2026-10-02 03:40:00 UTC 11,962 bytes, 2 lines download raw bytes

1import{n as se,as as ae,bt as ie,aw as re,bd as ne,bk as oe,e as d,l as ce,w as le,A as me,bu as ue,u as de,j as t,a$ as ee,V as he,W as pe,L as fe,B as g,ba as be,t as te}from"./entry.client-BF1tJIhu.js";import{E as ge}from"./ErrorMessage-Duye3aIz.js";import{a as ve}from"./ZodForm-D9Ait_lH.js";import{L as xe}from"./LoadingResults-BL-vfXql.js";import{S as ye}from"./SidebarLayout-CYs8a6ti.js";import{C as Ae,a as je}from"./CheckoutForm-BIUM6YLz.js";import{C as Ie}from"./ChoosePlan-Co5Rsx0W.js";import{L as Pe}from"./LoginForm-DZSp2x82.js";import{R as Se}from"./RegisterAccount-D4CB486N.js";import{u as Ce}from"./useCartController-CAg8YbAi.js";import{a as ke}from"./MembershipScreen-DYXM6xRO.js";import"./Field-DwH_Kkly.js";import"./index-MLNr-jcP.js";import"./RichSelect-Bpdg6iaB.js";import"./react-icons.esm-BrOTrqLX.js";import"./index-CWWd72kg.js";import"./index-CCDKe8Fw.js";import"./floating-ui.dom-D0RElrgj.js";import"./index-Btu-ytwD.js";import"./Checkbox-DPr6X9KO.js";import"./index-C04FzcVl.js";import"./SimpleSelect-CTEPCkQw.js";import"./Accordion-C3Rf-hB2.js";import"./index-BS5DzTJm.js";import"./MyInfoForm-Buw1nhD4.js";import"./Tabs-C0Soz9TM.js";import"./Note-TNu4FQb-.js";import"./dates-D-wmKt_5.js";const F=()=>({currentPhase:null,isAlreadyUser:!1,isRenewal:!1,chosenPlanSlug:void 0,createdUser:!1,hasConfirmedDetails:!1,complete:!1,subscriptionId:void 0,invite:void 0,acceptedInvite:!1,inviteState:void 0}),o=ne({...F()}),we={AcceptInvite:{label:"Accept Invite",header:"Join Team Membership",if(s){return!!s.invite},canProceed(s){return!!s.acceptedInvite}}
1,ChoosePlan:{label:"Choose Membership Plan",header:"Select membership type:",if(s){return!s.invite},canProceed(s){return!!s.chosenPlanSlug}},SignIn:{label:"Sign In",header:"Sign in",if(s){return s.inviteState==="login"},canProceed(s){return s.isLoggedIn}},CreateAccount:{label:"Account Setup",header:"Account setup",if(s){return s.invite&&s.inviteState!=="create-account"?!1:!s.isAlreadyUser},canProceed(s){return s.isLoggedIn}},Confirm:{label:"Confirm Details",header:"Confirm Details",if(s){return!s.invite},canProceed(s){return s.isLoggedIn&&s.hasConfirmedDetails}},BillingDetails:{label:"Billing Details",header:"Subscription and billing",if(s){return!s.invite},canProceed(s){return s.complete}},Complete:{label:"Finished",header:"Finished",if(s){return s.complete},canProceed(s){return!1}}};function Me(){var y,A,j,I,P,S,C,c,m,N,U,O,W,Y,H,$,J,V,_,q,z,K,Q,X,Z;const s=se(),r=ae(void 0),B=ie({onSuccess(){o.complete=!0},onMutate(){o.redeemingInvite=!0},onSettled(){o.redeemingInvite=!1,r.refetch()},onError(a){re(a)}}),e=oe(o),b=Ce("subscribe");d.useEffect(()=>{var a,n,u,l;o.inviteState=s.isLoggedIn()?((u=o.invite)==null?void 0:u.email)===((l=s.user)==null?void 0:l.email)?"ready":"swap-account":(n=(a=o.invite)==null?void 0:a.user)!=null&&n.id?"login":"create-account"},[e.invite,e.acceptedInvite,(y=s.user)==null?void 0:y.email,s.isLoggedIn()]),d.useEffect(()=>{b.setItems(e.subscriptionId&&s.isLoggedIn()?[{productId:e.subscriptionId,quantity:1,variationId:void 0}]:[])},[e.subscriptionId,s.isLoggedIn()]),d.useEffect(()=>{var a,n;o.chosenPlanSlug||(o.isAlreadyUser=!!((n=(a=r.data)==null?void 0:a.customer)!=null&&n.databaseId))},[!!((A=r.data)!=null&&A.customer)]);const v=((P=(I=(j=r.data)==null?void 0:j.customer)==null?void 0:I.latestMembership)==null?void 0:P.isActive)&&r.data.customer.latestMembership.plan,G=!((c=(C=(S=r.data)==null?void 0:S.customer)==null?void 0:C.latestMembership)!=null&&c.isActive)&&((O=(U=(N=(m=r.data)==null?void 0:m.customer)==null?void 0:N.latestMembership)==null?void 0:U.plan)==null?void 0:O.slug);o.isRenewal=((H=(Y=(W=r.data)==null?void 0:W.customer)==null?void 0:Y.latestMembership)==null?void 0:H.status)==="expired"||((V=(J=($=r.data)==null?void 0:$.customer)==null?void 0:J.latestMembership)==null?void 0:V.status)==="active";const h=s.isLoggedIn();((z=(q=(_=r.data)==null?void 0:_.customer)==null?void 0:q.latestMembership)==null?void 0:z.status)==="expired"||((X=(Q=(K=r.data)==null?void 0:K.customer)==null?void 0:Q.latestMembership)==null||X.status),e.chosenPlanSlug,d.useEffect(()=>{},[s.isLoggedIn()]);const p={...e,isLoggedIn:h,alreadyHasMembership:!!v},i=Object.entries(we).filter(([a,n])=>n.if(p)).map(([a,n])=>({key:a,label:n.label,header:n.header,canProceed:n.canProceed(p),canAccess:!1,active:!1}));for(let a of i)if(a.canProceed)a.canAccess=!0;else{a.canAccess=!0;break}const x=i.find(a=>a.key===e.currentPhase);if(x)x.active=!0;else{const a=i.findLast(n=>n.canAccess);a&&(a.active=!0)}return d.useEffect(()=>{e.invite&&e.inviteState==="ready"&&e.acceptedInvite&&B.status==="idle"&&B.mutate({hash:e.invite.hash})},[s.isLoggedIn(),e.inviteState,e.invite,e.acceptedInvite]),{...e,phases:i,membership:r.data,expiredPlanSlug:G,currentPhase:(Z=i.find(a=>a.active))==null?void 0:Z.key,cart:b,start(a,n){var k,w,M,D,L,T,E,R;const u=((M=(w=(k=r.data)==null?void 0:k.customer)==null?void 0:w.latestMembership)==null?void 0:M.status)==="expired"||((T=(L=(D=r.data)==null?void 0:D.customer)==null?void 0:L.latestMembership)==null?void 0:T.status)==="active",l=!!((R=(E=r.data)==null?void 0:E.customer)!=null&&R.databaseId);Object.assign(o,{...F(),isRenewal:u,isAlreadyUser:l,chosenPlanSlug:a,subscriptionId:n,currentPhase:null})},startFromInvite(a){var l,k,w,M,D,L,T,E,R;const n=((w=(k=(l=r.data)==null?void 0:l.customer)==null?void 0:k.latestMembership)==null?void 0:w.status)==="expired"||((L=(D=(M=r.data)==null?void 0:M.customer)==null?void 0:D.latestMembership)==null?void 0:L.status)==="active",u=!!((E=(T=r.data)==null?void 0:T.customer)!=null&&E.databaseId);console.log("Starting from invite",a),Object.assign(o,{...F(),isRenewal:n,isAlreadyUser:u,chosenPlanSlug:(R=a.plan)==null?void 0:R.slug,currentPhase:null,invite:a,subscriptionId:void 0})},goTo(a){o.currentPhase=a}
1,confirmDetails(){o.hasConfirmedDetails=!0},markComplete(){o.currentPhase=null,o.complete=!0,r.refetch()},markCreatedUser(){o.createdUser=!0},acceptInvite(){o.acceptedInvite=!0,o.currentPhase=null},goBack(){var n,u;const a=(n=i.find(l=>l.active))==null?void 0:n.key;o.currentPhase=(u=i[i.findIndex(l=>l.key===a)-1])==null?void 0:u.key}}}function De(s){var x,y,A,j,I,P,S,C;const r=se();ce();const B=le(),e=Me(),b=e.phases.find(c=>c.active||e.complete&&c.key==="Complete"),v=me(),G=d.useMemo(()=>new URL(document.location.href).searchParams.get("team-invite"),[]),h=!!G,p=ue({hash:G},{enabled:h,refetchOnWindowFocus:!1,refetchIntervalInBackground:!1,staleTime:0}),i=(x=p.data)==null?void 0:x.teamInvitationByHash;if(d.useEffect(()=>{var c;(c=document.scrollingElement)==null||c.scrollTo({top:0,behavior:"smooth"})},[b==null?void 0:b.key]),d.useEffect(()=>{h||v.hasAccess&&!v.expiresSoon&&B.navigate("/dashboard")},[v.hasAccess]),d.useEffect(()=>{i!=null&&i.plan&&e.startFromInvite(i)},[!!i]),de())return null;if(h&&!e.complete){if(h&&p.isLoading)return t.jsx(xe,{});if(h&&p.isError)return t.jsx(ee,{title:"An error occurred while processing this request",message:p.error.message});if(h&&!i)return t.jsx(ee,{title:"This link has expired",message:"The invitation link you're using is no longer valid. Please contact the member who sent you the invite."})}return t.jsx(ye,{navContent:t.jsx("ul",{children:e.phases.map(c=>t.jsx("li",{className:te("type-ui-m-light pb-[0.5em]"),children:t.jsx("button",{className:te(!c.canAccess&&"cursor-default opacity-50","data-[active]:decoration-fg/40 decoration-fg/0 underline underline-offset-[0.1em] transition-colors text-left"),"data-active":c.active?"":void 0,onClick:m=>(c.canAccess&&!e.complete&&e.goTo(c.key),m.preventDefault()),children:c.label})},c.key))}),children:t.jsx(he,{mode:"wait",children:t.jsxs(pe.div,{initial:{opacity:0}
1,exit:{opacity:0},animate:{opacity:1},children:[e.currentPhase==="ChoosePlan"&&t.jsxs(t.Fragment,{children:[t.jsx(f,{title:e.isRenewal?"Renew your membership":"Become an AGDA Member",subtitle:"Select membership type"}),t.jsx(Ie,{data:s,intent:"join",onChoose:(c,m)=>{e.start(c.slug,m==null?void 0:m.databaseId)}})]}),e.currentPhase==="AcceptInvite"&&t.jsxs(t.Fragment,{children:[t.jsx(f,{title:"Team Membership",subtitle:"You've been invited to join a team membership"}),t.jsxs("div",{className:"stack-y-4",children:[t.jsxs("p",{className:"type-body-m-roman",children:[(A=(y=i==null?void 0:i.businessTeam)==null?void 0:y.owner)==null?void 0:A.name," has invited you to join their design business membership."]}),t.jsxs("p",{className:"type-body-m-roman",children:["This invitation is for ",i==null?void 0:i.email," only."]}),t.jsx(ge,{children:e.inviteState==="swap-account"?t.jsxs("p",{children:["You're currently signed in with ",(j=r.user)==null?void 0:j.email,", but this invitation is for ",i==null?void 0:i.email,". You'll need to either change your email address in"," ",t.jsx(fe,{href:"/account",children:"Account Settings"}),", or sign out."]}):null})]}),t.jsx("div",{className:"mt-5",children:e.inviteState==="create-account"?t.jsx(g,{onClick:()=>e.acceptInvite(),children:"Create Account"}):e.inviteState==="swap-account"?t.jsx(g,{onClick:()=>{r.logout(),setTimeout(()=>p.refetch(),100)},children:"Sign Out"}):e.inviteState==="ready"?t.jsx(g,{onClick:()=>e.acceptInvite(),children:"Accept Invite"}):e.inviteState==="login"?t.jsx(g,{onClick:()=>e.acceptInvite(),children:"Sign In"}):null})]}),e.currentPhase==="SignIn"&&t.jsx(t.Fragment,{children:t.jsx(Pe,{loginReason:"You must sign in to accept the invitation.",onSuccess:()=>{e.goTo(null)},disableSignup:!!(i!=null&&i.email)})}),e.currentPhase==="CreateAccount"&&t.jsxs(t.Fragment,{children:[t.jsx(f,{title:"Become an AGDA Member",subtitle:"Account Setup"}),t.jsx(Se,{onComplete:()=>{e.markCreatedUser(),e.goTo("Confirm")},onGoBack:()=>e.goBack(),forceEmail:(i==null?void 0:i.email)??void 0})]}),e.currentPhase==="Confirm"&&t.jsxs(t.Fragment,{children:[e.isAlreadyUser?t.jsx(f,{title:`Welcome to AGDA, ${(I=r.user)==null?void 0:I.name}.`,subtitle:"Payment summary"}):t.jsx(f,{title:`Welcome to AGDA, ${(P=r.user)==null?void 0:P.name}.`,subtitle:"Account created"}),t.jsx("div",{className:"type-title-xs-medium border-b border-black pb-3",children:"Order Summary"}),t.jsx(Ae,{controller:e.cart}),t.jsx(ve,{submitLabel:"Continue",onClick:()=>{e.goTo(null),e.confirmDetails()},children:t.jsx(g,{onClick:()=>e.goTo("ChoosePlan"),leftIcon:t.jsx(be,{}),variant:"outline",children:"Back"})})]}),e.currentPhase==="BillingDetails"&&t.jsxs(t.Fragment,{children:[e.isAlreadyUser?t.jsx(f,{title:`Welcome to AGDA, ${(S=r.user)==null?void 0:S.name}.`,subtitle:"Subscription and billing"}):t.jsx(f,{title:`Welcome to AGDA, ${(C=r.user)==null?void 0:C.name}.`,subtitle:"Subscription and billing"}),t.jsx(je,{controller:e.cart,onGoBack:()=>e.goTo("Confirm"),agreements:{membership:"I support AGDA's mission of developing excellence in graphic design and do hereby agree to be bound by the AGDA Constitution and Code of Ethics which are available at www.agda.com.au or by contacting the AGDA National Office. I agree that my membership of AGDA does not allow the use of the AGDA identity, name or logo for endorsement of my business, product or services.",terms:"I agree to AGDA’s Terms and Conditions and Privacy Policy. ",newsletter:"I'd like to receive AGDA's newsletter and other communications."},onSuccess:()=>{e.goTo("Complete"),e.markComplete()}})]}),e.currentPhase==="Complete"&&t.jsxs(t.Fragment,{children:[t.jsx(f,{title:e.isRenewal?"Success! Your membership has been renewed.":"Success! You are now an AGDA member.",subtitle:"Membership information"}),t.jsx(ke,{data:e.membership}),t.jsx("div",{className:"mt-5",children:t.jsx(g,{href:"/dashboard",children:"Go to my account"})})]})]},e.currentPhase)})})}De.displayName="View(membership/join)";function f(s){return t.jsxs("div",{className:"mb-6",children:[t.jsx("h2",{className:"!type-title-l-medium",children:s.title}),!!s.subtitle&&t.jsx("div",{className:"!type-title-l-roman mt-1",children:s.subtitle})]})}
1export{De as default};
2//# sourceMappingURL=join-DN-07ij1.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.