"use strict";(self.webpackChunkhhgHealthCareV1=self.webpackChunkhhgHealthCareV1||[]).push([[1393],{45782:function(e,t,a){a.d(t,{A:function(){return he}});var i=a(858),r=a(53513),n=a(63538),l=a(83776),o=a(2445),c=a(73884),s=a(41579),d=a(48045),p=a(52238),u=a(1657),m=a(36814),h=a(59850),f=a(14265),g=a(84091),x=a(57421),v=a(88491),y=a(56771),_=a(73419),C=a(6442),b=a(36259),Y=a(74353),N=a.n(Y),w=a(18754),k=a(42280),F=function(){var e=(0,_.$)().locale,t=(0,k.Zb)(),a=t.referralData,i=t.appliedReferralCode,l=(0,k.Jf)().vaccinationDetail,s=(0,C.A)().formatMessage,d=(0,c.useState)({showAlreadyBefore:!1,hide:!1}),p=d[0],u=d[1];(0,c.useEffect)((function(){(null===l||void 0===l?void 0:l.id)&&u({showAlreadyBefore:!1,hide:!1})}),[null===l||void 0===l?void 0:l.id]),(0,c.useEffect)((function(){console.log("appliedReferralCode",i),u(i?function(e){return(0,n.A)((0,r.A)({},e),{showAlreadyBefore:!0})}:function(e){return(0,n.A)((0,r.A)({},e),{hide:!!e.showAlreadyBefore})})}),[i]);var h=(0,c.useMemo)((function(){if(!(null===a||void 0===a?void 0:a.created_at)||!(null===a||void 0===a?void 0:a.expires_at))return"";var e=N()(1e3*(Number(a.expires_at)||0)),t=N()(),i=function(e,t){var a=(t-e)/864e5;return Math.max(Math.round(a),1)}(Number(t),Number(e));return i}),[a]),f=(0,c.useMemo)((function(){return a&&l?"percentage"===a.discount_type?"".concat(a.discount_value,"%"):(0,g.nd)(s,(0,g.$g)(a.discount_value,e),l.price_unit):""}),[a]);return p.showAlreadyBefore&&!p.hide?(0,o.FD)(m.a,{className:"rounded-xl border border-solid border-neutral100 p-4 text-center mt-7 md:mt-0 bg-white md:mb-3 md:border-0 md:rounded-b-none md:p-6",children:[(0,o.Y)("img",{src:w.A.ResultIcon.success,alt:"HHG",className:"max-h-[96px] mb-4 block mx-auto"}),(0,o.Y)("p",{className:"text-[22px] leading-8 tracking-[-0.6px] font-semibold text-dark",children:s({id:"vaccination.payment.notice.congratulations"})}),(0,o.FD)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] mt-2 text-gray600 max-w-[330px] mx-auto",children:[s({id:"vaccination.payment.notice.recieved"},{discount:f,b:function(e){return(0,o.Y)("span",{className:"font-semibold text-dark",children:e})}}),(0,o.Y)("br",{}),s({id:"vaccination.payment.notice.book_now"},{valid_days:h,b:function(e){return(0,o.Y)("span",{className:"font-semibold text-dark",children:e})}})]})]}):null},D=a(60785),A=a(86706),M=a(47511),E=a(42594),L=function(){var e,t,a=(0,C.A)().formatMessage,i=(0,E.a)(),r=(0,M.J3)(),n=r.openPopupOrganization,l=r.closePopupOrganization,s=(0,k.Jf)().vaccinationDetail;return(0,c.useEffect)((function(){l()}),[s]),s?(0,o.FD)(m.a,{className:"bg-white py-5 px-4","data-testid":"hospital-clinic-info",children:[(0,o.FD)(m.a,{className:"flex items-center justify-between gap-3",children:[(0,o.Y)("p",{className:"text-[17px] leading-6 tracking-[-0.4px] font-semibold text-gray1000 flex-1",children:a({id:"vaccination.payment.hospital_clinic",defaultMessage:"Hospital / Clinic"})}),i.current&&(0,o.Y)("button",{onClick:n,className:"text-[13px] leading-5 tracking-[-0.3px] font-medium text-primaryBase w-auto",children:a({id:"vaccination.payment.change",defaultMessage:"Change"})})]}),(0,o.FD)(m.a,{className:"mt-3",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] font-semibold text-gray1000",children:null===(e=s.hospital_branch)||void 0===e?void 0:e.name}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 mt-1",children:null===(t=s.hospital_branch)||void 0===t?void 0:t.address})]})]}):null},P=a(37680),S=a(21995),V=a(2543),O=function(e){var t=e.className;return(0,o.Y)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,o.Y)("path",{d:"M3.125 6.37497C3.01875 6.37497 2.92969 6.33902 2.85781 6.26712C2.78594 6.19522 2.75 6.10612 2.75 5.99982C2.75 5.89352 2.78594 5.80448 2.85781 5.73269C2.92969 5.6609 3.01875 5.625 3.125 5.625H8.87498C8.98123 5.625 9.07029 5.66095 9.14216 5.73285C9.21404 5.80476 9.24998 5.89386 9.24998 6.00015C9.24998 6.10645 9.21404 6.1955 9.14216 6.26729C9.07029 6.33908 8.98123 6.37497 8.87498 6.37497H3.125Z",fill:"#595959"})})},T=function(e){var t=e.className;return(0,o.Y)("svg",{width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:(0,o.Y)("path",{d:"M5.625 6.37498H3.125C3.01875 6.37498 2.92969 6.33903 2.85781 6.26713C2.78594 6.19522 2.75 6.10612 2.75 5.99983C2.75 5.89353 2.78594 5.80448 2.85781 5.73269C2.92969 5.6609 3.01875 5.625 3.125 5.625H5.625V3.125C5.625 3.01875 5.66095 2.92969 5.73285 2.85781C5.80476 2.78594 5.89386 2.75 6.00015 2.75C6.10645 2.75 6.1955 2.78594 6.26729 2.85781C6.33908 2.92969 6.37497 3.01875 6.37497 3.125V5.625H8.87498C8.98123 5.625 9.07029 5.66095 9.14216 5.73285C9.21404 5.80476 9.24998 5.89386 9.24998 6.00015C9.24998 6.10645 9.21404 6.1955 9.14216 6.26729C9.07029 6.33908 8.98123 6.37498 8.87498 6.37498H6.37497V8.87498C6.37497 8.98123 6.33902 9.07029 6.26712 9.14216C6.19522 9.21404 6.10612 9.24998 5.99983 9.24998C5.89353 9.24998 5.80448 9.21404 5.73269 9.14216C5.6609 9.07029 5.625 8.98123 5.625 8.87498V6.37498Z",fill:"#595959"})})},B=function(){return(0,o.FD)(o.FK,{children:[(0,o.FD)(m.a,{className:"flex flex-col gap-4 pb-2 border-b border-solid border-neutral100 animate-pulse",children:[(0,o.FD)(m.a,{className:"flex justify-between",children:[(0,o.Y)("div",{className:"h-5 w-[127px] rounded-full bg-gray200"}),(0,o.Y)("div",{className:"h-5 w-[60px] rounded-full bg-gray200"})]}),(0,o.FD)(m.a,{className:"flex justify-between",children:[(0,o.Y)("div",{className:"h-5 w-[51px] rounded-full bg-gray200"}),(0,o.Y)("div",{className:"h-5 w-[60px] rounded-full bg-gray200"})]})]}),(0,o.FD)(m.a,{className:"flex justify-between py-2 animate-pulse",children:[(0,o.Y)("div",{className:"h-5 w-[55px] rounded-full bg-gray200"}),(0,o.Y)("div",{className:"h-6 w-[65px] rounded-full bg-gray200"})]})]})},R=a(9655),U=a(95204),Z=function(e){var t=e.loadingPrice,a=e.action,i=(0,k.Jf)(),r=i.setQuantity,n=i.computedPrice,l=i.vaccinationDetail,s=(0,A.T)(),d=s.quantity,p=s.displayShippingFee,u=s.displayDiscountPrice,h=s.displayTotalPrice,f=s.displayTaxPrice,g=s.displayPriceWithUnitAndQuantity,x=(0,C.A)().formatMessage,v=(0,_.$)().locale,y=(0,c.useMemo)((function(){return(0,V.debounce)((function(e){var t=k.Jf.getState().quantity,a=(null===l||void 0===l?void 0:l.max_product_quantity)||U.ZX,i=Math.max(1,t+e);i!==t&&i=Number((null===l||void 0===l?void 0:l.max_product_quantity)||U.ZX),className:"w-6 h-6 border-solid border-neutral100 border rounded-lg p-[5px] hover:border-primaryBase transition-all disabled:opacity-50 disabled:cursor-not-allowed disabled:hover:border-neutral100",children:(0,o.Y)(T,{className:"block"})})]})]}),p&&(0,o.FD)(m.a,{className:"flex justify-between border-b border-solid border-neutral100 py-2 lg:py-3",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:x({id:"vaccination.payment.shipping_fee",defaultMessage:"Shipping Fee"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 lg:font-medium",children:p})]}),f&&(0,o.FD)(m.a,{className:"flex justify-between border-b border-solid border-neutral100 py-2 lg:py-3",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:x({id:"vaccination.payment.tax",defaultMessage:"Tax"})}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 lg:font-medium",children:f})]}),u&&(0,o.FD)(m.a,{className:"flex justify-between border-b border-solid border-neutral100 py-2 lg:py-3",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:x({id:"vaccination.payment.discount",defaultMessage:"Discount"})}),(0,o.FD)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-green600 font-medium",children:["-",u]})]})]}),(0,o.FD)(m.a,{className:"flex justify-between items-center py-2 lg:py-3",children:[(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:x({id:"vaccination.payment.total",defaultMessage:"Total"})}),(0,o.Y)("p",{className:"text-[15px] leading-6 tracking-[-0.3px] text-dark font-semibold",children:h})]}),a]}),t&&(0,o.Y)(B,{})]})},H=a(70254),I=a(35291),z=a(27773),G=a(94858),q=a(85862),j=a(4982),W=a(86604),$=a(20396),J=a(51387),K=a(32485),Q=a.n(K),X=a(59260),ee=function(e){var t=e.className;return(0,o.FD)("svg",{width:189,height:103,viewBox:"0 0 189 103",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,children:[(0,o.FD)("g",{clipPath:"url(#clip0_5854_17923)",children:[(0,o.FD)("g",{clipPath:"url(#clip1_5854_17923)",children:[(0,o.Y)("path",{opacity:"0.15",d:"M140.95 26.614C140.95 26.614 136.508 -8.10425 110.303 16.8566C76.7093 48.8527 54.1283 -14.7403 29.2078 11.2177C15.5932 25.3985 51.5695 57.1134 27.5424 73.8037C3.51531 90.4941 23.1498 102.989 23.1498 102.989H159.582C159.582 102.989 173.706 104.008 174.775 86.1553C175.842 68.3026 159.424 68.0862 169.614 45.7452C179.803 23.4041 144.152 40.834 140.95 26.614Z",fill:"url(#paint0_linear_5854_17923)"}),(0,o.Y)("path",{opacity:"0.6",d:"M93.0825 45.4159C96.7359 45.4159 99.6975 42.4574 99.6975 38.8079C99.6975 35.1585 96.7359 32.2 93.0825 32.2C89.4292 32.2 86.4675 35.1585 86.4675 38.8079C86.4675 42.4574 89.4292 45.4159 93.0825 45.4159Z",fill:"url(#paint1_linear_5854_17923)"}),(0,o.Y)("path",{d:"M93.0828 36.4995C93.1339 36.8838 93.1676 37.2693 93.192 37.6537C93.2072 37.8464 93.213 38.038 93.2234 38.2308C93.2339 38.4235 93.2362 38.6151 93.2432 38.8078L93.1944 38.6929C93.4501 38.9286 93.7 39.1713 93.9487 39.4128C94.1952 39.6578 94.4427 39.9028 94.6822 40.1547C94.8042 40.279 94.9228 40.4056 95.0402 40.5344C95.1588 40.6622 95.2762 40.7899 95.3912 40.9211C95.6237 41.1812 95.8504 41.4459 96.0654 41.7234C95.7841 41.5144 95.5133 41.2938 95.2483 41.0674C95.1146 40.9559 94.9832 40.841 94.8531 40.7249C94.7217 40.6099 94.5927 40.4938 94.4648 40.3754C94.2068 40.142 93.9569 39.9005 93.7058 39.6601C93.4582 39.4163 93.2095 39.1724 92.9689 38.9216L92.9177 38.8694L92.92 38.8067C92.927 38.6139 92.9293 38.4223 92.9398 38.2296C92.9503 38.0368 92.9561 37.8453 92.9712 37.6525C92.9979 37.2682 93.0316 36.8838 93.0828 36.4995Z",fill:"url(#paint2_linear_5854_17923)"}),(0,o.FD)("g",{opacity:"0.45",children:[(0,o.Y)("rect",{x:"131.828",y:"37.3921",width:"22.2075",height:"46.256",fill:"white"}),(0,o.Y)("rect",{x:"109.62",y:"37.3921",width:"22.2075",height:"46.256",fill:"white"}),(0,o.Y)("rect",{x:"110.565",y:"38.3362",width:"20.79",height:"44.368",fill:"url(#paint3_linear_5854_17923)"}),(0,o.Y)("rect",{x:"132.3",y:"38.3362",width:"20.79",height:"44.368",fill:"url(#paint4_linear_5854_17923)"})]}),(0,o.FD)("g",{opacity:"0.7",children:[(0,o.Y)("path",{d:"M53.2144 38.9V41.721L55.0403 48.95L55.4411 50.5369H48.9324L49.3332 48.95L51.159 41.721V38.9H52.1867H53.2144Z",fill:"url(#paint5_linear_5854_17923)"}),(0,o.Y)("path",{d:"M49.3332 48.95L48.9324 50.5369H55.4411L55.0403 48.95M49.3332 48.95L51.159 41.721V38.9H52.1867M49.3332 48.95H55.0403M55.0403 48.95L53.2144 41.721V38.9H52.1867M52.1867 38.9C52.0154 37.4894 52.2552 34.1747 54.5847 32.2",stroke:"url(#paint6_linear_5854_17923)",strokeWidth:2})]}),(0,o.FD)("g",{opacity:"0.7",children:[(0,o.Y)("rect",{x:"60.0074",y:"41.7581",width:"10.3489",height:"8.94859",rx:"1.69912",fill:"url(#paint7_linear_5854_17923)"}),(0,o.Y)("path",{d:"M60.0074 44.3149H70.3563",stroke:"white",strokeWidth:"0.75"}),(0,o.Y)("path",{d:"M65.1817 41.7581C63.9399 41.6161 60.8352 40.6928 60.8352 38.1361C62.7346 38.3316 63.5881 38.7065 64.8354 41.072C64.035 39.2794 63.3625 36.1736 65.3887 34.0879C67.5413 36.4742 66.1476 40.1957 65.1817 41.7581C65.1882 41.7562 65.1948 41.7542 65.2014 41.7522C65.3965 41.5032 67.0458 38.1227 70.1492 37.923C70.1492 39.7906 66.8636 41.2494 65.2014 41.7522C65.1883 41.7689 65.1817 41.7715 65.1817 41.7581Z",fill:"url(#paint8_linear_5854_17923)"})]}),(0,o.Y)("rect",{opacity:"0.45",x:"45.5067",y:"50.7134",width:"27.405",height:"3.1737",fill:"url(#paint9_linear_5854_17923)"}),(0,o.Y)("path",{d:"M22.9767 102.777H152.981",stroke:"#9CACCE",strokeMiterlimit:10}),(0,o.Y)("path",{d:"M157.533 102.777H173.6",stroke:"#9CACCE",strokeMiterlimit:10})]}),(0,o.Y)("path",{d:"M93.2582 46.2702L96.3529 47.6814C95.9771 48.4814 96.4243 49.4478 97.3297 49.8694C98.235 50.2911 99.2623 49.9799 99.6216 49.1655L102.733 50.591C102.357 51.3911 102.79 52.3714 103.71 52.7791C104.615 53.2008 105.626 52.8752 106.001 52.0752L109.113 53.5007C108.828 54.1184 109.026 54.8413 109.556 55.3286C109.704 55.4577 109.882 55.5872 110.089 55.6888C110.995 56.1104 112.022 55.7993 112.381 54.9848L115.476 56.3961C114.379 58.7967 115.679 61.7376 118.392 62.9742C118.472 63.0177 118.55 63.0328 118.63 63.0763L102.043 99.4648C101.963 99.4214 101.883 99.378 101.82 99.3489C99.1059 98.1122 96.01 99.0597 94.9274 101.446L91.8327 100.035C92.2085 99.2351 91.7754 98.2548 90.8559 97.8471C89.9505 97.4254 88.9398 97.751 88.564 98.551L85.4693 97.1398C85.8451 96.3398 85.3955 95.3451 84.4925 94.9517C83.5871 94.5301 82.5599 94.8413 82.2006 95.6557L79.1059 94.2445C79.4816 93.4444 79.0344 92.478 78.1291 92.0564C77.2237 91.6348 76.2129 91.9603 75.8372 92.7604L72.6954 91.3344C73.7921 88.9338 72.4788 86.0068 69.765 84.7702L86.366 48.3677C89.0797 49.6043 92.1614 48.6708 93.2582 46.2702Z",fill:"url(#paint10_linear_5854_17923)"}),(0,o.Y)("rect",{width:"38.4766",height:"26.2381",rx:4,transform:"matrix(0.415692 -0.909506 0.909916 0.414794 74.3693 85.7542)",fill:"white",stroke:"#BDC6DB"}),(0,o.Y)("path",{d:"M101.543 89.4302L78.1701 78.8418",stroke:"#9CACCE",strokeWidth:2,strokeMiterlimit:10,strokeLinejoin:"round"}),(0,o.Y)("path",{d:"M91.8331 88.6181L84.719 85.3882",stroke:"#9CACCE",strokeWidth:2,strokeMiterlimit:10,strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.Y)("path",{d:"M110.823 68.897L87.4676 58.3234",stroke:"#BDC6DB",strokeMiterlimit:10,strokeLinejoin:"round"}),(0,o.Y)("path",{d:"M103.81 62.1657L96.7123 58.9501",stroke:"#BDC6DB",strokeMiterlimit:10,strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.Y)("path",{d:"M89.3899 70.5302L92.4333 70.4854C92.6176 70.48 92.7766 70.3957 92.8576 70.2606L94.4065 67.8256C94.5614 67.5821 94.88 67.5285 95.1429 67.689C95.2494 67.7479 95.3313 67.8428 95.3779 67.9565L96.5338 70.7107C96.6124 70.8766 96.7334 70.9969 96.9213 71.0357L99.9044 71.807C100.188 71.8872 100.377 72.156 100.318 72.441C100.29 72.548 100.234 72.647 100.139 72.7206L97.8038 74.4882C97.6731 74.5805 97.5959 74.7598 97.6178 74.9096L97.9098 77.8218C97.9429 78.1041 97.7135 78.3409 97.4195 78.3584C97.3097 78.3704 97.1855 78.321 97.079 78.2621L94.4819 76.5945C94.3256 76.4929 94.1484 76.4715 93.9786 76.5384L91.1836 77.5583C90.9148 77.6547 90.5989 77.5223 90.4844 77.2602C90.4379 77.1465 90.4197 77.0408 90.4476 76.9338L91.173 74.1511C91.2149 73.9906 91.1716 73.806 91.0506 73.6856L89.0108 71.3998C88.808 71.1845 88.8349 70.8474 89.061 70.6814C89.1526 70.5637 89.2694 70.5249 89.3899 70.5302Z",fill:"#C9D3E8"}),(0,o.Y)("path",{d:"M118.309 96.7377L118.309 93.3383C117.363 93.3475 116.62 92.5395 116.611 91.5413C116.603 90.5432 117.362 89.7387 118.314 89.7504L118.307 86.3301C117.361 86.3393 116.599 85.5383 116.61 84.5331C116.601 83.535 117.367 82.7514 118.313 82.7422L118.306 79.3219C117.578 79.3236 116.962 78.8434 116.722 78.1599C116.662 77.9715 116.616 77.7553 116.609 77.5249C116.6 76.5268 117.359 75.7223 118.312 75.734L118.311 72.3346C115.486 72.3342 113.199 69.9313 113.2 66.9507C113.193 66.86 113.213 66.7832 113.206 66.6924L70.4067 66.6521C70.4135 66.7428 70.4203 66.8335 70.4205 66.9033C70.4201 69.8839 68.1231 72.3044 65.3183 72.297L65.3188 75.6964C66.2647 75.6872 67.0271 76.4882 67.016 77.4934C67.0247 78.4915 66.2589 79.2751 65.313 79.2843L65.3135 82.6837C66.2594 82.6745 67.0285 83.4964 67.0107 84.4806C67.0194 85.4788 66.2603 86.2833 65.3077 86.2715L65.3082 89.6709C66.2541 89.6618 66.9967 90.4698 67.0054 91.4679C67.0141 92.4661 66.2484 93.2496 65.3024 93.2588L65.2964 96.7071C68.121 96.7075 70.3883 99.1174 70.3879 102.098L113.207 102.131C113.207 99.1508 115.484 96.7373 118.309 96.7377Z",fill:"url(#paint11_linear_5854_17923)"}),(0,o.Y)("rect",{width:"41.179",height:"26.2238",rx:4,transform:"matrix(1 0 0 -1 71.4733 97.5037)",fill:"white"}),(0,o.Y)("path",{d:"M87.2545 82.1219L90.2814 81.5348C90.4643 81.4964 90.6116 81.3797 90.6742 81.2235L91.8932 78.3931C92.0151 78.11 92.3255 77.9972 92.6088 78.119C92.7228 78.1619 92.8171 78.247 92.8786 78.358L94.3976 81.0434C94.4981 81.2035 94.6347 81.3084 94.8272 81.3157L97.9027 81.5957C98.1962 81.6295 98.4203 81.8782 98.3994 82.1877C98.3859 82.305 98.343 82.4189 98.2578 82.513L96.1667 84.7825C96.0488 84.9026 95.9957 85.1045 96.0375 85.2579L96.7167 88.2624C96.7873 88.5528 96.5903 88.842 96.2996 88.9125C96.1918 88.9446 96.0615 88.9148 95.9474 88.8719L93.1371 87.5827C92.9678 87.5037 92.7883 87.5128 92.628 87.6131L89.9788 89.1796C89.7237 89.3285 89.3912 89.2456 89.2422 88.9908C89.1807 88.8797 89.1485 88.772 89.162 88.6547L89.514 85.6056C89.5343 85.4297 89.4666 85.2436 89.33 85.1387L86.9926 83.1018C86.7618 82.9118 86.7437 82.5532 86.9469 82.339C87.0225 82.1991 87.1337 82.1377 87.2545 82.1219Z",fill:"url(#paint12_linear_5854_17923)"}),(0,o.Y)("path",{d:"M76.4337 76.9359L76.4214 91.6843",stroke:"#BDC6DB",strokeMiterlimit:10,strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.Y)("path",{d:"M107.516 77.1246L107.497 91.8336",stroke:"#BDC6DB",strokeMiterlimit:10,strokeLinecap:"round",strokeLinejoin:"round"}),(0,o.Y)("path",{d:"M147.024 91.9211C147.024 91.9211 146.861 87.513 150.374 83.105",stroke:"#63D2A4",strokeWidth:"1.14967",strokeMiterlimit:10}),(0,o.Y)("path",{d:"M138.527 85.2486C142.561 83.6767 143.101 91.9213 143.101 91.9213",stroke:"#63D2A4",strokeWidth:"1.14967",strokeMiterlimit:10}),(0,o.Y)("path",{d:"M144.973 91.9211L144.301 85.9719",stroke:"#63D2A4",strokeWidth:"1.14967",strokeMiterlimit:10}),(0,o.Y)("path",{d:"M144.137 76.4055C144.137 76.4055 144.109 81.3074 145.089 82.4126C146.067 83.5196 145.688 86.4118 144.214 86.2816C142.739 86.1496 140.609 81.3635 144.137 76.4055Z",fill:"#B0E4CE"}),(0,o.Y)("path",{d:"M134.183 90.355C134.183 90.355 134.127 85.9831 137.247 85.0154C140.182 84.1038 139.6 88.926 134.183 90.355Z",fill:"#B0E4CE"}),(0,o.Y)("path",{d:"M148.48 102.978H141.761C141.583 102.978 141.429 102.861 141.382 102.691L138.541 92.4186C138.472 92.1689 138.661 91.9211 138.92 91.9211H151.32C151.58 91.9211 151.769 92.1689 151.698 92.4186L148.857 102.691C148.812 102.861 148.658 102.978 148.48 102.978Z",fill:"url(#paint13_linear_5854_17923)"}),(0,o.Y)("path",{d:"M149.833 87.3521C148.098 87.5692 146.977 85.5723 147.986 84.1469C148.029 84.0836 148.078 84.0203 148.127 83.9552C149.768 81.8534 151.931 80.5022 156.203 82.0144C156.286 82.0433 156.266 82.1681 156.178 82.1681C155.042 82.1808 152.181 82.4159 151.902 84.4128C151.622 86.4423 150.796 87.231 149.833 87.3521Z",fill:"#B0E4CE"})]}),(0,o.FD)("defs",{children:[(0,o.FD)("linearGradient",{id:"paint0_linear_5854_17923",x1:"15.5925",y1:"4.82397",x2:"83.5736",y2:"141.256",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#AACBFA"}),(0,o.Y)("stop",{offset:1,stopColor:"#C4DFFB"})]}),(0,o.FD)("linearGradient",{id:"paint1_linear_5854_17923",x1:"76.5119",y1:"28.1722",x2:"111.059",y2:"32.6025",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#C5D2EC"}),(0,o.Y)("stop",{offset:"0.9964",stopColor:"#F1F7FE"})]}),(0,o.FD)("linearGradient",{id:"paint2_linear_5854_17923",x1:"93.3311",y1:"36.5899",x2:"97.969",y2:"37.0515",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#B0BBCC"}),(0,o.Y)("stop",{offset:1,stopColor:"#8D9EB7"})]}),(0,o.FD)("linearGradient",{id:"paint3_linear_5854_17923",x1:"94.9204",y1:"24.8145",x2:"149.903",y2:"28.1149",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#C5D2EC"}),(0,o.Y)("stop",{offset:"0.9964",stopColor:"#F1F7FE"})]}),(0,o.FD)("linearGradient",{id:"paint4_linear_5854_17923",x1:"116.655",y1:"24.8145",x2:"171.638",y2:"28.1149",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#C5D2EC"}),(0,o.Y)("stop",{offset:"0.9964",stopColor:"#F1F7FE"})]}),(0,o.FD)("linearGradient",{id:"paint5_linear_5854_17923",x1:"44.0346",y1:"26.6116",x2:"61.2744",y2:"27.3955",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#C5D2EC"}),(0,o.Y)("stop",{offset:"0.9964",stopColor:"#F1F7FE"})]}),(0,o.FD)("linearGradient",{id:"paint6_linear_5854_17923",x1:"44.0346",y1:"26.6116",x2:"61.2744",y2:"27.3955",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#C5D2EC"}),(0,o.Y)("stop",{offset:"0.9964",stopColor:"#F1F7FE"})]}),(0,o.FD)("linearGradient",{id:"paint7_linear_5854_17923",x1:"52.2199",y1:"39.0309",x2:"79.0981",y2:"43.0128",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#C5D2EC"}),(0,o.Y)("stop",{offset:"0.9964",stopColor:"#F1F7FE"})]}),(0,o.FD)("linearGradient",{id:"paint8_linear_5854_17923",x1:"53.8264",y1:"31.7477",x2:"77.1261",y2:"34.8284",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#B8C5E0"}),(0,o.Y)("stop",{offset:"0.9964",stopColor:"#C9D8E8"})]}),(0,o.FD)("linearGradient",{id:"paint9_linear_5854_17923",x1:"49.1058",y1:"50.7683",x2:"62.5414",y2:"69.9354",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#B0BBCC"}),(0,o.Y)("stop",{offset:1,stopColor:"#8D9EB7"})]}),(0,o.FD)("linearGradient",{id:"paint10_linear_5854_17923",x1:"67.6683",y1:"89.2776",x2:"103.722",y2:"51.8746",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#81A8FB"}),(0,o.Y)("stop",{offset:1,stopColor:"#4F84F7"})]}),(0,o.FD)("linearGradient",{id:"paint11_linear_5854_17923",x1:"65.0677",y1:"102.131",x2:"116.645",y2:"82.6435",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#81A8FB"}),(0,o.Y)("stop",{offset:1,stopColor:"#4F84F7"})]}),(0,o.FD)("linearGradient",{id:"paint12_linear_5854_17923",x1:"88.5068",y1:"88.0731",x2:"97.5549",y2:"80.8885",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#FFB52E"}),(0,o.Y)("stop",{offset:1,stopColor:"#E69603"})]}),(0,o.FD)("linearGradient",{id:"paint13_linear_5854_17923",x1:"138.47",y1:"91.9211",x2:"151.907",y2:"95.9728",gradientUnits:"userSpaceOnUse",children:[(0,o.Y)("stop",{stopColor:"#81A8FB"}),(0,o.Y)("stop",{offset:1,stopColor:"#4F84F7"})]}),(0,o.Y)("clipPath",{id:"clip0_5854_17923",children:(0,o.Y)("rect",{width:189,height:103,fill:"white"})}),(0,o.Y)("clipPath",{id:"clip1_5854_17923",children:(0,o.Y)("rect",{width:"159.379",height:"98.2252",fill:"white",transform:"translate(15.5925 4.82397)"})})]})]})},te=function(e){var t=e.opened,a=e.onClose,i=e.listVoucher,l=e.priceUnit,p=e.onSubmit,u=e.vaccinationDetail,f=e.selectedVoucher,x=e.computedPrice,y=e.appliedReferralCode,b=e.referralData,Y=e.packageId,N=e.type;(0,X.g)();var w=(0,_.$)().locale,F=(0,k.Jf)().quantity,D=(0,C.A)().formatMessage,A=(0,v.d)().isMobileOrTablet,M=(0,c.useState)(null),E=M[0],L=M[1],P=(0,c.useState)(null),S=P[0],V=P[1],O=!i.length&&!b,T=(0,c.useState)(U.vp),B=T[0],R=T[1],Z=(0,c.useState)(!1),H=Z[0],z=Z[1],G=u||{},j=G.id,J=G.hospital_branch,K=G.organization,ee=(J||{}).id,te=(K||{}).id,ae=Y||j,ne=N;(0,c.useEffect)((function(){t&&(L(f),V(y?b:null),R(x))}),[t,f,x]),(0,c.useEffect)((function(){if(t){var e=!1,a={product_id:ae,clinic_id:ee,hospital_id:te,type:ne,voucher_code:(null===E||void 0===E?void 0:E.voucher_code)||"",referral_code:(null===S||void 0===S?void 0:S.voucher_code)||"",quantity:F};return z(!0),(0,g.px)((0,g.$k)(h.R.GET_VACCINATION_PRICE),"POST",{data:a}).then((function(t){if(!e){if("success"===(null===t||void 0===t?void 0:t.message)){var a=(0,n.A)((0,r.A)({},t),{original_price:t.original_price,final_price:t.final_price,voucher_discount_value:t.voucher_discount_value||0,referral_discount_value:t.referral_discount_value||0});return R(a)}throw new Error("")}})).catch((function(e){console.error(e);var t=(0,n.A)((0,r.A)({},U.vp),{original_price:u.price_discount||u.price,final_price:u.price_discount||u.price});R(t)})).finally((function(){z(!1)})),function(){e=!0}}}),[ae,E,S,F,t]);var le=(0,c.useMemo)((function(){return E||S?"".concat((0,g.nd)(D,(0,g.$g)(B.voucher_discount_value+B.referral_discount_value,w),l)):""}),[E,B,l]),oe=function(){a(),L(null),V(null)};return(0,c.useEffect)((function(){return t?(document.body.style.overflow="hidden",document.body.style.maxHeight="100vh"):(document.body.style.overflow="auto",document.body.style.maxHeight="auto"),function(){document.body.style.overflow="",document.body.style.maxHeight=""}}),[t]),(0,o.FD)(o.FK,{children:[t&&!A&&(0,o.Y)(m.a,{className:"hidden lg:block lg:fixed top-0 left-0 bottom-0 right-0 bg-[#000]/50 z-[1]"}),(0,o.FD)(m.a,{className:Q()("fixed top-0 left-[200px] bottom-0 w-full max-h-full bg-neutral50 opacity-0 transition-all pointer-events-none -z-10 invisible","lg:w-[400px] lg:max-h-[681px] lg:bg-white lg:rounded-2xl lg:absolute lg:top-1/2 lg:bottom-auto lg:overflow-hidden lg:flex lg:flex-col",{"!opacity-100 !visible !pointer-events-auto !z-10 !left-0 lg:!left-1/2":t}),style:A?void 0:{transform:"translate(-50%, -50%)"},children:[(0,o.FD)(m.a,{className:"p-4 text-center lg:px-6 lg:text-left relative bg-white lg:border-b lg:border-solid lg:border-neutral100 flex items-center",children:[A&&(0,o.Y)(m.a,{onClick:oe,className:"absolute left-4 top-4 p-0.5 cursor-pointer",children:(0,o.Y)(W.A,{size:20,color:I.w.colors.gray800,className:"block"})}),(0,o.Y)("p",{className:"text-[17px] font-semibold leading-6 tracking-[-0.4px] flex-1 min-w-0",children:D({id:"vaccination.payment.select_voucher",defaultMessage:"Select voucher"})}),!A&&(0,o.Y)(m.a,{onClick:oe,className:" cursor-pointer",children:(0,o.Y)($.A,{size:20,color:I.w.colors.gray800,className:"block"})})]}),!O&&(0,o.Y)(m.a,{"data-testid":"voucher-list",className:"flex flex-col h-[calc(100vh_-_56px)] bg-white lg:h-auto lg:max-h-[60vh] overflow-y-auto scrollbar-custom",children:(0,o.FD)(m.a,{className:"flex-1 px-4 lg:px-6 pb-[220px] lg:pb-6",children:[i.map((function(e){return(0,o.Y)(ie,{selected:(null===E||void 0===E?void 0:E.id)===e.id,item:e,onClick:function(){return L(e.voucher_code===(null===E||void 0===E?void 0:E.voucher_code)?null:e)}},"".concat(e.id))})),b&&(0,o.Y)(ie,{selected:(null===S||void 0===S?void 0:S.id)===b.id,item:b,onClick:function(){return V(b.voucher_code===(null===S||void 0===S?void 0:S.voucher_code)?null:b)}})]})}),!O&&(0,o.FD)(m.a,{"data-testid":"voucher-list-discount",className:"py-2 px-4 lg:px-6 lg:pb-6 border-t border-solid border-neutral100 bg-white fixed left-0 right-0 bottom-0 lg:relative scrollbar-custom",children:[!!le&&(0,o.FD)(o.FK,{children:[(0,o.Y)(m.a,{className:"absolute pointer-events-none top-0 left-0 right-0 h-9",style:{background:"linear-gradient(180deg, #E3FFD7 0%, #FFFFFF 100%)"}}),(0,o.FD)(m.a,{className:"flex mb-4 gap-2 relative",children:[(0,o.Y)("img",{src:s.C.getAssetPath("payment/fireworks.png"),alt:"fireworkds",className:"w-5 h-5"}),(0,o.Y)("p",{className:"flex items-center gap-1 text-[13px] leading-5 font-medium tracking-[-0.3px] text-gray700",children:D({id:"vaccination.payment.details_saving",defaultMessage:"You've saved {number}"},{number:H?(0,o.Y)(q.V7n,{fontSize:12}):(0,o.Y)("span",{className:"font-bold",children:le})})})]})]}),(0,o.Y)(d.B,{size:"lg",fullWidth:!0,className:"mt-4 lg:mt-2",onClick:function(){H||(p(E,S,B),L(null),V(null))},"data-testid":"voucher-list-apply",children:(0,o.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium",children:D({id:"vaccination.payment.apply",defaultMessage:"Apply"})})})]}),O&&(0,o.Y)(re,{})]})]})},ae="voucherItem",ie=function(e){var t=e.loading,a=e.selected,i=e.item,r=e.onClick,n=e.className,l=e.style,c=(0,C.A)().formatMessage;return t?(0,o.FD)(m.a,{role:"button",className:(0,G.A)("flex items-center py-4 gap-2 border-b border-solid border-neutral100 cursor-pointer lg:last-of-type:border-0",ae,n),onClick:r,"data-selected":a,"data-testid":"voucher-item-".concat(i.voucher_code),style:l,children:[(0,o.Y)(J.E,{h:6,className:"flex-1 min-w-0"}),(0,o.Y)(J.E,{h:6,w:12})]},i.id):(0,o.FD)(m.a,{role:"button",onClick:r,"data-testid":"voucher-item-".concat(i.voucher_code),"data-selected":a,className:(0,G.A)("flex items-center py-4 gap-2 border-b border-solid border-neutral100 cursor-pointer lg:last-of-type:border-0",ae,n),style:l,children:[(0,o.FD)(m.a,{className:"flex-1 min-w-0",children:[(0,o.Y)("p",{className:(0,G.A)("".concat(ae,"_title"),"text-[13px] leading-5 tracking-[-0.3px] font-semibold text-gray900"),children:i.voucher_name}),(0,o.Y)("p",{className:(0,G.A)("".concat(ae,"_description"),"text-[13px] leading-5 tracking-[-0.3px] text-gray700"),children:i.voucher_description})]}),(0,o.Y)(m.a,{className:"ml-auto",children:a?(0,o.Y)(m.a,{className:"w-5 h-5 p-[2px]",children:(0,o.Y)(z.A,{color:I.w.colors.primaryBase,size:16,className:"block"})}):(0,o.Y)("button",{className:"w-auto h-8 font-medium text-primary600 text-[13px] leading-5 tracking-[-0.3px] py-[6px] px-3 rounded-xl border border-primary600 border-solid cursor-pointer",children:c({id:"vaccination.payment.apply",defaultMessage:"Apply"})})})]},i.id)},re=function(){var e=(0,C.A)().formatMessage;return(0,o.FD)(m.a,{"data-testid":"voucher-list-empty-sreen",className:"text-center max-w-[310px] mx-auto py-[100px]",children:[(0,o.Y)(ee,{className:"mx-auto"}),(0,o.Y)("p",{className:"text-[15px] leading-6 tracking-[-0.3px] text-dark font-semibold mt-4",children:e({id:"vaccination.payment.voucher_empty_title",defaultMessage:"No Vouchers Available"})}),(0,o.Y)("p",{className:"text-[12px] leading-4 tracking-[-0.2px] text-gray600 mt-2",children:e({id:"vaccination.payment.voucher_empty_description",defaultMessage:"There are no vouchers at the moment."})})]})};te.Result=function(e){var t=e.opened,a=e.onClose,i=e.voucher_code,r=e.previewDiscount,n=e.timeout,l=void 0===n?2e3:n,s=(0,C.A)().formatMessage,d=(0,c.useRef)(null),p=(0,c.useState)(!!t),u=p[0],m=p[1],h=(0,c.useCallback)((function(){m(!1),null===a||void 0===a||a(!1),d.current&&clearTimeout(d.current)}),[a]);return(0,c.useEffect)((function(){m(!!t)}),[t,a]),(0,c.useEffect)((function(){u&&(d.current=setTimeout((function(){h()}),l))}),[u,h,l]),(0,o.Y)(j.M,{opened:u,onClose:h,styles:{root:{},content:{maxWidth:295},header:{display:"none"},body:{padding:24,paddingTop:"16px !important"}},children:(0,o.FD)("div",{className:"text-center",children:[(0,o.Y)("img",{src:w.A.ResultIcon.success,alt:"HHG",className:"max-h-[96px] mb-4"}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] mb-1 text-gray1000",children:s({id:"vaccination.payment.you_saved",defaultMessage:"You saved"})}),(0,o.Y)("p",{className:"mb-3 text-[26px] leading-8 tracking-[-0.6px] font-semibold",children:r}),(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] font-medium mb-[28px]",children:s({id:"vaccination.payment.voucher_applied_success.code_applied"},{discount_code:i})}),(0,o.Y)("button",{onClick:h,className:"block cursor-pointer p-2 bg-gray100 text-primary600 text-[15px] leading-6 tracking-[-0.3px] font-medium rounded-xl",children:s({id:"vaccination.payment.voucher_applied_success.button",defaultMessage:"Yay! Thanks"})})]})})},te.Item=ie;var ne=te,le=function(e){var t=e.onViewAll,a=(0,C.A)().formatMessage;return(0,o.FD)(m.a,{className:"flex flex-row justify-between w-full gap-3 mb-3",children:[(0,o.Y)("h2",{className:"flex-1 text-[17px] leading-6 tracking-[-0.4px] text-dark font-semibold",children:a({id:"vaccination.payment.voucher_application",defaultMessage:"Discount Offers"})}),(0,o.FD)("button",{onClick:t,className:"flex w-auto items-center text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium cursor-pointer",children:[(0,o.Y)("span",{children:a({id:"admin.home.viewAll",defaultMessage:"View all"})}),(0,o.Y)(u.A,{color:"currentColor",size:16})]})]})},oe=function(e){var t=e.selected,a=e.item,i=e.onClick,r=(0,C.A)().formatMessage;return(0,o.FD)(m.a,{"data-testid":"selected-voucher","data-selected":t,className:(0,G.A)("stepOneVoucherApplicationItem flex gap-2 items-center cursor-pointer",{"py-3":!t,"py-[18px]":t}),onClick:i,children:[(0,o.Y)(m.a,{className:"flex-1 min-w-0",children:(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] font-medium text-gray900 uppercase m-0",children:a.voucher_name})}),t?(0,o.Y)(m.a,{className:"w-5 h-5 p-[2px]",children:(0,o.Y)(z.A,{color:I.w.colors.primaryBase,size:16,className:"block"})}):(0,o.Y)("button",{className:"w-auto h-8 font-medium text-primary600 text-[13px] leading-5 tracking-[-0.3px] py-[6px] px-3 rounded-xl border border-primary600 border-solid cursor-pointer",children:r({id:"vaccination.payment.apply",defaultMessage:"Apply"})})]},"".concat(a.id))},ce=function(e){var t=e.vaccinationDetail,a=e.handleClickOpenVoucher,i=t.price_unit,r=(0,C.A)().formatMessage,n=(0,_.$)().locale,l=(0,k.Jf)().computedPrice,s=(0,k.Zb)(),d=s.loading,p=s.listVoucher,u=s.appliedVoucher,h=s.setAppliedVoucher,f=s.referralData,x=s.appliedReferralCode,v=s.setAppliedReferralCode,y=s.openResult,b=s.setOpenResult,Y=s.voucherCount,N=s.setVoucherStore,w=s.lastVoucherApplied,F=(0,c.useMemo)((function(){return u||(w||(Y>1?null:(null===p||void 0===p?void 0:p[0])||null))}),[u,p]),D=(0,c.useMemo)((function(){return!!p.length&&!(!u&&1!==Y&&!w)}),[F,Y]),A=(0,c.useMemo)((function(){return f}),[f]),M=D||[u,x].filter(Boolean).length;return(0,o.FD)(m.a,{"data-testid":"voucher-application",className:(0,G.A)("stepOneVoucherApplication bg-white","p-4 pt-5 pb-2","lg:rounded-xl","[&>.stepOneVoucherApplicationItem]:border-b [&>.stepOneVoucherApplicationItem]:border-gray100 [&>.stepOneVoucherApplicationItem]:border-solid [&>.stepOneVoucherApplicationItem:last-child]:border-none"),children:[(0,o.Y)(le,{onViewAll:a}),!d&&(0,o.FD)(o.FK,{children:[!M&&(0,o.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray400 mb-2",children:r({id:"vaccination.payment.no_discount_apply",defaultMessage:"No discount applied yet"})}),A&&(0,o.Y)(oe,{selected:x===A.voucher_code,item:A,onClick:function(){var e="";x!==A.voucher_code&&(e=A.voucher_code),v(e)}}),D&&F&&(0,o.Y)(oe,{selected:F.voucher_code===(null===u||void 0===u?void 0:u.voucher_code),item:F,onClick:function(){var e=null;(null===u||void 0===u?void 0:u.voucher_code)!==F.voucher_code&&(e=F,b(!0),N({voucherCount:Y+1})),h(e)}})]}),d&&(0,o.Y)(m.a,{className:"flex gap-1 items-center animate-pulse",children:(0,o.FD)(m.a,{className:"flex-1",children:[(0,o.Y)("div",{className:"h-5 w-[60%] rounded-full bg-gray200"}),(0,o.Y)("div",{className:"h-4 w-[50%] rounded-full bg-gray200 mt-1"})]})}),(0,o.Y)(ne.Result,{opened:y,onClose:b,voucher_code:null===u||void 0===u?void 0:u.voucher_code,previewDiscount:(0,g.nd)(r,(0,g.$g)(l.voucher_discount_value+l.referral_discount_value,n),i)})]})},se=function(e){var t=e.loadingPrice,a=e.displayPricePayNow,i=e.displayPriceRemaining;return(0,o.FD)(m.a,{className:"flex flex-col gap-3",children:[(0,o.Y)(ce,(0,r.A)({},e)),(0,o.Y)(Z,{loadingPrice:t}),(0,o.Y)(P.Ay,{loadingPrice:t,displayPricePayNow:a,displayPriceRemaining:i})]})},de=a(24613),pe={width:"142px",height:"32px"},ue=function(e){var t=e.children,a=e.stepOneProps,i=e.renderedStepTwo,n=e.renderedStepTwoActions,l=e.paymentMethodProps,c=e.handleContinueToNextStep,p=(0,k.Jf)(),h=p.computedPrice,f=p.currentStep,g=p.vaccinationDetail,x=(0,C.A)().formatMessage,v=(0,A.T)().displayDiscountPrice,_=(0,y.A)(),b=function(){return v?(0,o.FD)(m.a,{className:"flex mb-2 py-2 gap-2 mx-[-16px] px-4 relative",style:{background:"linear-gradient(180deg, #E3FFD7 0%, #FFFFFF 100%)"},children:[(0,o.Y)("img",{src:s.C.getAssetPath("payment/fireworks.png"),alt:"fireworkds",className:"w-5 h-5"}),(0,o.Y)("p",{className:"text-[13px] leading-5 font-medium tracking-[-0.3px] text-gray700",children:x({id:"vaccination.payment.details_saving",defaultMessage:"You've saved {number}"},{number:(0,o.Y)("span",{className:"font-bold",children:v})})})]}):null};return(0,o.FD)(o.FK,{children:[(0,o.FD)(m.a,{className:"bg-neutral50 min-h-screen",children:[(0,o.Y)(m.a,{className:"bg-white py-6 px-4 border-b border-solid border-neutral100",children:(0,o.FD)(m.a,{className:"max-w-[1060px] mx-auto flex justify-between items-center",children:[(0,o.Y)(D.F,{customSize:pe}),(0,o.Y)(H.tn,{})]})}),f===U.RZ.ONE&&(0,o.FD)(m.a,{className:"max-w-[1060px] min-h-[calc(100vh_-_81px)] mx-auto flex gap-8",children:[(0,o.FD)(m.a,{className:"flex-1 pt-8 min-w-0",children:[(0,o.Y)(F,{}),(0,o.Y)(ce,(0,r.A)({},a)),(0,o.Y)(m.a,{className:"mt-3",children:(0,o.Y)(P.Ay,(0,r.A)({},l))})]}),(0,o.Y)(m.a,{className:"w-[1px] bg-neutral100"}),(0,o.FD)(m.a,{className:"flex-1 pt-8 min-w-0",children:[g&&(0,o.Y)(m.a,{className:"p-4 rounded-lg bg-white",children:(0,o.Y)(H.UB,{stepNumber:f,vaccinationDetail:g,className:"",showDeliveryFee:h.show_delivery_fee})}),!h.show_delivery_fee&&(0,o.Y)(m.a,{className:"mt-4",children:(0,o.Y)(L,{})}),(0,o.Y)(m.a,{className:"mt-4 rounded-lg overflow-hidden",children:(0,o.Y)(Z,{loadingPrice:a.loadingPrice,action:(0,o.FD)(m.a,{className:"pt-1",children:[b(),(0,o.FD)(d.B,{size:"lg",fullWidth:!0,onClick:c,dataEventAction:"Payment Confirm to Step 2",dataEventCategory:"Vaccination",dataEventLabel:_,children:[(0,o.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium",children:x({id:"vaccination.payment.btn_confirm",defaultMessage:"Confirm Payment Method"})}),(0,o.Y)(u.A,{color:"currentColor",size:22,className:"ml-1.5"})]})]})})})]})]}),f===U.RZ.TWO&&(0,o.FD)(m.a,{className:"max-w-[1060px] min-h-[calc(100vh_-_81px)] mx-auto flex gap-8",children:[(0,o.Y)(m.a,{className:"flex-1 py-8 min-w-0",children:(0,o.Y)(m.a,{className:"flex gap-3 flex-col",children:i})}),(0,o.Y)(m.a,{className:"w-[1px] bg-neutral100"}),(0,o.FD)(m.a,{className:"flex-1 py-8 min-w-0",children:[g&&(0,o.Y)(m.a,{className:"p-4 rounded-lg bg-white",children:(0,o.Y)(H.UB,{stepNumber:f,vaccinationDetail:g,className:"",showDeliveryFee:h.show_delivery_fee})}),(0,o.Y)(m.a,{className:"mt-4",children:(0,o.Y)(de.h,{action:(0,o.FD)(m.a,{className:"pb-6 pt-1",children:[b(),n]})})})]})]})]}),t]})},me=a(37639),he=function(e){var t,Y=e.vaccinationDetail,N=(0,c.useRef)(null),w=(0,v.d)().isMobileOrTablet,M=(0,_.$)().query,E=(0,C.A)().formatMessage,S=String(M.referral_code||""),V=String(M.ref_id||""),O=Number(M.pkg_id||"0"),T=String(M.pkg_name||""),B=(0,y.A)(),R=(0,c.useState)(!0),Z=R[0],I=R[1],z=(0,c.useState)(!1),G=z[0],q=z[1],j=(0,k.Zb)(),W=j.isOpenVoucher,$=j.setIsOpenVoucher,J=j.listVoucher,K=j.setListVoucher,Q=j.appliedVoucher,X=j.setAppliedVoucher,ee=j.referralData,te=j.setReferralData,ae=j.appliedReferralCode,ie=j.setAppliedReferralCode,re=j.loading,le=j.setLoading,oe=j.voucherCount,ce=j.setVoucherStore,pe=(0,k.Jf)(),he=pe.selectedPaymentValue,fe=pe.computedPrice,ge=pe.setComputedPrice,xe=pe.providers,ve=pe.currentStep,ye=pe.setCurrentStep,_e=pe.setQuantity,Ce=pe.selectedSubPaymentValue,be=(0,A.T)(),Ye=be.quantity,Ne=be.displayTotalPrice,we=be.displayPricePayTenPercentage,ke=be.displayPriceRemaining,Fe=be.displayDiscountPrice,De=Y||{},Ae=De.id,Me=De.hospital_branch,Ee=De.name,Le=De.organization,Pe=De.product_type,Se=Me||{},Ve=Se.id,Oe=Se.name,Te=Le||{},Be=Te.id,Re=Te.name,Ue=O||Ae,Ze=O?f.V.vaccine_package:null===f.L||void 0===f.L?void 0:f.L[Pe],He=(0,c.useContext)(b.B).pushNotifications,Ie=function(){$(!1)};(0,c.useEffect)((function(){ge((0,n.A)((0,r.A)({},U.vp),{original_price:Y.price_discount||Y.price,final_price:Y.price_discount||Y.price}))}),[null===Y||void 0===Y?void 0:Y.id]),(0,c.useEffect)((function(){S&&(0,g.px)((0,g.$k)(h.R.GET_VALIDATE_REFERRAL_CODE),"POST",{data:{product_id:Ue,product_type:Ze,clinic_id:Ve,hospital_id:Be,code:S,phone:"+84000000000"}}).then((function(e){(null===e||void 0===e?void 0:e.referral)?(te({id:e.referral.code,discount_value:e.referral.discount_value,discount_type:e.referral.discount_type,voucher_code:e.referral.code,voucher_name:e.referral.name,voucher_description:e.referral.description,voucher_type:"",brand:e.referral.brand,expires_at:e.referral.expires_at,created_at:e.referral.created_at}),ie(e.referral.code)):(te(null),ie(""))}))}),[S,Ue]),(0,c.useEffect)((function(){le(!0),(0,g.px)((0,g.$k)(h.R.GET_VACCINATION_VOUCHERS,{id:Ue,clinicId:Ve,hospitalId:Be,type:Ze}),"GET").then((function(e){var t,a;(null===e||void 0===e||null===(t=e.data)||void 0===t||null===(a=t.vouchers)||void 0===a?void 0:a.length)&&K(e.data.vouchers)})).finally((function(){le(!1)}))}),[Ue]),(0,c.useEffect)((function(){var e=!1,t={product_id:Ue,clinic_id:Ve,hospital_id:Be,type:Ze,voucher_code:(null===Q||void 0===Q?void 0:Q.voucher_code)||"",referral_code:ae,quantity:Ye};return(0,g.px)((0,g.$k)(h.R.GET_VACCINATION_PRICE),"POST",{data:t}).then((function(t){if(!e){if("success"===(null===t||void 0===t?void 0:t.message)){var a=(0,n.A)((0,r.A)({},U.vp,t),{original_price:t.original_price,final_price:t.final_price,voucher_discount_value:t.voucher_discount_value||0,referral_discount_value:t.referral_discount_value||0});return a.quantity_supported?Ye>a.max_product_quantity&&_e(a.max_product_quantity):_e(1),ge(a)}throw new Error("")}})).catch((function(e){console.error(e),ge((0,n.A)((0,r.A)({},U.vp),{original_price:Y.price_discount||Y.price,final_price:Y.price_discount||Y.price}))})).finally((function(){I(!1)})),function(){e=!0}}),[Ue,Q,ae,Ye]),(0,c.useEffect)((function(){return function(){ce(k.Ou)}}),[Ue]);var ze=function(e,t,a){$(!1),I(!1),X(e),ie((null===t||void 0===t?void 0:t.voucher_code)||""),ge(a),e&&ce({voucherCount:oe+1})},Ge=Y.price_discount,qe=Y.price,je=Y.price_unit,We=Ge||qe,$e=function(){var e=(0,i.A)((function(){var e,t,a,i,r,n,o,c,s,d,p,u,m,f,x,v;return(0,l.__generator)(this,(function(l){switch(l.label){case 0:if(G||!he)return[2];if(!(null===(e=N.current)||void 0===e?void 0:e.isFormValid()))return[2];if(a=[],!fe.prescription_required)return[3,4];l.label=1;case 1:return l.trys.push([1,3,,4]),[4,null===(i=N.current)||void 0===i?void 0:i.startUploadPrescription()];case 2:return a=l.sent(),(null===(r=N.current)||void 0===r?void 0:r.isFormValid())?[3,4]:[2];case 3:return n=l.sent(),console.error("Error uploading prescription:",n),He({message:E({id:"vaccination.payment.prescription.uploadError",defaultMessage:"Failed to upload prescription files. Please try again."}),type:"danger"}),[2];case 4:return[4,null===(t=N.current)||void 0===t?void 0:t.getFormData()];case 5:o=l.sent(),a.length>0&&(o.prescriptionUrls=a),c=(0,P.ze)(he),s=c.paymentVia,d=c.provider,p=c.providerTitle,u=c.paymentType,l.label=6;case 6:return l.trys.push([6,10,,11]),q(!0),ae?[4,(0,g.px)((0,g.$k)(h.R.GET_VALIDATE_REFERRAL_CODE),"POST",{data:{product_id:Ue,product_type:Ze,clinic_id:Ve,hospital_id:Be,code:ae,phone:o.phone.value}})]:[3,8];case 7:if("ok"!==(null===(f=l.sent())||void 0===f?void 0:f.message))return q(!1),[2,He({message:E({id:"vaccination.payment.failed_referral",defaultMessage:"Invalid referral code, please try again later"}),type:"danger"})];l.label=8;case 8:return[4,(0,g.px)((0,g.fK)(h.R.GET_PAYMENT_URL,{provider:d.toLowerCase()}),"POST",{data:{ref_id:V,order_info:Ee,amount:fe.final_price,payment_via:Number(s),payment_type:u,return_url:"".concat(window.location.origin).concat(window.location.pathname),provider:d.toLowerCase(),product_id:Ue,quantity:Ye,product_parent_id:Ae,price_unit:Y.price_unit,clinic_id:Ve,clinic_name:Oe,product_name:Ee,product_package_name:T||"",hospital_id:Be,hospital_name:Re,hospital_branch_name:null===(m=Y.hospital_branch)||void 0===m?void 0:m.name,image:Y.logo,type:Ze,voucher_code:null===Q||void 0===Q?void 0:Q.voucher_code,referral_code:ae,customer_info:{identification_number:(o.idNumber.value||"").trim(),name:(o.name.value||"").trim(),age:Number(o.age.value),gender:o.gender.value,email:(o.email.value||"").trim(),phone:(o.phone.value||"").trim()},shipping_address:{country:(o.shippingCountry.value||"").trim(),zip_or_postal_code:(o.shippingZipCode.value||"").trim(),address_line:(o.shippingAddressLine.value||"").trim(),city:(o.shippingCity.value||"").trim()},customer_address:{country:(o.userCountry.value||"").trim(),zip_or_postal_code:(o.userZipCode.value||"").trim(),address_line:(o.userAddressLine.value||"").trim(),city:(o.userCity.value||"").trim()},prescription:o.prescriptionUrls,sub_payment_method_code:Ce}})];case 9:if(x=l.sent(),!(v=x.data.url))throw new Error("");return window.location.href=v,[3,11];case 10:return l.sent(),He({message:E({id:"vaccination.payment.failed_desc",defaultMessage:"There was an issue with your {provider} transaction. Please try again or use another payment method."},{provider:p}),type:"danger"}),[3,11];case 11:return q(!1),[2]}}))}));return function(){return e.apply(this,arguments)}}();(0,c.useEffect)((function(){window.intlTelInputUtils||a(24183)}),[]);var Je,Ke=(0,c.useMemo)((function(){var e=(0,P.ze)(he||""),t=e.provider,a=e.paymentVia,i=e.paymentType;return xe.find((function(e){return e.provider===t&&e.payment_via===Number(a)&&e.payment_type===i}))}),[he,xe]),Qe={referralData:ee,appliedReferralCode:ae,appliedVoucher:Q,loadingVoucher:re,loadingPrice:Z,handleClickOpenVoucher:function(){$(!0)},vaccinationDetail:Y,displayPricePayNow:we,displayPriceRemaining:ke},Xe={loadingPrice:Z,displayPricePayNow:we,displayPriceRemaining:ke},et=function(){if(!he)return tt(),He({message:E({id:"vaccination.payment.error_select_method",defaultMessage:"Please select a payment method"}),type:"danger"});ye(U.RZ.TWO)},tt=function(){requestAnimationFrame((function(){var e;null===(e=document.querySelector("#payment-method-step-1"))||void 0===e||e.scrollIntoView({behavior:"smooth",block:"start"})}))},at=ve===U.RZ.TWO&&(0,o.Y)(de.A,{ref:N,loadingPayment:G,backToStepOne:function(){ye(1),tt()}}),it=ve===U.RZ.TWO&&(0,o.FD)(m.a,{className:"flex gap-2",children:[(0,o.Y)(d.B,{size:"lg","data-testid":"back",variant:"tertiary",onClick:function(){return!G&&ye(U.RZ.ONE)},dataEventAction:"Payment Back to Step 1",dataEventCategory:"Vaccination",dataEventLabel:B,children:(0,o.Y)(p.A,{})}),(0,o.Y)(d.B,{onClick:$e,"data-testid":"confirm-and-pay",size:"lg",className:"flex-1",loading:G,dataEventAction:"Payment Success",dataEventCategory:"Vaccination",dataEventLabel:B,children:(0,o.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium",children:E({id:"vaccination.payment.pay_final_amount",defaultMessage:"Pay {amount}"},{amount:(null===Ke||void 0===Ke?void 0:Ke.payment_type)===P.Ai.ten_percent?we:Ne})})})]}),rt=function(){return Fe?(0,o.FD)(o.FK,{children:[(0,o.Y)(m.a,{className:"absolute pointer-events-none top-0 left-0 right-0 h-9",style:{background:"linear-gradient(180deg, #E3FFD7 0%, #FFFFFF 100%)"}}),(0,o.FD)(m.a,{className:"flex mb-4 gap-2 relative",children:[(0,o.Y)("img",{src:s.C.getAssetPath("payment/fireworks.png"),alt:"fireworkds",className:"w-5 h-5"}),(0,o.Y)("p",{className:"text-[13px] leading-5 font-medium tracking-[-0.3px] text-gray700",children:E({id:"vaccination.payment.details_saving",defaultMessage:"You've saved {number}"},{number:(0,o.Y)("span",{className:"font-bold",children:Fe})})})]})]}):null};return w?(0,o.FD)(m.a,{className:"bg-neutral50",children:[(0,o.Y)(D.A,{}),(0,o.FD)(m.a,{className:"flex flex-col gap-3 pb-[120px]",children:[(0,o.Y)(H.Ay,{stepNumber:ve,vaccinationDetail:Y,showDeliveryFee:fe.show_delivery_fee,children:ve===U.RZ.ONE&&(0,o.Y)(F,{})}),ve===U.RZ.ONE&&!fe.show_delivery_fee&&(0,o.Y)(L,{}),ve===U.RZ.ONE&&(0,o.Y)(se,(0,r.A)({},Qe)),at]}),ve===U.RZ.ONE&&(0,o.FD)(m.a,{"data-testid":"continue",onClick:et,className:"fixed bottom-0 z-[1] left-0 right-0 border-t border-solid border-neutral100 py-2 px-4 bg-white",children:[rt(),(0,o.FD)(d.B,{size:"lg",fullWidth:!0,dataEventAction:"Payment Confirm to Step 2",dataEventCategory:"Vaccination",dataEventLabel:B,children:[(0,o.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium",children:E({id:"vaccination.payment.btn_confirm",defaultMessage:"Confirm Payment Method"})}),(0,o.Y)(u.A,{color:"currentColor",size:22,className:"ml-1.5"})]})]}),ve===U.RZ.TWO&&(0,o.FD)(m.a,{className:"fixed z-[1] bottom-0 left-0 right-0 border-t border-solid border-neutral100 py-2 px-4 bg-white",children:[rt(),it]}),(0,o.Y)(ne,{opened:W,listVoucher:J,onClose:Ie,productPrice:We,priceUnit:je,onSubmit:ze,selectedVoucher:Q,computedPrice:fe,vaccinationDetail:Y,appliedReferralCode:ae,referralData:ee,type:Ze,packageId:O}),(0,o.Y)(me.A,{className:"!top-4 !right-4 !left-4"}),(0,o.Y)(x.A,{excludeIds:[null===(t=Y.hospital_branch)||void 0===t?void 0:t.id]})]}):(0,o.FD)(ue,{stepOneProps:Qe,paymentMethodProps:Xe,handleContinueToNextStep:et,renderedStepTwo:at,renderedStepTwoActions:it,children:[(0,o.Y)(ne,{opened:W,listVoucher:J,onClose:Ie,productPrice:We,priceUnit:je,onSubmit:ze,selectedVoucher:Q,computedPrice:fe,vaccinationDetail:Y,appliedReferralCode:ae,referralData:ee,type:Ze,packageId:O}),(0,o.Y)(me.A,{className:"!top-4 !right-4"}),!fe.show_delivery_fee&&(0,o.Y)(x.A,{excludeIds:[null===(Je=Y.hospital_branch)||void 0===Je?void 0:Je.id]})]})}},59869:function(e,t,a){var i=a(2445),r=a(28519),n=a(73419),l=a(28636),o=a.n(l),c=a(67722),s=a(39636),d=a(40959);t.A=function(e){var t=e.vaccinationDetail,a=(0,n.$)(),l=a.locale,p=a.query,u=a.pathname,m=d.ElQ[l||"vi-VN"].SITE_NAME_FORMATTED;return(0,i.Y)(r.f,{SEOData:{SEOTitle:t.display_name,SEOImage:t.logo,SEODescription:(0,c.Yp)(t.description||"",d.ZCt),siteName:m,seoType:"website"},seoCustom:!0,locale:l,routerPathname:u,routerQuery:p,nextHead:function(e){var t=e.children;return(0,i.FD)(o(),{children:[(0,i.Y)(s.H,{locale:l,includeFavicons:!1}),t]})},siteType:"helloSites"})}},56771:function(e,t,a){var i=a(73884),r=a(27516),n=a(73419);t.A=function(){var e=(0,n.$)(),t=e.locale,a=e.asPath,l=e.basePath;return(0,i.useMemo)((function(){return"https://".concat(r.y[t]).concat(l).concat(a)}),[])}}}]);