PageSourceSearch

https://tesana.com/assets/CompanyInvitePage-DLpl-wNR.js

js tesana.com collected 2026-10-09 22:40:43 UTC 7,578 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-motion-hRg_q8lq.js";import{b as A,r as y}from"./vendor-react-E98sgxjj.js";import{b as E,u as P,a as z}from"./vendor-query-bOUN_gKe.js";import{u as F,b as T,M as k,am as H,a1 as M,an as $,H as L,d as Q}from"./index-BKzE8EQ8.js";import{du as m}from"./vendor-fa-Bn2dnpnC.js";import{u as R}from"./useLocaleNavigate-BNriJdRU.js";import{A as q}from"./AuthPanel-B4zt6SJ5.js";import{r as j,a as B}from"./pendingCompanyInvite-D9go2WHu.js";import{o as _}from"./organization-BuGhuc22.js";import"./pendingReferral-B4JPXhl_.js";import"./exploreHandoff-RQymaHkp.js";const K=new Set(["invite_email_mismatch","invite_expired","invite_revoked","member_of_other_organization","seat_limit_reached"]);function te(){const{token:o=""}=A(),{t}=F("company"),i=R(),x=E(),{user:c,isAuthenticated:l,loading:f,refreshUser:C,logout:N}=T(),[p,g]=y.useState(null),[s,v]=y.useState(null),d=P({queryKey:_.invite(o),queryFn:()=>k.getInvite(o),enabled:!!o,retry:!1}),r=d.data,a=r?.organization.name??"";y.useEffect(()=>{!f&&!l&&r?.status==="pending"&&j(o)},[f,l,r?.status,o]);const h=z({mutationFn:()=>k.acceptInvite(o),onSuccess:async({organization:n})=>{B(),x.setQueryData(_.current(),n),await C().catch(()=>{}),M.success(t("acceptInvite.welcome",{org:n.name})),i("/settings/company",{replace:!0})},onError:n=>{const b=H(n);v(b&&K.has(b)?b:"other")}}),w=!!c?.organization&&!!r&&c.organization.slug===r.organization.slug,u=n=>e.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-8 bg-background px-4 py-12",children:[e.jsxs(L,{children:[e.jsx("title",{children:a?t("acceptInvite.pageTitle",{org:a}):t("acceptInvite.pageTitleGeneric")}),e.jsx("meta",{name:"robots",content:"noindex"})]}),n]});if(d.isLoading||f&&!r)return u(e.jsx(m,{icon:["far","spinner-third"],className:"animate-spin text-2xl text-muted-foreground","aria-label":t("common.loading")}));if(d.isError||!r){const n=$(d.error)===404;return u(e.jsx(I,{icon:"circle-exclamation",tone:"danger",title:t(n?"acceptInvite.invali
1dTitle":"acceptInvite.loadFailedTitle"),body:t(n?"acceptInvite.invalidBody":"acceptInvite.loadFailedBody"),primary:n?{label:t("acceptInvite.goHome"),onClick:()=>i("/dashboard")}:{label:t("common.retry"),onClick:()=>d.refetch()}}))}if(w)return u(e.jsx(I,{icon:"circle-check",tone:"success",title:t("acceptInvite.alreadyTitle",{org:a}),body:t("acceptInvite.alreadyBody"),primary:{label:t("acceptInvite.openCompany"),onClick:()=>i("/settings/company")}}));if(r.status!=="pending"||s==="invite_expired"||s==="invite_revoked"){const n=s==="invite_expired"?"expired":s==="invite_revoked"?"revoked":r.status;return u(e.jsx(I,{icon:n==="accepted"?"circle-check":"clock",tone:n==="accepted"?"success":"muted",title:t(`acceptInvite.status.${n}.title`,{org:a}),body:t(`acceptInvite.status.${n}.body`,{org:a,inviter:r.invited_by}),primary:n==="accepted"&&l?{label:t("acceptInvite.openCompany"),onClick:()=>i("/settings/company")}:{label:t("acceptInvite.goHome"),onClick:()=>i(l?"/dashboard":"/")}}))}const S=e.jsxs("div",{className:"w-full max-w-md rounded-lg border border-border bg-card p-8 text-center",children:[e.jsx("div",{className:"mx-auto mb-5 flex size-14 items-center justify-center rounded-full bg-accent/10",children:e.jsx(m,{icon:["far","building"],className:"text-xl text-accent","aria-hidden":!0})}),e.jsx("h1",{className:"text-lg text-foreground",children:t("acceptInvite.title",{org:a})}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:t("acceptInvite.body",{inviter:r.invited_by,org:a})}),e.jsxs("p",{className:"mt-4 inline-flex items-center gap-2 rounded-md bg-foreground
1/6 px-3 py-1.5 text-xs text-muted-foreground",children:[e.jsx(m,{icon:["far","envelope"],className:"text-[10px]","aria-hidden":!0}),t("acceptInvite.forEmail",{email:r.email_hint,role:t(r.uses_seat===!1?"roles.adminNoSeat":`roles.${r.role}`)})]}),e.jsx("ul",{className:"mt-6 space-y-2 text-left text-sm text-muted-foreground",children:(r.uses_seat===!1?["perksNoSeat.manage","perksNoSeat.ownPlan","perksNoSeat.private"]:["perks.plan","perks.library","perks.private"]).map(n=>e.jsxs("li",{className:"flex items-start gap-2",children:[e.jsx(m,{icon:["far","check"],className:"mt-1 w-3 shrink-0 text-xs text-success","aria-hidden":!0}),e.jsx("span",{children:t(`acceptInvite.${n}`,{org:a})})]},n))}),l&&c?e.jsxs("div",{className:"mt-8",children:[s&&e.jsx("div",{role:"alert",className:"mb-4 rounded-md border border-destructive/30 bg-destructive/8 p-3 text-left text-sm text-foreground",children:t(`acceptInvite.errors.${s}`,{org:a,email:r.email_hint,me:c.email,inviter:r.invited_by})}),s==="invite_email_mismatch"?e.jsx("button",{type:"button",onClick:()=>{j(o),N().then(()=>v(null))},className:"h-10 w-full cursor-pointer rounded-md bg-foreground text-sm text-background transition-opacity hover:opacity-85",children:t("acceptInvite.switchAccount")}):s==="member_of_other_organization"?e.jsx("button",{type:"button",onClick:()=>i("/settings/company"),className:"h-10 w-full cursor-pointer rounded-md bg-foreground
1/6 text-sm text-foreground transition-colors hover:bg-foreground/10",children:t("acceptInvite.openCurrentCompany")}):e.jsx("button",{type:"button",onClick:()=>{v(null),h.mutate()},disabled:h.isPending,className:"h-10 w-full cursor-pointer rounded-md bg-foreground text-sm text-background transition-opacity hover:opacity-85 disabled:opacity-50",children:h.isPending?t("acceptInvite.joining"):t("acceptInvite.accept",{org:a})}),e.jsxs("p",{className:"mt-3 text-xs text-muted-foreground",children:[t("acceptInvite.signedInAs",{email:c.email})," ",s!=="invite_email_mismatch"&&e.jsx("button",{type:"button",onClick:()=>{j(o),N()},className:"cursor-pointer text-foreground/85 underline decoration-foreground/20 hover:decoration-foreground/50",children:t("acceptInvite.notYou")})]})]}):!p&&e.jsxs("div",{className:"mt-8 flex flex-col gap-3",children:[e.jsx("button",{type:"button",onClick:()=>g("login"),className:"h-10 w-full cursor-pointer rounded-md bg-foreground text-sm text-background transition-opacity hover:opacity-85",children:t("acceptInvite.signIn")}),e.jsx("button",{type:"button",onClick:()=>g("signup"),className:"h-10 w-full cursor-pointer rounded-md bg-foreground
1/6 text-sm text-foreground transition-colors hover:bg-foreground/10",children:t("acceptInvite.createAccount")}),e.jsx("p",{className:"text-xs text-muted-foreground",children:t("acceptInvite.useInvitedEmail",{email:r.email_hint})})]})]});return u(e.jsxs(e.Fragment,{children:[S,!l&&p&&e.jsx("div",{className:"w-full max-w-md",children:e.jsx(q,{mode:p,surface:p==="login"?"login-page":"register-page",onSwitchMode:()=>g(n=>n==="login"?"signup":"login"),onLoggedIn:()=>g(null),onSignupPendingVerify:()=>i("/check-email",{replace:!0}),referralCode:""})})]}))}function I({icon:o,tone:t,title:i,body:x,primary:c}){return e.jsxs("div",{className:"w-full max-w-md rounded-lg border border-border bg-card p-8 text-center",children:[e.jsx("div",{className:Q("mx-auto mb-5 flex size-14 items-center justify-center rounded-full",t==="danger"?"bg-destructive/10 text-destructive":t==="success"?"bg-success/10 text-success":"bg-foreground/6 text-muted-foreground"),children:e.jsx(m,{icon:["far",o],className:"text-xl","aria-hidden":!0})}),e.jsx("h1",{className:"text-lg text-foreground",children:i}),e.jsx("p",{className:"mt-2 text-sm text-muted-foreground",children:x}),e.jsx("button",{type:"button",onClick:c.onClick,className:"mt-6 h-10 cursor-pointer rounded-md bg-foreground
1/6 px-6 text-sm text-foreground transition-colors hover:bg-foreground/10",children:c.label})]})}export{te 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.