"use strict";(self.webpackChunkhhgHealthCareV1=self.webpackChunkhhgHealthCareV1||[]).push([[4613],{78773:function(e,n,t){t.d(n,{G:function(){return r}});var r="__subscription_add_another_card__"},47683:function(e,n,t){t.d(n,{L3:function(){return A},Lo:function(){return _},ze:function(){return C}});var r=t(40568),i=t(2445),a=t(73884),l=t(36814),o=t(84655),s=t(59850),c=t(84091),d=t(9934),u=t(63231),p=t(42280),f=t(73419),m=t(6442),g=t(39755),h="10_percent",y="100_percent",v="full_payment",x="subscription",b=["bind_card","subscription"];function C(e){var n=(0,r.A)(e.split("-"),4);return{provider:n[0],paymentVia:n[1],paymentType:n[2],providerTitle:n[3]}}var _=function(e){return!!e&&b.includes(C(e).paymentType)},A=function(e,n){return _(n)?1:e};n.Ay=function(e){var n=e.hospitalId,t=e.doctorId,r=(0,f.$)().locale,C=(0,m.A)().formatMessage,_=(0,a.useState)(!0),A=_[0],N=_[1],k=(0,a.useState)(),Y=k[0],w=k[1],M=(0,g.C)(),L=M.providers,F=M.setProviders,P=M.selectedPaymentValue,S=(0,p.Jf)();(0,a.useEffect)((function(){S.setProviders(L)}),[L]),(0,a.useEffect)((function(){S.setSelectedPaymentValue(P)}),[P]),(0,a.useEffect)((function(){return p.Jf.subscribe((function(e){var n,t=g.C.getState();(e.selectedPaymentValue!==t.selectedPaymentValue&&t.setSelectedPaymentValue(e.selectedPaymentValue),e.selectedSubPaymentValue!==t.selectedSubPaymentValue&&t.setSelectedSubPaymentValue(e.selectedSubPaymentValue),e.openOnlineBanking!==t.openOnlineBanking)&&t.setOpenOnlineBanking(null!==(n=e.openOnlineBanking)&&void 0!==n&&n)}))}),[]);var D=(0,a.useMemo)((function(){var e=L.filter((function(e){return e.payment_type===h})),n=L.filter((function(e){return e.payment_type===v})),t=L.filter((function(e){return e.payment_type===y})),r=L.filter((function(e){var n=e.payment_type;return b.includes(n)}));return{ten_percent:e,full_payment:n,one_hundred_percent:t,subscription:r}}),[L]),O=D.subscription.length>0,B=(0,a.useMemo)((function(){var e=[];return D.one_hundred_percent.length&&e.push({label:D.one_hundred_percent[0].display_label||C({id:"vaccination.payment.tabs.pay_100_percent",defaultMessage:"Pay 100%"}),value:y}),D.ten_percent.length&&e.push({label:D.ten_percent[0].display_label||C({id:"vaccination.payment.tabs.pay_10_percent",defaultMessage:"Pay 10% to Book"}),value:h}),D.full_payment.length&&e.push({label:D.full_payment[0].display_label||C({id:"vaccination.payment.tabs.buy_now_pay_later",defaultMessage:"Buy Now Pay Later"}),value:v}),e}),[D.ten_percent,D.full_payment,D.one_hundred_percent,D.subscription]);(0,a.useMemo)((function(){if(B.length){var e=B[0].value;P&&P.includes(v)&&(e=v),P&&P.includes(h)&&(e=h),P&&P.includes(y)&&(e=y),P&&P.includes(x)&&(e=x),w(e)}}),[B,P]);var V=(0,a.useMemo)((function(){return O?L:Y===h?D.ten_percent:Y===y?D.one_hundred_percent:Y===v?D.full_payment:Y===x?D.subscription:L}),[Y,D,L,O]);return(0,a.useEffect)((function(){if(n){N(!0);var e="teleconsult_payment_providers_".concat(n,"_").concat(t);o.W.withCached(e,(function(){return(0,c.px)((0,c.fK)(s.R.GET_VACCINATION_PAYMENT_PROVIDER,{locale:String(r),hospitalId:n,doctorId:"".concat(t||"")}),"GET")})).then((function(e){var n,t;(null===e||void 0===e||null===(n=e.data)||void 0===n||null===(t=n.items)||void 0===t?void 0:t.length)&&(F(e.data.items),N(!1))}))}}),[n]),(0,i.FD)("div",{id:"payment-method-tele-step-1",className:"paymentMethod",children:[!O&&(0,i.Y)(u.A,{tabs:B,currentTab:Y,onChangeTab:w}),(0,i.Y)(l.a,{className:"pt-[14px] bg-white",children:(0,i.FD)(l.a,{className:"px-4 pb-5 lg:pb-6",children:[O&&(0,i.Y)(l.a,{className:"flex justify-between items-center mb-3",children:(0,i.Y)("h2",{className:"text-[17px] leading-6 tracking-[-0.4px] text-dark font-semibold",children:C({id:"teleconsultation.payment.step2.payment_method",defaultMessage:"Payment Method"})})}),(0,i.Y)(d.A,{loading:A,options:O?L:V})]})})]})}},39755:function(e,n,t){t.d(n,{C:function(){return a},R:function(){return i}});var r=t(44745),i={RESULT:0,ONE:1,TWO:2},a=(0,r.vt)()((function(e){return{currentStep:i.ONE,setCurrentStep:function(n){return e((function(){return{currentStep:n}}))},providers:[],setProviders:function(n){return e((function(){return{providers:n}}))},setSelectedPaymentValue:function(n){return e((function(){return{selectedPaymentValue:n}}))},setSelectedSubPaymentValue:function(n){return e((function(){return{selectedSubPaymentValue:n}}))},setOpenOnlineBanking:function(n){return e((function(){return{openOnlineBanking:n}}))},setDoctorInfo:function(n){return e((function(){return{doctorInfo:n}}))},setSlotInfo:function(n){return e((function(){return{slotInfo:n}}))},setDate:function(n){return e((function(){return{date:n}}))},setScheduleId:function(n){return e((function(){return{scheduleId:n}}))},setPaymentResult:function(n){return e((function(){return{paymentResult:n}}))}}}))},24613:function(e,n,t){t.d(n,{h:function(){return oe},A:function(){return de}});var r=t(858),i=t(38971),a=t(44898),l=t(53513),o=t(63538),s=t(83776),c=t(2445),d=t(73884),u=t(31898),p=t(35291),f=t(39450),m=t(6043),g=t(4174),h=t(92793),y=t(22615),v=t(1657),x=t(36814),b=t(72280),C=t(6596),_=t(84091),A=t(32485),N=t.n(A),k=t(35652),Y=t(78773),w=t(47683),M=t(88491),L=t(73419),F=t(96404),P=t(6442),S=t(67722),D=t(86706),O=t(37680),B=t(88411),V=t(27773),j=t(20396),Z=t(41543),E=t(62481),T=t(99745),I=t(46270),z=t(57448),H=t(59850),R=t(40959),U=["image/png","image/jpeg","image/jpg","application/pdf","image/heic","image/heif"],W=(0,d.forwardRef)((function(e,n){var t,a=e.prescriptionFiles,u=e.setPrescriptionFiles,f=e.formData,m=e.setFormData,g=e.onValidate,h=e.loadingPayment,y=e.isDisableUpload,v=(0,P.A)().formatMessage,b=(0,d.useRef)(null),C=(0,L.$)(),A=C.locale,N=C.router;(0,d.useImperativeHandle)(n,(function(){return{handleFileSelect:function(e){k(e)}}}));var k=function(e){if(!h){var n=Array.from(e),t=Object.keys(a).filter((function(e){var n;return null===(n=a[e])||void 0===n?void 0:n.fileObject})).length;if(t+n.length>3)m((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{error:v({id:"vaccination.payment.prescription.maxFilesExceeded",defaultMessage:"Maximum 3 files/images allowed"}),touched:!0})})}));else{var r=new Set;Object.keys(a).forEach((function(e){var n=a[e];if(null===n||void 0===n?void 0:n.fileObject){var t="".concat(n.fileObject.name,"_").concat(n.fileObject.size);r.add(t)}}));var i=new Set,s=[];if(n.forEach((function(e){var n="".concat(e.name,"_").concat(e.size);r.has(n)||i.has(n)?s.push(e):i.add(n)})),s.length>0)m((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{error:v({id:"vaccination.payment.prescription.duplicateFile",defaultMessage:'File "{fileName}" has already been selected'},{fileName:s[0].name}),touched:!0})})}));else{var c=[];if(n.forEach((function(e){var n=function(e){return e.size>5242880?v({id:"vaccination.payment.prescription.fileTooLarge",defaultMessage:"File size must be less than 5MB"}):U.includes(e.type)||e.name.toLowerCase().endsWith(".heic")||e.name.toLowerCase().endsWith(".heif")?null:v({id:"vaccination.payment.prescription.invalidFileType",defaultMessage:"Invalid file type. Only PNG, JPG, JPEG, PDF, HEIC, HEIF are allowed"})}(e);n&&c.push({file:e,error:n})})),c.length>0)m((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{error:c[0].error,touched:!0})})}));else{var d=["File1","File2","File3"],p=new Set(Object.keys(a).filter((function(e){var n;return null===(n=a[e])||void 0===n?void 0:n.fileObject}))),f=[],g=!0,y=!1,x=void 0;try{for(var b,C=n[Symbol.iterator]();!(g=(b=C.next()).done);g=!0){var _=b.value,A=d.find((function(e){return!p.has(e)}));if(!A)return void m((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{error:"vaccination.payment.prescription.maxFilesExceeded",touched:!0})})}));p.add(A),f.push({file:_,key:A})}}catch(N){y=!0,x=N}finally{try{g||null==C.return||C.return()}finally{if(y)throw x}}m((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{error:""})})})),u((function(e){var n=(0,l.A)({},e);f.forEach((function(e){var t=e.file,r=e.key;n[r]={fileObject:t,status:"pending"}}));var t=Object.keys(n).filter((function(e){var t;return null===(t=n[e])||void 0===t?void 0:t.fileObject}));return t.sort((function(e,n){var t={File1:1,File2:2,File3:3};return t[e]-t[n]})),m((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{value:t.join("|"),touched:!0})})})),n}))}}}}},Y=function(e){if(!h){u((function(n){var t=(0,l.A)({},n);return delete t[e],t}));var n=Object.keys(a).filter((function(n){return n!==e})).filter((function(e){var n;return null===(n=a[e])||void 0===n?void 0:n.fileObject}));m((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{value:n.join("|"),touched:!0})})})),requestAnimationFrame((function(){g("prescription")}))}},w=function(){var e=(0,r.A)((function(e){var n,t,r,c,d,p;return(0,s.__generator)(this,(function(s){switch(s.label){case 0:if(h)return[2];if(!(null===(n=a[e])||void 0===n?void 0:n.fileObject)||"failed"!==n.status)return[2];u((function(n){var t=n[e];return t?(0,o.A)((0,l.A)({},n),(0,i.A)({},e,(0,o.A)((0,l.A)({},t),{status:"loading"}))):n})),m((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{error:""})})})),s.label=1;case 1:return s.trys.push([1,7,,8]),t=window.location.href.includes("localhost"),(r=new FormData).append("file",n.fileObject),t?(d={URL:"https://cdn-hermes.hellohealthgroup.com/2026/01/c73bb9c0c77b33740c67833e5081c2b25b7e2f8b01b88c15e5c4743617476022.png",message:"Upload Successful",status:!0},[3,4]):[3,2];case 2:return[4,(0,_.px)((0,_.Gx)(H.R.POST_IMAGE_UPLOAD),"POST",{data:r,headers:{"Content-Type":"multipart/form-data"}})];case 3:d=s.sent(),s.label=4;case 4:return c=d,t?[4,new Promise((function(e){return setTimeout(e,1e3)}))]:[3,6];case 5:s.sent(),s.label=6;case 6:if(!(p=(null===c||void 0===c?void 0:c.URL)||""))throw new Error("No URL returned");return u((function(n){var t=n[e];return t?(0,o.A)((0,l.A)({},n),(0,i.A)({},e,(0,o.A)((0,l.A)({},t),{status:"success",url:p}))):n})),[3,8];case 7:return s.sent(),u((function(n){var t=n[e];return t?(0,o.A)((0,l.A)({},n),(0,i.A)({},e,(0,o.A)((0,l.A)({},t),{status:"failed"}))):n})),[3,8];case 8:return[2]}}))}));return function(n){return e.apply(this,arguments)}}(),M=Object.keys(a).filter((function(e){var n,t;return(null===(n=a[e])||void 0===n?void 0:n.fileObject)||(null===(t=a[e])||void 0===t?void 0:t.url)})),F=M.length>=3,S=h||F||y;return(0,c.FD)(x.a,{className:"pt-4 flex gap-3 flex-col",children:[(0,c.Y)("p",{className:"text-[15px] leading-6 tracking-[-0.3px] text-gray1000 font-semibold",children:v({id:"vaccination.payment.prescription_upload_description",defaultMessage:"Please upload a valid prescription for our medical expert to review"})}),M.length>0&&(0,c.Y)(x.a,{className:"flex gap-2 flex-col",children:M.map((function(e){var n=function(e){var n=a[e];if(!n)return{text:"",icon:null,bgColor:"",status:"pending"};switch(n.status){case"pending":return{text:"",icon:null,bgColor:"bg-neutral50",status:"pending"};case"loading":return{text:v({id:"vaccination.payment.prescription.uploading",defaultMessage:"Uploading"}),icon:(0,c.Y)(z.a,{size:20,color:p.w.colors.primaryBase}),bgColor:"bg-neutral50",status:"loading"};case"success":return{text:"",icon:(0,c.Y)(V.A,{color:p.w.colors.green600,size:20,className:"flex-shrink-0"}),bgColor:"bg-green50",status:"success"};case"failed":return{text:v({id:"vaccination.payment.prescription.resend",defaultMessage:"Resend"}),icon:(0,c.Y)(E.A,{color:p.w.colors.red600,size:20,className:"flex-shrink-0"}),bgColor:"bg-red50",status:"failed"};default:return{text:"",icon:null,bgColor:"",status:"pending"}}}(e),t=function(e){var n=a[e];if(null===n||void 0===n?void 0:n.fileObject)return n.fileObject.name;if(null===n||void 0===n?void 0:n.url){var t,r=n.url.match(/([^/?#]+\.(?:png|jpg|jpeg|pdf|heic|heif|webp))(?=$|[?#])/i);return null!==(t=null===r||void 0===r?void 0:r[1])&&void 0!==t?t:"prescription_01.jpeg"}return""}(e);return(0,c.FD)(x.a,{className:"".concat(n.bgColor," rounded-lg px-4 py-3 flex items-center gap-3"),children:[n.icon&&(0,c.Y)(x.a,{className:"flex-shrink-0",children:n.icon}),(0,c.Y)("p",{className:"flex-1 text-[13px] leading-5 tracking-[-0.3px] text-dark truncate",children:t}),n.text&&"loading"===n.status&&(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-primaryBase",children:n.text}),n.text&&"failed"===n.status&&(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-red600 cursor-pointer",onClick:function(){return w(e)},children:n.text}),!y&&(0,c.Y)(c.FK,{children:"success"===n.status?(0,c.Y)(T.A,{size:20,color:p.w.colors.gray700,className:"flex-shrink-0 cursor-pointer",onClick:function(){return Y(e)}}):(0,c.Y)(j.A,{size:20,color:p.w.colors.gray700,className:"flex-shrink-0 cursor-pointer",onClick:function(){return Y(e)}})})]},e)}))}),(null===(t=f.prescription)||void 0===t?void 0:t.error)&&(0,c.Y)("p",{className:"text-[12px] leading-5 tracking-[-0.3px] text-red600",children:f.prescription.error}),(0,c.FD)(x.a,{className:"flex gap-2 flex-col lg:flex-row lg:gap-4 lg:items-center",children:[(0,c.Y)("input",{ref:b,type:"file",id:"prescription-upload-input",accept:".png,.jpg,.jpeg,.pdf,.heic,.heif",multiple:!0,onChange:function(e){e.target.files&&e.target.files.length>0&&(k(e.target.files),b.current&&(b.current.value=""))},className:"hidden",disabled:S}),(0,c.FD)(B.B,{variant:"tertiary",fullWidth:!0,size:"lg",onClick:function(){var e;return null===(e=b.current)||void 0===e?void 0:e.click()},disabled:S,className:S?"opacity-50 cursor-not-allowed !w-auto":"!w-auto",children:[(0,c.Y)(Z.A,{color:p.w.colors.primaryBase,size:20,className:"mr-2"}),(0,c.Y)("span",{className:"text-[15px] leading-6 tracking-[-0.3px] font-medium ".concat(S?"text-gray400":"text-primaryBase"),children:v({id:"vaccination.payment.prescription_upload_button",defaultMessage:"Upload prescription"})})]}),(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray400",children:v({id:"vaccination.payment.prescription_upload_description_2",defaultMessage:"Max files upload size can be 5MB"})})]}),!y&&(0,c.FD)(x.a,{onClick:function(){var e,n;N.push("/".concat(null===(e=R.y1A[A])||void 0===e?void 0:e.ALL,"/").concat(null===(n=R.y1A[A])||void 0===n?void 0:n.DOCTOR))},className:"bg-neutral50 rounded-xl p-4 flex items-center gap-3 cursor-pointer",children:[(0,c.Y)(G,{className:"min-w-[24px]"}),(0,c.Y)("p",{className:"text-dark text-[13px] leading-5 tracking-[-0.3px]",children:v({id:"vaccination.payment.prescription_upload_description_3",defaultMessage:"Don't have a prescription? Book a tele-consultation with our partner doctors"},{a:function(e){return(0,c.Y)("span",{className:"text-blue900 font-semibold",children:e})}})}),(0,c.Y)(I.A,{className:"min-w-[24px]",color:"#8C8C8C"})]})]})})),G=function(e){var n=e.className;return(0,c.FD)("svg",{width:"24",height:"24",className:n,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,c.FD)("g",{clipPath:"url(#clip0_14688_443)",children:[(0,c.Y)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M15.9813 12.3885C16.2548 12.3885 16.5056 12.5432 16.628 12.7878L17.7532 15.0404L20.008 16.1688C20.2525 16.2911 20.4071 16.541 20.4073 16.8145C20.4073 17.088 20.2527 17.3388 20.008 17.4612L17.7543 18.5875L16.628 20.8412C16.5056 21.0858 16.2548 21.2405 15.9813 21.2405C15.7079 21.2403 15.458 21.0857 15.3357 20.8412L14.2072 18.5864L11.9546 17.4612C11.71 17.3388 11.5553 17.088 11.5553 16.8145C11.5554 16.5412 11.7102 16.2912 11.9546 16.1688L14.2083 15.0415L15.3357 12.7878L15.3877 12.701C15.5212 12.5076 15.7421 12.3886 15.9813 12.3885ZM15.3932 15.903C15.3233 16.0428 15.2096 16.1565 15.0698 16.2264L13.8925 16.8145L15.0698 17.4037L15.1697 17.4633C15.2638 17.5312 15.3407 17.6212 15.3932 17.7259L15.9813 18.9032L16.5705 17.7259L16.6302 17.6272C16.698 17.533 16.788 17.4561 16.8927 17.4037L18.07 16.8145L16.8927 16.2264C16.7531 16.1565 16.6403 16.0427 16.5705 15.903L15.9813 14.7257L15.3932 15.903Z",fill:"#00B16A"}),(0,c.Y)("path",{d:"M17.0002 3.2218C18.6268 3.2218 19.945 4.54003 19.945 6.16668V12.5556C19.945 12.9544 19.6213 13.2782 19.2224 13.2782C18.8235 13.2782 18.4997 12.9544 18.4997 12.5556V6.16668C18.4997 5.33777 17.8291 4.66711 17.0002 4.66711H7.55572C6.72681 4.66711 6.05615 5.33777 6.05615 6.16668V17.8333C6.05615 18.6623 6.72681 19.3329 7.55572 19.3329H12.5557C12.9546 19.3329 13.2784 19.6567 13.2784 20.0556C13.2784 20.4544 12.9546 20.7782 12.5557 20.7782H7.55572C5.92907 20.7782 4.61084 19.46 4.61084 17.8333V6.16668C4.61084 4.54003 5.92907 3.2218 7.55572 3.2218H17.0002Z",fill:"#00B16A"}),(0,c.Y)("path",{d:"M9.22238 13.7774C9.62126 13.7774 9.94504 14.1011 9.94504 14.5C9.94504 14.8989 9.62126 15.2227 9.22238 15.2227H8.66683C8.26796 15.2227 7.94417 14.8989 7.94417 14.5C7.94417 14.1011 8.26796 13.7774 8.66683 13.7774H9.22238Z",fill:"#00B16A"}),(0,c.Y)("path",{d:"M9.22238 10.444C9.62126 10.444 9.94504 10.7678 9.94504 11.1667C9.94504 11.5656 9.62126 11.8893 9.22238 11.8893H8.66683C8.26796 11.8893 7.94417 11.5656 7.94417 11.1667C7.94417 10.7678 8.26796 10.444 8.66683 10.444H9.22238Z",fill:"#00B16A"}),(0,c.Y)("path",{d:"M13.9446 10.444C14.3435 10.444 14.6673 10.7678 14.6673 11.1667C14.6673 11.5656 14.3435 11.8893 13.9446 11.8893H12.0002C11.6013 11.8893 11.2775 11.5656 11.2775 11.1667C11.2775 10.7678 11.6013 10.444 12.0002 10.444H13.9446Z",fill:"#00B16A"}),(0,c.Y)("path",{d:"M9.22238 7.11069C9.62126 7.11069 9.94504 7.43447 9.94504 7.83335C9.94504 8.23222 9.62126 8.556 9.22238 8.556H8.66683C8.26796 8.556 7.94417 8.23222 7.94417 7.83335C7.94417 7.43447 8.26796 7.11069 8.66683 7.11069H9.22238Z",fill:"#00B16A"}),(0,c.Y)("path",{d:"M15.8891 7.11069C16.2879 7.11069 16.6117 7.43447 16.6117 7.83335C16.6117 8.23222 16.2879 8.556 15.8891 8.556H12.0002C11.6013 8.556 11.2775 8.23222 11.2775 7.83335C11.2775 7.43447 11.6013 7.11069 12.0002 7.11069H15.8891Z",fill:"#00B16A"})]}),(0,c.Y)("defs",{children:(0,c.Y)("clipPath",{id:"clip0_14688_443",children:(0,c.Y)("rect",{width:"20",height:"20",fill:"white",transform:"translate(2 2)"})})})]})};W.displayName="PrescriptionUpload";var q,$,J=W,K=t(42280),Q=t(9655),X=t(96149),ee=t(95204),ne=u.i.TextField,te=(0,d.lazy)((function(){return t.e(3299).then(t.bind(t,43299))})),re={wrapper:{":has(input[data-disabled])":{backgroundColor:ee.bm,borderColor:ee.AF,color:ee.Dp,opacity:1}},input:{fontSize:"15px",letterSpacing:"-0.3px",fontWeight:500,color:"#111111"}},ie={name:{value:"",error:""},idNumber:{value:"",error:""},phone:{value:"",error:""},gender:{value:"male",error:"",touched:!0},age:{value:"",error:""},email:{value:"",error:""},shippingAddressLine:{value:"",error:""},shippingCity:{value:"",error:""},shippingZipCode:{value:"",error:""},shippingCountry:{value:"",error:""},userAddressLine:{value:"",error:""},userCity:{value:"",error:""},userZipCode:{value:"",error:""},userCountry:{value:"",error:""},prescription:{value:"",error:""},creditCardNumber:{value:"",error:""}},ae=["name","idNumber","phone","gender","age","email","userAddressLine","userCity","userZipCode","userCountry","creditCardNumber","shippingAddressLine","shippingCity","shippingZipCode","shippingCountry","prescription"],le=["name","idNumber","phone","gender","age","creditCardNumber","prescription"],oe=function(e){var n=e.action,t=(0,D.T)(),r=t.displayDiscountPrice,i=t.displayTotalPrice,a=t.displayTaxPrice,l=t.displayShippingFee,o=t.displayPricePayTenPercentage,s=t.displayPriceRemaining,u=t.displayPriceWithUnitAndQuantity,p=(0,K.Jf)(),f=p.vaccinationDetail,m=p.selectedPaymentValue,g=p.providers,y=(0,P.A)().formatMessage,v=(0,L.$)().locale,b=(0,F.Y)().selectedExtraChargeList,C=(0,d.useMemo)((function(){var e=(0,O.ze)(m||""),n=e.provider,t=e.paymentVia,r=e.paymentType;return g.find((function(e){return e.provider===n&&e.payment_via===Number(t)&&e.payment_type===r}))}),[m,g]),A=null===f||void 0===f?void 0:f.hospital_branch.name;return(0,c.FD)(x.a,{"data-testid":"payment-details",className:"bg-white pt-6 px-4 pb-0.5",children:[(0,c.Y)(d.Suspense,{fallback:null,children:(0,c.Y)(te,{})}),(0,c.Y)("h2",{className:"flex-1 text-[17px] leading-6 tracking-[-0.4px] text-dark font-semibold pb-4",children:y({id:"vaccination.payment.details",defaultMessage:"Payment Details"})}),(0,c.FD)(x.a,{className:"flex justify-between pb-3",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:y({id:(null===Q.Y||void 0===Q.Y?void 0:Q.Y[v])||Q.Y[h.L.Vietnam],defaultMessage:"Package price"})}),(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:u})]}),b.length>0&&b.map((function(e){return(0,c.FD)(x.a,{className:"flex justify-between py-3 border-t border-solid border-neutral100",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:e.charge_type_name}),(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 lg:font-medium",children:(0,_.nd)(y,(0,_.$g)(e.amount,v),e.currency)})]},e.id)})),l&&(0,c.FD)(x.a,{className:"flex justify-between py-3 border-t border-solid border-neutral100",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:y({id:"vaccination.payment.shipping_fee",defaultMessage:"Shipping Fee"})}),(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:l})]}),a&&(0,c.FD)(x.a,{className:"flex justify-between py-3 border-t border-solid border-neutral100",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:y({id:"vaccination.payment.tax",defaultMessage:"Tax"})}),(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:a})]}),r&&(0,c.FD)(x.a,{className:"flex justify-between py-3 border-t border-solid border-neutral100",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:y({id:"vaccination.payment.discount",defaultMessage:"Discount"})}),(0,c.FD)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-green600 font-medium",children:["-",r]})]}),(null===C||void 0===C?void 0:C.payment_type)===O.Ai.ten_percent&&(0,c.FD)(c.FK,{children:[(0,c.FD)(x.a,{className:"flex gap-3 justify-between py-3 border-t border-solid border-neutral100",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:y({id:"vaccination.payment.pay_later",defaultMessage:"Pay later (at {hospital_name})"},{hospital_name:A})}),(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium whitespace-nowrap",children:s})]}),(0,c.FD)(x.a,{className:"flex gap-3 justify-between py-3 border-t border-solid border-neutral100",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:y({id:"vaccination.payment.pay_now_only",defaultMessage:"Pay now only"})}),(0,c.Y)("p",{className:"text-[15px] leading-5 lg:leading-6 tracking-[-0.3px] text-dark font-semibold whitespace-nowrap",children:o})]})]}),(null===C||void 0===C?void 0:C.payment_type)===O.Ai.full_payment&&(0,c.FD)(x.a,{className:"flex gap-3 justify-between py-3 border-t border-solid border-neutral100",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:y({id:"vaccination.payment.pay_later_via_installment",defaultMessage:"Pay Later Via Installment"})}),(0,c.Y)("p",{className:"text-[15px] leading-6 tracking-[-0.3px] text-dark font-semibold whitespace-nowrap",children:i})]}),(null===C||void 0===C?void 0:C.payment_type)===O.Ai.one_hundred_percent&&(0,c.FD)(x.a,{className:"flex gap-3 justify-between py-3 border-t border-solid border-neutral100",children:[(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:y({id:"vaccination.payment.pay_now_100",defaultMessage:"Pay now 100%"})}),(0,c.Y)("p",{className:"text-[15px] leading-6 tracking-[-0.3px] text-dark font-semibold whitespace-nowrap",children:i})]}),n]})},se=(q={},(0,i.A)(q,h.L.Vietnam,"VN"),(0,i.A)(q,h.L.Malaysia,"MY"),q),ce=($={},(0,i.A)($,h.L.Vietnam,"Vietnam"),(0,i.A)($,h.L.Malaysia,"Malaysia"),$),de=(0,d.forwardRef)((function(e,n){var t,u=e.loadingPayment,A=e.backToStepOne,F=e.subscriptionCustomerPrefill,D=e.lockPrefilledCustomerFields,B=e.isHidePaymentDetail,V=e.renderPaymentDetail,j=(0,P.A)().formatMessage,Z=(0,d.useState)(ie),E=Z[0],T=Z[1],I=(0,d.useState)({}),z=I[0],H=I[1],R=(0,d.useState)(!0),U=R[0],W=R[1],G=(0,d.useRef)(null),q=(0,K.Jf)(),$=q.selectedPaymentValue,Q=q.selectedSubPaymentValue,te=q.providers,de=q.computedPrice,ue=(0,k.i)((function(e){return e.subscriptionSavedCards})),pe=(0,d.useMemo)((function(){var e,n;if(!$||!(0,w.Lo)($))return"";if(!Q||Q===Y.G)return"";var t=ue.find((function(e){return e.token_id===Q}));return(null===t||void 0===t?void 0:t.cc_no)?t.cc_no:(null===(e=E.creditCardNumber)||void 0===e||null===(n=e.value)||void 0===n?void 0:n.trim())||""}),[$,Q,ue,null===(t=E.creditCardNumber)||void 0===t?void 0:t.value]),fe=(0,M.d)().isMobileOrTablet,me=(0,L.$)().locale,ge=(0,d.useMemo)((function(){var e=F;if(!e)return{};var n={},t=!0,r=!1,i=void 0;try{for(var a,l=ae[Symbol.iterator]();!(t=(a=l.next()).done);t=!0){var o=a.value,s=e[o];null!=s&&""!==String(s).trim()&&(n[o]=String(s))}}catch(c){r=!0,i=c}finally{try{t||null==l.return||l.return()}finally{if(r)throw i}}return n}),[F]),he=(0,d.useMemo)((function(){var e=Boolean(D),n=ge,t={},r=!0,i=!1,a=void 0;try{for(var l,o=le[Symbol.iterator]();!(r=(l=o.next()).done);r=!0){var s=l.value,c=n[s];t[s]=e&&null!=c&&""!==String(c).trim()}}catch(d){i=!0,a=d}finally{try{r||null==o.return||o.return()}finally{if(i)throw a}}return t}),[ge,D]);(0,d.useEffect)((function(){var e=ge;0!==Object.keys(e).length&&(T((function(n){var t=(0,l.A)({},n),r=!0,i=!1,a=void 0;try{for(var s,c=ae[Symbol.iterator]();!(r=(s=c.next()).done);r=!0){var d=s.value,u=e[d];if(void 0!==u){var p=n[d];p&&(t[d]=(0,o.A)((0,l.A)({},p),{value:u,touched:!0}))}}}catch(f){i=!0,a=f}finally{try{r||null==c.return||c.return()}finally{if(i)throw a}}return t})),e.prescription&&H((function(n){return(0,o.A)((0,l.A)({},n),{File1:{fileObject:null,status:"success",url:e.prescription}})})))}),[ge]),(0,d.useImperativeHandle)(n,(function(){return{getFormData:function(){return(0,r.A)((function(){var e;return(0,s.__generator)(this,(function(n){return e=[],Object.keys(z).forEach((function(n){var t=z[n];"success"===(null===t||void 0===t?void 0:t.status)&&t.url&&e.push(t.url)})),[2,(0,o.A)((0,l.A)({},E),{prescriptionUrls:e})]}))}))()},startUploadPrescription:function(){return(0,r.A)((function(){var e,n;return(0,s.__generator)(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,(0,X.RL)({prescriptionFiles:z,setPrescriptionFiles:H,formatMessage:j})];case 1:return e=t.sent(),T((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{error:""})})})),[2,e];case 2:throw n=t.sent(),(0,a.A)(n,X._l)&&T((function(e){return(0,o.A)((0,l.A)({},e),{prescription:(0,o.A)((0,l.A)({},e.prescription),{error:n.message,touched:!0})})})),n;case 3:return[2]}}))}))()},isFormValid:function(){var e=!1;return Object.keys(E).map((function(n){var t=ye(n,E[n].value);console.log("\ud83d\ude80 ~ error:",t,n,E[n].value||"-x"),t&&(e=!0),T((function(e){return(0,o.A)((0,l.A)({},e),(0,i.A)({},n,(0,o.A)((0,l.A)({},e[n]),{value:E[n].value,error:t})))}))})),!e}}}));var ye=function(e,n){return"phone"===e?window.intlTelInputUtils&&window.intlTelInputUtils.isValidNumber(String(n),"vn")?"":"error.pleaseEnterAValidPhone":"idNumber"===e?(0,ee.SE)(n,j):"age"===e?Number(n)>=18&&Number(n)===parseInt(n)?"":"error.pleaseEnterAValidAge":["shippingAddressLine","shippingCity","shippingCountry","userAddressLine","userCity","userCountry"].includes(e)?!de.show_delivery_fee&&["shippingAddressLine","shippingCity","shippingCountry"].includes(e)?"":["shippingAddressLine","userAddressLine"].includes(e)?(0,ee.tz)(n,j):["shippingCity","userCity"].includes(e)?(0,ee.Y$)(n,j):"":"shippingZipCode"===e||"userZipCode"===e?de.show_delivery_fee||"shippingZipCode"!==e?(0,ee.b_)(n,j):"":"prescription"===e?de.prescription_required?Object.keys(z).some((function(e){var n=z[e];return n&&(null!==n.fileObject||n.url)}))?"":j({id:"vaccination.payment.prescription.required",defaultMessage:"Please upload at least one prescription file"}):"":"creditCardNumber"===e?"":(0,_.tf)(e,n)},ve=function(e,n){if(!u&&!he[e]){var t=n;if("idNumber"===e){var r=n.trim(),a=r.replace(/\D/g,"").length,s=/^[\d-]*$/.test(r)&&a<=12;t=me!==h.L.Vietnam&&s?function(e){var n=e.replace(/\D/g,"");return n.length<=6?n:n.length<=8?"".concat(n.slice(0,6),"-").concat(n.slice(6)):"".concat(n.slice(0,6),"-").concat(n.slice(6,8),"-").concat(n.slice(8,12))}(r):r}T((function(n){return(0,o.A)((0,l.A)({},n),(0,i.A)({},e,(0,o.A)((0,l.A)({},n[e]),{value:t,touched:!0})))}))}},xe=function(e){u||T((function(n){return(0,o.A)((0,l.A)({},n),(0,i.A)({},e,(0,o.A)((0,l.A)({},n[e]),{error:ye(e,n[e].value)})))}))},be=function(e,n){if(de.show_delivery_fee)return"all"===e?(ve("shippingAddressLine",E.userAddressLine.value),ve("shippingCity",E.userCity.value),ve("shippingZipCode",E.userZipCode.value),void requestAnimationFrame((function(){E.userAddressLine.value&&xe("shippingAddressLine"),E.userCity.value&&xe("shippingCity"),E.userZipCode.value&&xe("shippingZipCode")}))):void(U&&(ve(e,n),requestAnimationFrame((function(){xe(e)}))))};(0,d.useEffect)((function(){ve("userCountry",ce[me]),de.show_delivery_fee&&ve("shippingCountry",ce[me]),requestAnimationFrame((function(){xe("userCountry"),xe("shippingCountry")}))}),[de.show_delivery_fee,me]);var Ce=(0,d.useMemo)((function(){var e=(0,O.ze)($||""),n=e.provider,t=e.paymentVia,r=e.paymentType;return te.find((function(e){return e.provider===n&&e.payment_via===Number(t)&&e.payment_type===r}))}),[$,te]),_e=(0,d.useMemo)((function(){var e;return null===Ce||void 0===Ce||null===(e=Ce.sub_payment_methods)||void 0===e?void 0:e.find((function(e){return e.code===Q}))}),[Q,null===Ce||void 0===Ce?void 0:Ce.sub_payment_methods]),Ae=(0,d.useMemo)((function(){return[{value:"Vietnam",label:j({id:"vaccination.payment.field_country_vn",defaultMessage:"Vietnam"})},{value:"Malaysia",label:j({id:"vaccination.payment.field_country_my",defaultMessage:"Malaysia"})}]}),[j]);return(0,c.FD)(c.FK,{children:[(0,c.FD)(x.a,{"data-testid":"customer-info",className:"bg-white pt-6 px-4 pb-4 lg:pb-6",children:[(0,c.Y)("h2",{className:"flex-1 text-[17px] leading-6 tracking-[-0.3px] lg:tracking-[-0.4px] text-dark font-semibold",children:j({id:"vaccination.payment.customer_info",defaultMessage:"Customer's Info"})}),(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray400 mt-1 mb-4",children:j({id:"vaccination.payment.customer_info.desc",defaultMessage:"We need your information to make a booking and contact you later."})}),(0,c.FD)(ee.q,{className:"flex gap-3 flex-col",children:[(0,c.Y)(ne,{shrink:!!E.name.touched||!!E.name.value,className:"w-full",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{spellCheck:!1,type:"text",id:"name",placeholder:"",value:E.name.value,label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_name"})}),styles:re,error:E.name.error?(0,c.Y)("p",{className:"text-[12px]",children:j({id:E.name.error})}):void 0,onChange:function(e){return ve("name",e.target.value)},onBlur:function(){return xe("name")},disabled:u||Boolean(he.name)})})}),(0,c.Y)(ne,{shrink:!!E.idNumber.touched||!!E.idNumber.value,className:"w-full",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{spellCheck:!1,type:"text",id:"idNumber",placeholder:"",value:E.idNumber.value,label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_id_number",defaultMessage:"ID/Passport number"})}),styles:re,error:E.idNumber.error?(0,c.Y)("p",{className:"text-[12px]",children:j({id:E.idNumber.error})}):void 0,onChange:function(e){return ve("idNumber",e.target.value)},onBlur:function(){return xe("idNumber")},disabled:u||Boolean(he.idNumber)})})}),(0,c.Y)(ne,{shrink:!!E.phone.touched||!!E.phone.value,children:(0,c.Y)(ne.Control,{children:(0,c.Y)(C.p.Wrapper,{size:"md",className:"form--phone_field",label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_phone"})}),error:E.phone.error?(0,c.Y)("p",{className:"text-[12px]",children:j({id:E.phone.error})}):void 0,children:(0,c.Y)(f.n,{id:"phone",name:"phone",className:"mantine-Input-input",value:E.phone.value,spellCheck:!1,type:"tel",placeholder:" ",defaultCountry:(null===se||void 0===se?void 0:se[me])||"VN",countryCallingCodeEditable:!1,onChange:function(e){return ve("phone",e)},onBlur:function(){return xe("phone")},disabled:u||Boolean(he.phone)})})})}),(0,c.FD)(x.a,{className:"flex gap-3",children:[(0,c.Y)(ne,{shrink:!!E.gender.touched||!!E.gender.value,className:"flex-1",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(f.S,{id:"gender",label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_gender"})}),name:"gender",searchable:!0,onChange:function(e){return ve("gender",e)},onBlur:function(){return xe("gender")},value:E.gender.value,data:[{value:"male",label:j({id:"vaccination.payment.field_gender_male"})},{value:"female",label:j({id:"vaccination.payment.field_gender_female"})}],rightSection:(0,c.Y)(y.A,{color:p.w.colors.gray600,size:24}),styles:re,disabled:u||Boolean(he.gender),sx:{"&:has(input[disabled])":{".mantine-Select-wrapper":{backgroundColor:ee.bm,borderColor:ee.AF,color:ee.Dp,opacity:1}}}})})}),(0,c.Y)(ne,{shrink:!!E.age.touched||!!E.age.value,className:"flex-1",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{id:"age",label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_age"})}),onChange:function(e){return ve("age",e.target.value)},onBlur:function(){return xe("age")},value:E.age.value,error:E.age.error?(0,c.Y)("p",{className:"text-[12px]",children:j({id:E.age.error})}):void 0,styles:re,placeholder:"",type:"number",disabled:u||Boolean(he.age)})})})]}),(0,c.Y)(ne,{shrink:!!E.email.touched||!!E.email.value,className:"w-full",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{id:"email",type:"text",placeholder:"",label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700",children:j({id:"vaccination.payment.field_email"})}),styles:re,value:E.email.value,error:E.email.error?(0,c.Y)("p",{className:"text-[12px]",children:j({id:E.email.error})}):void 0,onChange:function(e){return ve("email",e.target.value)},onBlur:function(){return xe("email")},disabled:u||Boolean(he.email)})})}),(0,c.FD)(x.a,{className:"flex flex-col gap-2",children:[(0,c.Y)("p",{className:"text-dark font-semibold text-[15px] leading-6 tracking-[-0.3px] pt-4 md:pt-5",children:j({id:"vaccination.payment.your_address",defaultMessage:"Your address"})}),(0,c.Y)(ne,{shrink:!!E.userAddressLine.touched||!!E.userAddressLine.value,className:"w-full",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{spellCheck:!1,type:"text",id:"userAddressLine",placeholder:"",value:E.userAddressLine.value,label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_address_line",defaultMessage:"Address line"})}),styles:re,error:E.userAddressLine.error?(0,c.Y)("p",{className:"text-[12px]",children:E.userAddressLine.error}):void 0,onChange:function(e){ve("userAddressLine",e.target.value),be("shippingAddressLine",e.target.value)},onBlur:function(){return xe("userAddressLine")},disabled:u||Boolean(he.userAddressLine)})})}),(0,c.Y)(ne,{shrink:!!E.userCity.touched||!!E.userCity.value,className:"w-full",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{spellCheck:!1,type:"text",id:"userCity",placeholder:"",value:E.userCity.value,label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_city",defaultMessage:"City"})}),styles:re,error:E.userCity.error?(0,c.Y)("p",{className:"text-[12px]",children:E.userCity.error}):void 0,onChange:function(e){ve("userCity",e.target.value),be("shippingCity",e.target.value)},onBlur:function(){return xe("userCity")},disabled:u||Boolean(he.userCity)})})}),(0,c.FD)(x.a,{className:"flex gap-3",sx:{"& .mantine-Select-wrapper":{backgroundColor:"#f2f2f2"}},children:[(0,c.Y)(ne,{shrink:!!E.userCountry.touched||!!E.userCountry.value,className:"flex-1 pointer-events-none",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(f.S,{id:"userCountry",label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_country",defaultMessage:"Country"})}),name:"userCountry",disabled:!0,value:E.userCountry.value,data:Ae,rightSection:(0,c.Y)(y.A,{color:p.w.colors.gray600,size:24}),styles:re,className:"rounded-lg cursor-not-allowed"})})}),(0,c.Y)(ne,{shrink:!!E.userZipCode.touched||!!E.userZipCode.value,className:"flex-1",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{spellCheck:!1,type:"text",id:"userZipCode",placeholder:"",value:E.userZipCode.value,label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_zip_code",defaultMessage:"ZIP / Postal Code"})}),styles:re,error:E.userZipCode.error?(0,c.Y)("p",{className:"text-[12px]",children:E.userZipCode.error}):void 0,onChange:function(e){ve("userZipCode",e.target.value),be("shippingZipCode",e.target.value)},onBlur:function(){return xe("userZipCode")},disabled:u||Boolean(he.userZipCode)})})})]})]}),de.show_delivery_fee&&(0,c.FD)(x.a,{className:"flex flex-col gap-2",children:[(0,c.Y)("p",{className:"text-dark font-semibold text-[15px] leading-6 tracking-[-0.3px] pt-4 md:pt-5",children:j({id:"vaccination.payment.shipping_address",defaultMessage:"Shipping address"})}),(0,c.Y)(m.S,{id:"shippingAddressSwitch",label:j({id:"vaccination.payment.field_same_as_your_address",defaultMessage:"Same as your address"}),checked:U,onChange:function(e){W(e.target.checked),e.target.checked&&be("all","")},className:"py-[5px]",styles:{track:{width:"30px",minWidth:"30px"},label:{color:p.w.colors.gray700,fontSize:"13px",lineHeight:"20px",letterSpacing:"-0.3px",fontWeight:500}}}),(0,c.Y)(ne,{shrink:!!E.shippingAddressLine.touched||!!E.shippingAddressLine.value,className:N()("w-full",U&&"!hidden"),children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{spellCheck:!1,type:"text",id:"shippingAddressLine",placeholder:"",value:E.shippingAddressLine.value,label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_address_line",defaultMessage:"Address line"})}),styles:re,error:E.shippingAddressLine.error?(0,c.Y)("p",{className:"text-[12px]",children:E.shippingAddressLine.error}):void 0,onChange:function(e){return ve("shippingAddressLine",e.target.value)},onBlur:function(){return xe("shippingAddressLine")}})})}),(0,c.Y)(ne,{shrink:!!E.shippingCity.touched||!!E.shippingCity.value,className:N()("w-full",U&&"!hidden"),children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{spellCheck:!1,type:"text",id:"shippingCity",placeholder:"",value:E.shippingCity.value,label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_city",defaultMessage:"City"})}),styles:re,error:E.shippingCity.error?(0,c.Y)("p",{className:"text-[12px]",children:E.shippingCity.error}):void 0,onChange:function(e){return ve("shippingCity",e.target.value)},onBlur:function(){return xe("shippingCity")}})})}),(0,c.FD)(x.a,{className:N()("flex gap-3",U&&"!hidden"),sx:{"& .mantine-Select-wrapper":{backgroundColor:"#f2f2f2"}},children:[(0,c.Y)(ne,{shrink:!!E.shippingCountry.touched||!!E.shippingCountry.value,className:"flex-1 pointer-events-none",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(f.S,{id:"shippingCountry",label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_country",defaultMessage:"Country"})}),name:"shippingCountry",disabled:!0,value:E.shippingCountry.value,data:[{value:"Vietnam",label:j({id:"vaccination.payment.field_country_vn",defaultMessage:"Vietnam"})},{value:"Malaysia",label:j({id:"vaccination.payment.field_country_my",defaultMessage:"Malaysia"})}],rightSection:(0,c.Y)(y.A,{color:p.w.colors.gray600,size:24}),styles:re,className:"rounded-lg cursor-not-allowed"})})}),(0,c.Y)(ne,{shrink:!!E.shippingZipCode.touched||!!E.shippingZipCode.value,className:"flex-1",children:(0,c.Y)(ne.Control,{children:(0,c.Y)(b.k,{spellCheck:!1,type:"text",id:"shippingZipCode",placeholder:"",value:E.shippingZipCode.value,label:(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium",children:j({id:"vaccination.payment.field_zip_code",defaultMessage:"ZIP / Postal Code"})}),styles:re,error:E.shippingZipCode.error?(0,c.Y)("p",{className:"text-[12px]",children:E.shippingZipCode.error}):void 0,onChange:function(e){return ve("shippingZipCode",e.target.value)},onBlur:function(){return xe("shippingZipCode")}})})})]})]}),de.prescription_required&&(0,c.Y)(J,{ref:G,isDisableUpload:!!he.prescription,prescriptionFiles:z,setPrescriptionFiles:H,formData:E,setFormData:T,onValidate:xe,loadingPayment:u})]})]}),Ce&&(0,c.FD)(x.a,{"data-testid":"payment-method-step-2",className:"bg-white pb-5 lg:pb-6",children:[(0,c.FD)(x.a,{className:"flex gap-3 items-center justify-between px-4 pt-6 pb-4",children:[(0,c.Y)("h2",{className:"flex-1 text-[17px] leading-6 tracking-[-0.4px] text-dark font-semibold",children:j({id:"vaccination.payment.method",defaultMessage:"Payment Method"})}),(0,c.FD)("p",{onClick:function(){return A(!0)},className:"text-[13px] leading-5 tracking-[-0.3px] text-gray700 font-medium cursor-pointe flex items-center",children:[(0,c.Y)("span",{className:"align-middle",children:j({id:"vaccination.payment.change_method",defaultMessage:"Change method"})}),(0,c.Y)(v.A,{size:16,className:"align-middle"})]})]}),(0,c.Y)(x.a,{className:"px-4",children:(0,c.FD)(x.a,{className:"bg-neutral50 rounded-xl p-4 ",children:[(0,c.FD)("div",{className:"flex items-center gap-2",children:[(0,c.Y)("img",{src:(null===_e||void 0===_e?void 0:_e.logo)||Ce.logo,alt:(null===_e||void 0===_e?void 0:_e.title)||Ce.title,className:"w-6 h-6"}),(0,c.Y)("p",{className:"text-[13px] leading-5 tracking-[-0.3px] text-dark font-medium",children:(null===_e||void 0===_e?void 0:_e.title)?"".concat(j({id:"vaccination.payment.online_banking"})," - ").concat(null===_e||void 0===_e?void 0:_e.title):Ce.title})]}),(0,w.Lo)($)&&pe&&(0,c.Y)(x.a,{className:"flex items-center gap-2 pt-3",children:(0,c.Y)(g.T,{size:"title2",fw:700,color:"gray1000",children:(0,S.fQ)(pe)})})]})})]}),fe&&(void 0!==V?V:!B&&(0,c.Y)(oe,{}))]})}))},96404:function(e,n,t){t.d(n,{Y:function(){return a}});var r=t(73884),i=t(42280),a=function(){var e=(0,i.Jf)().computedPrice,n=(0,i.re)(),t=n.selectedOptionalCharge,a=n.toggleOptionalCharge,l=n.setSelectedOptionalCharge,o=n.resetExtraChargeStore,s=e.extra_charges||[],c=(0,r.useMemo)((function(){return s.filter((function(e){return e.is_mandatory}))}),[s]),d=(0,r.useMemo)((function(){return s.filter((function(e){return!e.is_mandatory}))}),[s]),u=(0,r.useMemo)((function(){return s.filter((function(e){return e.selected}))}),[s]),p=(0,r.useCallback)((function(e){return t.includes(e.id)}),[t]),f=(0,r.useCallback)((function(e){a(e.id)}),[a]);return{extraChargeList:s,mandatoryExtraCharges:c,optionalExtraCharges:d,selectedExtraChargeList:u,selectedOptionalCharge:t,isOptionalSelected:p,toggleOptionalCharge:f,setSelectedOptionalCharge:l,resetExtraChargeStore:o}}}}]);