1import{s as ye,t as be,v as fe,w as _e,x as we,y as je,z as Ne,E as ve,J as Ue,K as Se,N as Ie,P as Pe,Q as Ae,r as de,b as Ce,U as Ee,R as Te,j as s,H as De,G as y,S as ke,V as le,I as Re,L as ce,W as Oe,X as l,Y as Fe}from"./index-BFWxWka4.js";import{u as Le,a as Ge,b as Me}from"./auth.api.service-Nk1Poitf.js";import{B as We}from"./BackButton-E7mN2hau.js";import{V as qe}from"./Visibility-DXt-f3RE.js";import{V as ze,s as He,g as Be}from"./VisibilityOff-BZkHJQhh.js";/* empty css */import{C as Ve}from"./Card-VkFMv38V.js";import{C as Qe}from"./CardContent-D1dAVQuO.js";import{A as Ye}from"./Alert-BQEsWf1Z.js";import{I as Xe}from"./InputAdornment-CMGfwbS_.js";import{t as $e}from"./apiHelpers-DLl3opJV.js";import"./assertValidationError-ZFG0PkZK.js";import"./userContextData-VQQ66oa8.js";import"./autoSignIn-BMLW60Lb.js";const Je=r=>ye(we,_e("GetUser"),fe(),{...be,...r}),Ke=async r=>{var d;const a=(d=r.getConfig().Auth)==null?void 0:d.Cognito;je(a);const{userPoolEndpoint:u,userPoolId:o}=a,{tokens:i}=await Ne(r,{forceRefresh:!1});ve(i);const p=Je({endpointResolver:Pe({endpointOverride:u})}),{UserAttributes:x}=await p({region:Ie(o),userAgentValue:Ue(Se.FetchUserAttributes)},{AccessToken:i.accessToken.toString()});return $e(x)},Ze=()=>Ke(Ae),es="/assets/aicpa-BoIZsptS.png",ss="/assets/aws-security-Cykbf4TR.png",gs=()=>{var f,_;const[r,a]=de.useState(""),[u]=Le(),o=Ce(),{userBasicDetail:i}=Ee(),[p]=Ge(),[x]=Me(),{register:d,handleSubmit:me,formState:{errors:c,isSubmitting:m}}=Te({mode:"onChange"}),[b,ue]=de.useState(!1),pe=async n=>{var w,j,N,v,U,S,I,P,A,C,E,T,D,k,R,O,F,L,G,M,W,q,z,H,B,V,Q,Y,X,$,J,K,Z,ee,se,ae,te,re,ie,ne;try{a(""),await Oe();const{nextStep:t}=await He({username:n.email,password:n.password,options:{authFlowType:"USER_AUTH",preferredChallenge:"PASSWORD_SRP"}});switch(console.log(t.signInStep),t.signInStep){case"DONE":{await l.setToken(),Fe.setUser(n.email);const e=await u({}).unwrap(),oe=(w=e==null?void 0:e.data)==null?void 0:w.name;let h=oe;if(!oe){const ge=await Be(),g=await Ze();h=(g==null?void 0:g.name)||ge.username||"Unknown User",await x({name:h})}l.setUser({email:(j=e==null?void 0:e.data)==null?void 0:j.email,userType:(N=e==null?void 0:e.data)==null?void 0:N.userType,name:((v=e==null?void 0:e.data)==null?void 0:v.name)||h,status:(U=e==null?void 0:e.data)==null?void 0:U.status,isReportGenerated:((S=e==null?void 0:e.data)==null?void 0:S.isReportGenerated)||null,authId:(I=e==null?void 0:e.data)==null?void 0:I.auth_id}),(P=e==null?void 0:e.data)!=null&&P.userDetail?l.setUserBasicDetail({annual_revenue:(C=(A=e==null?void 0:e.data)==null?void 0:A.userDetail)==null?void 0:C.annual_revenue,company_name:(T=(E=e==null?void 0:e.data)==null?void 0:E.userDetail)==null?void 0:T.company_name,company_url:(k=(D=e==null?void 0:e.data)==null?void 0:D.userDetail)==null?void 0:k.company_url,company_size:(O=(R=e==null?void 0:e.data)==null?void 0:R.userDetail)==null?void 0:O.company_size,industry:(L=(F=e==null?void 0:e.data)==null?void 0:F.userDetail)==null?void 0:L.industry,functional_area:((M=(G=e==null?void 0:e.data)==null?void 0:G.userDetail)==null?void 0:M.functional_area)??[],sub_industry:((q=(W=e==null?void 0:e.data)==null?void 0:W.userDetail)==null?void 0:q.sub_industry)??"",role:((H=(z=e==null?void 0:e.data)==null?void 0:z.userDetail)==null?void 0:H.role)??"",job_description:((V=(B=e==null?void 0:e.data)==null?void 0:B.userDetail)==null?void 0:V.job_description)??""}):i!=null&&i.industry?await p(i).unwrap():(Q=e==null?void 0:e.data)!=null&&Q.inviterUserDetail&&l.setUserBasicDetail({annual_revenue:(X=(Y=e==null?void 0:e.data)==null?void 0:Y.inviterUserDetail)==null?void 0:X.annual_revenue,company_name:(J=($=e==null?void 0:e.data)==null?void 0:$.inviterUserDetail)==null?void 0:J.company_name,company_url:(Z=(K=e==null?void 0:e.data)==null?void 0:K.inviterUserDetail)==null?void 0:Z.company_url,company_size:(se=(ee=e==null?void 0:e.data)==null?void 0:ee.inviterUserDetail)==null?void 0:se.company_size,industry:(te=(ae=e==null?void 0:e.data)==null?void 0:ae.inviterUserDetail)==null?void 0:te.industry,sub_industry:((ie=(re=e==null?void 0:e.data)==null?void 0:re.inviterUserDetail)==null?void 0:ie.sub_industry)??""});const xe="/",he="/";l.setHomePage(xe),o(he);break}case"CONFIRM_SIGN_UP":{a("Please verify your account."),o("/verify-otp",{state:{email:n.email}});break}case"CONFIRM_SIGN_IN_WITH_NEW_PASSWORD_REQUIRED":a("New password required. Prompt user to change password.");break;case"CONFIRM_SIGN_IN_WITH_TOTP_CODE":a("TOTP (MFA) required. Prompt user to enter OTP code.");break;case"CONFIRM_SIGN_IN_WITH_SMS_CODE":a("SMS-based OTP required. Prompt user to enter the OTP.");break;case"RESET_PASSWORD":a("Password reset required. Prompt user to reset password.");break;case"CONFIRM_SIGN_IN_WITH_CUSTOM_CHALLENGE":a("Custom challenge required.");break;default:a("Unhandled next step: "+t.signInStep),console.warn("Unhandled step:",t)}}catch(t){switch(console.error("Sign in error:",t),(t==null?void 0:t.code)||(t==null?void 0:t.name)){case"UserNotFoundException":a("User does not exist.");break;case"NotAuthorizedException":a("Incorrect email or password.");break;case"UserNotConfirmedException":a("User is not confirmed. Please verify your email."),o("/verify-otp",{state:{email:n.email}});break;case"PasswordResetRequiredException":a("Password reset is required. Please reset your password.");break;case"TooManyFailedAttemptsException":a("Too many failed attempts. Try again later.");break;case"TooManyRequestsException":a("Too many requests. Please try again after some time.");break;case"InvalidParameterException":a("Invalid parameters provided.");break;default:a(t.message||((ne=t==null?void 0:t.data)==null?void 0:ne.msg)||"An unknown error occurred.")}}};return s.jsxs(s.Fragment,{children:[s.jsxs(De,{children:[s.jsx("title",{children:"Login | Aisus"}),s.jsx("meta",{name:"robots",content:"index, follow"}),s.jsx("meta",{name:"googlebot",content:"index, follow"})]}),s.jsxs("div",{className:"container login-container",children:[s.jsx("div",{className:"back-btn-position",children:s.jsx(We,{})}),s.jsxs(y,{container:!0,spacing:4,sx:{padding:"16px"},children:[s.jsx(y,{size:{sm:6,xs:12},children:s.jsxs("div",{className:"info-container",children:[s.jsx("div",{className:"login-logo",children:s.jsx("img",{src:ke,className:"logo",alt:"Logo"})}),s.jsxs("h2",{className:"responsive-header",children:[s.jsx("span",{className:"gradient-text",children:"Welcome"})," Back to Your"]}),s.jsxs("h2",{className:"responsive-header",children:[s.jsx("span",{className:"gradient-text",children:"Business Insights"})," Hub"]}),s.jsx("p",{className:"sub-title responsive-para",children:"Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s"}),s.jsxs("div",{className:"partners mt-5",children:[s.jsx("img",{src:es,alt:"aicpa"}),s.jsx("img",{src:ss,alt:"aws security"})]})]})}),s.jsx(y,{size:{sm:6,xs:12},children:s.jsx(Ve,{sx:{maxWidth:{xs:"calc(100vw - 50px)",sm:470},margin:{xs:"auto"},padding:{xs:"8px"},height:"fit-content",width:"100%",paddingX:"20px",paddingY:"28px",borderRadius:"18px",boxShadow:"0px 0px 10px 0px rgba(0,0,0,0.09)"},children:s.jsxs(Qe,{className:"card-content text-center",children:[s.jsxs("h3",{className:"responsive-header",children:["Get ",s.jsx("span",{className:"gradient-text",children:"Started "})," with"," ",s.jsx("span",{className:"gradient-text-3",children:"Aisus"})]}),s.jsx("p",{className:"responsive-para",children:"Create an account or sign in to access your dashboard"}),s.jsxs("div",{className:"dot-line-container",children:[s.jsx("div",{className:"circle"}),s.jsx("hr",{className:"dotted-line"}),s.jsx("div",{className:"circle"})]}),r&&s.jsx(Ye,{severity:"error",sx:{mb:2},children:r}),s.jsxs("form",{onSubmit:me(pe),children:[s.jsxs("div",{className:"form-field",children:[s.jsx("label",{children:"Email Address"}),s.jsx(le,{placeholder:"Enter your Email",type:"email",variant:"outlined",fullWidth:!0,...d("email",{required:"Email is required",onChange:()=>{r!==""&&a("")},pattern:{value:/^[^\s@]+@[^\s@]+\.[^\s@]+$/,message:"Enter a valid email"}}),error:!!c.email,helperText:String(((f=c.email)==null?void 0:f.message)||""),disabled:m,sx:{mb:2}})]}),s.jsxs("div",{className:"form-field",children:[s.jsx("label",{htmlFor:"passwordInput",children:"Password"}),s.jsx(le,{id:"passwordInput",placeholder:"Enter your Password",type:b?"text":"password",variant:"outlined",fullWidth:!0,...d("password",{required:"Password is required",onChange:()=>{r!==""&&a("")},minLength:{value:8,message:"Password must be at least 8 characters"}}),error:!!c.password,helperText:String(((_=c.password)==null?void 0:_.message)||""),disabled:m,sx:{mb:1},slotProps:{input:{endAdornment:s.jsx(Xe,{position:"end",children:s.jsx(Re,{onClick:()=>ue(n=>!n),edge:"end",children:b?s.jsx(qe,{}):s.jsx(ze,{})})})}}}),s.jsx("p",{children:s.jsx(ce,{to:"/forgot-password",className:"forget-text",children:"Forgot Password ?"})})]}),s.jsx("button",{type:"submit",className:"gradient-btn submit-btn",disabled:m,children:m?"Loading...":"Submit"}),s.jsxs("p",{className:"p-internal",children:["Don't have an Account"," ",s.jsx(ce,{to:"/signup",className:"sign-text gradient-text",children:"Create Account"})]})]})]})})})]})]})]})};export{gs 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.