PageSourceSearch

https://hellobacsi.com/_next/static/chunks/961c6017.cde4660369584065.js

js hellobacsi.com collected 2026-09-24 10:07:01 UTC 114,957 bytes, 32 lines download raw bytes

1"use strict";(self.webpackChunkhhgDiscoverV1=self.webpackChunkhhgDiscoverV1||[]).push([[696],{g6BO:function(e,t,a){a.r(t),a.d(t,{SSOV2:function(){return SSOV2},getURLwithSSOTracking:function(){return F.g},useSSOV2Store:function(){return T.u}});var o=a("mup0"),n=a("+OUp"),l=a.n(n),i=a("27Mu"),r=a("Bril"),d=a("ei/7"),s=a("GOBr"),c=a("AQbO"),u=a("OWiL"),p=a("6mQP"),v=a("VSpn"),m=a("9VLu"),g=a("sYIX"),h=a("YtXE"),f=a("PAGY"),y=a("vH4S"),S=a("5GB8"),E=a("QnSE"),_=a("E13D"),C=a("RIW1"),b=a("11Kd"),T=a("c5l1"),P=a("xX6x"),O=a("+1EJ"),w=a("W23Z"),F=a("3yHj"),x=a("raNv"),k=a("xrdX"),I=a("iBNF"),D=a("rBCA"),R=a("xXM3"),B=a.n(R),W=a("mYAu"),L=a("sEfC"),M=a.n(L),U=a("DzJC"),G=a.n(U),N=a("A9bs"),V=a("T5Ef"),H=a("NDoz"),j=a("8e12"),q=a("oguI"),Y=a("Tabs"),$=a("M2mm"),Z=a("8BcA"),Q=a.n(Z),X=a("HxUk");let fetchFeatureFlag=e=>(0,o._)(void 0,void 0,void 0,function*(){var t,a;let o=null;try{let t=s.K?"https://mobile-be.hellohealthgroup.com":"https://staging-mobile-be.hellohealthgroup.com",a=yield fetch(`${t}/api/feature-flag/v1/list?site=${e}`);o=yield a.json()}catch(e){o=null}return null===(a=null===(t=null==o?void 0:o.data)||void 0===t?void 0:t.flags)||void 0===a?void 0:a.find(e=>"SSO_V2_flag"===e.name)}),J=(0,n.createContext)({locale:b.L.Vietnam,onClose:()=>!1,setTracking:()=>!1}),SSOStateProvider=({children:e,locale:t=b.L.Vietnam,onClose:a})=>{let[o,n]=l().useState(!1),[i,r]=l().useState();return l().createElement(J.Provider,{value:{locale:t,onClose:a,openCollectInfoPopup:o,setOpenCollectInfoPopup:n,tracking:i,setTracking:r}},e)},useSSOState=()=>l().useContext(J),ConfirmClosePopup=({opened:e,onCancel:t,onClose:a})=>{let{t:o}=(0,C.u)(),{tracking:n}=useSSOState();return l().createElement(f.M,{opened:e,onClose:()=>t(),withCloseButton:!1,zIndex:m.c+2,styles:e=>({body:{padding:"32px 24px",position:"relative",background:"linear-gradient(180deg, #91CAFF 0%,  #CFE8FF 100px, #FFFFFF 200px)",[e.fn.smallerThan("sm")]:{height:"100%"},"[data-event-category]":{pointerEvents:"initial !important","> *":{pointerEvents:"none"}}},content:{[e.fn.largerThan("sm")]:{transform:"translateY(90px)"},[e.fn.smallerThan("sm")]:{width:"100%",height:"100%",borderBottomLeftRadius:0,borderBottomRightRadius:0,maxWidth:"100%",maxHeight:"100%"}},inner:{[e.fn.smallerThan("sm")]:{padding:0,left:0,right:0,top:"unset",display:"block",transition:"transform 70ms"}}})},l().createElement(BackgroundHeader,null),l().createElement(y.Stack,{pos:"relative",mt:150,spacing:8,style:{zIndex:1,textAlign:"center"}},l().createElement(_.T,{size:"h4"},o("ssov2.popup.close.title")),l().createElement(_.T,{size:"p3"},o("ssov2.popup.close.description"))),l().createElement(y.Stack,{mt:32,spacing:8,align:"center"},l().createElement(h.B,{variant:"primary",size:"lg",onClick:t,w:"50%",radius:40,"data-event-category":null==n?void 0:n.category,"data-event-action":null==n?void 0:n.action,"data-event-label":"Cancel Exit"},l().createElement(_.T,{size:"s2",weight:"regular",color:"inherit"},o("ssov2.button.cancel"))),l().createElement(h.B,{variant:"white",size:"lg",onClick:a,fullWidth:!0,"data-event-category":null==n?void 0:n.category,"data-event-action":null==n?void 0:n.action,"data-event-label":"Want to exit"},l().createElement(_.T,{size:"p2",weight:"regular",color:"gray.6"},o("ssov2.button.exitNow")))))},BackgroundHeader=()=>l().createElement("svg",{width:"292",height:"255",viewBox:"0 0 292 255",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{position:"absolute",top:0,left:"50%",zIndex:0,transform:"translateX(-50%)",pointerEvents:"none"}},l().createElement("circle",{opacity:".2",cx:"146",cy:"109",r:"146",fill:"url(#paint0_linear_908_35161)"}),l().createElement("circle",{opacity:".3",cx:"146",cy:"109",r:"85",fill:"url(#paint1_linear_908_35161)"}),l().createElement("circle",{cx:"146.5",cy:"108.5",r:"47.5",fill:"url(#paint2_linear_908_35161)"}),l().createElement("circle",{cx:"146.5",cy:"108.5",r:"47",stroke:"url(#paint3_linear_908_35161)"}),l().createElement("path",{d:"m148.68 89.129-13.51-2.087a4.552 4.552 0 0 0-5.17 4.454v35.009a4.55 4.55 0 0 0 1.586 3.395 4.56 4.56 0 0 0 3.594 1.059l13.5-2.087a4.474 4.474 0 0 0 3.82-4.452V93.58a4.48 4.48 0 0 0-3.82-4.451",fill:"#2D87F3"}),l().createElement("path",{d:"M164.342 108.002a1.43 1.43 0 0 1-.557 1.132l-4.714 3.643a1.07 1.07 0 0 1-1.563-.281 1.1 1.1 0 0 1-.161-.566v-1.224l-5.085-.025a.54.54 0 0 1-.535-.539v-4.322a.54.54 0 0 1 .538-.538l5.088.004-.009-1.214a1.08 1.08 0 0 1 .598-.962 1.07 1.07 0 0 1 1.127.113l4.716 3.648a1.42 1.42 0 0 1 .557 1.131",fill:"#FF6F4D"}),l().createElement("path",{d:"M164.342 108.002a1.43 1.43 0 0 1-.557 1.132l-4.714 3.643a1.07 1.07 0 0 1-1.563-.281 1.1 1.1 0 0 1-.161-.566v-1.224l-5.085-.025a.54.54 0 0 1-.535-.539v-4.322a.54.54 0 0 1 .538-.538l5.088.004-.009-1.214a1.08 1.08 0 0 1 .598-.962 1.07 1.07 0 0 1 1.127.113l4.716 3.648a1.42 1.42 0 0 1 .557 1.131m-18.248-2.179v4.324a.54.54 0 0 0 .539.539h3.017a.54.54 0 0 0 .538-.539v-4.324a.54.54 0 0 0-.538-.539h-3.017a.54.54 0 0 0-.539.539m-1.616 4.341a.54.54 0 0 1-.539.539h-.977a1.463 1.463 0 0 1-1.462-1.462v-2.478a1.463 1.463 0 0 1 1.462-1.463h.977a.54.54 0 0 1 .539.539z",fill:"#FF6F4D"}),l().createElement("defs",null,l().createElement("linearGradient",{id:"paint0_linear_908_35161",x1:"147.5",y1:"141",x2:"36.5",y2:"30",gradientUnits:"userSpaceOnUse"},l().createElement("stop",{stopColor:"#fff",stopOpacity:"0"}),l().createElement("stop",{offset:"1",stopColor:"#fff"})),l().createElement("linearGradient",{id:"paint1_linear_908_35161",x1:"218.376",y1:"63.134",x2:"61",y2:"109",gradientUnits:"userSpaceOnUse"},l().createElement("stop",{stopColor:"#fff"}),l().createElement("stop",{offset:"1",stopColor:"#fff",stopOpacity:"0"})),l().createElement("linearGradient",{id:"paint2_linear_908_35161",x1:"146.5",y1:"61",x2:"146.5",y2:"156",gradientUnits:"userSpaceOnUse"},l().createElement("stop",{stopColor:"#fff",stopOpacity:".6"}),l().createElement("stop",{offset:"1",stopColor:"#fff",stopOpacity:"0"})),l().createElement("linearGradient",{id:"paint3_linear_908_35161",x1:"178.979",y1:"98.35",x2:"108.338",y2:"98.35",gradientUnits:"userSpaceOnUse"},l().createElement("stop",{stopColor:"#fff",stopOpacity:"0"}),l().createElement("stop",{offset:"1",stopColor:"#fff"})))),isPhoneVerifedAlready=(e,t)=>{var a;return(null==t?void 0:t.metaData)?null===(a=null==t?void 0:t.metaData)||void 0===a?void 0:a.is_phone_verified:(null==e?void 0:e.phone_verified_at)&&(null==e?void 0:e.phone)},isSetupFullInfoAlready=(e,t)=>{var a,o,n;if(null==t?void 0:t.metaData)return(null===(a=null==t?void 0:t.metaData)||void 0===a?void 0:a.is_name)&&(null===(o=null==t?void 0:t.metaData)||void 0===o?void 0:o.is_gender)&&(null===(n=null==t?void 0:t.metaData)||void 0===n?void 0:n.is_birthday);let l=!!(null==e?void 0:e.name),i="number"==typeof(null==e?void 0:e.gender),r=!!(null==e?void 0:e.b
1irthday);return l&&i&&r},isExistUpdateEmailStep=e=>e.find(e=>e.type===T.S.UPDATE_EMAIL),isVerifyPhoneInTheSignUp=(e,t)=>{var a;return(null===(a=e[0])||void 0===a?void 0:a.type)===T.S.FIRST&&(null==t?void 0:t.flow)==="signup"},parseEmailFromToken=e=>{try{let t=e.split(".")[1],a=t.replace(/-/g,"+").replace(/_/g,"/"),o=decodeURIComponent(atob(a).split("").map(function(e){return"%"+("00"+e.charCodeAt(0).toString(16)).slice(-2)}).join("")),n=JSON.parse(o);return n.email}catch(e){return""}},isSocialFlowFn=e=>(null==e?void 0:e.method)==="google"||(null==e?void 0:e.method)==="facebook",isPhoneFlowFn=e=>(null==e?void 0:e.method)==="sms"||(null==e?void 0:e.method)==="zalo"||(null==e?void 0:e.method)==="phone"||(null==e?void 0:e.method)==="whatsapp",isEmailFlowFn=e=>(null==e?void 0:e.method)==="email",isResetPasswordFlowFn=e=>{let t=e.findIndex(e=>e.type===T.S.PASSWORD),a=e.findIndex(e=>e.type===T.S.FORGOT_PASSWORD_SETUP);return t>0&&a>0&&a>t},isResetPasswordViePhoneFlowFn=e=>{let t=e.findIndex(e=>e.type===T.S.PASSWORD),a=e.findIndex(e=>e.type===T.S.FORGOT_PASSWORD_PHONE);return t>0&&a>0&&a>t},isDisplayProgressBarFn=(e,t)=>{let a=(null==t?void 0:t.type)===T.S.OTP||(null==t?void 0:t.type)===T.S.SETUP_FULL||(null==t?void 0:t.type)===T.S.VERIFY_PHONE||(null==t?void 0:t.type)===T.S.PASSWORD||(null==t?void 0:t.type)===T.S.FORGOT_PASSWORD_PHONE||(null==t?void 0:t.type)===T.S.FORGOT_PASSWORD_SETUP||(null==t?void 0:t.type)===T.S.EMAIL||(null==t?void 0:t.type)===T.S.UPDATE_EMAIL,o=isSocialFlowFn(e)||isPhoneFlowFn(e)||isEmailFlowFn(e);return a&&o},getCurrentStepNumber=(e,{steps:t,currentStepIndex:a,abTestFlow:o},n)=>{var l,i,r;let d=t[a],s=isSocialFlowFn(e),c=isPhoneFlowFn(e),u=isEmailFlowFn(e);if(s){let i="community"===(0,T.u)().setupSource&&(null===(l=t[0])||void 0===l?void 0:l.type)===T.S.UPDATE_EMAIL,r=i?[T.S.UPDATE_EMAIL,T.S.OTP,n&&(0,T.i)(n)?void 0:T.S.SETUP_FULL].flat().filter(Boolean):[isPhoneVerifedAlready(n,e)||"B"===o?void 0:[T.S.VERIFY_PHONE,T.S.OTP],isExistUpdateEmailStep(t)?(null==d?void 0:d.type)===T.S.OTP?T.S.OTP:T.S.UPDATE_EMAIL:void 0,n&&(0,T.i)(n)?void 0:T.S.SETUP_FULL].flat().filter(Boolean),s=t[a-1];return[r.length,(null==s?void 0:s.type)===T.S.UPDATE_EMAIL?r.findLastIndex(e=>e===(null==d?void 0:d.type))+1:r.findIndex(e=>e===(null==d?void 0:d.type))+1]}if(c&&(null==e?void 0:e.flow)==="signup"){let t=[isPhoneVerifedAlready(n,e)?void 0:T.S.OTP,(null===(i=null==e?void 0:e.metaData)||void 0===i?void 0:i.is_pass)?void 0:T.S.FORGOT_PASSWORD_SETUP,isSetupFullInfoAlready(n,e)?void 0:T.S.SETUP_FULL].flat().filter(Boolean);return[t.length,t.findIndex(e=>e===(null==d?void 0:d.type))+1]}if(c&&(null==e?void 0:e.flow)==="login"){let o=t.find(e=>e.type===T.S.FORGOT_PASSWORD_PHONE),l=[T.S.PASSWORD,!isPhoneVerifedAlready(n,e)||o?[T.S.FORGOT_PASSWORD_PHONE,T.S.OTP]:void 0,o?T.S.FORGOT_PASSWORD_SETUP:void 0,isExistUpdateEmailStep(t)?(null==d?void 0:d.type)===T.S.OTP?T.S.OTP:T.S.UPDATE_EMAIL:void 0,isSetupFullInfoAlready(n,e)?void 0:T.S.SETUP_FULL].flat().filter(Boolean),i=t[a-1];return[l.length,(null==i?void 0:i.type)===T.S.UPDATE_EMAIL?l.findLastIndex(e=>e===(null==d?void 0:d.type))+1:l.findIndex(e=>e===(null==d?void 0:d.type))+1]}if(u){let l=!isPhoneVerifedAlready(n,e)&&"B"!==o,i=!isPhoneVerifedAlready(n,e)&&"care_onboarding"===T.u.getState().source,s=!(null===(r=null==e?void 0:e.metaData)||void 0===r?void 0:r.is_pass),c=l||i,u=!isSetupFullInfoAlready(n,e),p=t.find(e=>e.type===T.S.FORGOT_PASSWORD_SETUP);if(!s&&!c&&!u)return[];let v=[(null==d?void 0:d.type)===T.S.OTP?T.S.OTP:T.S.EMAIL,s||p?T.S.FORGOT_PASSWORD_SETUP:T.S.PASSWORD,c?(null==d?void 0:d.type)===T.S.OTP?T.S.OTP:T.S.VERIFY_PHONE:void 0,u?T.S.SETUP_FULL:void 0].flat().filter(Boolean),m=t[a-1];return[v.length,(null==m?void 0:m.type)===T.S.VERIFY_PHONE?v.findLastIndex(e=>e===(null==d?void 0:d.type))+1:v.findIndex(e=>e===(null==d?void 0:d.type))+1]}return[]},ProgressBar=()=>{let{steps:e,currentStepIndex:t}=(0,T.a)(),{flowData:a,userInfo:o,abTestFlow:i}=(0,T.u)(),r=(0,n.useMemo)(()=>o,[o]),[d,s]=getCurrentStepNumber(a,{steps:e,currentStepIndex:t,abTestFlow:i},r);return s&&1!==d?l().createElement(y.Flex,{gap:2},Array.from({length:d}).map((e,t)=>{let a=t+1;return l().createElement(y.Box,{key:a,style:{width:"auto",height:2,flex:1,borderRadius:4,backgroundColor:a<=s?"#00B16A":"#D2D6DC"}})})):null},SSOPopupWrapper=({children:e,opened:t,onClose:a})=>{var o;let{steps:n,goBack:i,currentStepIndex:r}=(0,T.a)(),{flowData:d}=(0,T.u)(),{locale:s,tracking:p}=useSSOState(),v=n[r],y=isDisplayProgressBarFn(d,v),E=n.length>1&&!y||(null==v?void 0:v.type)===T.S.OTP||(null==v?void 0:v.type)===T.S.WHATSAPP_OTP&&n.length>1||(null==v?void 0:v.type)===T.S.PASSWORD||(null==v?void 0:v.type)===T.S.EMAIL,_=(null==v?void 0:v.type)===T.S.FIRST,C=(1===n.length||y)&&!E,O=null===(o=m.L[s])||void 0===o?void 0:o.LOGO_TYPE,[w,F]=l().useState(!1),onCloseClick=()=>{F(!0)},x=(null==v?void 0:v.type)===T.S.WHATSAPP_PHONE_VERIFY,k=(null==v?void 0:v.type)===T.S.WHATSAPP_PHONE_VERIFY||(null==v?void 0:v.type)===T.S.WHATSAPP_OTP;return l().createElement(l().Fragment,null,l().createElement(f.M,{opened:t,onClose:()=>{k||onCloseClick()},closeOnClickOutside:!k,closeOnEscape:!k,styles:e=>({body:{display:"flex",flexDirection:"column",gap:x?24:16,padding:"32px 24px",position:"relative",background:x?"linear-gradient(180deg, #A5D4FF 0%, #FFFFFF 70px)":"linear-gradient(180deg, #A5D4FF 0%, #FFFFFF 150px
1)",overflow:"auto",[e.fn.smallerThan("sm")]:{height:"100%"},"[data-event-category]":{pointerEvents:"initial !important","> *":{pointerEvents:"none"}}},content:{[e.fn.smallerThan("sm")]:{width:"100%",height:"100%",borderRadius:0,maxWidth:"100%",maxHeight:"100%"}},inner:{[e.fn.smallerThan("sm")]:{padding:0,left:0,right:0,display:"block"}}}),withCloseButton:!1,zIndex:m.c,overlayProps:{"data-event-label":"Focus out","data-event-category":null==p?void 0:p.category,"data-event-action":null==p?void 0:p.action}},l().createElement("div",{style:{height:40,display:"flex",alignItems:"center",justifyContent:"space-between"}},E&&l().createElement(h.B,{variant:"white",style:{width:40,height:40,padding:8,background:"white",borderRadius:"100%"},onClick:i,"data-event-category":null==p?void 0:p.category,"data-event-action":null==p?void 0:p.action,"data-event-label":"Back"},l().createElement(c.A,null)),C&&l().createElement("div",{style:{display:"flex",alignItems:"center",gap:"8px"}},l().createElement(g.L,{type:O,height:32,width:"unset"}),s===b.L.Indonesia&&l().createElement(P.I,{alt:"",src:S.C.getAssetPath("sehat-badge.png"),style:{width:56,height:23}})),_&&l().createElement(h.B,{variant:"white",style:{width:40,height:40,padding:8,background:"white",borderRadius:"100%"},onClick:onCloseClick,"data-event-category":null==p?void 0:p.category,"data-event-action":null==p?void 0:p.action,"data-event-label":"Exit"},l().createElement(u.A,null))),y&&l().createElement(ProgressBar,null),l().createElement("div",{style:{flex:1}},e)),l().createElement(ConfirmClosePopup,{opened:w,onCancel:()=>F(!1),onClose:()=>{F(!1),null==a||a()}}))},loginByEmailPassword=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("email",e),a.append("password",t),(0,d.f)(d.S.EMAIL.LOGIN_BY_PASSWORD,{method:"POST",body:a})}),registerBySendEmailOTP=e=>(0,o._)(void 0,void 0,void 0,function*(){let t=new FormData;return t.append("email",e),t.append("website_id",d.w),(0,d.f)(d.S.EMAIL.REGISTER_BY_SEND_OTP,{method:"POST",body:t})}),resendEmailOTP=e=>(0,o._)(void 0,void 0,void 0,function*(){let t=new FormData;return t.append("email",e),(0,d.f)(d.S.EMAIL.SEND_OTP,{method:"POST",body:t})}),verifyByEmailOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("email",e),a.append("code",t),(0,d.f)(d.S.EMAIL.VERIFY_BY_OTP,{method:"POST",body:a})}),getErrorTextFromCode=(e,t)=>{let a=null==t?void 0:t.split("_")[2];if("string"!=typeof a)return e("ssov2.error.api");let o=null==a?void 0:a.padStart(3,"0");return e(`ssov2.error.api.${o}`)||e("ssov2.error.api")},SSOEmailScreen=({hidden:e})=>{let{t}=(0,C.u)(),[a,i]=l().useState(!1),[s,c]=l().useState(""),{flowData:u,abTestFlow:p}=(0,T.u)(),v="signup"===u.flow?`SSO - Sign Up via Email_Phone_Adoption_Test_${p}`:`SSO - Sign In via Email_Phone_Adoption_Test_${p}`,m="Continue With Email",{setTracking:g}=useSSOState();(0,n.useEffect)(()=>{e||(c(""),g({category:v,action:m}))},[e]);let{addStep:f,goNext:S}=(0,T.a)();return l().createElement("form",{style:{display:e?"none":"block"},onSubmit:e=>(0,o._)(void 0,void 0,void 0,function*(){var a,o;e.preventDefault(),i(!0);try{let n=e.currentTarget.email.value,l=yield(0,d.c)({email:n});if((null==l?void 0:l._status)===1){if(null===(a=l._data)||void 0===a?void 0:a.is_pass)T.u.setState({flowData:{method:"email",flow:"login",metaData:l._data}}),f({type:T.S.PASSWORD,config:{email:n}}),S();else{let e;if(T.u.setState({flowData:{method:"email",flow:"signup",metaData:l._data}}),(null==(e=(null===(o=l._data)||void 0===o?void 0:o.provider)?yield resendEmailOTP(n):yield registerBySendEmailOTP(n))?void 0:e._status)!==1)return c(getErrorTextFromCode(t,null==e?void 0:e.code)),i(!1);f({type:T.S.OTP,config:{email:n,otpType:"email",afterAction:"forgot"}}),S()}}else c(getErrorTextFromCode(t,null==l?void 0:l.code))}catch(e){console.error(e),c(getErrorTextFromCode(t,""))}i(!1)})},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},t("ssov2.email.title")),l().createElement(_.T,{size:"p4"},t("ssov2.email.description"))),l().createElement(r.I,{name:"email",placeholder:t("onboarding.formEmail.yourEmail"),error:s||void 0,type:"email",required:!0,mt:24,disabled:a,onChange:()=>c(""),"data-event-category":v,"data-event-action":m,"data-event-label":"Enter Email"}),l().createElement(h.B,{type:"submit",size:"lg",variant:"primary",fullWidth:!0,mt:16,disabled:a,loading:a,"data-event-category":v,"data-event-action":m,"data-event-label":"Verify Your Email"},t("ssov2.email.button")))},K="6LdojYYcAAAAAA8ua5QRzZg7pp-chCFjpXbevSt-",GRecaptchaHandler=e=>{let{recaptchaHandlerRef:t}=e,a=(0,n.useRef)();return((0,n.useImperativeHandle)(t,()=>({getToken:()=>(0,o._)(void 0,void 0,void 0,function*(){let e=a.current;if(!e)return null;try{let t=yield e.executeAsync();return e.reset(),t}catch(e){return null}})})),(0,n.useEffect)(()=>{K||console.warn("[ERROR] Google Recaptcha key isn't available")},[]),K)?l().createElement(r.h,null,l().createElement(O.A,{ref:a,size:"invisible",sitekey:K,onErrored:()=>{console.warn("[ERROR] Recaptcha")}})):null},useGRecaptchaHandler=()=>{let e=(0,n.useRef)(null);return{getGRecaptchaToken:()=>{var t,a,o;return null!==(o=null===(a=null===(t=e.current)||void 0===t?void 0:t.getToken)||void 0===a?void 0:a.call(t))&&void 0!==o?o:null},renderRecaptchaHandler:()=>(0,T.I)()?l().createElement(GRecaptchaHandler,{recaptchaHandlerRef:e}):null}},loginByPhonePassword=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData,{phoneNumber:o}=(0,T.s)(e);return o=o.startsWith("0")?o.substring(1):o,a.append("phone_number",o),a.append("password",t),(0,d.f)(d.S.PHONE.LOGIN_BY_PASSWORD,{method:"POST",body:a},!0)}),registerBySendPhoneOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("phone_number",e),a.append("area_code",t),a.append("website_id",d.w),(0,d.f)(d.S.PHONE.REGISTER_BY_SEND_OTP,{method:"POST",body:a})}),resendPhoneOTP=(e,t,a)=>(0,o._)(void 0,void 0,void 0,function*(){let o=new FormData;return o.append("phone_number",e),o.append("area_code",t),o.append("g-recaptcha-response",a),(0,d.f)(d.S.PHONE.SEND_OTP,{method:"POST",body:o})}),verifyByPhoneOTP=(e,t,a)=>(0,o._)(void 0,void 0,void 0,function*(){let o=new FormData;return o.append("phone_number",e),o.append("area_code",t),o.append("otp_code",a),(0,d.f)(d.S.PHONE.VERIFY_BY_OTP,{method:"POST",body:o})}),resendUpdatePhoneOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("phone_number",e),a.append("area_code",t),(0,d.f)(d.S.PHONE.UPDATE_PHONE_SEND_OTP,{method:"POST",body:a})}),verifyUpdatePhoneOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("otp_code",t),a.append("area_code",e),(0,d.f)(d.S.PHONE.UPDATE_PHONE_VERIFY_OTP,{method:"POST",body:a})}),loginBySocial=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("token",e),a.append("provider",t),a.append("website_id",d.w),(0,d.f)(d.S.LOGIN_BY_SOCIAL,{method:"POST",body:a})}),sendLoginOtpWhatsapp=(e,t,a)=>(0,o._)(void 0,void 0,void 0,function*(){return(0,d.b)(d.S.WHATSAPP.LOGIN_OTP_WHATSAPP,{phone_number:e,area_code:t,website_id:Number(d.w),ga_client_id:(0,i.Ri)("_ga")||"",referrer:a||("undefined"!=typeof window?window.location.href:"")},!0)}),verifyWhatsappOtpGuest=(e,t,a)=>(0,o._)(void 0,void 0,void 0,function*(){return(0,d.b)(d.S.WHATSAPP.VERIFY_BY_OTP,{otp_code:a,phone_number:e,area_code:t,login_type:"otp-whatsapp"}
1,!0)}),registerBySendWhatsAppOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("phone_number",e),a.append("area_code",t),a.append("website_id",d.w),F.i&&a.append("consent_type",JSON.stringify({TC_acceptance:T.u.getState().isHaveReadAndAgreePolicy,marketing_opt_in:T.u.getState().isGetUpdateFromHHG,source_screen:"signup_page"})),(0,d.f)(d.S.WHATSAPP.REGISTER_BY_SEND_OTP,{method:"POST",body:a})}),resendWhatsAppOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("phone_number",e),a.append("area_code",t),(0,d.f)(d.S.WHATSAPP.SEND_OTP,{method:"POST",body:a})}),resendUpdatePhoneWhatsAppOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("phone_number",e),a.append("area_code",t),(0,d.f)(d.S.WHATSAPP.UPDATE_PHONE_SEND_OTP,{method:"POST",body:a})}),verifyUpdatePhoneWhatsAppOTP=(e,t,a)=>(0,o._)(void 0,void 0,void 0,function*(){let o=new FormData;return o.append("phone_number",e),o.append("otp_code",a),o.append("area_code",t),(0,d.f)(d.S.WHATSAPP.UPDATE_PHONE_VERIFY_OTP,{method:"POST",body:o})}),verifyByWhatsAppOTP=(e,t,a)=>(0,o._)(void 0,void 0,void 0,function*(){let o=new FormData;return o.append("otp_code",a),o.append("phone_number",e),o.append("area_code",t),(0,d.f)(d.S.WHATSAPP.VERIFY_BY_OTP,{method:"POST",body:o})}),registerBySendZaloOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("phone_number",e),a.append("area_code",t),a.append("website_id",d.w),(0,d.f)(d.S.ZALO.REGISTER_BY_SEND_OTP,{method:"POST",body:a})}),resendZaloOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("phone_number",e),a.append("area_code",t),(0,d.f)(d.S.ZALO.SEND_OTP,{method:"POST",body:a})}),verifyByZaloOTP=(e,t,a)=>(0,o._)(void 0,void 0,void 0,function*(){let o=new FormData;return o.append("otp_code",a),o.append("phone_number",e),o.append("area_code",t),(0,d.f)(d.S.ZALO.VERIFY_BY_OTP,{method:"POST",body:o})}),resendUpdatePhoneZaloOTP=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=new FormData;return a.append("phone_number",e),a.append("area_code",t),(0,d.f)(d.S.ZALO.UPDATE_PHONE_SEND_OTP,{method:"POST",body:a})}),verifyUpdatePhoneZaloOTP=(e,t,a)=>(0,o._)(void 0,void 0,void 0,function*(){let o=new FormData;return o.append("phone_number",e),o.append("otp_code",a),o.append("area_code",t),(0,d.f)(d.S.ZALO.UPDATE_PHONE_VERIFY_OTP,{method:"POST",body:o})}),MailIcon=e=>l().createElement("svg",Object.assign({width:"21",height:"20",viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},e),l().createElement("path",{d:"M15.043 2.56348H6.29297C3.66797 2.56348 1.91797 3.87598 1.91797 6.93848V13.0635C1.91797 16.126 3.66797 17.4385 6.29297 17.4385H15.043C17.668 17.4385 19.418 16.126 19.418 13.0635V6.93848C19.418 3.87598 17.668 2.56348 15.043 2.56348ZM15.4542 7.89223L12.7155 10.0797C12.138 10.5435 11.403 10.771 10.668 10.771C9.93297 10.771 9.18922 10.5435 8.62047 10.0797L5.88172 7.89223C5.60172 7.66473 5.55797 7.24473 5.77672 6.96473C6.00422 6.68473 6.41547 6.63223 6.69547 6.85973L9.43422 9.04723C10.0992 9.58098 11.228 9.58098 11.893 9.04723L14.6317 6.85973C14.9117 6.63223 15.3317 6.67598 15.5505 6.96473C15.778 7.24473 15.7342 7.66473 15.4542 7.89223Z",fill:"#00B16A"})),checkboxStyles=e=>({inner:{padding:"3px"},label:{paddingLeft:"8px",position:"relative",top:"1px"},icon:{width:"40%"},input:{borderColor:I.w.colors.neutral400,borderWidth:"1.5px",borderRadius:"3px",width:"14px",height:"14px",":not(:checked)":{borderColor:e?I.w.colors.red600:I.w.colors.neutral400}}}),PolicyContent=({legalTextType:e,trackingCategory:t,trackingAction:a,activeTab:o,errMsgPolicy:n})=>{var i,d;let{t:s}=(0,C.u)(),{locale:c}=useSSOState(),{isHaveReadAndAgreePolicy:u,setIsHaveReadAndAgreePolicy:p,isGetUpdateFromHHG:v,setIsGetUpdateFromHHG:g}=(0,T.u)(),h=F.i&&"signup"===o,f=`https://${k.y[c]}/static/${(null===(i=m.S[c])||void 0===i?void 0:i.PRIVACY_POLICY)||""}`,S=`https://${k.y[c]}/static/${(null===(d=m.S[c])||void 0===d?void 0:d.TERM_OF_USE)||""}`,E=l().createElement(_.T,{size:"p5",color:"gray.6"}
1,s(F.i?"ssov2.policyText.version2":"community"===e?"ssov2.policyText.community":"ssov2.policyText",{privacy:l().createElement("a",{href:f,target:"_blank",style:{color:"#262626",textDecoration:"underline"},"data-event-category":t,"data-event-action":a,"data-event-label":"Privacy Policy",rel:"noreferrer"},s("ssov2.policyText.privacy")),terms:l().createElement("a",{href:S,target:"_blank",style:{color:"#262626",textDecoration:"underline"},"data-event-category":t,"data-event-action":a,"data-event-label":"Terms of Service",rel:"noreferrer"},s("ssov2.policyText.terms"))}));return l().createElement(y.Stack,{spacing:24,sx:e=>({marginTop:56,[e.fn.smallerThan("sm")]:{marginTop:"auto",paddingTop:50}}),className:n?"sso-has-error":void 0,"data-testid":"policy-content"},h&&l().createElement(y.Stack,{spacing:16},l().createElement(r.d,{label:l().createElement(_.T,{size:"p5",color:"gray.5"},s("ssov2.policyText.readAndAgree",{privacy:l().createElement("a",{href:f,target:"_blank",style:{color:"inherit",textDecoration:"underline"},"data-event-category":t,"data-event-action":a,"data-event-label":"Privacy Policy",rel:"noreferrer"},s("ssov2.policyText.privacy")),terms:l().createElement("a",{href:S,target:"_blank",style:{color:"inherit",textDecoration:"underline"},"data-event-category":t,"data-event-action":a,"data-event-label":"Terms of Service",rel:"noreferrer"},s("ssov2.policyText.terms"))}),l().createElement("span",{style:{color:I.w.colors.red600}},"*")),checked:u,onChange:e=>{p(e.target.checked)},styles:checkboxStyles(!!n)}),l().createElement(r.d,{label:l().createElement(_.T,{size:"p5",color:"gray.5"},s("ssov2.policyText.receiveUpdates")),checked:v,onChange:e=>{g(e.target.checked)},styles:checkboxStyles()})),(!o||"signup"!==o)&&(F.i?E:l().createElement(x.S,{maxHeight:74,showLabel:l().createElement(_.T,{size:"p5",color:"gray.6",underline:!0,align:"left"},s("home.seeMore")),hideLabel:l().createElement(_.T,{size:"p5",color:"gray.6",underline:!0,align:"left"},s("articlePage.showLess"))},E)))},FirstBFlow=({hidden:e,activeTab:t,legalTextType:a,trackingAction:o,trackingCategory:n,onTriggerGoogleLogin:i,onTriggerFacebookLogin:r,onClickEmail:d})=>{let{t:s}=(0,C.u)();return l().createElement("div",{style:{display:e?"none":"flex",flexDirection:"column",height:"100%"}},l().createElement(y.Stack,{mt:8,spacing:8},l().createElement(_.T,{size:"h4",weight:"semiBold"},s("home.navigator.menu.category.noDatas.title")),l().createElement(_.T,{size:"p4"},s("ssov2.abTestingFlowB.description"))),l().createElement(y.Stack,{mt:24,spacing:24},l().createElement(h.B,{variant:"white",style:{flex:1,height:48,padding:12,background:"#F7F9FC",borderRadius:8},onClick:i,"data-event-category":n,"data-event-action":o,"data-event-label":"Continue with Google"},l().createElement(w.G,{style:{width:20,height:20,marginRight:4,borderRadius:"100%"}})," ",l().createElement(_.T,{size:"p4",color:"black",weight:"semiBold"},s("ssov2.button.continueGoogle"))),l().createElement(y.Stack,{spacing:24,align:"center"},l().createElement(_.T,{size:"p4",color:"gray.4"},s("ssov2.orContinueWith")),l().createElement(y.Group,{spacing:8,style:{width:"100%"}},l().createElement(h.B,{variant:"white",style:{flex:1,height:48,padding:12,background:"#F7F9FC",borderRadius:8},onClick:r,"data-event-category":n,"data-event-action":o,"data-event-label":"Continue with Facebook"},l().createElement(w.F,{style:{width:20,height:20,marginRight:4,borderRadius:"100%"}})," ",l().createElement(_.T,{size:"p4",color:"black",weight:"regular"},"Facebook")),l().createElement(h.B,{variant:"white",style:{flex:1,height:48,padding:12,background:"#F7F9FC",borderRadius:8},onClick:d,"data-event-category":n,"data-event-action":o,"data-event-label":"Continue with Email"},l().createElement(MailIcon,{style:{marginRight:4}})," ",l().createElement(_.T,{size:"p4",color:"black",weight:"regular"},"Email"))))),l().createElement(PolicyContent,{legalTextType:a,trackingAction:o,trackingCategory:n,activeTab:t}))};function createCommonjsModule(e){var t={exports:{}};return e(t,t.exports),t.exports}/** @license React v16.13.1
2 * react-is.production.min.js
3 *
4 * Copyright (c) Facebook, Inc. and its affiliates.
5 *
6 * This source code is licensed under the MIT license found in the
7 * LICENSE file in the root directory of this source tree.
8 */var ee="function"==typeof Symbol&&Symbol.for,et=ee?Symbol.for("react.element"):60103,ea=ee?Symbol.for("react.portal"):60106,eo=ee?Symbol.for("react.fragment"):60107,en=ee?Symbol.for("react.strict_mode"):60108,el=ee?Symbol.for("react.profiler"):60114,ei=ee?Symbol.for("react.provider"):60109,er=ee?Symbol.for("react.context"):60110,ed=ee?Symbol.for("react.async_mode"):60111,es=ee?Symbol.for("react.concurrent_mode"):60111,ec=ee?Symbol.for("react.forward_ref"):60112,eu=ee?Symbol.for("react.suspense"):60113,ep=ee?Symbol.for("react.suspense_list"):60120,ev=ee?Symbol.for("react.memo"):60115,em=ee?Symbol.for("react.lazy"):60116,eg=ee?Symbol.for("react.block"):60121,eh=ee?Symbol.for("react.fundamental"):60117,ef=ee?Symbol.for("react.responder"):60118,ey=ee?Symbol.for("react.scope"):60119;function z(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case et:switch(e=e.type){case ed:case es:case eo:case el:case en:case eu:return e;default:switch(e=e&&e.$$typeof){case er:case ec:case em:case ev:case ei:return e;default:return t}}case ea:return t}}}function A(e){return z(e)===es}var eS={AsyncMode:ed,ConcurrentMode:es,ContextConsumer:er,ContextProvider:ei,Element:et,ForwardRef:ec,Fragment:eo,Lazy:em,Memo:ev,Portal:ea,Profiler:el,StrictMode:en,Suspense:eu,isAsyncMode:function(e){return A(e)||z(e)===ed},isConcurrentMode:A,isContextConsumer:function(e){return z(e)===er},isContextProvider:function(e){return z(e)===ei},isElement:function(e){return"object"==typeof e&&null!==e&&e.$$typeof===et},isForwardRef:function(e){return z(e)===ec},isFragment:function(e){return z(e)===eo},isLazy:function(e){return z(e)===em},isMemo:function(e){return z(e)===ev},isPortal:function(e){return z(e)===ea},isProfiler:function(e){return z(e)===el},isStrictMode:function(e){return z(e)===en},isSuspense:function(e){return z(e)===eu},isValidElementType:function(e){return"string"==typeof e||"function"==typeof e||e===eo||e===es||e===el||e===en||e===eu||e===ep||"object"==typeof e&&null!==e&&(e.$$typeof===em||e.$$typeof===ev||e.$$typeof===ei||e.$$typeof===er||e.$$typeof===ec||e.$$typeof===eh||e.$$typeof===ef||e.$$typeof===ey||e.$$typeof===eg)},typeOf:z};function emptyFunction(){}function emptyFunctionWithReset(){}createCommonjsModule(function(e,t){}),createCommonjsModule(function(e){e.exports=eS}),Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable,function(){try{if(!Object.assign)return!1;var e=new String("abc");if(e[5]="de","5"===Object.getOwnPropertyNames(e)[0])return!1;for(var t={},a=0;a<10;a++)t["_"+String.fromCharCode(a)]=a;var o=Object.getOwnPropertyNames(t).map(function(e){return t[e]});if("0123456789"!==o.join(""))return!1;var n={};"abcdefghijklmnopqrst".split("").forEach(function(e){n[e]=e}),Object.keys(Object.assign({},n)).join("")}catch(e){return!1}}(),Function.call.bind(Object.prototype.hasOwnProperty),emptyFunctionWithReset.resetWarningCache=emptyFunction;var require$$2=function(){function shim(e,t,a,o,n,l){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==l){var i=Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw i.name="Invariant Violation",i}}function getShim(){return shim}shim.isRequired=shim;var e={array:shim,bigint:shim,bool:shim,func:shim,number:shim,object:shim,string:shim,symbol
8:shim,any:shim,arrayOf:getShim,element:shim,elementType:shim,instanceOf:getShim,node:shim,objectOf:getShim,oneOf:getShim,oneOfType:getShim,shape:getShim,exact:getShim,checkPropTypes:emptyFunctionWithReset,resetWarningCache:emptyFunction};return e.PropTypes=e,e},eE=createCommonjsModule(function(e){e.exports=require$$2()});function CountrySelectWithIcon(e){var{value:t,options:a,className:i,arrowComponent:d=DefaultArrowComponent,onChange:s,disabled:c,readOnly:u,trackingFn:v}=e,g=(0,o.a)(e,["value","options","className","arrowComponent","onChange","disabled","readOnly","trackingFn"]);let{t:h}=(0,C.u)(),[f,S]=(0,n.useState)(!1),[E,b]=(0,n.useState)({}),{isMobile:T}=(0,P.u)(),[O,w]=(0,n.useState)(""),F=(0,n.useMemo)(()=>(function(e,t){for(let o of e){var a;if(!o.divider&&(null==(a=o.value)?null==t:a===t))return o}})(a,t),[a,t]),x=(0,n.useMemo)(()=>{if(!F.value)return"";let e=(0,N.getCountryCallingCode)(F.value);return e?`+${e}`:""},[F]),k=(0,n.useCallback)(e=>{s("ZZ"===e?void 0:e)},[s]),I=l().useRef(null),[D,R]=(0,n.useState)(()=>a.filter(e=>e.value)),W=(0,n.useMemo)(()=>M()((e,t)=>{if(!e)return R(t.filter(e=>e.value));let a=e.split(/[\s,;:]+/gi).filter(e=>!!e.trim()).map(e=>e.trim().replace(/\+/gi,"").toLowerCase());if(!a.length)return R(t.filter(e=>e.value));let matched=e=>!!e&&a.some(t=>e.toLowerCase().includes(t)),o=t.filter(e=>{let t=e.value?(0,N.getCountryCallingCode)(e.value):"";return matched(e.value)||matched(e.label)||matched(t)});R(o.filter(e=>e.value))},200),[]);(0,n.useEffect)(()=>{W(O,a)},[a,O]),(0,n.useEffect)(()=>{if(w(""),f){function positionCountrySelect(){let e=I.current.getBoundingClientRect();b({top:e.top+e.height,left:e.left,width:I.current.parentElement.clientWidth,maxHeight:window.innerHeight-e.top-e.height})}let e=G()(positionCountrySelect,200);return window.addEventListener("resize",e,{passive:!0}),positionCountrySelect(),()=>{window.removeEventListener("resize",e)}}},[f]),(0,n.useEffect)(()=>{(c||u)&&S(!1)},[c,u]);let L=l().createElement(y.Stack,{spacing:24},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s4"},h("ssov2.first.country.code")),l().createElement(r.I,{size:"lg",placeholder:h("ssov2.first.search.country.placeholder"),icon:l().createElement(p.A,null),value:O,onChange:e=>w(e)})),!!(null==F?void 0:F.value)&&l().createElement(y.Stack,{spacing:0},l().createElement(_.T,{size:"s4"},h("ssov2.first.search.country.selected")),l().createElement(SelectCountryItem,{option:F,onSelect:e=>{k(e.value),S(!1)},trackingFn:v})),l().createElement(y.Stack,{spacing:0},l().createElement(_.T,{size:"s4"},h("ssov2.first.search.country.all")),D.map(e=>l().createElement(SelectCountryItem,{option:e,key:e.value,onSelect:e=>{k(e.value),S(!1)},selected:F.value===e.value,trackingFn:v})))),U=V.Ay[null==F?void 0:F.value];return l().createElement(l().Fragment,null,l().createElement("div",{className:"PhoneInputCountry",ref:I},l().createElement("div",Object.assign({},g,{className:B()("PhoneInputCountrySelect",i),onClick:()=>{c||u||S(!f)}})),l().createElement(y.Group,{spacing:6,align:"center"},F&&l().createElement(l().Fragment,null,U&&l().createElement(U,{"aria-hidden":!0,label:F.label,style:{width:24,height:16,borderRadius:2}}),l().createElement(_.T,{size:"p2",variant:"primary"},x)),l().createElement(d,null))),f&&(T?l().createElement(H._s.Root,{open:f,onOpenChange:e=>S(e)},l().createElement(H._s.Portal,null,l().createElement(H._s.Overlay,{"data-testid":"overlay",style:{zIndex:m.c+9,position:"fixed",background:"rgba(0, 0, 0, 0.4)",inset:0}}),l().createElement(H._s.Content,{"data-testid":"fully-controlled-content",style:{zIndex:m.c+9,position:"fixed",bottom:0,left:0,right:0,backgroundColor:"white",height:"calc(100% - 120px)",display:"flex",padding:"32px 0 0",flexDirection:"column",borderTopLeftRadius:10,borderTopRightRadius:10}},l().createElement(H._s.Handle,{style:{flexShrink:0,cursor:"pointer",backgroundColor:"#ADB3BC",width:44,height:2,transform:"translateY(-22px)"}}),l().createElement(y.Box,{sx:{flex:1,padding:"0 24px 32px",overflow:"auto"}},L)))):l().createElement(l().Fragment,null,l().createElement("div",{style:{position:"fixed",top:0,left:0,width:"100%",height:"100%",zIndex:m.c+9},onClick:()=>S(!1)}),l().createElement("div",{style:Object.assign({position:"fixed",height:540,top:"100%",left:0,width:"100%",backgroundColor:"white",padding:"8px 24px",zIndex:m.c+9,borderRadius:12,boxShadow:"0px 0px 1px 0px #0000000A, 0px 4px 8px 0px #0000000A, 0px 16px 24px 0px #0000000A, 0px 24px 32px 0px #0000000A",overflow:"auto"},E)},L))))}let SelectCountryItem=({option:e,onSelect:t,selected:a,trackingFn:o})=>{let i=(0,n.useMemo)(()=>
8{if(!e.value)return"";let t=(0,N.getCountryCallingCode)(e.value);return t?`+${t}`:""},[e.value]),r=V.Ay[e.value],d=(null==o?void 0:o(e))||{};return l().createElement(y.Stack,Object.assign({sx:{padding:"0 24px",backgroundColor:a?"#e3f2ff":"transparent",":hover":{backgroundColor:"#F7F9FA"},cursor:"pointer",marginLeft:-24,marginRight:-24},justify:"center",onClick:()=>t(e)},d),l().createElement(y.Group,{position:"apart",sx:{height:50,borderBottom:"1px solid #E4E8EC"},align:"center"},l().createElement(y.Group,{spacing:12},l().createElement(r,{"aria-hidden":!0,label:e.label,style:{width:24,height:16,borderRadius:2}}),l().createElement(_.T,{size:"p4"},e.label)),l().createElement(_.T,{size:"p4"},i)))};function DefaultArrowComponent(){return l().createElement("div",{style:{display:"flex",alignItems:"center",justifyContent:"center",width:16,height:16}},l().createElement(W.A,{size:7,color:"#8C8C8C"}))}CountrySelectWithIcon.propTypes={iconComponent:eE.elementType,arrowComponent:eE.elementType,unicodeFlags:eE.bool};let e_=(0,n.forwardRef)((e,t)=>{let{isError:i,defaultCountry:d,countryCallingCodeEditable:s=!1,defaultValue:c,value:u,onChange:p,className:v,trackingFn:m}=e,g=(0,o.a)(e,["isError","defaultCountry","countryCallingCodeEditable","defaultValue","value","onChange","className","trackingFn"]),[h,f]=(0,n.useState)(c||u),[y,S]=(0,n.useState)(null);return((0,n.useEffect)(()=>{f(u)},[u]),(0,n.useEffect)(()=>{(0,o._)(void 0,void 0,void 0,function*(){let e=yield Promise.resolve().then(a.bind(a,"A9bs"));S(e)})},[]),y)?l().createElement(y.default,Object.assign({ref:t,value:h,onChange:e=>{f(e),null==p||p(e)},defaultCountry:d,countryCallingCodeEditable:s,className:B()(r.s.phoneInput,{isError:i,[r.s.error]:i},v),countrySelectComponent:CountrySelectWithIcon,countrySelectProps:{trackingFn:m}},g)):null}),eC=(0,D.A)(e_)`
9  position: relative;
10  .PhoneInputCountry {
11    background: unset;
12    border: none;
13    position: absolute;
14    left: 0;
15    top: 0;
16    height: 100%;
17    padding-right: 0;
18    min-width: 100px;
19    .PhoneInputCountryIcon {
20      min-width: 70px;
21      .PhoneInputCountryIconImg {
22        margin: auto;
23      }
24    }
25  }
26  .PhoneInputInput {
27    border-radius: 8px;
28    border-left-width: 1px;
29    line-height: 46px;
30    padding-left: 105px;
31  }
32`,WhatsApp=({size:e=20})=>l().createElement("svg",{width:19*e/18,height:e,viewBox:"0 0 19 18",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M9.92578 1.07422C5.78895 1.07422 2.42578 4.43738 2.42578 8.57422C2.42578 10.0305 2.83992 11.4277 3.62269 12.6382L2.48494 15.1458C2.38027 15.3779 2.41668 15.6464 2.58506 15.8421C2.71249 15.9923 2.89453 16.0742 3.08112 16.0742C3.14028 16.0742 3.19489 16.0651 3.25406 16.0515L6.39423 15.1913C7.47736 15.7693 8.69247 16.0742 9.92578 16.0742C14.0626 16.0742 17.4258 12.711 17.4258 8.57422C17.4258 4.44193 14.0626 1.07422 9.92578 1.07422ZM9.92578 14.7635C8.82899 14.7635 7.75497 14.4723 6.80836 13.9216C6.70824 13.8624 6.59447 13.8306 6.47614 13.8306C6.41698 13.8306 6.35782 13.8397 6.30321 13.8533L4.25072 14.4177L4.96522 12.843C5.06079 12.6291 5.03804 12.3788 4.90151 12.1877C4.13695 11.1273 3.73191 9.88035 3.73191 8.56967C3.73191 5.15644 6.508 2.38035 9.92123 2.38035C13.3345 2.38035 16.1105 5.15644 16.1105 8.56967C16.1151 11.9874 13.339 14.7635 9.92578 14.7635Z",fill:"currentColor"}),l().createElement("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M12.8115 9.69834C12.4975 9.51175 12.0879 9.30241 11.7193 9.4526C11.4371 9.57092 11.2551 10.0124 11.0685 10.2399C10.9729 10.3582 10.8637 10.3764 10.7181 10.3173C9.65315 9.89404 8.83397 9.17954 8.2469 8.20108C8.14678 8.0509 8.16498 7.92802 8.2833 7.78694C8.46079 7.57759 8.68379 7.34095 8.73385 7.05879C8.78391 6.77663 8.65193 6.44896 8.53361 6.19865C8.38343 5.88009 8.21959 5.42043 7.89647 5.2384C7.60066 5.07001 7.21383 5.16558 6.94987 5.37948C6.49477 5.74811 6.27633 6.33063 6.28543 6.90405C6.28543 7.06788 6.30818 7.23172 6.34459 7.38645C6.43561 7.76418 6.6131 8.11916 6.80879 8.45593C6.95897 8.71079 7.11826 8.95654 7.29119 9.19319C7.86006 9.96685 8.57002 10.6404 9.38919 11.141C9.79878 11.3913 10.2402 11.6143 10.6999 11.7645C11.2141 11.9329 11.6692 12.1104 12.2244 12.0057C12.8024 11.8965 13.3758 11.5369 13.6079 10.9772C13.6762 10.8133 13.7081 10.6267 13.6717 10.4538C13.5897 10.0897 13.1028 9.87128 12.8115 9.69834Z",fill:"currentColor"})),Zalo=({size:e=20,useCurrentColor:t=!1})=>{let a=t?"currentColor":"#0068FF";return l().createElement("svg",{width:21*e/20,height:e,viewBox:"0 0 21 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l().createElement("path",{d:"M13.7007 6.55306C13.9781 6.55306 14.2555 6.55306 14.5336 6.55306C14.529 8.17796 14.529 9.8035 14.5336 11.4284C14.262 11.3903 13.81 11.5642 13.7079 11.2027C13.691 9.65349 13.7066 8.10296 13.7007 6.55306Z",fill:a}),l().createElement("path",{d:"M5.21482 6.61061C6.50542 6.60932 7.79474 6.60091 9.0847 6.60996C9.07564 6.86278 9.06142 7.13823 8.89201 7.34256C8.01005 8.44048 7.14685 9.55262 6.26554 10.6505C7.20245 10.6564 8.13937 10.6525 9.07629 10.6525C9.05883 10.8717 9.13578 11.1271 8.99353 11.3172C8.9043 11.44 8.74265 11.429 8.6088 11.4303C7.43652 11.4239 6.26424 11.4362 5.09261 11.4239C5.09584 11.1762 5.09843 10.9021 5.27172 10.7049C6.14333 9.61146 7.02529 8.52583 7.89302 7.42985C7.00136 7.43114 6.10906 7.42403 5.2174 7.43373C5.21159 7.15957 5.21352 6.88477 5.21482 6.61061Z",fill:a}),l().createElement("path",{d:"M16.5981 7.68655C17.5267 7.47899 18.5341 8.08873 18.7882 9.00302C19.1069 9.95416 18.525 11.0851 17.5635 11.3747C16.7469 11.6625 15.7692 11.2868 15.3457 10.5342C15.0133 9.97809 14.9933 9.25002 15.2953 8.67778C15.5513 8.17279 16.046 7.80358 16.5981 7.68655ZM16.5826 8.51031C16.0162 8.71011 15.711 9.39938 15.9322 9.9561C16.1151 10.4824 16.7313 10.8044 17.2667 10.6428C17.8778 10.4967 18.247 9.78087 18.0304 9.19441C17.8493 8.61377 17.1478 8.27883 16.5826 8.51031Z",fill:a}),l().createElement("path",{d:"M9.71965 8.36353C10.1665 7.81005 10.9488 7.53718 11.6381 7.73439C11.8657 7.79194 12.072 7.90574 12.2711 8.02666C12.2692 7.96588 12.2647 7.84496 12.2627 7.78418C12.5233 7.78289 12.7832 7.78354 13.0438 7.78224C13.0425 8.99784 13.0412 10.2134 13.0445 11.4297C12.8531 11.4245 12.6584 11.4472 12.4703 11.4084C12.3384 11.3547 12.2976 11.2105 12.2453 11.0928C11.5262 11.6515 10.3966 11.5247 9.79919 10.8445C9.16229 10.1856 9.12931 9.06315 9.71965 8.36353ZM10.7723 8.52648C10.1736 8.73727 9.88324 9.50865 10.1865 10.0647C10.4451 10.6066 11.1732 10.8342 11.6937 10.5355C12.1767 10.282 12.3998 9.65285 12.1922 9.14979C11.9911 8.60277 11.3129 8.29629 10.7723 8.52648Z",fill:a}),l().createElement("path",{d:"M4.20742 0.101327C4.89217 -0.00665471 5.58855 -0.00730131 6.28041 0.008217L6.22092 0.0631777C5.31569 0.656106 4.56499 1.47017 4.02249 2.4045C2.93492 4.27511 2.53856 6.48711 2.62843 8.63123C2.71766 10.377 3.13666 12.1325 4.02508 13.6501C4.1738 13.9217 4.42144 14.1616 4.42532 14.4913C4.45313 15.1987 4.10332 15.8653 3.63001 16.371C3.66105 16.4033 3.69144 16.4356 3.72247 16.468C4.16539 16.9516 4.63805 17.4062 5.08809 17.8834C5.72757 18.6063 6.45628 19.2464 7.
3208283 19.9822C6.04052 19.9977 4.98592 20.0462 3.9559 19.8516C2.65947 19.6001 1.50853 18.7013 0.958922 17.4999C0.625925 16.8055 0.526349 16.0289 0.500485 15.2679C0.499838 11.7543 0.499838 8.24133 0.500485 4.72837C0.51471 3.55415 0.825723 2.32562 1.65207 1.45465C2.30643 0.716886 3.233 0.237112 4.20742 0.101327Z",fill:a}),l().createElement("path",{d:"M6.22092 0.0631777C6.36576 0.0217955 6.51706 0.0088636 6.66707 0.00433743C9.25281 0.0140364 11.8386 0.00304423 14.4243 0.00757041C15.1155 0.0159762 15.8106 -0.0305788 16.4966 0.0748164C17.4465 0.147235 18.3608 0.549418 19.0675 1.18502C19.9546 2.03271 20.4279 3.25348 20.4428 4.47102C20.4435 7.89863 20.4415 11.3288 20.4447 14.7551C20.4357 14.7752 20.4182 14.8166 20.4092 14.8373C19.4878 15.8679 18.2489 16.5656 16.9538 17.0169C15.2086 17.6118 13.3393 17.8032 11.5049 17.6635C9.67051 17.5058 7.8219 17.0266 6.26618 16.0128C5.47087 16.3665 4.59344 16.5397 3.72247 16.468C3.69144 16.4356 3.66105 16.4033 3.63001 16.371C4.10332 15.8653 4.45313 15.1987 4.42532 14.4913C4.42144 14.1616 4.1738 13.9217 4.02508 13.6501C3.13666 12.1325 2.71766 10.377 2.62843 8.63123C2.53856 6.48711 2.93492 4.27511 4.02249 2.4045C4.56499 1.47017 5.31569 0.656106 6.22092 0.0631777ZM13.7007 6.55306C13.7066 8.10296 13.691 9.65349 13.7079 11.2027C13.81 11.5642 14.262 11.3903 14.5336 11.4284C14.529 9.8035 14.529 8.17796 14.5336 6.55306C14.2555 6.55306 13.9781 6.55306 13.7007 6.55306ZM5.21482 6.61061C5.21352 6.88477 5.21159 7.15957 5.2174 7.43373C6.10906 7.42403 7.00136 7.43114 7.89302 7.42985C7.02529 8.52583 6.14333 9.61146 5.27172 10.7049C5.09843 10.9021 5.09584 11.1762 5.09261 11.4239C6.26424 11.4362 7.43652 11.4239 8.6088 11.4303C8.74265 11.429 8.9043 11.44 8.99353 11.3172C9.13578 11.1271 9.05883 10.8717 9.07629 10.6525C8.13937 10.6525 7.20245 10.6564 6.26554 10.6505C7.14685 9.55262 8.01005 8.44048 8.89201 7.34256C9.06142 7.13823 9.07564 6.86278 9.0847 6.60996C7.79474 6.60091 6.50542 6.60932 5.21482 6.61061ZM16.5981 7.68655C16.046 7.80358 15.5513 8.17279 15.2953 8.67778C14.9933 9.25002 15.0133 9.97809 15.3457 10.5342C15.7692 11.2868 16.7469 11.6625 17.5635 11.3747C18.525 11.0851 19.1069 9.95416 18.7882 9.00302C18.5341 8.08873 17.5267 7.47899 16.5981 7.68655ZM9.71965 8.36353C9.12931 9.06315 9.16229 10.1856 9.79919 10.8445C10.3966 11.5247 11.5262 11.6515 12.2453 11.0928C12.2976 11.2105 12.3384 11.3547 12.4703 11.4084C12.6584 11.4472 12.8531 11.4245 13.0445 11.4297C13.0412 10.2134 13.0425 8.99784 13.0438 7.78224C12.7832 7.78354 12.5233 7.78289 12.2627 7.78418C12.2647 7.84496 12.2692 7.96588 12.2711 8.02666C12.072 7.90574 11.8657 7.79194 11.6381 7.73439C10.9488 7.53718 10.1665 7.81005 9.71965 8.36353Z",fill:"white"}),l().createElement("path",{d:"M10.7737 8.52648C11.3142 8.29629 11.9925 8.60278 12.1936 9.1498C12.4012 9.65285 12.1781 10.282 11.6951 10.5355C11.1746 10.8342 10.4465 10.6066 10.1879 10.0647C9.8846 9.50866 10.1749 8.73727 10.7737 8.52648Z",fill:"white"}),l().createElement("path",{d:"M16.5822 8.51048C17.1473 8.279 17.8489 8.61394 18.0299 9.19458C18.2465 9.78104 17.8773 10.4968 17.2663 10.643C16.7309 10.8046 16.1147 10.4826 15.9317 9.95627C15.7106 9.39955 16.0158 8.71028 16.5822 8.51048Z",fill:"white"}),l().createElement("path",{d:"M20.4094 14.8378L20.4604 14.7822C20.487 15.7929 20.3777 16.8475 19.8817 17.7469C19.305 18.8021 18.2588 19.5858 17.082 19.8367C16.4218 19.9731 15.7448 20.0035 15.0724 19.9951C13.0039 19.9957 10.9354 19.9951 8.86698 19.9957C8.27211 19.986 7.67595 20.0138 7.08302 19.9828C6.45646 19.247 5.72775 18.6068 5.08827 17.8839C4.63824 17.4068 4.16557 16.9522 3.72266 16.4685C4.59362 16.5403 5.47105 16.367 6.26637 16.0133C7.82208 17.0272 9.67069 17.5063 11.5051 17.6641C13.3395 17.8038 15.2088 17.6124 16.954 17.0175C18.2491 16.5662 19.488 15.8685 20.4094 14.8378Z",fill:a}))},SSOFirstScreen=({hidden:e,config:t})=>{let[a,i]=l().useState(""),[s,c]=l().useState(""),[u,p]=l().useState(""),{locale:m,onClose:g,setTracking:f}=useSSOState(),{addStep:S,goNext:b}=(0,T.a)(),{setUserInfo:P,abTestFlow:O,isHaveReadAndAgreePolicy:x,setIsHaveReadAndAgreePolicy:k,setIsGetUpdateFromHHG:I}=(0,T.u)(),[D,R]=l().useState("login"),{legalTextType:B}=t||{},{t:W}=(0,C.u)(),{getGRecaptchaToken:L,renderRecaptchaHandler:M}=useGRecaptchaHandler(),U="B"===O?"Sign Up":"Sign In or Sign Up",G=`SSO - ${"login"===D?"Sign In":"Sign Up"}_Phone_Adoption_Test_${O}`;(0,n.useEffect)(()=>{e||(c(""),f({category:G,action:U}))},[e]);let[N,V]=l().useState(!1),handleLoginBySocial=(e,t)=>(0,o._)(void 0,void 0,void 0,function*(){let a=yield loginBySocial(e,t);if((null==a?void 0:a._status)===1){(0,d.h)(null==a?void 0:a._data);let e=yield(0,d.g)();if(P(null==e?void 0:e._data),(null==e?void 0:e._status)===1&&e._data){T.u.setState({flowData:{method:t}});let a=!e._data.phone||!e._data.phone_verified_at;a&&"B"!==O?(T.u.setState(t=>{var a;return{flowData:Object.assign(Object.assign({},t.flowData),{flow:(null===(a=null==e?void 0:e._data)||void 0===a?void 0:a.first_time_login)?"signup":"login",isVerifyPhone:!0})}}),S({type:T.S.VERIFY_PHONE,config:{provider:t}}),b()):(0,T.i)(e._data)?null==g||g(!0):(T.u.setState(t=>{var a;return{flowData:Object.assign(Object.assign({},t.flowData),{flow:(null===(a=null==e?void 0:e._data)||void 0===a?void 0:a.first_time_login)?"signup":"login"})}}),"facebook"===t?window.FB.api("/me",{fields:"name, email, gender, birthday"},function(t){S({type:T.S.SETUP_FULL,config:{userInfo:e._data,setupDefaultData:{name:t.name,email:t.email,gender:t.gender,birthday:t.birthday}}}),b()}):(S({type:T.S.SETUP_FULL,config:{userInfo:e._data}}),b()))}else c(getErrorTextFromCode(W,null==e?void 0:e.code))}else c(getErrorTextFromCode(W,null==a?void 0:a.code))});(0,n.useEffect)(()=>{var e;if(!document.getElementById("hhg-google-auth-script")&&!(null===(e=window.google)||void 0===e?void 0:e.accounts)){let e=document.createElement("script");e.src="https://accounts.google.com/gsi/client",e.async=!0,e.id="hhg-google-auth-script",document.body.appendChild(e)}if(!document.getElementById("hhg-fb-sdk-script")&&!window.FB){let e=document.createElement("script");e.src="https://connect.facebook.net/en_US/sdk.js",e.async=!0,e.id="hhg-fb-sdk-script",document.body.appendChild(e)}
32window.fbAsyncInit=function(){window.FB.init({appId:d.F,cookie:!0,xfbml:!0,version:"v20.0"})}},[]);let scrollToError=()=>{requestAnimationFrame(()=>{var e,t;null===(t=null===(e=document.querySelector(".sso-has-error"))||void 0===e?void 0:e.scrollIntoView)||void 0===t||t.call(e,{behavior:"smooth",block:"end",inline:"nearest"})})},onClickContinueZalo=()=>(0,o._)(void 0,void 0,void 0,function*(){var e,t;V(!0);let{areaCode:o,phoneNumber:n}=(0,T.s)(a);if(!o||!n||!a)return c(W("ssov2.validate.phone.required")),V(!1);let l=yield(0,d.c)({phone:n});if((null==l?void 0:l._status)===1){let i=null===(e=l._data)||void 0===e?void 0:e.provider;if(null===(t=l._data)||void 0===t?void 0:t.is_pass)T.u.setState({flowData:{method:"zalo",flow:"login",metaData:l._data}}),S({type:T.S.PASSWORD,config:{phone:a,method:"zalo"}}),b();else{let e;if((null==(e=i?yield resendZaloOTP(n,o):yield registerBySendZaloOTP(n,o))?void 0:e._status)!==1)return c(getErrorTextFromCode(W,null==e?void 0:e.code)),V(!1);T.u.setState({flowData:{method:"zalo",flow:"signup",metaData:l._data}}),S({type:T.S.OTP,config:{phone:a,otpType:"phone-zalo",afterAction:"forgot"}}),b()}}else c(getErrorTextFromCode(W,null==l?void 0:l.code));V(!1)}),onClickEmail=()=>{T.u.setState({flowData:{method:"email",flow:"login"===D?"login":"signup"}}),S({type:T.S.EMAIL}),b()},onTriggerGoogleLogin=()=>{let e=window.google.accounts.oauth2.initTokenClient({client_id:d.G,scope:"https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile openid",ux_mode:"popup",callback:e=>(0,o._)(void 0,void 0,void 0,function*(){e.access_token&&(yield handleLoginBySocial(e.access_token,"google"))}),error_callback:()=>{}});null==e||e.requestAccessToken()},onTriggerFacebookLogin=()=>{window.FB.login(function(e){var t;return(0,o._)(this,void 0,void 0,function*(){(null===(t=null==e?void 0:e.authResponse)||void 0===t?void 0:t.accessToken)&&(yield handleLoginBySocial(e.authResponse.accessToken,"facebook"))})},{scope:"public_profile,email,user_gender,user_birthday"})};return((0,n.useEffect)(()=>{F.i?k(!1):k(!0),I(!1)},[]),"B"===O)?l().createElement(FirstBFlow,{hidden:e,activeTab:D,legalTextType:B,trackingAction:U,trackingCategory:G,onTriggerGoogleLogin:onTriggerGoogleLogin,onTriggerFacebookLogin:onTriggerFacebookLogin,onClickEmail:onClickEmail}):l().createElement("div",{style:{display:e?"none":"flex",flexDirection:"column",height:"100%"}},l().createElement(y.Stack,{spacing:12},l().createElement(y.Group,{spacing:24},l().createElement(_.T,{size:"s1",weight:"semiBold",color:"login"===D?"gray.8":"gray.4",onClick:()=>R("login"),style:{borderBottom:"login"===D?"2px solid #000":void 0,cursor:"pointer"},"data-event-category":G,"data-event-action":U,"data-event-label":"Log In"},W("ssov2.first.title.login")),l().createElement(_.T,{size:"s1",weight:"semiBold",color:"signup"===D?"gray.8":"gray.4",onClick:()=>R("signup"),style:{borderBottom:"signup"===D?"2px solid #000":void 0,cursor:"pointer"},"data-event-category":G,"data-event-action":U,"data-event-label":"Sign Up"},W("ssov2.first.title.signup"))),l().createElement(_.T,{size:"p4"},W("ssov2.first.description"))),l().createElement(y.Stack,{mt:24,spacing:24},l().createElement(y.Stack,{spacing:16},l().createElement("form",{onSubmit:e=>{e.preventDefault(),onClickContinueZalo()},"data-testid":"screen-first-form"},l().createElement(r.I.Wrapper,{error:s},l().createElement(eC,{defaultCountry:m&&j.M[m]||"VN",value:a,onChange:e=>i(e),isError:!!s,required:!0,name:"phone",disabled:N,"data-event-category":G,"data-event-action":U,"data-event-label":"Enter Phone",trackingFn:(0,n.useCallback)(e=>{if(null==e?void 0:e.label)return{"data-event-action":"Country Selection","data-event-label":e.label,"data-event-category":"signup"===D?"SSO - Sign Up":"SSO - Sign In"}},[D])}))),l().createElement(h.B,{size:"lg",variant:"primary",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){var e,t;V(!0);let{areaCode:o,phoneNumber:n}=(0,T.s)(a);if(!o||!n||!a)return c(W("ssov2.validate.phone.required")),V(!1);let l=yield(0,d.c)({phone:n});if((null==l?void 0:l._status)===1){if(!l._data||!(null===(e=l._data)||void 0===e?void 0:e.is_pass))return(0,E.s)({message:W("ssov2.first.noAccountOrPass"),type:"danger"}),R("signup"),V(!1);(null===(t=l._data)||void 0===t?void 0:t.is_pass)&&(T.u.setState({flowData:{method:"phone",flow:"login",metaData:l._data}}),S({type:T.S.PASSWORD,config:{phone:a,method:"phone"}}),b())}else c(getErrorTextFromCode(W,null==l?void 0:l.code));V(!1)}),loading:N,disabled:N,"data-event-category":G,"data-event-action":U,"data-event-label":"Continue Login",display:"login"===D?"block":"none"}
32,W("ssov2.button.continue")),F.a&&l().createElement(h.B,{size:"lg",variant:"primary",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){var e,t;V(!0);let{areaCode:o,phoneNumber:n}=(0,T.s)(a);if(!o||!n||!a||!x)return x||p("REQUIRED"),o&&n&&a||c(W("ssov2.validate.phone.required")),scrollToError(),V(!1);let l=yield(0,d.c)({phone:n});if((null==l?void 0:l._status)===1){let i=null===(e=l._data)||void 0===e?void 0:e.provider;if(null===(t=l._data)||void 0===t?void 0:t.is_pass)T.u.setState({flowData:{method:"whatsapp",flow:"login",metaData:l._data}}),S({type:T.S.PASSWORD,config:{phone:a,method:"whatsapp"}}),b();else{let e;if((null==(e=i?yield resendWhatsAppOTP(n,o):yield registerBySendWhatsAppOTP(n,o))?void 0:e._status)!==1)return c(getErrorTextFromCode(W,null==e?void 0:e.code)),V(!1);T.u.setState({flowData:{method:"whatsapp",flow:"signup",metaData:l._data}}),S({type:T.S.OTP,config:{phone:a,otpType:"phone-whatsapp",afterAction:"forgot"}}),b()}}else c(getErrorTextFromCode(W,null==l?void 0:l.code));V(!1)}),loading:N,disabled:N,"data-event-category":G,"data-event-action":U,"data-event-label":"Continue with WhatsApp",display:"signup"===D?"block":"none",leftIcon:l().createElement(WhatsApp,null),color:"#00B16A"},W("ssov2.button.otp.whatsapp")),F.b&&l().createElement(h.B,{size:"lg",variant:"primary",onClick:onClickContinueZalo,loading:N,disabled:N,"data-event-category":G,"data-event-action":U,"data-event-label":"Continue with Zalo",display:"signup"===D?"block":"none",leftIcon:l().createElement(Zalo,null)},W("ssov2.button.otp.zalo")),F.c&&l().createElement(l().Fragment,null,l().createElement(h.B,{size:"sm",variant:"white",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){var e,t;V(!0);let{areaCode:o,phoneNumber:n}=(0,T.s)(a);if(!o||!n||!a||!x)return x||p("REQUIRED"),o&&n&&a||c(W("ssov2.validate.phone.required")),V(!1);let l=yield(0,d.c)({phone:n});if((null==l?void 0:l._status)===1){let i=null===(e=l._data)||void 0===e?void 0:e.provider;if(null===(t=l._data)||void 0===t?void 0:t.is_pass)T.u.setState({flowData:{method:"sms",flow:"login",metaData:l._data}}),S({type:T.S.PASSWORD,config:{phone:a,method:"sms"}}),b();else{let e;if(i){let t=yield L();e=yield resendPhoneOTP(n,o,t||"")}else e=yield registerBySendPhoneOTP(n,o);if((null==e?void 0:e._status)!==1)return c(getErrorTextFromCode(W,null==e?void 0:e.code)),V(!1);T.u.setState({flowData:{method:"sms",flow:"signup",metaData:l._data}}),S({type:T.S.OTP,config:{phone:a,otpType:"phone-sms",afterAction:"forgot"}}),b()}}else c(getErrorTextFromCode(W,null==l?void 0:l.code));V(!1)}),loading:N,disabled:N,"data-event-category":G,"data-event-action":U,"data-event-label":"Continue with SMS",display:"signup"===D?"block":"none",style:{fontWeight:400},color:"#595959",leftIcon:l().createElement(v.A,{size:18})},W("ssov2.button.otp.sms")),M())),l().createElement(y.Divider,{color:"#E4E8EC",display:"signup"===D?"block":"none"}),l().createElement(y.Stack,{spacing:16,align:"center"},l().createElement(_.T,{size:"p4",color:"gray.4"},W("ssov2.orContinueWith")),l().createElement(y.Group,{spacing:8,style:{width:"100%"}},l().createElement(h.B,{variant:"white",style:{flex:1,height:48,padding:12,background:"#F7F9FC",borderRadius:8},onClick:onTriggerGoogleLogin,"data-event-category":G,"data-event-action":U,"data-event-label":"Continue with Google"},l().createElement(w.G,{style:{width:20,height:20,marginRight:4,borderRadius:"100%"}})," ",l().createElement(_.T,{size:"p4",color:"black",weight:"regular"},"Google")),l().createElement(h.B,{variant:"white",style:{flex:1,height:48,padding:12,background:"#F7F9FC",borderRadius:8},onClick:onTriggerFacebookLogin,"data-event-category":G,"data-event-action":U,"data-event-label":"Continue with Facebook"},l().createElement(w.F,{style:{width:20,height:20,marginRight:4,borderRadius:"100%"}})," ",l().createElement(_.T,{size:"p4",color:"black",weight:"regular"},"Facebook")),l().createElement(h.B,{variant:"white",style:{flex:1,height:48,padding:12,background:"#F7F9FC",borderRadius:8},onClick:onClickEmail,"data-event-category":G,"data-event-action":U,"data-event-label":"Continue with Email"},l().createElement(MailIcon,{style:{marginRight:4}})," ",l().createElement(_.T,{size:"p4",color:"black",weight:"regular"},"Email"))))),l().createElement(PolicyContent,{legalTextType:B,trackingAction:U,trackingCategory:G,activeTab:D,errMsgPolicy:u}))},initSendUpdateEmailOtp=e=>(0,o._)(void 0,void 0,void 0,function*(){let t=new FormData;return t.append("email",e),(0,d.f)(d.S.ECOM_CARE.SEND_OTP,{method:"POST",body:t})}),resendUpdateEmailOTP=()=>(0,o._)(void 0,void 0,void 0,function*(){return(0,d.f)(d.S.ECOM_CARE.RESEND_OTP,{method:"GET"})}),verifyUpdateEmailOTP=e=>(0,o._)(void 0,void 0,void 0,function*(){let t=new FormData;return t.append("code",e),(0,d.f)(d.S.ECOM_CARE.VERIFY_OTP,{method:"POST",body:t})}),SSOOTPScreen=({hidden:e,index:t,config:a})=>{let{t:i}=(0,C.u)(),{onClose:s,setTracking:c}=useSSOState(),{setSteps:u,steps:p}=(0,T.a)(),{flowData:m,userInfo:g,abTestFlow:f}=(0,T.u)(),[S,E]=l().useState(!1),[b,P]=l().useState(""),[O,w]=l().useState(""),x=l().useRef(null),k=l().useRef(null),{getGRecaptchaToken:I,renderRecaptchaHandler:D}=useGRecaptchaHandler(),{phone:R,email:B,otpType:W,isUpdatePhone:L,afterAction:M,setupData:U}=a,G="email"===W||"update-email"===W,N="phone-zalo"===W,V="phone-sms"===W,H="phone-whatsapp"===W,j=null==m?void 0:m.method,q=g&&!g.first_time_login?`SSO - Existing User via ${j}_Phone_Adoption_Test_${f}`:isVerifyPhoneInTheSignUp(p,m)?`SSO - Sign Up via ${j}_Phone_Adoption_Test_${f}`:`SSO - Sign In via ${j}_Phone_Adoption_Test_${f}
32`,Y=G?"Verify Your Email":`Verify Phone Number via ${N?"Zalo":V?"SMS":H?"WhatsApp":""}`;(0,n.useEffect)(()=>{e||(w(""),c({category:q,action:Y}))},[e]);let addStepAndGoNext=e=>{T.a.setState(a=>{let o=a.steps;return{steps:o.slice(0,t).concat(e),currentStepIndex:t}})},sendOTPCode=e=>(0,o._)(void 0,void 0,void 0,function*(){if(!e||!($>0)){E(!0);try{let e;let{areaCode:t,phoneNumber:a}=(0,T.s)(R);if(L)"phone-sms"===W?e=yield resendUpdatePhoneOTP(a,t):"phone-zalo"===W?e=yield resendUpdatePhoneZaloOTP(a,t):"phone-whatsapp"===W&&(e=yield resendUpdatePhoneWhatsAppOTP(a,t));else if("phone-sms"===W){let o=yield I();e=yield resendPhoneOTP(a,t,o||"")}else"phone-zalo"===W?e=yield resendZaloOTP(a,t):"phone-whatsapp"===W?e=yield resendWhatsAppOTP(a,t):"email"===W?e=yield resendEmailOTP(B):"update-email"===W&&(e=yield resendUpdateEmailOTP());if((null==e?void 0:e._status)!==1)return w(getErrorTextFromCode(i,null==e?void 0:e.code)),E(!1);setupResendTimer()}catch(e){console.error(e),w(getErrorTextFromCode(i,""))}E(!1)}}),submitOtp=e=>(0,o._)(void 0,void 0,void 0,function*(){var t,a,o;if(!e||e.length<6){w(i("ssov2.validate.otp.required"));return}E(!0);try{let n;let{areaCode:l,phoneNumber:r}=(0,T.s)(R);if(L){let a;if("phone-sms"===W?a=yield verifyUpdatePhoneOTP(l,e):"phone-zalo"===W?a=yield verifyUpdatePhoneZaloOTP(r,l,e):"phone-whatsapp"===W&&(a=yield verifyUpdatePhoneWhatsAppOTP(r,l,e)),(null==a?void 0:a._status)===1){if("setup"===M){let e=yield(0,d.g)();if((null==e?void 0:e._status)!==1)return w(getErrorTextFromCode(i,null==e?void 0:e.code)),E(!1);let a=(null===(t=null==e?void 0:e._data)||void 0===t?void 0:t.id)&&e._data.phone&&e._data.phone_verified_at&&e._data.email&&!e._data.email.includes("@hhg.com")&&!e._data.email.includes("@facebook.com")&&e._data.name&&e._data.birthday&&("number"==typeof e._data.gender||"string"==typeof e._data.gender);if(a){let t=("email"===m.method||"zalo"===m.method||"sms"===m.method||"whatsapp"===m.method||"phone"===m.method||(null==e?void 0:e._data.provider)==="email"||(null==e?void 0:e._data.provider)==="phone")&&!(null==e?void 0:e._data.is_pass);if(t)return addStepAndGoNext({type:T.S.FORGOT_PASSWORD_SETUP,config:{email:B,phone:R}}),E(!1);return null==s||s(!0),E(!1)}addStepAndGoNext({type:T.S.SETUP_FULL,config:{phone:R,userInfo:null==e?void 0:e._data}})}else if("submitSetup"===M){let e=yield(0,d.u)(Object.assign(Object.assign({},U),{validate:""}));(null==e?void 0:e._status)===1?((0,d.h)(null==e?void 0:e._data),null==s||s(!0)):w(getErrorTextFromCode(i,null==e?void 0:e.code))}else"update-email"===M?addStepAndGoNext({type:T.S.UPDATE_EMAIL}):null==s||s(!0)}else w(getErrorTextFromCode(i,null==a?void 0:a.code));return E(!1)}if("phone-sms"===W?n=yield verifyByPhoneOTP(r,l,e):"phone-zalo"===W?n=yield verifyByZaloOTP(r,l,e):"phone-whatsapp"===W?n=yield verifyByWhatsAppOTP(r,l,e):"email"===W?n=yield verifyByEmailOTP(B,e):"update-email"===W&&(n=yield verifyUpdateEmailOTP(e)),(null==n?void 0:n._status)!==1)return P(""),null===(a=k.current)||void 0===a||a.focus(),w(getErrorTextFromCode(i,null==n?void 0:n.code)),E(!1);if((0,d.h)(null==n?void 0:n._data),"forgot"===M)addStepAndGoNext({type:T.S.FORGOT_PASSWORD_SETUP,config:{provider:N?"Zalo":V?"SMS":H?"WhatsApp":G?"Email":""}});else if("setup"===M){let e=yield(0,d.g)();if((null==e?void 0:e._status)!==1)return w(getErrorTextFromCode(i,null==e?void 0:e.code)),E(!1);let t=(null===(o=null==e?void 0:e._data)||void 0===o?void 0:o.id)&&e._data.phone&&e._data.phone_verified_at&&e._data.email&&!e._data.email.includes("@hhg.com")&&!e._data.email.includes("@facebook.com")&&e._data.name&&e._data.birthday&&("number"==typeof e._data.gender||"string"==typeof e._data.gender);if(t){let t=("email"===m.method||"zalo"===m.method||"sms"===m.method||"whatsapp"===m.method||"phone"===m.method||(null==e?void 0:e._data.provider)==="email"||(null==e?void 0:e._data.provider)==="phone")&&!(null==e?void 0:e._data.is_pass);if(t)return addStepAndGoNext({type:T.S.FORGOT_PASSWORD_SETUP,config:{email:B,phone:R}}),E(!1);return null==s||s(!0),E(!1)}addStepAndGoNext({type:T.S.SETUP_FULL,config:{phone:R,userInfo:null==e?void 0:e._data}})}else"update-email"===M?addStepAndGoNext({type:T.S.UPDATE_EMAIL,config:{email:B}}):null==s||s(!0)}catch(e){console.error(e),w(getErrorTextFromCode(i,""))}E(!1)}),swapAnotherMethod=e=>(0,o._)(void 0,void 0,void 0,function*(){if(!G){E(!0);try{let a;let{areaCode:o,phoneNumber:n}=(0,T.s)(R);if(L)"phone-sms"===e?a=yield resendUpdatePhoneOTP(n,o):"phone-zalo"===e?a=yield resendUpdatePhoneZaloOTP(n,o):"phone-whatsapp"===e&&(a=yield resendUpdatePhoneWhatsAppOTP(n,o));else if("phone-sms"===e){let e=yield I();a=yield resendPhoneOTP(n,o,e||"")}else"phone-zalo"===e?a=yield resendZaloOTP(n,o):"phone-whatsapp"===e&&(a=yield resendWhatsAppOTP(n,o));if((null==a?void 0:a._status)!==1)return w(getErrorTextFromCode(i,null==a?void 0:a.code)),E(!1);
32u(a=>a.map((a,o)=>o===t?Object.assign(Object.assign({},a),{config:Object.assign(Object.assign({},a.config),{otpType:e})}):a))}catch(e){console.error(e),w(getErrorTextFromCode(i,""))}E(!1)}}),[$,Z]=l().useState(30),setupResendTimer=()=>{Z(30);let countdown=()=>{Z(e=>{if(e<=0)return 0;let t=e-1;return t>0&&setTimeout(()=>countdown(),1e3),t})};countdown()};return(0,n.useEffect)(()=>{setupResendTimer()},[]),l().createElement("form",{style:{display:e?"none":"block"},onSubmit:e=>{e.preventDefault(),submitOtp(String(b))}},D(),l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},G?i("ssov2.otp.email.title"):i("ssov2.otp.phone.title")),l().createElement(_.T,{size:"p4",sx:{b:{fontWeight:"bold"}}},l().createElement("span",{dangerouslySetInnerHTML:{__html:i(G?"ssov2.otp.email.description":"ssov2.otp.phone.description",{email:B,phone:R,method:V?"SMS":N?"Zalo":H?"WhatsApp":""})}}))),l().createElement(y.Stack,{mt:24,spacing:8},l().createElement(r.I.Wrapper,{error:O},l().createElement(r.O,{ref:k,value:b,onChange:e=>{P(String(e)),6===String(e).length&&setTimeout(()=>{var e;null===(e=x.current)||void 0===e||e.click()},100),w("")},otpShareProps:{"data-event-category":q,"data-event-action":Y,"data-event-label":"Enter Code"},placeholder:"*"})),l().createElement(y.Group,{spacing:8,align:"center",style:{height:40}},l().createElement(_.T,{size:"p4"},i("ssov2.otp.resendQuestion")),l().createElement(_.T,{style:{pointerEvents:$>0?"none":"auto",cursor:$>0?"not-allowed":"pointer"},size:"s4",color:"blue.6",onClick:()=>sendOTPCode(!0),"data-event-category":q,"data-event-action":Y,"data-event-label":"Resend OTP"},i("ssov2.otp.resendText",{count:$})))),l().createElement(h.B,{type:"submit",size:"lg",variant:"primary",mt:12,fullWidth:!0,disabled:S,loading:S,"data-event-category":q,"data-event-action":Y,"data-event-label":"Continue",ref:x},i("ssov2.button.continue")),!G&&l().createElement(l().Fragment,null,F.a&&l().createElement(h.B,{size:"sm",variant:"white",mt:12,fullWidth:!0,onClick:()=>swapAnotherMethod("phone-whatsapp"),loading:S,disabled:S,"data-event-category":q,"data-event-action":Y,"data-event-label":"Send OTP Code via WhatsApp",display:H?"none":"block",leftIcon:l().createElement(WhatsApp,null),style:{fontWeight:400},color:"#595959"},i("ssov2.otp.sendVia",{method:"WhatsApp"})),F.b&&l().createElement(h.B,{size:"sm",variant:"white",mt:12,fullWidth:!0,onClick:()=>swapAnotherMethod("phone-zalo"),loading:S,disabled:S,"data-event-category":q,"data-event-action":Y,"data-event-label":"Send OTP Code via Zalo",display:N?"none":"block",leftIcon:l().createElement(Zalo,null),style:{fontWeight:400},color:"#595959"},i("ssov2.otp.sendVia",{method:"Zalo"})),F.c&&l().createElement(h.B,{size:"sm",variant:"white",mt:12,fullWidth:!0,onClick:()=>swapAnotherMethod("phone-sms"),loading:S,disabled:S,"data-event-category":q,"data-event-action":Y,"data-event-label":"Send OTP Code via SMS",display:V?"none":"block",leftIcon:l().createElement(v.A,{size:18}),style:{fontWeight:400},color:"#595959"},i("ssov2.otp.sendVia",{method:"SMS"}))))},SSOPasswordScreen=({hidden:e,config:t})=>{let{t:a}=(0,C.u)(),{onClose:i,setTracking:s}=useSSOState(),{setUserInfo:c,flowData:u,abTestFlow:p}=(0,T.u)(),[v,m]=l().useState(""),g=null==t?void 0:t.phone,f=null==t?void 0:t.method,S=null==t?void 0:t.email,E=`SSO - Sign In via ${S?"Email":f}_Phone_Adoption_Test_${p}`,b="Welcome Back";(0,n.useEffect)(()=>{e||(m(""),s({category:E,action:b}))},[e]);let[P,O]=l().useState(!1),{addStep:w,goNext:x}=(0,T.a)(),onAuthSuccess=e=>(0,o._)(void 0,void 0,void 0,function*(){(0,d.h)(e);let t=yield(0,d.g)(),a=isPhoneFlowFn(u),o=isEmailFlowFn(u);if(c(null==t?void 0:t._data),!g&&S&&(0,T.b)(null==t?void 0:t._data)&&"B"!==p){T.u.setState(e=>({flowData:Object.assign(Object.assign({},e.flowData),{isVerifyPhone:!0})})),w({type:T.S.VERIFY_PHONE,config:{provider:"email"}}),x();return}if((0,T.c)(u,t._data)){w({type:T.S.FORGOT_PASSWORD_PHONE,config:{phone:`${t._data.area_code}${t._data.phone}`,afterAction:"setup"}}),x();return}if((a||o)&&!(0,T.i)(null==t?void 0:t._data)){w({type:T.S.SETUP_FULL,config:{userInfo:null==t?void 0:t._data}}),x();return}null==i||i(!0)}),k=l().createElement("form",{style:{display:e?"none":"block"},onSubmit:e=>(0,o._)(void 0,void 0,void 0,function*(){e.preventDefault(),O(!0);try{let t;let o=e.currentTarget.password.value;(null==(t=g?yield loginByPhonePassword(g,o):yield loginByEmailPassword(S,o))?void 0:t._status)===1?yield onAuthSuccess(null==t?void 0:t._data):m(getErrorTextFromCode(a,null==t?void 0:t.code))}catch(e){m(getErrorTextFromCode(a,"")),console.error(e)}O(!1)})},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},a("ssov2.password.title1"),l().createElement("br",null),a("ssov2.password.title2")),l().createElement(_.T,{size:"p4"},a("ssov2.password.description"))),l().createElement(y.Stack,{mt:24,spacing:8},l().createElement(r.i,{name:"password",placeholder:a("ssov2.passwordForgotSetup.field.password.placeholder"),error:v||void 0,onChange:()=>m(""),disabled:P,required:!0,"data-event-category":E,"data-event-action":b,"data-event-label":"Enter Password"}),l().createElement(y.Group,{spacing:8,align:"center",style:{height:40}},l().createElement(_.T,{size:"p4"},a("ssov2.password.forgotPassword")),l().createElement(_.T,{size:"s4",color:"blue.6",style:{cursor:"pointer"},onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){var e,t;O(!0);try{if(g)w({type:T.S.FORGOT_PASSWORD_PHONE,config:{phone:g}});else{let o=yield(0,d.c)({email:S});if((null==o?void 0:o._status)===1){let n;if((null===(e=o._data)||void 0===e?void 0:e.provider)?(n=yield resendEmailOTP(S),T.u.setState(e=>({flowData:Object.assign(Object.assign({},e.flowData),{flow:"login"})}))):(n=yield registerBySendEmailOTP(S),T.u.setState(e=>({flowData:Object.assign(Object.assign({},e.flowData),{flow:"signup"})}))),(null==n?void 0:n._status)!==1)return m(getErrorTextFromCode(a,null==n?void 0:n.code)),O(!1);w({type:T.S.OTP,config:{email:S,otpType:"email",afterAction:"forgot",provider:null===(t=o._data)||void 0===t?void 0:t.provider}})}}x()}catch(e){m(getErrorTextFromCode(a,"")),console.error(e)}O(!1)}),"data-event-category":E,"data-event-action":b,"data-event-label":"Reset Password"},a("ssov2.password.reset")))),l().createElement(h.B,{type:"submit",size:"lg",variant:"primary",mt:12,fullWidth:!0,disabled:P,loading:P,"data-event-category":E,"data-event-action":b,"data-event-label":"Sign In"},a("ssov2.password.signIn")));return F.i?l().createElement("div",{style:{display:e?"none":"flex",flexDirection:"column",height:"100%"}},k,l().createElement(PolicyContent,{legalTextType:"default",trackingAction:b,trackingCategory:E,activeTab:"password"})):k},SetupLater=({style:e={}})=>{let{t}=(0,C.u)(),{onClose:a,tracking:i}
32=useSSOState(),[r,d]=(0,n.useState)(!1),{userInfo:s,flowData:c}=(0,T.u)(),{currentStepIndex:u,steps:p,addStep:v,goNext:m}=(0,T.a)(),g=p[u];return l().createElement(h.B,{size:"sm",variant:"white",color:"#737373",style:Object.assign({fontWeight:400},e),onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){var e;if(!r){if(d(!0),s&&!(0,T.i)(s)&&((null==g?void 0:g.type)===T.S.VERIFY_PHONE||(null==g?void 0:g.type)===T.S.FORGOT_PASSWORD_PHONE))v({type:(null===(e=g.config)||void 0===e?void 0:e.afterAction)==="update-email"?T.S.UPDATE_EMAIL:T.S.SETUP_FULL,config:{userInfo:s}}),m();else if(s||(0,T.d)(c)||(null==g?void 0:g.type)!==T.S.VERIFY_PHONE){let e=isResetPasswordViePhoneFlowFn(p);null==a||a(!e)}else v({type:T.S.SETUP_FULL,config:{userInfo:s}}),m();d(!1)}}),disabled:r,dataEventCategory:null==i?void 0:i.category,dataEventAction:null==i?void 0:i.action,dataEventLabel:"Setup Later"},t("ssov2.button.setupLater"))},SSOPasswordForgotPhone=({hidden:e,config:t})=>{let a=null==t?void 0:t.phone,{t:i}=(0,C.u)(),[r,s]=l().useState(""),{setTracking:c,locale:u}=useSSOState(),{flowData:p,abTestFlow:m}=(0,T.u)(),{getGRecaptchaToken:g,renderRecaptchaHandler:f}=useGRecaptchaHandler(),S=p.method,E=`SSO - Sign In via ${S}_Phone_Adoption_Test_${m}`,b="Forgot Password";(0,n.useEffect)(()=>{e||(s(""),c({category:E,action:b}))},[e]);let[P,O]=l().useState(!1),{addStep:w,goNext:x}=(0,T.a)();return l().createElement("div",{style:{display:e?"none":"block"}},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},i("ssov2.resetPassword.title")),l().createElement(_.T,{size:"p4"},i("ssov2.resetPassword.description"))),l().createElement(y.Stack,{mt:24,spacing:16},l().createElement(eC,{defaultCountry:u&&j.M[u]||"VN",value:a,isError:!!r,required:!0,disabled:!0,"data-event-category":E,"data-event-action":b,"data-event-label":"Enter Phone",trackingFn:(0,n.useCallback)(e=>{if(null==e?void 0:e.label)return{"data-event-action":"Country Selection","data-event-label":e.label,"data-event-category":E}},[])}),r&&l().createElement(_.T,{size:"label2",color:"red.6",mt:-12},r),F.a&&l().createElement(h.B,{size:"lg",variant:"primary",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){var e,o;O(!0);try{let{areaCode:n,phoneNumber:l}=(0,T.s)(a);if(!n||!l||!a)return s(i("ssov2.validate.phone.required")),O(!1);let r=yield(0,d.c)({phone:l});if((null==r?void 0:r._status)===1){let d;if((null==(d=(null===(e=r._data)||void 0===e?void 0:e.provider)?yield resendWhatsAppOTP(l,n):yield registerBySendWhatsAppOTP(l,n))?void 0:d._status)!==1)return s(getErrorTextFromCode(i,null==d?void 0:d.code)),O(!1);w({type:T.S.OTP,config:{phone:a,otpType:"phone-whatsapp",afterAction:t.afterAction||"forgot",provider:null===(o=r._data)||void 0===o?void 0:o.provider}}),x()}else s(getErrorTextFromCode(i,null==r?void 0:r.code))}catch(e){console.error(e),s(getErrorTextFromCode(i,""))}O(!1)}),loading:P,disabled:P,"data-event-category":E,"data-event-action":b,"data-event-label":"Continue with WhatsApp",leftIcon:l().createElement(WhatsApp,null),color:"#00B16A"},i("ssov2.button.continueWhatsApp")),F.b&&l().createElement(h.B,{size:"lg",variant:"primary",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){var e,o;O(!0);try{let{areaCode:n,phoneNumber:l}=(0,T.s)(a);if(!n||!l||!a)return s(i("ssov2.validate.phone.required")),O(!1);let r=yield(0,d.c)({phone:l});if((null==r?void 0:r._status)===1){let d;if((null==(d=(null===(e=r._data)||void 0===e?void 0:e.provider)?yield resendZaloOTP(l,n):yield registerBySendZaloOTP(l,n))?void 0:d._status)!==1)return s(getErrorTextFromCode(i,null==d?void 0:d.code)),O(!1);w({type:T.S.OTP,config:{phone:a,otpType:"phone-zalo",afterAction:t.afterAction||"forgot",provider:null===(o=r._data)||void 0===o?void 0:o.provider}}),x()}else s(getErrorTextFromCode(i,null==r?void 0:r.code))}catch(e){console.error(e),s(getErrorTextFromCode(i,""))}O(!1)}),disabled:P,loading:P,"data-event-category":E,"data-event-action":b,"data-event-label":"Continue with Zalo",leftIcon:l().createElement(Zalo,null)},i("ssov2.button.continueZalo")),F.c&&l().createElement(l().Fragment,null,l().createElement(h.B,{size:"sm",variant:"white",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){var e,o;O(!0);try{let{areaCode:n,phoneNumber:l}=(0,T.s)(a);if(!n||!l||!a)return s(i("ssov2.validate.phone.required")),O(!1);let r=yield(0,d.c)({phone:l});if((null==r?void 0:r._status)===1){let d;if(null===(e=r._data)||void 0===e?void 0:e.provider){let e=yield g();d=yield resendPhoneOTP(l,n,e||"")}else d=yield registerBySendPhoneOTP(l,n);if((null==d?void 0:d._status)!==1)return s(getErrorTextFromCode(i,null==d?void 0:d.code)),O(!1);w({type:T.S.OTP,config:{phone:a,otpType:"phone-sms",afterAction:t.afterAction||"forgot",provider:null===(o=r._data)||void 0===o?void 0:o.provider}}),x()}else s(getErrorTextFromCode(i,null==r?void 0:r.code))}catch(e){console.error(e),s(getErrorTextFromCode(i,""))}O(!1)}),disabled:P,loading:P,"data-event-category":E,"data-event-action":b,"data-event-label":"Continue with SMS",style:{fontWeight:400},color:"#595959",leftIcon:l().createElement(v.A,{size:18})},i("ssov2.button.continueSMS")),f()),l().createElement(SetupLater,null)))},CheckGrayIcon=()=>l().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l().createElement("path",{d:"M7.053 9.43 5.505 7.883a.48.48 0 0 0-.349-.142.47.47 0 0 0-.354.142.48.48 0 0 0-.145.351q0 .207.145.352l1.83 1.83q.18.18.421.18.24 0 .422-.18l3.709-3.71a.48.48 0 0 0 .142-.348.47.47 0 0 0-.142-.354.48.48 0 0 0-.351-.145.48.48 0 0 0-.352.145zm.948 4.903a6.2 6.2 0 0 1-2.47-.498 6.4 6.4 0 0 1-2.012-1.354 6.4 6.4 0 0 1-1.354-2.01A6.2 6.2 0 0 1 1.666 8q0-1.315.499-2.47a6.4 6.4 0 0 1 1.353-2.01 6.4 6.4 0 0 1 2.01-1.354 6.2 6.2 0 0 1 2.47-.5q1.314 0 2.47.5 1.157.498 2.012 1.353t1.354 2.01q.498 1.156.499 2.47 0 1.314-.499 2.47a6.4 6.4 0 0 1-1.354 2.011 6.4 
326.4 0 0 1-2.01 1.355 6.2 6.2 0 0 1-2.47.498m-.002-1q2.234 0 3.784-1.55T13.333 8t-1.55-3.783-3.784-1.55-3.783 1.55T2.666 8t1.55 3.783 3.783 1.55",fill:"#8C8C8C"})),CheckGreenIcon=()=>l().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l().createElement("path",{d:"M7.053 9.43 5.505 7.883a.48.48 0 0 0-.349-.142.47.47 0 0 0-.354.142.48.48 0 0 0-.145.351q0 .207.145.352l1.83 1.83q.18.18.421.18.24 0 .422-.18l3.709-3.71a.48.48 0 0 0 .142-.348.47.47 0 0 0-.142-.354.48.48 0 0 0-.351-.145.48.48 0 0 0-.352.145zm.948 4.903a6.2 6.2 0 0 1-2.47-.498 6.4 6.4 0 0 1-2.012-1.354 6.4 6.4 0 0 1-1.354-2.01A6.2 6.2 0 0 1 1.666 8q0-1.315.499-2.47a6.4 6.4 0 0 1 1.353-2.01 6.4 6.4 0 0 1 2.01-1.354 6.2 6.2 0 0 1 2.47-.5q1.314 0 2.47.5 1.157.498 2.012 1.353t1.354 2.01q.498 1.156.499 2.47 0 1.314-.499 2.47a6.4 6.4 0 0 1-1.354 2.011 6.4 6.4 0 0 1-2.01 1.355 6.2 6.2 0 0 1-2.47.498",fill:"#00B16A"})),CheckRedIcon=()=>l().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l().createElement("path",{d:"m8.001 8.703 2.049 2.048q.138.14.348.142a.47.47 0 0 0 .355-.142.48.48 0 0 0 .145-.35.48.48 0 0 0-.145-.352L8.703 8l2.05-2.049a.48.48 0 0 0 .141-.348.47.47 0 0 0-.141-.354.48.48 0 0 0-.352-.145.48.48 0 0 0-.351.145L8.001 7.298l-2.048-2.05a.48.48 0 0 0-.349-.14.47.47 0 0 0-.354.14.48.48 0 0 0-.145.352q0 .207.145.351l2.049 2.05-2.049 2.048a.48.48 0 0 0-.142.348.47.47 0 0 0 .142.354.48.48 0 0 0 .351.145.48.48 0 0 0 .352-.145zm.001 5.63a6.2 6.2 0 0 1-2.47-.498 6.4 6.4 0 0 1-2.011-1.354 6.4 6.4 0 0 1-1.354-2.01A6.2 6.2 0 0 1 1.668 8q0-1.315.499-2.47A6.4 6.4 0 0 1 3.52 3.52a6.4 6.4 0 0 1 2.01-1.354 6.2 6.2 0 0 1 2.47-.5q1.314 0 2.47.5 1.156.498 2.012 1.353.855.855 1.354 2.01.499 1.156.499 2.47t-.499 2.47a6.4 6.4 0 0 1-1.354 2.011 6.4 6.4 0 0 1-2.01 1.355 6.2 6.2 0 0 1-2.47.498",fill:"#F44D2C"})),SSOPasswordWithConfirm=e=>{var{form:t,loading:a,tracking:i}=e,d=(0,o.a)(e,["form","loading","tracking"]);let{t:s}=(0,C.u)(),[c,u]=l().useState(void 0),[p,v]=l().useState(void 0),m=t.values.password;return(0,n.useEffect)(()=>{void 0!==m&&(u(m.length>=8),v(!!m.match(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/)))},[m]),l().createElement(y.Stack,Object.assign({spacing:12},d),l().createElement(r.i,Object.assign({name:"password",placeholder:s("ssov2.passwordForgotSetup.field.password.placeholder"),label:s("ssov2.passwordForgotSetup.field.password.label"),required:!0,withAsterisk:!0},t.getInputProps("password"),{onBlur:e=>{t.getInputProps("password").onBlur(e),t.values.confirmPassword&&t.validateField("confirmPassword")},disabled:a,"data-event-category":null==i?void 0:i.category,"data-event-action":null==i?void 0:i.action,"data-event-label":"Enter Password"})),l().createElement(y.Stack,{spacing:8},l().createElement(y.Group,{spacing:4,align:"flex-start"},c?l().createElement(CheckGreenIcon,null):void 0===c?l().createElement(CheckGrayIcon,null):l().createElement(CheckRedIcon,null),l().createElement(_.T,{size:"n1",style:{flex:1}},s("ssov2.passwordForgotSetup.field.password.atLeast8Chars"))),l().createElement(y.Group,{spacing:4,align:"flex-start"},p?l().createElement(CheckGreenIcon,null):void 0===p?l().createElement(CheckGrayIcon,null):l().createElement(CheckRedIcon,null),l().createElement(_.T,{size:"n1",style:{flex:1}},s("ssov2.passwordForgotSetup.field.password.atLeastOneUpper")))),l().createElement(r.i,Object.assign({name:"confirm-password",placeholder:s("ssov2.passwordForgotSetup.field.passwordConfirm.placeholder"),label:s("ssov2.passwordForgotSetup.field.passwordConfirm.label"),required:!0,withAsterisk:!0,disabled:a,"data-event-category":null==i?void 0:i.category,"data-event-action":null==i?void 0:i.action,"data-event-label":"Confirm Password"},t.getInputProps("confirmPassword"))))},SSOPasswordForgotSetup=({hidden:e})=>{let{t}=(0,C.u)(),[a,i]=l().useState(!1),[r,s]=l().useState(""),{setTracking:c,onClose:u}=useSSOState(),{addStep:p,goNext:v}=(0,T.a)(),{flowData:m,setUserInfo:g,source:f,abTestFlow:S}=(0,T.u)(),b=m.method,P="login"===m.flow?`SSO - Sign In via ${b}_Phone_Adoption_Test_${S}`:`SSO - Sign Up via ${b}_Phone_Adoption_Test_${S}`,O="Setup Password";(0,n.useEffect)(()=>{e||(s(""),c({category:P,action:O}))},[e]);let{steps:w,setSteps:F}=(0,T.a)(),x=(0,q.m)({validate:(0,Y.t)($.Ik().shape({password:$.Yj().required(t("ssov2.validate.password.required")).min(8," ").max(50," ").matches(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/," "),confirmPassword:$.Yj().required(t("ssov2.validate.confirmPassword.required")).test("passwords-match",t("ssov2.validate.confirmPassword.match"),function(e){return this.parent.password===e})}))});return l().createElement("form",{style:{display:e?"none":"block"},onSubmit:x.onSubmit(e=>(0,o._)(void 0,void 0,void 0,function*(){var a;i(!0);try{let{password:o,confirmPassword:n}=e;if(o.length>=8&&o.length<=50&&o.match(/^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)/)&&o===n){let e=isPhoneFlowFn(m)||isEmailFlowFn(m),l=e?yield(0,d.u)({password:o,confirm_password:n,validate:""}):yield(0,d.r)(o,n);if((null==l?void 0:l._status)===1){if(e){let e=parseEmailFromToken(null===(a=null==l?void 0:l._data)||void 0===a?void 0:a.token),t=isEmailFlowFn(m)&&isResetPasswordFlowFn(w)?yield loginByEmailPassword(e,o):null;(0,d.h)((null==t?void 0:t._data)||(null==l?void 0:l._data));let n=yield(0,d.g)();if(isPhoneFlowFn(m)&&(n&&!(0,T.i)(null==n?void 0:n._data)?(p({type:T.S.SETUP_FULL,config:{userInfo:null==n?void 0:n._data}}),v()):null==u||u(!0)),isEmailFlowFn(m)){g(null==n?void 0:n._data);let e=(0,T.b)(null==n?void 0:n._data)&&"care_onboarding"===f,t=(0,T.b)(null==n?void 0:n._data)&&"B"!==S;e||t?(p({type:T.S.VERIFY_PHONE,config:{provider:"email"}}),v()):isSetupFullInfoAlready(null==n?void 0:n._data,m)?null==u||u(!0):(p({type:T.S.SETUP_FULL,config:{userInfo:null==n?void 0:n._data}}),v())}}else{(0,E.s)({type:"success",message:"Password has been reset successfully"});let e=w.findIndex(e=>e.type===T.S.PASSWORD);-1===e?(F(e=>[e[0]]),T.a.setState({currentStepIndex:0})):(F(t=>t.slice(0,e+1)),T.a.setState({currentStepIndex:e}))}}else s(getErrorTextFromCode(t,null==l?void 0:l.code))}}catch(e){console.error(e),s(getErrorTextFromCode(t,null==e?void 0:e.code))}i(!1)}))},l().createElement(y.Stack,{spacing:24},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},t("ssov2.passwordForgotSetup.title")),l().createElement(_.T,{size:"p4"},t("ssov2.passwordForgotSetup.description"))),l().createElement(SSOPasswordWithConfirm,{form:x,loading:a,tracking:{category:P,action:O}}),r&&l().createElement(_.T,{size:"label2",color:"red.6",mt:-12},r),l().createElement(h.B,{type:"submit",size:"lg",variant:"primary",fullWidth:!0,disabled:a,loading:a,"data-event-category":P,"data-event-action":O,"data-event-label":(null==m?void 0:m.flow)==="signup"?"Create New Account":"Save"},(null==m?void 0:m.flow)==="signup"?t("ssov2.setup.button.createAccount"):t("ssov2.button.save")))
32)},SSOPhoneVerify=({hidden:e,config:t})=>{let{t:a}=(0,C.u)(),[i,s]=l().useState(""),[c,u]=l().useState(!1),[p,m]=l().useState(""),{locale:g,setTracking:f}=useSSOState(),{flowData:S,userInfo:E,abTestFlow:b}=(0,T.u)(),{steps:P}=(0,T.a)(),{afterAction:O,provider:w,email:x}=t||{},k=null==S?void 0:S.method,I=E&&!E.first_time_login?`SSO - Existing User via ${k}_Phone_Adoption_Test_${b}`:isVerifyPhoneInTheSignUp(P,S)?`SSO - Sign Up via ${k}_Phone_Adoption_Test_${b}`:`SSO - Sign In via ${k}_Phone_Adoption_Test_${b}`,D="Verify Phone Number";(0,n.useEffect)(()=>{e||(m(""),f({category:I,action:D}))},[e]);let{source:R}=(0,T.u)(),{addStep:B,goNext:W}=(0,T.a)();return l().createElement("div",{style:{display:e?"none":"block"}},l().createElement(y.Stack,{spacing:24},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},a("ssov2.phoneVerify.title")),l().createElement(_.T,{size:"p4"},a("ssov2.phoneVerify.description"))),l().createElement(y.Stack,{spacing:16},l().createElement(r.I.Wrapper,{error:p},l().createElement(eC,{defaultCountry:g&&j.M[g]||"VN",value:i,onChange:e=>{s(e),m("")},isError:!!p,required:!0,name:"phone",disabled:c,"data-event-category":I,"data-event-action":D,"data-event-label":"Enter Phone",trackingFn:(0,n.useCallback)(e=>{if(null==e?void 0:e.label)return{"data-event-action":"Country Selection","data-event-label":e.label,"data-event-category":I}},[])})),F.a&&l().createElement(h.B,{size:"lg",variant:"primary",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){u(!0);try{let{areaCode:e,phoneNumber:t}=(0,T.s)(i);if(!e||!t||!i)return m(a("ssov2.validate.phone.required")),u(!1);let o=yield(0,d.c)({phone:t});if((null==o?void 0:o._status)===1){if(o._data)m(a("ssov2.phone.alreadyUsed"));else{let o=yield resendUpdatePhoneWhatsAppOTP(t,e);if((null==o?void 0:o._status)!==1)return m(getErrorTextFromCode(a,null==o?void 0:o.code)),u(!1);B({type:T.S.OTP,config:{provider:w,phone:i,email:x,otpType:"phone-whatsapp",isUpdatePhone:!0,afterAction:O||"setup"}}),W()}}else m(getErrorTextFromCode(a,null==o?void 0:o.code))}catch(e){console.log(e),m(getErrorTextFromCode(a,""))}u(!1)}),loading:c,disabled:c,"data-event-category":I,"data-event-action":D,"data-event-label":"Continue with WhatsApp",leftIcon:l().createElement(WhatsApp,null),color:"#00B16A"},a("ssov2.button.continueWhatsApp")),F.b&&l().createElement(h.B,{size:"lg",variant:"primary",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){u(!0);try{let{areaCode:e,phoneNumber:t}=(0,T.s)(i);if(!e||!t||!i)return m(a("ssov2.validate.phone.required")),u(!1);let o=yield(0,d.c)({phone:t});if((null==o?void 0:o._status)===1){if(o._data)m(a("ssov2.phone.alreadyUsed"));else{let o=yield resendUpdatePhoneZaloOTP(t,e);if((null==o?void 0:o._status)!==1)return m(getErrorTextFromCode(a,null==o?void 0:o.code)),u(!1);B({type:T.S.OTP,config:{provider:w,phone:i,email:x,otpType:"phone-zalo",isUpdatePhone:!0,afterAction:O||"setup"}}),W()}}else m(getErrorTextFromCode(a,null==o?void 0:o.code))}catch(e){console.log(e),m(getErrorTextFromCode(a,""))}u(!1)}),disabled:c,loading:c,"data-event-category":I,"data-event-action":D,"data-event-label":"Continue with Zalo",leftIcon:l().createElement(Zalo,null)},a("ssov2.button.continueZalo")),F.c&&l().createElement(h.B,{size:"sm",variant:"white",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){u(!0);try{let{areaCode:e,phoneNumber:t}=(0,T.s)(i);if(!e||!t||!i)return m(a("ssov2.validate.phone.required")),u(!1);let o=yield(0,d.c)({phone:t});if((null==o?void 0:o._status)===1){if(o._data)m(a("ssov2.phone.alreadyUsed"));else{let o=yield resendUpdatePhoneOTP(t,e);if((null==o?void 0:o._status)!==1)return m(getErrorTextFromCode(a,null==o?void 0:o.code)),u(!1);B({type:T.S.OTP,config:{provider:w,phone:i,email:x,otpType:"phone-sms",isUpdatePhone:!0,afterAction:O||"setup"}}),W()}}else m(getErrorTextFromCode(a,null==o?void 0:o.code))}catch(e){console.log(e),m(getErrorTextFromCode(a,""))}u(!1)}),disabled:c,loading:c,"data-event-category":I,"data-event-action":D,"data-event-label":"Continue with SMS",style:{fontWeight:400},color:"#595959",leftIcon:l().createElement(v.A,{size:18})},a("ssov2.button.continueSMS")),"care_onboarding"!==R&&"ecom"!==R&&l().createElement(SetupLater,null))))},FemaleIcon=()=>l().createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l().createElement("path",{d:"M9.907.476C7.828.428 5.535 2.36 4.817 4.593c-1.192 3.7.154 9.554-1.391 13.089l10.542-.056c.649-3.603.786-7.28.41-10.922-.159-1.46-.4-3.184-1.33-4.294C12.02 1.184 11.02.624 10.514.514a2.4 2.4 0 0 0-.607-.038",fill:"#262626"}),l().createElement("path",{d:"M14.224 18.144H5.532c-1.44 0-2.196-.447-1.206-1.493a7 7 0 0 1 .531-.502c.537-.457 1.743-1.437 2.57-1.921.513-.3.894-.78 1.068-1.348q.108-.418.143-.847h2.48q.035.43.143.847a2.36 2.36 0 0 0 1.066 1.348c.83.484 2.034 1.464 2.572 1.921q.28.238.532.502c.99 1.046.233 1.493-1.207 1.493",fill:"#FFB497"}),l().createElement("path",{d:"M15.841 17.15c.41.686.031 1.06-.556 1.401-.604.35-2.454 1.086-5.407 1.086S5.076 18.9 4.471 18.55c-.587-.34-.965-.71
325-.555-1.4q.327-.538.76-.985a9.3 9.3 0 0 1 2.64-1.846l2.59 2.726 2.573-2.707a9.3 9.3 0 0 1 2.6 1.827h.003c.287.297.542.628.759.985",fill:"#FC488D"}),l().createElement("path",{d:"M6.037 7.275a.95.95 0 0 0-.763-.012c-.442.225-.502.809-.353 1.227.19.538.782 1.076 1.414.871z",fill:"#FFB497"}),l().createElement("path",{d:"M6.334 8.688a.23.23 0 0 1-.192-.104.66.66 0 0 0-.514-.249.23.23 0 0 1-.003-.46c.023 0 .6-.005.902.457a.23.23 0 0 1-.193.356m4.929 4.192c-.519.285-1.054.501-1.384.501s-.865-.216-1.383-.501q.108-.418.143-.847h2.481q.034.43.143.847",fill:"#FF977B"}),l().createElement("path",{d:"M13.564 6.966c-.181-1.907-1.68-4.121-2.63-3.686a.18.18 0 0 1-.194-.028C9.154 1.846 9.156 6.759 6.035 7.274c.071 2.186.776 3.652 1.512 4.224.667.52 1.781 1.116 2.33 1.116s1.664-.596 2.332-1.116c.77-.6 1.577-2.186 1.355-4.532",fill:"#FCCAAF"}),l().createElement("path",{d:"M11.786 7.978a.387.387 0 1 0 0-.775.387.387 0 0 0 0 .775",fill:"#404040"}),l().createElement("path",{d:"M11.098 7.092a.85.85 0 0 1 .417-.26c.15-.04.307-.048.46-.022q.218.034.413.136.069.03.143.03l.045-.001a.157.157 0 0 1 .163.153.2.2 0 0 1-.012.065.34.34 0 0 1-.207.188.45.45 0 0 1-.323-.02 1.1 1.1 0 0 0-.287-.072.8.8 0 0 0-.268.014.5.5 0 0 0-.207.104l-.018.015a.23.23 0 0 1-.319-.33m-.157-1.074c.35-.09.711-.116 1.07-.076a2.5 2.5 0 0 1 1.012.349.179.179 0 0 1-.177.31 2.2 2.2 0 0 0-.875-.253 2.5 2.5 0 0 0-.908.113.23.23 0 0 1-.134-.44z",fill:"#262626"}),l().createElement("path",{d:"M7.971 7.978a.387.387 0 1 0 0-.775.387.387 0 0 0 0 .775",fill:"#404040"}),l().createElement("path",{d:"M8.324 7.409a.5.5 0 0 0-.207-.105.8.8 0 0 0-.268-.014 1.1 1.1 0 0 0-.288.073.45.45 0 0 1-.322.019.34.34 0 0 1-.208-.188.158.158 0 0 1 .15-.217l.047.001q.075 0 .143-.03.195-.102.412-.136c.153-.026.31-.018.46.022a.85.85 0 0 1 .416.26.23.23 0 0 1-.317.33zm.37-.948a2.5 2.5 0 0 0-.907-.113 2.2 2.2 0 0 0-.876.253.179.179 0 0 1-.176-.31h.001a2.5 2.5 0 0 1 1.013-.35c.358-.039.72-.013 1.069.077a.23.23 0 0 1-.11.447l-.01-.003z",fill:"#262626"}),l().createElement("path",{d:"M10.887 9.971a.15.15 0 0 0-.19-.094l-.012.005a.2.2 0 0 1-.118.004c-.046-.01-.108-.032-.193-.05a.6.6 0 0 0-.397.053.6.6 0 0 0-.397-.053c-.084.019-.145.041-.192.05a.2.2 0 0 1-.118-.004l-.012-.004a.15.15 0 0 0-.132.265.5.5 0 0 0 .283.082c.092 0 .165-.013.217-.012.053.001.152.115.188.145a.28.28 0 0 0 .36-.033c.02-.024.101-.111.155-.112.054 0 .126.012.218.012a.5.5 0 0 0 .282-.082.15.15 0 0 0 .058-.172",fill:"#F44D2C"}),l().createElement("path",{d:"M10.142 8.676a.23.23 0 0 0-.173.078.4.4 0 0 1-.092.015.4.4 0 0 1-.093-.015.23.23 0 0 0-.403.152c0 .32.49.324.496.324.005 0 .494-.004.494-.324a.23.23 0 0 0-.23-.23",fill:"#FF977B"}),l().createElement("path",{d:"M10.026 10.691h-.294a.23.23 0 1 0 0 .46h.294a.23.23 0 0 0 0-.46",fill:"#F44D2C"}),l().createElement("path",{d:"M11.796 18.906a.45.45 0 0 1-.402-.628c.7-1.683-.73-4.184-.36-6.07a9 9 0 0 0 1.09-.687c.771-.6 1.578-2.186 1.356-4.532-.178-1.869-1.621-4.033-2.574-3.71l-.008.001-.007-.005a.013.013 0 0 1 .001-.016c.267-.299.343-1.113-.318-1.782-.498-.505-.665-.992-.418-.979 1.971.11 4.022 2.014 4.7 4.117.79 2.454.252 5.67.611 8.706.23 1.94 1.62 5.74-3.671 5.585",fill:"#262626"})),MaleIcon=()=>l().createElement("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},l().createElement("path",{d:"M10.334 16.266c-3.177 0-3.932-2.198-3.444-2.426.155-.073.312-.14.465-.21.487-.136.801-.72.966-1.133s.213-.762.219-.997l.19.37q.102.06.21.107a3.27 3.27 0 0 0 2.789 0c.072-.031.532-.437.599-.477l-.1.498c.005.226.063.286.14.499.222.59.41.89.955 1.138q.226.1.456.205c.153.071.017 2.426-3.445 2.426",fill:"#FF977B"}),l().createElement("path",{d:"M17.623 17.018c.503.8.038 1.233-.68 1.63-.74.407-2.994 1.263-6.609 1.263s-5.869-.856-6.61-1.264c-.717-.396-1.182-.83-.68-1.63.43-.685 1.662-2.158 3.845-3.177.155-.073.312-.14.466-.21.695 1.15 2.091 1.4 2.985 1.4s2.286-.25 2.983-1.395q.225.1.456.205c2.183 1.019 3.415 2.492 3.844 3.178",fill:"#2D87F3"}),l().createElement("path",{d:"M12.852 12.533c-.72.35-1.573.539-2.447.543a5.8 5.8 0 0 1-2.458-.517c.117-.22.18-.453.188-.688l.003-.002q.143.06.296.107c.617.205 1.29.312 1.972.312a6.3 6.3 0 0 0 2.269-.419l.002.002c.007.226.066.45.175.662",fill:"#FF6F4D"}),l().createElement("path",{d:"M14.755 7.579H5.61c-.213-2.439.17-4.883 1.27-5.997a.97.97 0 0 1 .98-.242c.205.066.731.01.906-.234.14-.197.714-.443 1.08-.104a.5.5 0 0 0 .334.127h.003a.52.52 0 0 0 .335-.127c.365-.339.939-.093 1.078.104.176.245.703.3.908.234a.97.97 0 0 1 .98.242c1.1 1.114 1.482 3.558 1.27 5.997",fill:"#404040"}),l().createElement("path",{d:"M14.02 6.912a1 1 0 0 1 .728-.007c.5.203.641.795.438 1.417-.2.617-.906 1.045-1.517.826-.179-.587-.062-1.716.351-2.236M6.607 9.147c-.611.219-1.317-.208-1.517-.825-.203-.622-.063-1.214.437-1.417a1 1 0 0 1 .728.007c.612.412.71 1.838.352 2.235",fill:"#FF977B"}
32),l().createElement("path",{d:"M13.887 8.263a.156.156 0 0 1-.125-.25 1.05 1.05 0 0 1 .804-.417.156.156 0 1 1-.003.312h-.001a.73.73 0 0 0-.55.292.16.16 0 0 1-.125.063m-7.498-.008a.16.16 0 0 1-.125-.063.7.7 0 0 0-.545-.282.16.16 0 0 1-.16-.151.156.156 0 0 1 .15-.161 1.02 1.02 0 0 1 .805.408.156.156 0 0 1-.125.25z",fill:"#FF6F4D"}),l().createElement("path",{d:"M12.353 3.765c-.545.131-.883.448-2.2.448s-1.656-.317-2.201-.448c-1.02-.247-1.649 2.672-1.647 3.883.001.18.028.696.054 1.2l.029.493q.03.34.152.66c1.108 3.11 6.118 3.096 7.347-.04.002-.085.015-.324.032-.62l.028-.493c.026-.504.053-1.02.053-1.2.002-1.211-.625-4.13-1.647-3.883",fill:"#FFB497"}),l().createElement("path",{d:"M12.348 6.946a.359.359 0 1 0-.717 0v.14a.359.359 0 1 0 .717 0zm-4.421.141a.359.359 0 0 0 .718 0v-.14a.359.359 0 1 0-.718 0z",fill:"#595959"}),l().createElement("path",{d:"M11.344 6.96a.2.2 0 0 1-.061-.013.15.15 0 0 1-.082-.198c.081-.196.348-.278.557-.312.381-.062.889-.017 1.102.228a.156.156 0 1 1-.236.206c-.1-.116-.446-.174-.772-.132-.24.032-.35.102-.363.13a.16.16 0 0 1-.145.091",fill:"#404040"}),l().createElement("path",{d:"M10.137 8.963c-.008 0-.772-.033-.772-.373a.156.156 0 0 1 .305-.048c.147.068.306.105.467.11.163-.005.324-.042.472-.11a.156.156 0 0 1 .305.048c0 .34-.77.373-.777.373",fill:"#FF6F4D"}),l().createElement("path",{d:"M11.122 6.393a.157.157 0 0 1-.051-.304c.687-.234 1.688-.344 2.26-.03a.156.
32156 0 0 1-.15.274c-.463-.254-1.38-.163-2.009.052a.2.2 0 0 1-.05.008m-2.19.572a.16.16 0 0 1-.144-.097c-.013-.027-.123-.097-.363-.129-.325-.043-.672.016-.772.131a.156.156 0 1 1-.236-.205c.214-.245.721-.29 1.103-.228.209.034.475.116.556.311a.156.156 0 0 1-.144.217m.222-.571a.2.2 0 0 1-.05-.009c-.629-.215-1.546-.306-2.009-.051a.156.156 0 1 1-.15-.274c.572-.315 1.572-.206 2.26.03a.156.156 0 0 1-.05.304",fill:"#404040"}),l().createElement("path",{d:"m11.12 9.547-.019.001a8 8 0 0 1-1.928 0 .156.156 0 1 0-.037.31c.665.08 1.337.08 2.003 0a.156.156 0 0 0-.019-.31",fill:"#D84023"})),OtherSetup=({form:e,needEmail:t,isEmailDisable:a,loading:o,tracking:n})=>{let{t:i}=(0,C.u)(),{setupSource:d}=(0,T.u)(),[s,c]=l().useState(!1);return l().createElement(y.Stack,{spacing:12},l().createElement(r.I,Object.assign({name:"name",label:i("ssov2.setup.field.name.label"),withAsterisk:!0,required:!0,placeholder:i("ssov2.setup.field.name.placeholder"),disabled:o,"data-event-category":null==n?void 0:n.category,"data-event-action":null==n?void 0:n.action,"data-event-label":"Enter Name"},e.getInputProps("name"))),l().createElement(r.I.Wrapper,Object.assign({label:i("ssov2.setup.field.gender.label"),withAsterisk:!0},e.getInputProps("gender")),l().createElement(y.Group,null,l().createElement(h.B,{type:"button",styles:{root:{flex:1},leftIcon:{marginRight:8}},variant:"female"===e.getInputProps("gender").value?"secondary":"tertiary",onClick:()=>{e.setFieldValue("gender","female")},leftIcon:l().createElement(FemaleIcon,null),disabled:o,"data-event-category":null==n?void 0:n.category,"data-event-action":null==n?void 0:n.action,"data-event-label":"Enter Gender"},i("ssov2.setup.field.gender.female")),l().createElement(h.B,{type:"button",styles:{root:{flex:1},leftIcon:{marginRight:8}},variant:"male"===e.getInputProps("gender").value?"secondary":"tertiary",onClick:()=>{e.setFieldValue("gender","male")},leftIcon:l().createElement(MaleIcon,null),disabled:o,"data-event-category":null==n?void 0:n.category,"data-event-action":null==n?void 0:n.action,"data-event-label":"Enter Gender"},i("ssov2.setup.field.gender.male")))),l().createElement(X.D,Object.assign({name:"dob",label:i("ssov2.setup.field.dob.label"),withAsterisk:!0,required:!0,placeholder:i("ssov2.setup.field.dob.placeholder"),maxDate:new Date(new Date().getFullYear()-18,new Date().getMonth(),new Date().getDate()),disabled:o,"data-event-category":null==n?void 0:n.category,"data-event-action":null==n?void 0:n.action,"data-event-label":"Enter Birthday"},e.getInputProps("dob"),{onChange:t=>{e.getInputProps("dob").onChange(t),c(!0)},onBlur:t=>{(e.getInputProps("dob").value||s)&&e.getInputProps("dob").onBlur(t)}})),t&&l().createElement(r.I,Object.assign({name:"email",type:"email",label:i("ssov2.setup.field.email.label"),disabled:a||o,required:["care","ecom","community"].includes(d),withAsterisk:["care","ecom","community"].includes(d),"data-event-category":null==n?void 0:n.category,"data-event-action":null==n?void 0:n.action,"data-event-label":"Enter Email",style:{display:a?"none":"block"}},e.getInputProps("email"))))},eb={f:"female",m:"male"},getDefaultData=e=>{try{let t=new URLSearchParams(window.location.search),a=t.get(m.Q.gender),o=Q()(t.get(m.Q.birthday),"MM/DD/YYYY");if("f"===a||"m"===a||o.isValid()){let n=Object.assign({},e||{});return("f"===a||"m"===a)&&(n.gender=eb[a]),o.isValid()&&(n.birthday=t.get(m.Q.birthday)),n}}catch(t){return e}},SSOSetupScreen=({hidden:e,config:t})=>{var a,i,r;let{onClose:s,setTracking:c}=useSSOState(),{t:u}=(0,C.u)(),{setupSource:p,flowData:v,abTestFlow:m}=(0,T.u)(),[g,f]=l().useState(""),S=null==t?void 0:t.userInfo,[E,b]=l().useState(!1),P=null==t?void 0:t.phone,O=null==v?void 0:v.method,w=null===(a=null==t?void 0:t.userInfo)||void 0===a?void 0:a.provider,F=null==v?void 0:v.flow,x=getDefaultData(null==t?void 0:t.setupDefaultData),k=(null==S?void 0:S.phone)&&!!(null==S?void 0:S.phone_verified_at),I=!!(P||(null==x?void 0:x.phone)||k),D="signup"===F&&("email"===O||"google"===O||"facebook"===O||"google"===w||"facebook"===w||"email"===w),R=(null==x?void 0:x.email)||((null===(i=null==S?void 0:S.email)||void 0===i?void 0:i.includes("@hhg.com"))||(null===(r=null==S?void 0:S.email)||void 0===r?void 0:r.includes("@facebook.com"))?void 0:null==S?void 0:S.email)||void 0,B="care"===p||"ecom"===p||"community"===p||!(null==v?void 0:v.isVerifyPhone)||"facebook"===O||"facebook"===w,W=R&&("google"===O||"email"===O||"google"===w||"email"===w)||!!(null==S?void 0:S.email)&&!!(null==S?void 0:S.email_verified_at),L=`SSO - ${"signup"===F?"Sign Up":"Existing Users"} via ${O||(null==S?void 0:S.provider)}_Phone_Adoption_Test_${m}`,M="Add Information";(0,n.useEffect)(()=>{e||(f(""),c({category:L,action:M}))},[e]);let U=(0,q.m)({initialValues:Object.assign(Object.assign(Object.assign(Object.assign({},D?Object.assign(Object.assign({},k?{}:{otpMethod:"zalo"}),{phone:P||(null==x?void 0:x.phone)||((null==S?void 0:S.phone)?(S.area_code||"+84")+S.phone:void 0)||void 0}):{}),{gender:(null==x?void 0:x.gender)?x.gender:void 0,name:(null==S?void 0:S.name)||(null==x?void 0:x.name)||void 0}),B?{email:R}:{}),{dob:(null==x?void 0:x.birthday)?Q()(x.birthday,"MM/DD/YYYY").toDate():void 0}),validateInputOnBlur:!0,validate:(0,Y.t)($.Ik().shape(Object.assign(Object.assign({},B?{email:"care"===p||"ecom"===p?$.Yj().email(u("ssov2.validate.email.invalid")).required(u("ssov2.validate.email.required")):$.Yj().email(u("ssov2.validate.email.invalid"))}:{}),{gender:$.Yj().required(u("ssov2.validate.gender.required")).oneOf(["male","female"],u("ssov2.validate.gender.oneOf")),dob:$.p6().required(u("ssov2.validate.dob.required")),name:$.Yj().required(u("ssov2.validate.name.required"))})))});return l().createElement("form",{style:{display:e?"none":"block"},onSubmit:U.onSubmit(e=>(0,o._)(void 0,void 0,void 0,function*(){b(!0);try{let{phone:t,gender:a,name:o,dob:n}=e,{phoneNumber:l,areaCode:i}=(0,T.s)(t||P||""),r=yield(0,d.u)({name:o,birthday:Q()(n).format("YYYY-MM-DD"),email:e.email||void 0,phone_number:l||(null==S?void 0:S.phone),area_code:i||(null==S?void 0:S.area_code)||"84",gender:"male"===a?1:0,source:p,validate:"true"});if((null==r?void 0:r._status)===1){let t=yield(0,d.u)({name:o,birthday:Q()(n).format("YYYY-MM-DD"),email:e.email||void 0,phone_number:l||(null==S?void 0:S.phone),area_code:i||(null==S?void 0:S.area_code),gender:"male"===a?1:0,source:p,validate:""});if((null==t?void 0:t._status)!==1)return f(getErrorTextFromCode(u,null==t?void 0:t.code)),b(!1);(0,d.h)(null==t?void 0:t._data),null==s||s(!0)}else f(getErrorTextFromCode(u,null==r?void 0:r.code))}catch(e){console.error(e),f(getErrorTextFromCode(u,""))}b(!1)}))},l().createElement(y.Stack,{spacing:24},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},u("ssov2.setup.title")),l().createElement(_.T,{size:"p4"},u("ssov2.setup.description"))),l().createElement(OtherSetup,{needPhone:D,skipPhone:k,needEmail
32:B,isEmailDisable:W,isPhoneDisabled:I,form:U,loading:E,tracking:{category:L,action:M}}),g&&l().createElement(_.T,{color:"red.6",size:"p4"},g),l().createElement(h.B,{type:"submit",variant:"primary",fullWidth:!0,loading:E,disabled:E,"data-event-category":L,"data-event-action":M,"data-event-label":"Save"},u("ssov2.button.save")),l().createElement(SetupLater,{style:{marginTop:-8}})))},SSOUpdateEmailScreen=({hidden:e,config:t})=>{var a;let{t:i}=(0,C.u)(),[s,c]=l().useState(""),{setTracking:u}=useSSOState(),{flowData:p,abTestFlow:v}=(0,T.u)(),m=`SSO - Existing User via ${null==p?void 0:p.method}_Phone_Adoption_Test_${v}`,g="Continue With Email";(0,n.useEffect)(()=>{e||(c(""),u({category:m,action:g}))},[e]);let{addStep:f,goNext:S}=(0,T.a)(),[E,b]=l().useState(!1),P=null===(a=null==t?void 0:t.email)||void 0===a?void 0:a.trim(),O=l().useRef(!1),w=l().useCallback(e=>(0,o._)(void 0,void 0,void 0,function*(){var t,a;if(!E){b(!0);try{let o=(e||"").trim(),n=yield(0,d.c)({email:o});if((null==n?void 0:n._status)===1){let e=yield(0,d.g)();if(n._data&&o!==(null===(t=null==e?void 0:e._data)||void 0===t?void 0:t.email))c(i("ssov2.email.alreadyUsed"));else{let t=yield initSendUpdateEmailOtp(o);if((null==t?void 0:t._status)!==1)return c(getErrorTextFromCode(i,null==t?void 0:t.code)),b(!1);f({type:T.S.OTP,config:{provider:null===(a=null==e?void 0:e._data)||void 0===a?void 0:a.provider,email:o,otpType:"update-email",afterAction:"setup"}}),S()}}else c(getErrorTextFromCode(i,null==n?void 0:n.code))}catch(e){c(getErrorTextFromCode(i,"")),console.error(e)}b(!1)}}),[f,S,E,i]);return(0,n.useEffect)(()=>{e||!P||O.current||(O.current=!0,w(P))},[e,P,w]),l().createElement("form",{style:{display:e?"none":"block"},onSubmit:e=>(0,o._)(void 0,void 0,void 0,function*(){e.preventDefault(),yield w(e.currentTarget.email.value)})},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},i("ssov2.updateEmail.title")),l().createElement(_.T,{size:"p4"},i("ssov2.updateEmail.description"))),l().createElement(r.I,{name:"email",placeholder:i("onboarding.formEmail.yourEmail"),error:s||void 0,type:"email",required:!0,mt:24,onChange:()=>c(""),disabled:E,"data-event-category":m,"data-event-action":g,"data-event-label":"Enter Email"}),l().createElement(h.B,{type:"submit",size:"lg",variant:"primary",fullWidth:!0,mt:16,loading:E,disabled:E,"data-event-category":m,"data-event-action":g,"data-event-label":"Verify Your Email"},i("ssov2.updateEmail.button")))},SSOWhatsAppOTPScreen=({hidden:e,config:t})=>{let{t:a}=(0,C.u)(),{onClose:i,setTracking:s}=useSSOState(),[c,u]=l().useState(!1),[p,v]=l().useState(""),[m,g]=l().useState(""),f=l().useRef(null),S=l().useRef(null),E=(null==t?void 0:t.phone)||"",b=null==t?void 0:t.referrer,P=!!(null==t?void 0:t.useAuthenticatedWhatsAppApis),O="SSO - WhatsApp Login",w="Verify WhatsApp OTP";(0,n.useEffect)(()=>{e||(g(""),s({category:O,action:w}))},[e]);let[F,x]=l().useState(30),setupResendTimer=()=>{x(30);let countdown=()=>{x(e=>{if(e<=0)return 0;let t=e-1;return t>0&&setTimeout(()=>countdown(),1e3),t})};countdown()},sendOTPCode=e=>(0,o._)(void 0,void 0,void 0,function*(){if(!e||!(F>0)){u(!0);try{let{areaCode:e,phoneNumber:t}=(0,T.s)(E);if(!e||!t)return g(a("ssov2.validate.phone.required")),u(!1);let o=P?yield resendUpdatePhoneWhatsAppOTP(t,e):yield sendLoginOtpWhatsapp(t,e,b);if((null==o?void 0:o._status)!==1)return g(getErrorTextFromCode(a,null==o?void 0:o.code)),u(!1);setupResendTimer()}catch(e){console.error(e),g(getErrorTextFromCode(a,""))}u(!1)}}),submitOtp=e=>(0,o._)(void 0,void 0,void 0,function*(){var t;if(!e||e.length<6){g(a("ssov2.validate.otp.required"));return}u(!0);try{let{areaCode:o,phoneNumber:n}=(0,T.s)(E);if(!o||!n)return g(a("ssov2.validate.phone.required")),u(!1);let l=P?yield verifyUpdatePhoneWhatsAppOTP(n,o,e):yield verifyWhatsappOtpGuest(n,o,e);if((null==l?void 0:l._status)!==1)return v(""),null===(t=S.current)||void 0===t||t.focus(),g(getErrorTextFromCode(a,null==l?void 0:l.code)),u(!1);!P&&(null==l?void 0:l._data)&&(0,d.h)(l._data),null==i||i(!0)}catch(e){console.error(e),g(getErrorTextFromCode(a,""))}u(!1)});(0,n.useEffect)(()=>{setupResendTimer()},[]);let k=l().useRef(!1);return(0,n.useEffect)(()=>{!e&&P&&E&&!k.current&&(k.current=!0,sendOTPCode(!1))},[e,P,E]),l().createElement("form",{style:{display:e?"none":"block"},onSubmit:e=>{e.preventDefault(),submitOtp(String(p))}},l().createElement(y.Stack,{spacing:8},l().createElement(_.T,{size:"s1",weight:"semiBold"},a("ssov2.otp.phone.title")),l().createElement(_.T,{size:"p4",sx:{b:{fontWeight:"bold"}}},l().createElement("span",{dangerouslySetInnerHTML:{__html:a("ssov2.otp.phone.description",{phone:E,method:"WhatsApp"})}}))),l().createElement(y.Stack,{mt:24,spacing:8},l().createElement(r.I.Wrapper,{error:m},l().createElement(r.O,{ref:S,value:p,onChange:e=>{v(String(e)),6===String(e).length&&setTimeout(()=>{var e;null===(e=f.current)||void 0===e||e.click()},100),g("")},otpShareProps:{"data-event-category":O,"data-event-action":w,"data-event-label":"Enter Code"},placeholder:"*"})),l().createElement(y.Group,{spacing:8,align:"center",style:{height:40}},l().createElement(_.T,{size:"p4"},a("ssov2.otp.resendQuestion")),l().createElement(_.T,{style:{pointerEvents:F>
320?"none":"auto",cursor:F>0?"not-allowed":"pointer"},size:"s4",color:"blue.6",onClick:()=>sendOTPCode(!0),"data-event-category":O,"data-event-action":w,"data-event-label":"Resend OTP"},a("ssov2.otp.resendText",{count:F})))),l().createElement(h.B,{type:"submit",size:"lg",variant:"primary",mt:12,fullWidth:!0,disabled:c,loading:c,"data-event-category":O,"data-event-action":w,"data-event-label":"Verify",ref:f},a("ssov2.whatsappLogin.verifySubmit")))},InfoIcon=()=>l().createElement("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{minWidth:"16px",position:"relative",top:"2px"}},l().createElement("path",{d:"M8.00004 11.166C8.14177 11.166 8.2605 11.1181 8.35622 11.0222C8.45194 10.9264 8.4998 10.8077 8.4998 10.666V7.83265C8.4998 7.69099 8.45187 7.57225 8.356 7.47642C8.26013 7.38058 8.14133 7.33267 7.9996 7.33267C7.85787 7.33267 7.73914 7.38058 7.64342 7.47642C7.5477 7.57225 7.49984 7.69099 7.49984 7.83265V10.666C7.49984 10.8077 7.54777 10.9264 7.64364 11.0222C7.73951 11.1181 7.85831 11.166 8.00004 11.166ZM7.99982 6.19165C8.15239 6.19165 8.28027 6.14005 8.38347 6.03685C8.48667 5.93365 8.53827 5.80577 8.53827 5.6532C8.53827 5.50064 8.48667 5.37276 8.38347 5.26955C8.28027 5.16635 8.15239 5.11475 7.99982 5.11475C7.84725 5.11475 7.71937 5.16635 7.61617 5.26955C7.51297 5.37276 7.46137 5.50064 7.46137 5.6532C7.46137 5.80577 7.51297 5.93365 7.61617 6.03685C7.71937 6.14005 7.84725 6.19165 7.99982 6.19165ZM8.00094 14.3327C7.12498 14.3327 6.30163 14.1664 5.53087 13.834C4.7601 13.5015 4.08965 13.0504 3.5195 12.4805C2.94935 11.9106 2.49798 11.2404 2.16539 10.47C1.8328 9.69959 1.6665 8.8764 1.6665 8.00045C1.6665 7.12449 1.83273 6.30114 2.16517 5.53038C2.49762 4.75962 2.94878 4.08916 3.51867 3.51902C4.08857 2.94886 4.75873 2.49749 5.52915 2.1649C6.29956 1.83231 7.12275 1.66602 7.9987 1.66602C8.87466 1.66602 9.69802 1.83224 10.4688 2.16468C11.2395 2.49713 11.91 2.94829 12.4801 3.51818C13.0503 4.08808 13.5017 4.75824 13.8343 5.52867C14.1668 6.29908 14.3331 7.12226 14.3331 7.99822C14.3331 8.87417 14.1669 9.69753 13.8345 10.4683C13.502 11.239 13.0509 11.9095 12.481 12.4796C11.9111 13.0498 11.2409 13.5012 10.4705 13.8338C9.70008 14.1664 8.87689 14.3327 8.00094 14.3327ZM7.99982 13.3327C9.48871 13.3327 10.7498 12.816 11.7832 11.7827C12.8165 10.7493 13.3332 9.48822 13.3332 7.99933C13.3332 6.51044 12.8165 5.24933 11.7832 4.216C10.7498 3.18267 9.48871 2.666 7.99982 2.666C6.51093 2.666 5.24982 3.18267 4.21649 4.216C3.18315 5.24933 2.66649 6.51044 2.66649 7.99933C2.66649 9.48822 3.18315 10.7493 4.21649 11.7827C5.24982 12.816 6.51093 13.3327 7.99982 13.3327Z",fill:"#2D87F3"})),SSOWhatsAppPhoneVerifyScreen=({hidden:e,config:t})=>{let{t:a}=(0,C.u)(),[i,d]=l().useState(""),[s,c]=l().useState(!1),[u,p]=l().useState(""),{locale:v,setTracking:m}=useSSOState(),{addStep:g,goNext:f}=(0,T.a)(),S=null==t?void 0:t.referrer,E=!!(null==t?void 0:t.useAuthenticatedWhatsAppApis),b="SSO - WhatsApp Login",P="Enter WhatsApp phone";return(0,n.useEffect)(()=>{e||(p(""),m({category:b,action:P}))},[e]),l().createElement("div",{style:{display:e?"none":"block"}},l().createElement(y.Stack,{spacing:24},l().createElement(y.Box,{sx:{backgroundColor:"#E3F2FF",padding:"12px 16px",borderRadius:"8px",display:"flex",gap:"8px"}},l().createElement(InfoIcon,null),l().createElement(_.T,{styles:{root:{fontSize:"13px"}},color:"gray700"},a("ssov2.whatsappLogin.phoneNotice"))),l().createElement(y.Stack,{spacing:16},l().createElement(r.I.Wrapper,{error:u},l().createElement(eC,{defaultCountry:v&&j.M[v]||"VN",value:i,onChange:e=>{d(e),p("")},isError:!!u,required:!0,name:"phone",disabled:s,placeholder:a("ssov2.setup.field.phone.label"),"data-event-category":b,"data-event-action":P,"data-event-label":"Enter Phone",trackingFn:(0,n.useCallback)(e=>{if(null==e?void 0:e.label)return{"data-event-action":"Country Selection","data-event-label":e.label,"data-event-category":b}},[])})),l().createElement(h.B,{size:"lg",variant:"primary",onClick:()=>(0,o._)(void 0,void 0,void 0,function*(){c(!0);try{let{areaCode:e,phoneNumber:t}=(0,T.s)(i);if(!e||!t||!i)return p(a("ssov2.validate.phone.required")),c(!1);let o=E?{_status:1,code:"Fake_Code"}:yield sendLoginOtpWhatsapp(t,e,S);if((null==o?void 0:o._status)!==1)return p(getErrorTextFromCode(a,null==o?void 0:o.code)),c(!1);g({type:T.S.WHATSAPP_OTP,config:Object.assign({phone:i,referrer:S},E?{useAuthenticatedWhatsAppApis:!0}:{})}),f()}catch(e){console.error(e),p(getErrorTextFromCode(a,""))}c(!1)}),loading:s,disabled:s,"data-event-category":b,"data-event-action":P,"data-event-label":"Continue"},a("ssov2.button.continue")))))},SSOScreenRenderer=()=>{let{steps:e,currentStepIndex:t}=(0,T.a)();return l().createElement(l().Fragment,null,e.map((e,a)=>{let o=a===t,n=`${e.type}-${a}`;switch(e.type){case T.S.FIRST:return l().createElement(SSOFirstScreen,{key:n,hidden:!o,config:e.config});case T.S.WHATSAPP_PHONE_VERIFY:return l().createElement(SSOWhatsAppPhoneVerifyScreen,{key:n,hidden:!o,index:a,config:e.config});case T.S.WHATSAPP_OTP:return l().createElement(SSOWhatsAppOTPScreen,{key:n,hidden:!o,index:a,config:e.config});case T.S.PASSWORD:return l().createElement(SSOPasswordScreen,{key:n+"-"+t,hidden:!o,index:a,config:e.config});case T.S.FORGOT_PASSWORD_PHONE:return l().createElement(SSOPasswordForgotPhone,{key:n,hidden:!o,index:a,config:e.config});case T.S.FORGOT_PASSWORD_SETUP:return l().createElement(SSOPasswordForgotSetup,{key:n+"-"+t,hidden:!o,config:e.config});case T.S.OTP:let{phone:i,email:r,otpType:d}=e.config||{};return l().createElement(SSOOTPScreen,{key:[n,i,r,d].join("-"),hidden:!o,index:a,config:e.config});case T.S.EMAIL:return l().createElement(SSOEmailScreen,{key:n,hidden:!o,index:a,config:e.config});case T.S.SETUP_FULL:return l().createElement(SSOSetupScreen,{key:n,hidden:!o,index:a,config:e.config});case T.S.VERIFY_PHONE:return l().createElement(SSOPhoneVerify,{key:n,hidden:!o,index:a,config:e.config});case T.S.UPDATE_EMAIL:return l().createElement(SSOUpdateEmailScreen,{key:n,hidden:!o,index:a,config:e.config});default:return l().createElement("div",{key:n},"Not found")}}))};Array.prototype.findLastIndex||(Array.prototype.findLastIndex=function(e,t){for(let a=this.length-1;a>=0;a--)if(e.call(t,this[a],a,this))return a;return -1}),String.prototype.capitalize||(String.prototype.capitalize=function(){return this.charAt(0).toUpperCase()+this.slice(1)});let SSOV2=({onClose:e,locale:t})=>{let{isOpen:a,setOpen:s,returnUrl:c,setMounted:u,source:p,overrideClose:v,setOnCloseProp:m,forceReloadOnClose
32:g,setABTestFlow:h}=(0,T.u)();if((0,n.useEffect)(()=>(u(!0),()=>{u(!1)}),[]),(0,n.useEffect)(()=>{a?document.body.classList.add("sso-v2-opening"):document.body.classList.remove("sso-v2-opening")},[a]),(0,n.useEffect)(()=>{m(e)},[e]),(0,n.useEffect)(()=>{let e=k.H[t],a=(0,i.Ri)("abTestingFlow");fetchFeatureFlag(e).then(e=>{if((null==e?void 0:e.is_enabled)&&(0,F.d)(null==e?void 0:e.products)){if(a)h(a);else{let t=e.a_percentage;Math.floor(100*Math.random()+1)<=t?((0,i.TV)("abTestingFlow","A",{days:30}),h("A")):((0,i.TV)("abTestingFlow","B",{days:30}),h("B"))}}else(0,i.Yj)("abTestingFlow")})},[t]),!a)return null;let onClose=t=>(0,o._)(void 0,void 0,void 0,function*(){var a;if(t&&v){v();return}s(!1);let o=!1;if(t)o=(0,T.r)(c,p,g);else{let e=yield(0,d.g)();(null===(a=null==e?void 0:e._data)||void 0===a?void 0:a.id)?o=(0,T.r)(c,p,g):g&&(window.location.reload(),o=!0)}o||null==e||e()});return l().createElement(r.h,null,l().createElement(SSOStateProvider,{onClose:onClose,locale:t},l().createElement(SSOPopupWrapper,{opened:!0,onClose:onClose},l().createElement(SSOScreenRenderer,null))))}}}]);

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.