1import{j as e,r as t}from"./react-CRjXmzdu.js";import{a as u}from"./http-3ukMoIbY.js";import{Q as d,l as x,p as g,V as h}from"./index-De75rBSf.js";import{al as f,b6 as y,B as j,P as v,b7 as b,T as a,H as w}from"./mui-CNr6W-ty.js";import"./vendor-IdvdfVCJ.js";import"./redux-Dts5QXDw.js";import"./iconify-BNxKwMGw.js";import"./react-query-Cwaq9TKo.js";import"./router-BDpR9Pxq.js";import"./lodash-CpjO0APP.js";import"./ui-utils-DqNXFlDe.js";import"./date-utils-Cj6NCtA4.js";import"./sanitize-RB1-lMRI.js";import"./validation-B8dh9o27.js";import"./i18n-89tvej9L.js";import"./emotion-CfcNTy1E.js";import"./firebase-UICncsdF.js";const A=()=>e.jsxs(f,{component:"main",maxWidth:"sm",children:[e.jsx(y,{}),e.jsx(j,{sx:{marginTop:8,display:"flex",flexDirection:"column",alignItems:"center"},children:e.jsxs(v,{elevation:3,sx:{p:4,width:"100%",textAlign:"center"},children:[e.jsx(b,{color:"error",sx:{fontSize:60,mb:2}}),e.jsx(a,{component:"h1",variant:"h4",gutterBottom:!0,children:"Merge Confirmation Error"}),e.jsx(w,{severity:"error",sx:{mb:3},children:"This Invite Merge confirmation link has expired or is invalid."}),e.jsx(a,{variant:"body1",paragraph:!0,children:"The link you used to merge your Customer email address to Employee is no longer valid. This might be because it expired or was already used."})]})})]}),{getAdminApiUrl:M}=x,W=()=>{const[c,o]=t.useState(!1),[l,m]=t.useState(!1),{isAuthenticated:p}=d(),r=new URLSearchParams(window.location.search).get("token"),i=t.useCallback(async()=>{if(!r){o(!0);return}try{const s=u.create({baseURL:M(),withCredentials:!0}),{data:n={}}=await s.post("v1/user/mergeInvitedAccount",{token:r});if(n?.message==="Success")g("Account converted to employee successfully."),m(!0);else throw new Error(n?.message||"Merge failed")}catch(s){console.error("Merge error:",s),o(!0)}},[r]);return t.useEffect(()=>{r?i():o(!0)},[r,i]),c?e.jsx(A,{}):l?e.jsxs("div",{style:{textAlign:"center",marginTop:"100px"},children:[e.jsx("h2",{children:"Account converted to employee successfully"}),e.jsx("button",{type:"button",onClick:()=>{p?h():window.location.href="/"},style:{marginTop:"20px",padding:"10px 20px",fontSize:"16px",cursor:"pointer"},children:"Home"})]}):null};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.