1"use strict";(self.webpackChunkhhgDiscoverV1=self.webpackChunkhhgDiscoverV1||[]).push([[4575],{"ei/7":function(e,o,t){let i;t.d(o,{B:function(){return f},F:function(){return h},G:function(){return _},S:function(){return c},a:function(){return getSSOCurrentLocale},b:function(){return fetchSSOV2ApiJson},c:function(){return checkUserExist},f:function(){return fetchSSOV2Api},g:function(){return getUserInfo},h:function(){return handleAuthSuccess},l:function(){return v},r:function(){return resetPassword},s:function(){return setSSOCurrentLocale},u:function(){return updateUserInfo},w:function(){return p}});var n=t("mup0");if(8068==t.j)var r=t("GOBr");var l=t("LtKL"),d=t("9VLu");if(8068==t.j)var a=t("27Mu");var s=t("11Kd");if(8068==t.j)var u=t("xrdX");let c={LOGIN_BY_SOCIAL:"member/social-login",EMAIL:{REGISTER_BY_SEND_OTP:"login/login-with-email",LOGIN_BY_PASSWORD:"member/login",VERIFY_BY_OTP:"login/email-verify-code",SEND_OTP:"login/email-resend-otp-code"},PHONE:{REGISTER_BY_SEND_OTP:"login/login-with-sms",SEND_OTP:"login/sms/sent-otp",VERIFY_BY_OTP:"login/phone-verify-code",LOGIN_BY_PASSWORD:"member/login-by-phone",UPDATE_PHONE_SEND_OTP:"login/sms-social/sent-otp",UPDATE_PHONE_VERIFY_OTP:"login/sms-social/phone-verify-code"},WHATSAPP:{LOGIN_OTP_WHATSAPP:"login/login-otp-whatsapp",REGISTER_BY_SEND_OTP:"login/login-with-whatsapp",SEND_OTP:"login/whatsapp/sent-otp",UPDATE_PHONE_SEND_OTP:"login/sms-social/whatsapp/sent-otp",UPDATE_PHONE_VERIFY_OTP:"login/sms-social/whatsapp-verify-code",VERIFY_BY_OTP:"login/whatsapp-verify-code"}
1,ZALO:{REGISTER_BY_SEND_OTP:"login/login-with-zalo",SEND_OTP:"login/zalo/sent-otp",VERIFY_BY_OTP:"login/zalo-verify-code",UPDATE_PHONE_SEND_OTP:"login/sms-social/zalo/sent-otp",UPDATE_PHONE_VERIFY_OTP:"login/sms-social/zalo-verify-code"},RESET_PASSWORD:"login/reset-password",CHECK_USER_EXIST:"member/check-user-exist",UPDATE_USER_INFO:"login/update-first-info",SETUP_USER_INFO:"login/setup-first-info",ECOM_CARE:{SEND_OTP:"login/ecom-care/send-email-otp-code",VERIFY_OTP:"login/ecom-care/email-verify-code",RESEND_OTP:"login/ecom-care/resend-email-otp-code"}},v="vi-VN",p={[s.L.Vietnam]:"1",[s.L.Indonesia]:"2",[s.L.Malaysia]:"3"}[v];d.L[v].PHONE;let setSSOCurrentLocale=e=>{i=e},getSSOCurrentLocale=()=>i||v,getSSOV2ApiUrl=(e,o)=>{let t=o||i||v;return(0,l.e)(`${(0,l.a)(t)}/api/v2/${e}`)},getSSOApiUrl=(e,o)=>{let t=o||i||v;return(0,l.e)(`${(0,l.a)(t)}/api/${e}`)},f="hhg_user_token",fetchSSOV2Api=(e,o={},t)=>(0,n._)(void 0,void 0,void 0,function*(){var i;let n;let r=t?"":null===(i=document.cookie.split("; ").find(e=>e.startsWith(f)))||void 0===i?void 0:i.split("=")[1];try{o.body instanceof FormData&&(o.body.append("ga_client_id",(0,a.Ri)("_ga")||""),o.body.append("referrer",window.location.href)),n=yield fetch(getSSOV2ApiUrl(e),r?Object.assign(Object.assign({},o),{headers:Object.assign({Authorization:`Bearer ${r}`},null==o?void 0:o.headers)}):o)}catch(e){return console.error(e),null}return null==n?void 0:n.json()}),fetchSSOV2ApiJson=(e,o,t)=>(0,n._)(void 0,void 0,void 0,function*(){var i;let n;let r=t?"":null===(i=document.cookie.split("; ").find(e=>e.startsWith(f)))||void 0===i?void 0:i.split("=")[1];try{n=yield fetch(getSSOV2ApiUrl(e),{method:"POST",headers:Object.assign({Accept:"application/json","Content-Type":"application/json"},r?{Authorization:`Bearer ${r}`}:{}),body:JSON.stringify(o)})}catch(e){return console.error(e),null}return null==n?void 0:n.json()}),fetchSSOApi=(e,o={},t)=>(0,n._)(void 0,void 0,void 0,function*(){var i;let n;let r=t?"":null===(i=document.cookie.split("; ").find(e=>e.startsWith(f)))||void 0===i?void 0:i.split("=")[1];try{n=yield fetch(getSSOApiUrl(e),r?Object.assign(Object.assign({},o),{headers:Object.assign({Authorization:`Bearer ${r}`},null==o?void 0:o.headers)}):o)}catch(e){return console.error(e),null}return null==n?void 0:n.json()}),resetPassword=(e,o)=>(0,n._)(void 0,void 0,void 0,function*(){let t=new FormData;return t.append("password",e),t.append("confirm-password",o),fetchSSOV2Api(c.RESET_PASSWORD,{method:"POST",body:t})}),checkUserExist=({email:e,phone:o})=>(0,n._)(void 0,void 0,void 0,function*(){let t=new FormData;return e?t.append("email",e):t.append("phone_number",o),fetchSSOV2Api(c.CHECK_USER_EXIST,{method:"POST",body:t})}),updateUserInfo=e=>(0,n._)(void 0,void 0,void 0,function*(){let o=new FormData;return Object.keys(e).forEach(t=>{let i=e[t];null!=i&&("string"!=typeof i||i.trim())&&o.append(t,e[t])}),fetchSSOV2Api(c.SETUP_USER_INFO,{method:"POST",body:o})}),_=8068==t.j?r.K?"289442006438-040a42cbidr6v5d178f3iqi9q95821r3.apps.googleusercontent.com":"289442006438-cihobuq1h3r4426pur7u0e43fqdnep59.apps.googleusercontent.com":null,h="2759888574045636",getUserInfo=()=>(0,n._)(void 0,void 0,void 0,function*(){return fetchSSOApi("user/profile",{method:"POST"})}),handleAuthSuccess=e=>{let o=getSSOCurrentLocale();(null==e?void 0:e.token)&&(0,a.TV)(f,e.token,{domain:"localhost"===window.location.hostname?"localhost":`.${u.y[o]}`,expires:new Date(1e3*e.expire_in).toUTCString()}),(null==e?void 0:e.refresh_token)&&(0,a.TV)(d.k,e.refresh_token,{domain:"localhost"===window.location.hostname?"localhost":`.${u.y[o]}`})}},LtKL:function(e,o,t){t.d(o,{a:function(){return getCurrentSsoUrl},b:function(){return getTogetherApiDomain},c:function(){return getDiscoverApiDomain},d:function(){return getCareApiDomain},e:function(){return normalizeLinkSlash},g:function(){return getCurrentBaseUrl},n:function(){return normalizeLink},r:function(){return resolveDiscoverNavLink}});var i=t("xrdX"),n=t("GOBr"),r=t("yNk5");let getCurrentBaseUrl=(e,o)=>{let t=!n.K;return`https://${t?o?"fe.":"discover.":o?"www.":""}${i.y[o?"vi-VN_MB":e]}`},getCurrentSsoUrl=(e,o)=>r.env.UNIFY_SSO_API||`https://${n.K?"id.":"staging-id."}${i.y[o?"vi-VN_MB":e]}`,getTogetherApiDomain=()=>
1r.env.UNIFY_INTERNAL_TOGETHER_API||r.env.UNIFY_TOGETHER_API||`https://${n.K?"together.":"staging-together."}hellohealthgroup.com`,getDiscoverApiDomain=e=>{let o=e.endsWith("_MB");return o?`https://${n.K?"wp.":"staging."}${i.y[e]}`:r.env.UNIFY_INTERNAL_DISCOVER_API||r.env.UNIFY_DISCOVER_API||`https://${n.K?"wp.":"staging."}${i.y[e]}`},getCareApiDomain=()=>r.env.UNIFY_INTERNAL_CARE_API||r.env.UNIFY_CARE_API||`https://${n.K?"health-care.":"service-health-care."}hellohealthgroup.com`,normalizeLinkSlash=e=>e.replace(/([^:]\/)\/+/g,"$1"),forceEndSlash=e=>e.replace(/\/?$/,"/"),normalizeLink=e=>normalizeLinkSlash(forceEndSlash(e)),resolveDiscoverNavLink=(e,o="")=>{if(!o)return normalizeLinkSlash(e);if(o.startsWith("http://")||o.startsWith("https://"))return normalizeLinkSlash(o);let t=o.startsWith("/")?o:`/${o}`;return normalizeLinkSlash(`${e}${t}`)}},c5l1:function(e,o,t){t.d(o,{I:function(){return IS_SSOV2_ENABLED},S:function(){return n},a:function(){return v},b:function(){return isPhoneNotVerifedYet},c:function(){return isLoginWithPhoneNotVerifedYet},d:function(){return isFlowFinishedSetup},i:function(){return isUserFinishedSetup}
1,r:function(){return redirect},s:function(){return splitPhone},u:function(){return p}});var i,n,r=t("mup0"),l=t("VNqU"),d=t("ei/7");if(8068==t.j)var a=t("A9bs");var s=t("9VLu"),u=t("27Mu"),c=t("yNk5");let mergePhone=(e,o)=>{let t=o.startsWith("+")?o:`+${o}`,i=e.startsWith("0")?e.slice(1):e;return`${t}${i}`},splitPhone=e=>{if(!e)return{areaCode:void 0,phoneNumber:void 0};let o=(0,a.parsePhoneNumber)(e);return{areaCode:o.countryCallingCode?"+"+o.countryCallingCode:"",phoneNumber:o.nationalNumber||""}};(i=n||(n={})).FIRST="first",i.WHATSAPP_PHONE_VERIFY="whatsapp_phone_verify",i.WHATSAPP_OTP="whatsapp_otp",i.EMAIL="email",i.VERIFY_PHONE="verify_phone",i.PASSWORD="password",i.UPDATE_EMAIL="update_email",i.FORGOT_PASSWORD_PHONE="forgot_password_phone",i.FORGOT_PASSWORD_SETUP="forgot_password_setup",i.OTP="otp",i.SETUP_FULL="setup_full";let v=(0,l.vt)(e=>({currentStepIndex:0,steps:[{type:n.FIRST}],setSteps:o=>e(e=>({steps:"function"==typeof o?o(e.steps):o})),addStep:o=>{e(e=>({steps:[...e.steps,o]}))},goNext:()=>{e(e=>({currentStepIndex:e.currentStepIndex+1}))},goBack:()=>{e(e=>({currentStepIndex:e.currentStepIndex-1,steps:e.steps.slice(0,e.steps.length-1)}))}})),p=(0,l.vt)()((e,o)=>({isHaveReadAndAgreePolicy:!1,setIsHaveReadAndAgreePolicy:o=>e({isHaveReadAndAgreePolicy:o}),isGetUpdateFromHHG:!1,setIsGetUpdateFromHHG:o=>e({isGetUpdateFromHHG:o}),userInfo:void 0,abTestFlow:"A",setABTestFlow(o){e({abTestFlow:o})},setUserInfo:o=>e({userInfo:o}),isOpen:!1,setOpen:o=>e({isOpen:o}),returnUrl:void 0,setReturnUrl:o=>e({returnUrl:o}),mounted:!1,setMounted:o=>e({mounted:o}),source:void 0,setSource:o=>e({source:o}),setupSource:void 0,setSetupSource:o=>e({setupSource:o}),setOnCloseProp:o=>e({onCloseProp:o}),setSSOCurrentLocale:e=>(0,d.s)(e),triggerLogin:t=>{var i,r;let{source:l,returnUrl:a,locale:c}=t||{};(0,d.s)(c);let p=(0,u.Ri)(s.B);p?(redirect(null==t?void 0:t.returnUrl,null==t?void 0:t.source,null==t?void 0:t.forceReloadOnClose),e({isOpen:!1}),null===(r=(i=o()).onCloseProp)||void 0===r||r.call(i)):(v.setState({steps:[{type:n.FIRST,config:{legalTextType:((null==a?void 0:a.includes("joincommunity=1"))?"community":null==t?void 0:t.legalTextType)||"default"}}],currentStepIndex:0}),e({isOpen:!0,returnUrl:a,source:l,overrideClose:void 0,forceReloadOnClose
1:null!=a&&!!a.includes("joincommunity=1")||(null==t?void 0:t.forceReloadOnClose)||!1,flowData:void 0,userInfo:void 0}))},triggerWhatsappLogin:o=>{let{source:t,returnUrl:i,referrer:r,forceReloadOnClose:l,isAlreadyLogin:d,phone_number:a,area_code:s}=o||{},u=d&&a&&s;if(u){let e=mergePhone(String(a),s);v.setState({steps:[{type:n.WHATSAPP_OTP,config:{phone:e,referrer:r,useAuthenticatedWhatsAppApis:!0}}],currentStepIndex:0})}else v.setState({steps:[{type:n.WHATSAPP_PHONE_VERIFY,config:Object.assign({referrer:r},d?{useAuthenticatedWhatsAppApis:!0}:{})}],currentStepIndex:0});e({isOpen:!0,returnUrl:i,source:t,overrideClose:void 0,forceReloadOnClose:l||!1,flowData:{method:"whatsapp",flow:"login"},userInfo:void 0})},triggerCareEmailPhoneVerify:t=>(0,r._)(void 0,void 0,void 0,function*(){var i,l,a;let s=yield(0,d.g)();(null===(i=null==s?void 0:s._data)||void 0===i?void 0:i.first_time_login)&&(s._data.first_time_login=0),e({userInfo:null==s?void 0:s._data});let forceUpdatePhoneEmail=i=>(0,r._)(void 0,void 0,void 0,function*(){var r,l,a,s,u,c,p,f,_,h,S,g,m,O,P;let E=yield(0,d.g)(),A=null===(r=null==E?void 0:E._data)||void 0===r?void 0:r.email,T=!A||A.endsWith("@hhg.com")||A.endsWith("@facebook.com")?void 0:A,I=(null==t?void 0:t.email)||T,U=!!(null===(l=null==E?void 0:E._data)||void 0===l?void 0:l.phone)&&!!(null===(a=null==E?void 0:E._data)||void 0===a?void 0:a.phone_verified_at),w=!!(null===(s=null==E?void 0:E._data)||void 0===s?void 0:s.email)&&!!(null===(u=null==E?void 0:E._data)||void 0===u?void 0:u.email_verified_at)&&!(null===(p=null===(c=null==E?void 0:E._data)||void 0===c?void 0:c.email)||void 0===p?void 0:p.endsWith("@hhg.com"))&&!(null===(_=null===(f=null==E?void 0:E._data)||void 0===f?void 0:f.email)||void 0===_?void 0:_.endsWith("@facebook.com")),y=!!(null===(h=null==E?void 0:E._data)||void 0===h?void 0:h.name),R=!!(null===(S=null==E?void 0:E._data)||void 0===S?void 0:S.birthday),N="number"==typeof(null===(g=null==E?void 0:E._data)||void 0===g?void 0:g.gender),D=null===(m=null==E?void 0:E._data)||void 0===m?void 0:m.provider;U&&w?(null==t?void 0:t.skipForceSetup)||y&&R&&N?(redirect(null==t?void 0:t.returnUrl,null==t?void 0:t.source,!0),e({isOpen:!1,forceReloadOnClose
1:!1}),null===(P=(O=o()).onCloseProp)||void 0===P||P.call(O)):(v.setState({steps:[{type:n.SETUP_FULL,config:{userInfo:E._data}}],currentStepIndex:0}),e(e=>Object.assign({source:null==t?void 0:t.source,returnUrl:null==t?void 0:t.returnUrl,isOpen:!0,overrideClose:void 0,forceReloadOnClose:!0},i&&!e.flowData?{flowData:getSSOFlowFromUserProfile(null==E?void 0:E._data)}:{}))):(v.setState({steps:[{type:U?n.UPDATE_EMAIL:n.VERIFY_PHONE,config:U||w?{provider:D,afterAction:(null==t?void 0:t.skipForceSetup)?"done":"setup",email:I}:{provider:D,afterAction:"update-email",email:I}}],currentStepIndex:0}),e(e=>Object.assign({source:null==t?void 0:t.source,returnUrl:null==t?void 0:t.returnUrl,isOpen:!0,overrideClose:void 0,forceReloadOnClose:!0},i&&!e.flowData?{flowData:getSSOFlowFromUserProfile(null==E?void 0:E._data)}:{})))});if(null===(l=null==s?void 0:s._data)||void 0===l?void 0:l.id)forceUpdatePhoneEmail(!0);else{v.setState({steps:[{type:n.FIRST,config:{legalTextType:((null===(a=null==t?void 0:t.returnUrl)||void 0===a?void 0:a.includes("joincommunity=1"))?"community":null==t?void 0:t.legalTextType)||"default"}}],currentStepIndex:0}),e({isOpen:!0,overrideClose:forceUpdatePhoneEmail,source:null==t?void 0:t.source,returnUrl:null==t?void 0:t.returnUrl,forceReloadOnClose
1:!0,flowData:void 0});return}}),triggerCommunityEmailVerify:t=>(0,r._)(void 0,void 0,void 0,function*(){var i,l,a;let s=yield(0,d.g)();(null===(i=null==s?void 0:s._data)||void 0===i?void 0:i.first_time_login)&&(s._data.first_time_login=0),e({userInfo:null==s?void 0:s._data});let forceUpdateEmail=i=>(0,r._)(void 0,void 0,void 0,function*(){var r,l,a,s,u,c,p,f,_,h,S,g;let m=yield(0,d.g)(),O=!!(null===(r=null==m?void 0:m._data)||void 0===r?void 0:r.email)&&!!(null===(l=null==m?void 0:m._data)||void 0===l?void 0:l.email_verified_at)&&!(null===(s=null===(a=null==m?void 0:m._data)||void 0===a?void 0:a.email)||void 0===s?void 0:s.endsWith("@hhg.com"))&&!(null===(c=null===(u=null==m?void 0:m._data)||void 0===u?void 0:u.email)||void 0===c?void 0:c.endsWith("@facebook.com")),P=!!(null===(p=null==m?void 0:m._data)||void 0===p?void 0:p.name),E=!!(null===(f=null==m?void 0:m._data)||void 0===f?void 0:f.birthday),A="number"==typeof(null===(_=null==m?void 0:m._data)||void 0===_?void 0:_.gender),T=null===(h=null==m?void 0:m._data)||void 0===h?void 0:h.provider;O?P&&E&&A?(redirect(null==t?void 0:t.returnUrl,null==t?void 0:t.source,!0),e({isOpen:!1,forceReloadOnClose
1:!1}),null===(g=(S=o()).onCloseProp)||void 0===g||g.call(S)):(v.setState({steps:[{type:n.SETUP_FULL,config:{userInfo:m._data}}],currentStepIndex:0}),e(e=>Object.assign({source:null==t?void 0:t.source,returnUrl:null==t?void 0:t.returnUrl,isOpen:!0,overrideClose:void 0,forceReloadOnClose:!0},i&&!e.flowData?{flowData:getSSOFlowFromUserProfile(null==m?void 0:m._data)}:{}))):(v.setState({steps:[{type:n.UPDATE_EMAIL,config:{provider:T,afterAction:"setup"}}].filter(Boolean),currentStepIndex:0}),e(e=>Object.assign({source:null==t?void 0:t.source,returnUrl:null==t?void 0:t.returnUrl,isOpen:!0,overrideClose:void 0,forceReloadOnClose:(null==t?void 0:t.forceReloadOnClose)||!1},i&&!e.flowData?{flowData:getSSOFlowFromUserProfile(null==m?void 0:m._data)}:{})))});if(null===(l=null==s?void 0:s._data)||void 0===l?void 0:l.id)forceUpdateEmail(!0);else{v.setState({steps:[{type:n.FIRST,config:{legalTextType:((null===(a=null==t?void 0:t.returnUrl)||void 0===a?void 0:a.includes("joincommunity=1"))?"community":null==t?void 0:t.legalTextType)||"default"}}],currentStepIndex:0}),e({isOpen:!0,overrideClose:forceUpdateEmail,source:null==t?void 0:t.source,returnUrl:null==t?void 0:t.returnUrl,forceReloadOnClose
1:!0,flowData:void 0});return}}),forceReloadOnClose:!1})),redirect=(e,o,t)=>{if(t){let t;return t=(null==e?void 0:e.startsWith("http"))||(null==e?void 0:e.startsWith("//"))?new URL(e):e?new URL(e,window.location.href):new URL(window.location.href),o&&t.searchParams.set("source",o),window.location.href=t.href,!0}let i=new URL(window.location.href);if(e){let t;t=e.startsWith("http")||e.startsWith("//")?new URL(e):new URL(e,window.location.href);let n=t.searchParams.get("source");i.searchParams.delete("source"),t.searchParams.delete("source");let r=n||o;if(i.href!==t.href)return r&&t.searchParams.set("source",r||""),window.location.href=t.href,!0}if(o){i.searchParams.set("source",o),window.history.replaceState({},"",i.href);return}},f=["vi-VN","id-ID","ms-MY"],IS_SSOV2_ENABLED=e=>!c.env.NEXT_PUBLIC_MARRY_BABY&&f.includes(e||c.env.UNIFY_LOCALE||(0,d.a)()||""),getSSOFlowFromUserProfile=e=>{if(!e)throw Error("userInfo is required");let o=!!(null==e?void 0:e.name),t=!!(null==e?void 0:e.birthday),i="number"==typeof(null==e?void 0:e.gender);return{flow:o&&t&&i?"signup":"login",method:(null==e?void 0:e.provider)||"email"}},isUserFinishedSetup=e=>{if(!e)throw Error("userInfo is required");let o=!!(null==e?void 0:e.name),t=!!(null==e?void 0:e.birthday),i="number"==typeof(null==e?void 0:e.gender);return o&&t&&i},isFlowFinishedSetup=e=>{var o,t,i;return(null===(o=null==e?void 0:e.metaData)||void 0===o?void 0:o.is_gender)&&(null===(t=null==e?void 0:e.metaData)||void 0===t?void 0:t.is_name)&&(null===(i=null==e?void 0:e.metaData)||void 0===i?void 0:i.is_birthday)},isPhoneNotVerifedYet=e=>!(null==e?void 0:e.phone_verified_at)||!(null==e?void 0:e.phone),isLoginWithPhoneNotVerifedYet=(e,o)=>(null==e?void 0:e.flow)==="login"&&(null==o?void 0:o.phone)&&(null==o?void 0:o.area_code)&&!(null==o?void 0:o.phone_verified_at)}}]);
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.