PageSourceSearch

https://portal.heyfilo.ai/assets/AcceptInvitePage-m_BTVyOD.js

js heyfilo.ai collected 2026-10-05 14:28:19 UTC 4,581 bytes, 1 lines download raw bytes

1import{b as N,d as C,r as n,i as g,j as e,h as S,I as d,B as k,z as m}from"./index-BIdkve2-.js";import{C as I}from"./circle-x-BK6ctuSy.js";function q(){const[w]=N(),l=w.get("token")||"",{login:j}=C(),[v,u]=n.useState(!0),[x,p]=n.useState(""),[s,_]=n.useState(null),[r,c]=n.useState({first_name:"",last_name:"",password:"",password_confirm:""}),[h,f]=n.useState(!1);n.useEffect(()=>{if(!l){p("Invalid invitation link."),u(!1);return}g.validateToken(l).then(({data:t})=>{_(t),u(!1)}).catch(t=>{var a,i;p(((i=(a=t.response)==null?void 0:a.data)==null?void 0:i.detail)||"Invalid or expired invitation."),u(!1)})},[l]);const y=async t=>{var i,b;t.preventDefault();const a=!!(s!=null&&s.existing_user);if(!a&&r.password!==r.password_confirm){m.error("Passwords do not match");return}f(!0);try{const{data:o}=await g.accept({token:l,first_name:a?"":r.first_name,last_name:a?"":r.last_name,password:r.password});j(o.user,{access:o.access,refresh:o.refresh}),m.success("Welcome!"),window.location.href="/"}catch(o){m.error(((b=(i=o.response)==null?void 0:i.data)==null?void 0:b.detail)||(a?"Could not sign in. Check your password and try again.":"Failed to create account"))}finally{f(!1)}};return v?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-claude-bg",children:e.jsxs("div",{className:"text-center",children:[e.jsx("div",{className:"animate-spin h-8 w-8 border-2 border-claude-accent border-t-transparent rounded-full mx-auto mb-4"}),e.jsx("p",{className:"text-claude-text-secondary",children:"Validating your invitation..."})]})}):x?e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-claude-bg px-4",children:e.jsxs("div",{className:"bg-white rounded-2xl border border-claude-border p-8 max-w-md w-full text-center",children:[e.jsx(I,{className:"w-12 h-12 text-claude-danger mx-auto mb-4"}),e.jsx("h2",{className:"text-xl font-semibold text-claude-text mb-2",children:"Invitation Invalid"}),e.jsx("p",{className:"text-claude-text-secondary mb-6",children:x}),e.jsx("a",{href:"/",className:"text-claude-accent hover:underline text-sm",children:"Return to homepage"})]})}):e.jsx("div",{className:"min-h-screen flex items-center justify-center bg-claude-bg px-4 py-8",children:e.jsxs("div",{className:"w-full max-w-sm",children:[e.jsxs("div",{className:"flex flex-col items-center mb-8",children:[e.jsx("img",{src:S,alt:"heyfilo",className:"h-10 mb-4"}),e.jsxs("h1",{className:"text-2xl font-semibold text-claude-text text-center",children:["Join ",s.tenant_name||"workspace"]}),s.invited_by_name?e.jsxs("p",{className:"text-sm text-claude-text-secondary mt-1 text-center",children:["Invited by ",e.jsx("span",{className:"font-medium",children:s.invited_by_name})]}):null]}),e.jsxs("div",{className:"bg-white rounded-2xl border border-claude-border shadow-soft p-7",children:[s.existing_user&&e.jsx("p",{className:"text-sm text-claude-text-secondary mb-4",children:"You already have an account. Enter your password to join this workspace — no new account needed."}),e.jsxs("form",{onSubmit:y,className:"space-y-4",autoComplete:"off",children:[e.jsxs("div",{children:[e.jsx("label",{className:"block text-sm font-medium text-claude-text mb-1.5",children:"Email"}),e.jsx("input",{type:"email",value:s.email,disabled:!0,className:"block w-full rounded-xl border border-claude-border bg-claude-bg-alt px-4 py-2.5 text-sm text-claude-text-secondary"})]}),!s.existing_user&&e.jsxs("div",{className:"grid grid-cols-2 gap-3",children:[e.jsx(d,{id:"first_name",label:"First name",value:r.first_name,onChange:t=>c(a=>({...a,first_name:t.target.value})),placeholder:"Jane",required:!0,autoComplete:"off"}),e.jsx(d,{id:"last_name",label:"Last name",value:r.last_name,onChange:t=>c(a=>({...a,last_name:t.target.value})),placeholder:"Doe",required:!0,autoComplete:"off"})]}),e.jsx(d,{id:"password",label:s.existing_user?"Your password":"Password",type:"password",value:r.password,onChange:t=>c(a=>({...a,password:t.target.value})),placeholder:s.existing_user?"Your account password":"Min 8 characters",required:!0,autoComplete:s.existing_user?"current-password":"new-password"}),!s.existing_user&&e.jsx(d,{id:"password_confirm",label:"Confirm password",type:"password",value:r.password_confirm,onChange:t=>c(a=>({...a,password_confirm:t.target.value})),placeholder:"Repeat password",required:!0,autoComplete:"new-password"}),e.jsx(k,{type:"submit",className:"w-full",size:"lg",disabled:h,children:h?s.existing_user?"Joining...":"Creating account...":s.existing_user?"Sign in & join":"Create account & join"})]})]})]})})}export{q as AcceptInvitePage};

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.