"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9762],{SoOY:function(e,t,n){n.d(t,{TG:function(){return eu}});var r=n("q1tI"),a=n("Eso5"),o=n("aDCK"),i=n("C/sX"),l=n("nWfB"),s=n("7Ci/"),m=n("SPK5"),d=n("mYVa"),c=n("OAL+"),p=n("RZSM"),u=n("StZb"),g=n("NGsg"),h=n("Y5X8"),b=n("oZWv"),E=n("XDLp"),f=n("nCpW"),v=n("jaE6"),y=n("Efqo"),x=n("+UX+"),w=n("U80/"),S=n("Tabs"),C=n("rBCA"),O=n("HJpP"),P=n("L+vc"),z=n("M2mm"),k=n("RL1p"),M=n("mTnX"),B=n("PMHd"),F=n("ake8"),_=n("i8i4"),I=n("iBNF"),L=n("1N+i"),N=n("E3xp"),j=n("wDwK"),T=n("DzJC"),D=n.n(T),Z=n("uwjA"),A=n("+6Eu"),q=n("25AQ"),W=n("yVya");n("xXM3"),n("Wgwc");var $=n("yNk5");let U=(0,r.createContext)({currentStep:0,setCurrentStep:()=>!1,setMaxStep:()=>!1,nextStep:()=>!1,prevStep:()=>!1,isMarryBaby:!1,siteType:"helloSites",sharedData:{},setSharedData:()=>!1}),[R,V,X]=(0,w.W)(),Y=(0,C.Z)(a.x)` .phone-input { width: 100%; margin-bottom: 32px; ${y.M.mbDown} { margin-bottom: 16px; } .PhoneInput { margin-bottom: 16px; } .PhoneInputCountry { border-radius: 4px 0 0 4px; } .PhoneInputInput { border-radius: 0 4px 4px 0; } } `,DynamicForm=e=>{var{inputOrder:t=["phone"],withSimilac:n=!1,customTerms:a="",formContext:i}=e,l=(0,O._)(e,["inputOrder","withSimilac","customTerms","formContext"]);let{t:s}=(0,P.u)(),m=i||V(),d={phone:e=>{var{label:t,name:a="phone"}=e,i=(0,O._)(e,["label","name"]);return r.createElement(o.I.Wrapper,{className:n?"input-control":"phone-input",withAsterisk:!0,label:t||n?r.createElement(b.T,{size:"s4",weight:"semiBold",as:"span"},t||s("onboarding.similac.input.phone")):void 0},r.createElement(u.P,Object.assign({defaultCountry:x.M[$.env.UNIFY_LOCALE]||"VN"},m.getInputProps(a),i)),r.createElement(o.I.Error,{size:"md"},m.errors.phone))},full_name:e=>{var{label:t,name:n="name"}=e,a=(0,O._)(e,["label","name"]);return r.createElement(u.I,Object.assign({label:r.createElement(b.T,{size:"s4",weight:"semiBold",as:"span"},t||s("onboarding.formEmail.yourName")),withAsterisk:!0},m.getInputProps(n),a))},email:e=>{var{label:t,name:n="email"}=e,a=(0,O._)(e,["label","name"]);return r.createElement(u.I,Object.assign({label:r.createElement(b.T,{size:"s4",weight:"semiBold",as:"span"},t||s("onboarding.formEmail.yourEmail")),withAsterisk:!0},m.getInputProps(n),a))},dob:e=>{var{label:t,name:n="dob"}=e,a=(0,O._)(e,["label","name"]);return r.createElement(k.D,Object.assign({label:r.createElement(b.T,{size:"s4",weight:"semiBold",as:"span"},t||s("onboarding.formEmail.yourBirthday")),placeholder:"DD/MM/YYYY"},m.getInputProps(n),a))},gender:e=>{var{label:t,name:n="gender"}=e,a=(0,O._)(e,["label","name"]);return r.createElement(u.R.Group,Object.assign({className:"radio-group",label:r.createElement(b.T,{size:"s4",weight:"semiBold",as:"span"},t||s("tools.selectGender"))},m.getInputProps(n),a),r.createElement(u.R,{value:"0",label:s("onboarding.formEmail.genderMale")}),r.createElement(u.R,{value:"1",label:s("onboarding.formEmail.genderFemale")}))},otp:({name:e="otp"})=>r.createElement("div",{className:"otp-input"},r.createElement(u.O,Object.assign({enterKeyHint:void 0,nonce:void 0},m.getInputProps(e))),r.createElement(o.I.Error,null,m.errors.otp)),password:({label:e,name:t="password"})=>r.createElement(u.I.Password,Object.assign({label:r.createElement(b.T,{size:"s4",weight:"semiBold",as:"span"},e||s("onboarding.updatePassword.password")),withAsterisk:!0,rightSection:r.createElement(B.V,null)},m.getInputProps(t))),confirm_password:({label:e,name:t="confirmPassword"})=>r.createElement(u.I.Password,Object.assign({label:r.createElement(b.T,{size:"s4",weight:"semiBold",as:"span"},e||s("onboarding.updatePassword.confirmPassword")),withAsterisk:!0,rightSection:r.createElement(B.V,null)},m.getInputProps(t))),term:({name:e="term",className:t=""})=>a?r.createElement("div",{style:{marginBottom:16},className:t},r.createElement(u.d,Object.assign({label:r.createElement(b.T,{size:"p4",as:"span",sx:{a:{color:"#2d87f3",fontWeight:"bold",letterSpacing:0}}},a)},m.getInputProps(e,{type:"checkbox"}),{error:null})),r.createElement(o.I.Error,{size:"md"},m.getInputProps("term",{type:"checkbox"}).error)):null,address:e=>{var{label:t,className:n="",name:a="address"}=e,o=(0,O._)(e,["label","className","name"]);return r.createElement(M.A,Object.assign({className:`${n} input-control`,label:r.createElement(b.T,{size:"s4",weight:"semiBold",as:"span"},t||s("onboarding.similac.input.address"))},m.getInputProps(a),o))}},c=t.map(e=>{var t;let n="string"==typeof e?{inputType:e}:e;return null===(t=d[n.inputType])||void 0===t?void 0:t.call(d,n)});return r.createElement(Y,Object.assign({},l),c)},frisoOnboardingSchema=e=>z.Ry().shape({phone:z.Z_().required(e("onboarding.updatePhone.error")).default(""),name:z.Z_().required(e("onboarding.errorMessage.requiredName")),email:z.Z_().required(e("onboarding.errorMessage.requiredEmail")).email(e("onboarding.errorMessage.invalidEmail")).default(""),address:z.nK().required(e("onboarding.similac.address.error")),term:z.Xg().oneOf([!0],e("validation.error.requiredField"))});var H=(0,r.forwardRef)((e,t)=>{var{inputOrder:n,onSubmit:o,validateSchema:i,defaultValues:l,isActive:s,customTerms:m,customFormTexts:d}=e,c=(0,O._)(e,["inputOrder","onSubmit","validateSchema","defaultValues","isActive","customTerms","customFormTexts"]);let{nextStep:p,setSharedData:u,sharedData:g}=(0,r.useContext)(U),{t:h}=(0,P.u)(),E=X({initialValues:{term:!1,phone:(null==g?void 0:g.phone)||(null==l?void 0:l.phone)||"",email:(null==g?void 0:g.email)||(null==l?void 0:l.email)||"",name:(null==g?void 0:g.name)||(null==l?void 0:l.name)||""},validate:i||(0,S.X)(frisoOnboardingSchema(h))}),onSubmit=e=>(0,O.a)(void 0,void 0,void 0,function*(){try{yield null==o?void 0:o(e),u(t=>Object.assign(Object.assign({},t),{phone:e.phone,email:e.email,name:e.name})),p()}catch(e){console.error(e)}}),onError=e=>{console.log(e)},handleSubmitForm=()=>{var e;return null===(e=E.onSubmit(onSubmit,onError))||void 0===e?void 0:e()};return(0,r.useImperativeHandle)(t,()=>({submitForm:handleSubmitForm})),r.createElement(a.x,Object.assign({"data-active":s},c),r.createElement(a.x,{sx:e=>({display:"flex",flexDirection:"column",gap:"16px",[e.fn.largerThan("md")]:{gap:"24px"}})},r.createElement(a.x,{sx:{textAlign:"center"}},r.createElement(F.H,{tag:"h4",as:"h2"},null==d?void 0:d.heading),r.createElement(b.T,{size:"p3"},null==d?void 0:d.description)),r.createElement(R,{form:E},r.createElement("form",{className:"friso-form",style:{width:"100%"},onSubmit:E.onSubmit(onSubmit,onError)},r.createElement(a.x,{sx:{".friso-form":{display:"flex",flexWrap:"wrap",gap:"8px",".input-control":{width:"100%",marginBottom:0},".phone-input":{marginBottom:"0 !important",".PhoneInput":{marginBottom:"0 !important"}}}}},r.createElement(DynamicForm,{inputOrder:n,customTerms:m,className:"friso-form"}))))))});let G=C.Z.div` position: fixed; inset: 0; z-index: 1000; background: white; overflow-y: auto; `,K=C.Z.div` height: 100%; ${y.M.lgPcUp} { display: table; width: 100%; height: calc(100% - 25px); } `,J=C.Z.div` padding: 16px; ${y.M.mbUp} { padding: 48px 24px 24px; } &[data-similac='true'][data-has-banner='true'] { ${y.M.mbDown} { background: white; border-top-left-radius: 1rem; border-top-right-radius: 1rem; margin-top: -1rem; } } `,Q=C.Z.div` width: 640px; padding: 16px 16px 0 16px; display: none; ${y.M.mbUp} { width: 640px; display: table-cell; } `,ee=C.Z.div` background-color: ${I.r.colors.primary50}; border-radius: 12px; height: 100%; display: flex; flex-direction: column; justify-content: space-between; &[data-is-marry-baby='true'] { background-color: ${I.r.mbColors.tonePink}; } `,et=C.Z.div` margin-top: 40px; padding: 24px 40px; `,en=C.Z.div` width: 100%; display: block; img { width: 100%; height: auto; } &.similac { min-width: 1px; img { width: 100%; height: 100%; object-fit: contain; } ${y.M.mbUp} { position: sticky; top: 0; height: 100vh; } } `,er=C.Z.div` margin-top: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; &.similac { margin-top: 16px; } `,ea=(0,C.Z)(s.W)` &.hhg-comp-onboarding-container.hhg-comp-onboarding-container { display: flex; flex-direction: column; align-items: center; height: 100%; width: 100%; max-width: 520px; } .header { margin-bottom: 32px; text-align: center; ${y.M.mbDown} { margin-bottom: 16px; } } .input-control { width: 100%; } .radio-group, .input-control { margin-bottom: 16px; } .form { width: 100%; } /* .form-error { margin-top: 32px; font-size: 14px; } .field-error { margin-top: 10px; font-size: 14px; } */ .form-button { width: 100%; } `,eo=C.Z.img` margin-bottom: 38px; `,Onboarding$1=e=>{var t,{heading:n,description:a,children:o,className:i,imgSrc:s,hiddenLogo:m=!1}=e,d=(0,O._)(e,["heading","description","children","className","imgSrc","hiddenLogo"]);let{isMarryBaby:c,siteType:p}=(0,r.useContext)(U);return r.createElement(ea,Object.assign({},d,{className:`hhg-comp-onboarding-container ${i}`,size:"sm"}),!m&&r.createElement(N.L,{type:c?p:(null===(t=g.L[$.env.UNIFY_LOCALE])||void 0===t?void 0:t.LOGO_TYPE)||"hellobacsi"}),r.createElement(er,{className:m?"similac":""},s&&r.createElement(eo,{src:s,loading:"lazy"}),(n||a)&&r.createElement("div",{className:"header"},n&&r.createElement(l.D,{order:3},n),a&&r.createElement(b.T,{size:"p3",mt:8,color:I.r.colors.gray600},a)),o))},ei=(0,C.Z)(Onboarding$1)` .phone-input { width: 100%; margin-bottom: 32px; ${y.M.mbDown} { margin-bottom: 16px; } .PhoneInput { margin-bottom: 16px; } .PhoneInputCountry { border-radius: 4px 0 0 4px; } .PhoneInputInput { border-radius: 0 4px 4px 0; } } &:not([data-active='true']) { display: none !important; } `,onboardingSchema=e=>z.Ry().shape({phone:z.Z_().required(e("onboarding.updatePhone.error")).default("")}),el=(0,C.Z)(Onboarding$1)` .otp-input { margin-bottom: 36px; ${y.M.mbDown} { margin-bottom: 20px; } .otpContainer { margin-bottom: 16px; } } .resend { display: flex; gap: 6px; margin-bottom: 32px; ${y.M.mbDown} { margin-bottom: 16px; } a { text-decoration: underline; cursor: pointer; } } .phone-description { margin-left: 2px; margin-top: 2px; } .otp-description-edit-icon { cursor: pointer; vertical-align: bottom; /* height: 100%; */ margin-bottom: 3px; margin-left: 3px; } `,otpSchema=e=>z.Ry().shape({otp:z.Z_().required(e("onboarding.otpForm.error")).length(6,e("onboarding.otpForm.error")).default("")}),onboardingEmailSchema=e=>z.Ry().shape({email:z.Z_().required(e("onboarding.errorMessage.requiredEmail")).email(e("onboarding.errorMessage.invalidEmail")).default(""),name:z.Z_().required(e("onboarding.errorMessage.requiredName"))}),es=C.Z.div` margin-top: 70px; display: flex; flex-direction: column; align-items: center; justify-content: center; &.similac { margin-top: 16px; } `,em=(0,C.Z)(s.W)` &.hhg-comp-onboarding-container.hhg-comp-onboarding-container { display: flex; flex-direction: column; align-items: center; height: 100%; width: 100%; max-width: 520px; } .header { margin-bottom: 32px; text-align: center; ${y.M.mbDown} { margin-bottom: 16px; } } .input-control { width: 100%; } .radio-group, .input-control { margin-bottom: 16px; } .form { width: 100%; } /* .form-error { margin-top: 32px; font-size: 14px; } .field-error { margin-top: 10px; font-size: 14px; } */ .form-button { width: 100%; } `,ed=C.Z.img` margin-bottom: 38px; `,OnboardingUI=e=>{var t,{heading:n,description:a,children:o,className:i,imgSrc:s,hiddenLogo:m=!1}=e,d=(0,O._)(e,["heading","description","children","className","imgSrc","hiddenLogo"]);let{isMarryBaby:c,siteType:p}=(0,r.useContext)(U);return r.createElement(em,Object.assign({},d,{className:`hhg-comp-onboarding-container ${i}`,size:"sm"}),!m&&r.createElement(N.L,{type:c?p:(null===(t=g.L[$.env.UNIFY_LOCALE])||void 0===t?void 0:t.LOGO_TYPE)||"hellobacsi"}),r.createElement(es,{className:m?"similac":""},s&&r.createElement(ed,{src:s,loading:"lazy"}),r.createElement("div",{className:"header"},r.createElement(l.D,{order:3},n),r.createElement(b.T,{size:"p3",mt:8,color:I.r.colors.gray600},a)),o))},ec=(0,C.Z)(Onboarding$1)` .phone-input { width: 100%; margin-bottom: 32px; ${y.M.mbDown} { margin-bottom: 16px; } .PhoneInput { margin-bottom: 16px; } .PhoneInputCountry { border-radius: 4px 0 0 4px; } .PhoneInputInput { border-radius: 0 4px 4px 0; } } &:not([data-active='true']) { display: none !important; } `,similacOnboardingSchema=(e,t)=>z.Ry().shape({phone:z.Z_().required(e("onboarding.updatePhone.error")).default(""),name:z.Z_().required(e("onboarding.errorMessage.requiredName")),email:z.Z_().required(e("onboarding.errorMessage.requiredEmail")).email(e("onboarding.errorMessage.invalidEmail")).default(""),address:z.nK().required(e("onboarding.similac.address.error")),term:t?z.Xg():z.Xg().oneOf([!0],e("validation.error.requiredField"))}),ep=(0,C.Z)(Onboarding$1)` .phone-input { width: 100%; margin-bottom: 32px; ${y.M.mbDown} { margin-bottom: 16px; } .PhoneInput { margin-bottom: 16px; } .PhoneInputCountry { border-radius: 4px 0 0 4px; } .PhoneInputInput { border-radius: 0 4px 4px 0; } } &:not([data-active='true']) { display: none !important; } `,onboardingUpdatePasswordSchema=e=>z.Ry().shape({password:z.Z_().required(e("onboarding.errorMessage.requiredPassword")).min(8,e("onboarding.errorMessage.minLength",{length:8})).matches(/.*[A-Z].*/,e("onboarding.errorMessage.passWithPattern")).default(""),confirmPassword:z.Z_().required(e("onboarding.errorMessage.requiredConfirmPassword")).oneOf([z.iH("password"),null],e("onboarding.errorMessage.passNotMatch")).default("")}),eu={Provider:({children:e,siteType:t,setSharedData:n})=>{let[a,o]=(0,r.useState)(0),[i,l]=(0,r.useState)(0),[s,m]=(0,r.useState)({});return(0,r.useEffect)(()=>{null==n||n(s)},[s,n]),r.createElement(U.Provider,{value:{currentStep:a,setCurrentStep:o,setMaxStep:l,nextStep:()=>a+1<=i&&o(a+1),prevStep:()=>a-1>=0&&o(a-1),siteType:t,isMarryBaby:"marryBaby"===t,sharedData:s,setSharedData:m}},e)},Modal:e=>{var{children:t,withSimilac:n,banner:a,withPortal:o}=e,s=(0,O._)(e,["children","withSimilac","banner","withPortal"]);let{isMobile:m}=(0,L.u)(),{isMarryBaby:d}=(0,r.useContext)(U),{t:c}=(0,P.u)();if(o&&"undefined"==typeof window)return null;let p=r.createElement(G,Object.assign({},s),r.createElement(K,null,r.createElement(i.r,{sx:{[y.M.mbDown]:{margin:0},".mantine-Grid-col":{[y.M.mbDown]:{padding:0}}}},r.createElement(i.r.Col,{span:("object"==typeof a||n)&&!m?6:12,order:n?2:1,orderMd:n?1:2,sx:{zIndex:n?99:void 0}},r.createElement(J,{"data-similac":n,"data-has-banner":"object"==typeof a},t)),a&&"object"==typeof a&&!n&&r.createElement(i.r.Col,{span:m?12:6,order:1,orderMd:2},r.createElement(Q,null,r.createElement(ee,{"data-is-marry-baby":d},r.createElement(et,null,a.heading&&r.createElement(l.D,{order:1,mb:24},a.heading),a.description&&r.createElement(b.T,{size:"p1",color:I.r.colors.gray800},c("onboarding.welcomeScreen.content"))),r.createElement(en,null,a.imgSrc?r.createElement("img",{src:a.imgSrc,loading:"lazy"}):a.imgComponent?a.imgComponent:null)))),a&&"object"==typeof a&&n&&(a.imgSrc||a.imgComponent)&&r.createElement(i.r.Col,{span:"auto",order:1,orderMd:2},r.createElement(en,{className:"similac"},a.imgSrc?r.createElement("img",{src:a.imgSrc,loading:"lazy"}):a.imgComponent?a.imgComponent:null)))));return o?(0,_.createPortal)(p,(0,y.a)()):p},Form:({onClose:e,onSubmit:t,canSkip:n=!0,customFormTexts:a,isActive:o,submitProps:i,submitLabel:l,skipProps:s,isWhatsApp:m})=>{let{t:d}=(0,P.u)(),{sharedData:c,setSharedData:p,nextStep:u}=(0,r.useContext)(U),g=X({initialValues:{phone:(null==c?void 0:c.phone)||""},validate:(0,S.X)(onboardingSchema(d))});return r.createElement(ei,{heading:(null==a?void 0:a.heading)||d("onboarding.updatePhone.heading"),description:(null==a?void 0:a.description)||d(m?"onboarding.updateWhatsapp.description":"onboarding.updatePhone.description"),"data-active":o},r.createElement(R,{form:g},r.createElement("form",{onSubmit:g.onSubmit(e=>(0,O.a)(void 0,void 0,void 0,function*(){try{p(t=>Object.assign(Object.assign({},t),{phone:e.phone}));let n=yield null==t?void 0:t(e.phone);n||u()}catch(e){console.error(e)}}),e=>{console.log(e)})},r.createElement(DynamicForm,{inputOrder:["phone"]}),r.createElement(E.B,Object.assign({variant:"primary",fullWidth:!0,size:"lg"},m&&{leftIcon:r.createElement(j.I.WhatsApp,{size:18,useCurrentColor:!0})},i,{type:"submit","data-event-category":m?"OTP":"Sign Up","data-event-action":m?"Whatsapp - Fill phone and continue Click":"Update Phone Number","data-event-label":"undefined"!=typeof window?window.location.href:"",className:"pointer-event-child-none"}),l||d(m?"onboarding.updateWhatsapp.submitLabel":"onboarding.button.continue")),n&&r.createElement(E.B,Object.assign({variant:"ghost",fullWidth:!0,size:"lg"},m&&{dataEventCategory:"OTP",dataEventAction:"Whatsapp - Skip fill phone Click",dataEventLabel:"undefined"!=typeof window?window.location.href:""},s,{onClick:e,type:"button"}),d("onboarding.button.skip")))))},OtpForm:{Email:({onSubmit:e,email:t,onResendCode:n,otpError:a,onClose:o,loading:i,canSkip:l})=>{let{sharedData:{email:s,retryEmailCount:m},setSharedData:d,prevStep:c,siteType:p,isMarryBaby:u,nextStep:g}=(0,r.useContext)(U),h=t||s||"",[b,E]=(0,r.useState)(30),y=(0,f.Y)(()=>E(e=>e-1),1e3),[w,C]=(0,v.C)(0,{min:0,max:3}),z=(0,r.useRef)(!0),{t:k}=(0,P.u)();(0,r.useEffect)(()=>(y.start(),y.stop),[]),(0,r.useEffect)(()=>{0===b&&(y.stop(),z.current=!1)},[b]);let M=X({initialValues:{otp:""},validate:(0,S.X)(otpSchema(k))});(0,r.useEffect)(()=>{a&&M.setFieldError("otp",a)},[a]);let B=(0,r.useMemo)(()=>D()(()=>{z.current||(C.increment(),E(30),null==n||n(h),y.start(),z.current=!0)},1e3,{trailing:!1}),[h,n,y]);return r.createElement(el,{heading:k("onboarding.otpForm.heading"),description:r.createElement(r.Fragment,null,r.createElement("span",{dangerouslySetInnerHTML:{__html:k("onboarding.otpForm.descriptionEmail",{email:`${(0,x.h)(h)}`})}}),!(m>=2)&&r.createElement("svg",{onClick:()=>{m>=2||(d(e=>Object.assign(Object.assign({},e),{retryEmailCount:e.retryEmailCount+1})),c())},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"otp-description-edit-icon"},r.createElement("path",{d:"M12.7812 1.33337C12.2987 1.33337 11.8162 1.51712 11.4479 1.88546L10.6667 2.66671L13.3333 5.33337L14.1146 4.55212C14.8506 3.81612 14.8506 2.62212 14.1146 1.88546C13.7463 1.51712 13.2638 1.33337 12.7812 1.33337ZM9.66667 3.66671L2 11.3334V14H4.66667L12.3333 6.33337L9.66667 3.66671Z",fill:"#ADB3BC"})))},r.createElement(R,{form:M},r.createElement("form",{onSubmit:M.onSubmit(t=>(0,O.a)(void 0,void 0,void 0,function*(){try{C.increment();let n=yield null==e?void 0:e(t.otp);n||g()}catch(e){console.error(e)}}),e=>{console.log(e)})},r.createElement(DynamicForm,{inputOrder:["otp"]}),r.createElement("div",{className:"resend"},r.createElement(Z.T,{size:"p4",color:I.r.colors.gray400},k("onboarding.otpForm.notReceiveOTP")),r.createElement(Z.T,{as:"a",size:"p4",color:u?I.r.mbColors.pink:I.r.colors.primaryBase,onClick:B},0===b?k("onboarding.otpForm.resendCode"):k("onboarding.otpForm.resendCodeWithSeconds",{seconds:b}))),r.createElement(A.B,{theme:p,color:"primary",isBlock:!0,size:"lg",type:"submit",isLoading:i,disabled:i,"data-event-category":"Sign Up","data-event-action":"Confirm Phone Number","data-event-label":"undefined"!=typeof window?window.location.href:"",className:"pointer-event-child-none"},k("onboarding.button.continue")),l&&w>=3&&r.createElement(A.B,{theme:p,color:"ghost",isBlock:!0,size:"lg",onClick:o,type:"button"},k("onboarding.button.skip")))))},Phone:({onSubmit:e,phone:t,onResendCode:n,otpError:a,onClose:o,loading:i,canSkip:l,isWhatsApp:s})=>{let{sharedData:{phone:c,retryPhoneCount:p},setSharedData:u,prevStep:g,siteType:E,isMarryBaby:y,nextStep:x}=(0,r.useContext)(U),w=t||c||"",[C,z]=(0,r.useState)(30),k=(0,f.Y)(()=>z(e=>e-1),1e3),[M,B]=(0,v.C)(0,{min:0,max:3}),F=(0,r.useRef)(!0),{t:_}=(0,P.u)();(0,r.useEffect)(()=>(k.start(),k.stop),[]),(0,r.useEffect)(()=>{0===C&&(k.stop(),F.current=!1)},[C]);let L=X({initialValues:{otp:""},validate:(0,S.X)(otpSchema(_))});(0,r.useEffect)(()=>{a&&L.setFieldError("otp",a)},[a]);let N=(0,r.useMemo)(()=>D()(()=>{F.current||(B.increment(),z(30),null==n||n(w),k.start(),F.current=!0)},1e3,{trailing:!1}),[w,n,k]),j=`${w.slice(0,-3).replace(/./g,"x").concat(w.slice(-3))}`;return r.createElement(el,{heading:s?r.createElement(m.k,{align:"center",justify:"center",gap:(0,d.h)(8)},r.createElement("img",{style:{width:(0,d.h)(24)},loading:"lazy",src:h.C.getAssetPath("whatsapp.svg"),alt:"whatsapp"}),r.createElement("span",null,_("onboarding.otpWhatsapps.heading"))):_("onboarding.otpForm.heading"),description:r.createElement(r.Fragment,null,r.createElement("span",{dangerouslySetInnerHTML:{__html:_(s?"onboarding.otpWhatsapps.description":"onboarding.otpForm.description",{phone:j})}}),!(p>=2)&&r.createElement("svg",{onClick:()=>{p>=2||(u(e=>Object.assign(Object.assign({},e),{retryPhoneCount:e.retryPhoneCount+1})),g())},width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",className:"otp-description-edit-icon"},r.createElement("path",{d:"M12.7812 1.33337C12.2987 1.33337 11.8162 1.51712 11.4479 1.88546L10.6667 2.66671L13.3333 5.33337L14.1146 4.55212C14.8506 3.81612 14.8506 2.62212 14.1146 1.88546C13.7463 1.51712 13.2638 1.33337 12.7812 1.33337ZM9.66667 3.66671L2 11.3334V14H4.66667L12.3333 6.33337L9.66667 3.66671Z",fill:"#ADB3BC"})))},r.createElement(R,{form:L},r.createElement("form",{onSubmit:L.onSubmit(t=>(0,O.a)(void 0,void 0,void 0,function*(){try{B.increment();let n=yield null==e?void 0:e(t.otp);n||x()}catch(e){console.error(e)}}),e=>{console.log(e)})},r.createElement(DynamicForm,{inputOrder:["otp"]}),r.createElement("div",{className:"resend"},r.createElement(b.T,{size:"p4",color:I.r.colors.gray400},_("onboarding.otpForm.notReceiveOTP")),r.createElement(b.T,{as:"a",size:"p4",color:y?I.r.mbColors.pink:I.r.colors.primaryBase,onClick:N},0===C?_("onboarding.otpForm.resendCode"):_("onboarding.otpForm.resendCodeWithSeconds",{seconds:C}))),r.createElement(A.B,{theme:E,color:"primary",isBlock:!0,size:"lg",type:"submit",isLoading:i,disabled:i,"data-event-category":s?"OTP":"Sign Up","data-event-action":s?"Whatsapp - OTP verified Click":"Confirm Phone Number","data-event-label":"undefined"!=typeof window?window.location.href:"",className:"pointer-event-child-none"},_("onboarding.button.continue")),l&&M>=3&&r.createElement(A.B,{theme:E,color:"ghost",isBlock:!0,size:"lg",onClick:o,type:"button"},_("onboarding.button.skip")))))}},PersonalInfoForm:({onClose:e,onSubmit:t,canSkip:n,loading:a,errorMessage:o,initialData:i})=>{let{t:l,locale:s}=(0,P.u)(),{siteType:m,isMarryBaby:d,setSharedData:c,nextStep:p}=(0,r.useContext)(U),u=X({validate:(0,S.X)(onboardingEmailSchema(l))});return(0,r.useEffect)(()=>{u.setValues(Object.assign(Object.assign({gender:"0"},i),(null==i?void 0:i.birthday)&&{birthday:new Date(i.birthday)}))},[i]),(0,r.useEffect)(()=>{o&&u.setFieldError("email",o)},[o]),r.createElement(OnboardingUI,{heading:l("onboarding.formEmail.heading"),description:l("onboarding.formEmail.description",{site:d?"Marry Baby":g.L[s].SITE_NAME_FORMATTED})},r.createElement(R,{form:u},r.createElement("form",{className:"form",onSubmit:u.onSubmit(e=>(0,O.a)(void 0,void 0,void 0,function*(){c(t=>Object.assign(Object.assign({},t),e));let n=yield null==t?void 0:t(Object.assign(Object.assign({},e),{birthday:e.birthday&&(0,q.Z)(e.birthday,"yyyy-MM-dd")}));n||p()}),e=>{console.log({fieldErrors:e})})},r.createElement(DynamicForm,{inputOrder:["full_name","email","dob","gender"]}),r.createElement(A.B,{color:"primary",isBlock:!0,size:"lg",type:"submit",theme:m,isLoading:a,disabled:a},l("onboarding.button.continue")),n&&r.createElement(A.B,{theme:m,color:"ghost",isBlock:!0,size:"lg",onClick:e,type:"button"},l("onboarding.button.skip")))))},ResultScreen:e=>{var{onClose:t}=e,n=(0,O._)(e,["onClose"]);let{t:a}=(0,P.u)(),{siteType:o}=(0,r.useContext)(U);return r.createElement(OnboardingUI,Object.assign({},n),r.createElement(A.B,{theme:o,size:"lg",onClick:t,className:"form-button"},a("onboarding.button.continue")))},SimilacForm:e=>{var{onClose:t,onSubmit:n,canSkip:a=!0,customFormTexts:o,customTerms:i,defaultValues:l,isActive:s}=e,m=(0,O._)(e,["onClose","onSubmit","canSkip","customFormTexts","customTerms","defaultValues","isActive"]);let{t:d}=(0,P.u)(),{nextStep:c,setSharedData:p,sharedData:u}=(0,r.useContext)(U),{isMobile:g}=(0,L.u)(),h=X({initialValues:{term:!1,phone:(null==u?void 0:u.phone)||(null==l?void 0:l.phone)||"",email:(null==u?void 0:u.email)||(null==l?void 0:l.email)||"",name:(null==u?void 0:u.name)||(null==l?void 0:l.name)||""},validate:(0,S.X)(similacOnboardingSchema(d,!i))}),b=(null==l?void 0:l.email)?["full_name","phone","address","term"]:["full_name","email","phone","address","term"];return r.createElement(ec,Object.assign({heading:(null==o?void 0:o.heading)||d("onboarding.updatePhone.heading"),description:(null==o?void 0:o.description)||d("onboarding.updatePhone.description"),hiddenLogo:g,"data-active":s},m),r.createElement(R,{form:h},r.createElement("form",{style:{width:"100%"},onSubmit:h.onSubmit(e=>(0,O.a)(void 0,void 0,void 0,function*(){try{yield null==n?void 0:n(e),p(t=>Object.assign(Object.assign({},t),{phone:e.phone,email:e.email,name:e.name})),c()}catch(e){console.error(e)}}),e=>{console.log(e)})},r.createElement(DynamicForm,{inputOrder:b,withSimilac:!0,customTerms:i}),r.createElement(E.B,{fullWidth:!0,size:"lg",type:"submit","data-event-category":"Sign Up","data-event-action":"Update Phone Number","data-event-label":"undefined"!=typeof window?window.location.href:"",className:"pointer-event-child-none"},d("onboarding.button.continue")),a&&r.createElement(E.B,{variant:"ghost",fullWidth:!0,size:"lg",onClick:t,type:"button"},d("onboarding.button.skip")))))},FrisoForm:H,UpdatePasswordForm:({onClose:e,onSubmit:t,canSkip:n,errorMessage:a,loading:i})=>{let{t:l}=(0,P.u)(),{nextStep:s}=(0,r.useContext)(U),m=X({initialValues:{password:"",confirmPassword:""},validate:(0,S.X)(onboardingUpdatePasswordSchema(l))});return r.createElement(OnboardingUI,{heading:l("onboarding.updatePassword.heading"),description:l("onboarding.updatePassword.description")},r.createElement(R,{form:m},r.createElement("form",{className:"form",onSubmit:m.onSubmit(e=>(0,O.a)(void 0,void 0,void 0,function*(){yield t((null==e?void 0:e.password)||""),a||s()}),e=>{console.log({fieldErrors:e})})},r.createElement(DynamicForm,{inputOrder:["password","confirm_password"]}),r.createElement(A.B,{color:"primary",isBlock:!0,size:"lg",type:"submit",isLoading:i,disabled:i},l("onboarding.button.continue")),n&&r.createElement(A.B,{color:"ghost",isBlock:!0,size:"lg",onClick:e},l("onboarding.button.skip")),a&&r.createElement(o.I.Error,{className:"form-error"},a))))},StepRenderer:({children:e,onStepChange:t})=>{let{currentStep:n,setMaxStep:a}=(0,r.useContext)(U),o=r.Children.count(e);return(0,r.useEffect)(()=>{null==t||t(n)},[n]),(0,r.useEffect)(()=>{a(o-1)},[o]),r.createElement(r.Fragment,null,(0,W.Z)(e).map((e,t)=>{let a=t===n;return r.createElement(r.Fragment,{key:t},r.isValidElement(e)?e.props.alwaysRender||a?r.cloneElement(e,{isActive:t===n,stepIndex:t}):null:a?e:null)}))},ThankYou:e=>{var{onClose:t,thanksPageInfo:n,isActive:a}=e,o=(0,O._)(e,["onClose","thanksPageInfo","isActive"]);let{t:i}=(0,P.u)(),{isMobile:l}=(0,L.u)();return r.createElement(ep,Object.assign({heading:"",description:"",hiddenLogo:l,"data-active":a},o),r.createElement(s.W,{fluid:!0},r.createElement(c.K,{align:"center",spacing:8,w:"100%",ta:"center"},r.createElement(p.o,{ratio:1,w:{base:120,md:160}},r.createElement("svg",{width:"160",height:"160",viewBox:"0 0 160 160",fill:"none"},r.createElement("mask",{id:"mask0_4580_96805",maskUnits:"userSpaceOnUse",x:"0",y:"0",width:"160",height:"160"},r.createElement("circle",{cx:"80",cy:"80",r:"80",fill:"url(#paint0_radial_4580_96805)"})),r.createElement("g",{mask:"url(#mask0_4580_96805)",fill:"#E0F8EE"},r.createElement("path",{d:"m71.594.46 5.382 37.677c.035 0 .106 0 .141-.035l5.242 36.901 5.207-36.936h.07l5.207-37.043A81 81 0 0 0 80.002 0c-2.85 0-5.664.141-8.408.46m59.556 18.08a79.7 79.7 0 0 0-17.977-11.336L97.87 41.068c.035 0 .07.036.07.036L82.46 75.286z"}),r.createElement("path",{d:"M46.439 64.833 82.11 75.321h-.14l.352.106h.035l.035-.035.035.035h-.035l.035.035h.035l.14.071-.105-.07 35.849 10.523c0 .035 0 .035-.035.07l39.789 11.76a81.6 81.6 0 0 0 1.9-17.48c0-1.66-.071-3.355-.141-4.98h-40.035v.071l-37.362.035v-.035l.176-.035-.14.07.316-.106h-.176l72.858-21.717a81 81 0 0 0-9.885-19.35L82.639 75.285h-.14l.07-.07-.106.07.035-.212-.07.141v.036l-.035.035v-.035h-.07v-.036l-.07-.141.034.177-.07-.036.035.036h-.14l-66.35-42.834A80.5 80.5 0 0 0 4.854 52.615zm35.884 10.559v.035l-.106-.07z"}),r.createElement("path",{d:"M57.803 46.93 82.29 75.25 66.774 41.105 50.556 5.614c-6.895 2.72-13.298 6.392-19.103 10.842zm56.074 48.872L82.531 75.568l24.451 28.286c-.036 0-.036.035-.071.035l29.094 33.758a81.7 81.7 0 0 0 14.037-18.468zM82.32 75.427v.036h.036zh.036z"}),r.createElement("path",{d:"m82.286 75.462.035-.035h-.035l-.142.07zm-.07.106L50.941 95.944c-.035-.036-.035-.071-.07-.106L11.328 121.51c4.151 6.991 9.358 13.277 15.374 18.68l35.884-41.74zM46.438 86.056l35.849-10.664-82.146.106A72 72 0 0 0 0 80.3c0 6.498.774 12.818 2.216 18.892zq0 .052 0 0M82.25 75.71 47 153.467c7.282 3.319 15.127 5.544 23.395 6.533zm.21 0 11.892 83.619a78.2 78.2 0 0 0 22.586-7.769zm-.14-.142.036.283.07-.283-.07-.07z"})),r.createElement("path",{d:"m124.694 61.2.292.973c.097.486.486.778.973.972l.972.292-.972.39c-.39.096-.779.485-.876.874l-.389 1.07-.389-1.07a1.9 1.9 0 0 0-.875-.875l-.973-.292.973-.291c.389-.098.681-.487.875-.876z",fill:"#2D87F3"}),r.createElement("path",{d:"m104.744 34.286.171.571c.058.286.286.457.572.572l.571.17-.571.23a.77.77 0 0 0-.514.514l-.229.628-.229-.628a1.1 1.1 0 0 0-.514-.515l-.571-.17.571-.172c.229-.057.4-.286.514-.515z",fill:"#00B16A"}),r.createElement("path",{d:"m118.345 38 .743 2.4c.343 1.086 1.2 1.943 2.229 2.229l2.4.742-2.458.858c-1.028.342-1.771 1.142-2.114 2.114l-.857 2.457-.971-2.571c-.343-.972-1.143-1.715-2.115-2.058l-2.343-.8 2.286-.8c.972-.342 1.714-1.085 2.114-2z",fill:"#FFB521"}),r.createElement("path",{d:"m41.885 98.857.171.572c.057.285.286.457.572.571l.57.171-.57.229a.77.77 0 0 0-.515.514l-.228.629-.229-.629a1.12 1.12 0 0 0-.514-.514l-.572-.171.572-.172c.228-.057.4-.285.514-.514z",fill:"#00B16A"}),r.createElement("path",{d:"m64.572 125.314.742 2.4c.343 1.086 1.2 1.943 2.23 2.229l2.4.743-2.458.857c-1.029.343-1.772 1.143-2.114 2.114l-.858 2.457-.97-2.571c-.344-.972-1.144-1.715-2.115-2.057l-2.343-.8 2.286-.8c.971-.343 1.714-1.086 2.114-2z",fill:"#FFB521"}),r.createElement("path",{d:"m80.97 120.343.287.971c.114.457.514.8.914.914l1.028.286-1.028.343c-.4.114-.743.457-.857.857l-.343 1.029-.4-1.086c-.172-.4-.457-.743-.857-.857l-.972-.343.972-.343c.4-.114.685-.457.857-.8z",fill:"#2D87F3"}),r.createElement("path",{d:"m130.307 98.286.222.757c.09.356.401.623.713.712l.801.223-.801.267a1 1 0 0 0-.668.668l-.267.801-.312-.846c-.133-.311-.356-.579-.668-.668l-.757-.267.757-.267c.312-.09.535-.356.668-.623z",fill:"#00B16A"}),r.createElement("path",{d:"m36.592 64 .223.757c.089.356.4.623.712.712l.802.223-.802.267a1 1 0 0 0-.668.668l-.267.802-.312-.846c-.133-.312-.356-.58-.668-.668l-.757-.268.757-.267c.312-.089.535-.356.668-.623z",fill:"#FFB521"}),r.createElement("path",{d:"m67.382 26.857.291.973c.098.486.487.778.973.973l.973.291-.973.39c-.389.097-.778.486-.875.875l-.39 1.07-.388-1.07a1.9 1.9 0 0 0-.876-.876l-.973-.291.973-.292c.39-.098.681-.487.876-.876z",fill:"#2D87F3"}),r.createElement("path",{d:"M80.001 108.572c15.78 0 28.572-12.792 28.572-28.572S95.781 51.43 80.001 51.43 51.43 64.22 51.43 80 64.222 108.572 80 108.572",fill:"#00B16A"}),r.createElement("path",{d:"M78.58 89.145a9.28 9.28 0 0 1-6.576-2.717l-3.365-3.366a2.444 2.444 0 0 1 3.455-3.455l3.365 3.367a4.377 4.377 0 0 0 6.189 0l21.336-19.283a2.445 2.445 0 0 1 3.408.213 2.44 2.44 0 0 1-.134 3.412L85.005 86.514a9.05 9.05 0 0 1-6.424 2.632",fill:"#fff"}),r.createElement("defs",null,r.createElement("radialGradient",{id:"paint0_radial_4580_96805",cx:"0",cy:"0",r:"1",gradientUnits:"userSpaceOnUse",gradientTransform:"rotate(90 0 80)scale(80)"},r.createElement("stop",null),r.createElement("stop",{offset:"1"}))))),r.createElement(F.H,{tag:"h3"},null==n?void 0:n.title),r.createElement(b.T,{size:"p3",color:"gray.6"},null==n?void 0:n.description),r.createElement(E.B,{mt:{base:16,md:24},fullWidth:l,size:"lg",onClick:t},i("similac.thankYou.done")))))}}}}]);