1import{r as C,A as a,S as h,fk as j,B as f}from"./index.02f3d9ef.1790259279201.js";import{o as v,s as m,r as I,u as y,a as S}from"./index.3ac8e23d.1790259279201.js";import{u as F,r as E}from"./agentation.c08165d4.1790259279201.js";import{h as q,d as $}from"./registerModules.119935e2.1790259279201.js";import B from"./breadcrumbs.4e8b44b5.1790259279201.js";const A=()=>{const[e,o]=C.useState({currentPassword:!1,newPassword:!1,confirmNewPassword:!1});return{uiFields:e,toggleHideShow:c=>{o(l=>({...l,[c]:!l[c]}))}}},G="_changePasswordContainer_1famb_1",O="_changePasswordContent_1famb_8",M="_changePasswordNavbar_1famb_12",k="_changePasswordForm_1famb_17",L="_changePasswordField_1famb_22",R="_changePasswordLabel_1famb_25",V="_req_1famb_32",H="_changePasswordErrorMsg_1famb_35",Y="_changePasswordInput_1famb_40",W="_disabled_1famb_50",D="_error_1famb_53",T="_changePasswordInputPrefix_1famb_57",U="_prefixtext_1famb_65",z="_changePasswordInputSuffix_1famb_69",J="_suffixtext_1famb_76",K="_icon_1famb_80",Q="_changePasswordInputField_1famb_85",X="_actions_1famb_92",Z="_changePasswordBtn_1famb_98",ss="_btnGhost_1famb_106",as="_btnPrimary_1famb_114",s={changePasswordContainer:G,changePasswordContent:O,changePasswordNavbar:M,changePasswordForm:k,changePasswordField:L,changePasswordLabel:R,req:V,changePasswordErrorMsg:H,changePasswordInput:Y,disabled:W,error:D,changePasswordInputPrefix:T,prefixtext:U,changePasswordInputSuffix:z,suffixtext:J,icon:K,changePasswordInputField:Q,actions:X,changePasswordBtn:Z,btnGhost:ss,btnPrimary:as},ts=()=>{const{t:e}=F(["liteChangePassword"]),{uiFields:o,toggleHideShow:w}=A(),c=E.useHistory(),l=v({currentPassword:m().required(e("liteChangePassword:validation.newPassword.required","Your password is required.")),newPassword:m().required(e("liteChangePassword:validation.newPassword.required","Your password is required.")).notOneOf([I("currentPassword"),null],e("liteChangePassword:validation.newPassword.samePassword","Your new password cannot be the same as your current password")).test({name:"validateNewPassword",test:(i,{createError:d})=>{const n=q(i);return n&&n.length!==0?d({message:e(`liteChangePassword:validate.password.${n[0]}`,{min:6,max:12})}):!0}}),confirmNewPassword:m().required(e("liteChangePassword:validation.newPassword.required","Your password is required.")).test({name:"validateConfirmPassword",test:(i,d)=>{const n=$(d.parent.newPassword,i);return n.length!==0?d.createError({message:e(`liteChangePassword:validate.confirmPassword.${n[0]}`)}):!0}})}).required(),{register:P,handleSubmit:p,trigger:t,formState:{errors:r,isValid:_,isSubmitting:x},reset:b,setError:g}=y({resolver:S(l)}),N=async i=>{try{const{confirmNewPassword:d,currentPassword:n}=i,u=await j({newPassword:d,currentPassword:n});u.status===200?(b(),f.toast.success(e("liteChangePassword:passwordChanged","Password changed!"))):u.status===400?f.toast.error(e("liteChangePassword:errorCode.general")):g("form",{type:"custom",message:"liteChangePassword:errorCode.general"})}catch{g("form",{type:"custom",message:"liteChangePassword:errorCode.general"})}};return a.jsx("div",{className:s.changePasswordContainer,children:a.jsxs("div",{className:s.changePasswordContent,children:[a.jsx("div",{className:s.changePasswordNavbar,children:a.jsx(B,{title:e("liteChangePassword:changePassword","Change Password"),backAction:()=>c.push("/myaccount/profile")})}),a.jsx("div",{className:s.changePasswordForm,children:a.jsxs("form",{onSubmit:p(N),children:[a.jsxs("div",{className:s.changePasswordField,children:[a.jsxs("label",{className:s.changePasswordLabel,children:[e("liteChangePassword:currentPassword","Current Password")," ",a.jsx("span",{className:s?.req,children:"*"})]}),a.jsxs("div",{className:`${s.changePasswordInput} ${r?.currentPassword?s.error:""}`,children:[a.jsx("input",{className:s.changePasswordInputField,type:o.currentPassword?"text":"password",id:"currentPassword",placeholder:e("liteChangePassword:currentPassword","Current Password"),...P("currentPassword",{onChange:()=>t("currentPassword"),onBlur:()=>t("currentPassword")})}),a.jsx("div",{onClick:()=>w("currentPassword"),className:s.changePasswordInputSuffix,children:a.jsx(h,{category:"SVGReactIcons",name:o.currentPassword?"AiOutlineEye":"AiOutlineEyeInvisible",className:s.icon})})]}),r.currentPassword&&a.jsx("p",{className:s.changePasswordErrorMsg,children:r.currentPassword.message})]}),a.jsxs("div",{className:s.changePasswordField,children:[a.jsxs("label",{className:s.changePasswordLabel,children:[e("liteChangePassword:newPassword","New Password")," ",a.jsx("span",{className:s?.req,children:"*"})]}),a.jsxs("div",{className:`${s.changePasswordInput} ${r?.newPassword?s.error:""}`,children:[a.jsx("input",{className:s.changePasswordInputField,type:o.newPassword?"text":"password",id:"newPassword",placeholder:e("liteChangePassword:newPassword","New Password"),...P("newPassword",{onChange:()=>t("newPassword"),onBlur:()=>t("newPassword")})}),a.jsx("div",{onClick:()=>w("newPassword"),className:s.changePasswordInputSuffix,children:a.jsx(h,{category:"SVGReactIcons",name:o.newPassword?"AiOutlineEye":"AiOutlineEyeInvisible",className:s.icon})})]}),r.newPassword&&a.jsx("p",{className:s.changePasswordErrorMsg,children:r.newPassword.message})]}),a.jsxs("div",{className:s.changePasswordField,children:[a.jsxs("label",{className:s.changePasswordLabel,children:[e("liteChangePassword:confirmNewPassword","Confirm New Password")," ",a.jsx("span",{className:s?.req,children:"*"})]}),a.jsxs("div",{className:`${s.changePasswordInput} ${r?.confirmNewPassword?s.error:""}`,children:[a.jsx("input",{className:s.changePasswordInputField,type:o.confirmNewPassword?"text":"password",id:"confirmNewPassword",placeholder:e("liteChangePassword:confirmNewPassword","Confirm New Password"),...P("confirmNewPassword",{onChange:()=>t("confirmNewPassword"),onBlur:()=>t("confirmNewPassword")})}),a.jsx("div",{onClick:()=>w("confirmNewPassword"),className:s.changePasswordInputSuffix,children:a.jsx(h,{category:"SVGReactIcons",name:o.confirmNewPassword?"AiOutlineEye":"AiOutlineEyeInvisible",className:s.icon})})]}),r.confirmNewPassword&&a.jsx("p",{className:s.changePasswordErrorMsg,children:r.confirmNewPassword.message}),r.form&&a.jsx("p",{className:s.changePasswordErrorMsg,children:r.form.message})]}),a.jsxs("div",{className:s.actions,children:[a.jsx("button",{className:`${s.changePasswordBtn} ${s.btnGhost}`,onClick:()=>c.push("/myaccount/profile"),children:e("liteChangePassword:cancel","Cancel")}),a.jsx("button",{type:"submit",className:`${s.changePasswordBtn} ${s.btnPrimary}`,disabled:!_||x,children:e("liteChangePassword:confirm","Confirm")})]})]})})]})})};export{ts 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.