import{j as e}from"./vendor-mui-69397583.js";import{u as f,I as x,B as j,h as v}from"./index-c62ac197.js";import{F,a as C}from"./FormContainer-91c2b0e4.js";import{A as b}from"./Alert-7dfbd254.js";import{u as g}from"./useTimeOutMessage-e4eaa9f2.js";import{c as w,a as A,F as y,b as T,d as k}from"./index.esm-70ab539c.js";import{Q as S}from"./index-0ec48d3d.js";import"./vendor-react-ece1c85f.js";import"./vendor-redux-a1f00e6b.js";import"./vendor-pdf-b2a5d8b1.js";import"./vendor-devex-33a39e11.js";import"./vendor-i18n-2fcb1983.js";import"./vendor-msal-9caa1ed1.js";import"./vendor-charts-eccea5d1.js";const M=w().shape({verificationCode:A().required("Please enter verification code")}),N=r=>{const{disableSubmit:s=!1,className:m,tempToken:n,email:c}=r,{verifyTwoFactor:d}=f(),[l,p]=g(),u=async(t,o)=>{const{verificationCode:a}=t,h={verificationCode:a,userName:c,tempToken:n};o(!0);const i=await d(h);(i==null?void 0:i.status)==="failed"&&p(i.message),o(!1)};return e.jsxs("div",{className:m,children:[l&&e.jsx(b,{showIcon:!0,className:"mb-4",type:"danger",children:l}),e.jsx(y,{initialValues:{verificationCode:""},validationSchema:M,onSubmit:(t,{setSubmitting:o})=>{s?o(!1):u(t,o)},children:({touched:t,errors:o,isSubmitting:a})=>e.jsx(T,{children:e.jsxs(F,{children:[e.jsx(C,{label:"Verification Code",invalid:o.verificationCode&&t.verificationCode,errorMessage:o.verificationCode,children:e.jsx(k,{type:"text",autoComplete:"off",name:"verificationCode",placeholder:"Verification Code",component:x})}),e.jsx(j,{block:!0,loading:a,variant:"solid",type:"submit",children:a?"Verifying...":"Submit"})]})})})]})},V=()=>{const{authenticatorUrl:r,email:s}=v(c=>c.auth.user),n=new URLSearchParams(document.location.search).get("tempToken")??"";return e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-8",children:[e.jsx("h3",{className:"mb-1",children:"Enter Authentication Code"}),e.jsx("p",{children:"Check your authenticator app for the 6-digit code and enter it below:"}),e.jsx("p",{children:"For added security, consider using an authenticator app like Google or Microsoft Authenticator."}),e.jsx("p",{children:"Don't have an authenticator app? Download one from the App Store or Google Play."}),e.jsx("br",{}),e.jsx(S,{value:r||""})]}),e.jsx(N,{disableSubmit:!1,tempToken:n,email:s??""})]})},H=V;export{H as default};
