"use strict";(self.webpackChunkhhgHealthCareV1=self.webpackChunkhhgHealthCareV1||[]).push([[8754],{84655:function(e,t,n){n.d(t,{W:function(){return o}});var a=n(858),i=n(44898),r=n(83776),o={cached:{},clearCached:function(e){console.log(o.cached),Object.keys(o.cached).filter((function(t){return t.startsWith(e)})).forEach((function(e){console.log(e),o.cached[e]=void 0}))},withCached:function(){var e=(0,a.A)((function(e,t){var n,a,c;return(0,r.__generator)(this,(function(r){switch(r.label){case 0:if("waitingTheFirstResponse"===o.cached[e])return[2,new Promise((function(t){var n=(new Date).getTime(),a=setInterval((function(){(new Date).getTime()-n>3e3&&clearInterval(a),"object"===typeof o.cached[e]&&(t(o.cached[e]),clearInterval(a))}),100)}))];if("object"===typeof o.cached[e])return[2,o.cached[e]];o.cached[e]="waitingTheFirstResponse",r.label=1;case 1:return r.trys.push([1,3,,4]),[4,t()];case 2:return n=r.sent(),o.cached[e]=n,setTimeout((function(){o.cached[e]=void 0}),18e5),[2,n];case 3:return a=r.sent(),o.cached[e]=void 0,c=(0,i.A)(a,Error)?a:new Error(String(a)),[2,Promise.reject(c)];case 4:return[2]}}))}));return function(t,n){return e.apply(this,arguments)}}()}},39385:function(e,t,n){n.d(t,{dR:function(){return p}});var a=n(44898),i=n(27516),r=n(94886),o=n.n(r),c=n(59850),l=n(84091),s=n(40959),d=function(){try{var e=localStorage.getItem("hhg_subscription_test_token"),t=null===e||void 0===e?void 0:e.trim();return t||null}catch(n){return null}},u=o().create({baseURL:"https://health-care.hellohealthgroup.com/",headers:{accept:"application/json, text/plain, version=2.0.0"}});u.interceptors.request.use((function(e){return s.KVY||console.log("[Api] ".concat(e.baseURL).concat(e.url)),e}),(function(e){var t=(0,a.A)(e,Error)?e:new Error(String(e));return Promise.reject(t)}));var p={getSubscriptionProduct:function(e){var t,n=e.site,a=void 0===n?i.y["vi-VN"]:n,r=e.plan_key;return u.get((0,l.w5)(c.R.GET_SUBSCRIPTION_PRODUCT,{site:a,plan_key:r})).then((function(e){var n;return null!==(t=null===(n=e.data)||void 0===n?void 0:n._data)&&void 0!==t?t:null})).catch((function(){return null}))},getTeleconsultationSubscriptionData:function(e){var t=e.doctor_id,n=void 0===t?"":t,a=e.schedule_id,i=void 0===a?"":a,r=e.reqCookie,o=(0,l.fK)(c.R.GET_TELECONSULTATION_SUBSCRIPTION_DATA,{doctor_id:n,schedule_id:i}),s=d();return(null!=s?(0,l.px)(o,"GET",{headers:{Authorization:"Bearer ".concat(s)}}):(0,l.T7)(o,"GET",void 0,r)).then((function(e){return e&&"object"===typeof e?e:null}))},chargeTeleconsultationSubscription:function(e){var t=e.subscription_id,n=e.customer_address,a=e.shipping_address,i=e.email,r=e.reqCookie,o=(0,l.fK)(c.R.POST_TELECONSULTATION_SUBSCRIPTION_CHARGE),s=d(),u={subscription_id:t,customer_address:n,shipping_address:a,email:i};return(null!=s?(0,l.px)(o,"POST",{data:u,headers:{Authorization:"Bearer ".concat(s)}}):(0,l.T7)(o,"POST",{data:u},r)).then((function(e){return e&&"object"===typeof e?e:null}))}}},82187:function(e,t,n){function a(e){return e.flatMap((function(e){return e.split("\n").map((function(e){return e.trim()})).filter(Boolean)}))}function i(e){var t=a(e);return 0===t.length?{title:"",items:[]}:{title:t[0],items:t.slice(1)}}function r(e,t){var n,r=e.subscription_product_content,o=function(e){var t=e.toLowerCase();return"oral"===t||"standard"===t||"accelerate"===t?t:"oral"}(e.plan_key),c=i(r["Jaminan Hasil"]||[]),l=i(r["Best For"]||[]),s=a(r["Diskaun Komitmen"]||[]).map((function(e){var t=/class=["']discount["']/.test(e);return{text:e.replace(/<[^>]+>/g,"").trim(),isHighlighted:t}})),d=a(r["Bagaimana Pendosan Berfungsi"]||[]),u=(null===(n=r.Subtext)||void 0===n?void 0:n.join(" "))||"";return{planKey:o,tierTitle:t({id:"subscription.payment.mapper.tier_title",defaultMessage:"{tierLabel} Plan"},{tierLabel:e.tier_label}),brandName:e.brand_name,brandSubtext:e.brand_subtext,medication:e.short_description,howDosingWorks:e.outcome_promise,howDosingDetail:d,outcomePromiseTitle:c.title,outcomePromiseItems:c.items,commitmentDiscountLines:s,bundleItems:r["Pakej Rangkuman Semua"]||[],bestForTitle:l.title,bestForBody:l.items.join(" "),pricingDisclaimer:t({id:"subscription.payment.pricingDisclaimer",defaultMessage:"Pricing is variable and depends on prescribed dose/treatment. You will only be charged the actual teleconsultation fee if you are approved for a prescription by the doctor."}),subtext:u}}n.d(t,{O:function(){return r}})},20394:function(e,t,n){n.d(t,{Y:function(){return N}});var a,i=n(38971),r=n(2445),o=n(73),c=n(35291),l=n(53611),s=n(41579),d=n(48045),u=n(21995),p=n(48085),m=n(36814),f=n(94858),h=n(88491),g=n(73419),v=n(6442),_=n(12034),y=(a={},(0,i.A)(a,u.L.Vietnam,{label:"Zalo",icon:s.C.getAssetPath("zalo-mini.png")}),(0,i.A)(a,u.L.Malaysia,{label:"WhatsApp",icon:s.C.getAssetPath("whatsapp.svg")}),a),x="CustomerSupport",b={root:{borderColor:"".concat(c.w.colors.gray200," !important")},label:{color:c.w.colors.gray700,fontSize:(0,p.D)(13),fontWeight:600,lineHeight:(0,p.D)(20),letterSpacing:(0,p.D)(-.3)}},N=function(e){var t=e.className,n=e.style,a=(0,h.d)().isMobile,i=(0,v.A)().formatMessage,c=(0,g.$)(),u=c.locale,p=c.push,N=c.router,w=(0,_.ZN)(),Y=w.isOpenPopupCollection,k=w.setIsOpenPopupCollection,D=w.onSubmitPopupCollection,P=o.Kt[u]||"",A=o.dm[u]||"",C=(null===y||void 0===y?void 0:y[u])||{},M=C.icon,F=C.label,T=N.pathname.includes("subscription");return(0,r.Y)(r.FK,{children:(0,r.FD)(m.a,{className:(0,f.A)(x,"pt-6 pb-7 px-4 bg-white lg:pb-6 lg:rounded-b-2xl",t),style:n,children:[(0,r.Y)("h2",{className:"".concat(x,"__title text-[17px] leading-6 tracking-[-0.4px] text-dark font-semibold mb-4"),children:i({id:"vaccination.payment.customer_support_title",defaultMessage:"Customer Support"})}),(0,r.Y)("p",{className:"".concat(x,"__desc text-[13px] leading-5 tracking-[-0.3px] text-gray700 mb-4 lg:mb-5"),children:i(T?{id:"vaccination.payment.customer_support_desc_whatsapp",defaultMessage:"For any questions or concerns regarding your booking, appointment scheduling, or cancellations, please contact the HelloDokter customer care team via Whatsapp."}:{id:"vaccination.payment.customer_support_desc",defaultMessage:"For any questions or concerns regarding your booking, appointment scheduling, or cancellations, please contact the HelloBacsi customer care team via Zalo or Facebook Messenger."})}),(0,r.FD)("div",{className:"".concat(x,"__footer flex gap-2"),children:[!!P&&!T&&(0,r.Y)(d.B,{"data-testid":"customer_support_button_1",variant:"tertiary",size:"lg",className:"".concat(x,"__button_1 flex-1 min-w-0"),onClick:function(){return p(P)},styles:b,leftIcon:(0,r.Y)("img",{src:s.C.getAssetPath("messenger.png"),className:"w-[23px] h-[23px]"}),children:"Messenger"}),!!M&&!!F&&(0,r.Y)(d.B,{"data-testid":"customer_support_button_2",variant:"tertiary",size:"lg",className:"".concat(x,"__button_2 flex-1 min-w-0"),onClick:function(){"Zalo"!==F?p(A):k(!0)},styles:b,leftIcon:(0,r.Y)("img",{src:M,className:"w-[23px] h-[23px] rounded-md"}),children:F})]}),(0,r.Y)(l.P,{onOpenChange:k,isOpen:Y,isMobile:a,onSubmit:D})]})})}},60785:function(e,t,n){n.d(t,{F:function(){return p}});var a=n(2445),i=n(615),r=n(45430),o=n(36814),c=n(32485),l=n.n(c),s=n(73419),d=n(32876),u=n.n(d),p=function(e){var t,n=e.customSize,o=(0,s.$)().locale,c=null===(t=r.L[o])||void 0===t?void 0:t.LOGO_TYPE;return(0,a.Y)(u(),{href:"/",children:(0,a.Y)("a",{href:"/",className:"block text-[0px]",children:(0,a.Y)(i.L,{customSize:n,type:c})})})};t.A=function(e){var t=e.className,n=e.customSize;return(0,a.Y)(o.a,{className:l()("p-4 sticky top-0 bg-white z-10",t),children:(0,a.Y)(p,{customSize:n})})}},86706:function(e,t,n){n.d(t,{T:function(){return l}});var a=n(73884),i=n(84091),r=n(73419),o=n(6442),c=n(42280),l=function(){var e=(0,r.$)().locale,t=(0,o.A)().formatMessage,n=(0,c.Jf)(),l=n.vaccinationDetail,s=n.computedPrice,d=n.quantity,u=(l||{}).price_unit,p=void 0===u?"":u,m=(0,a.useCallback)((function(n,a,r){return"%"===n&&a?"".concat(r,"%"):a?(0,i.nd)(t,(0,i.$g)(a,e),p):""}),[p,e]),f=(0,a.useCallback)((function(n,a,r){return n?(0,i.nd)(t,(0,i.$g)(a,e),r):""}),[e]),h=(0,a.useMemo)((function(){return f(s.show_delivery_fee,s.delivery_fee,s.delivery_fee_currency)}),[s.delivery_fee,s.delivery_fee_currency,e]);if(!l)return{quantity:1,displayTotalPrice:"",displayShippingFee:"",displayPriceWithUnit:"",displayDiscountPrice:"",displayDiscountReferral:"",displayTaxPrice:"",displayPricePayTenPercentage:"",displayPriceRemaining:"",displayPriceWithUnitAndQuantity:"",getDisplayTaxPrice:m,getDisplayDeliveryFee:f};var g=(0,i.nd)(t,(0,i.$g)(s.final_price,e),p),v=(0,i.nd)(t,(0,i.$g)(s.original_price,e),p),_="".concat((0,i.nd)(t,(0,i.$g)(s.unit_price,e),p)," X ").concat(d);return{quantity:d,displayTotalPrice:g,displayShippingFee:h,displayPriceWithUnit:v,displayDiscountPrice:s.voucher_discount_value+s.referral_discount_value>0?(0,i.nd)(t,(0,i.$g)(s.voucher_discount_value+s.referral_discount_value,e),p):"",displayDiscountReferral:(0,i.nd)(t,(0,i.$g)(s.referral_discount_value,e),p),displayTaxPrice:m(s.tax_unit,s.tax_computed,s.tax_amount),displayPricePayTenPercentage:(0,i.nd)(t,(0,i.$g)(Math.floor(.1*s.final_price)),p),displayPriceRemaining:(0,i.nd)(t,(0,i.$g)(s.final_price-Math.floor(.1*s.final_price)),p),getDisplayTaxPrice:m,getDisplayDeliveryFee:f,displayPriceWithUnitAndQuantity:_}}},9934:function(e,t,n){n.d(t,{A:function(){return N},e:function(){return b}});var a=n(53513),i=n(53455),r=n(2445),o=n(73884),c=n(35291),l=n(60765),s=n(1657),d=n(36814),u=n(94858),p=n(51387),m=n(48085),f=n(73827),h=n(30686),g=n(6442),v=n(42280),_=n(95204),y=function(e){var t=e.collapsed,n=void 0===t||t,a=e.content,i=e.className,o=e.style,c=(0,g.A)().formatMessage,l=(null===a||void 0===a?void 0:a.split("\n").filter(Boolean))||[];if(!l.length)return null;if(1===(null===l||void 0===l?void 0:l.length))return(0,r.Y)("p",{className:(0,u.A)(i,"payment__listItemDescription text-[13px] leading-5 tracking-[-0.3px] text-gray700 [&>b]:text-green600"),style:o,dangerouslySetInnerHTML:{__html:l[0]}});var s=c({id:"vaccination.payment.offers_number",defaultMessage:"{number} offers"},{number:l.length});return(0,r.FD)("div",{className:(0,u.A)(i,"payment__listItemDescription text-[13px] leading-5 tracking-[-0.3px] text-gray700"),style:o,children:[n&&(0,r.Y)("span",{className:"text-green600",children:s}),!n&&(0,r.Y)("ul",{className:"payment__listItemDescription-list mt-1",children:l.map((function(e,t){return(0,r.Y)("li",{dangerouslySetInnerHTML:{__html:e},className:(0,u.A)("[&>b]:text-green600 pl-5 relative [&~&]:mt-1","before:content-[''] before:w-[4px] before:h-[4px] before:bg-dark before:absolute before:top-[8px] before:left-[6px] before:rounded-[50%]")},"".concat(e,"-").concat(t))}))})]})},x=n(24360);function b(e){var t=e.provider,n=e.payment_via,a=e.payment_type,i=e.title;return"".concat(t,"-").concat(n,"-").concat(a,"-").concat(i)}var N=function(e){var t=e.loading,n=e.options,N=e.defaultValue,w=e.onChange,Y=e.className,k=e.style,D=(0,v.Jf)(),P=D.selectedPaymentValue,A=D.setSelectedPaymentValue,C=D.openOnlineBanking,M=D.setOpenOnlineBanking,F=D.selectedSubPaymentValue,T=D.setSelectedSubPaymentValue,S=(0,g.A)().formatMessage,E=(0,o.useMemo)((function(){var e,t=null===n||void 0===n?void 0:n.find((function(e){return P===b(e)}));return t&&(null===(e=t.sub_payment_methods)||void 0===e?void 0:e.length)?(F||M(!0),t.sub_payment_methods.filter((function(e){return e.is_active}))):[]}),[P]),R=(0,o.useMemo)((function(){return E.find((function(e){return e.code===F}))}),[F,E]),V=(0,o.useCallback)((function(e){A(e),T(""),null===w||void 0===w||w(e)}),[n,w]),I=(0,o.useCallback)((function(){M(!1),F||V("")}),[F,V]),O=(0,o.useCallback)((function(e){M(!1),T("".concat(e))}),[]);return t?(0,r.FD)(d.a,{className:(0,u.A)(Y,"payment__list","p-4 flex flex-col gap-2","border border-solid border-[rgba(0,0,0,0.1)] rounded-xl"),children:[(0,r.FD)("label",{className:"payment__listItem flex justify-between py-2",children:[(0,r.Y)(p.E,{width:24,height:24,radius:3,mr:(0,m.D)(8)}),(0,r.FD)("div",{className:"flex-1 min-w-0",children:[(0,r.Y)(p.E,{width:"100%",height:18,radius:5}),(0,r.Y)(p.E,{width:"30%",height:16,radius:5,mt:4})]}),(0,r.Y)(p.E,{width:16,height:16,circle:!0,ml:(0,m.D)(12)})]}),(0,r.Y)(f.c,{color:"rgba(0,0,0,0.1)"}),(0,r.FD)("label",{className:"payment__listItem flex justify-between py-2",children:[(0,r.Y)(p.E,{width:24,height:24,radius:3,mr:(0,m.D)(8)}),(0,r.FD)("div",{className:"flex-1 min-w-0",children:[(0,r.Y)(p.E,{width:"100%",height:18,radius:5}),(0,r.Y)(p.E,{width:"30%",height:16,radius:5,mt:4})]}),(0,r.Y)(p.E,{width:16,height:16,circle:!0,ml:(0,m.D)(12)})]}),(0,r.Y)(f.c,{color:"rgba(0,0,0,0.1)"}),(0,r.FD)("label",{className:"payment__listItem flex justify-between py-2",children:[(0,r.Y)(p.E,{width:24,height:24,radius:3,mr:(0,m.D)(8)}),(0,r.FD)("div",{className:"flex-1 min-w-0",children:[(0,r.Y)(p.E,{width:"100%",height:18,radius:5}),(0,r.Y)(p.E,{width:"30%",height:16,radius:5,mt:4})]}),(0,r.Y)(p.E,{width:16,height:16,circle:!0,ml:(0,m.D)(12)})]})]}):n&&n.length?(0,r.FD)(r.FK,{children:[(0,r.Y)(h.s.Group,{defaultValue:N,value:P,onChange:V,className:(0,u.A)(Y,"payment__list","p-4 flex flex-col gap-2","border border-solid border-[rgba(0,0,0,0.1)] rounded-xl"),style:k,children:n.map((function(e,t){var a,i=e.logo,p=e.title,g=e.description,v=e.provider,x=i||(null===_.pf||void 0===_.pf?void 0:_.pf[v])||_.uY.HHG,N=b(e);return(0,r.FD)(o.Fragment,{children:[(0,r.FD)("label",{className:"payment__listItem flex justify-between py-2 cursor-pointer",children:[(0,r.Y)("img",{src:x,alt:p,className:(0,u.A)("payment__listItemLogo","w-6 h-6 object-contain object-center mr-3")}),(0,r.FD)("div",{className:"payment__listItemContent flex-1 min-w-0 mr-4",children:[(0,r.Y)("p",{className:"payment__listItemTitle text-[15px] leading-6 tracking-[-0.3px] font-medium text-dark mb-0",children:p}),(0,r.Y)(y,{content:g,collapsed:N!==P})]}),(0,r.Y)(h.s,{value:N,checked:N===P,styles:{root:{marginTop:(0,m.D)(2)},radio:{width:(0,m.D)(16),height:(0,m.D)(16)},icon:{color:c.w.colors.primary600}}})]}),!!(null===(a=e.sub_payment_methods)||void 0===a?void 0:a.length)&&R&&(0,r.FD)(d.a,{className:"bg-neutral50 rounded-xl flex items-center gap-2 flex-col lg:flex-row p-3 lg:p-4 -mt-2",children:[(0,r.FD)(d.a,{className:"flex gap-3 items-center flex-1 min-w-full w-full md:min-w-0 text-gray900 text-[13px] leading-5 tracking-[-0.3px] font-medium",children:[(0,r.Y)("img",{src:null===R||void 0===R?void 0:R.logo,className:"w-8 h-6"}),(0,r.Y)("p",{className:"m-0 flex-1 min-w-0",children:null===R||void 0===R?void 0:R.title})]}),(0,r.Y)(f.c,{color:"rgba(0,0,0,0.1)",className:"border-[rgba(0,0,0,0.1)] border-[0.7px] w-full lg:hidden"}),(0,r.FD)(l.b,{onClick:function(){return M(!0)},className:"flex items-center text-primary600 !text-[13px] !leading-5 tracking-[-0.3px] cursor-pointer",children:[S({id:"vaccination.payment.change_method",defaultMessage:"Change method"}),(0,r.Y)(s.A,{size:"1em",color:"currentColor"})]})]}),t!==n.length-1&&(0,r.Y)(f.c,{color:"rgba(0,0,0,0.1)"})]},"".concat(e.title,"-").concat(t))}))}),(0,r.Y)(x.R,{open:C,onOpen:I,options:E.map((function(e){var t=e.title,n=e.code,r=(0,i.A)(e,["title","code"]);return(0,a.A)({label:t,value:n},r)})),value:"".concat(F),itemRender:function(e){return(0,r.FD)(d.a,{className:"flex gap-3 items-center flex-1 min-w-full w-full md:min-w-0 text-gray900 text-[13px] leading-5 tracking-[-0.3px] font-medium",children:[(0,r.Y)("img",{src:null===e||void 0===e?void 0:e.logo,className:"w-8 h-6"}),(0,r.Y)("p",{className:"m-0 flex-1 min-w-0",children:null===e||void 0===e?void 0:e.label})]})},onChange:O})]}):null}},63231:function(e,t,n){n.d(t,{A:function(){return u}});var a=n(53513),i=n(63538),r=n(2445),o=n(73884),c=n(36814),l=n(94858),s=n(35291),d=function(e){var t=e||{},n=t.w,c=t.h,d=t.active,u=t.className,p=t.style,m=(0,o.useMemo)((function(){return{width:n+2,height:c+2,viewBox:"0 0 ".concat(n+2," ").concat(c+2),className:(0,l.A)(u,"absolute z-[-1] inset-x-[-32px] top-[-1px] pointer-events-none"),style:p,xmlns:"http://www.w3.org/2000/svg"}}),[n,c,u,p]),f=(0,o.useMemo)((function(){if(!d)return"M0 56 H".concat(n+1," V").concat(c," H0 Z");var e=d.w,t=d.h,a=d.x,i=d.y,r=12,o=4/3*(Math.sqrt(2)-1)*r;return"M0,".concat(i+c,"\n\t\t\tV").concat(i+t,"\n\t\t\tH").concat(a-r,"\n\t\t\tC").concat(a-r+o,",").concat(i+t," ").concat(a,",").concat(i+t-o," ").concat(a,",").concat(i+t-r,"\n\t\t\tV").concat(i+r+1,"\n\t\t\tC").concat(a,",").concat(i+r+1-o," ").concat(a+o,",").concat(i+1," ").concat(a+r,",").concat(i+1,"\n\t\t\tH").concat(a+e-r,"\n\t\t\tC").concat(a+e-o,",").concat(i+1," ").concat(a+e,",").concat(i+r+1-o," ").concat(a+e,",").concat(i+r+1,"\n\t\t\tV").concat(t-r,"\n\t\t\tC").concat(a+e,",").concat(i+t-o," ").concat(a+e+r-o,",").concat(i+t," ").concat(a+e+r,",").concat(i+t,"\n\t\t\tH").concat(n+2,"\n\t\t\tV").concat(c+2,"\n\t\t\tH0\n\t\t\tZ")}),[n,c,null===d||void 0===d?void 0:d.x,null===d||void 0===d?void 0:d.y,null===d||void 0===d?void 0:d.w,null===d||void 0===d?void 0:d.h]);return(0,r.FD)("svg",(0,i.A)((0,a.A)({},m),{children:[(0,r.Y)("path",{d:f,fill:"white",stroke:s.w.colors.neutral100,strokeWidth:"1"}),(0,r.FD)("defs",{children:[(0,r.FD)("linearGradient",{id:"line__gradient",x1:(null===d||void 0===d?void 0:d.x)||0,y1:1,x2:((null===d||void 0===d?void 0:d.x)||0)+((null===d||void 0===d?void 0:d.w)||0),y2:1,gradientUnits:"userSpaceOnUse",colorInterpolation:"linearRGB",children:[(0,r.Y)("stop",{offset:"0%",stopColor:s.w.colors.neutral100,stopOpacity:"0"}),(0,r.Y)("stop",{offset:"50%",stopColor:s.w.colors.primary600,stopOpacity:"0.5"}),(0,r.Y)("stop",{offset:"100%",stopColor:s.w.colors.neutral100,stopOpacity:"0"})]}),(0,r.FD)("radialGradient",{id:"ellipse__radial",cx:"50%",cy:"50%",r:"50%",gradientTransform:"translate(0.5,0.5) scale(1,0.6) translate(-0.5,-0.5)",children:[(0,r.Y)("stop",{offset:"0%",stopColor:s.w.colors.primary600,stopOpacity:"0.1"}),(0,r.Y)("stop",{offset:"100%",stopColor:"white",stopOpacity:"0"})]})]}),(0,r.Y)("line",{fill:"none",stroke:"url(#line__gradient)",strokeWidth:"1",x1:(null===d||void 0===d?void 0:d.x)||0,y1:1,x2:((null===d||void 0===d?void 0:d.x)||0)+((null===d||void 0===d?void 0:d.w)||0),y2:1}),(0,r.Y)("rect",{x:(null===d||void 0===d?void 0:d.x)||0,y:-"".concat(((null===d||void 0===d?void 0:d.h)||0)/2),width:(null===d||void 0===d?void 0:d.w)||0,height:(null===d||void 0===d?void 0:d.h)||0,fill:"url(#ellipse__radial)"})]}))},u=function(e){var t=e.tabs,n=e.defaultTab,s=e.currentTab,u=e.onChangeTab,p=e.className,m=e.style,f=(0,o.useState)(n||s),h=f[0],g=f[1],v=(0,o.useRef)({}),_=(0,o.useRef)(null),y=(0,o.useState)(null),x=y[0],b=y[1],N=(0,o.useState)({w:1600,h:72}),w=N[0],Y=N[1],k=(0,o.useCallback)((function(e){requestAnimationFrame((function(){var t,n=v.current[e],a=_.current,i=null===a||void 0===a||null===(t=a.children)||void 0===t?void 0:t[0];n&&a&&i&&a.offsetWidth=f&&"after:content-[''] after:absolute after:h-[1px] after:bg-neutral100 after:bottom-[0.5px]",{"text-gray700":u!==h},{"payment__tabsNav-nav-active text-blue600":u===h}),"data-testid":u,onClick:D(u),sx:function(){return{"&::after":{width:"".concat(g,"px"),right:"-".concat(g+16,"px")}}},children:[u===h&&(0,r.Y)(d,(0,i.A)((0,a.A)({},w),{active:x,className:"payment__tabsNav-svg"})),s]})},"".concat(u,"-").concat(n))}))})})})}):null}},37680:function(e,t,n){n.d(t,{Ai:function(){return b},Ay:function(){return w},ze:function(){return N}});var a=n(40568),i=n(2445),r=n(73884),o=n(36814),c=n(51387),l=n(48085),s=n(84655),d=n(59850),u=n(84091),p=n(73419),m=n(6442),f=n(86706),h=n(42280),g=n(9934),v=n(63231),_=n(94858),y=function(e){var t=e.icon,n=e.titleComponent,a=e.rightComponent,r=e.className,c=e.style;return t||n||a?(0,i.FD)(o.a,{className:(0,_.A)(r,"payment__warningBox","p-3 flex gap-2 items-center justify-between bg-yellow50","border border-solid border-yellow200 rounded-xl"),style:c,children:[!!t&&(0,i.Y)("img",{src:t,className:"payment__warningBoxIcon w-5 h-5 leading-none"}),!!n&&(0,i.Y)("div",{className:"payment__warningBoxContent flex-1 min-w-0 text-[13px] font-semibold leading-5 tracking-[-0.3px]",children:n}),!!a&&(0,i.Y)("p",{className:"payment__warningBoxPrice text-gray900 font-semibold text-[15px] leading-6 tracking-[-0.3px]",children:a})]}):null},x=n(40959),b={ten_percent:"10_percent",one_hundred_percent:"100_percent",full_payment:"full_payment"};function N(e){var t=(0,a.A)(e.split("-"),4);return{provider:t[0],paymentVia:t[1],paymentType:t[2],providerTitle:t[3]}}var w=function(e){var t=e.loadingPrice,n=e.displayPricePayNow,a=e.displayPriceRemaining,_=(0,p.$)().locale,N=(0,m.A)().formatMessage,w=(0,r.useState)(!0),Y=w[0],k=w[1],D=(0,r.useState)(),P=D[0],A=D[1],C=(0,h.Jf)(),M=C.providers,F=C.setProviders,T=C.selectedPaymentValue,S=C.vaccinationDetail,E=(0,f.T)().displayTotalPrice,R=(0,r.useMemo)((function(){var e=M.filter((function(e){return"10_percent"===e.payment_type})),t=M.filter((function(e){return"full_payment"===e.payment_type})),n=M.filter((function(e){return"100_percent"===e.payment_type}));return{ten_percent:e,full_payment:t,one_hundred_percent:n}}),[M]),V=(0,r.useMemo)((function(){var e=[];return R.ten_percent.length&&e.push({label:R.ten_percent[0].display_label||N({id:"vaccination.payment.tabs.pay_10_percent",defaultMessage:"Pay 10% to Book"}),value:b.ten_percent}),R.one_hundred_percent.length&&e.push({label:R.one_hundred_percent[0].display_label||N({id:"vaccination.payment.tabs.pay_100_percent",defaultMessage:"Pay 100%"}),value:b.one_hundred_percent}),R.full_payment.length&&e.push({label:R.full_payment[0].display_label||N({id:"vaccination.payment.tabs.buy_now_pay_later",defaultMessage:"Buy Now Pay Later"}),value:b.full_payment}),e}),[R.ten_percent,R.full_payment]);return(0,r.useEffect)((function(){var e;(null===S||void 0===S||null===(e=S.organization)||void 0===e?void 0:e.id)&&(k(!0),s.W.withCached(d.R.GET_VACCINATION_PAYMENT_PROVIDER,(function(){var e;return(0,u.px)((0,u.fK)(d.R.GET_VACCINATION_PAYMENT_PROVIDER,{locale:String(_),hospitalId:null===S||void 0===S||null===(e=S.organization)||void 0===e?void 0:e.id}),"GET")})).then((function(e){var t,n;(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(n=t.items)||void 0===n?void 0:n.length)&&(F(e.data.items),k(!1))})))}),[null===S||void 0===S?void 0:S.id]),(0,r.useMemo)((function(){if(V.length){var e=null===V||void 0===V?void 0:V[0].value;T&&T.includes(b.full_payment)&&(e=b.full_payment),T&&T.includes(b.ten_percent)&&(e=b.ten_percent),T&&T.includes(b.one_hundred_percent)&&(e=b.one_hundred_percent),A(e)}}),[V,T]),(0,i.FD)("div",{id:"payment-method-step-1",className:"paymentMethod",children:[(0,i.Y)(v.A,{tabs:V,currentTab:P,onChangeTab:A}),(0,i.FD)(o.a,{className:"pt-[14px] bg-white",children:[P==b.ten_percent&&(0,i.FD)(o.a,{className:"px-4 pb-5 lg:pb-6",children:[(0,i.Y)(y,{icon:"".concat(x.JpE,"/svg/coin.svg"),titleComponent:N({id:"vaccination.payment.warning.pay_now",defaultMessage:"Pay Now ({number})"},{number:"10%"}),rightComponent:t?(0,i.Y)(c.E,{width:"100%",height:(0,l.D)(24)}):n}),(0,i.Y)("p",{className:"mt-2 text-gray700 text-[13px] leading-5 tracking-[-0.3px]",children:N({id:"vaccination.payment.notice.remaining",defaultMessage:"You\u2019ll pay the remaining {percent} of the amount ({price}) at the clinic when you get the vaccine."},{percent:"90%",price:t?(0,i.Y)(c.E,{width:"50px"}):a})}),(0,i.Y)(g.A,{loading:Y,options:R.ten_percent,className:"mt-4"})]}),P==b.full_payment&&(0,i.Y)(o.a,{className:"px-4 pb-5 lg:pb-6",children:(0,i.Y)(g.A,{loading:Y,options:R.full_payment})}),P==b.one_hundred_percent&&(0,i.FD)(o.a,{className:"px-4 pb-5 lg:pb-6",children:[(0,i.Y)(y,{icon:"".concat(x.JpE,"/svg/coin.svg"),titleComponent:N({id:"vaccination.payment.warning.pay_now",defaultMessage:"Pay Now ({number})"},{number:"100%"}),rightComponent:t?(0,i.Y)(c.E,{width:"100%",height:(0,l.D)(24)}):E,className:"mb-4"}),(0,i.Y)(g.A,{loading:Y,options:R.one_hundred_percent})]})]})]})}},18754:function(e,t,n){n.d(t,{A:function(){return H}});var a=n(858),i=n(53513),r=n(63538),o=n(83776),c=n(2445),l=n(73884),s=n(35291),d=n(41579),u=n(48045),p=n(21995),m=n(86436),f=n(36814),h=n(94858),g=n(59850),v=n(14265),_=n(39385),y=n(84091),x=n(32485),b=n.n(x),N=n(74353),w=n.n(N),Y=n(88491),k=n(59167),D=n(67722),P=function(e){var t,n=(0,k.a)();if("success"===(null===e||void 0===e||null===(t=e.transaction)||void 0===t?void 0:t.status)){var a=n.getHref();if(a){var i,r=(0,D.VG)(a);r!==(null===e||void 0===e||null===(i=e.snapshot_order)||void 0===i?void 0:i.product_id)&&null!==r||n.resetHref()}}},A=n(73419),C=n(6442),M=n(36259),F=n(12034),T=n(92047),S=n(20394),E=n(60785),R=n(70254),V=n(42280),I=n(9655),O=n(95204),L=n(37639),j=n(40959),B=function(e){var t,n,s,d=e.vaccinationDetail,p=e.subscriptionProduct,m=(0,C.A)().formatMessage,h=(0,Y.d)().isMobileOrTablet,x=(0,A.$)().query,N=String(x.ref_id||""),w=(0,V.Jf)(),k=w.paymentResult,D=w.setPaymentResult,O=(0,l.useState)(60),j=O[0],B=O[1],z=(0,l.useContext)(M.B).pushNotifications,G=(0,T.eZ)();P(k);var H=function(){var e=(0,a.A)((function(){var e,t,n,a,c,l,s,u,p,f,h,_,x,b,w,Y,D,P,A,C,M;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(ne||!k||!Q||!d)return[2];t=(e=k||{}).snapshot_order,n=e.payment_via,a=e.payment_type,c=e.payment_provider,s=(l=t||{}).type,u=l.product_id,p=l.clinic_id,f=l.voucher_code,h=l.referral_code,_=l.customer_info,x="".concat(window.location.origin).concat(window.location.pathname),b=null===d||void 0===d?void 0:d.id,w=null===c||void 0===c?void 0:c.toLowerCase(),s===v.V.vaccine_package&&(b=u),o.label=1;case 1:return o.trys.push([1,3,,4]),ae(!0),[4,(0,y.px)((0,y.fK)(g.R.GET_PAYMENT_URL,{provider:w}),"POST",{data:(0,r.A)((0,i.A)({},k.snapshot_order),{ref_id:N,amount:Q.amount,price_unit:d.price_unit,order_info:d.name,product_name:d.name,clinic_name:null===(Y=d.hospital_branch)||void 0===Y?void 0:Y.name,hospital_name:null===(D=d.organization)||void 0===D?void 0:D.name,hospital_branch_name:null===(P=d.hospital_branch)||void 0===P?void 0:P.name,image:d.logo,type:s,provider:w,return_url:x,product_id:b,payment_via:n,payment_type:a,clinic_id:p,voucher_code:f,referral_code:h,customer_info:_,sub_payment_method_code:null===k||void 0===k||null===(A=k.sub_payment_method)||void 0===A?void 0:A.code})})];case 2:if(C=o.sent(),!(M=C.data.url))throw new Error("");return window.location.href=M,ae(!1),[3,4];case 3:return o.sent(),z({message:m({id:"vaccination.payment.failed_desc",defaultMessage:"There was an issue with your {provider} transaction. Please try again or use another payment method."},{provider:k.payment_provider_title}),type:"danger"}),ae(!1),[3,4];case 4:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),W=function(){var e=(0,a.A)((function(){var e,t,n,a,i;return(0,o.__generator)(this,(function(r){switch(r.label){case 0:if(ne||!k||!p)return[2];r.label=1;case 1:return r.trys.push([1,3,,4]),ae(!0),t={address_line:(k.snapshot_order.customer_address.address_line||"").trim(),city:(k.snapshot_order.customer_address.city||"").trim(),country:(k.snapshot_order.customer_address.country||"").trim(),zip_or_postal_code:(k.snapshot_order.customer_address.zip_or_postal_code||"").trim()},n={address_line:(k.snapshot_order.shipping_address.address_line||"").trim(),city:(k.snapshot_order.shipping_address.city||"").trim(),country:(k.snapshot_order.shipping_address.country||"").trim(),zip_or_postal_code:(k.snapshot_order.shipping_address.zip_or_postal_code||"").trim()},[4,_.dR.chargeTeleconsultationSubscription({subscription_id:k.snapshot_order.subscription_id,customer_address:t,shipping_address:n,email:k.snapshot_order.customer_info.email})];case 2:if(a=r.sent(),!(i=null===a||void 0===a||null===(e=a.data)||void 0===e?void 0:e.url))throw new Error("Missing payment url");return window.location.href=i,[3,4];case 3:return r.sent(),z({message:m({id:"vaccination.payment.failed_desc",defaultMessage:"There was an issue with your {provider} transaction. Please try again or use another payment method."},{provider:k.payment_provider_title}),type:"danger"}),ae(!1),[3,4];case 4:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),q=null===k||void 0===k||null===(t=k.transaction)||void 0===t?void 0:t.status,K=x.hhg_payment_token?String(x.hhg_payment_token):"",J=function(){"default"===q&&K&&(ae(!0),(0,y.px)((0,y.fK)(g.R.GET_PAYMENT_RESULT,{hhgToken:K}),"GET").then((function(e){var t,n=null===e||void 0===e?void 0:e.data,a=null===n||void 0===n||null===(t=n.transaction)||void 0===t?void 0:t.status;k&&a&&"default"!==a&&D(n)})).finally((function(){ae(!1)})))},Z=k||{},X=Z.payment_provider_title,Q=Z.transaction,ee=(Z.user_referral||{}).code,te=(0,l.useState)(!1),ne=te[0],ae=te[1],ie=(0,l.useState)(!1),re=ie[0],oe=ie[1],ce="success"===q,le="failed"===q,se="default"===q,de=le&&(0,c.Y)(u.B,{size:"lg",fullWidth:!0,loading:ne,onClick:p?W:H,children:(0,c.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium",children:m({id:"vaccination.payment.retry",defaultMessage:"Retry Payment"})})}),ue=se&&(0,c.Y)(u.B,{size:"lg",fullWidth:!0,loading:ne,onClick:J,children:(0,c.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium pointer-events-none",children:m({id:"vaccination.payment.reload",defaultMessage:"Reload ({count})"},{count:j})})});return(0,l.useEffect)((function(){var e;if((null===k||void 0===k||null===(e=k.snapshot_order)||void 0===e?void 0:e.type)===v.V.vaccine_package){var t,n=null===k||void 0===k||null===(t=k.snapshot_order)||void 0===t?void 0:t.product_id.toString();(0,T.Gp)(n,((null===G||void 0===G?void 0:G[n])||0)-1)}}),[]),(0,l.useEffect)((function(){if("default"===q&&K){var e=setInterval((function(){B((function(e){var t=e-1;return 0===t&&J(),t||60}))}),1e3);return function(){B(60),clearInterval(e)}}}),[q,K]),k&&Q?(0,c.FD)(F.Ue,{value:{isOpenPopupCollection:re,setIsOpenPopupCollection:oe},children:[(0,c.FD)(f.a,{className:"bg-neutral50 min-h-screen",children:[(0,c.Y)(E.A,{className:"lg:mb-8 lg:border-b lg:border-solid lg:border-gray200 lg:py-6 lg:flex lg:justify-center",customSize:h?void 0:{width:"141px",height:"32px"}}),(0,c.FD)(f.a,{className:"max-w-[552px] mx-auto",children:[(0,c.FD)(f.a,{className:b()("flex flex-col gap-3 lg:gap-2",le||se?"pb-[100px]":"pb-[50px] lg:pb-[40px]"),children:[(null===Q||void 0===Q?void 0:Q.status)&&(0,c.Y)(U,{status:Q.status,provider:X}),(0,c.FD)(f.a,{className:"bg-white p-4 pt-6 lg:pb-6",children:[(0,c.FD)("div",{className:"payment__productInfo",children:[d&&(0,c.Y)(R.Ay.Inner,{stepNumber:0,vaccinationDetail:d,className:"mt-0",showDeliveryFee:null===(n=k.snapshot_order)||void 0===n?void 0:n.show_delivery_fee,quantity:null===(s=k.snapshot_order)||void 0===s?void 0:s.quantity}),p&&(0,c.Y)(R.Ay.SubscriptionInner,{subscriptionProduct:p,className:"mt-0"})]}),ee&&ce&&d&&(0,c.Y)($,{paymentResult:k,vaccinationDetail:d,userReferral:k.user_referral,className:"mt-4 !px-0"})]}),(0,c.Y)(I.A,{paymentResult:k,vaccinationDetail:d,subscriptionProduct:p,isFailed:le,isSuccess:ce,isPending:se,action:!h&&(le||se)&&(0,c.Y)(f.a,{className:"py-1","data-testid":le?"retry-button":"reload-button",children:le?de:ue})}),(ce||p)&&(0,c.Y)(S.Y,{})]}),le&&h&&(0,c.Y)(f.a,{"data-testid":"retry-button",className:"fixed bottom-0 left-0 right-0 border-t border-solid border-neutral100 py-2 px-4 bg-white",children:de}),se&&h&&(0,c.Y)(f.a,{"data-testid":"reload-button",className:"fixed bottom-0 left-0 right-0 border-t border-solid border-neutral100 py-2 px-4 bg-white",children:ue})]})]}),(0,c.Y)(L.A,{className:"!top-4 !right-4 !left-4"})]}):null},z={success:d.C.getAssetPath("payment/payment_success.png"),failed:d.C.getAssetPath("payment/payment_failed.png"),default:d.C.getAssetPath("payment/payment_pending.png")},G={success:{title:{id:"vaccination.payment.success_title",defaultMessage:"Payment Successful"},description:{id:"vaccination.payment.success_desc",defaultMessage:"Your payment has been completed successfully. Thank you for your purchase!"}},failed:{title:{id:"vaccination.payment.failed_title",defaultMessage:"Payment Unsuccessful"},description:{id:"vaccination.payment.failed_desc",defaultMessage:"There was an issue with your {provider} transaction. Please try again or use another payment method."}},default:{title:{id:"vaccination.payment.pending_title",defaultMessage:"Pending Transaction"},description:{id:"vaccination.payment.pending_desc",defaultMessage:"Your payment is being processed. Please refresh to see the latest status"}}},U=function(e){var t=e.status,n=e.provider,a=e.className,i=e.style,r=(0,C.A)().formatMessage,o=(null===z||void 0===z?void 0:z[t])||z.failed,s=(0,l.useMemo)((function(){var e=G.failed.title,a=G.failed.description;if(t in G){var i=G[t];e=i.title,a=i.description}return{title:r(e),description:r(a,{provider:n})}}),[r,n,t]),d=s.title,u=s.description;return(0,c.Y)(c.FK,{children:(0,c.FD)("div",{className:(0,h.A)(a,"result","result-".concat(t),"bg-white p-4 text-center lg:rounded-t-2xl"),style:i,"data-testid":"result-message",children:[(0,c.Y)("img",{src:o,alt:"hhg",className:"result__icon leading-none w-auto h-[96px] mb-2 block mx-auto"}),(0,c.Y)("h4",{className:"result__title mb-0 font-semibold text-[22px] text-dark leading-8 tracking-[-0.6px]",children:d}),(0,c.Y)("p",{className:"result__description mt-2 mb-0 text-[13px] text-gray600 leading-5 tracking-[-0.3px] lg:text-[14px] lg:leading-[22px] lg:tracking-[-0.2px]",children:u})]})})},$=function(e){var t=e.paymentResult,n=e.vaccinationDetail,a=e.userReferral,i=e.className,r=e.style,o=(0,C.A)().formatMessage,u=(0,A.$)(),g=u.locale,_=u.asPath,x=(0,Y.d)().isMobileOrTablet,b=(0,l.useContext)(M.B).pushNotifications,N=null===a||void 0===a?void 0:a.code,k=n||{},D=k.name,P=(k.hospital_branch||{}).name,F=t.snapshot_order,T=F.type,S=F.product_id,E=F.product_package_name,R="percentage"===(null===a||void 0===a?void 0:a.discount_type)?"".concat(null===a||void 0===a?void 0:a.discount_value,"%"):(0,y.nd)(o,(0,y.$g)((null===a||void 0===a?void 0:a.discount_value)||0,g),n.price_unit),V=(0,l.useMemo)((function(){if(j.kUY)return"";var e=(0,O.jX)(n)?O.kx:(0,O.J8)(n)?O.W:(0,O.FL)(n)?O.km:(0,O.LJ)(n)?O.w7:O.OP,t="".concat(window.location.origin).concat(j.JpE).concat(e(n.slug,n.id,_),"payment?referral_code=").concat(N);if(T===v.V.vaccine_package){var a=encodeURIComponent(E);t+="&pkg_name=".concat(a,"&pkg_id=").concat(S)}return t}),[N,T,S,E,n]),I=(0,l.useMemo)((function(){var e=w()(1e3*((null===a||void 0===a?void 0:a.expires_at)||0)),t=w()(1e3*((null===a||void 0===a?void 0:a.created_at)||0)),n=function(e,t){var n=(t-e)/864e5;return Math.max(Math.round(n),1)}(Number(t),Number(e)),i=D;return T===v.V.vaccine_package&&E&&(i+=" - ".concat(E)),[o({id:"vaccination.share_sentence1"},{productName:i,clinicName:P}),o({id:"vaccination.share_sentence2"},{refCode:N,refAmount:R,expiresLength:o({id:"vaccination.share_day_length"},{days:n}),createdAt:t.format("DD/MM/YYYY")}),o({id:"vaccination.share_sentence3"}),o({id:"vaccination.share_sentence4"})].join("\n")}),[o,a,R,N,D,E]),L=function(e){(0,O.lW)(e||V,(function(){b({type:"success",message:o({id:"widget.integrations.document.copiedToClipboard",defaultMessage:"Copied to clipboard!"})})}),(function(){}))};return(0,c.Y)(f.a,{"data-testid":"referral-code-box",className:(0,h.A)(i,"px-4"),style:r,children:(0,c.FD)(f.a,{style:x?O.yi:O.IL,className:"py-[20px] rounded-lg lg:rounded-2xl bg-primary500",children:[(0,c.Y)("div",{className:"w-[196px] h-[78px] mx-auto relative",children:(0,c.Y)("img",{alt:"cash back 40%",className:"w-[320px] absolute top-[-15px] left-1/2 pointer-events-none",style:{transform:"translateX(-50%)"},src:d.C.getAssetPath(g===p.L.Vietnam?"payment/referral_title_bg_vi-VN.png":"payment/referral_title_bg.png")})}),(0,c.Y)("p",{className:"text-[15px] leading-6 font-semibold tracking-[-0.3px] px-9 text-white text-center",children:o({id:"vaccination.payment_referral_desc",defaultMessage:"Share this code with your friends and get {amount} cashback for every friend (max {count}) who gets vaccinated using it."},{amount:R,count:(null===a||void 0===a?void 0:a.usage_limit)||2})}),(0,c.FD)(f.a,{className:"px-6 flex gap-2 mt-[18px]",children:[(0,c.FD)(f.a,{className:"flex justify-between rounded bg-white/[0.64] flex-1 px-4 py-[10px] backdrop-blur-[24px] min-w-0",children:[(0,c.Y)("p",{className:"text-[15px] leading-6 font-semibold tracking-[-0.3px] text-gray700 text-ellipsis overflow-hidden whitespace-nowrap pr-1",children:N}),(0,c.Y)(f.a,{className:"cursor-pointer",onClick:function(){return L()},children:(0,c.Y)(m.A,{color:s.w.colors.gray600,size:20})})]}),(0,c.Y)("button",{onClick:function(){if("undefined"!==typeof(null===navigator||void 0===navigator?void 0:navigator.share)){var e={url:V,title:n.name,text:I};navigator.share(e).then((function(){return console.log("Successful share")})).catch((function(e){console.log("Error sharing",e),L(I)}))}else L(I)},className:"bg-white rounded-xl text-[15px] leading-6 font-semibold tracking-[-0.3px] text-primaryBase px-[26px] py-[10px] w-auto whitespace-nowrap",children:o({id:"vaccination.payment_share",defaultMessage:"Share"})})]})]})})};B.Result=U,B.ResultIcon=z,B.ReferralCode=$;var H=B},70254:function(e,t,n){n.d(t,{UB:function(){return f},tn:function(){return h}});var a=n(2445),i=n(36814),r=n(32485),o=n.n(r),c=n(82187),l=n(73419),s=n(32876),d=n.n(s),u=n(6442),p=n(42280),m=n(95204),f=function(e){var t=e.stepNumber,n=e.vaccinationDetail,r=e.className,c=void 0===r?"mt-4":r,s=e.showDeliveryFee,u=e.quantity,p=n.id,f=n.slug,h=n.logo,g=n.hospital_branch,v=(n.name,n.display_name),_=(0,l.$)().asPath,y=(0,m.jX)(n),x=(0,m.OP)(f,p,_);return(0,a.FD)(i.a,{"data-testid":"product-info",className:o()("flex gap-3",c),children:[(0,a.FD)(i.a,{className:"flex-1",children:[y?(0,a.FD)("span",{className:"text-[17px] tracking-[-0.4px] leading-6 font-semibold text-dark block",children:[v,u&&u>=1&&" x ".concat(u)]}):(0,a.Y)(d(),{href:x,children:(0,a.FD)("a",{className:"text-[17px] tracking-[-0.4px] leading-6 font-semibold text-dark block cursor-pointer",children:[v,u&&u>=1&&" x ".concat(u)]})}),t!==m.RZ.ONE&&!s&&(0,a.Y)("p",{className:"border-l-2 border-solid border-gray200 pl-2 text-[13px] leading-5 tracking-[-0.3px] text-gray700 mt-2",children:g.name})]}),(0,a.Y)(i.a,{className:"w-[72px] h-[72px] min-w-[72px]",children:(0,a.Y)("img",{src:h||m.XS,className:"block w-full h-full object-cover rounded-lg"})})]})},h=function(){var e=(0,u.A)().formatMessage,t=(0,p.Jf)().currentStep;return t>0?(0,a.FD)(i.a,{"data-testid":"step-bar",className:"flex gap-1 justify-between items-start text-center",children:[(0,a.FD)(i.a,{className:"flex-1",children:[(0,a.Y)(i.a,{className:"h-1 rounded bg-primaryBase mb-2"}),(0,a.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] font-semibold text-primaryBase lg:whitespace-nowrap lg:px-4",children:e({id:"vaccination.payment.step_select_payment",defaultMessage:"SELECT PAYMENT"})})]}),(0,a.FD)(i.a,{className:"flex-1",children:[(0,a.Y)(i.a,{className:o()("h-1 rounded mb-2",{"bg-primaryBase":2===t,"bg-neutral100":t<2})}),(0,a.Y)("p",{className:o()("text-[13px] leading-5 tracking-[-0.3px] font-semibold lg:whitespace-nowrap lg:px-4",2===t?"text-primaryBase":"text-gray300"),children:e({id:"vaccination.payment.step_review_confirm",defaultMessage:"REVIEW AND CONFIRM"})})]})]}):null},g=function(e){var t=e.stepNumber,n=e.vaccinationDetail,r=e.children,c=e.showDeliveryFee,l=(0,u.A)().formatMessage,s=t===m.RZ.RESULT;return(0,a.FD)(i.a,{className:o()("bg-white pb-5 px-4 pt-3",s?"pt-2.5 pb-0":"pt-3"),children:[(0,a.Y)(h,{}),r,s&&(0,a.Y)("p",{className:"text-[22px] leading-8 font-semibold tracking-[-0.6px] text-dark",children:s&&l({id:"vaccination.payment_summary",defaultMessage:"Payment summary"})}),(0,a.Y)(f,{stepNumber:t,vaccinationDetail:n,className:s?"pt-5":"mt-7",showDeliveryFee:c})]})};g.Inner=f,g.SubscriptionInner=function(e){var t,n,r,l=e.subscriptionProduct,s=e.className,d=void 0===s?"mt-4":s,f=(0,u.A)().formatMessage,h=(0,p.Jf)().paymentResult,g=null===h||void 0===h||null===(t=h.snapshot_order)||void 0===t?void 0:t.image,v=(0,c.O)(l,f),_=null===h||void 0===h||null===(n=h.snapshot_order)||void 0===n?void 0:n.product_name,y=v.subtext;return(0,a.FD)(i.a,{"data-testid":"product-info-subscription",className:o()("flex gap-3",d),children:[(0,a.FD)(i.a,{className:"flex-1",children:[(0,a.Y)("p",{className:"text-[17px] tracking-[-0.4px] leading-6 font-semibold text-dark block",children:_}),(0,a.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-semibold mt-2",children:f({id:"subscription.payment.1st_month_label",defaultMessage:"{name} (1st month)"},{name:null===h||void 0===h||null===(r=h.snapshot_order)||void 0===r?void 0:r.drug_name})}),(0,a.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 mt-2",children:y})]}),(0,a.Y)(i.a,{className:"w-[72px] h-[72px] min-w-[72px]",children:(0,a.Y)("img",{src:g||m.XS,className:"block w-full h-full object-cover rounded-lg"})})]})},t.Ay=g},42280:function(e,t,n){n.d(t,{Jf:function(){return c},Ou:function(){return l},Zb:function(){return s}});var a=n(53513),i=n(63538),r=n(44745),o=n(95204),c=(0,r.vt)()((function(e,t){return{currentStep:o.RZ.ONE,quantity:1,setCurrentStep:function(t){return e((function(){return{currentStep:t}}))},setQuantity:function(t){e((function(){return{quantity:t}}))},providers:[],setProviders:function(t){return e((function(){return{providers:t}}))},setPaymentResult:function(t){return e((function(){return{paymentResult:t}}))},computedPrice:o.vp,setComputedPrice:function(n){if(!t().computedPrice.unit_price||n.unit_price){var a=t().vaccinationDetail;a&&(a.max_product_quantity=n.max_product_quantity,a.quantity_supported=Number(!!n.quantity_supported)),e((function(){return{computedPrice:n,vaccinationDetail:a}}))}},setSelectedPaymentValue:function(t){return e((function(){return{selectedPaymentValue:t}}))},setVaccinationDetail:function(t){return e((function(){return{vaccinationDetail:t}}))},setOpenOnlineBanking:function(t){return e((function(){return{openOnlineBanking:t}}))},setSelectedSubPaymentValue:function(t){e((function(){return{selectedSubPaymentValue:t}}))}}})),l={loading:!1,isOpenVoucher:!1,openResult:!1,listVoucher:[],appliedVoucher:null,lastVoucherApplied:null,referralData:null,appliedReferralCode:"",voucherCount:1},s=(0,r.vt)((function(e){return(0,i.A)((0,a.A)({},l),{setLoading:function(t){e((function(){return{loading:t}}))},setIsOpenVoucher:function(t){e((function(){return{isOpenVoucher:t}}))},setOpenResult:function(t){e((function(){return{openResult:t}}))},setListVoucher:function(t){t.length?e((function(){return{listVoucher:t}})):e((function(){return{listVoucher:t,lastVoucherApplied:null}}))},setAppliedVoucher:function(t){e(t?function(){return{appliedVoucher:t,lastVoucherApplied:t}}:function(){return{appliedVoucher:t}})},setLastVoucherApplied:function(t){e((function(){return{lastVoucherApplied:t}}))},setReferralData:function(t){e((function(){return{referralData:t}}))},setAppliedReferralCode:function(t){e((function(){return{appliedReferralCode:t}}))},setVoucherStore:function(t,n){e(t,n)}})}))},9655:function(e,t,n){n.d(t,{Y:function(){return v}});var a,i=n(38971),r=n(2445),o=n(73884),c=n(21995),l=n(36814),s=n(94858),d=n(84091),u=n(74353),p=n.n(u),m=n(73419),f=n(6442),h=n(86706),g=n(37680);n(40860),n(65826);var v=(a={},(0,i.A)(a,c.L.Vietnam,"vaccination.payment.product_price"),(0,i.A)(a,c.L.Malaysia,"vaccination.payment.product_price"),a);t.A=function(e){var t=e.paymentResult,n=e.vaccinationDetail,a=e.isFailed,i=e.isSuccess,u=e.isPending,_=e.className,y=e.style,x=e.action,b=e.subscriptionProduct,N=(0,m.$)().locale,w=(0,f.A)().formatMessage,Y=N===c.L.Vietnam?"vi":"en",k=t.payment_provider_title,D=t.snapshot_order,P=t.sub_payment_method,A=(0,h.T)(),C=A.getDisplayTaxPrice,M=A.getDisplayDeliveryFee,F={default:w({id:"vaccination.payment.status_default",defaultMessage:"Pending"}),success:w({id:"vaccination.payment.success",defaultMessage:"Success"}),failed:w({id:"vaccination.payment.failed",defaultMessage:"Failed"})},T=(0,d.nd)(w,(0,d.$g)(D.final_price,N),null===n||void 0===n?void 0:n.price_unit),S=(0,d.nd)(w,(0,d.$g)(D.original_price,N),null===n||void 0===n?void 0:n.price_unit),E=C(D.tax_unit,D.tax_computed,D.tax_amount),R=M(D.show_delivery_fee,D.delivery_fee,D.delivery_fee_currency),V=(0,d.nd)(w,(0,d.$g)(t.remain_amount,N),null===n||void 0===n?void 0:n.price_unit),I=(0,d.nd)(w,(0,d.$g)(t.transaction.amount,N),null===n||void 0===n?void 0:n.price_unit),O=Number((null===D||void 0===D?void 0:D.referral_discount_value)||0)+Number((null===D||void 0===D?void 0:D.voucher_discount_value)||0),L=O>0?(0,d.nd)(w,(0,d.$g)(O,N),(null===n||void 0===n?void 0:n.price_unit)||"RM"):"",j=null===n||void 0===n?void 0:n.hospital_branch.name,B=(0,o.useMemo)((function(){var e=w({id:"subscription.payment.1st_month_label",defaultMessage:"{name} (1st month)"},{name:null===b||void 0===b?void 0:b.title});return{displayPriceFirstMonth:t.snapshot_order.original_price>0?(0,d.UN)(t.snapshot_order.original_price,N):"",displayDiscountFirstMonth:t.snapshot_order.voucher_discount_value>0?"- "+(0,d.UN)(t.snapshot_order.voucher_discount_value,N):"",display1stMonthLabel:e,displayTotalPriceSubscription:t.snapshot_order.final_price>0?(0,d.UN)(t.snapshot_order.final_price,N):""}}),[w,N,t]),z=B.displayPriceFirstMonth,G=B.display1stMonthLabel,U=B.displayDiscountFirstMonth,$=B.displayTotalPriceSubscription;return(0,r.FD)(l.a,{"data-testid":"transaction-info",className:(0,s.A)(_,"bg-white pt-6 px-4 pb-2 lg:pb-3"),style:y,children:[(0,r.FD)(l.a,{className:"pb-4 flex justify-between items-center",children:[(0,r.Y)("h2",{className:"text-[17px] leading-6 tracking-[-0.4px] text-dark font-semibold",children:w({id:"vaccination.payment.transaction_info",defaultMessage:"Transaction Info"})}),i&&(0,r.Y)("label",{className:"rounded-[40px] py-[3px] px-2 bg-green50 font-medium text-[12px] leading-4 tracking-[-0.2px] text-green600",children:F.success}),a&&(0,r.Y)("label",{className:"rounded-[40px] py-[3px] px-2 bg-red50 font-medium text-[12px] leading-4 tracking-[-0.2px] text-red700",children:F.failed}),u&&(0,r.Y)("label",{className:"rounded-[40px] py-[3px] px-2 bg-yellow50 font-medium text-[12px] leading-4 tracking-[-0.2px] text-yellow800",children:F.default})]}),(0,r.FD)(l.a,{className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"vaccination.payment.date"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:p()(t.transaction.created_at).locale(Y).format("DD MMM YYYY - HH:mm")})]}),(0,r.FD)(l.a,{className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"vaccination.payment.transaction_id"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:t.transaction.transaction_id})]}),n&&(0,r.FD)(l.a,{"data-testid":"price-for-1-dose",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:(null===v||void 0===v?void 0:v[N])||v[c.L.Vietnam],defaultMessage:"Package price"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:S})]}),n&&R&&(0,r.FD)(l.a,{"data-testid":"shipping-fee",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"vaccination.payment.shipping_fee"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:R})]}),n&&E&&(0,r.FD)(l.a,{"data-testid":"tax-price",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"vaccination.payment.tax"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:E})]}),n&&L&&(0,r.FD)(l.a,{"data-testid":"discount-price",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"vaccination.payment.discount"})}),(0,r.FD)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-green600 font-medium",children:["-",L]})]}),n&&(null===t||void 0===t?void 0:t.payment_type)===g.Ai.ten_percent&&(0,r.FD)(r.FK,{children:[(0,r.FD)(l.a,{className:"py-3 gap-2 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 min-w-0",children:w({id:"vaccination.payment.pay_later",defaultMessage:"Pay later (at {hospital_name})"},{hospital_name:j})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium whitespace-nowrap",children:V})]}),(0,r.FD)(l.a,{className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:i?"vaccination.payment.already_paid_10_percentage":a?"vaccination.payment.failed_paid_10_percentage":"vaccination.payment.pending_paid_10_percentage"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:I})]})]}),n&&(null===t||void 0===t?void 0:t.payment_type)===g.Ai.full_payment&&(0,r.FD)(l.a,{className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"vaccination.payment.price_after_tax_discount",defaultMessage:"Package price after tax & discount"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:T})]}),n&&(null===t||void 0===t?void 0:t.payment_type)===g.Ai.one_hundred_percent&&(0,r.FD)(l.a,{"data-testid":"price-for-100-percent",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:i?"vaccination.payment.already_paid_100":a?"vaccination.payment.failed_paid_100_percentage":"vaccination.payment.pending_paid_100_percentage"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:T})]}),b&&(0,r.FD)(r.FK,{children:[(0,r.FD)(l.a,{"data-testid":"price-for-first-month",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:G}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:z})]}),U&&(0,r.FD)(l.a,{"data-testid":"price-for-first-month",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"subscription.payment.1st_month_discount_label",defaultMessage:"Discount (1st month)"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-green600 font-medium",children:U})]}),(0,r.FD)(l.a,{"data-testid":"price-for-first-month",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"vaccination.payment.total_payment"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:$})]})]}),(0,r.FD)(l.a,{className:"py-3 flex justify-between",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:w({id:"vaccination.payment.method"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:(null===P||void 0===P?void 0:P.title)?"".concat(w({id:"vaccination.payment.online_banking"})," - ").concat(null===P||void 0===P?void 0:P.title):k})]}),x]})}},12034:function(e,t,n){n.d(t,{Ue:function(){return p},ZN:function(){return u}});var a=n(53513),i=n(63538),r=n(2445),o=n(73884),c=n(48894),l=n(13306),s=n(6442),d=(0,o.createContext)({isOpenPopupCollection:!1,setIsOpenPopupCollection:function(){},onSubmitPopupCollection:function(){return new Promise((function(){return!0}))}}),u=function(){return(0,o.useContext)(d)},p=function(e){var t=e.value,n=e.children,o=(0,s.A)().formatMessage;return(0,r.Y)(d.Provider,{value:(0,i.A)((0,a.A)({},t),{onSubmitPopupCollection:function(e){var t=e.callingCode,n=e.countryCode,a=e.phone;return c.F.collectionSubmitCTA({area_code:t,country_code:n,cta_text:o({id:"common.contactVia",defaultMessage:"Contact {name}"},{name:l.so.Zalo}),phone_number:a,source_url:window.location.href,messaging_app:l.so.Zalo})}}),children:n})}},92047:function(e,t,n){n.d(t,{Gp:function(){return y},IL:function(){return h},eZ:function(){return _}});var a=n(53513),i=n(63538),r=n(73884),o=n(27516),c=n(84655),l=n(59850),s=n(14265),d=n(84091),u=n(73419),p=n(12215),m=n.n(p),f=n(28543),h=function(e){var t=e.vaccinationDetail,n=e.vaccinationPackages,p=t.id,m=t.hospital_branch,h=t.organization,g=m.id,v=h.id,_=(0,r.useState)(!0),y=_[0],b=_[1],N=(0,r.useState)(n||[]),w=N[0],Y=N[1],k=(0,u.$)().locale,D=o.y[k],P=(0,r.useCallback)((function(e){var t=e.clinic_id,n=e.product_id,r=e.hospital_id,o=e.product_type,u=void 0===o?s.V.vaccine_package:o,p=e.site;b(!0);var m={clinic_id:t,product_id:n,hospital_id:r,product_type:u,site:p};c.W.withCached(l.R.GET_VACCINATION_PACKAGES,(function(){return(0,d.px)((0,d.$k)(l.R.GET_VACCINATION_PACKAGES,m),"GET")})).then((function(e){var t=(e.data||{}).packages;if(t&&(null===t||void 0===t?void 0:t.length)){var n=x(t.map((function(e){var t=e.id;return"".concat(t)})));Y(t.map((function(e){return(0,i.A)((0,a.A)({},e),{stock:n[e.id]})})))}})).finally((function(){return b(!1)}))}),[]);return(0,r.useEffect)((function(){p&&g&&v&&f.LG.includes(k)?P({product_id:p,clinic_id:g,hospital_id:v,site:D}):b(!1)}),[p,g,v]),(0,r.useEffect)((function(){if(null===n||void 0===n?void 0:n.length){var e=x(n.map((function(e){var t=e.id;return"".concat(t)})));Y(n.map((function(t){return(0,i.A)((0,a.A)({},t),{stock:e[t.id]})})))}}),[n]),(0,r.useMemo)((function(){return{loading:y,setLoading:b,vaccinationPackages:w,setVaccinationPackages:Y,fetchVaccinationPackages:P}}),[y,b,w,Y,P])},g="VC_PKG_MG_NUM",v=function(e,t){return e+Math.floor(Math.random()*(t-e+1))};function _(){try{return JSON.parse(m().get(g)||"{}")||{}}catch(e){return{}}}function y(e,t){var n=_();return n[e]?n[e]=t>0?t:v(3,6):n[e]=v(3,6),m().set(g,JSON.stringify(n)),n}function x(e){var t=_(),n=!0,a=!1,i=void 0;try{for(var r,o=e[Symbol.iterator]();!(n=(r=o.next()).done);n=!0){var c=r.value;t[c]||(t[c]=v(3,6))}}catch(l){a=!0,i=l}finally{try{n||null==o.return||o.return()}finally{if(a)throw i}}return Object.keys(t).length&&m().set(g,JSON.stringify(t)),t}},73:function(e,t,n){n.d(t,{Kt:function(){return o},dm:function(){return c}});var a,i=n(38971),r=n(21995),o=(a={},(0,i.A)(a,r.L.Vietnam,"https://m.me/hellobacsi"),(0,i.A)(a,r.L.Malaysia,"https://m.me/HelloDoktorMY"),a),c=(0,i.A)({},r.L.Malaysia,"https://api.whatsapp.com/send/?phone=60163469577&text&type=phone_number&app_absent=0");(0,i.A)({},r.L.Vietnam,"https://zalo.me/3186943975751313634")}}]);