"use strict";(self.webpackChunkhhgHealthCareV1=self.webpackChunkhhgHealthCareV1||[]).push([[8754],{48894:function(e,t,n){n.d(t,{F:function(){return f}});var a=n(858),i=n(53513),r=n(53455),o=n(83776),c=n(84886),l=n(94886),s=n.n(l),d=n(13306),u=n(40959),p=s().create({baseURL:"".concat(u.Yif,"api")});p.interceptors.request.use(c.HH,c.DV),p.interceptors.response.use(c.U1,c.DV);var m=function(){var e=(0,a.A)((function(e){var t,n,a,c,l,s,u,m,f,g,_,y,v,h;return(0,o.__generator)(this,(function(o){return t=e.source_type,n=void 0===t?d.Y1.VACCINATION:t,a=e.widget_type,c=void 0===a?d.xO.STANDALONE_CTA_BUTTON:a,l=e.article_id,s=void 0===l?"":l,u=e.article_name,m=void 0===u?"NA":u,f=e.category_id,g=void 0===f?"":f,_=e.category_name,y=void 0===_?"NA":_,v=e.area_code,h=(0,r.A)(e,["source_type","widget_type","article_id","article_name","category_id","category_name","area_code"]),[2,p.post("/collection/cta-submit",(0,i.A)({source_type:n,widget_type:c,article_id:s,article_name:m,category_id:g,category_name:y,area_code:(null===v||void 0===v?void 0:v.includes("+"))?v:"+".concat(v)},h)).then((function(e){return 200===e.status}))]}))}));return function(t){return e.apply(this,arguments)}}(),f={collectionSubmitCTA:m}},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(95833),s=n(52194),d=n(84343),u=n(66405),p=n(48085),m=n(36814),f=n(94858),g=n(88491),_=n(73419),y=n(6442),v=n(12034),h=(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,g.d)().isMobile,i=(0,y.A)().formatMessage,c=(0,_.$)(),u=c.locale,p=c.push,N=(0,v.ZN)(),w=N.isOpenPopupCollection,k=N.setIsOpenPopupCollection,Y=N.onSubmitPopupCollection,M=o.Kt[u]||"",A=o.dm[u]||"",P=(null===h||void 0===h?void 0:h[u])||{},D=P.icon,C=P.label;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({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:[!!M&&(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(M)},styles:b,leftIcon:(0,r.Y)("img",{src:s.C.getAssetPath("messenger.png"),className:"w-[23px] h-[23px]"}),children:"Messenger"}),!!D&&!!C&&(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"!==C?p(A):k(!0)},styles:b,leftIcon:(0,r.Y)("img",{src:D,className:"w-[23px] h-[23px] rounded-md"}),children:C})]}),(0,r.Y)(l.P,{onOpenChange:k,isOpen:w,isMobile:a,onSubmit:Y})]})})}},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=(l||{}).price_unit,u=void 0===d?"":d,p=(0,a.useCallback)((function(n,a,r){return"%"===n&&a?"".concat(r,"%"):a?(0,i.nd)(t,(0,i.$g)(a,e),u):""}),[u,e]),m=(0,a.useMemo)((function(){return(null===s||void 0===s?void 0:s.show_delivery_fee)?(0,i.nd)(t,(0,i.$g)(s.delivery_fee,e),s.delivery_fee_currency):""}),[s.delivery_fee,s.delivery_fee_currency,e]);return l?{displayTotalPrice:(0,i.nd)(t,(0,i.$g)(s.final_price,e),u),displayShippingFee:m,displayPriceWithUnit:(0,i.nd)(t,(0,i.$g)(s.original_price,e),u),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),u):"",displayDiscountReferral:(0,i.nd)(t,(0,i.$g)(s.referral_discount_value,e),u),displayTaxPrice:p(s.tax_unit,s.tax_computed,s.tax_amount),displayPricePayTenPercentage:(0,i.nd)(t,(0,i.$g)(Math.floor(.1*s.final_price)),u),displayPriceRemaining:(0,i.nd)(t,(0,i.$g)(s.final_price-Math.floor(.1*s.final_price)),u),getDisplayTaxPrice:p}:{displayTotalPrice:"",displayShippingFee:"",displayPriceWithUnit:"",displayDiscountPrice:"",displayDiscountReferral:"",displayTaxPrice:"",displayPricePayTenPercentage:"",displayPriceRemaining:"",getDisplayTaxPrice:p}}},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),g=n(42280),_=n(9934),y=n(63231),v=n(94858),h=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,v.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,v=(0,p.$)().locale,N=(0,m.A)().formatMessage,w=(0,r.useState)(!0),k=w[0],Y=w[1],M=(0,r.useState)(),A=M[0],P=M[1],D=(0,g.Jf)(),C=D.providers,F=D.setProviders,T=D.selectedPaymentValue,S=D.vaccinationDetail,E=(0,f.T)().displayTotalPrice,R=(0,r.useMemo)((function(){var e=C.filter((function(e){return"10_percent"===e.payment_type})),t=C.filter((function(e){return"full_payment"===e.payment_type})),n=C.filter((function(e){return"100_percent"===e.payment_type}));return{ten_percent:e,full_payment:t,one_hundred_percent:n}}),[C]),I=(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)&&(Y(!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(v),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),Y(!1))})))}),[S]),(0,r.useMemo)((function(){if(I.length){var e=null===I||void 0===I?void 0:I[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),P(e)}}),[I,T]),(0,i.FD)("div",{id:"payment-method-step-1",className:"paymentMethod",children:[(0,i.Y)(y.A,{tabs:I,currentTab:A,onChangeTab:P}),(0,i.FD)(o.a,{className:"pt-[14px] bg-white",children:[A==b.ten_percent&&(0,i.FD)(o.a,{className:"px-4 pb-5 lg:pb-6",children:[(0,i.Y)(h,{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)(_.A,{loading:k,options:R.ten_percent,className:"mt-4"})]}),A==b.full_payment&&(0,i.Y)(o.a,{className:"px-4 pb-5 lg:pb-6",children:(0,i.Y)(_.A,{loading:k,options:R.full_payment})}),A==b.one_hundred_percent&&(0,i.FD)(o.a,{className:"px-4 pb-5 lg:pb-6",children:[(0,i.Y)(h,{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)(_.A,{loading:k,options:R.one_hundred_percent})]})]})]})}},18754:function(e,t,n){n.d(t,{A:function(){return z}});var a=n(858),i=n(53513),r=n(63538),o=n(83776),c=n(2445),l=n(73884),s=n(35291),d=n(52194),u=n(84343),p=n(66405),m=n(86436),f=n(36814),g=n(94858),_=n(59850),y=n(14265),v=n(84091),h=n(32485),x=n.n(h),b=n(74353),N=n.n(b),w=n(88491),k=n(60155),Y=n(67722),M=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,Y.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),P=n(6442),D=n(36259),C=n(12034),F=n(92047),T=n(20394),S=n(60785),E=n(70254),R=n(42280),I=n(9655),O=n(95204),V=n(37639),L=n(40959),B=function(e){var t,n,s=e.vaccinationDetail,d=(0,P.A)().formatMessage,p=(0,w.d)().isMobileOrTablet,m=(0,A.$)().query,g=String(m.ref_id||""),h=(0,R.Jf)(),b=h.paymentResult,N=h.setPaymentResult,k=(0,l.useState)(60),Y=k[0],O=k[1],L=(0,l.useContext)(D.B).pushNotifications,B=(0,F.eZ)();M(b);var $=function(){var e=(0,a.A)((function(){var e,t,n,a,c,l,u,p,m,f,h,x,N,w,k,Y,M,A,P,D,C;return(0,o.__generator)(this,(function(o){switch(o.label){case 0:if(q||!b||!Z)return[2];t=(e=b||{}).snapshot_order,n=e.payment_via,a=e.payment_type,c=e.payment_provider,u=(l=t||{}).type,p=l.product_id,m=l.clinic_id,f=l.voucher_code,h=l.referral_code,x=l.customer_info,N="".concat(window.location.origin).concat(window.location.pathname),w=s.id,k=null===c||void 0===c?void 0:c.toLowerCase(),u===y.V.vaccine_package&&(w=p),o.label=1;case 1:return o.trys.push([1,3,,4]),Q(!0),[4,(0,v.px)((0,v.fK)(_.R.GET_PAYMENT_URL,{provider:k}),"POST",{data:(0,r.A)((0,i.A)({},b.snapshot_order),{ref_id:g,amount:Z.amount,price_unit:s.price_unit,order_info:s.name,product_name:s.name,clinic_name:null===(Y=s.hospital_branch)||void 0===Y?void 0:Y.name,hospital_name:null===(M=s.organization)||void 0===M?void 0:M.name,hospital_branch_name:null===(A=s.hospital_branch)||void 0===A?void 0:A.name,image:s.logo,type:u,provider:k,return_url:N,product_id:w,payment_via:n,payment_type:a,clinic_id:m,voucher_code:f,referral_code:h,customer_info:x,sub_payment_method_code:null===b||void 0===b||null===(P=b.sub_payment_method)||void 0===P?void 0:P.code})})];case 2:if(D=o.sent(),!(C=D.data.url))throw new Error("");return window.location.href=C,Q(!1),[3,4];case 3:return o.sent(),L({message:d({id:"vaccination.payment.failed_desc",defaultMessage:"There was an issue with your {provider} transaction. Please try again or use another payment method."},{provider:b.payment_provider_title}),type:"danger"}),Q(!1),[3,4];case 4:return[2]}}))}));return function(){return e.apply(this,arguments)}}(),j=null===b||void 0===b||null===(t=b.transaction)||void 0===t?void 0:t.status,z=m.hhg_payment_token?String(m.hhg_payment_token):"",H=function(){"default"===j&&z&&(Q(!0),(0,v.px)((0,v.fK)(_.R.GET_PAYMENT_RESULT,{hhgToken:z}),"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;b&&a&&"default"!==a&&N(n)})).finally((function(){Q(!1)})))},J=b||{},W=J.payment_provider_title,Z=J.transaction,K=(J.user_referral||{}).code,X=(0,l.useState)(!1),q=X[0],Q=X[1],ee=(0,l.useState)(!1),te=ee[0],ne=ee[1],ae="success"===j,ie="failed"===j,re="default"===j,oe=ie&&(0,c.Y)(u.B,{size:"lg",fullWidth:!0,loading:q,onClick:$,children:(0,c.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium",children:d({id:"vaccination.payment.retry",defaultMessage:"Retry Payment"})})}),ce=re&&(0,c.Y)(u.B,{size:"lg",fullWidth:!0,loading:q,onClick:H,children:(0,c.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium pointer-events-none",children:d({id:"vaccination.payment.reload",defaultMessage:"Reload ({count})"},{count:Y})})});return(0,l.useEffect)((function(){var e;if((null===b||void 0===b||null===(e=b.snapshot_order)||void 0===e?void 0:e.type)===y.V.vaccine_package){var t,n=null===b||void 0===b||null===(t=b.snapshot_order)||void 0===t?void 0:t.product_id.toString();(0,F.Gp)(n,((null===B||void 0===B?void 0:B[n])||0)-1)}}),[]),(0,l.useEffect)((function(){if("default"===j&&z){var e=setInterval((function(){O((function(e){var t=e-1;return 0===t&&H(),t||60}))}),1e3);return function(){O(60),clearInterval(e)}}}),[j,z]),b&&Z?(0,c.FD)(C.Ue,{value:{isOpenPopupCollection:te,setIsOpenPopupCollection:ne},children:[(0,c.FD)(f.a,{className:"bg-neutral50 min-h-screen",children:[(0,c.Y)(S.A,{className:"lg:mb-8 lg:border-b lg:border-solid lg:border-gray200 lg:py-6 lg:flex lg:justify-center",customSize:p?void 0:{width:"141px",height:"32px"}}),(0,c.FD)(f.a,{className:"max-w-[552px] mx-auto",children:[(0,c.FD)(f.a,{className:x()("flex flex-col gap-3 lg:gap-2",ie||re?"pb-[100px]":"pb-[50px] lg:pb-[40px]"),children:[(null===Z||void 0===Z?void 0:Z.status)&&(0,c.Y)(U,{status:Z.status,provider:W}),(0,c.FD)(f.a,{className:"bg-white p-4 pt-6 lg:pb-6",children:[(0,c.Y)("div",{className:"payment__productInfo",children:(0,c.Y)(E.Ay.Inner,{stepNumber:0,vaccinationDetail:s,className:"mt-0",showDeliveryFee:null===(n=b.snapshot_order)||void 0===n?void 0:n.show_delivery_fee})}),K&&ae&&(0,c.Y)(G,{paymentResult:b,vaccinationDetail:s,userReferral:b.user_referral,className:"mt-4 !px-0"})]}),(0,c.Y)(I.A,{paymentResult:b,vaccinationDetail:s,isFailed:ie,isSuccess:ae,isPending:re,action:!p&&(ie||re)&&(0,c.Y)(f.a,{className:"py-1","data-testid":ie?"retry-button":"reload-button",children:ie?oe:ce})}),ae&&(0,c.Y)(T.Y,{})]}),ie&&p&&(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:oe}),re&&p&&(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:ce})]})]}),(0,c.Y)(V.A,{className:"!top-4 !right-4 !left-4"})]}):null},$={success:d.C.getAssetPath("payment/payment_success.png"),failed:d.C.getAssetPath("payment/payment_failed.png"),default:d.C.getAssetPath("payment/payment_pending.png")},j={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,P.A)().formatMessage,o=(null===$||void 0===$?void 0:$[t])||$.failed,s=(0,l.useMemo)((function(){var e=j.failed.title,a=j.failed.description;if(t in j){var i=j[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,g.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})]})})},G=function(e){var t=e.paymentResult,n=e.vaccinationDetail,a=e.userReferral,i=e.className,r=e.style,o=(0,P.A)().formatMessage,u=(0,A.$)(),_=u.locale,h=u.asPath,x=(0,w.d)().isMobileOrTablet,b=(0,l.useContext)(D.B).pushNotifications,k=null===a||void 0===a?void 0:a.code,Y=n||{},M=Y.name,C=(Y.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,v.nd)(o,(0,v.$g)((null===a||void 0===a?void 0:a.discount_value)||0,_),n.price_unit),I=(0,l.useMemo)((function(){if(L.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(L.JpE).concat(e(n.slug,n.id,h),"payment?referral_code=").concat(k);if(T===y.V.vaccine_package){var a=encodeURIComponent(E);t+="&pkg_name=".concat(a,"&pkg_id=").concat(S)}return t}),[k,T,S,E,n]),V=(0,l.useMemo)((function(){var e=N()(1e3*((null===a||void 0===a?void 0:a.expires_at)||0)),t=N()(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=M;return T===y.V.vaccine_package&&E&&(i+=" - ".concat(E)),[o({id:"vaccination.share_sentence1"},{productName:i,clinicName:C}),o({id:"vaccination.share_sentence2"},{refCode:k,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,k,M,E]),B=function(e){(0,O.lW)(e||I,(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,g.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(_===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:k}),(0,c.Y)(f.a,{className:"cursor-pointer",onClick:function(){return B()},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:I,title:n.name,text:V};navigator.share(e).then((function(){return console.log("Successful share")})).catch((function(e){console.log("Error sharing",e),B(V)}))}else B(V)},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=$,B.ReferralCode=G;var z=B},70254:function(e,t,n){n.d(t,{UB:function(){return m},tn:function(){return f}});var a=n(2445),i=n(36814),r=n(32485),o=n.n(r),c=n(73419),l=n(32876),s=n.n(l),d=n(6442),u=n(42280),p=n(95204),m=function(e){var t=e.stepNumber,n=e.vaccinationDetail,r=e.className,l=void 0===r?"mt-4":r,d=e.showDeliveryFee,u=n.id,m=n.slug,f=n.logo,g=n.hospital_branch,_=(n.name,n.display_name),y=(0,c.$)().asPath,v=(0,p.jX)(n),h=(0,p.OP)(m,u,y);return(0,a.FD)(i.a,{"data-testid":"product-info",className:o()("flex gap-3",l),children:[(0,a.FD)(i.a,{className:"flex-1",children:[v?(0,a.Y)("span",{className:"text-[17px] tracking-[-0.4px] leading-6 font-semibold text-dark block",children:_}):(0,a.Y)(s(),{href:h,children:(0,a.Y)("a",{className:"text-[17px] tracking-[-0.4px] leading-6 font-semibold text-dark block cursor-pointer",children:_})}),t!==p.RZ.ONE&&!d&&(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:f||p.XS,className:"block w-full h-full object-cover rounded-lg"})})]})},f=function(){var e=(0,d.A)().formatMessage,t=(0,u.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,d.A)().formatMessage,s=t===p.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)(f,{}),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)(m,{stepNumber:t,vaccinationDetail:n,className:s?"pt-5":"mt-7",showDeliveryFee:c})]})};g.Inner=m,t.Ay=g},9655:function(e,t,n){n.d(t,{Y:function(){return _}});var a,i=n(38971),r=n(2445),o=n(66405),c=n(36814),l=n(94858),s=n(84091),d=n(74353),u=n.n(d),p=n(73419),m=n(6442),f=n(86706),g=n(37680);n(40860),n(65826);var _=(a={},(0,i.A)(a,o.L.Vietnam,"vaccination.payment.product_price"),(0,i.A)(a,o.L.Malaysia,"vaccination.payment.product_price"),a);t.A=function(e){var t=e.paymentResult,n=e.vaccinationDetail,a=e.isFailed,i=e.isSuccess,d=e.isPending,y=e.className,v=e.style,h=e.action,x=(0,p.$)().locale,b=(0,m.A)().formatMessage,N=x===o.L.Vietnam?"vi":"en",w=t.payment_provider_title,k=t.snapshot_order,Y=t.sub_payment_method,M=(0,f.T)().getDisplayTaxPrice,A={default:b({id:"vaccination.payment.status_default",defaultMessage:"Pending"}),success:b({id:"vaccination.payment.success",defaultMessage:"Success"}),failed:b({id:"vaccination.payment.failed",defaultMessage:"Failed"})},P=(0,s.nd)(b,(0,s.$g)(k.final_price,x),n.price_unit),D=(0,s.nd)(b,(0,s.$g)(k.original_price,x),n.price_unit),C=M(k.tax_unit,k.tax_computed,k.tax_amount),F=(0,s.nd)(b,(0,s.$g)(t.remain_amount,x),n.price_unit),T=(0,s.nd)(b,(0,s.$g)(t.transaction.amount,x),n.price_unit),S=Number((null===k||void 0===k?void 0:k.referral_discount_value)||0)+Number((null===k||void 0===k?void 0:k.voucher_discount_value)||0),E=S>0?(0,s.nd)(b,(0,s.$g)(S,x),n.price_unit):"",R=null===n||void 0===n?void 0:n.hospital_branch.name;return(0,r.FD)(c.a,{"data-testid":"transaction-info",className:(0,l.A)(y,"bg-white pt-6 px-4 pb-2 lg:pb-3"),style:v,children:[(0,r.FD)(c.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:b({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:A.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:A.failed}),d&&(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:A.default})]}),(0,r.FD)(c.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:b({id:"vaccination.payment.date"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:u()(t.transaction.created_at).locale(N).format("DD MMM YYYY - HH:mm")})]}),(0,r.FD)(c.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:b({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})]}),(0,r.FD)(c.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:b({id:(null===_||void 0===_?void 0:_[x])||_[o.L.Vietnam],defaultMessage:"Package price"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:D})]}),C&&(0,r.FD)(c.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:b({id:"vaccination.payment.tax"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:C})]}),E&&(0,r.FD)(c.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:b({id:"vaccination.payment.discount"})}),(0,r.FD)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-green600 font-medium",children:["-",E]})]}),(null===t||void 0===t?void 0:t.payment_type)===g.Ai.ten_percent&&(0,r.FD)(r.FK,{children:[(0,r.FD)(c.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:b({id:"vaccination.payment.pay_later",defaultMessage:"Pay later (at {hospital_name})"},{hospital_name:R})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium whitespace-nowrap",children:F})]}),(0,r.FD)(c.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:b({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:T})]})]}),g.Ai.full_payment===(null===t||void 0===t?void 0:t.payment_type)&&(0,r.FD)(c.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:b({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:P})]}),g.Ai.one_hundred_percent===(null===t||void 0===t?void 0:t.payment_type)&&(0,r.FD)(c.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:b({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:P})]}),(0,r.FD)(c.a,{className:"py-3 flex justify-between",children:[(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:b({id:"vaccination.payment.method"})}),(0,r.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:(null===Y||void 0===Y?void 0:Y.title)?"".concat(b({id:"vaccination.payment.online_banking"})," - ").concat(null===Y||void 0===Y?void 0:Y.title):w})]}),h]})}},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 h},IL:function(){return g},eZ:function(){return v}});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),g=function(e){var t=e.vaccinationDetail,n=e.vaccinationPackages,p=t.id,m=t.hospital_branch,g=t.organization,_=m.id,y=g.id,v=(0,r.useState)(!0),h=v[0],b=v[1],N=(0,r.useState)(n||[]),w=N[0],k=N[1],Y=(0,u.$)().locale,M=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,i.A)((0,a.A)({},e),{stock:n[e.id]})})))}})).finally((function(){return b(!1)}))}),[]);return(0,r.useEffect)((function(){p&&_&&y&&f.LG.includes(Y)?A({product_id:p,clinic_id:_,hospital_id:y,site:M}):b(!1)}),[p,_,y]),(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,i.A)((0,a.A)({},t),{stock:e[t.id]})})))}}),[n]),(0,r.useMemo)((function(){return{loading:h,setLoading:b,vaccinationPackages:w,setVaccinationPackages:k,fetchVaccinationPackages:A}}),[h,b,w,k,A])},_="VC_PKG_MG_NUM",y=function(e,t){return e+Math.floor(Math.random()*(t-e+1))};function v(){try{return JSON.parse(m().get(_)||"{}")||{}}catch(e){return{}}}function h(e,t){var n=v();return n[e]?n[e]=t>0?t:y(3,6):n[e]=y(3,6),m().set(_,JSON.stringify(n)),n}function x(e){var t=v(),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]=y(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(_,JSON.stringify(t)),t}},28543:function(e,t,n){n.d(t,{LG:function(){return o},lL:function(){return i},zF:function(){return a}});var a,i,r=n(66405),o=[r.L.Vietnam,r.L.Malaysia];!function(e){e[e.available=1]="available",e[e.out_of_stock=0]="out_of_stock",e[e.limit=2]="limit"}(a||(a={})),function(e){e.PRICE="price",e.DISCOUNT="discount"}(i||(i={}))},67722:function(e,t,n){n.d(t,{$p:function(){return g},AQ:function(){return m},BB:function(){return l},HB:function(){return f},Hg:function(){return y},In:function(){return u},Sh:function(){return d},VG:function(){return v},Yp:function(){return p},fC:function(){return s},t2:function(){return _}});var a=n(40568),i=n(2543),r=n(10159),o=n(6442),c=n(40959),l=function(e){return(e=null===e||void 0===e?void 0:e.replace("_",""))?e.charAt(0).toUpperCase()+e.slice(1):""},s=function(e,t){var n="",a=c.pTf[t].prefix,i=void 0===a?"":a,r=Array.from(e);if(!e)return"";var o=new RegExp("^\\".concat(i),"gi").test(e);return r.forEach((function(e,t){o&&tt?e.substring(0,t):e},m=function(e){return e?{years:parseInt("".concat(e/365)),months:parseInt("".concat(e/30)),weeks:parseInt("".concat(e/7))}:{years:0,months:0,weeks:0}};function f(e){if(e)try{if(new URL(e)){var t=r.H8&&r.XF?"_self":"_blank";window.open(e,t)}}catch(n){console.log("\ud83d\ude80 ~ handleDeepLink ~ error:",n)}}function g(e){if("no_age"===e||!e)return 0;var t=(0,a.A)(e.split("-"),2),n=t[0];return"month"!==t[1]?0:Number(n)}function _(e){if(!(0,i.isArray)(e)||0===e.length)return{comboMapByDisplayName:new Map,sortedList:[]};var t=function(e){var t=new Map,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,l=c.age;l||(l="no_age");var s=t.get(l);s||t.set(l,s=[]),s.push(c)}}catch(d){a=!0,i=d}finally{try{n||null==o.return||o.return()}finally{if(a)throw i}}return t}(e),n=function(e){var t=new Map;return e.forEach((function(e,n){var a=new Map;e.forEach((function(e){var t=e.display_name;t||(t="no_name");var n=a.get(t);n||a.set(t,n=[]),n.push(e)})),t.set(n,Object.fromEntries(a))})),t}(t),a=Array.from(t.keys()).sort((function(e,t){return g(e)-g(t)}));return{resultData:Object.fromEntries(n),sortedList:a}}function y(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return e.toString().padStart(t,"0")}var v=function(e){try{var t=new URL(e).pathname;if(new RegExp("/payment").test(t)){var n=t.replace("/payment","").split("/"),a=n[n.length-1].split("-"),i=a[a.length-1].trim();return Number(i)}return null}catch(r){return console.log("\ud83d\ude80 ~ getIdFromPaymentUrl ~ error:",r),null}}}}]);