1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/index-_aijvlUq.js","assets/index-CqSexa-f.css"])))=>i.map(i=>d[i]); 2import{m as q,r as l,i as f,_ as z,j as e,w as y,S as B,B as F}from"./index-_aijvlUq.js";import{I as n}from"./Input-ysTyZFq5.js";import{U as D}from"./usStates-B3oQG6kH.js";function $(){const{token:o}=q(),[d,v]=l.useState(null),[j,N]=l.useState(!0),[m,u]=l.useState(null),[w,C]=l.useState(!1),[S,g]=l.useState(!1),[I,h]=l.useState([]),[A,E]=l.useState(!0),[s,b]=l.useState({firstName:"",lastName:"",emailAddress:"",phone:"",street:"",street2:"",city:"",state:"",zip:"",birthday:"",profession:"",bio:"",emergencyContactName:"",emergencyContactRelationship:"",emergencyContactEmail:"",emergencyContactPhone:"",instruments:[]}),[c,p]=l.useState({});l.useEffect(()=>{f.getByToken(o).then(t=>{v(t),b(r=>({...r,firstName:t.firstName||"",lastName:t.lastName||"",emailAddress:t.emailAddress||"",phone:t.phone||""}))}).catch(t=>u(t.response?.data?.error?.message||"Invalid or expired invite")).finally(()=>N(!1)),z(async()=>{const{default:t}=await import("./index-_aijvlUq.js").then(r=>r.aq);return{default:t}},__vite__mapDeps([0,1])).then(({default:t})=>{t.get("/api/v1/invites/public/instruments",{params:{context:"member"}}).then(i=>h(i.data?.data??i.data??[])).catch(()=>h([])).finally(()=>E(!1))})},[o]);function a(t,r){b(i=>({...i,[t]:r})),c[t]&&p(i=>({...i,[t]:null}))}function P(t){s.instruments.find(i=>i.instrumentId===t.id)?a("instruments",s.instruments.filter(i=>i.instrumentId!==t.id)):a("instruments",[...s.instruments,{instrumentId:t.id}])}function k(){const t={};return s.firstName.trim()||(t.firstName="Required"),s.lastName.trim()||(t.lastName="Required"),s.emailAddress.trim()?s.emailAddress.includes("@")||(t.emailAddress="Invalid email"):t.emailAddress="Required",p(t),Object.keys(t).length===0}async function R(t){if(t.preventDefault(),!!k()){g(!0);try{await f.acceptInvite(o,{token:o,...s}),C(!0)}catch(r){u(r.response?.data?.error?.message||r.message||"Failed to submit")}finally{g(!1)}}}if(j)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center",children:e.jsx("div",{className:"animate-spin motion-reduce:!animate-spin h-8 w-8 border-2 border-band-500 border-t-transparent rounded-full"})});if(m&&!d)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center px-4",children:e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-8 max-w-md w-full text-center",children:[e.jsx("div",{className:"text-4xl mb-4",children:"ð"}),e.jsx("h1",{className:"text-xl font-bold text-gray-900 mb-2",children:"Invite Not Available"}),e.jsx("p",{className:"text-sm text-gray-500",children:m})]})});if(d?.status==="expired")return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center px-4",children:e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-8 max-w-md w-full text-center",children:[e.jsx("div",{className:"text-4xl mb-4",children:"â°"}),e.jsx("h1",{className:"text-xl font-bold text-gray-900 mb-2",children:"Invite Expired"}),e.jsx("p",{className:"text-sm text-gray-500",children:"This invitation has expired. Please contact the organization for a new invite."})]})});if(d?.status!=="invite_sent")return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center px-4",children:e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-8 max-w-md w-full text-center",children:[e.jsx("div",{className:"text-4xl mb-4",children:"â"}),e.jsx("h1",{className:"text-xl font-bold text-gray-900 mb-2",children:"Already Submitted"}),e.jsx("p",{className:"text-sm text-gray-500",children:"This invitation has already been accepted. Your information is being reviewed."})]})});if(w)return e.jsx("div",{className:"min-h-screen bg-gray-50 flex items-center justify-center px-4",children:e.jsxs("div",{className:"bg-white rounded-xl border border-gray-200 p-8 max-w-md w-full text-center",children:[e.jsx("div",{className:"text-4xl mb-4",children:"ð"}),e.jsx("h1",{className:"text-xl font-bold text-gray-900 mb-2",children:"Registration Submitted!"}),e.jsxs("p",{className:"text-sm text-gray-500",children:["Thank you for joining ",e.jsx("strong",{children:d.orgName}),"! Your information has been submitted for review. You'll receive a notification once your membership is a
2pproved."]})]})});const x=d.memberType==="guest",_=I.reduce((t,r)=>(t[r.family]||(t[r.family]=[]),t[r.family].push(r),t),{});return e.jsx("div",{className:"min-h-screen bg-gray-50 py-8 px-4",children:e.jsxs("div",{className:"max-w-2xl mx-auto",children:[e.jsxs("div",{className:"bg-band-900 rounded-t-xl px-8 py-6 text-white text-center",children:[e.jsxs("h1",{className:"text-2xl font-bold",children:["Join ",d.orgName]}),e.jsx("p",{className:"text-band-200 text-sm mt-1",children:"Complete your registration below"})]}),e.jsxs("div",{className:"bg-white rounded-b-xl border border-t-0 border-gray-200 p-8",children:[m&&e.jsx("div",{className:"mb-4 p-3 bg-red-50 border border-red-200 rounded-lg text-sm text-red-700",children:m}),e.jsxs("form",{onSubmit:R,className:"space-y-6",children:[e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:"Personal Information"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(n,{label:"First Name",value:s.firstName,onChange:t=>a("firstName",t.target.value),error:c.firstName,required:!0}),e.jsx(n,{label:"Last Name",value:s.lastName,onChange:t=>a("lastName",t.target.value),error:c.lastName,required:!0})]}),e.jsx(n,{label:"Email Address",type:"email",value:s.emailAddress,onChange:t=>a("emailAddress",t.target.value),error:c.emailAddress,required:!0}),e.jsx(n,{label:"Phone Number",type:"tel",value:s.phone,onChange:t=>a("phone",y(t.target.value))}),!x&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(n,{label:"Birthday",type:"date",value:s.birthday,onChange:t=>a("birthday",t.target.value)}),e.jsx(n,{label:"Profession",value:s.profession,onChange:t=>a("profession",t.target.value)})]}),e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-gray-700 mb-1.5",children:"Bio"}),e.jsx("textarea",{value:s.bio,onChange:t=>a("bio",t.target.value),rows:3,maxLength:500,placeholder:"Tell us a bit about yourself...",className:"w-full px-3 py-2 border border-gray-300 rounded-lg text-sm focus:ring-2 focus:ring-band-500 focus:border-band-500 resize-none"})]})]})]})]}),!x&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:"Contact Information"}),e.jsxs("div",{className:"space-y-4",children:[e.jsx(n,{label:"Street Address",value:s.street,onChange:t=>a("street",t.target.value)}),e.jsx(n,{label:"Street Address Line 2",value:s.street2,onChange:t=>a("street2",t.target.value)}),e.jsxs("div",{className:"grid grid-cols-2 sm:grid-cols-3 gap-4",children:[e.jsx(n,{label:"City",value:s.city,onChange:t=>a("city",t.target.value)}),e.jsx(B,{label:"State",options:D,placeholder:"Select state",value:s.state,onChange:t=>a("state",t.target.value)}),e.jsx(n,{label:"ZIP",value:s.zip,onChange:t=>a("zip",t.target.value)})]})]})]}),!x&&e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:"Emergency Contact"}),e.jsxs("div",{className:"space-y-4",children:[e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(n,{label:"Name",value:s.emergencyContactName,onChange:t=>a("emergencyContactName",t.target.value)}),e.jsx(n,{label:"Relationship",value:s.emergencyContactRelationship,onChange:t=>a("emergencyContactRelationship",t.target.value)})]}),e.jsxs("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[e.jsx(n,{label:"Email",type:"email",value:s.emergencyContactEmail,onChange:t=>a("emergencyContactEmail",t.target.value)}),e.jsx(n,{label:"Phone",type:"tel",value:s.emergencyContactPhone,onChange:t=>a("emergencyContactPhone",y(t.target.value))})]})]})]}),e.jsxs("div",{children:[e.jsx("h3",{className:"text-sm font-semibold text-gray-500 uppercase tracking-wide mb-4",children:x?"Primary Instrument":"Instruments"}),A?e.jsx("p",{className:"text-sm text-gray-400",children:"Loading instruments..."}):e.jsx("div",{className:"space-y-3",children:Object.entries(_).map(([t,r])=>e.jsxs("div",{children:[e.jsx("p",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wide mb-2 capitalize",children:t}),e.jsx("div",{className:"flex flex-wrap gap-2",children:r.map(i=>{const L=s.instruments.some(T=>T.instrumentId===i.id);return e.jsx("button",{type:"button",onClick:()=>P(i),className:`px-3 py-1.5 rounded-full text-sm font-medium border transition-all ${L?"border-band-500 bg-band-50 text-band-700":"border-gray-200 bg-white text-gray-600 hover:border-gray-400"}`,children:i.name},i.id)})})]},t))})]}),e.jsx("div",{className:"pt-4 border-t border-gray-100",children:e.jsx(F,{type:"submit",isLoading:S,className:"w-full",children:"Submit registration"})})]})]})]})})}export{$ as InviteAcceptPage};
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.