"use strict";(self.webpackChunkhhgHealthCareV1=self.webpackChunkhhgHealthCareV1||[]).push([[8754],{84655:function(e,t,n){n.d(t,{W:function(){return o}});var i=n(858),a=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,i.A)((function(e,t){var n,i,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(),i=setInterval((function(){(new Date).getTime()-n>3e3&&clearInterval(i),"object"===typeof o.cached[e]&&(t(o.cached[e]),clearInterval(i))}),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 i=r.sent(),o.cached[e]=void 0,c=(0,a.A)(i,Error)?i:new Error(String(i)),[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 v}});var i=n(858),a=n(44898),r=n(53513),o=n(53455),c=n(83776),l=n(27516),s=n(94886),d=n.n(s),u=n(59850),p=n(84091),m=n(40959),f=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}},h=d().create({baseURL:"https://health-care.hellohealthgroup.com/",headers:{accept:"application/json, text/plain, version=2.0.0"}});h.interceptors.request.use((function(e){return m.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 g=function(){var e=(0,i.A)((function(e){var t,n,i,a,l,s,d,u;return(0,c.__generator)(this,(function(c){return t=e.path,n=e.body,i=e.reqCookie,a=(0,p.fK)(t),l=n.card_token_id,s=(0,o.A)(n,["card_token_id"]),d=(0,r.A)({},s,l?{card_token_id:l}:{}),u=f(),[2,(null!=u?(0,p.px)(a,"POST",{data:d,headers:{Authorization:"Bearer ".concat(u)}}):(0,p.T7)(a,"POST",{data:d},i)).then((function(e){return e&&"object"===typeof e?e:null}))]}))}));return function(t){return e.apply(this,arguments)}}(),v={getSubscriptionProduct:function(e){var t,n=e.site,i=void 0===n?l.y["vi-VN"]:n,a=e.plan_key;return h.get((0,p.w5)(u.R.GET_SUBSCRIPTION_PRODUCT,{site:i,plan_key:a})).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,i=e.schedule_id,a=void 0===i?"":i,r=e.reqCookie,o=(0,p.fK)(u.R.GET_TELECONSULTATION_SUBSCRIPTION_DATA,{doctor_id:n,schedule_id:a}),c=f();return(null!=c?(0,p.px)(o,"GET",{headers:{Authorization:"Bearer ".concat(c)}}):(0,p.T7)(o,"GET",void 0,r)).then((function(e){return e&&"object"===typeof e?e:null}))},getTeleconsultationSubscriptionCards:function(){var e=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}).reqCookie,t=(0,p.fK)(u.R.GET_TELECONSULTATION_SUBSCRIPTION_CARDS),n=f(),i=null!=n?(0,p.px)(t,"GET",{headers:{Authorization:"Bearer ".concat(n)}}):(0,p.T7)(t,"GET",void 0,e);return i.then((function(e){return e&&"object"===typeof e?e:null}))},chargeTeleconsultationSubscription:function(e){var t=e.subscription_id,n=e.customer_address,i=e.shipping_address,a=e.email,o=e.card_token_id,c=e.reqCookie;return g({path:u.R.POST_TELECONSULTATION_SUBSCRIPTION_CHARGE,body:(0,r.A)({subscription_id:t,customer_address:n,shipping_address:i,email:a},o?{card_token_id:o}:{}),reqCookie:c})},chargeTeleconsultationSubscriptionWithNewCard:function(e){var t=e.subscription_id,n=e.customer_address,i=e.shipping_address,a=e.email,r=e.reqCookie;return g({path:u.R.POST_TELECONSULTATION_SUBSCRIPTION_CHARGE_WITH_NEW_CARD,body:{subscription_id:t,customer_address:n,shipping_address:i,email:a},reqCookie:r})}}},99187:function(e,t,n){n.d(t,{Pj:function(){return f},Ty:function(){return v},u7:function(){return g}});var i,a,r,o=n(81539),c=n(73884),l=n(84091),s=n(73419),d=n(6442),u=n(35652),p=n(95204),m=function(e){var t=h(e).map((function(e){return e.name}));return t.length>0?t:(null===e||void 0===e?void 0:e.glp1_drug_name)?[e.glp1_drug_name]:[]},f=function(e){return m(e).join(" + ")},h=function(e){return(0,o.A)(null!==(i=null===e||void 0===e?void 0:e.breakdown)&&void 0!==i?i:[]).filter((function(e){return e.name})).sort((function(e,t){return(null!==(a=e.line_no)&&void 0!==a?a:0)-(null!==(r=t.line_no)&&void 0!==r?r:0)}))},g=function(e){return[e.subscription_brand_name,e.subscription_title].filter(Boolean).join(" - ")},v=function(){var e=(0,d.A)().formatMessage,t=(0,s.$)().locale,n=(0,u.i)().teleconsultationSubscription;return(0,c.useMemo)((function(){var i=null===n||void 0===n?void 0:n.order_schedule,a=null===i||void 0===i?void 0:i.find((function(e){return"current"===e.type})),r=f(a),o=m(a).length>1,c=g({subscription_brand_name:null===n||void 0===n?void 0:n.subscription_brand_name,subscription_title:null===n||void 0===n?void 0:n.subscription_title}),s=o?c:[r,null===n||void 0===n?void 0:n.subscription_title].filter(Boolean).join(" - "),d=!(null===i||void 0===i?void 0:i.some((function(e){return"previous"===e.type}))),u=d&&!o?e({id:"subscription.confirm.service_fee_first_month",defaultMessage:"{name} (1st month)"},{name:r}):r,v=(null===a||void 0===a?void 0:a.amount)?(0,l.UN)(a.amount,t):"",_=!!a&&"number"===typeof a.original_price&&a.original_price>a.amount,y=_?(0,l.UN)(a.original_price||0,t):"";return{currentOrder:a,currentOrderBreakdownLines:h(a),currentOrderImage:(null===a||void 0===a?void 0:a.glp1_drug_image_url)||p.XS,currentOrderName:s,isMultiDrug:o,isFirstMonth:d,serviceFeeLabel:u,currentOrderAmount:v,currentOrderOriginalAmount:y,showCurrentOrderOriginalPrice:_}}),[e,t,n])}},35652:function(e,t,n){n.d(t,{i:function(){return r}});var i=n(44745),a=n(95204),r=(0,i.vt)()((function(e,t){return{currentStep:1,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}}))},computedPrice:a.vp,setComputedPrice:function(n){t().computedPrice.unit_price&&!n.unit_price||e((function(){return{computedPrice:n}}))},setSelectedPaymentValue:function(t){return e((function(){return{selectedPaymentValue:t}}))},setSubscriptionProduct:function(t){return e((function(){return{subscriptionProduct:t}}))},setTeleconsultationSubscription:function(t){return e((function(){return{teleconsultationSubscription:t}}))},subscriptionSavedCards:[],subscriptionSavedCardsCount:0,subscriptionSavedCardsMax:0,setSubscriptionSavedCards:function(t){var n=t.cards,i=t.count,a=t.max_cards;return e((function(){return{subscriptionSavedCards:n,subscriptionSavedCardsCount:i,subscriptionSavedCardsMax:a}}))},setOpenOnlineBanking:function(t){return e((function(){return{openOnlineBanking:t}}))},setSelectedSubPaymentValue:function(t){e((function(){return{selectedSubPaymentValue:t}}))}}}))},82187:function(e,t,n){function i(e){return e.flatMap((function(e){return e.split("\n").map((function(e){return e.trim()})).filter(Boolean)}))}function a(e){var t=i(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=a(r["Sokongan Berterusan"]||[]),l=a(r["Best For"]||[]),s=i(r["Diskaun Komitmen"]||[]).map((function(e){var t=/class=["']discount["']/.test(e);return{text:e.replace(/<[^>]+>/g,"").trim(),isHighlighted:t}})),d=i(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 i,a=n(38971),r=n(2445),o=n(73),c=n(35291),l=n(93766),s=n(12575),d=n(64196),u=n(67454),p=n(48085),m=n(36814),f=n(94858),h=n(88491),g=n(73419),v=n(6442),_=n(12034),y=(i={},(0,a.A)(i,u.L.Vietnam,{label:"Zalo",icon:s.C.getAssetPath("zalo-mini.png")}),(0,a.A)(i,u.L.Malaysia,{label:"WhatsApp",icon:s.C.getAssetPath("whatsapp.svg")}),i),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,i=(0,h.d)().isMobile,a=(0,v.A)().formatMessage,c=(0,g.$)(),u=c.locale,p=c.push,N=c.router,w=(0,_.ZN)(),k=w.isOpenPopupCollection,Y=w.setIsOpenPopupCollection,D=w.onSubmitPopupCollection,A=o.Kt[u]||"",P=o.dm[u]||"",C=(null===y||void 0===y?void 0:y[u])||{},S=C.icon,M=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:a({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:a(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:[!!A&&!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(A)},styles:b,leftIcon:(0,r.Y)("img",{src:s.C.getAssetPath("messenger.png"),className:"w-[23px] h-[23px]"}),children:"Messenger"}),!!S&&!!M&&(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"!==M?p(P):Y(!0)},styles:b,leftIcon:(0,r.Y)("img",{src:S,className:"w-[23px] h-[23px] rounded-md"}),children:M})]}),(0,r.Y)(l.P,{onOpenChange:Y,isOpen:k,isMobile:i,onSubmit:D})]})})}},60785:function(e,t,n){n.d(t,{F:function(){return p}});var i=n(2445),a=n(55474),r=n(96420),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,i.Y)(u(),{href:"/",children:(0,i.Y)("a",{href:"/",className:"block text-[0px]",children:(0,i.Y)(a.L,{customSize:n,type:c})})})};t.A=function(e){var t=e.className,n=e.customSize;return(0,i.Y)(o.a,{className:l()("p-4 sticky top-0 bg-white z-10",t),children:(0,i.Y)(p,{customSize:n})})}},86706:function(e,t,n){n.d(t,{T:function(){return l}});var i=n(73884),a=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,i.useCallback)((function(n,i,r){return"%"===n&&i?"".concat(r,"%"):i?(0,a.nd)(t,(0,a.$g)(i,e),p):""}),[p,e]),f=(0,i.useCallback)((function(n,i,r){return n?(0,a.nd)(t,(0,a.$g)(i,e),r):""}),[e]),h=(0,i.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,a.nd)(t,(0,a.$g)(s.final_price,e),p),v=(0,a.nd)(t,(0,a.$g)(s.original_price,e),p),_="".concat((0,a.nd)(t,(0,a.$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,a.nd)(t,(0,a.$g)(s.voucher_discount_value+s.referral_discount_value,e),p):"",displayDiscountReferral:(0,a.nd)(t,(0,a.$g)(s.referral_discount_value,e),p),displayTaxPrice:m(s.tax_unit,s.tax_computed,s.tax_amount),displayPricePayTenPercentage:(0,a.nd)(t,(0,a.$g)(Math.floor(.1*s.final_price)),p),displayPriceRemaining:(0,a.nd)(t,(0,a.$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 i=n(53513),a=n(53455),r=n(2445),o=n(73884),c=n(35291),l=n(81120),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,i=e.content,a=e.className,o=e.style,c=(0,g.A)().formatMessage,l=(null===i||void 0===i?void 0:i.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)(a,"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)(a,"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,i=e.payment_type,a=e.title;return"".concat(t,"-").concat(n,"-").concat(i,"-").concat(a)}var N=function(e){var t=e.loading,n=e.options,N=e.defaultValue,w=e.onChange,k=e.className,Y=e.style,D=(0,v.Jf)(),A=D.selectedPaymentValue,P=D.setSelectedPaymentValue,C=D.openOnlineBanking,S=D.setOpenOnlineBanking,M=D.selectedSubPaymentValue,T=D.setSelectedSubPaymentValue,F=(0,g.A)().formatMessage,E=(0,o.useMemo)((function(){var e,t=null===n||void 0===n?void 0:n.find((function(e){return A===b(e)}));return t&&(null===(e=t.sub_payment_methods)||void 0===e?void 0:e.length)?(M||S(!0),t.sub_payment_methods.filter((function(e){return e.is_active}))):[]}),[A]),O=(0,o.useMemo)((function(){return E.find((function(e){return e.code===M}))}),[M,E]),R=(0,o.useCallback)((function(e){P(e),T(""),null===w||void 0===w||w(e)}),[n,w]),I=(0,o.useCallback)((function(){S(!1),M||R("")}),[M,R]),V=(0,o.useCallback)((function(e){S(!1),T("".concat(e))}),[]);return t?(0,r.FD)(d.a,{className:(0,u.A)(k,"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:A,onChange:R,className:(0,u.A)(k,"payment__list","p-4 flex flex-col gap-2","border border-solid border-[rgba(0,0,0,0.1)] rounded-xl"),style:Y,children:n.map((function(e,t){var i,a=e.logo,p=e.title,g=e.description,v=e.provider,x=a||(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!==A})]}),(0,r.Y)(h.s,{value:N,checked:N===A,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===(i=e.sub_payment_methods)||void 0===i?void 0:i.length)&&O&&(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===O||void 0===O?void 0:O.logo,className:"w-8 h-6"}),(0,r.Y)("p",{className:"m-0 flex-1 min-w-0",children:null===O||void 0===O?void 0:O.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 S(!0)},className:"flex items-center text-primary600 !text-[13px] !leading-5 tracking-[-0.3px] cursor-pointer",children:[F({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,a.A)(e,["title","code"]);return(0,i.A)({label:t,value:n},r)})),value:"".concat(M),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:V})]}):null}},63231:function(e,t,n){n.d(t,{A:function(){return u}});var i=n(53513),a=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,i=d.x,a=d.y,r=12,o=4/3*(Math.sqrt(2)-1)*r;return"M0,".concat(a+c,"\n\t\t\tV").concat(a+t,"\n\t\t\tH").concat(i-r,"\n\t\t\tC").concat(i-r+o,",").concat(a+t," ").concat(i,",").concat(a+t-o," ").concat(i,",").concat(a+t-r,"\n\t\t\tV").concat(a+r+1,"\n\t\t\tC").concat(i,",").concat(a+r+1-o," ").concat(i+o,",").concat(a+1," ").concat(i+r,",").concat(a+1,"\n\t\t\tH").concat(i+e-r,"\n\t\t\tC").concat(i+e-o,",").concat(a+1," ").concat(i+e,",").concat(a+r+1-o," ").concat(i+e,",").concat(a+r+1,"\n\t\t\tV").concat(t-r,"\n\t\t\tC").concat(i+e,",").concat(a+t-o," ").concat(i+e+r-o,",").concat(a+t," ").concat(i+e+r,",").concat(a+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,a.A)((0,i.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],k=N[1],Y=(0,o.useCallback)((function(e){requestAnimationFrame((function(){var t,n=v.current[e],i=_.current,a=null===i||void 0===i||null===(t=i.children)||void 0===t?void 0:t[0];n&&i&&a&&i.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,a.A)((0,i.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 N},Ay:function(){return k},ze:function(){return w}});var i=n(40568),a=n(81539),r=n(2445),o=n(73884),c=n(86540),l=n(36814),s=n(51387),d=n(48085),u=n(84655),p=n(59850),m=n(84091),f=n(73419),h=n(6442),g=n(42280),v=n(9934),_=n(63231),y=n(94858),x=function(e){var t=e.icon,n=e.titleComponent,i=e.rightComponent,a=e.className,o=e.style;return t||n||i?(0,r.FD)(l.a,{className:(0,y.A)(a,"payment__warningBox","p-3 flex gap-2 items-center justify-between bg-yellow50","border border-solid border-yellow200 rounded-xl"),style:o,children:[!!t&&(0,r.Y)("img",{src:t,className:"payment__warningBoxIcon w-5 h-5 leading-none"}),!!n&&(0,r.Y)("div",{className:"payment__warningBoxContent flex-1 min-w-0 text-[13px] font-semibold leading-5 tracking-[-0.3px]",children:n}),!!i&&(0,r.Y)("p",{className:"payment__warningBoxPrice text-gray900 font-semibold text-[15px] leading-6 tracking-[-0.3px]",children:i})]}):null},b=n(40959),N={ten_percent:"10_percent",one_hundred_percent:"100_percent",full_payment:"full_payment"};function w(e){var t=(0,i.A)(e.split("-"),4);return{provider:t[0],paymentVia:t[1],paymentType:t[2],providerTitle:t[3]}}var k=function(e){var t=e.loadingPrice,n=e.displayPricePayNow,i=e.displayPriceRemaining,y=(0,f.$)().locale,w=(0,h.A)().formatMessage,k=(0,o.useState)(!0),Y=k[0],D=k[1],A=(0,o.useState)(),P=A[0],C=A[1],S=(0,g.Jf)(),M=S.providers,T=S.setProviders,F=S.selectedPaymentValue,E=S.vaccinationDetail,O=(0,o.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]),R=(0,o.useMemo)((function(){return(0,a.A)(O.full_payment).concat((0,a.A)(O.one_hundred_percent))}),[O]),I=(0,o.useMemo)((function(){var e,t,n,i=[];(O.ten_percent.length&&i.push({label:O.ten_percent[0].display_label||w({id:"vaccination.payment.tabs.pay_10_percent",defaultMessage:"Pay 10% to Book"}),value:N.ten_percent}),(null===(e=O.one_hundred_percent)||void 0===e?void 0:e.length)||(null===(t=O.full_payment)||void 0===t?void 0:t.length))&&i.push({label:(null===(n=O.one_hundred_percent[0])||void 0===n?void 0:n.display_label)||w({id:"vaccination.payment.tabs.pay_100_percent",defaultMessage:"Pay 100%"}),value:N.one_hundred_percent});return i}),[O.ten_percent,O.one_hundred_percent,O.full_payment]);return(0,o.useEffect)((function(){var e;(null===E||void 0===E||null===(e=E.organization)||void 0===e?void 0:e.id)&&(D(!0),u.W.withCached(p.R.GET_VACCINATION_PAYMENT_PROVIDER,(function(){var e;return(0,m.px)((0,m.fK)(p.R.GET_VACCINATION_PAYMENT_PROVIDER,{locale:String(y),hospitalId:null===E||void 0===E||null===(e=E.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)&&(T(e.data.items),D(!1))})))}),[null===E||void 0===E?void 0:E.id]),(0,o.useMemo)((function(){if(I.length){var e=null===I||void 0===I?void 0:I[0].value;F&&F.includes(N.ten_percent)&&(e=N.ten_percent),F&&(F.includes(N.full_payment)||F.includes(N.one_hundred_percent))&&(e=N.one_hundred_percent),C(e)}}),[I,F]),(0,r.Y)("div",{id:"payment-method-step-1",className:"paymentMethod",children:O.ten_percent.length>0?(0,r.FD)(r.FK,{children:[(0,r.Y)(_.A,{tabs:I,currentTab:P,onChangeTab:C}),(0,r.FD)(l.a,{className:"pt-[14px] bg-white",children:[P==N.ten_percent&&(0,r.FD)(l.a,{className:"px-4 pb-5 lg:pb-6",children:[(0,r.Y)(x,{icon:"".concat(b.JpE,"/svg/coin.svg"),titleComponent:w({id:"vaccination.payment.warning.pay_now",defaultMessage:"Pay Now ({number})"},{number:"10%"}),rightComponent:t?(0,r.Y)(s.E,{width:"100%",height:(0,d.D)(24)}):n}),(0,r.Y)("p",{className:"mt-2 text-gray700 text-[13px] leading-5 tracking-[-0.3px]",children:w({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,r.Y)(s.E,{width:"50px"}):i})}),(0,r.Y)(v.A,{loading:Y,options:O.ten_percent,className:"mt-4"})]}),P==N.one_hundred_percent&&(0,r.Y)(l.a,{className:"px-4 pb-5 lg:pb-6",children:(0,r.Y)(v.A,{loading:Y,options:R})})]})]}):(0,r.FD)(l.a,{className:"flex flex-col rounded-2xl bg-white py-6 px-4 gap-4",children:[(0,r.Y)(l.a,{className:"flex items-center",children:(0,r.Y)(c.T,{size:"title1",fw:600,color:"gray1000",children:w({id:"subscription.payment.payment_method",defaultMessage:"Payment Method"})})}),(0,r.Y)(v.A,{loading:Y,options:R})]})})}},18754:function(e,t,n){n.d(t,{A:function(){return W}});var i=n(858),a=n(53513),r=n(63538),o=n(83776),c=n(2445),l=n(73884),s=n(35291),d=n(12575),u=n(64196),p=n(67454),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),k=n(88491),Y=n(97705),D=n(67722),A=function(e){var t,n=(0,Y.a)();if("success"===(null===e||void 0===e||null===(t=e.transaction)||void 0===t?void 0:t.status)){var i=n.getHref();if(i){var a,r=(0,D.VG)(i);r!==(null===e||void 0===e||null===(a=e.snapshot_order)||void 0===a?void 0:a.product_id)&&null!==r||n.resetHref()}}},P=n(73419),C=n(6442),S=n(36259),M=n(12034),T=n(92047),F=n(20394),E=n(60785),O=n(70254),R=n(42280),I=n(9655),V=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,k.d)().isMobileOrTablet,x=(0,P.$)().query,N=String(x.ref_id||""),w=(0,R.Jf)(),Y=w.paymentResult,D=w.setPaymentResult,V=(0,l.useState)(60),j=V[0],B=V[1],U=(0,l.useContext)(S.B).pushNotifications,z=(0,T.eZ)();A(Y);var W=function(){var e=(0,i.A)((function(){var e,t,n,i,c,l,s,u,p,f,h,_,x,b,w,k,D,A,P,C,S;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(ne||!Y||!Q||!d)return[2];t=(e=Y||{}).snapshot_order,n=e.payment_via,i=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]),ie(!0),[4,(0,y.px)((0,y.fK)(g.R.GET_PAYMENT_URL,{provider:w}),"POST",{data:(0,r.A)((0,a.A)({},Y.snapshot_order),{ref_id:N,amount:Q.amount,price_unit:d.price_unit,order_info:d.name,product_name:d.name,clinic_name:null===(k=d.hospital_branch)||void 0===k?void 0:k.name,hospital_name:null===(D=d.organization)||void 0===D?void 0:D.name,hospital_branch_name:null===(A=d.hospital_branch)||void 0===A?void 0:A.name,image:d.logo,type:s,provider:w,return_url:x,product_id:b,payment_via:n,payment_type:i,clinic_id:p,voucher_code:f,referral_code:h,customer_info:_,sub_payment_method_code:null===Y||void 0===Y||null===(P=Y.sub_payment_method)||void 0===P?void 0:P.code})})];case 2:if(C=o.sent(),!(S=C.data.url))throw new Error("");return window.location.href=S,ie(!1),[3,4];case 3:return o.sent(),U({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:Y.payment_provider_title}),type:"danger"}),ie(!1),[3,4];case 4:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),$=function(){var e=(0,i.A)((function(){var e,t,n,i,c,l,s,d;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(ne||!Y||!p)return[2];o.label=1;case 1:return o.trys.push([1,6,,7]),ie(!0),t={address_line:(Y.snapshot_order.customer_address.address_line||"").trim(),city:(Y.snapshot_order.customer_address.city||"").trim(),country:(Y.snapshot_order.customer_address.country||"").trim(),zip_or_postal_code:(Y.snapshot_order.customer_address.zip_or_postal_code||"").trim()},n={address_line:(Y.snapshot_order.shipping_address.address_line||"").trim(),city:(Y.snapshot_order.shipping_address.city||"").trim(),country:(Y.snapshot_order.shipping_address.country||"").trim(),zip_or_postal_code:(Y.snapshot_order.shipping_address.zip_or_postal_code||"").trim()},i="ipay88"===Y.payment_provider&&"BCC"===Y.sub_payment_method_code,c={subscription_id:Y.snapshot_order.subscription_id,customer_address:t,shipping_address:n,email:Y.snapshot_order.customer_info.email},i?[4,_.dR.chargeTeleconsultationSubscriptionWithNewCard(c)]:[3,3];case 2:return s=o.sent(),[3,5];case 3:return[4,_.dR.chargeTeleconsultationSubscription((0,r.A)((0,a.A)({},c),{card_token_id:Y.snapshot_order.card_token_id}))];case 4:s=o.sent(),o.label=5;case 5:if(!(d=null===(l=s)||void 0===l||null===(e=l.data)||void 0===e?void 0:e.url))throw new Error("Missing payment url");return window.location.href=d,[3,7];case 6:return o.sent(),U({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:Y.payment_provider_title}),type:"danger"}),ie(!1),[3,7];case 7:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),H=null===Y||void 0===Y||null===(t=Y.transaction)||void 0===t?void 0:t.status,K=x.hhg_payment_token?String(x.hhg_payment_token):"",Z=function(){"default"===H&&K&&(ie(!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,i=null===n||void 0===n||null===(t=n.transaction)||void 0===t?void 0:t.status;Y&&i&&"default"!==i&&D(n)})).finally((function(){ie(!1)})))},J=Y||{},X=J.payment_provider_title,Q=J.transaction,ee=(J.user_referral||{}).code,te=(0,l.useState)(!1),ne=te[0],ie=te[1],ae=(0,l.useState)(!1),re=ae[0],oe=ae[1],ce="success"===H,le="failed"===H,se="default"===H,de=le&&(0,c.Y)(u.B,{size:"lg",fullWidth:!0,loading:ne,onClick:p?$:W,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:Z,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===Y||void 0===Y||null===(e=Y.snapshot_order)||void 0===e?void 0:e.type)===v.V.vaccine_package){var t,n=null===Y||void 0===Y||null===(t=Y.snapshot_order)||void 0===t?void 0:t.product_id.toString();(0,T.Gp)(n,((null===z||void 0===z?void 0:z[n])||0)-1)}}),[]),(0,l.useEffect)((function(){if("default"===H&&K){var e=setInterval((function(){B((function(e){var t=e-1;return 0===t&&Z(),t||60}))}),1e3);return function(){B(60),clearInterval(e)}}}),[H,K]),Y&&Q?(0,c.FD)(M.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)(G,{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)(O.Ay.Inner,{stepNumber:0,vaccinationDetail:d,className:"mt-0",showDeliveryFee:null===(n=Y.snapshot_order)||void 0===n?void 0:n.show_delivery_fee,quantity:null===(s=Y.snapshot_order)||void 0===s?void 0:s.quantity}),p&&(0,c.Y)(O.Ay.SubscriptionInner,{subscriptionProduct:p,className:"mt-0"})]}),ee&&ce&&d&&(0,c.Y)(q,{paymentResult:Y,vaccinationDetail:d,userReferral:Y.user_referral,className:"mt-4 !px-0"})]}),(0,c.Y)(I.A,{paymentResult:Y,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)(F.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},U={success:d.C.getAssetPath("payment/payment_success.png"),failed:d.C.getAssetPath("payment/payment_failed.png"),default:d.C.getAssetPath("payment/payment_pending.png")},z={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"}}},G=function(e){var t=e.status,n=e.provider,i=e.className,a=e.style,r=(0,C.A)().formatMessage,o=(null===U||void 0===U?void 0:U[t])||U.failed,s=(0,l.useMemo)((function(){var e=z.failed.title,i=z.failed.description;if(t in z){var a=z[t];e=a.title,i=a.description}return{title:r(e),description:r(i,{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)(i,"result","result-".concat(t),"bg-white p-4 text-center lg:rounded-t-2xl"),style:a,"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})]})})},q=function(e){var t=e.paymentResult,n=e.vaccinationDetail,i=e.userReferral,a=e.className,r=e.style,o=(0,C.A)().formatMessage,u=(0,P.$)(),g=u.locale,_=u.asPath,x=(0,k.d)().isMobileOrTablet,b=(0,l.useContext)(S.B).pushNotifications,N=null===i||void 0===i?void 0:i.code,Y=n||{},D=Y.name,A=(Y.hospital_branch||{}).name,M=t.snapshot_order,T=M.type,F=M.product_id,E=M.product_package_name,O="percentage"===(null===i||void 0===i?void 0:i.discount_type)?"".concat(null===i||void 0===i?void 0:i.discount_value,"%"):(0,y.nd)(o,(0,y.$g)((null===i||void 0===i?void 0:i.discount_value)||0,g),n.price_unit),R=(0,l.useMemo)((function(){if(j.kUY)return"";var e=(0,V.jX)(n)?V.kx:(0,V.J8)(n)?V.W:(0,V.FL)(n)?V.km:(0,V.LJ)(n)?V.w7:V.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 i=encodeURIComponent(E);t+="&pkg_name=".concat(i,"&pkg_id=").concat(F)}return t}),[N,T,F,E,n]),I=(0,l.useMemo)((function(){var e=w()(1e3*((null===i||void 0===i?void 0:i.expires_at)||0)),t=w()(1e3*((null===i||void 0===i?void 0:i.created_at)||0)),n=function(e,t){var n=(t-e)/864e5;return Math.max(Math.round(n),1)}(Number(t),Number(e)),a=D;return T===v.V.vaccine_package&&E&&(a+=" - ".concat(E)),[o({id:"vaccination.share_sentence1"},{productName:a,clinicName:A}),o({id:"vaccination.share_sentence2"},{refCode:N,refAmount:O,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,i,O,N,D,E]),L=function(e){(0,V.lW)(e||R,(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)(a,"px-4"),style:r,children:(0,c.FD)(f.a,{style:x?V.yi:V.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:O,count:(null===i||void 0===i?void 0:i.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:R,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=G,B.ResultIcon=U,B.ReferralCode=q;var W=B},70254:function(e,t,n){n.d(t,{UB:function(){return x},tn:function(){return b}});var i,a,r,o=n(81539),c=n(2445),l=n(36814),s=n(32485),d=n.n(s),u=n(99187),p=n(82187),m=n(73419),f=n(32876),h=n.n(f),g=n(6442),v=n(42280),_=n(95204),y=function(e){return(0,o.A)(null!==(i=null===e||void 0===e?void 0:e.breakdown)&&void 0!==i?i:[]).filter((function(e){return e.name})).sort((function(e,t){return(null!==(a=e.line_no)&&void 0!==a?a:0)-(null!==(r=t.line_no)&&void 0!==r?r:0)}))},x=function(e){var t=e.stepNumber,n=e.vaccinationDetail,i=e.className,a=void 0===i?"mt-4":i,r=e.showDeliveryFee,o=e.quantity,s=n.id,u=n.slug,p=n.logo,f=n.hospital_branch,g=n.display_name,v=(0,m.$)().asPath,y=(0,_.jX)(n),x=(0,_.OP)(u,s,v);return(0,c.FD)(l.a,{"data-testid":"product-info",className:d()("flex gap-3",a),children:[(0,c.FD)(l.a,{className:"flex-1",children:[y?(0,c.FD)("span",{className:"text-[17px] tracking-[-0.4px] leading-6 font-semibold text-dark block",children:[g,o&&o>=1&&" x ".concat(o)]}):(0,c.Y)(h(),{href:x,children:(0,c.FD)("a",{className:"text-[17px] tracking-[-0.4px] leading-6 font-semibold text-dark block cursor-pointer",children:[g,o&&o>=1&&" x ".concat(o)]})}),t!==_.RZ.ONE&&!r&&(0,c.Y)("p",{className:"border-l-2 border-solid border-gray200 pl-2 text-[13px] leading-5 tracking-[-0.3px] text-gray700 mt-2",children:f.name})]}),(0,c.Y)(l.a,{className:"w-[72px] h-[72px] min-w-[72px]",children:(0,c.Y)("img",{src:p||_.XS,className:"block w-full h-full object-cover rounded-lg"})})]})},b=function(){var e=(0,g.A)().formatMessage,t=(0,v.Jf)().currentStep;return t>0?(0,c.FD)(l.a,{"data-testid":"step-bar",className:"flex gap-1 justify-between items-start text-center",children:[(0,c.FD)(l.a,{className:"flex-1",children:[(0,c.Y)(l.a,{className:"h-1 rounded bg-primaryBase mb-2"}),(0,c.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,c.FD)(l.a,{className:"flex-1",children:[(0,c.Y)(l.a,{className:d()("h-1 rounded mb-2",{"bg-primaryBase":2===t,"bg-neutral100":t<2})}),(0,c.Y)("p",{className:d()("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},N=function(e){var t=e.stepNumber,n=e.vaccinationDetail,i=e.children,a=e.showDeliveryFee,r=(0,g.A)().formatMessage,o=t===_.RZ.RESULT;return(0,c.FD)(l.a,{className:d()("bg-white pb-5 px-4 pt-3",o?"pt-2.5 pb-0":"pt-3"),children:[(0,c.Y)(b,{}),i,o&&(0,c.Y)("p",{className:"text-[22px] leading-8 font-semibold tracking-[-0.6px] text-dark",children:o&&r({id:"vaccination.payment_summary",defaultMessage:"Payment summary"})}),(0,c.Y)(x,{stepNumber:t,vaccinationDetail:n,className:o?"pt-5":"mt-7",showDeliveryFee:a})]})};N.Inner=x,N.SubscriptionInner=function(e){var t,n,i=e.subscriptionProduct,a=e.className,r=void 0===a?"mt-4":a,o=(0,g.A)().formatMessage,s=(0,v.Jf)().paymentResult,m=null===s||void 0===s?void 0:s.snapshot_order,f=null===m||void 0===m?void 0:m.image,h=(0,p.O)(i,o),x=function(e){return y(e).length>1}(s),b=(0,u.u7)({subscription_brand_name:null!==(t=null===m||void 0===m?void 0:m.subscription_brand_name)&&void 0!==t?t:i.brand_name,subscription_title:null!==(n=null===m||void 0===m?void 0:m.subscription_title)&&void 0!==n?n:i.title}),N=x?b:null===m||void 0===m?void 0:m.product_name,w=h.subtext,k=function(e){var t,n=y(e).map((function(e){return e.name}));return n.length>0?n.join(" + "):null===e||void 0===e||null===(t=e.snapshot_order)||void 0===t?void 0:t.drug_name}(s),Y=x?k:o({id:"subscription.payment.1st_month_label",defaultMessage:"{name} (1st month)"},{name:k||i.title});return(0,c.FD)(l.a,{"data-testid":"product-info-subscription",className:d()("flex gap-3",r),children:[(0,c.FD)(l.a,{className:"flex-1",children:[(0,c.Y)("p",{className:"text-[17px] tracking-[-0.4px] leading-6 font-semibold text-dark block",children:N}),Y&&(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-semibold mt-2",children:Y}),!x&&(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 mt-2",children:w})]}),(0,c.Y)(l.a,{className:"w-[72px] h-[72px] min-w-[72px]",children:(0,c.Y)("img",{src:f||_.XS,className:"block w-full h-full object-cover rounded-lg"})})]})},t.Ay=N},42280:function(e,t,n){n.d(t,{Jf:function(){return c},Ou:function(){return l},Zb:function(){return s}});var i=n(53513),a=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 i=t().vaccinationDetail;i&&(i.max_product_quantity=n.max_product_quantity,i.quantity_supported=Number(!!n.quantity_supported)),e((function(){return{computedPrice:n,vaccinationDetail:i}}))}},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,a.A)((0,i.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 b}});var i,a=n(38971),r=n(81539),o=n(2445),c=n(73884),l=n(67454),s=n(36814),d=n(94858),u=n(84091),p=n(74353),m=n.n(p),f=n(73419),h=n(6442),g=n(86706),v=n(37680);n(40860),n(65826);var _,y,x,b=(i={},(0,a.A)(i,l.L.Vietnam,"vaccination.payment.product_price"),(0,a.A)(i,l.L.Malaysia,"vaccination.payment.product_price"),i);t.A=function(e){var t=e.paymentResult,n=e.vaccinationDetail,i=e.isFailed,a=e.isSuccess,p=e.isPending,N=e.className,w=e.style,k=e.action,Y=e.subscriptionProduct,D=(0,f.$)().locale,A=(0,h.A)().formatMessage,P=D===l.L.Vietnam?"vi":"en",C=t.payment_provider_title,S=t.snapshot_order,M=t.sub_payment_method,T=(0,g.T)(),F=T.getDisplayTaxPrice,E=T.getDisplayDeliveryFee,O={default:A({id:"vaccination.payment.status_default",defaultMessage:"Pending"}),success:A({id:"vaccination.payment.success",defaultMessage:"Success"}),failed:A({id:"vaccination.payment.failed",defaultMessage:"Failed"})},R=(0,u.nd)(A,(0,u.$g)(S.final_price,D),null===n||void 0===n?void 0:n.price_unit),I=(0,u.nd)(A,(0,u.$g)(S.original_price,D),null===n||void 0===n?void 0:n.price_unit),V=F(S.tax_unit,S.tax_computed,S.tax_amount),L=E(S.show_delivery_fee,S.delivery_fee,S.delivery_fee_currency),j=(0,u.nd)(A,(0,u.$g)(t.remain_amount,D),null===n||void 0===n?void 0:n.price_unit),B=(0,u.nd)(A,(0,u.$g)(t.transaction.amount,D),null===n||void 0===n?void 0:n.price_unit),U=Number((null===S||void 0===S?void 0:S.referral_discount_value)||0)+Number((null===S||void 0===S?void 0:S.voucher_discount_value)||0),z=U>0?(0,u.nd)(A,(0,u.$g)(U,D),(null===n||void 0===n?void 0:n.price_unit)||"RM"):"",G=null===n||void 0===n?void 0:n.hospital_branch.name,q=(0,c.useMemo)((function(){var e,n=1===t.snapshot_order.charge_sequence,i=function(e){return(0,r.A)(null!==(_=e.breakdown)&&void 0!==_?_:[]).filter((function(e){return e.name})).sort((function(e,t){return(null!==(y=e.line_no)&&void 0!==y?y:0)-(null!==(x=t.line_no)&&void 0!==x?x:0)}))}(t),a=i.length>1,o=A({id:"subscription.payment.1st_month_label",defaultMessage:"{name} (1st month)"},{name:t.snapshot_order.drug_name||(null===Y||void 0===Y?void 0:Y.title)}),c=i.map((function(t){return{label:n&&!a?A({id:"subscription.payment.1st_month_label",defaultMessage:"{name} (1st month)"},{name:t.name}):t.name,amount:(0,u.UN)(null!==(e=t.original_price)&&void 0!==e?e:t.amount,D)}}));return{displayPriceFirstMonth:t.snapshot_order.original_price>0?(0,u.UN)(t.snapshot_order.original_price,D):"",displayDiscountFirstMonth:t.snapshot_order.voucher_discount_value>0?"- "+(0,u.UN)(t.snapshot_order.voucher_discount_value,D):"",display1stMonthLabel:o,displayTotalPriceSubscription:t.snapshot_order.final_price>0?(0,u.UN)(t.snapshot_order.final_price,D):"",subscriptionBreakdownLines:c}}),[A,D,t,null===Y||void 0===Y?void 0:Y.title]),W=q.displayPriceFirstMonth,$=q.display1stMonthLabel,H=q.displayDiscountFirstMonth,K=q.displayTotalPriceSubscription,Z=q.subscriptionBreakdownLines;return(0,o.FD)(s.a,{"data-testid":"transaction-info",className:(0,d.A)(N,"bg-white pt-6 px-4 pb-2 lg:pb-3"),style:w,children:[(0,o.FD)(s.a,{className:"pb-4 flex justify-between items-center",children:[(0,o.Y)("h2",{className:"text-[17px] leading-6 tracking-[-0.4px] text-dark font-semibold",children:A({id:"vaccination.payment.transaction_info",defaultMessage:"Transaction Info"})}),a&&(0,o.Y)("label",{className:"rounded-[40px] py-[3px] px-2 bg-green50 font-medium text-[12px] leading-4 tracking-[-0.2px] text-green600",children:O.success}),i&&(0,o.Y)("label",{className:"rounded-[40px] py-[3px] px-2 bg-red50 font-medium text-[12px] leading-4 tracking-[-0.2px] text-red700",children:O.failed}),p&&(0,o.Y)("label",{className:"rounded-[40px] py-[3px] px-2 bg-yellow50 font-medium text-[12px] leading-4 tracking-[-0.2px] text-yellow800",children:O.default})]}),(0,o.FD)(s.a,{className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"vaccination.payment.date"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:m()(t.transaction.created_at).locale(P).format("DD MMM YYYY - HH:mm")})]}),(0,o.FD)(s.a,{className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"vaccination.payment.transaction_id"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:t.transaction.transaction_id})]}),n&&(0,o.FD)(s.a,{"data-testid":"price-for-1-dose",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:(null===b||void 0===b?void 0:b[D])||b[l.L.Vietnam],defaultMessage:"Package price"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:I})]}),n&&L&&(0,o.FD)(s.a,{"data-testid":"shipping-fee",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"vaccination.payment.shipping_fee"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:L})]}),n&&V&&(0,o.FD)(s.a,{"data-testid":"tax-price",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"vaccination.payment.tax"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:V})]}),n&&z&&(0,o.FD)(s.a,{"data-testid":"discount-price",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"vaccination.payment.discount"})}),(0,o.FD)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-green600 font-medium",children:["-",z]})]}),n&&(null===t||void 0===t?void 0:t.payment_type)===v.Ai.ten_percent&&(0,o.FD)(o.FK,{children:[(0,o.FD)(s.a,{className:"py-3 gap-2 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 min-w-0",children:A({id:"vaccination.payment.pay_later",defaultMessage:"Pay later (at {hospital_name})"},{hospital_name:G})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium whitespace-nowrap",children:j})]}),(0,o.FD)(s.a,{className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:a?"vaccination.payment.already_paid_10_percentage":i?"vaccination.payment.failed_paid_10_percentage":"vaccination.payment.pending_paid_10_percentage"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:B})]})]}),n&&(null===t||void 0===t?void 0:t.payment_type)===v.Ai.full_payment&&(0,o.FD)(s.a,{className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"vaccination.payment.price_after_tax_discount",defaultMessage:"Package price after tax & discount"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:R})]}),n&&(null===t||void 0===t?void 0:t.payment_type)===v.Ai.one_hundred_percent&&(0,o.FD)(s.a,{"data-testid":"price-for-100-percent",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:a?"vaccination.payment.already_paid_100":i?"vaccination.payment.failed_paid_100_percentage":"vaccination.payment.pending_paid_100_percentage"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:R})]}),Y&&(0,o.FD)(o.FK,{children:[Z.length>0?Z.map((function(e,t){return(0,o.FD)(s.a,{"data-testid":"price-for-first-month",className:"py-3 gap-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 min-w-0",children:e.label}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium whitespace-nowrap",children:e.amount})]},"".concat(e.label,"-").concat(t))})):(0,o.FD)(s.a,{"data-testid":"price-for-first-month",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:$}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:W})]}),H&&(0,o.FD)(s.a,{"data-testid":"price-for-first-month",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"subscription.payment.1st_month_discount_label",defaultMessage:"Discount (1st month)"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-green600 font-medium",children:H})]}),(0,o.FD)(s.a,{"data-testid":"price-for-first-month",className:"py-3 flex justify-between border-b border-solid border-neutral100",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"vaccination.payment.total_payment"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:K})]})]}),(0,o.FD)(s.a,{className:"py-3 flex justify-between",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:A({id:"vaccination.payment.method"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:(null===M||void 0===M?void 0:M.title)?"".concat(A({id:"vaccination.payment.online_banking"})," - ").concat(null===M||void 0===M?void 0:M.title):C})]}),k]})}},12034:function(e,t,n){n.d(t,{Ue:function(){return p},ZN:function(){return u}});var i=n(53513),a=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,a.A)((0,i.A)({},t),{onSubmitPopupCollection:function(e){var t=e.callingCode,n=e.countryCode,i=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:i,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 i=n(53513),a=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],k=N[1],Y=(0,u.$)().locale,D=o.y[Y],A=(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)})));k(t.map((function(e){return(0,a.A)((0,i.A)({},e),{stock:n[e.id]})})))}})).finally((function(){return b(!1)}))}),[]);return(0,r.useEffect)((function(){p&&g&&v&&f.LG.includes(Y)?A({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)})));k(n.map((function(t){return(0,a.A)((0,i.A)({},t),{stock:e[t.id]})})))}}),[n]),(0,r.useMemo)((function(){return{loading:y,setLoading:b,vaccinationPackages:w,setVaccinationPackages:k,fetchVaccinationPackages:A}}),[y,b,w,k,A])},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,i=!1,a=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){i=!0,a=l}finally{try{n||null==o.return||o.return()}finally{if(i)throw a}}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 i,a=n(38971),r=n(67454),o=(i={},(0,a.A)(i,r.L.Vietnam,"https://m.me/hellobacsi"),(0,a.A)(i,r.L.Malaysia,"https://m.me/HelloDoktorMY"),i),c=(0,a.A)({},r.L.Malaysia,"https://api.whatsapp.com/send/?phone=60163469577&text&type=phone_number&app_absent=0");(0,a.A)({},r.L.Vietnam,"https://zalo.me/3186943975751313634")}}]);