"use strict";(self.webpackChunkhhgHealthCareV1=self.webpackChunkhhgHealthCareV1||[]).push([[4397],{13148:function(o,e,i){i.d(e,{B:function(){return f},F:function(){return E},G:function(){return O},S:function(){return s},c:function(){return m},f:function(){return p},g:function(){return S},h:function(){return y},l:function(){return v},r:function(){return h},u:function(){return g},w:function(){return c}});var n=i(12033);if(8068==i.j)var t=i(6432);var l=i(95762),r=i(54840);if(8068==i.j)var d=i(6806);var a=i(66405);if(8068==i.j)var u=i(27516);const s={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:{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"},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",c={[a.L.Vietnam]:"1",[a.L.Indonesia]:"2",[a.L.Malaysia]:"3"}[v];r.L[v].PHONE;const f="hhg_user_token",p=(o,e={},i)=>(0,n.a)(void 0,void 0,void 0,(function*(){var n;let t;const r=i?"":null===(n=document.cookie.split("; ").find((o=>o.startsWith(f))))||void 0===n?void 0:n.split("=")[1];try{e.body instanceof FormData&&(e.body.append("ga_client_id",(0,d.Ri)("_ga")||""),e.body.append("referrer",window.location.href)),t=yield fetch((o=>(0,l.n)(`${(0,l.a)(v)}/api/v2/${o}`))(o),r?Object.assign(Object.assign({},e),{headers:Object.assign({Authorization:`Bearer ${r}`},null===e||void 0===e?void 0:e.headers)}):e)}catch(a){return console.error(a),null}return null===t||void 0===t?void 0:t.json()})),_=(o,e={},i)=>(0,n.a)(void 0,void 0,void 0,(function*(){var n;let t;const r=i?"":null===(n=document.cookie.split("; ").find((o=>o.startsWith(f))))||void 0===n?void 0:n.split("=")[1];try{t=yield fetch((o=>(0,l.n)(`${(0,l.a)(v)}/api/${o}`))(o),r?Object.assign(Object.assign({},e),{headers:Object.assign({Authorization:`Bearer ${r}`},null===e||void 0===e?void 0:e.headers)}):e)}catch(d){return console.error(d),null}return null===t||void 0===t?void 0:t.json()})),h=(o,e)=>(0,n.a)(void 0,void 0,void 0,(function*(){const i=new FormData;return i.append("password",o),i.append("confirm-password",e),p(s.RESET_PASSWORD,{method:"POST",body:i})})),m=({email:o,phone:e})=>(0,n.a)(void 0,void 0,void 0,(function*(){const i=new FormData;return o?i.append("email",o):i.append("phone_number",e),p(s.CHECK_USER_EXIST,{method:"POST",body:i})})),g=o=>(0,n.a)(void 0,void 0,void 0,(function*(){const e=new FormData;return Object.keys(o).forEach((i=>{const n=o[i];"undefined"===typeof n||null===n||"string"===typeof n&&!n.trim()||e.append(i,o[i])})),p(s.SETUP_USER_INFO,{method:"POST",body:e})})),O=8068==i.j?t.K?"289442006438-040a42cbidr6v5d178f3iqi9q95821r3.apps.googleusercontent.com":"289442006438-cihobuq1h3r4426pur7u0e43fqdnep59.apps.googleusercontent.com":null,E="2759888574045636",S=()=>(0,n.a)(void 0,void 0,void 0,(function*(){return _("user/profile",{method:"POST"})})),y=o=>{(null===o||void 0===o?void 0:o.token)&&(0,d.TV)(f,o.token,{domain:"localhost"===window.location.hostname?"localhost":`.${u.y[v]}`,expires:new Date(1e3*o.expire_in).toUTCString()}),(null===o||void 0===o?void 0:o.refresh_token)&&(0,d.TV)(r.k,o.refresh_token,{domain:"localhost"===window.location.hostname?"localhost":`.${u.y[v]}`})}},95762:function(o,e,i){i.d(e,{a:function(){return d},b:function(){return a},c:function(){return u},d:function(){return s},e:function(){return c},g:function(){return r},n:function(){return v}});var n=i(27516),t=i(6432),l=i(65606);const r=(o,e)=>`https://${!t.K?e?"fe.":"discover.":e?"www.":""}${n.y[e?"vi-VN_MB":o]}`,d=(o,e)=>l.env.UNIFY_SSO_API||`https://${t.K?"id.":"staging-id."}${n.y[e?"vi-VN_MB":o]}`,a=()=>l.env.UNIFY_INTERNAL_TOGETHER_API||l.env.UNIFY_TOGETHER_API||`https://${t.K?"together.":"staging-together."}hellohealthgroup.com`,u=o=>o.endsWith("_MB")?`https://${t.K?"wp.":"staging."}${n.y[o]}`:l.env.UNIFY_INTERNAL_DISCOVER_API||l.env.UNIFY_DISCOVER_API||`https://${t.K?"wp.":"staging."}${n.y[o]}`,s=()=>l.env.UNIFY_INTERNAL_CARE_API||l.env.UNIFY_CARE_API||`https://${t.K?"health-care.":"service-health-care."}hellohealthgroup.com`,v=o=>o.replace(/([^:]\/)\/+/g,"$1"),c=o=>v((o=>o.replace(/\/?$/,"/"))(o))},92935:function(o,e,i){i.d(e,{I:function(){return p},S:function(){return n},a:function(){return s},b:function(){return g},c:function(){return O},d:function(){return m},i:function(){return h},r:function(){return c},u:function(){return v}});var n,t=i(12033),l=i(44745),r=i(13148),d=i(54840),a=i(6806),u=i(65606);!function(o){o.FIRST="first",o.EMAIL="email",o.VERIFY_PHONE="verify_phone",o.PASSWORD="password",o.UPDATE_EMAIL="update_email",o.FORGOT_PASSWORD_PHONE="forgot_password_phone",o.FORGOT_PASSWORD_SETUP="forgot_password_setup",o.OTP="otp",o.SETUP_FULL="setup_full"}(n||(n={}));const s=(0,l.vt)((o=>({currentStepIndex:0,steps:[{type:n.FIRST}],setSteps:e=>o((o=>({steps:"function"===typeof e?e(o.steps):e}))),addStep:e=>{o((o=>({steps:[...o.steps,e]})))},goNext:()=>{o((o=>({currentStepIndex:o.currentStepIndex+1})))},goBack:()=>{o((o=>({currentStepIndex:o.currentStepIndex-1,steps:o.steps.slice(0,o.steps.length-1)})))}}))),v=(0,l.vt)()(((o,e)=>({userInfo:void 0,abTestFlow:"A",setABTestFlow(e){o({abTestFlow:e})},setUserInfo:e=>o({userInfo:e}),isOpen:!1,setOpen:e=>o({isOpen:e}),returnUrl:void 0,setReturnUrl:e=>o({returnUrl:e}),mounted:!1,setMounted:e=>o({mounted:e}),source:void 0,setSource:e=>o({source:e}),setupSource:void 0,setSetupSource:e=>o({setupSource:e}),setOnCloseProp:e=>o({onCloseProp:e}),triggerLogin:i=>{var t,l;const{source:r,returnUrl:u}=i||{};(0,a.Ri)(d.B)?(c(null===i||void 0===i?void 0:i.returnUrl,null===i||void 0===i?void 0:i.source,null===i||void 0===i?void 0:i.forceReloadOnClose),o({isOpen:!1}),null===(l=(t=e()).onCloseProp)||void 0===l||l.call(t)):(s.setState({steps:[{type:n.FIRST,config:{legalTextType:((null===u||void 0===u?void 0:u.includes("joincommunity=1"))?"community":null===i||void 0===i?void 0:i.legalTextType)||"default"}}],currentStepIndex:0}),o({isOpen:!0,returnUrl:u,source:r,overrideClose:void 0,forceReloadOnClose:!!(null===u||void 0===u?void 0:u.includes("joincommunity=1"))||((null===i||void 0===i?void 0:i.forceReloadOnClose)||!1),flowData:void 0,userInfo:void 0}))},triggerCareEmailPhoneVerify:i=>(0,t.a)(void 0,void 0,void 0,(function*(){var l,d,a;const u=yield(0,r.g)();(null===(l=null===u||void 0===u?void 0:u._data)||void 0===l?void 0:l.first_time_login)&&(u._data.first_time_login=0),o({userInfo:null===u||void 0===u?void 0:u._data});const v=l=>(0,t.a)(void 0,void 0,void 0,(function*(){var t,d,a,u,v,f,p,h,m,g,O,E,S,y,P;const T=yield(0,r.g)(),I=null===(t=null===T||void 0===T?void 0:T._data)||void 0===t?void 0:t.email,w=!I||I.endsWith("@hhg.com")||I.endsWith("@facebook.com")?void 0:I,R=(null===i||void 0===i?void 0:i.email)||w,U=!!(null===(d=null===T||void 0===T?void 0:T._data)||void 0===d?void 0:d.phone)&&!!(null===(a=null===T||void 0===T?void 0:T._data)||void 0===a?void 0:a.phone_verified_at),N=!!(null===(u=null===T||void 0===T?void 0:T._data)||void 0===u?void 0:u.email)&&!!(null===(v=null===T||void 0===T?void 0:T._data)||void 0===v?void 0:v.email_verified_at)&&!(null===(p=null===(f=null===T||void 0===T?void 0:T._data)||void 0===f?void 0:f.email)||void 0===p?void 0:p.endsWith("@hhg.com"))&&!(null===(m=null===(h=null===T||void 0===T?void 0:T._data)||void 0===h?void 0:h.email)||void 0===m?void 0:m.endsWith("@facebook.com")),D=!!(null===(g=null===T||void 0===T?void 0:T._data)||void 0===g?void 0:g.name),b=!!(null===(O=null===T||void 0===T?void 0:T._data)||void 0===O?void 0:O.birthday),A="number"===typeof(null===(E=null===T||void 0===T?void 0:T._data)||void 0===E?void 0:E.gender),C=null===(S=null===T||void 0===T?void 0:T._data)||void 0===S?void 0:S.provider,F=D&&b&&A;U&&N?(null===i||void 0===i?void 0:i.skipForceSetup)||F?(c(null===i||void 0===i?void 0:i.returnUrl,null===i||void 0===i?void 0:i.source,!0),o({isOpen:!1,forceReloadOnClose:!1}),null===(P=(y=e()).onCloseProp)||void 0===P||P.call(y)):(s.setState({steps:[{type:n.SETUP_FULL,config:{userInfo:T._data}}],currentStepIndex:0}),o((o=>Object.assign({source:null===i||void 0===i?void 0:i.source,returnUrl:null===i||void 0===i?void 0:i.returnUrl,isOpen:!0,overrideClose:void 0,forceReloadOnClose:!0},l&&!o.flowData?{flowData:_(null===T||void 0===T?void 0:T._data)}:{})))):(s.setState({steps:[{type:U?n.UPDATE_EMAIL:n.VERIFY_PHONE,config:U||N?{provider:C,afterAction:(null===i||void 0===i?void 0:i.skipForceSetup)?"done":"setup",email:R}:{provider:C,afterAction:"update-email",email:R}}],currentStepIndex:0}),o((o=>Object.assign({source:null===i||void 0===i?void 0:i.source,returnUrl:null===i||void 0===i?void 0:i.returnUrl,isOpen:!0,overrideClose:void 0,forceReloadOnClose:!0},l&&!o.flowData?{flowData:_(null===T||void 0===T?void 0:T._data)}:{}))))}));if(!(null===(d=null===u||void 0===u?void 0:u._data)||void 0===d?void 0:d.id))return s.setState({steps:[{type:n.FIRST,config:{legalTextType:((null===(a=null===i||void 0===i?void 0:i.returnUrl)||void 0===a?void 0:a.includes("joincommunity=1"))?"community":null===i||void 0===i?void 0:i.legalTextType)||"default"}}],currentStepIndex:0}),void o({isOpen:!0,overrideClose:v,source:null===i||void 0===i?void 0:i.source,returnUrl:null===i||void 0===i?void 0:i.returnUrl,forceReloadOnClose:!0,flowData:void 0});v(!0)})),triggerCommunityEmailVerify:i=>(0,t.a)(void 0,void 0,void 0,(function*(){var l,d,a;const u=yield(0,r.g)();(null===(l=null===u||void 0===u?void 0:u._data)||void 0===l?void 0:l.first_time_login)&&(u._data.first_time_login=0),o({userInfo:null===u||void 0===u?void 0:u._data});const v=l=>(0,t.a)(void 0,void 0,void 0,(function*(){var t,d,a,u,v,f,p,h,m,g,O,E;const S=yield(0,r.g)(),y=!!(null===(t=null===S||void 0===S?void 0:S._data)||void 0===t?void 0:t.email)&&!!(null===(d=null===S||void 0===S?void 0:S._data)||void 0===d?void 0:d.email_verified_at)&&!(null===(u=null===(a=null===S||void 0===S?void 0:S._data)||void 0===a?void 0:a.email)||void 0===u?void 0:u.endsWith("@hhg.com"))&&!(null===(f=null===(v=null===S||void 0===S?void 0:S._data)||void 0===v?void 0:v.email)||void 0===f?void 0:f.endsWith("@facebook.com")),P=!!(null===(p=null===S||void 0===S?void 0:S._data)||void 0===p?void 0:p.name),T=!!(null===(h=null===S||void 0===S?void 0:S._data)||void 0===h?void 0:h.birthday),I="number"===typeof(null===(m=null===S||void 0===S?void 0:S._data)||void 0===m?void 0:m.gender),w=null===(g=null===S||void 0===S?void 0:S._data)||void 0===g?void 0:g.provider;y?P&&T&&I?(c(null===i||void 0===i?void 0:i.returnUrl,null===i||void 0===i?void 0:i.source,!0),o({isOpen:!1,forceReloadOnClose:!1}),null===(E=(O=e()).onCloseProp)||void 0===E||E.call(O)):(s.setState({steps:[{type:n.SETUP_FULL,config:{userInfo:S._data}}],currentStepIndex:0}),o((o=>Object.assign({source:null===i||void 0===i?void 0:i.source,returnUrl:null===i||void 0===i?void 0:i.returnUrl,isOpen:!0,overrideClose:void 0,forceReloadOnClose:!0},l&&!o.flowData?{flowData:_(null===S||void 0===S?void 0:S._data)}:{})))):(s.setState({steps:[{type:n.UPDATE_EMAIL,config:{provider:w,afterAction:"setup"}}].filter(Boolean),currentStepIndex:0}),o((o=>Object.assign({source:null===i||void 0===i?void 0:i.source,returnUrl:null===i||void 0===i?void 0:i.returnUrl,isOpen:!0,overrideClose:void 0,forceReloadOnClose:(null===i||void 0===i?void 0:i.forceReloadOnClose)||!1},l&&!o.flowData?{flowData:_(null===S||void 0===S?void 0:S._data)}:{}))))}));if(!(null===(d=null===u||void 0===u?void 0:u._data)||void 0===d?void 0:d.id))return s.setState({steps:[{type:n.FIRST,config:{legalTextType:((null===(a=null===i||void 0===i?void 0:i.returnUrl)||void 0===a?void 0:a.includes("joincommunity=1"))?"community":null===i||void 0===i?void 0:i.legalTextType)||"default"}}],currentStepIndex:0}),void o({isOpen:!0,overrideClose:v,source:null===i||void 0===i?void 0:i.source,returnUrl:null===i||void 0===i?void 0:i.returnUrl,forceReloadOnClose:!0,flowData:void 0});v(!0)})),forceReloadOnClose:!1}))),c=(o,e,i)=>{if(i){let i;return i=(null===o||void 0===o?void 0:o.startsWith("http"))||(null===o||void 0===o?void 0:o.startsWith("//"))?new URL(o):o?new URL(o,window.location.href):new URL(window.location.href),e&&i.searchParams.set("source",e),window.location.href=i.href,!0}const n=new URL(window.location.href);if(o){let i;i=o.startsWith("http")||o.startsWith("//")?new URL(o):new URL(o,window.location.href);const t=i.searchParams.get("source");n.searchParams.delete("source"),i.searchParams.delete("source");const l=t||e;if(n.href!==i.href)return l&&i.searchParams.set("source",l||""),window.location.href=i.href,!0}if(e)return n.searchParams.set("source",e),void window.history.replaceState({},"",n.href)},f=8068==i.j?["vi-VN","id-ID","ms-MY"]:null,p=o=>!u.env.NEXT_PUBLIC_MARRY_BABY&&f.includes(o||u.env.UNIFY_LOCALE||"vi-VN"),_=o=>{if(!o)throw new Error("userInfo is required");const e=!!(null===o||void 0===o?void 0:o.name),i=!!(null===o||void 0===o?void 0:o.birthday),n="number"===typeof(null===o||void 0===o?void 0:o.gender);return{flow:e&&i&&n?"signup":"login",method:(null===o||void 0===o?void 0:o.provider)||"email"}},h=o=>{if(!o)throw new Error("userInfo is required");const e=!!(null===o||void 0===o?void 0:o.name),i=!!(null===o||void 0===o?void 0:o.birthday),n="number"===typeof(null===o||void 0===o?void 0:o.gender);return e&&i&&n},m=o=>{var e,i,n;return(null===(e=null===o||void 0===o?void 0:o.metaData)||void 0===e?void 0:e.is_gender)&&(null===(i=null===o||void 0===o?void 0:o.metaData)||void 0===i?void 0:i.is_name)&&(null===(n=null===o||void 0===o?void 0:o.metaData)||void 0===n?void 0:n.is_birthday)},g=o=>!(null===o||void 0===o?void 0:o.phone_verified_at)||!(null===o||void 0===o?void 0:o.phone),O=(o,e)=>"login"===(null===o||void 0===o?void 0:o.flow)&&(null===e||void 0===e?void 0:e.phone)&&(null===e||void 0===e?void 0:e.area_code)&&!(null===e||void 0===e?void 0:e.phone_verified_at)},50315:function(o,e,i){i.d(e,{B:function(){return h}});var n=i(73884),t=i.n(n),l=i(86566),r=i(50736),d=i(9103),a=(0,r.r)(((o,{spacing:e,align:i,justify:n})=>({root:{display:"flex",flexDirection:"column",alignItems:i,justifyContent:n,gap:(0,d.Y)({size:e,sizes:o.spacing})}}))),u=i(36814),s=Object.defineProperty,v=Object.getOwnPropertySymbols,c=Object.prototype.hasOwnProperty,f=Object.prototype.propertyIsEnumerable,p=(o,e,i)=>e in o?s(o,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):o[e]=i;const _={spacing:"md",align:"stretch",justify:"flex-start"},h=(0,n.forwardRef)(((o,e)=>{const i=(0,l.a1)("Stack",_,o),{spacing:n,className:r,align:d,justify:s,unstyled:h,variant:m}=i,g=((o,e)=>{var i={};for(var n in o)c.call(o,n)&&e.indexOf(n)<0&&(i[n]=o[n]);if(null!=o&&v)for(var n of v(o))e.indexOf(n)<0&&f.call(o,n)&&(i[n]=o[n]);return i})(i,["spacing","className","align","justify","unstyled","variant"]),{classes:O,cx:E}=a({spacing:n,align:d,justify:s},{name:"Stack",unstyled:h,variant:m});return t().createElement(u.a,((o,e)=>{for(var i in e||(e={}))c.call(e,i)&&p(o,i,e[i]);if(v)for(var i of v(e))f.call(e,i)&&p(o,i,e[i]);return o})({className:E(O.root,r),ref:e},g))}));h.displayName="@mantine/core/Stack"}}]);