@solvimon/solvimon-web 0.1.0-alpha.20 → 0.1.0-alpha.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-B9WTpz0k.js +1 -0
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-DJCMa2Lz.mjs +223 -0
- package/dist/Amount.vue.es-DExaYBqm.js +1 -0
- package/dist/Amount.vue.es-DPqHB8Xd.mjs +22 -0
- package/dist/Avatar.vue.es-CJw5z7Uu.js +1 -0
- package/dist/Avatar.vue.es-ChcLSNaN.mjs +81 -0
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-CTQ5RMtx.js +1 -0
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-DApMAncl.mjs +60 -0
- package/dist/Button.vue.es-BWl37nzm.js +1 -0
- package/dist/Button.vue.es-VQCd3V3C.mjs +368 -0
- package/dist/Checkout.entry.ce-BTVuGyNq.js +1 -0
- package/dist/Checkout.entry.ce-DRHqEFd7.mjs +3674 -0
- package/dist/Chip.vue.es-CXG8o1Qf.mjs +114 -0
- package/dist/Chip.vue.es-DUgjuRWm.js +1 -0
- package/dist/Comparators.vue.es-CwhX3rbx.mjs +93 -0
- package/dist/Comparators.vue.es-DmkxV0gb.js +1 -0
- package/dist/ContentWithAsideLayout-Bnbsq8_5.mjs +32 -0
- package/dist/ContentWithAsideLayout-C6yMIVJF.js +1 -0
- package/dist/ContextMenu.vue.es-BllxeDTt.js +1 -0
- package/dist/ContextMenu.vue.es-C6TKlSXs.mjs +573 -0
- package/dist/CustomerBillingInformation.vue.es-CKQH_ds0.mjs +153 -0
- package/dist/CustomerBillingInformation.vue.es-CMCZ-lIM.js +1 -0
- package/dist/CustomerPaymentMethods.lib-B_753rau.mjs +4 -0
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-BxwllXwU.mjs +140 -0
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-n097Xf1H.js +1 -0
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-C_yKvYtG.js +1 -0
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-CtaoLbrM.mjs +2700 -0
- package/dist/Divider.vue.es-DnP_HqLz.mjs +22 -0
- package/dist/Divider.vue.es-UwnWvUTl.js +1 -0
- package/dist/DividerText.vue.es-BBdydUy_.js +1 -0
- package/dist/DividerText.vue.es-Bomiy4if.mjs +56 -0
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-C9elbdbF.mjs +335 -0
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-DXO9xpFT.js +1 -0
- package/dist/ErrorNotification.vue.es-0ZC_DozN.js +1 -0
- package/dist/ErrorNotification.vue.es-C6ngWAVU.mjs +31 -0
- package/dist/Expand.vue.es-BleuAfDz.mjs +32 -0
- package/dist/Expand.vue.es-BtM0EZEr.js +1 -0
- package/dist/FormMessage.vue.es-dqATjC2N.js +1 -0
- package/dist/FormMessage.vue.es-jG3fQZms.mjs +29 -0
- package/dist/IconButton.vue.es-DAR7e8NA.mjs +198 -0
- package/dist/IconButton.vue.es-DGLIdHkR.js +1 -0
- package/dist/IconTitle.vue.es-Bbusc4wK.mjs +103 -0
- package/dist/IconTitle.vue.es-D-q6w2E-.js +1 -0
- package/dist/Input.vue.es-AY1c0Rui.mjs +235 -0
- package/dist/Input.vue.es-BN95nPBw.js +1 -0
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-1WjSbPEP.mjs +92 -0
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-qiBCPY8l.js +1 -0
- package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-BXTInmf9.js +1 -0
- package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-D99nuBRE.mjs +41 -0
- package/dist/InvoiceSummary.vue.es-B0MPR0oI.js +1 -0
- package/dist/InvoiceSummary.vue.es-Bs5c2Ovx.mjs +2598 -0
- package/dist/Modal.vue.es-Chi6_MH_.js +1 -0
- package/dist/Modal.vue.es-DSkC4eMv.mjs +387 -0
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-Draz_8Ts.js +1 -0
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-vD88j_U7.mjs +144 -0
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-DVif_ME8.mjs +51 -0
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-Db6jAkqD.js +1 -0
- package/dist/{PaymentHistoryBlock-Ci8aSJeb.js → PaymentHistoryBlock-DGJ_PiVq.js} +1 -1
- package/dist/PaymentHistoryBlock-budeR7ep.mjs +4 -0
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-C28ofG7N.mjs +93 -0
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Dv-3suBX.js +1 -0
- package/dist/PaymentIntegrationForm-Crrhar96.mjs +4 -0
- package/dist/{PaymentIntegrationForm-CsuueDE0.js → PaymentIntegrationForm-DqqGcEP1.js} +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-C4bk0m8g.mjs +138 -0
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CcEEdHQJ.js +1 -0
- package/dist/PaymentIntegrationFormAdyen-DM-xMcm0.mjs +621 -0
- package/dist/PaymentIntegrationFormAdyen-DronjwO3.js +98 -0
- package/dist/PaymentIntegrationFormStripe-yBm4KnpV.mjs +488 -0
- package/dist/PaymentIntegrationFormStripe-ybM6wirp.js +102 -0
- package/dist/PaymentMethod.vue.es-BdMcKq8_.mjs +623 -0
- package/dist/PaymentMethod.vue.es-Ctw9Es1g.js +1 -0
- package/dist/{PaymentMethodForm-hZuVHAti.js → PaymentMethodForm-BQ5TVHlS.js} +1 -1
- package/dist/PaymentMethodForm-C1bIGX10.mjs +4 -0
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-5KKkuVt5.mjs +167 -0
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-V88bCeDt.js +1 -0
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-B_207kq5.js +1 -0
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-CnmZ9dvP.mjs +169 -0
- package/dist/PlanCustomizationEditor-CCOTD6Qu.mjs +769 -0
- package/dist/PlanCustomizationEditor-CiZnVCM6.js +1 -0
- package/dist/PricingGroupRangeInput.vue.es-Bnb-ARie.mjs +627 -0
- package/dist/PricingGroupRangeInput.vue.es-D82XvoC_.js +185 -0
- package/dist/PricingGroupSingleEditor.vue_vue_type_script_setup_true_lang-CxMkCmti.js +1 -0
- package/dist/PricingGroupSingleEditor.vue_vue_type_script_setup_true_lang-skQMgHEL.mjs +131 -0
- package/dist/RadioGroupExtended.vue.es-B1YtLNKG.js +1 -0
- package/dist/RadioGroupExtended.vue.es-WDbo_yj1.mjs +163 -0
- package/dist/Section.vue.es-By1JltGi.mjs +72 -0
- package/dist/Section.vue.es-DuK52y67.js +1 -0
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-CS3KIkPL.mjs +687 -0
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Ct3ZNq-j.js +1 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-DRLoYWGY.mjs +51 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-DypW8aNJ.js +1 -0
- package/dist/SubscriptionSchedules-DDCjVEbG.mjs +4 -0
- package/dist/SubscriptionSchedules-DEjIERyF.js +1 -0
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BlX0W6lw.js +1 -0
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-JAedXFzq.mjs +5256 -0
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-D-Fa54M6.js +1 -0
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-DVMS4gJQ.mjs +91 -0
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-BckZJtOc.mjs +284 -0
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DiXmEjUD.js +1 -0
- package/dist/TooltipParagraph.vue.es-DYu2ReL7.mjs +129 -0
- package/dist/TooltipParagraph.vue.es-sTgWAgcd.js +1 -0
- package/dist/TrialChip.vue.es-Cl-9_pdr.js +1 -0
- package/dist/TrialChip.vue.es-DX53r0ku.mjs +35 -0
- package/dist/accel.svg.es-C0hqmmEY.mjs +4 -0
- package/dist/accel.svg.es-DFJXdioD.js +1 -0
- package/dist/ach.svg.es-BYP873jU.js +1 -0
- package/dist/ach.svg.es-DduMiYM2.mjs +4 -0
- package/dist/adyen-BJfC7N6f.js +1 -0
- package/dist/adyen-Bugab0JE.mjs +4 -0
- package/dist/adyen-CvsH5fok.mjs +117 -0
- package/dist/adyen-Druit6gz.js +1 -0
- package/dist/adyenSdk-B01MB9Ia.mjs +58 -0
- package/dist/adyenSdk-BP2XXzeJ.js +1 -0
- package/dist/amazon-pay.svg.es-BACIX6C7.mjs +4 -0
- package/dist/amazon-pay.svg.es-CQWgtowB.js +1 -0
- package/dist/amex.svg.es-DKhW4Txt.js +1 -0
- package/dist/amex.svg.es-DjTEMRVg.mjs +4 -0
- package/dist/api.es-QaC926Xu.mjs +43 -0
- package/dist/api.es-duCDtZD9.js +1 -0
- package/dist/apple-pay.svg.es-B3tkA54p.mjs +4 -0
- package/dist/apple-pay.svg.es-Dyojd0F-.js +1 -0
- package/dist/bacs.svg.es-CZIjZIE8.mjs +4 -0
- package/dist/bacs.svg.es-GJpZs1sD.js +1 -0
- package/dist/bancontact.svg.es-B26-JwdE.mjs +4 -0
- package/dist/bancontact.svg.es-BQh7nAup.js +1 -0
- package/dist/carnet.svg.es-BtO3AmNu.mjs +4 -0
- package/dist/carnet.svg.es-DY04-F2L.js +1 -0
- package/dist/cartes-bancaires.svg.es-BleHMlkN.js +1 -0
- package/dist/cartes-bancaires.svg.es-DEPpdLvi.mjs +4 -0
- package/dist/cashapp.svg.es-DOGwRjXp.mjs +4 -0
- package/dist/cashapp.svg.es-MwXGYom6.js +1 -0
- package/dist/cn.es-CNvIP217.js +1 -0
- package/dist/{cn.es-BEU5D0Wz.mjs → cn.es-DjnGlmqV.mjs} +657 -927
- package/dist/comparators.es-D8WGL-c4.mjs +153 -0
- package/dist/comparators.es-OGt19O9U.js +1 -0
- package/dist/component-5wqcK7yz.mjs +8 -0
- package/dist/component-B7ZDyqBp.js +1 -0
- package/dist/components/BillingInformation/BillingInformation.cjs +1 -1
- package/dist/components/BillingInformation/BillingInformation.mjs +39 -48
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs +1 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.mjs +256 -307
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs +1 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.mjs +43 -52
- package/dist/components/Invoice/Invoice.cjs +1 -1
- package/dist/components/Invoice/Invoice.mjs +372 -430
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.mjs +55 -65
- package/dist/components/InvoiceHeader/InvoiceHeader.cjs +1 -1
- package/dist/components/InvoiceHeader/InvoiceHeader.mjs +41 -46
- package/dist/components/InvoicesList/InvoicesList.cjs +1 -1
- package/dist/components/InvoicesList/InvoicesList.mjs +43 -53
- package/dist/components/PaymentHistory/PaymentHistory.cjs +1 -1
- package/dist/components/PaymentHistory/PaymentHistory.mjs +58 -68
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs +1 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.mjs +51 -63
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs +1 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.mjs +41 -50
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs +1 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.mjs +49 -60
- package/dist/components/WalletBalances/WalletBalances.cjs +1 -1
- package/dist/components/WalletBalances/WalletBalances.mjs +59 -70
- package/dist/configuration-BytDBAWs.mjs +14 -0
- package/dist/configuration-akTS7Wiw.js +1 -0
- package/dist/core/index.cjs +1 -1
- package/dist/core/index.mjs +89 -104
- package/dist/{countryData.es--zJAd6LA.mjs → countryData.es-BegoD-cZ.mjs} +2 -2
- package/dist/countryData.es-C4jHBzfo.js +1 -0
- package/dist/customElements-Bt8PbjIn.js +1187 -0
- package/dist/customElements-Com2NiGU.mjs +6531 -0
- package/dist/customer-CKgMJEgv.mjs +31 -0
- package/dist/customer-Q4JGfVfq.js +1 -0
- package/dist/customer.es-B5ppZf0j.mjs +20 -0
- package/dist/customer.es-BButyYo0.js +1 -0
- package/dist/dana.svg.es-BDtZLpwd.js +1 -0
- package/dist/dana.svg.es-Cy8Q6DZi.mjs +4 -0
- package/dist/dankort.svg.es-B7VqJdWq.mjs +4 -0
- package/dist/dankort.svg.es-CksaipXF.js +1 -0
- package/dist/{de-DE-CI2zQkiP.mjs → de-DE-CVCmzlNH.mjs} +5 -5
- package/dist/{de-DE-BeyQVhTv.mjs → de-DE-DBO5f-Eu.mjs} +38 -56
- package/dist/{de-DE-_40QfLNJ.js → de-DE-DqLD4IX2.js} +1 -1
- package/dist/de-DE-Ds_yJLS3.js +1 -0
- package/dist/diners.svg.es-BP9enCow.mjs +4 -0
- package/dist/diners.svg.es-D6Mu1pqP.js +1 -0
- package/dist/discover.svg.es-DEsEJBYh.mjs +4 -0
- package/dist/discover.svg.es-DgqWCMUM.js +1 -0
- package/dist/eftpos.svg.es--js6-yfk.mjs +4 -0
- package/dist/eftpos.svg.es-Dk2DOT8W.js +1 -0
- package/dist/elo.svg.es-C-BzjuRP.js +1 -0
- package/dist/elo.svg.es-CMZPAxcn.mjs +4 -0
- package/dist/{en-US-5YWNEi-V.mjs → en-US-3UmnS23B.mjs} +38 -56
- package/dist/en-US-C51ILrVv.js +1 -0
- package/dist/{en-US--NRsi7Hz.js → en-US-CvFmmI_O.js} +1 -1
- package/dist/{en-US-DksUWPIu.mjs → en-US-DVR9O7b_.mjs} +5 -5
- package/dist/eps.svg.es-B_85bP-W.js +1 -0
- package/dist/eps.svg.es-CzIPBSb9.mjs +4 -0
- package/dist/error-BHVZJGwD.mjs +13 -0
- package/dist/error-CmduqgVq.js +1 -0
- package/dist/floating-ui.vue.es-Bly3DGWm.js +1 -0
- package/dist/floating-ui.vue.es-CYt0fSY7.mjs +1108 -0
- package/dist/formatting.es-C72Nsrmh.js +1 -0
- package/dist/formatting.es-RclXHhKo.mjs +61 -0
- package/dist/gcash.svg.es-BKAdhWzv.js +1 -0
- package/dist/gcash.svg.es-BpDtvraq.mjs +4 -0
- package/dist/getComposedString.es-C__uhJpd.mjs +10 -0
- package/dist/getComposedString.es-haS4bAj7.js +1 -0
- package/dist/getCountryNameByCode.es-BDHua7VM.mjs +8 -0
- package/dist/getCountryNameByCode.es-Xxc0nZsH.js +1 -0
- package/dist/girocard.svg.es-HSOEvDif.js +1 -0
- package/dist/girocard.svg.es-Riswtk8Z.mjs +4 -0
- package/dist/go-pay.svg.es-CiIyLELZ.mjs +4 -0
- package/dist/go-pay.svg.es-DQjtunZ_.js +1 -0
- package/dist/google-pay.svg.es-Dgj_N6nz.mjs +4 -0
- package/dist/google-pay.svg.es-hzc_EgiJ.js +1 -0
- package/dist/hipercard.svg.es-B80bu8Vd.mjs +4 -0
- package/dist/hipercard.svg.es-CbCsRY2q.js +1 -0
- package/dist/icon-sprite.svg.es-Bt21fMEt.mjs +4 -0
- package/dist/icon-sprite.svg.es-Dauis9LS.js +1 -0
- package/dist/ideal.svg.es-Booz1IML.js +1 -0
- package/dist/ideal.svg.es-DaqTS2Ax.mjs +4 -0
- package/dist/index-BPU8tIml.mjs +828 -0
- package/dist/index-BPZPnOQQ.js +7 -0
- package/dist/index-CTwLxoOS.mjs +7250 -0
- package/dist/index-DwueOtPi.js +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.es-BclokHQX.js +1 -0
- package/dist/index.es-CXkP_k3u.mjs +345 -0
- package/dist/index.mjs +40 -40
- package/dist/invoices-CV9iAUHf.mjs +115 -0
- package/dist/invoices-CvpL4rv5.js +1 -0
- package/dist/{it-IT-CMy1tHKZ.mjs → it-IT-CDMnnFKZ.mjs} +5 -5
- package/dist/{it-IT-aPQY57ht.js → it-IT-CFEfSpPH.js} +1 -1
- package/dist/{it-IT-B6blp8MI.mjs → it-IT-CxBRisRm.mjs} +38 -56
- package/dist/it-IT-Dxw59eR_.js +1 -0
- package/dist/jcb.svg.es-B3WPB8c2.js +1 -0
- package/dist/jcb.svg.es-Couw-2p9.mjs +4 -0
- package/dist/kakao-pay.svg.es-CIFT8fob.mjs +4 -0
- package/dist/kakao-pay.svg.es-Cs-lCW74.js +1 -0
- package/dist/klarna.svg.es-Cs6XaHD7.js +1 -0
- package/dist/klarna.svg.es-WKt8_NZa.mjs +4 -0
- package/dist/maestro.svg.es-BvK4oPg4.js +1 -0
- package/dist/maestro.svg.es-DbdxwYUE.mjs +4 -0
- package/dist/mastercard.svg.es-B7T3PS12.mjs +4 -0
- package/dist/mastercard.svg.es-lp4AXyyV.js +1 -0
- package/dist/momo.svg.es-C5aLYf_R.js +1 -0
- package/dist/momo.svg.es-X5XB25fM.mjs +4 -0
- package/dist/{nl-NL-CjoW8r_M.mjs → nl-NL-BWGkVweu.mjs} +38 -56
- package/dist/nl-NL-Btbfd9p2.js +1 -0
- package/dist/{nl-NL-zRUAuEHg.js → nl-NL-jtVgF3jx.js} +1 -1
- package/dist/{nl-NL-CckNM7R9.mjs → nl-NL-o3UvtSNg.mjs} +5 -5
- package/dist/nyce.svg.es-ArAivAZW.js +1 -0
- package/dist/nyce.svg.es-DcPsO_sh.mjs +4 -0
- package/dist/object.es-8aLDIncs.mjs +12 -0
- package/dist/object.es-CdriXMPs.js +1 -0
- package/dist/open-banking.svg.es-C4mPhwsn.mjs +4 -0
- package/dist/open-banking.svg.es-Q3rRkCvP.js +1 -0
- package/dist/paymentMethods-BuwoJ1y9.mjs +75 -0
- package/dist/paymentMethods-ChWAwDSF.js +1 -0
- package/dist/payments-C_cMXQzE.mjs +45 -0
- package/dist/payments-DGckugN0.js +1 -0
- package/dist/paypal.svg.es-BC2AP20j.mjs +4 -0
- package/dist/paypal.svg.es-Cjp5sNI3.js +1 -0
- package/dist/pricing-BVAld27Y.js +1 -0
- package/dist/pricing-DLOeiAIB.mjs +16 -0
- package/dist/pricingItemConfigs.es-DMf1e6y7.mjs +76 -0
- package/dist/pricingItemConfigs.es-DlybwIh1.js +1 -0
- package/dist/pricingPlanSchedule-COfmWv_o.js +1 -0
- package/dist/pricingPlanSchedule-J1nb9pCu.mjs +129 -0
- package/dist/pulse.svg.es-Dit33E8S.js +1 -0
- package/dist/pulse.svg.es-Rmoz-9Ej.mjs +4 -0
- package/dist/screens/Checkout/Checkout.cjs +1 -1
- package/dist/screens/Checkout/Checkout.mjs +3 -5237
- package/dist/screens/CustomerOverview/CustomerOverview.cjs +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.mjs +112 -138
- package/dist/screens/PayInvoice/PayInvoice.cjs +1 -1
- package/dist/screens/PayInvoice/PayInvoice.mjs +348 -397
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs +1 -1
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.mjs +153 -170
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs +1 -1
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.mjs +609 -720
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs +1 -1
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.mjs +466 -555
- package/dist/sepa.svg.es-0t4DKeA1.js +1 -0
- package/dist/sepa.svg.es-DIO_K345.mjs +4 -0
- package/dist/slots.es-BA4MyEAa.mjs +5 -0
- package/dist/slots.es-T9ZJRGtG.js +1 -0
- package/dist/sorting.es-DCihKqD2.mjs +77 -0
- package/dist/sorting.es-DQsjKr8A.js +1 -0
- package/dist/star.svg.es-BUZNUnYq.mjs +4 -0
- package/dist/star.svg.es-D2JncY7b.js +1 -0
- package/dist/subscription-9GORG-Gt.js +1 -0
- package/dist/subscription-CvfAEJeP.mjs +69 -0
- package/dist/subscriptions-B5VqRayX.mjs +55 -0
- package/dist/subscriptions-X0Ciw8z3.js +1 -0
- package/dist/trustly.svg.es-AM7Ha-3Y.mjs +4 -0
- package/dist/trustly.svg.es-GJByiFAs.js +1 -0
- package/dist/twint.svg.es-BJ2f48og.js +1 -0
- package/dist/twint.svg.es-DZogAQG6.mjs +4 -0
- package/dist/typeGuards.es-B4XMtlkM.mjs +8 -0
- package/dist/typeGuards.es-DS3vZaJn.js +1 -0
- package/dist/types/components/payments/PaymentCompletedCard/PaymentCompletedCard.types.d.ts +6 -0
- package/dist/types/components/payments/PaymentIntegrationForm/PaymentIntegrationForm.types.d.ts +7 -0
- package/dist/types/components/payments/PaymentIntegrationFormStripe/PaymentIntegrationFormStripeFrame.types.d.ts +2 -1
- package/dist/types/public/components/PaymentMethodForm/PaymentMethodForm.types.d.ts +7 -0
- package/dist/unionpay.svg.es-DjFZ5EMQ.js +1 -0
- package/dist/unionpay.svg.es-me7q-nTI.mjs +4 -0
- package/dist/url-BNKStNY9.js +1 -0
- package/dist/url-DwiuKYpu.mjs +20 -0
- package/dist/useActionDispatchProvider-B54GYEY7.js +1 -0
- package/dist/useActionDispatchProvider-e2lQXTid.mjs +11 -0
- package/dist/useCustomer-BJwJ9BkJ.js +1 -0
- package/dist/useCustomer-CC9zxV6c.mjs +20 -0
- package/dist/useCustomerFormLabels-72Pxw8X5.js +1 -0
- package/dist/useCustomerFormLabels-V2YuYMLU.mjs +930 -0
- package/dist/useExperimentalFeature-8Mzpj5wc.js +1 -0
- package/dist/useExperimentalFeature-B0IFn3Uw.mjs +6 -0
- package/dist/useIncrementalLoading-CaWOE8Xl.js +1 -0
- package/dist/useIncrementalLoading-Cgxw2GD7.mjs +48 -0
- package/dist/useInvoiceData-6mHUZC9a.mjs +38 -0
- package/dist/useInvoiceData-Bblwdl0f.js +1 -0
- package/dist/useInvoicesList-B5H5JfvY.mjs +500 -0
- package/dist/useInvoicesList-_U1-tn9_.js +1 -0
- package/dist/useLoadInitialData-CezlvhBV.js +1 -0
- package/dist/useLoadInitialData-ux_wpNiR.mjs +15 -0
- package/dist/usePaymentMethodAvailability-CkR4TwoV.mjs +118 -0
- package/dist/usePaymentMethodAvailability-DRwrBdto.js +1 -0
- package/dist/usePaymentMethodOptions-B6GIM9q4.js +1 -0
- package/dist/usePaymentMethodOptions-BfnLBZOo.mjs +37 -0
- package/dist/usePaymentMethods-C3QfLSrP.mjs +15 -0
- package/dist/usePaymentMethods-GFmQRp0X.js +1 -0
- package/dist/usePayments-BkwGyZT0.mjs +318 -0
- package/dist/usePayments-SQF_V7oL.js +1 -0
- package/dist/usePortal-BdM7hDge.js +1 -0
- package/dist/usePortal-DDG9b6FI.mjs +11 -0
- package/dist/useService-Bh47bllz.mjs +50 -0
- package/dist/useService-H7BjLg8P.js +1 -0
- package/dist/useSubscription-BJJYHYgr.mjs +210 -0
- package/dist/useSubscription-Q4C2DPhw.js +1 -0
- package/dist/useTimePeriod.es-9tZvAhyb.mjs +93 -0
- package/dist/useTimePeriod.es-pepm2TpV.js +1 -0
- package/dist/useViewport-BgdA2PPt.mjs +29 -0
- package/dist/useViewport-hPRVDWCm.js +1 -0
- package/dist/useWatchDebounced-CAU1WI1P.js +1 -0
- package/dist/useWatchDebounced-DT5IicPp.mjs +14 -0
- package/dist/visa.svg.es-B0T5Su99.mjs +4 -0
- package/dist/visa.svg.es-NY3BHhda.js +1 -0
- package/dist/vpay.svg.es-VViQi42w.js +1 -0
- package/dist/vpay.svg.es-Zt3rrmCy.mjs +4 -0
- package/dist/zip.svg.es-C9S_F31W.js +1 -0
- package/dist/zip.svg.es-QC6dxzC7.mjs +4 -0
- package/package.json +3 -3
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Ce30EXY5.mjs +0 -240
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-kmam2c7P.js +0 -1
- package/dist/Amount.vue.es-BO5sS1UX.mjs +0 -25
- package/dist/Amount.vue.es-JDVa_3H-.js +0 -1
- package/dist/Avatar.vue.es-BGTZSAqU.js +0 -1
- package/dist/Avatar.vue.es-DJzJiYtv.mjs +0 -91
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-Bq2mTdUs.mjs +0 -66
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-BtNTRSqH.js +0 -1
- package/dist/Button.vue.es-Cm9pLU9i.mjs +0 -421
- package/dist/Button.vue.es-O8mNivLL.js +0 -1
- package/dist/Chip.vue.es-BBmn-qJp.mjs +0 -120
- package/dist/Chip.vue.es-DmCjC1hi.js +0 -1
- package/dist/Comparators.vue.es-CYfxd5H-.mjs +0 -120
- package/dist/Comparators.vue.es-DK8wGjxM.js +0 -1
- package/dist/ContentWithAsideLayout-DHpnJfGA.js +0 -1
- package/dist/ContentWithAsideLayout-Dy9xgxuF.mjs +0 -39
- package/dist/ContextMenu.vue.es-CTc1ktXb.mjs +0 -681
- package/dist/ContextMenu.vue.es-DaW0yp4Y.js +0 -1
- package/dist/CustomerBillingInformation.vue.es-BX0Da7Kr.js +0 -1
- package/dist/CustomerBillingInformation.vue.es-CMZO8oLj.mjs +0 -175
- package/dist/CustomerPaymentMethods.lib-CcSt0sl1.mjs +0 -4
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Bi_dCntQ.js +0 -1
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CtdFharm.mjs +0 -150
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-BDqBXbJq.mjs +0 -3264
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-ZyN2vlNu.js +0 -1
- package/dist/Divider.vue.es-ClFG8QtG.js +0 -1
- package/dist/Divider.vue.es-wKkIVBgb.mjs +0 -24
- package/dist/DividerText.vue.es-CeAHAe_Y.mjs +0 -72
- package/dist/DividerText.vue.es-DjT4i_YD.js +0 -1
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-DLE5-9wz.mjs +0 -562
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-DkIK-lID.js +0 -1
- package/dist/ErrorNotification.vue.es-CHyVTBGs.mjs +0 -38
- package/dist/ErrorNotification.vue.es-CaEFTi2k.js +0 -1
- package/dist/Expand.vue.es-C-lnbA1v.js +0 -1
- package/dist/Expand.vue.es-C4_XmqbR.mjs +0 -50
- package/dist/FormMessage.vue.es-Bd4_NG9H.js +0 -1
- package/dist/FormMessage.vue.es-C3oxwq_8.mjs +0 -46
- package/dist/IconButton.vue.es-BHdQskx0.js +0 -1
- package/dist/IconButton.vue.es-KywqWWvr.mjs +0 -228
- package/dist/IconTitle.vue.es-BmjBdZb_.mjs +0 -107
- package/dist/IconTitle.vue.es-D9Wc3PIq.js +0 -1
- package/dist/Input.vue.es-DqKJhFTr.js +0 -1
- package/dist/Input.vue.es-WZGF8dfr.mjs +0 -251
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-B6efz7NU.mjs +0 -97
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-LE6zBLKM.js +0 -1
- package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-C2aLMfu6.mjs +0 -49
- package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-CtpFzWU3.js +0 -1
- package/dist/InvoiceSummary.vue.es-BI5sD_8F.mjs +0 -2944
- package/dist/InvoiceSummary.vue.es-BWYIHezU.js +0 -1
- package/dist/Modal.vue.es-B_1aqm_m.js +0 -1
- package/dist/Modal.vue.es-qdUHDOnU.mjs +0 -483
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-BKKXQbge.js +0 -1
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-Ch1TFO7x.mjs +0 -154
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CsH47WSM.mjs +0 -54
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-mKNNYnMU.js +0 -1
- package/dist/PaymentHistoryBlock-CgNUV8Gy.mjs +0 -4
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DZwnDzha.js +0 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Uj1aK-dp.mjs +0 -101
- package/dist/PaymentIntegrationForm-CLokpXvK.mjs +0 -4
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CRUs7sP4.mjs +0 -167
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-kKkzRi6w.js +0 -1
- package/dist/PaymentIntegrationFormAdyen-C885o8IE.mjs +0 -699
- package/dist/PaymentIntegrationFormAdyen-Co19AgvG.js +0 -1
- package/dist/PaymentIntegrationFormStripe-BjMdJmDC.mjs +0 -547
- package/dist/PaymentIntegrationFormStripe-DWff6wzK.js +0 -1
- package/dist/PaymentMethod.vue.es-CdskNJ3Z.js +0 -1
- package/dist/PaymentMethod.vue.es-rv-pu1CC.mjs +0 -677
- package/dist/PaymentMethodForm-IEuDxEPN.mjs +0 -4
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-Cj60U90J.js +0 -1
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-gA74Rak9.mjs +0 -172
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-B3H_AWMM.js +0 -1
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-CTn-OxM6.mjs +0 -189
- package/dist/PricingGroupRangeInput.vue.es-ButaePib.mjs +0 -632
- package/dist/PricingGroupRangeInput.vue.es-Cls2lm80.js +0 -1
- package/dist/Section.vue.es-CAJvEDn6.js +0 -1
- package/dist/Section.vue.es-DX_9ueCG.mjs +0 -79
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-CQAkPfJz.js +0 -1
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DVtMzgjc.mjs +0 -1044
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs +0 -78
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js +0 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BJVXCHny.js +0 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-ByO-L6nm.mjs +0 -6171
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-C5zB3CgZ.mjs +0 -101
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-CabskT-r.js +0 -1
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-D-T1wGg7.js +0 -1
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DKd2DIVb.mjs +0 -309
- package/dist/TooltipParagraph.vue.es-C5RTcrid.mjs +0 -136
- package/dist/TooltipParagraph.vue.es-H9fI7zzt.js +0 -1
- package/dist/TrialChip.vue.es-B1puKyR-.mjs +0 -56
- package/dist/TrialChip.vue.es-CCs50m02.js +0 -1
- package/dist/accel.svg.es-CE5tIWtm.mjs +0 -4
- package/dist/accel.svg.es-Dt_1wJmV.js +0 -1
- package/dist/ach.svg.es-B4tn0_IV.js +0 -1
- package/dist/ach.svg.es-D4QPcIU-.mjs +0 -4
- package/dist/adyen-51SvcyqV.mjs +0 -4
- package/dist/adyen-BXi_D9TQ.mjs +0 -123
- package/dist/adyen-DZsyEXkw.js +0 -1
- package/dist/adyen-VS2sDW0m.js +0 -1
- package/dist/amazon-pay.svg.es-B428S4f3.js +0 -1
- package/dist/amazon-pay.svg.es-DUScOW15.mjs +0 -4
- package/dist/amex.svg.es-BCXkaVLN.mjs +0 -4
- package/dist/amex.svg.es-Bn9e31C3.js +0 -1
- package/dist/api.es-C5pe8LUl.mjs +0 -62
- package/dist/api.es-Czekkp_X.js +0 -1
- package/dist/apple-pay.svg.es-Cfgn0K28.js +0 -1
- package/dist/apple-pay.svg.es-DlCfkt39.mjs +0 -4
- package/dist/bacs.svg.es-BKsvSeIP.mjs +0 -4
- package/dist/bacs.svg.es-hL7hLPkQ.js +0 -1
- package/dist/bancontact.svg.es-BbRqGgZ9.mjs +0 -4
- package/dist/bancontact.svg.es-DU2ejvNL.js +0 -1
- package/dist/carnet.svg.es-C5SFaOsa.js +0 -1
- package/dist/carnet.svg.es-Db-KEb13.mjs +0 -4
- package/dist/cartes-bancaires.svg.es-ByD-JAAi.mjs +0 -4
- package/dist/cartes-bancaires.svg.es-CbBJQZrk.js +0 -1
- package/dist/cashapp.svg.es-CnS5r_D8.mjs +0 -4
- package/dist/cashapp.svg.es-DE4vMu_p.js +0 -1
- package/dist/cn.es-DxSeYcoP.js +0 -1
- package/dist/comparators.es-9VsCB-JI.mjs +0 -175
- package/dist/comparators.es-wrKHduVq.js +0 -1
- package/dist/component-BG6DmXcy.mjs +0 -9
- package/dist/component-hDuDTBt5.js +0 -1
- package/dist/configuration-BjYwV4_B.js +0 -1
- package/dist/configuration-CD8cOXAJ.mjs +0 -15
- package/dist/countryData.es-D3MFzU92.js +0 -1
- package/dist/customElements-B-89a5oH.mjs +0 -6810
- package/dist/customElements-DD7bpqkx.js +0 -1
- package/dist/customer-DozNwS_a.js +0 -1
- package/dist/customer-Dzj1g9lV.mjs +0 -32
- package/dist/customer.es-C_vSWcVA.mjs +0 -30
- package/dist/customer.es-D42Md24r.js +0 -1
- package/dist/dana.svg.es-Bbn6_ktN.mjs +0 -4
- package/dist/dana.svg.es-DKZaseoJ.js +0 -1
- package/dist/dankort.svg.es-D8FgSiFf.js +0 -1
- package/dist/dankort.svg.es-DtAdliQq.mjs +0 -4
- package/dist/de-DE-BvHD68Ay.js +0 -1
- package/dist/diners.svg.es-DhchsD1D.mjs +0 -4
- package/dist/diners.svg.es-SydF_H-Z.js +0 -1
- package/dist/discover.svg.es-B8vgzVNG.js +0 -1
- package/dist/discover.svg.es-BnqYPvnV.mjs +0 -4
- package/dist/eftpos.svg.es-DO0YPaY1.js +0 -1
- package/dist/eftpos.svg.es-DRLaafYa.mjs +0 -4
- package/dist/elo.svg.es-CTOm1rvj.js +0 -1
- package/dist/elo.svg.es-CgkEOP_O.mjs +0 -4
- package/dist/en-US-dqfKx3GS.js +0 -1
- package/dist/eps.svg.es-CApyGjyU.js +0 -1
- package/dist/eps.svg.es-D6IHsRYP.mjs +0 -4
- package/dist/error-Cg-i7gGl.js +0 -1
- package/dist/error-DY_I2hPx.mjs +0 -13
- package/dist/floating-ui.vue.es-Bv94BfDm.js +0 -1
- package/dist/floating-ui.vue.es-DWY7pdz8.mjs +0 -1573
- package/dist/formatting.es-DBtYnvI5.js +0 -1
- package/dist/formatting.es-eYgXv_AK.mjs +0 -70
- package/dist/gcash.svg.es-BhJ-eA2z.mjs +0 -4
- package/dist/gcash.svg.es-JaL4fpZr.js +0 -1
- package/dist/getComposedString.es-CELkn0I7.mjs +0 -14
- package/dist/getComposedString.es-DvSNX-_z.js +0 -1
- package/dist/getCountryNameByCode.es-fP52nO_7.js +0 -1
- package/dist/getCountryNameByCode.es-ymC9R46j.mjs +0 -8
- package/dist/girocard.svg.es-D_3LML4l.mjs +0 -4
- package/dist/girocard.svg.es-tVgtT23w.js +0 -1
- package/dist/go-pay.svg.es-6UtgwVBA.mjs +0 -4
- package/dist/go-pay.svg.es-fYX6yMzJ.js +0 -1
- package/dist/google-pay.svg.es-BYXX1em8.js +0 -1
- package/dist/google-pay.svg.es-CRxXgFVl.mjs +0 -4
- package/dist/hipercard.svg.es-Ct1-mF9F.mjs +0 -4
- package/dist/hipercard.svg.es-D-nmiFXB.js +0 -1
- package/dist/icon-sprite.svg.es-BpwT0GQ5.js +0 -1
- package/dist/icon-sprite.svg.es-YYqtl2IP.mjs +0 -4
- package/dist/ideal.svg.es-D23EhJJ2.mjs +0 -4
- package/dist/ideal.svg.es-DXtHE0Jb.js +0 -1
- package/dist/index-Cai7laNY.mjs +0 -1069
- package/dist/index-DIFK3mcJ.js +0 -6
- package/dist/index-DyvRdSR7.mjs +0 -9673
- package/dist/index-IZaUTAsE.js +0 -1
- package/dist/index.es-2JWHHSgP.js +0 -1
- package/dist/index.es-D5xOw_SJ.mjs +0 -542
- package/dist/invoices-1oYkdQQV.mjs +0 -121
- package/dist/invoices-BAoh6X2a.js +0 -1
- package/dist/it-IT-CEP3oeWs.js +0 -1
- package/dist/jcb.svg.es-Bz6J-c0s.js +0 -1
- package/dist/jcb.svg.es-CcH08OoO.mjs +0 -4
- package/dist/kakao-pay.svg.es-DcgRDAsc.mjs +0 -4
- package/dist/kakao-pay.svg.es-qVTABboW.js +0 -1
- package/dist/klarna.svg.es-Clu-7zkp.js +0 -1
- package/dist/klarna.svg.es-DfIPX0gr.mjs +0 -4
- package/dist/maestro.svg.es-CVmNVokN.mjs +0 -4
- package/dist/maestro.svg.es-e8E_H2QU.js +0 -1
- package/dist/mastercard.svg.es-B8z0ZySS.mjs +0 -4
- package/dist/mastercard.svg.es-YO3_jGD6.js +0 -1
- package/dist/momo.svg.es-BXTQlQRy.js +0 -1
- package/dist/momo.svg.es-Bm5zCTOT.mjs +0 -4
- package/dist/nl-NL-e_vf6OuT.js +0 -1
- package/dist/nyce.svg.es-CgurqLKH.mjs +0 -4
- package/dist/nyce.svg.es-DM6esO47.js +0 -1
- package/dist/object.es-DFXiU9p3.js +0 -1
- package/dist/object.es-jvvnR8Kr.mjs +0 -12
- package/dist/open-banking.svg.es-DUM360xB.js +0 -1
- package/dist/open-banking.svg.es-DzzLCVp_.mjs +0 -4
- package/dist/paymentMethods-CZ3ydybI.js +0 -1
- package/dist/paymentMethods-DIV78w0O.mjs +0 -78
- package/dist/payments--lkjiwCt.js +0 -1
- package/dist/payments-Cvqdrprv.mjs +0 -47
- package/dist/paypal.svg.es-BdkNTf3c.js +0 -1
- package/dist/paypal.svg.es-DltWzW4V.mjs +0 -4
- package/dist/pricing-3W7XLwL6.js +0 -1
- package/dist/pricing-CJxS2hr2.mjs +0 -17
- package/dist/pricingItemConfigs.es-BPIm6S8M.mjs +0 -107
- package/dist/pricingItemConfigs.es-C73cQlxQ.js +0 -1
- package/dist/pricingPlanSchedule-B9HFiXy-.js +0 -1
- package/dist/pricingPlanSchedule-CXG3CQ61.mjs +0 -146
- package/dist/pulse.svg.es-BdpWAuIN.js +0 -1
- package/dist/pulse.svg.es-BecAwT-p.mjs +0 -4
- package/dist/sepa.svg.es-BF8PYKZg.js +0 -1
- package/dist/sepa.svg.es-cbE9g8gV.mjs +0 -4
- package/dist/slots.es-BpwYO3A3.mjs +0 -18
- package/dist/slots.es-Dq1PTUOv.js +0 -1
- package/dist/sorting.es-CjTrRfSW.mjs +0 -105
- package/dist/sorting.es-RyvcgbSL.js +0 -1
- package/dist/star.svg.es-DsCD-tSp.mjs +0 -4
- package/dist/star.svg.es-Q50IzqXr.js +0 -1
- package/dist/subscription-C41lG-rH.mjs +0 -89
- package/dist/subscription-b0OPx8Du.js +0 -1
- package/dist/subscriptions-300o4ae0.js +0 -1
- package/dist/subscriptions-DcMHBPVJ.mjs +0 -58
- package/dist/trustly.svg.es-C0Ou1HWk.mjs +0 -4
- package/dist/trustly.svg.es-CHojqNqm.js +0 -1
- package/dist/twint.svg.es-CQ-ZDfy8.js +0 -1
- package/dist/twint.svg.es-WrZYquRs.mjs +0 -4
- package/dist/typeGuards.es-C4nR5FkL.js +0 -1
- package/dist/typeGuards.es-fwUoeMCe.mjs +0 -12
- package/dist/unionpay.svg.es-DYgo83Hf.mjs +0 -4
- package/dist/unionpay.svg.es-YqJKKFEj.js +0 -1
- package/dist/url-CjULBkjW.js +0 -1
- package/dist/url-CvNDq4wp.mjs +0 -22
- package/dist/useActionDispatchProvider-BVOBO0Jx.mjs +0 -12
- package/dist/useActionDispatchProvider-Cv9amjTf.js +0 -1
- package/dist/useCustomer-DLHOs4BR.js +0 -1
- package/dist/useCustomer-EDhref7T.mjs +0 -25
- package/dist/useCustomerFormLabels-B61-4xQ7.mjs +0 -1168
- package/dist/useCustomerFormLabels-C6wW4n2e.js +0 -1
- package/dist/useExperimentalFeature-0yFoaEzV.js +0 -1
- package/dist/useExperimentalFeature-DvxOrFPU.mjs +0 -9
- package/dist/useIncrementalLoading-BK9pRYAU.mjs +0 -71
- package/dist/useIncrementalLoading-CdtGJm_Y.js +0 -1
- package/dist/useInvoiceData-BSjVeJrI.js +0 -1
- package/dist/useInvoiceData-C0Y5WrbT.mjs +0 -45
- package/dist/useInvoicesList-BRDZqsaB.js +0 -1
- package/dist/useInvoicesList-CYoE7q0u.mjs +0 -580
- package/dist/useLoadInitialData-Cp1OA8y6.mjs +0 -18
- package/dist/useLoadInitialData-u7IyXqb6.js +0 -1
- package/dist/usePaymentMethodAvailability-B3s1lqQ2.js +0 -1
- package/dist/usePaymentMethodAvailability-EuhZPghG.mjs +0 -141
- package/dist/usePaymentMethodOptions--8QpMvNm.js +0 -1
- package/dist/usePaymentMethodOptions-Cljh7HYp.mjs +0 -36
- package/dist/usePaymentMethods-BJzoI8dZ.mjs +0 -16
- package/dist/usePaymentMethods-DvEnJWmB.js +0 -1
- package/dist/usePayments-CANj0QVc.js +0 -1
- package/dist/usePayments-CaT1CBzE.mjs +0 -362
- package/dist/usePortal-BjGoSeLy.js +0 -1
- package/dist/usePortal-CMPQ0M9R.mjs +0 -12
- package/dist/useService-D73FNBjT.js +0 -1
- package/dist/useService-W3Kxems4.mjs +0 -72
- package/dist/useSubscription-D1UKnZAx.mjs +0 -250
- package/dist/useSubscription-DZfRHbL7.js +0 -1
- package/dist/useViewport-Bu0cyeSi.mjs +0 -38
- package/dist/useViewport-CKRY1CKR.js +0 -1
- package/dist/useWatchDebounced-C_YxgoQ6.js +0 -1
- package/dist/useWatchDebounced-Zmxd6InB.mjs +0 -16
- package/dist/visa.svg.es-B6aU_qRs.mjs +0 -4
- package/dist/visa.svg.es-D6sc4YTE.js +0 -1
- package/dist/vpay.svg.es-4qIqS4aX.mjs +0 -4
- package/dist/vpay.svg.es-CLGTyB09.js +0 -1
- package/dist/zip.svg.es-3PzSBe1E.mjs +0 -4
- package/dist/zip.svg.es-BRsgmur-.js +0 -1
|
@@ -1,3264 +0,0 @@
|
|
|
1
|
-
import { defineComponent, ref, onMounted, onBeforeUnmount, computed, openBlock, createBlock, withCtx, createElementVNode, toDisplayString, createVNode, createTextVNode, createElementBlock, unref, createCommentVNode, renderSlot, createSlots, Fragment, renderList, useModel, watch, isRef, mergeModels, mergeProps, reactive, normalizeClass, withModifiers, normalizeStyle } from "vue";
|
|
2
|
-
import { w as withExpand } from "./api.es-C5pe8LUl.mjs";
|
|
3
|
-
import { u as useIntl, _ as _sfc_main$h, c as createRequestService, a as useConfig, b as useLogger, g as createLatestGuard } from "./customElements-B-89a5oH.mjs";
|
|
4
|
-
import { E as EXPAND_ALL } from "./component-BG6DmXcy.mjs";
|
|
5
|
-
import { u as useService } from "./useService-W3Kxems4.mjs";
|
|
6
|
-
import { _ as _sfc_main$w } from "./ErrorNotification.vue.es-CHyVTBGs.mjs";
|
|
7
|
-
import { i as isFixedPricing, a as isFlexiblePricing, h as hasOneOfPricingTypes } from "./pricingItemConfigs.es-BPIm6S8M.mjs";
|
|
8
|
-
import { f as formatAmount } from "./formatting.es-eYgXv_AK.mjs";
|
|
9
|
-
import { a as _sfc_main$i, _ as _sfc_main$j } from "./Button.vue.es-Cm9pLU9i.mjs";
|
|
10
|
-
import { _ as _sfc_main$f, T as TooltipContent, a as _sfc_main$g } from "./TooltipParagraph.vue.es-C5RTcrid.mjs";
|
|
11
|
-
import { _ as _sfc_main$k } from "./Section.vue.es-DX_9ueCG.mjs";
|
|
12
|
-
import { _ as _sfc_main$l } from "./Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
|
|
13
|
-
import { b as _sfc_main$n, a as _sfc_main$r } from "./EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-DLE5-9wz.mjs";
|
|
14
|
-
import { u as useValidation, c as common, _ as _sfc_main$p, a as requiredIf, r as required } from "./index-Cai7laNY.mjs";
|
|
15
|
-
import { _ as _sfc_main$s } from "./Divider.vue.es-wKkIVBgb.mjs";
|
|
16
|
-
import { _ as _sfc_main$q } from "./Expand.vue.es-C4_XmqbR.mjs";
|
|
17
|
-
import { _ as _sfc_main$m } from "./cn.es-BEU5D0Wz.mjs";
|
|
18
|
-
import { c as createInvoicesService } from "./invoices-1oYkdQQV.mjs";
|
|
19
|
-
import { u as useWatchDebounced } from "./useWatchDebounced-Zmxd6InB.mjs";
|
|
20
|
-
import { _ as _sfc_main$o } from "./Input.vue.es-WZGF8dfr.mjs";
|
|
21
|
-
import { _ as _sfc_main$t, a as _sfc_main$u } from "./AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Ce30EXY5.mjs";
|
|
22
|
-
import { _ as _sfc_main$v } from "./SubscriptionSummary.vue_vue_type_script_setup_true_lang-C5zB3CgZ.mjs";
|
|
23
|
-
import { g as getCustomerCountry } from "./customer.es-C_vSWcVA.mjs";
|
|
24
|
-
import { u as usePaymentMethodOptions } from "./usePaymentMethodOptions-Cljh7HYp.mjs";
|
|
25
|
-
import { M as Modal } from "./Modal.vue.es-qdUHDOnU.mjs";
|
|
26
|
-
const formatWalletBalanceValue = (formatMessage, formatNumber, balanceValue) => {
|
|
27
|
-
var _a, _b, _c, _d, _e, _f;
|
|
28
|
-
if (balanceValue == null ? void 0 : balanceValue.amount) {
|
|
29
|
-
return formatAmount(balanceValue.amount);
|
|
30
|
-
}
|
|
31
|
-
if (balanceValue == null ? void 0 : balanceValue.credits) {
|
|
32
|
-
const quantity = Number(balanceValue.credits.quantity);
|
|
33
|
-
const unitLabel = quantity === 1 ? (_b = (_a = balanceValue.credits.credit_type) == null ? void 0 : _a.unit_name) == null ? void 0 : _b.singular : ((_d = (_c = balanceValue.credits.credit_type) == null ? void 0 : _c.unit_name) == null ? void 0 : _d.plural) ?? ((_f = (_e = balanceValue.credits.credit_type) == null ? void 0 : _e.unit_name) == null ? void 0 : _f.singular);
|
|
34
|
-
const unit = unitLabel ?? formatMessage({
|
|
35
|
-
defaultMessage: "credits",
|
|
36
|
-
description: "Wallet balances credits default message",
|
|
37
|
-
id: "wB/wXs"
|
|
38
|
-
});
|
|
39
|
-
return `${formatNumber(quantity)} ${unit}`;
|
|
40
|
-
}
|
|
41
|
-
return formatMessage({
|
|
42
|
-
defaultMessage: "N/A",
|
|
43
|
-
description: "Fallback wallet balance label when no balance is available",
|
|
44
|
-
id: "PW+sL4"
|
|
45
|
-
});
|
|
46
|
-
};
|
|
47
|
-
const REFRESH_INTERVAL_MS = 3e4;
|
|
48
|
-
const SECONDS_PER_MINUTE = 60;
|
|
49
|
-
const MONTHS_PER_YEAR = 12;
|
|
50
|
-
const _sfc_main$e = /* @__PURE__ */ defineComponent({
|
|
51
|
-
__name: "DateTimeAgo",
|
|
52
|
-
props: {
|
|
53
|
-
date: {},
|
|
54
|
-
actionVerb: {}
|
|
55
|
-
},
|
|
56
|
-
setup(__props) {
|
|
57
|
-
const SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE;
|
|
58
|
-
const SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR;
|
|
59
|
-
const props = __props;
|
|
60
|
-
const { $t, formatDate } = useIntl();
|
|
61
|
-
const now = ref(Date.now());
|
|
62
|
-
let refreshTimer;
|
|
63
|
-
onMounted(() => {
|
|
64
|
-
refreshTimer = setInterval(() => {
|
|
65
|
-
now.value = Date.now();
|
|
66
|
-
}, REFRESH_INTERVAL_MS);
|
|
67
|
-
});
|
|
68
|
-
onBeforeUnmount(() => {
|
|
69
|
-
clearInterval(refreshTimer);
|
|
70
|
-
});
|
|
71
|
-
const elapsedMonths = (from, to) => {
|
|
72
|
-
const months = (to.getFullYear() - from.getFullYear()) * MONTHS_PER_YEAR + (to.getMonth() - from.getMonth());
|
|
73
|
-
return to.getDate() < from.getDate() ? months - 1 : months;
|
|
74
|
-
};
|
|
75
|
-
const timeAgo = computed(() => {
|
|
76
|
-
const elapsed = Math.max(0, (now.value - props.date.getTime()) / 1e3);
|
|
77
|
-
if (elapsed < SECONDS_PER_MINUTE) {
|
|
78
|
-
return $t(
|
|
79
|
-
{
|
|
80
|
-
defaultMessage: "{count, plural, one {# second} other {# seconds}} ago",
|
|
81
|
-
id: "dateTimeAgo.seconds",
|
|
82
|
-
description: "Relative time in whole seconds"
|
|
83
|
-
},
|
|
84
|
-
{ count: Math.trunc(elapsed) }
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
if (elapsed < SECONDS_PER_HOUR) {
|
|
88
|
-
return $t(
|
|
89
|
-
{
|
|
90
|
-
defaultMessage: "{count, plural, one {# minute} other {# minutes}} ago",
|
|
91
|
-
id: "dateTimeAgo.minutes",
|
|
92
|
-
description: "Relative time in whole minutes"
|
|
93
|
-
},
|
|
94
|
-
{ count: Math.trunc(elapsed / SECONDS_PER_MINUTE) }
|
|
95
|
-
);
|
|
96
|
-
}
|
|
97
|
-
if (elapsed < SECONDS_PER_DAY) {
|
|
98
|
-
return $t(
|
|
99
|
-
{
|
|
100
|
-
defaultMessage: "{count, plural, one {# hour} other {# hours}} ago",
|
|
101
|
-
id: "dateTimeAgo.hours",
|
|
102
|
-
description: "Relative time in whole hours"
|
|
103
|
-
},
|
|
104
|
-
{ count: Math.trunc(elapsed / SECONDS_PER_HOUR) }
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
const months = elapsedMonths(props.date, new Date(now.value));
|
|
108
|
-
if (months < 1) {
|
|
109
|
-
const days = Math.trunc(elapsed / SECONDS_PER_DAY);
|
|
110
|
-
if (days === 1) {
|
|
111
|
-
return $t({
|
|
112
|
-
defaultMessage: "yesterday",
|
|
113
|
-
id: "dateTimeAgo.yesterday",
|
|
114
|
-
description: 'Relative time for a single day ago, reading as "updated yesterday" once the action verb is in front'
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
return $t(
|
|
118
|
-
{
|
|
119
|
-
defaultMessage: "{count, plural, one {# day} other {# days}} ago",
|
|
120
|
-
id: "dateTimeAgo.days",
|
|
121
|
-
description: "Relative time in whole days"
|
|
122
|
-
},
|
|
123
|
-
{ count: days }
|
|
124
|
-
);
|
|
125
|
-
}
|
|
126
|
-
if (months < MONTHS_PER_YEAR) {
|
|
127
|
-
return $t(
|
|
128
|
-
{
|
|
129
|
-
defaultMessage: "{count, plural, one {# month} other {# months}} ago",
|
|
130
|
-
id: "dateTimeAgo.months",
|
|
131
|
-
description: "Relative time in whole months"
|
|
132
|
-
},
|
|
133
|
-
{ count: months }
|
|
134
|
-
);
|
|
135
|
-
}
|
|
136
|
-
return $t(
|
|
137
|
-
{
|
|
138
|
-
defaultMessage: "{count, plural, one {# year} other {# years}} ago",
|
|
139
|
-
id: "dateTimeAgo.years",
|
|
140
|
-
description: "Relative time in whole years"
|
|
141
|
-
},
|
|
142
|
-
{ count: Math.trunc(months / MONTHS_PER_YEAR) }
|
|
143
|
-
);
|
|
144
|
-
});
|
|
145
|
-
const label = computed(
|
|
146
|
-
() => props.actionVerb ? `${props.actionVerb} ${timeAgo.value}` : timeAgo.value
|
|
147
|
-
);
|
|
148
|
-
const fullDate = computed(
|
|
149
|
-
() => formatDate({ date: props.date, format: "dateTime", offsetType: "local" })
|
|
150
|
-
);
|
|
151
|
-
return (_ctx, _cache) => {
|
|
152
|
-
return openBlock(), createBlock(_sfc_main$f, null, {
|
|
153
|
-
tooltip: withCtx(() => [
|
|
154
|
-
createVNode(TooltipContent, null, {
|
|
155
|
-
default: withCtx(() => [
|
|
156
|
-
createVNode(_sfc_main$g, null, {
|
|
157
|
-
default: withCtx(() => [
|
|
158
|
-
createTextVNode(toDisplayString(fullDate.value), 1)
|
|
159
|
-
]),
|
|
160
|
-
_: 1
|
|
161
|
-
})
|
|
162
|
-
]),
|
|
163
|
-
_: 1
|
|
164
|
-
})
|
|
165
|
-
]),
|
|
166
|
-
default: withCtx(() => [
|
|
167
|
-
createElementVNode("span", null, toDisplayString(label.value), 1)
|
|
168
|
-
]),
|
|
169
|
-
_: 1
|
|
170
|
-
});
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
const useWalletBalancesItem = (props) => {
|
|
175
|
-
const { $t, formatNumber } = useIntl();
|
|
176
|
-
const formatBalance = (balanceValue) => formatWalletBalanceValue($t, formatNumber, balanceValue);
|
|
177
|
-
const walletName = computed(
|
|
178
|
-
() => {
|
|
179
|
-
var _a, _b;
|
|
180
|
-
return ((_b = (_a = props.walletBalance.wallet) == null ? void 0 : _a.wallet_type) == null ? void 0 : _b.name) || $t({
|
|
181
|
-
defaultMessage: "Balance",
|
|
182
|
-
id: "wallet_balance.balance_label",
|
|
183
|
-
description: "Label shown above a wallet's balance amount"
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
);
|
|
187
|
-
const getOnDemandConfigs = (chargeOnDemandItem) => {
|
|
188
|
-
var _a;
|
|
189
|
-
return (((_a = chargeOnDemandItem.pricing_item) == null ? void 0 : _a.configs) ?? []).filter((config) => !!config.on_demand);
|
|
190
|
-
};
|
|
191
|
-
const manualTopUpItems = computed(
|
|
192
|
-
() => (props.walletBalance.charge_on_demand_pricing_items ?? []).filter(
|
|
193
|
-
(chargeOnDemandItem) => getOnDemandConfigs(chargeOnDemandItem).some(
|
|
194
|
-
(config) => isFixedPricing(config) || isFlexiblePricing(config)
|
|
195
|
-
)
|
|
196
|
-
)
|
|
197
|
-
);
|
|
198
|
-
const flexibleManualTopUpItem = computed(
|
|
199
|
-
() => manualTopUpItems.value.find(
|
|
200
|
-
(chargeOnDemandItem) => getOnDemandConfigs(chargeOnDemandItem).some((config) => isFlexiblePricing(config))
|
|
201
|
-
)
|
|
202
|
-
);
|
|
203
|
-
const showManualTopUp = computed(
|
|
204
|
-
() => !!props.showManualTopUp && manualTopUpItems.value.length > 0
|
|
205
|
-
);
|
|
206
|
-
const showAutoTopUp = computed(() => !!props.showAutoTopUp && !!flexibleManualTopUpItem.value);
|
|
207
|
-
const activeTopUpConfig = computed(
|
|
208
|
-
() => {
|
|
209
|
-
var _a, _b;
|
|
210
|
-
return (_b = (_a = props.walletBalance.wallet) == null ? void 0 : _a.auto_top_up_configs) == null ? void 0 : _b.find(
|
|
211
|
-
(config) => config.status === "ACTIVE"
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
const balanceCreditType = computed(
|
|
216
|
-
() => {
|
|
217
|
-
var _a, _b;
|
|
218
|
-
return (_b = (_a = props.walletBalance.wallet_balance.open_balance) == null ? void 0 : _a.credits) == null ? void 0 : _b.credit_type;
|
|
219
|
-
}
|
|
220
|
-
);
|
|
221
|
-
const formatCredits = (quantity, creditTypeId) => formatBalance({
|
|
222
|
-
credits: {
|
|
223
|
-
quantity,
|
|
224
|
-
credit_type_id: creditTypeId,
|
|
225
|
-
credit_type: balanceCreditType.value
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
const formatThreshold = (threshold) => {
|
|
229
|
-
if (threshold.amount) {
|
|
230
|
-
return formatBalance({ amount: threshold.amount });
|
|
231
|
-
}
|
|
232
|
-
if (threshold.credits) {
|
|
233
|
-
return formatCredits(threshold.credits.quantity, threshold.credits.credit_type_id);
|
|
234
|
-
}
|
|
235
|
-
return "";
|
|
236
|
-
};
|
|
237
|
-
const autoTopUpWalletGrant = computed(() => {
|
|
238
|
-
var _a, _b;
|
|
239
|
-
const pricingItemId = (_a = activeTopUpConfig.value) == null ? void 0 : _a.pricing_item_id;
|
|
240
|
-
if (!pricingItemId) {
|
|
241
|
-
return void 0;
|
|
242
|
-
}
|
|
243
|
-
const grants = (props.walletBalance.charge_on_demand_pricing_items ?? []).filter((chargeOnDemandItem) => chargeOnDemandItem.pricing_item_id === pricingItemId).flatMap((chargeOnDemandItem) => getOnDemandConfigs(chargeOnDemandItem)).flatMap((config) => config.wallet_grants ?? []);
|
|
244
|
-
const walletTypeId = (_b = props.walletBalance.wallet) == null ? void 0 : _b.wallet_type_id;
|
|
245
|
-
return grants.find((grant) => grant.wallet_type_id === walletTypeId) ?? grants[0];
|
|
246
|
-
});
|
|
247
|
-
const autoTopUpCredits = computed(() => {
|
|
248
|
-
var _a, _b;
|
|
249
|
-
const topUpAmount = (_a = activeTopUpConfig.value) == null ? void 0 : _a.topup_amount;
|
|
250
|
-
const creditsGrant = (_b = autoTopUpWalletGrant.value) == null ? void 0 : _b.credits_grant;
|
|
251
|
-
if (!topUpAmount || !creditsGrant) {
|
|
252
|
-
return "";
|
|
253
|
-
}
|
|
254
|
-
if (creditsGrant.credits) {
|
|
255
|
-
return formatCredits(
|
|
256
|
-
creditsGrant.credits.quantity,
|
|
257
|
-
creditsGrant.credits.credit_type_id
|
|
258
|
-
);
|
|
259
|
-
}
|
|
260
|
-
if (creditsGrant.conversion) {
|
|
261
|
-
const quantity = Number(topUpAmount.quantity) * Number(creditsGrant.conversion.rate);
|
|
262
|
-
return formatCredits(String(quantity), creditsGrant.conversion.credit_type_id);
|
|
263
|
-
}
|
|
264
|
-
return "";
|
|
265
|
-
});
|
|
266
|
-
const autoTopUpLabel = computed(
|
|
267
|
-
() => activeTopUpConfig.value ? $t({
|
|
268
|
-
defaultMessage: "Auto top-up enabled",
|
|
269
|
-
id: "wallet_balance.auto_top_up_enabled_label",
|
|
270
|
-
description: "Label shown when a wallet tops itself up automatically"
|
|
271
|
-
}) : $t({
|
|
272
|
-
defaultMessage: "No auto top-up enabled",
|
|
273
|
-
id: "wallet_balance.auto_top_up_disabled_label",
|
|
274
|
-
description: "Label shown when a wallet has no automatic top-up configured"
|
|
275
|
-
})
|
|
276
|
-
);
|
|
277
|
-
const autoTopUpExplanation = computed(() => {
|
|
278
|
-
const config = activeTopUpConfig.value;
|
|
279
|
-
if (!config) {
|
|
280
|
-
return $t({
|
|
281
|
-
defaultMessage: "Set up an automatic top-up and your balance is increased for you whenever it drops below an amount you choose, so you never run out.",
|
|
282
|
-
id: "wallet_balance.auto_top_up_setup_explanation",
|
|
283
|
-
description: "Tooltip explaining what automatic top-ups do, shown when none is configured yet"
|
|
284
|
-
});
|
|
285
|
-
}
|
|
286
|
-
const topUpAmount = config.topup_amount ? formatBalance({ amount: config.topup_amount }) : "";
|
|
287
|
-
const threshold = formatThreshold(config.threshold);
|
|
288
|
-
if (!topUpAmount || !threshold) {
|
|
289
|
-
return $t({
|
|
290
|
-
defaultMessage: "Your balance is topped up automatically once it runs low.",
|
|
291
|
-
id: "wallet_balance.auto_top_up_generic_explanation",
|
|
292
|
-
description: "Tooltip shown for an active automatic top-up whose amount or threshold is unknown"
|
|
293
|
-
});
|
|
294
|
-
}
|
|
295
|
-
if (autoTopUpCredits.value) {
|
|
296
|
-
return $t(
|
|
297
|
-
{
|
|
298
|
-
defaultMessage: "Your balance is automatically increased with {topUpCredits} ({topUpAmount}) when it drops below {threshold}.",
|
|
299
|
-
id: "wallet_balance.auto_top_up_credits_explanation",
|
|
300
|
-
description: "Tooltip explaining an automatic top-up that grants credits for a paid amount"
|
|
301
|
-
},
|
|
302
|
-
{ topUpCredits: autoTopUpCredits.value, topUpAmount, threshold }
|
|
303
|
-
);
|
|
304
|
-
}
|
|
305
|
-
return $t(
|
|
306
|
-
{
|
|
307
|
-
defaultMessage: "Your balance is automatically increased with {topUpAmount} when it drops below {threshold}.",
|
|
308
|
-
id: "wallet_balance.auto_top_up_explanation",
|
|
309
|
-
description: "Tooltip explaining how the automatic top-up of a wallet balance works"
|
|
310
|
-
},
|
|
311
|
-
{ topUpAmount, threshold }
|
|
312
|
-
);
|
|
313
|
-
});
|
|
314
|
-
return {
|
|
315
|
-
walletName,
|
|
316
|
-
formatBalance,
|
|
317
|
-
manualTopUpItems,
|
|
318
|
-
flexibleManualTopUpItem,
|
|
319
|
-
showManualTopUp,
|
|
320
|
-
showAutoTopUp,
|
|
321
|
-
activeTopUpConfig,
|
|
322
|
-
autoTopUpLabel,
|
|
323
|
-
autoTopUpExplanation
|
|
324
|
-
};
|
|
325
|
-
};
|
|
326
|
-
const _hoisted_1$b = { class: "flex flex-col gap-3 py-3" };
|
|
327
|
-
const _hoisted_2$2 = { class: "flex flex-col gap-1 px-4" };
|
|
328
|
-
const _hoisted_3$2 = { class: "flex w-full justify-between gap-3" };
|
|
329
|
-
const _hoisted_4$1 = { class: "flex w-full items-center gap-4" };
|
|
330
|
-
const _hoisted_5$1 = { key: 0 };
|
|
331
|
-
const _hoisted_6 = {
|
|
332
|
-
key: 1,
|
|
333
|
-
class: "flex w-full justify-between gap-3 px-4"
|
|
334
|
-
};
|
|
335
|
-
const _hoisted_7 = { class: "flex min-w-0 items-center gap-1" };
|
|
336
|
-
const _hoisted_8 = { class: "flex min-w-0 items-center gap-1" };
|
|
337
|
-
const _hoisted_9 = { class: "shrink-0" };
|
|
338
|
-
const _sfc_main$d = /* @__PURE__ */ defineComponent({
|
|
339
|
-
__name: "WalletBalancesItem",
|
|
340
|
-
props: {
|
|
341
|
-
walletBalance: {},
|
|
342
|
-
showAutoTopUp: { type: Boolean },
|
|
343
|
-
showManualTopUp: { type: Boolean }
|
|
344
|
-
},
|
|
345
|
-
emits: ["top-up", "auto-top-up", "cancel-auto-top-up"],
|
|
346
|
-
setup(__props) {
|
|
347
|
-
const props = __props;
|
|
348
|
-
const { $t } = useIntl();
|
|
349
|
-
const {
|
|
350
|
-
walletName,
|
|
351
|
-
formatBalance,
|
|
352
|
-
manualTopUpItems,
|
|
353
|
-
flexibleManualTopUpItem,
|
|
354
|
-
showManualTopUp,
|
|
355
|
-
showAutoTopUp,
|
|
356
|
-
activeTopUpConfig,
|
|
357
|
-
autoTopUpLabel,
|
|
358
|
-
autoTopUpExplanation
|
|
359
|
-
} = useWalletBalancesItem(props);
|
|
360
|
-
return (_ctx, _cache) => {
|
|
361
|
-
return openBlock(), createElementBlock("div", _hoisted_1$b, [
|
|
362
|
-
createElementVNode("div", _hoisted_2$2, [
|
|
363
|
-
createElementVNode("div", _hoisted_3$2, [
|
|
364
|
-
createVNode(_sfc_main$h, {
|
|
365
|
-
variant: "body-xs",
|
|
366
|
-
color: "subtle",
|
|
367
|
-
"no-spacing": ""
|
|
368
|
-
}, {
|
|
369
|
-
default: withCtx(() => [
|
|
370
|
-
createTextVNode(toDisplayString(unref(walletName)), 1)
|
|
371
|
-
]),
|
|
372
|
-
_: 1
|
|
373
|
-
}),
|
|
374
|
-
createVNode(_sfc_main$h, {
|
|
375
|
-
variant: "body-xs",
|
|
376
|
-
color: "subtle",
|
|
377
|
-
"no-spacing": ""
|
|
378
|
-
}, {
|
|
379
|
-
default: withCtx(() => {
|
|
380
|
-
var _a, _b;
|
|
381
|
-
return [
|
|
382
|
-
((_a = __props.walletBalance.wallet_balance) == null ? void 0 : _a.balance_at) ? (openBlock(), createBlock(_sfc_main$e, {
|
|
383
|
-
key: 0,
|
|
384
|
-
date: new Date((_b = __props.walletBalance.wallet_balance) == null ? void 0 : _b.balance_at),
|
|
385
|
-
"action-verb": unref($t)({
|
|
386
|
-
defaultMessage: "updated",
|
|
387
|
-
id: "wallet_balance.updated_action_verb",
|
|
388
|
-
description: "Verb in front of when a wallet balance was last updated, e.g. 'updated 5 minutes ago'"
|
|
389
|
-
})
|
|
390
|
-
}, null, 8, ["date", "action-verb"])) : createCommentVNode("", true)
|
|
391
|
-
];
|
|
392
|
-
}),
|
|
393
|
-
_: 1
|
|
394
|
-
})
|
|
395
|
-
]),
|
|
396
|
-
createElementVNode("div", _hoisted_4$1, [
|
|
397
|
-
createVNode(_sfc_main$h, {
|
|
398
|
-
variant: "body-lg",
|
|
399
|
-
weight: "semibold",
|
|
400
|
-
"no-spacing": "",
|
|
401
|
-
class: "grow"
|
|
402
|
-
}, {
|
|
403
|
-
default: withCtx(() => [
|
|
404
|
-
createTextVNode(toDisplayString(unref(formatBalance)(props.walletBalance.wallet_balance.open_balance)), 1)
|
|
405
|
-
]),
|
|
406
|
-
_: 1
|
|
407
|
-
}),
|
|
408
|
-
unref(showManualTopUp) ? (openBlock(), createBlock(unref(_sfc_main$i), {
|
|
409
|
-
key: 0,
|
|
410
|
-
size: "xs",
|
|
411
|
-
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("top-up", unref(manualTopUpItems)[0]))
|
|
412
|
-
}, {
|
|
413
|
-
default: withCtx(() => [
|
|
414
|
-
createTextVNode(toDisplayString(unref($t)({
|
|
415
|
-
defaultMessage: "Top up",
|
|
416
|
-
id: "v1V8kA",
|
|
417
|
-
description: "Button to top up a wallet balance"
|
|
418
|
-
})), 1)
|
|
419
|
-
]),
|
|
420
|
-
_: 1
|
|
421
|
-
})) : createCommentVNode("", true)
|
|
422
|
-
])
|
|
423
|
-
]),
|
|
424
|
-
_ctx.$slots["graph"] ? (openBlock(), createElementBlock("div", _hoisted_5$1, [
|
|
425
|
-
renderSlot(_ctx.$slots, "graph")
|
|
426
|
-
])) : createCommentVNode("", true),
|
|
427
|
-
unref(showAutoTopUp) ? (openBlock(), createElementBlock("div", _hoisted_6, [
|
|
428
|
-
createElementVNode("div", _hoisted_7, [
|
|
429
|
-
createVNode(_sfc_main$f, { class: "min-w-0" }, {
|
|
430
|
-
tooltip: withCtx(() => [
|
|
431
|
-
createVNode(TooltipContent, null, {
|
|
432
|
-
default: withCtx(() => [
|
|
433
|
-
createVNode(_sfc_main$g, null, {
|
|
434
|
-
default: withCtx(() => [
|
|
435
|
-
createTextVNode(toDisplayString(unref(autoTopUpExplanation)), 1)
|
|
436
|
-
]),
|
|
437
|
-
_: 1
|
|
438
|
-
})
|
|
439
|
-
]),
|
|
440
|
-
_: 1
|
|
441
|
-
})
|
|
442
|
-
]),
|
|
443
|
-
default: withCtx(() => [
|
|
444
|
-
createElementVNode("div", _hoisted_8, [
|
|
445
|
-
createVNode(_sfc_main$h, {
|
|
446
|
-
variant: "body-sm",
|
|
447
|
-
color: "secondary",
|
|
448
|
-
"no-spacing": "",
|
|
449
|
-
class: "truncate"
|
|
450
|
-
}, {
|
|
451
|
-
default: withCtx(() => [
|
|
452
|
-
createTextVNode(toDisplayString(unref(autoTopUpLabel)), 1)
|
|
453
|
-
]),
|
|
454
|
-
_: 1
|
|
455
|
-
}),
|
|
456
|
-
createVNode(_sfc_main$j, {
|
|
457
|
-
icon: "info",
|
|
458
|
-
size: "2xs",
|
|
459
|
-
class: "shrink-0 cursor-help text-gray-400"
|
|
460
|
-
})
|
|
461
|
-
])
|
|
462
|
-
]),
|
|
463
|
-
_: 1
|
|
464
|
-
})
|
|
465
|
-
]),
|
|
466
|
-
createElementVNode("div", _hoisted_9, [
|
|
467
|
-
unref(activeTopUpConfig) ? (openBlock(), createBlock(unref(_sfc_main$i), {
|
|
468
|
-
key: 0,
|
|
469
|
-
size: "xs",
|
|
470
|
-
intent: "secondary",
|
|
471
|
-
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("cancel-auto-top-up", unref(activeTopUpConfig)))
|
|
472
|
-
}, {
|
|
473
|
-
default: withCtx(() => [
|
|
474
|
-
createTextVNode(toDisplayString(unref($t)({
|
|
475
|
-
defaultMessage: "Disable",
|
|
476
|
-
id: "wallet_balance.auto_top_up_disable_button",
|
|
477
|
-
description: "Button to turn off a wallet's automatic top-up"
|
|
478
|
-
})), 1)
|
|
479
|
-
]),
|
|
480
|
-
_: 1
|
|
481
|
-
})) : (openBlock(), createBlock(unref(_sfc_main$i), {
|
|
482
|
-
key: 1,
|
|
483
|
-
size: "xs",
|
|
484
|
-
intent: "secondary",
|
|
485
|
-
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("auto-top-up", unref(flexibleManualTopUpItem)))
|
|
486
|
-
}, {
|
|
487
|
-
default: withCtx(() => [
|
|
488
|
-
createTextVNode(toDisplayString(unref($t)({
|
|
489
|
-
defaultMessage: "Enable",
|
|
490
|
-
id: "wallet_balance.auto_top_up_enable_button",
|
|
491
|
-
description: "Button to set up a wallet's automatic top-up"
|
|
492
|
-
})), 1)
|
|
493
|
-
]),
|
|
494
|
-
_: 1
|
|
495
|
-
}))
|
|
496
|
-
])
|
|
497
|
-
])) : createCommentVNode("", true)
|
|
498
|
-
]);
|
|
499
|
-
};
|
|
500
|
-
}
|
|
501
|
-
});
|
|
502
|
-
const _hoisted_1$a = { class: "flex flex-col gap-2" };
|
|
503
|
-
const _sfc_main$c = /* @__PURE__ */ defineComponent({
|
|
504
|
-
__name: "WalletBalances",
|
|
505
|
-
props: {
|
|
506
|
-
customerWalletBalances: {},
|
|
507
|
-
title: { default: void 0 },
|
|
508
|
-
showAutoTopUp: { type: Boolean, default: false },
|
|
509
|
-
showManualTopUp: { type: Boolean, default: false }
|
|
510
|
-
},
|
|
511
|
-
emits: ["top-up", "auto-top-up", "cancel-auto-top-up"],
|
|
512
|
-
setup(__props) {
|
|
513
|
-
return (_ctx, _cache) => {
|
|
514
|
-
return openBlock(), createBlock(_sfc_main$k, {
|
|
515
|
-
"no-spacing": "",
|
|
516
|
-
"no-border": "",
|
|
517
|
-
title: __props.title
|
|
518
|
-
}, createSlots({
|
|
519
|
-
default: withCtx(() => [
|
|
520
|
-
createElementVNode("div", _hoisted_1$a, [
|
|
521
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.customerWalletBalances, (walletBalance) => {
|
|
522
|
-
return openBlock(), createBlock(_sfc_main$k, {
|
|
523
|
-
key: walletBalance.wallet_id,
|
|
524
|
-
"no-spacing": ""
|
|
525
|
-
}, {
|
|
526
|
-
default: withCtx(() => [
|
|
527
|
-
createVNode(_sfc_main$d, {
|
|
528
|
-
"wallet-balance": walletBalance,
|
|
529
|
-
"show-auto-top-up": __props.showAutoTopUp,
|
|
530
|
-
"show-manual-top-up": __props.showManualTopUp,
|
|
531
|
-
onTopUp: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("top-up", $event)),
|
|
532
|
-
onAutoTopUp: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("auto-top-up", $event)),
|
|
533
|
-
onCancelAutoTopUp: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("cancel-auto-top-up", $event))
|
|
534
|
-
}, null, 8, ["wallet-balance", "show-auto-top-up", "show-manual-top-up"])
|
|
535
|
-
]),
|
|
536
|
-
_: 2
|
|
537
|
-
}, 1024);
|
|
538
|
-
}), 128))
|
|
539
|
-
])
|
|
540
|
-
]),
|
|
541
|
-
_: 2
|
|
542
|
-
}, [
|
|
543
|
-
_ctx.$slots["heading-right"] ? {
|
|
544
|
-
name: "right",
|
|
545
|
-
fn: withCtx(() => [
|
|
546
|
-
renderSlot(_ctx.$slots, "heading-right")
|
|
547
|
-
]),
|
|
548
|
-
key: "0"
|
|
549
|
-
} : void 0
|
|
550
|
-
]), 1032, ["title"]);
|
|
551
|
-
};
|
|
552
|
-
}
|
|
553
|
-
});
|
|
554
|
-
function createWalletsService() {
|
|
555
|
-
const request = createRequestService();
|
|
556
|
-
const config = useConfig();
|
|
557
|
-
function getCustomerWalletBalances(customerId) {
|
|
558
|
-
return request({
|
|
559
|
-
url: `${config.apiUrls.config}/portal/customers/${customerId}/wallets/balance`,
|
|
560
|
-
query: withExpand({ expandParams: EXPAND_ALL }),
|
|
561
|
-
options: { method: "POST" },
|
|
562
|
-
data: {}
|
|
563
|
-
});
|
|
564
|
-
}
|
|
565
|
-
return {
|
|
566
|
-
getCustomerWalletBalances
|
|
567
|
-
};
|
|
568
|
-
}
|
|
569
|
-
function useCustomerWalletBalances({ customerId }) {
|
|
570
|
-
const { getCustomerWalletBalances } = createWalletsService();
|
|
571
|
-
const { data, execute, apiStatus, error, isPending } = useService({
|
|
572
|
-
service: () => getCustomerWalletBalances(customerId)
|
|
573
|
-
});
|
|
574
|
-
const walletBalances = computed(
|
|
575
|
-
() => data.value ?? null
|
|
576
|
-
);
|
|
577
|
-
return { walletBalances, apiStatus, error, fetch: execute, isPending };
|
|
578
|
-
}
|
|
579
|
-
const getWalletBalanceForTopUpItem = (walletBalances = [], topUpItem) => {
|
|
580
|
-
if (!(topUpItem == null ? void 0 : topUpItem.pricing_item_id)) {
|
|
581
|
-
return void 0;
|
|
582
|
-
}
|
|
583
|
-
return walletBalances.find(
|
|
584
|
-
(balance) => (balance.charge_on_demand_pricing_items ?? []).some(
|
|
585
|
-
({ pricing_item_id }) => pricing_item_id === topUpItem.pricing_item_id
|
|
586
|
-
)
|
|
587
|
-
);
|
|
588
|
-
};
|
|
589
|
-
const TOP_UP_MODAL_STEPS = ["TOP_UP", "ADD_PAYMENT_METHOD", "SUCCESS"];
|
|
590
|
-
const isChargeOnDemandPricingItem = (entry) => typeof entry === "object" && entry !== null && "pricing_item" in entry;
|
|
591
|
-
const getTopUpScheduleIds = (walletBalanceItem) => [
|
|
592
|
-
...new Set(
|
|
593
|
-
((walletBalanceItem == null ? void 0 : walletBalanceItem.charge_on_demand_pricing_items) ?? []).flatMap(
|
|
594
|
-
(entry) => isChargeOnDemandPricingItem(entry) && entry.pricing_plan_schedule_id ? [entry.pricing_plan_schedule_id] : []
|
|
595
|
-
)
|
|
596
|
-
)
|
|
597
|
-
];
|
|
598
|
-
const getTopUpSubscriptions = (walletBalanceItem, subscriptions) => {
|
|
599
|
-
const toppedUpOn = new Set(getTopUpScheduleIds(walletBalanceItem));
|
|
600
|
-
return subscriptions.flatMap((subscription) => {
|
|
601
|
-
const scheduleInfos = (subscription.pricing_plan_schedule_infos ?? []).filter(
|
|
602
|
-
({ id }) => toppedUpOn.has(id)
|
|
603
|
-
);
|
|
604
|
-
if (scheduleInfos.length === 0) {
|
|
605
|
-
return [];
|
|
606
|
-
}
|
|
607
|
-
return [
|
|
608
|
-
{
|
|
609
|
-
id: subscription.id,
|
|
610
|
-
name: subscription.name || subscription.reference || subscription.id,
|
|
611
|
-
scheduleIds: scheduleInfos.map(({ id }) => id),
|
|
612
|
-
enabledPricingIds: scheduleInfos.flatMap(
|
|
613
|
-
(info) => {
|
|
614
|
-
var _a;
|
|
615
|
-
return (((_a = info.pricing_plan_schedule) == null ? void 0 : _a.enabled_pricings) ?? []).flatMap(
|
|
616
|
-
({ pricing_id }) => pricing_id ? [pricing_id] : []
|
|
617
|
-
);
|
|
618
|
-
}
|
|
619
|
-
)
|
|
620
|
-
}
|
|
621
|
-
];
|
|
622
|
-
});
|
|
623
|
-
};
|
|
624
|
-
const withTopUpPricingItemsForSchedules = (walletBalanceItem, scheduleIds) => {
|
|
625
|
-
if (!walletBalanceItem || scheduleIds.length === 0) {
|
|
626
|
-
return walletBalanceItem;
|
|
627
|
-
}
|
|
628
|
-
const allowed = new Set(scheduleIds);
|
|
629
|
-
return {
|
|
630
|
-
...walletBalanceItem,
|
|
631
|
-
charge_on_demand_pricing_items: (walletBalanceItem.charge_on_demand_pricing_items ?? []).filter(
|
|
632
|
-
(entry) => isChargeOnDemandPricingItem(entry) && !!entry.pricing_plan_schedule_id && allowed.has(entry.pricing_plan_schedule_id)
|
|
633
|
-
)
|
|
634
|
-
};
|
|
635
|
-
};
|
|
636
|
-
const getTopUpPricingItems = (walletBalanceItem) => ((walletBalanceItem == null ? void 0 : walletBalanceItem.charge_on_demand_pricing_items) ?? []).flatMap((entry) => {
|
|
637
|
-
var _a, _b;
|
|
638
|
-
if (!isChargeOnDemandPricingItem(entry)) {
|
|
639
|
-
return [];
|
|
640
|
-
}
|
|
641
|
-
const pricingItemId = entry.pricing_item_id ?? ((_a = entry.pricing_item) == null ? void 0 : _a.id);
|
|
642
|
-
if (!pricingItemId) {
|
|
643
|
-
return [];
|
|
644
|
-
}
|
|
645
|
-
return (((_b = entry.pricing_item) == null ? void 0 : _b.configs) ?? []).map((config) => {
|
|
646
|
-
const flexiblePricing = getFlexiblePricing(config, walletBalanceItem);
|
|
647
|
-
const fixedPricing = getFixedPricing(config, walletBalanceItem);
|
|
648
|
-
return {
|
|
649
|
-
pricingItemId,
|
|
650
|
-
...entry.pricing_plan_schedule_id && {
|
|
651
|
-
pricingPlanScheduleId: entry.pricing_plan_schedule_id
|
|
652
|
-
},
|
|
653
|
-
config,
|
|
654
|
-
...flexiblePricing && { flexiblePricing },
|
|
655
|
-
...fixedPricing && { fixedPricing }
|
|
656
|
-
};
|
|
657
|
-
});
|
|
658
|
-
});
|
|
659
|
-
function getFixedPricing(config, walletBalanceItem) {
|
|
660
|
-
var _a, _b, _c;
|
|
661
|
-
if (!config.on_demand || !hasOneOfPricingTypes(config, ["FIXED"])) {
|
|
662
|
-
return void 0;
|
|
663
|
-
}
|
|
664
|
-
const amount = (_c = (_b = (_a = config.details) == null ? void 0 : _a.bands) == null ? void 0 : _b[0]) == null ? void 0 : _c.fixed_amount;
|
|
665
|
-
if (!amount) {
|
|
666
|
-
return void 0;
|
|
667
|
-
}
|
|
668
|
-
const walletCredits = getWalletCredits(walletBalanceItem);
|
|
669
|
-
const grantedCredits = walletCredits ? getGrantedCredits(config, walletBalanceItem) : void 0;
|
|
670
|
-
return {
|
|
671
|
-
amount,
|
|
672
|
-
value: grantedCredits && walletCredits ? toCreditsValue(grantedCredits.quantity, walletCredits) : { amount }
|
|
673
|
-
};
|
|
674
|
-
}
|
|
675
|
-
const getWalletCredits = (walletBalanceItem) => {
|
|
676
|
-
var _a;
|
|
677
|
-
return (_a = walletBalanceItem == null ? void 0 : walletBalanceItem.wallet_balance.balance) == null ? void 0 : _a.credits;
|
|
678
|
-
};
|
|
679
|
-
const getWalletGrants = (config, walletBalanceItem) => {
|
|
680
|
-
var _a;
|
|
681
|
-
const walletTypeId = (_a = walletBalanceItem == null ? void 0 : walletBalanceItem.wallet) == null ? void 0 : _a.wallet_type_id;
|
|
682
|
-
return (config.wallet_grants ?? []).filter(
|
|
683
|
-
({ wallet_type_id }) => !walletTypeId || wallet_type_id === walletTypeId
|
|
684
|
-
);
|
|
685
|
-
};
|
|
686
|
-
const getCreditsConversion = (config, walletBalanceItem) => {
|
|
687
|
-
var _a, _b;
|
|
688
|
-
return (_b = (_a = getWalletGrants(config, walletBalanceItem).find(
|
|
689
|
-
({ credits_grant }) => credits_grant == null ? void 0 : credits_grant.conversion
|
|
690
|
-
)) == null ? void 0 : _a.credits_grant) == null ? void 0 : _b.conversion;
|
|
691
|
-
};
|
|
692
|
-
const getGrantedCredits = (config, walletBalanceItem) => {
|
|
693
|
-
var _a, _b;
|
|
694
|
-
return (_b = (_a = getWalletGrants(config, walletBalanceItem).find(({ credits_grant }) => credits_grant == null ? void 0 : credits_grant.credits)) == null ? void 0 : _a.credits_grant) == null ? void 0 : _b.credits;
|
|
695
|
-
};
|
|
696
|
-
const toCreditsValue = (quantity, walletCredits) => ({ credits: { ...walletCredits, quantity } });
|
|
697
|
-
const toCreditsQuantity = (quantity, rate) => {
|
|
698
|
-
const parsedQuantity = Number(quantity);
|
|
699
|
-
const parsedRate = Number(rate);
|
|
700
|
-
return Number.isFinite(parsedQuantity) && Number.isFinite(parsedRate) ? String(parsedQuantity * parsedRate) : void 0;
|
|
701
|
-
};
|
|
702
|
-
function getFlexiblePricing(config, walletBalanceItem) {
|
|
703
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
704
|
-
if (!config.on_demand || !isFlexiblePricing(config)) {
|
|
705
|
-
return void 0;
|
|
706
|
-
}
|
|
707
|
-
const band = (_b = (_a = config.details) == null ? void 0 : _a.bands) == null ? void 0 : _b[0];
|
|
708
|
-
const currency = ((_c = band == null ? void 0 : band.minimum_amount) == null ? void 0 : _c.currency) ?? ((_d = band == null ? void 0 : band.maximum_amount) == null ? void 0 : _d.currency) ?? ((_f = (_e = walletBalanceItem == null ? void 0 : walletBalanceItem.wallet_balance.balance) == null ? void 0 : _e.amount) == null ? void 0 : _f.currency);
|
|
709
|
-
if (!currency) {
|
|
710
|
-
return void 0;
|
|
711
|
-
}
|
|
712
|
-
const credits = getWalletCredits(walletBalanceItem);
|
|
713
|
-
const conversion = credits ? getCreditsConversion(config, walletBalanceItem) : void 0;
|
|
714
|
-
const unitName = (_g = credits == null ? void 0 : credits.credit_type) == null ? void 0 : _g.unit_name;
|
|
715
|
-
const toBound = (amount) => {
|
|
716
|
-
if (!amount) {
|
|
717
|
-
return void 0;
|
|
718
|
-
}
|
|
719
|
-
const quantity = credits && conversion ? toCreditsQuantity(amount.quantity, conversion.rate) : void 0;
|
|
720
|
-
return quantity !== void 0 && credits ? toCreditsValue(quantity, credits) : { amount };
|
|
721
|
-
};
|
|
722
|
-
return {
|
|
723
|
-
config: {
|
|
724
|
-
...(band == null ? void 0 : band.minimum_amount) && { minimum_amount: band.minimum_amount },
|
|
725
|
-
...(band == null ? void 0 : band.maximum_amount) && { maximum_amount: band.maximum_amount }
|
|
726
|
-
},
|
|
727
|
-
currency,
|
|
728
|
-
...conversion && {
|
|
729
|
-
creditsConfiguration: {
|
|
730
|
-
conversionRate: conversion.rate,
|
|
731
|
-
...(unitName == null ? void 0 : unitName.singular) && { unitNameSingle: unitName.singular },
|
|
732
|
-
...(unitName == null ? void 0 : unitName.plural) && { unitNamePlural: unitName.plural }
|
|
733
|
-
}
|
|
734
|
-
},
|
|
735
|
-
bounds: {
|
|
736
|
-
...toBound(band == null ? void 0 : band.minimum_amount) && { minimum: toBound(band == null ? void 0 : band.minimum_amount) },
|
|
737
|
-
...toBound(band == null ? void 0 : band.maximum_amount) && { maximum: toBound(band == null ? void 0 : band.maximum_amount) }
|
|
738
|
-
}
|
|
739
|
-
};
|
|
740
|
-
}
|
|
741
|
-
const isCreditBasedTopUp = (item) => {
|
|
742
|
-
var _a, _b, _c, _d, _e;
|
|
743
|
-
return !!((_a = item.fixedPricing) == null ? void 0 : _a.value.credits) || !!((_b = item.flexiblePricing) == null ? void 0 : _b.creditsConfiguration) || !!((_e = ((_c = item.flexiblePricing) == null ? void 0 : _c.bounds.minimum) ?? ((_d = item.flexiblePricing) == null ? void 0 : _d.bounds.maximum)) == null ? void 0 : _e.credits);
|
|
744
|
-
};
|
|
745
|
-
const getCreditTypeId = (items) => {
|
|
746
|
-
var _a;
|
|
747
|
-
for (const { fixedPricing, flexiblePricing } of items) {
|
|
748
|
-
const credits = (fixedPricing == null ? void 0 : fixedPricing.value.credits) ?? ((_a = (flexiblePricing == null ? void 0 : flexiblePricing.bounds.minimum) ?? (flexiblePricing == null ? void 0 : flexiblePricing.bounds.maximum)) == null ? void 0 : _a.credits);
|
|
749
|
-
if (credits == null ? void 0 : credits.credit_type_id) {
|
|
750
|
-
return credits.credit_type_id;
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
return void 0;
|
|
754
|
-
};
|
|
755
|
-
const getAutoTopUpChargeCurrency = (items = []) => {
|
|
756
|
-
for (const { flexiblePricing, fixedPricing } of items) {
|
|
757
|
-
const currency = (flexiblePricing == null ? void 0 : flexiblePricing.currency) ?? (fixedPricing == null ? void 0 : fixedPricing.amount.currency);
|
|
758
|
-
if (currency) {
|
|
759
|
-
return currency;
|
|
760
|
-
}
|
|
761
|
-
}
|
|
762
|
-
return void 0;
|
|
763
|
-
};
|
|
764
|
-
const getAutoTopUpCreditUnitName = (items = []) => {
|
|
765
|
-
var _a, _b, _c;
|
|
766
|
-
for (const { fixedPricing, flexiblePricing } of items) {
|
|
767
|
-
const credits = (fixedPricing == null ? void 0 : fixedPricing.value.credits) ?? ((_a = (flexiblePricing == null ? void 0 : flexiblePricing.bounds.minimum) ?? (flexiblePricing == null ? void 0 : flexiblePricing.bounds.maximum)) == null ? void 0 : _a.credits);
|
|
768
|
-
if ((_c = (_b = credits == null ? void 0 : credits.credit_type) == null ? void 0 : _b.unit_name) == null ? void 0 : _c.plural) {
|
|
769
|
-
return credits.credit_type.unit_name.plural;
|
|
770
|
-
}
|
|
771
|
-
}
|
|
772
|
-
return void 0;
|
|
773
|
-
};
|
|
774
|
-
const getAutoTopUpConversionRate = (items = []) => {
|
|
775
|
-
var _a;
|
|
776
|
-
for (const { flexiblePricing } of items) {
|
|
777
|
-
const rate = (_a = flexiblePricing == null ? void 0 : flexiblePricing.creditsConfiguration) == null ? void 0 : _a.conversionRate;
|
|
778
|
-
if (rate) {
|
|
779
|
-
return rate;
|
|
780
|
-
}
|
|
781
|
-
}
|
|
782
|
-
return void 0;
|
|
783
|
-
};
|
|
784
|
-
const getAutoTopUpBounds = (items = []) => {
|
|
785
|
-
for (const { flexiblePricing } of items) {
|
|
786
|
-
const { minimum_amount: minimum, maximum_amount: maximum } = (flexiblePricing == null ? void 0 : flexiblePricing.config) ?? {};
|
|
787
|
-
if (minimum || maximum) {
|
|
788
|
-
return { ...minimum && { minimum }, ...maximum && { maximum } };
|
|
789
|
-
}
|
|
790
|
-
}
|
|
791
|
-
return {};
|
|
792
|
-
};
|
|
793
|
-
const getAutoTopUpDenomination = (items = []) => {
|
|
794
|
-
if (items.some(isCreditBasedTopUp)) {
|
|
795
|
-
const creditTypeId = getCreditTypeId(items);
|
|
796
|
-
return creditTypeId ? { creditTypeId } : void 0;
|
|
797
|
-
}
|
|
798
|
-
for (const { flexiblePricing, fixedPricing } of items) {
|
|
799
|
-
const currency = (flexiblePricing == null ? void 0 : flexiblePricing.currency) ?? (fixedPricing == null ? void 0 : fixedPricing.amount.currency);
|
|
800
|
-
if (currency) {
|
|
801
|
-
return { currency };
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
return void 0;
|
|
805
|
-
};
|
|
806
|
-
const getTopUpValue = (item, amount) => {
|
|
807
|
-
var _a;
|
|
808
|
-
if (item.fixedPricing) {
|
|
809
|
-
return item.fixedPricing.value;
|
|
810
|
-
}
|
|
811
|
-
if (!item.flexiblePricing || !amount) {
|
|
812
|
-
return void 0;
|
|
813
|
-
}
|
|
814
|
-
const { bounds, creditsConfiguration } = item.flexiblePricing;
|
|
815
|
-
const credits = (_a = bounds.minimum ?? bounds.maximum) == null ? void 0 : _a.credits;
|
|
816
|
-
const quantity = creditsConfiguration ? toCreditsQuantity(amount.quantity, creditsConfiguration.conversionRate) : void 0;
|
|
817
|
-
return credits && quantity !== void 0 ? toCreditsValue(quantity, credits) : { amount };
|
|
818
|
-
};
|
|
819
|
-
const getAutoTopUpEditorConfig = (items = []) => {
|
|
820
|
-
const denomination = getAutoTopUpDenomination(items);
|
|
821
|
-
if (!denomination) {
|
|
822
|
-
return void 0;
|
|
823
|
-
}
|
|
824
|
-
return {
|
|
825
|
-
denomination,
|
|
826
|
-
chargeCurrency: getAutoTopUpChargeCurrency(items) ?? "",
|
|
827
|
-
creditUnitName: getAutoTopUpCreditUnitName(items),
|
|
828
|
-
conversionRate: getAutoTopUpConversionRate(items),
|
|
829
|
-
topUpBounds: getAutoTopUpBounds(items)
|
|
830
|
-
};
|
|
831
|
-
};
|
|
832
|
-
const PREVIEW_DEBOUNCE_MS = 400;
|
|
833
|
-
function useTopUpInvoicePreview({
|
|
834
|
-
pricingPlanScheduleId,
|
|
835
|
-
pricingItems
|
|
836
|
-
}) {
|
|
837
|
-
const { previewChargeOnDemandPricingItems } = createInvoicesService();
|
|
838
|
-
const logger = useLogger();
|
|
839
|
-
const invoicePreview = ref();
|
|
840
|
-
const isPreviewPending = ref(false);
|
|
841
|
-
const latestGuard = createLatestGuard();
|
|
842
|
-
const loadPreview = async () => {
|
|
843
|
-
const scheduleId = pricingPlanScheduleId.value;
|
|
844
|
-
const isLatest = latestGuard();
|
|
845
|
-
if (!scheduleId || !pricingItems.value) {
|
|
846
|
-
if (pricingItems.value && !scheduleId) {
|
|
847
|
-
logger.warn(
|
|
848
|
-
"INVOICE_PREVIEW_SKIPPED",
|
|
849
|
-
"Skipped the top-up invoice preview: no schedule to charge it on",
|
|
850
|
-
{ missing: ["pricingPlanScheduleId"] }
|
|
851
|
-
);
|
|
852
|
-
}
|
|
853
|
-
invoicePreview.value = void 0;
|
|
854
|
-
isPreviewPending.value = false;
|
|
855
|
-
return;
|
|
856
|
-
}
|
|
857
|
-
isPreviewPending.value = true;
|
|
858
|
-
try {
|
|
859
|
-
const invoice = await previewChargeOnDemandPricingItems({
|
|
860
|
-
pricingPlanScheduleId: scheduleId,
|
|
861
|
-
pricingItems: pricingItems.value
|
|
862
|
-
});
|
|
863
|
-
if (isLatest()) {
|
|
864
|
-
invoicePreview.value = invoice;
|
|
865
|
-
}
|
|
866
|
-
} catch (error) {
|
|
867
|
-
if (isLatest()) {
|
|
868
|
-
invoicePreview.value = void 0;
|
|
869
|
-
}
|
|
870
|
-
logger.error(
|
|
871
|
-
"INVOICE_PREVIEW_FAILED",
|
|
872
|
-
"Failed to load top-up invoice preview",
|
|
873
|
-
{},
|
|
874
|
-
error
|
|
875
|
-
);
|
|
876
|
-
} finally {
|
|
877
|
-
if (isLatest()) {
|
|
878
|
-
isPreviewPending.value = false;
|
|
879
|
-
}
|
|
880
|
-
}
|
|
881
|
-
};
|
|
882
|
-
useWatchDebounced(pricingItems, () => void loadPreview(), {
|
|
883
|
-
debounce: PREVIEW_DEBOUNCE_MS,
|
|
884
|
-
deep: true
|
|
885
|
-
});
|
|
886
|
-
void loadPreview();
|
|
887
|
-
return { invoicePreview, isPreviewPending, loadPreview };
|
|
888
|
-
}
|
|
889
|
-
const _hoisted_1$9 = { key: 0 };
|
|
890
|
-
const _sfc_main$b = /* @__PURE__ */ defineComponent({
|
|
891
|
-
__name: "TopUpInvoicePreview",
|
|
892
|
-
props: {
|
|
893
|
-
pricingPlanScheduleId: { type: String },
|
|
894
|
-
pricingItems: { type: Array }
|
|
895
|
-
},
|
|
896
|
-
setup(__props) {
|
|
897
|
-
const props = __props;
|
|
898
|
-
const { $t } = useIntl();
|
|
899
|
-
const pricingPlanScheduleId = computed(() => props.pricingPlanScheduleId);
|
|
900
|
-
const pricingItems = computed(() => props.pricingItems);
|
|
901
|
-
const { invoicePreview } = useTopUpInvoicePreview({ pricingPlanScheduleId, pricingItems });
|
|
902
|
-
return (_ctx, _cache) => {
|
|
903
|
-
return openBlock(), createBlock(_sfc_main$l, {
|
|
904
|
-
class: "sv-top-up-invoice-preview h-[152px]",
|
|
905
|
-
"data-testid": "top-up-invoice-preview-skeleton"
|
|
906
|
-
}, {
|
|
907
|
-
default: withCtx(() => [
|
|
908
|
-
unref(invoicePreview) ? (openBlock(), createElementBlock("div", _hoisted_1$9, [
|
|
909
|
-
createVNode(unref(_sfc_main$m), { required: "" }, {
|
|
910
|
-
default: withCtx(() => [
|
|
911
|
-
createTextVNode(toDisplayString(unref($t)({
|
|
912
|
-
defaultMessage: "You will pay",
|
|
913
|
-
description: "Label above the preview of what topping up will be invoiced for",
|
|
914
|
-
id: "topup_modal.invoice_preview.label"
|
|
915
|
-
})), 1)
|
|
916
|
-
]),
|
|
917
|
-
_: 1
|
|
918
|
-
}),
|
|
919
|
-
createVNode(unref(_sfc_main$k), { "content-background": "none" }, {
|
|
920
|
-
default: withCtx(() => [
|
|
921
|
-
createVNode(unref(_sfc_main$n), {
|
|
922
|
-
invoice: unref(invoicePreview),
|
|
923
|
-
"is-customer-facing": ""
|
|
924
|
-
}, null, 8, ["invoice"])
|
|
925
|
-
]),
|
|
926
|
-
_: 1
|
|
927
|
-
})
|
|
928
|
-
])) : createCommentVNode("", true)
|
|
929
|
-
]),
|
|
930
|
-
_: 1
|
|
931
|
-
});
|
|
932
|
-
};
|
|
933
|
-
}
|
|
934
|
-
});
|
|
935
|
-
const getThresholdUnit = (denomination, creditUnitName) => denomination.currency ?? creditUnitName ?? denomination.creditTypeId ?? "";
|
|
936
|
-
const toInputValue = (quantity, unit) => ({
|
|
937
|
-
quantity: quantity ?? null,
|
|
938
|
-
currency: unit
|
|
939
|
-
});
|
|
940
|
-
const toFormState = (rule, { denomination, chargeCurrency, creditUnitName, minimumTopUp }) => {
|
|
941
|
-
var _a, _b, _c, _d, _e;
|
|
942
|
-
return {
|
|
943
|
-
enabled: (rule == null ? void 0 : rule.status) === "ACTIVE",
|
|
944
|
-
threshold: toInputValue(
|
|
945
|
-
((_b = (_a = rule == null ? void 0 : rule.threshold) == null ? void 0 : _a.amount) == null ? void 0 : _b.quantity) ?? ((_d = (_c = rule == null ? void 0 : rule.threshold) == null ? void 0 : _c.credits) == null ? void 0 : _d.quantity),
|
|
946
|
-
getThresholdUnit(denomination, creditUnitName)
|
|
947
|
-
),
|
|
948
|
-
topUpAmount: toInputValue(((_e = rule == null ? void 0 : rule.topup_amount) == null ? void 0 : _e.quantity) ?? minimumTopUp, chargeCurrency)
|
|
949
|
-
};
|
|
950
|
-
};
|
|
951
|
-
const toThreshold = (state, denomination) => {
|
|
952
|
-
var _a;
|
|
953
|
-
const quantity = (_a = state.threshold) == null ? void 0 : _a.quantity;
|
|
954
|
-
if (!quantity) {
|
|
955
|
-
return {};
|
|
956
|
-
}
|
|
957
|
-
return denomination.creditTypeId ? { credits: { quantity, credit_type_id: denomination.creditTypeId } } : { amount: { quantity, currency: denomination.currency ?? "" } };
|
|
958
|
-
};
|
|
959
|
-
const toTopUpAmount = (state, chargeCurrency) => {
|
|
960
|
-
var _a;
|
|
961
|
-
return ((_a = state.topUpAmount) == null ? void 0 : _a.quantity) ? {
|
|
962
|
-
quantity: state.topUpAmount.quantity,
|
|
963
|
-
currency: state.topUpAmount.currency ?? chargeCurrency
|
|
964
|
-
} : void 0;
|
|
965
|
-
};
|
|
966
|
-
const toAutoTopUpRule$1 = (state, { denomination, chargeCurrency }) => ({
|
|
967
|
-
status: state.enabled ? "ACTIVE" : "INACTIVE",
|
|
968
|
-
threshold: toThreshold(state, denomination),
|
|
969
|
-
...toTopUpAmount(state, chargeCurrency) && {
|
|
970
|
-
topup_amount: toTopUpAmount(state, chargeCurrency)
|
|
971
|
-
}
|
|
972
|
-
});
|
|
973
|
-
const normalizeAutoTopUpRule = (rule, context) => toAutoTopUpRule$1(toFormState(rule, context), context);
|
|
974
|
-
const isSameAutoTopUpRule = (a, b) => JSON.stringify(a) === JSON.stringify(b);
|
|
975
|
-
const toQuantity = (value) => {
|
|
976
|
-
const quantity = Number(value == null ? void 0 : value.quantity);
|
|
977
|
-
return (value == null ? void 0 : value.quantity) && Number.isFinite(quantity) ? quantity : void 0;
|
|
978
|
-
};
|
|
979
|
-
const isAtLeastMinimum = (value, minimum) => {
|
|
980
|
-
const bound = Number(minimum == null ? void 0 : minimum.quantity);
|
|
981
|
-
return value === null || !(minimum == null ? void 0 : minimum.quantity) || !Number.isFinite(bound) || value >= bound;
|
|
982
|
-
};
|
|
983
|
-
const isWithinMaximum = (value, maximum) => {
|
|
984
|
-
const bound = Number(maximum == null ? void 0 : maximum.quantity);
|
|
985
|
-
return value === null || !(maximum == null ? void 0 : maximum.quantity) || !Number.isFinite(bound) || value <= bound;
|
|
986
|
-
};
|
|
987
|
-
const toNumber = (quantity) => {
|
|
988
|
-
const parsed = Number(quantity);
|
|
989
|
-
return quantity !== null && quantity !== void 0 && quantity !== "" && Number.isFinite(parsed) ? parsed : void 0;
|
|
990
|
-
};
|
|
991
|
-
const toConvertedQuantity = (quantity, base, conversionRate) => {
|
|
992
|
-
const value = toNumber(quantity);
|
|
993
|
-
const rate = toNumber(conversionRate);
|
|
994
|
-
if (value === void 0 || rate === void 0 || rate <= 0) {
|
|
995
|
-
return void 0;
|
|
996
|
-
}
|
|
997
|
-
return base === "CREDITS" ? value / rate : value * rate;
|
|
998
|
-
};
|
|
999
|
-
const toOtherBase = (quantity, from, to, conversionRate) => from === to ? toNumber(quantity) : toConvertedQuantity(quantity, from, conversionRate);
|
|
1000
|
-
const toBaseQuantity = (quantity, base, conversionRate) => base === "CREDITS" ? toConvertedQuantity(quantity, "AMOUNT", conversionRate) : toNumber(quantity);
|
|
1001
|
-
const toMoneyQuantity = (value) => value.toFixed(2);
|
|
1002
|
-
const toFieldQuantity = (value, base) => base === "AMOUNT" ? toMoneyQuantity(value) : String(Number(value.toFixed(6)));
|
|
1003
|
-
const toBoundQuantity = (bound, base, conversionRate, formatNumber) => {
|
|
1004
|
-
const quantity = toBaseQuantity(bound == null ? void 0 : bound.quantity, base, conversionRate);
|
|
1005
|
-
if (quantity === void 0) {
|
|
1006
|
-
return void 0;
|
|
1007
|
-
}
|
|
1008
|
-
return base === "CREDITS" ? formatNumber(quantity) : toMoneyQuantity(quantity);
|
|
1009
|
-
};
|
|
1010
|
-
const _hoisted_1$8 = ["data-testid"];
|
|
1011
|
-
const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
1012
|
-
__name: "ConvertedAmountInput",
|
|
1013
|
-
props: /* @__PURE__ */ mergeModels({
|
|
1014
|
-
unit: { type: String },
|
|
1015
|
-
modelBase: { type: String },
|
|
1016
|
-
entryBase: { type: String },
|
|
1017
|
-
conversionRate: { type: String },
|
|
1018
|
-
showConversionHint: { type: Boolean },
|
|
1019
|
-
currency: { type: String },
|
|
1020
|
-
creditUnitName: { type: String },
|
|
1021
|
-
bounds: { type: Object },
|
|
1022
|
-
label: { type: String },
|
|
1023
|
-
name: { type: String },
|
|
1024
|
-
required: { type: Boolean },
|
|
1025
|
-
disabled: { type: Boolean },
|
|
1026
|
-
error: { type: [String, Object, Array] }
|
|
1027
|
-
}, {
|
|
1028
|
-
"modelValue": { default: "" },
|
|
1029
|
-
"modelModifiers": {}
|
|
1030
|
-
}),
|
|
1031
|
-
emits: ["update:modelValue"],
|
|
1032
|
-
setup(__props) {
|
|
1033
|
-
const props = __props;
|
|
1034
|
-
const model = useModel(__props, "modelValue");
|
|
1035
|
-
const { $t, formatNumber } = useIntl();
|
|
1036
|
-
const entryBase = computed(() => props.entryBase ?? props.modelBase);
|
|
1037
|
-
const isConverted = computed(
|
|
1038
|
-
() => entryBase.value !== props.modelBase && toNumber(props.conversionRate) !== void 0
|
|
1039
|
-
);
|
|
1040
|
-
const entered = ref("");
|
|
1041
|
-
watch(
|
|
1042
|
-
() => [model.value, entryBase.value, props.modelBase, props.conversionRate],
|
|
1043
|
-
([quantity]) => {
|
|
1044
|
-
if (!isConverted.value) {
|
|
1045
|
-
entered.value = quantity ?? "";
|
|
1046
|
-
return;
|
|
1047
|
-
}
|
|
1048
|
-
if (quantity === toEnteredAsModel(entered.value)) {
|
|
1049
|
-
return;
|
|
1050
|
-
}
|
|
1051
|
-
const converted = toOtherBase(
|
|
1052
|
-
quantity,
|
|
1053
|
-
props.modelBase,
|
|
1054
|
-
entryBase.value,
|
|
1055
|
-
props.conversionRate
|
|
1056
|
-
);
|
|
1057
|
-
entered.value = converted === void 0 ? "" : toFieldQuantity(converted, entryBase.value);
|
|
1058
|
-
},
|
|
1059
|
-
{ immediate: true }
|
|
1060
|
-
);
|
|
1061
|
-
function toEnteredText(quantity) {
|
|
1062
|
-
if (typeof quantity === "string") {
|
|
1063
|
-
return quantity;
|
|
1064
|
-
}
|
|
1065
|
-
return typeof quantity === "number" ? String(quantity) : "";
|
|
1066
|
-
}
|
|
1067
|
-
function toEnteredAsModel(quantity) {
|
|
1068
|
-
const converted = toOtherBase(quantity, entryBase.value, props.modelBase, props.conversionRate);
|
|
1069
|
-
return converted === void 0 ? "" : toFieldQuantity(converted, props.modelBase);
|
|
1070
|
-
}
|
|
1071
|
-
const enteredQuantity = computed({
|
|
1072
|
-
get: () => entered.value,
|
|
1073
|
-
set: (quantity) => {
|
|
1074
|
-
entered.value = toEnteredText(quantity);
|
|
1075
|
-
model.value = isConverted.value ? toEnteredAsModel(entered.value) : entered.value;
|
|
1076
|
-
}
|
|
1077
|
-
});
|
|
1078
|
-
const convertedQuantity = computed(
|
|
1079
|
-
() => toConvertedQuantity(entered.value, entryBase.value, props.conversionRate)
|
|
1080
|
-
);
|
|
1081
|
-
const creditUnitName = computed(() => {
|
|
1082
|
-
if (props.creditUnitName) {
|
|
1083
|
-
return props.creditUnitName;
|
|
1084
|
-
}
|
|
1085
|
-
return entryBase.value === "CREDITS" ? props.unit : $t({
|
|
1086
|
-
defaultMessage: "credits",
|
|
1087
|
-
description: "Generic name for a wallet credit, where its credit type does not name one",
|
|
1088
|
-
id: "converted_amount_input.credits"
|
|
1089
|
-
});
|
|
1090
|
-
});
|
|
1091
|
-
const formatMoney = (quantity, currency) => formatAmount({ quantity: toMoneyQuantity(quantity), currency });
|
|
1092
|
-
const formatCredits = (quantity) => `${formatNumber(quantity)} ${creditUnitName.value}`;
|
|
1093
|
-
const hasError = computed(() => {
|
|
1094
|
-
const error = props.error;
|
|
1095
|
-
if (Array.isArray(error)) {
|
|
1096
|
-
return error.length > 0;
|
|
1097
|
-
}
|
|
1098
|
-
return Boolean(isRef(error) ? error.value : error);
|
|
1099
|
-
});
|
|
1100
|
-
const helperText = computed(() => {
|
|
1101
|
-
const converted = convertedQuantity.value;
|
|
1102
|
-
if (hasError.value || !props.showConversionHint || converted === void 0) {
|
|
1103
|
-
return void 0;
|
|
1104
|
-
}
|
|
1105
|
-
if (entryBase.value === "CREDITS") {
|
|
1106
|
-
return props.currency ? $t(
|
|
1107
|
-
{
|
|
1108
|
-
defaultMessage: "Will cost {amount} excluding taxes",
|
|
1109
|
-
description: "Helper text under a credits field, naming what those credits cost in money",
|
|
1110
|
-
id: "converted_amount_input.cost"
|
|
1111
|
-
},
|
|
1112
|
-
{ amount: formatMoney(converted, props.currency) }
|
|
1113
|
-
) : void 0;
|
|
1114
|
-
}
|
|
1115
|
-
return $t(
|
|
1116
|
-
{
|
|
1117
|
-
defaultMessage: "Buys about {credits}",
|
|
1118
|
-
description: "Helper text under a money field, naming the credits that amount converts into",
|
|
1119
|
-
id: "converted_amount_input.buys"
|
|
1120
|
-
},
|
|
1121
|
-
{ credits: formatCredits(converted) }
|
|
1122
|
-
);
|
|
1123
|
-
});
|
|
1124
|
-
const toBound = (bound) => toBoundQuantity(bound, entryBase.value, props.conversionRate, formatNumber);
|
|
1125
|
-
const boundsUnit = computed(
|
|
1126
|
-
() => {
|
|
1127
|
-
var _a, _b, _c, _d;
|
|
1128
|
-
return entryBase.value === "CREDITS" ? creditUnitName.value : ((_b = (_a = props.bounds) == null ? void 0 : _a.minimum) == null ? void 0 : _b.currency) ?? ((_d = (_c = props.bounds) == null ? void 0 : _c.maximum) == null ? void 0 : _d.currency) ?? props.unit;
|
|
1129
|
-
}
|
|
1130
|
-
);
|
|
1131
|
-
const boundsText = computed(() => {
|
|
1132
|
-
var _a, _b;
|
|
1133
|
-
const minimum = toBound((_a = props.bounds) == null ? void 0 : _a.minimum);
|
|
1134
|
-
const maximum = toBound((_b = props.bounds) == null ? void 0 : _b.maximum);
|
|
1135
|
-
const unit = boundsUnit.value;
|
|
1136
|
-
if (minimum && maximum) {
|
|
1137
|
-
return $t(
|
|
1138
|
-
{
|
|
1139
|
-
defaultMessage: "Between {minimum} and {maximum} {unit}",
|
|
1140
|
-
description: "Range of what a flexible top-up may be charged for, beside its label",
|
|
1141
|
-
id: "converted_amount_input.bounds.range"
|
|
1142
|
-
},
|
|
1143
|
-
{ minimum, maximum, unit }
|
|
1144
|
-
);
|
|
1145
|
-
}
|
|
1146
|
-
if (minimum) {
|
|
1147
|
-
return $t(
|
|
1148
|
-
{
|
|
1149
|
-
defaultMessage: "At least {minimum} {unit}",
|
|
1150
|
-
description: "Smallest amount a flexible top-up may be charged for, beside its label",
|
|
1151
|
-
id: "converted_amount_input.bounds.minimum"
|
|
1152
|
-
},
|
|
1153
|
-
{ minimum, unit }
|
|
1154
|
-
);
|
|
1155
|
-
}
|
|
1156
|
-
if (maximum) {
|
|
1157
|
-
return $t(
|
|
1158
|
-
{
|
|
1159
|
-
defaultMessage: "Up to {maximum} {unit}",
|
|
1160
|
-
description: "Largest amount a flexible top-up may be charged for, beside its label",
|
|
1161
|
-
id: "converted_amount_input.bounds.maximum"
|
|
1162
|
-
},
|
|
1163
|
-
{ maximum, unit }
|
|
1164
|
-
);
|
|
1165
|
-
}
|
|
1166
|
-
return void 0;
|
|
1167
|
-
});
|
|
1168
|
-
return (_ctx, _cache) => {
|
|
1169
|
-
return openBlock(), createBlock(unref(_sfc_main$o), {
|
|
1170
|
-
modelValue: enteredQuantity.value,
|
|
1171
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => enteredQuantity.value = $event),
|
|
1172
|
-
class: "sv-converted-amount-input",
|
|
1173
|
-
type: "number",
|
|
1174
|
-
"as-text-type": "",
|
|
1175
|
-
name: __props.name,
|
|
1176
|
-
label: __props.label,
|
|
1177
|
-
required: __props.required,
|
|
1178
|
-
disabled: __props.disabled,
|
|
1179
|
-
error: __props.error
|
|
1180
|
-
}, createSlots({
|
|
1181
|
-
suffix: withCtx(() => [
|
|
1182
|
-
createElementVNode("span", {
|
|
1183
|
-
"data-testid": `${__props.name}-unit`
|
|
1184
|
-
}, toDisplayString(__props.unit), 9, _hoisted_1$8)
|
|
1185
|
-
]),
|
|
1186
|
-
_: 2
|
|
1187
|
-
}, [
|
|
1188
|
-
boundsText.value ? {
|
|
1189
|
-
name: "label-suffix",
|
|
1190
|
-
fn: withCtx(() => [
|
|
1191
|
-
createVNode(unref(_sfc_main$h), {
|
|
1192
|
-
tag: "span",
|
|
1193
|
-
variant: "body-xs",
|
|
1194
|
-
color: "subtle",
|
|
1195
|
-
"no-spacing": "",
|
|
1196
|
-
"data-testid": `${__props.name}-bounds`
|
|
1197
|
-
}, {
|
|
1198
|
-
default: withCtx(() => [
|
|
1199
|
-
createTextVNode(toDisplayString(boundsText.value), 1)
|
|
1200
|
-
]),
|
|
1201
|
-
_: 1
|
|
1202
|
-
}, 8, ["data-testid"])
|
|
1203
|
-
]),
|
|
1204
|
-
key: "0"
|
|
1205
|
-
} : void 0,
|
|
1206
|
-
helperText.value ? {
|
|
1207
|
-
name: "helper",
|
|
1208
|
-
fn: withCtx(() => [
|
|
1209
|
-
createVNode(unref(_sfc_main$h), {
|
|
1210
|
-
tag: "span",
|
|
1211
|
-
variant: "body-xs",
|
|
1212
|
-
color: "subtle",
|
|
1213
|
-
"no-spacing": "",
|
|
1214
|
-
"data-testid": `${__props.name}-conversion`
|
|
1215
|
-
}, {
|
|
1216
|
-
default: withCtx(() => [
|
|
1217
|
-
createTextVNode(toDisplayString(helperText.value), 1)
|
|
1218
|
-
]),
|
|
1219
|
-
_: 1
|
|
1220
|
-
}, 8, ["data-testid"])
|
|
1221
|
-
]),
|
|
1222
|
-
key: "1"
|
|
1223
|
-
} : void 0
|
|
1224
|
-
]), 1032, ["modelValue", "name", "label", "required", "disabled", "error"]);
|
|
1225
|
-
};
|
|
1226
|
-
}
|
|
1227
|
-
});
|
|
1228
|
-
const _sfc_main$9 = /* @__PURE__ */ defineComponent({
|
|
1229
|
-
__name: "Section",
|
|
1230
|
-
props: {
|
|
1231
|
-
emphasized: { type: Boolean, default: false },
|
|
1232
|
-
contentClasses: { type: String },
|
|
1233
|
-
contentBackground: { type: String },
|
|
1234
|
-
title: { type: String },
|
|
1235
|
-
noSpacing: { type: Boolean },
|
|
1236
|
-
hasError: { type: Boolean },
|
|
1237
|
-
noBorder: { type: Boolean }
|
|
1238
|
-
},
|
|
1239
|
-
setup(__props) {
|
|
1240
|
-
const props = __props;
|
|
1241
|
-
const ACCENT = [
|
|
1242
|
-
"sv-section__accent relative",
|
|
1243
|
-
"before:absolute before:inset-y-0.5 before:left-0.5 before:w-0.5",
|
|
1244
|
-
"before:rounded-full before:bg-primary-600"
|
|
1245
|
-
].join(" ");
|
|
1246
|
-
const contentClasses = computed(
|
|
1247
|
-
() => [props.emphasized ? ACCENT : void 0, props.contentClasses].filter(Boolean).join(" ")
|
|
1248
|
-
);
|
|
1249
|
-
const sectionProps = computed(() => {
|
|
1250
|
-
const { emphasized: _emphasized, ...rest } = props;
|
|
1251
|
-
return rest;
|
|
1252
|
-
});
|
|
1253
|
-
return (_ctx, _cache) => {
|
|
1254
|
-
return openBlock(), createBlock(unref(_sfc_main$k), mergeProps(sectionProps.value, {
|
|
1255
|
-
class: "sv-section",
|
|
1256
|
-
"content-classes": contentClasses.value
|
|
1257
|
-
}), createSlots({
|
|
1258
|
-
default: withCtx(() => [
|
|
1259
|
-
renderSlot(_ctx.$slots, "default")
|
|
1260
|
-
]),
|
|
1261
|
-
_: 2
|
|
1262
|
-
}, [
|
|
1263
|
-
_ctx.$slots.right ? {
|
|
1264
|
-
name: "right",
|
|
1265
|
-
fn: withCtx(() => [
|
|
1266
|
-
renderSlot(_ctx.$slots, "right")
|
|
1267
|
-
]),
|
|
1268
|
-
key: "0"
|
|
1269
|
-
} : void 0
|
|
1270
|
-
]), 1040, ["content-classes"]);
|
|
1271
|
-
};
|
|
1272
|
-
}
|
|
1273
|
-
});
|
|
1274
|
-
const _hoisted_1$7 = { class: "flex grow flex-col" };
|
|
1275
|
-
const _sfc_main$8 = /* @__PURE__ */ defineComponent({
|
|
1276
|
-
__name: "AutoTopUpConfig",
|
|
1277
|
-
props: {
|
|
1278
|
-
config: { type: Object },
|
|
1279
|
-
denomination: { type: Object },
|
|
1280
|
-
creditUnitName: { type: String },
|
|
1281
|
-
chargeCurrency: { type: String },
|
|
1282
|
-
conversionRate: { type: String },
|
|
1283
|
-
topUpBounds: { type: Object },
|
|
1284
|
-
showThresholdConversion: { type: Boolean, default: true },
|
|
1285
|
-
contained: { type: Boolean },
|
|
1286
|
-
alwaysEnabled: { type: Boolean },
|
|
1287
|
-
disabled: { type: Boolean }
|
|
1288
|
-
},
|
|
1289
|
-
emits: ["save"],
|
|
1290
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1291
|
-
const props = __props;
|
|
1292
|
-
const emit = __emit;
|
|
1293
|
-
const { $t, formatNumber } = useIntl();
|
|
1294
|
-
const formContext = computed(() => {
|
|
1295
|
-
var _a, _b;
|
|
1296
|
-
return {
|
|
1297
|
-
denomination: props.denomination,
|
|
1298
|
-
chargeCurrency: props.chargeCurrency,
|
|
1299
|
-
creditUnitName: props.creditUnitName,
|
|
1300
|
-
minimumTopUp: (_b = (_a = props.topUpBounds) == null ? void 0 : _a.minimum) == null ? void 0 : _b.quantity
|
|
1301
|
-
};
|
|
1302
|
-
});
|
|
1303
|
-
const model = ref(toFormState(props.config, formContext.value));
|
|
1304
|
-
const entryUnit = computed(() => getThresholdUnit(props.denomination, props.creditUnitName));
|
|
1305
|
-
const entryBase = computed(
|
|
1306
|
-
() => props.denomination.creditTypeId ? "CREDITS" : "AMOUNT"
|
|
1307
|
-
);
|
|
1308
|
-
const topUpUnit = computed(
|
|
1309
|
-
() => entryBase.value === "CREDITS" ? entryUnit.value : props.chargeCurrency
|
|
1310
|
-
);
|
|
1311
|
-
const thresholdQuantity = computed({
|
|
1312
|
-
get: () => {
|
|
1313
|
-
var _a;
|
|
1314
|
-
return ((_a = model.value.threshold) == null ? void 0 : _a.quantity) ?? "";
|
|
1315
|
-
},
|
|
1316
|
-
set: (quantity) => {
|
|
1317
|
-
model.value.threshold = { quantity: quantity || null, currency: entryUnit.value };
|
|
1318
|
-
}
|
|
1319
|
-
});
|
|
1320
|
-
const topUpQuantity = computed({
|
|
1321
|
-
get: () => {
|
|
1322
|
-
var _a;
|
|
1323
|
-
return ((_a = model.value.topUpAmount) == null ? void 0 : _a.quantity) ?? "";
|
|
1324
|
-
},
|
|
1325
|
-
set: (quantity) => {
|
|
1326
|
-
model.value.topUpAmount = { quantity: quantity || null, currency: props.chargeCurrency };
|
|
1327
|
-
}
|
|
1328
|
-
});
|
|
1329
|
-
watch(
|
|
1330
|
-
() => [props.config, formContext.value],
|
|
1331
|
-
([config, context]) => {
|
|
1332
|
-
if (isSameAutoTopUpRule(normalizeAutoTopUpRule(config, context), currentRule())) {
|
|
1333
|
-
return;
|
|
1334
|
-
}
|
|
1335
|
-
model.value = toFormState(config, context);
|
|
1336
|
-
}
|
|
1337
|
-
);
|
|
1338
|
-
const isEnabled = computed({
|
|
1339
|
-
get: () => props.alwaysEnabled || model.value.enabled,
|
|
1340
|
-
set: (enabled) => {
|
|
1341
|
-
model.value.enabled = enabled;
|
|
1342
|
-
}
|
|
1343
|
-
});
|
|
1344
|
-
const rule = computed(
|
|
1345
|
-
() => toAutoTopUpRule$1({ ...model.value, enabled: isEnabled.value }, formContext.value)
|
|
1346
|
-
);
|
|
1347
|
-
const currentRule = () => rule.value;
|
|
1348
|
-
const validationState = reactive({
|
|
1349
|
-
threshold: computed(() => toQuantity(model.value.threshold) ?? null),
|
|
1350
|
-
topUpAmount: computed(() => toQuantity(model.value.topUpAmount) ?? null)
|
|
1351
|
-
});
|
|
1352
|
-
const formatBound = (bound) => {
|
|
1353
|
-
if (!bound) {
|
|
1354
|
-
return "";
|
|
1355
|
-
}
|
|
1356
|
-
const quantity = toBoundQuantity(bound, entryBase.value, props.conversionRate, formatNumber);
|
|
1357
|
-
return quantity === void 0 ? formatAmount(bound) : `${quantity} ${topUpUnit.value}`;
|
|
1358
|
-
};
|
|
1359
|
-
const isRequired = requiredIf(() => isEnabled.value);
|
|
1360
|
-
const validation = useValidation(
|
|
1361
|
-
{
|
|
1362
|
-
threshold: {
|
|
1363
|
-
required: common.withMessage(
|
|
1364
|
-
() => $t({
|
|
1365
|
-
defaultMessage: "Enter the balance to top up at.",
|
|
1366
|
-
description: "Error shown under the auto top-up threshold when it is left empty",
|
|
1367
|
-
id: "auto_topup_config.threshold.required"
|
|
1368
|
-
}),
|
|
1369
|
-
isRequired
|
|
1370
|
-
),
|
|
1371
|
-
notNegative: common.withMessage(
|
|
1372
|
-
() => $t({
|
|
1373
|
-
defaultMessage: "The balance to top up at cannot be negative.",
|
|
1374
|
-
description: "Error shown under the auto top-up threshold when it is below zero",
|
|
1375
|
-
id: "auto_topup_config.threshold.not_negative"
|
|
1376
|
-
}),
|
|
1377
|
-
(value) => value === null || value >= 0
|
|
1378
|
-
)
|
|
1379
|
-
},
|
|
1380
|
-
topUpAmount: {
|
|
1381
|
-
required: common.withMessage(
|
|
1382
|
-
() => $t({
|
|
1383
|
-
defaultMessage: "Enter the amount to top up with.",
|
|
1384
|
-
description: "Error shown under the auto top-up amount when it is left empty",
|
|
1385
|
-
id: "auto_topup_config.amount.required"
|
|
1386
|
-
}),
|
|
1387
|
-
isRequired
|
|
1388
|
-
),
|
|
1389
|
-
positive: common.withMessage(
|
|
1390
|
-
() => $t({
|
|
1391
|
-
defaultMessage: "Top up with more than zero.",
|
|
1392
|
-
description: "Error shown under the auto top-up amount when it is zero or negative",
|
|
1393
|
-
id: "auto_topup_config.amount.positive"
|
|
1394
|
-
}),
|
|
1395
|
-
(value) => value === null || value > 0
|
|
1396
|
-
),
|
|
1397
|
-
atLeastMinimum: common.withMessage(
|
|
1398
|
-
() => {
|
|
1399
|
-
var _a;
|
|
1400
|
-
return $t(
|
|
1401
|
-
{
|
|
1402
|
-
defaultMessage: "Top up with at least {minimum}.",
|
|
1403
|
-
description: "Error shown under the auto top-up amount when it is below what the pricing allows",
|
|
1404
|
-
id: "auto_topup_config.amount.at_least_minimum"
|
|
1405
|
-
},
|
|
1406
|
-
{ minimum: formatBound((_a = props.topUpBounds) == null ? void 0 : _a.minimum) }
|
|
1407
|
-
);
|
|
1408
|
-
},
|
|
1409
|
-
(value) => {
|
|
1410
|
-
var _a;
|
|
1411
|
-
return isAtLeastMinimum(value, (_a = props.topUpBounds) == null ? void 0 : _a.minimum);
|
|
1412
|
-
}
|
|
1413
|
-
),
|
|
1414
|
-
withinMaximum: common.withMessage(
|
|
1415
|
-
() => {
|
|
1416
|
-
var _a;
|
|
1417
|
-
return $t(
|
|
1418
|
-
{
|
|
1419
|
-
defaultMessage: "Top up with at most {maximum}.",
|
|
1420
|
-
description: "Error shown under the auto top-up amount when it is above what the pricing allows",
|
|
1421
|
-
id: "auto_topup_config.amount.within_maximum"
|
|
1422
|
-
},
|
|
1423
|
-
{ maximum: formatBound((_a = props.topUpBounds) == null ? void 0 : _a.maximum) }
|
|
1424
|
-
);
|
|
1425
|
-
},
|
|
1426
|
-
(value) => {
|
|
1427
|
-
var _a;
|
|
1428
|
-
return isWithinMaximum(value, (_a = props.topUpBounds) == null ? void 0 : _a.maximum);
|
|
1429
|
-
}
|
|
1430
|
-
)
|
|
1431
|
-
}
|
|
1432
|
-
},
|
|
1433
|
-
validationState
|
|
1434
|
-
);
|
|
1435
|
-
const hasChanges = computed(
|
|
1436
|
-
() => !isSameAutoTopUpRule(
|
|
1437
|
-
currentRule(),
|
|
1438
|
-
normalizeAutoTopUpRule(props.config, formContext.value)
|
|
1439
|
-
)
|
|
1440
|
-
);
|
|
1441
|
-
function validate() {
|
|
1442
|
-
validation.value.$touch();
|
|
1443
|
-
return validation.value.$invalid ? void 0 : currentRule();
|
|
1444
|
-
}
|
|
1445
|
-
function submit() {
|
|
1446
|
-
const rule2 = validate();
|
|
1447
|
-
if (rule2) {
|
|
1448
|
-
emit("save", rule2);
|
|
1449
|
-
}
|
|
1450
|
-
}
|
|
1451
|
-
__expose({
|
|
1452
|
-
submit,
|
|
1453
|
-
validate,
|
|
1454
|
-
rule,
|
|
1455
|
-
hasChanges,
|
|
1456
|
-
isInvalid: computed(() => validation.value.$invalid)
|
|
1457
|
-
});
|
|
1458
|
-
return (_ctx, _cache) => {
|
|
1459
|
-
return openBlock(), createBlock(_sfc_main$9, {
|
|
1460
|
-
class: "sv-auto-topup-config",
|
|
1461
|
-
"content-background": __props.contained ? "gray" : "none",
|
|
1462
|
-
"no-spacing": !__props.contained,
|
|
1463
|
-
"no-border": !__props.contained
|
|
1464
|
-
}, {
|
|
1465
|
-
default: withCtx(() => [
|
|
1466
|
-
!__props.alwaysEnabled ? (openBlock(), createBlock(unref(_sfc_main$p), {
|
|
1467
|
-
key: 0,
|
|
1468
|
-
modelValue: isEnabled.value,
|
|
1469
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isEnabled.value = $event),
|
|
1470
|
-
"no-spacing": "",
|
|
1471
|
-
"label-position": "before",
|
|
1472
|
-
class: "!flex",
|
|
1473
|
-
disabled: __props.disabled
|
|
1474
|
-
}, {
|
|
1475
|
-
"inline-label": withCtx(() => [
|
|
1476
|
-
createElementVNode("div", _hoisted_1$7, [
|
|
1477
|
-
createVNode(unref(_sfc_main$h), {
|
|
1478
|
-
tag: "span",
|
|
1479
|
-
variant: "body-sm"
|
|
1480
|
-
}, {
|
|
1481
|
-
default: withCtx(() => [
|
|
1482
|
-
createTextVNode(toDisplayString(unref($t)({
|
|
1483
|
-
defaultMessage: "Auto top-up",
|
|
1484
|
-
description: "Title of the automatic wallet top-up settings",
|
|
1485
|
-
id: "auto_topup_config.title"
|
|
1486
|
-
})), 1)
|
|
1487
|
-
]),
|
|
1488
|
-
_: 1
|
|
1489
|
-
}),
|
|
1490
|
-
createVNode(unref(_sfc_main$h), {
|
|
1491
|
-
tag: "span",
|
|
1492
|
-
variant: "body-xs",
|
|
1493
|
-
color: "subtle"
|
|
1494
|
-
}, {
|
|
1495
|
-
default: withCtx(() => [
|
|
1496
|
-
createTextVNode(toDisplayString(unref($t)({
|
|
1497
|
-
defaultMessage: "Automatically top up your balance when it runs low.",
|
|
1498
|
-
description: "Subtitle of the automatic wallet top-up settings",
|
|
1499
|
-
id: "auto_topup_config.subtitle"
|
|
1500
|
-
})), 1)
|
|
1501
|
-
]),
|
|
1502
|
-
_: 1
|
|
1503
|
-
})
|
|
1504
|
-
])
|
|
1505
|
-
]),
|
|
1506
|
-
_: 1
|
|
1507
|
-
}, 8, ["modelValue", "disabled"])) : createCommentVNode("", true),
|
|
1508
|
-
createVNode(unref(_sfc_main$q), { "is-open": isEnabled.value }, {
|
|
1509
|
-
default: withCtx(() => [
|
|
1510
|
-
isEnabled.value ? (openBlock(), createElementBlock("div", {
|
|
1511
|
-
key: 0,
|
|
1512
|
-
class: normalizeClass(["grid grid-cols-1 gap-3", { "mt-4": !__props.alwaysEnabled }])
|
|
1513
|
-
}, [
|
|
1514
|
-
createVNode(_sfc_main$a, {
|
|
1515
|
-
modelValue: thresholdQuantity.value,
|
|
1516
|
-
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => thresholdQuantity.value = $event),
|
|
1517
|
-
name: "auto-top-up-threshold",
|
|
1518
|
-
unit: entryUnit.value,
|
|
1519
|
-
"model-base": entryBase.value,
|
|
1520
|
-
"entry-base": entryBase.value,
|
|
1521
|
-
currency: __props.chargeCurrency,
|
|
1522
|
-
"conversion-rate": __props.conversionRate,
|
|
1523
|
-
"show-conversion-hint": __props.showThresholdConversion,
|
|
1524
|
-
required: "",
|
|
1525
|
-
disabled: __props.disabled,
|
|
1526
|
-
error: unref(validation).threshold.$errors,
|
|
1527
|
-
label: unref($t)({
|
|
1528
|
-
defaultMessage: "When your balance falls below",
|
|
1529
|
-
description: "Label of the balance at which an automatic top-up is charged",
|
|
1530
|
-
id: "auto_topup_config.threshold.label"
|
|
1531
|
-
})
|
|
1532
|
-
}, null, 8, ["modelValue", "unit", "model-base", "entry-base", "currency", "conversion-rate", "show-conversion-hint", "disabled", "error", "label"]),
|
|
1533
|
-
createVNode(_sfc_main$a, {
|
|
1534
|
-
modelValue: topUpQuantity.value,
|
|
1535
|
-
"onUpdate:modelValue": _cache[2] || (_cache[2] = ($event) => topUpQuantity.value = $event),
|
|
1536
|
-
name: "auto-top-up-amount",
|
|
1537
|
-
unit: topUpUnit.value,
|
|
1538
|
-
"model-base": "AMOUNT",
|
|
1539
|
-
"entry-base": entryBase.value,
|
|
1540
|
-
currency: __props.chargeCurrency,
|
|
1541
|
-
"credit-unit-name": __props.creditUnitName,
|
|
1542
|
-
"conversion-rate": __props.conversionRate,
|
|
1543
|
-
bounds: __props.topUpBounds,
|
|
1544
|
-
"show-conversion-hint": "",
|
|
1545
|
-
required: "",
|
|
1546
|
-
disabled: __props.disabled,
|
|
1547
|
-
error: unref(validation).topUpAmount.$errors,
|
|
1548
|
-
label: unref($t)({
|
|
1549
|
-
defaultMessage: "Top-up with",
|
|
1550
|
-
description: "Label of the amount every automatic top-up adds",
|
|
1551
|
-
id: "auto_topup_config.amount.label"
|
|
1552
|
-
})
|
|
1553
|
-
}, null, 8, ["modelValue", "unit", "entry-base", "currency", "credit-unit-name", "conversion-rate", "bounds", "disabled", "error", "label"])
|
|
1554
|
-
], 2)) : createCommentVNode("", true)
|
|
1555
|
-
]),
|
|
1556
|
-
_: 1
|
|
1557
|
-
}, 8, ["is-open"])
|
|
1558
|
-
]),
|
|
1559
|
-
_: 1
|
|
1560
|
-
}, 8, ["content-background", "no-spacing", "no-border"]);
|
|
1561
|
-
};
|
|
1562
|
-
}
|
|
1563
|
-
});
|
|
1564
|
-
const toTime = (createdAt) => {
|
|
1565
|
-
const parsed = Date.parse(createdAt ?? "");
|
|
1566
|
-
return Number.isFinite(parsed) ? parsed : 0;
|
|
1567
|
-
};
|
|
1568
|
-
function useDefaultPaymentMethod({
|
|
1569
|
-
paymentMethods,
|
|
1570
|
-
selectedPaymentMethodId,
|
|
1571
|
-
preferredPaymentMethodId
|
|
1572
|
-
}) {
|
|
1573
|
-
const sortedPaymentMethods = computed(
|
|
1574
|
-
() => [...paymentMethods.value ?? []].sort(
|
|
1575
|
-
(a, b) => toTime(b.created_at) - toTime(a.created_at)
|
|
1576
|
-
)
|
|
1577
|
-
);
|
|
1578
|
-
watch(
|
|
1579
|
-
() => [
|
|
1580
|
-
paymentMethods.value,
|
|
1581
|
-
preferredPaymentMethodId == null ? void 0 : preferredPaymentMethodId.value,
|
|
1582
|
-
selectedPaymentMethodId.value
|
|
1583
|
-
],
|
|
1584
|
-
([methods, preferredId, chosenId], previous) => {
|
|
1585
|
-
var _a;
|
|
1586
|
-
const previousMethods = previous == null ? void 0 : previous[0];
|
|
1587
|
-
const addedPaymentMethod = methods == null ? void 0 : methods.find(
|
|
1588
|
-
({ id }) => !(previousMethods == null ? void 0 : previousMethods.some((previousMethod) => previousMethod.id === id))
|
|
1589
|
-
);
|
|
1590
|
-
if (addedPaymentMethod && (previousMethods == null ? void 0 : previousMethods.length)) {
|
|
1591
|
-
selectedPaymentMethodId.value = addedPaymentMethod.id;
|
|
1592
|
-
return;
|
|
1593
|
-
}
|
|
1594
|
-
const isStillOffered = (id) => !!id && !!(methods == null ? void 0 : methods.some((method) => method.id === id));
|
|
1595
|
-
if (isStillOffered(chosenId)) {
|
|
1596
|
-
return;
|
|
1597
|
-
}
|
|
1598
|
-
selectedPaymentMethodId.value = isStillOffered(preferredId) ? preferredId : (_a = (methods == null ? void 0 : methods.find(({ is_default }) => is_default)) ?? sortedPaymentMethods.value[0]) == null ? void 0 : _a.id;
|
|
1599
|
-
},
|
|
1600
|
-
{ immediate: true }
|
|
1601
|
-
);
|
|
1602
|
-
return { sortedPaymentMethods };
|
|
1603
|
-
}
|
|
1604
|
-
function useWalletBalanceFormat() {
|
|
1605
|
-
const { $t, formatNumber } = useIntl();
|
|
1606
|
-
const formatValue = (value) => formatWalletBalanceValue($t, formatNumber, value);
|
|
1607
|
-
const formatOpenBalance = (balanceItem) => formatValue(balanceItem == null ? void 0 : balanceItem.wallet_balance.open_balance);
|
|
1608
|
-
return { formatValue, formatOpenBalance };
|
|
1609
|
-
}
|
|
1610
|
-
const _hoisted_1$6 = { class: "sv-top-up-form" };
|
|
1611
|
-
const _hoisted_2$1 = { class: "grid grid-cols-1 gap-4" };
|
|
1612
|
-
const _hoisted_3$1 = { class: "grid grid-cols-1 gap-1" };
|
|
1613
|
-
const _hoisted_4 = { class: "sv-top-up-form__option-details" };
|
|
1614
|
-
const _hoisted_5 = { key: 0 };
|
|
1615
|
-
const _sfc_main$7 = /* @__PURE__ */ defineComponent({
|
|
1616
|
-
__name: "TopUpModalForm",
|
|
1617
|
-
props: {
|
|
1618
|
-
topUpPricingItems: { type: null },
|
|
1619
|
-
paymentMethods: { type: Array },
|
|
1620
|
-
paymentMethodOptions: { type: Array },
|
|
1621
|
-
autoTopUpConfig: { type: Object }
|
|
1622
|
-
},
|
|
1623
|
-
emits: ["add-payment-method", "success", "save-auto-top-up", "failure"],
|
|
1624
|
-
setup(__props, { expose: __expose, emit: __emit }) {
|
|
1625
|
-
const props = __props;
|
|
1626
|
-
const emit = __emit;
|
|
1627
|
-
const { $t } = useIntl();
|
|
1628
|
-
const { formatValue } = useWalletBalanceFormat();
|
|
1629
|
-
const model = ref({
|
|
1630
|
-
pricing_plan_schedule_id: "",
|
|
1631
|
-
pricing_items: [],
|
|
1632
|
-
start_at: "",
|
|
1633
|
-
finalize_immediately: false,
|
|
1634
|
-
payment_method_id: void 0,
|
|
1635
|
-
preview: true
|
|
1636
|
-
});
|
|
1637
|
-
const chargeableItems = computed(() => {
|
|
1638
|
-
const chargeable = (props.topUpPricingItems ?? []).filter(
|
|
1639
|
-
(item) => item.flexiblePricing || item.fixedPricing
|
|
1640
|
-
);
|
|
1641
|
-
return [
|
|
1642
|
-
...chargeable.filter(({ flexiblePricing }) => flexiblePricing),
|
|
1643
|
-
...chargeable.filter(({ flexiblePricing }) => !flexiblePricing)
|
|
1644
|
-
];
|
|
1645
|
-
});
|
|
1646
|
-
const findItem = (pricingItemId) => chargeableItems.value.find((item) => item.pricingItemId === pricingItemId);
|
|
1647
|
-
const pricingPlanScheduleId = computed(
|
|
1648
|
-
() => {
|
|
1649
|
-
var _a, _b;
|
|
1650
|
-
return (_b = (_a = props.topUpPricingItems) == null ? void 0 : _a.find((item) => item.pricingPlanScheduleId)) == null ? void 0 : _b.pricingPlanScheduleId;
|
|
1651
|
-
}
|
|
1652
|
-
);
|
|
1653
|
-
watch(
|
|
1654
|
-
pricingPlanScheduleId,
|
|
1655
|
-
(scheduleId) => {
|
|
1656
|
-
model.value.pricing_plan_schedule_id = scheduleId ?? "";
|
|
1657
|
-
},
|
|
1658
|
-
{ immediate: true }
|
|
1659
|
-
);
|
|
1660
|
-
const getInitialAmount = (item) => {
|
|
1661
|
-
const { config, currency } = item.flexiblePricing ?? {};
|
|
1662
|
-
const minimum = config == null ? void 0 : config.minimum_amount;
|
|
1663
|
-
return minimum && currency ? { quantity: minimum.quantity, currency } : void 0;
|
|
1664
|
-
};
|
|
1665
|
-
const selectedPricingItemId = computed({
|
|
1666
|
-
get: () => {
|
|
1667
|
-
var _a;
|
|
1668
|
-
return (_a = model.value.pricing_items[0]) == null ? void 0 : _a.pricing_item_id;
|
|
1669
|
-
},
|
|
1670
|
-
set: (value) => {
|
|
1671
|
-
const item = findItem(typeof value === "string" ? value : void 0);
|
|
1672
|
-
if (!item) {
|
|
1673
|
-
model.value.pricing_items = [];
|
|
1674
|
-
return;
|
|
1675
|
-
}
|
|
1676
|
-
const initialAmount = getInitialAmount(item);
|
|
1677
|
-
model.value.pricing_items = [
|
|
1678
|
-
{
|
|
1679
|
-
pricing_item_id: item.pricingItemId,
|
|
1680
|
-
...initialAmount && { flexible_amount: initialAmount }
|
|
1681
|
-
}
|
|
1682
|
-
];
|
|
1683
|
-
}
|
|
1684
|
-
});
|
|
1685
|
-
watch(
|
|
1686
|
-
chargeableItems,
|
|
1687
|
-
(items) => {
|
|
1688
|
-
const chosenIsStillOffered = items.some(
|
|
1689
|
-
({ pricingItemId }) => {
|
|
1690
|
-
var _a;
|
|
1691
|
-
return pricingItemId === ((_a = model.value.pricing_items[0]) == null ? void 0 : _a.pricing_item_id);
|
|
1692
|
-
}
|
|
1693
|
-
);
|
|
1694
|
-
if (chosenIsStillOffered) {
|
|
1695
|
-
return;
|
|
1696
|
-
}
|
|
1697
|
-
const preferred = items.find(({ flexiblePricing }) => flexiblePricing) ?? items[0];
|
|
1698
|
-
selectedPricingItemId.value = preferred == null ? void 0 : preferred.pricingItemId;
|
|
1699
|
-
},
|
|
1700
|
-
{ immediate: true }
|
|
1701
|
-
);
|
|
1702
|
-
const flexibleAmount = computed({
|
|
1703
|
-
get: () => {
|
|
1704
|
-
var _a;
|
|
1705
|
-
return (_a = model.value.pricing_items[0]) == null ? void 0 : _a.flexible_amount;
|
|
1706
|
-
},
|
|
1707
|
-
set: (amount) => {
|
|
1708
|
-
var _a;
|
|
1709
|
-
const pricingItemId = (_a = model.value.pricing_items[0]) == null ? void 0 : _a.pricing_item_id;
|
|
1710
|
-
if (!pricingItemId) {
|
|
1711
|
-
return;
|
|
1712
|
-
}
|
|
1713
|
-
model.value.pricing_items = [
|
|
1714
|
-
{ pricing_item_id: pricingItemId, ...amount && { flexible_amount: amount } }
|
|
1715
|
-
];
|
|
1716
|
-
}
|
|
1717
|
-
});
|
|
1718
|
-
const getCostLabel = (optionValue) => {
|
|
1719
|
-
var _a;
|
|
1720
|
-
const fixedPricing = (_a = findItem(String(optionValue))) == null ? void 0 : _a.fixedPricing;
|
|
1721
|
-
return (fixedPricing == null ? void 0 : fixedPricing.value.credits) ? formatAmount(fixedPricing.amount) : void 0;
|
|
1722
|
-
};
|
|
1723
|
-
const selectedFlexiblePricing = computed(
|
|
1724
|
-
() => {
|
|
1725
|
-
var _a;
|
|
1726
|
-
return (_a = findItem(String(selectedPricingItemId.value))) == null ? void 0 : _a.flexiblePricing;
|
|
1727
|
-
}
|
|
1728
|
-
);
|
|
1729
|
-
const flexibleAmountQuantity = computed({
|
|
1730
|
-
get: () => {
|
|
1731
|
-
var _a;
|
|
1732
|
-
return ((_a = flexibleAmount.value) == null ? void 0 : _a.quantity) ?? "";
|
|
1733
|
-
},
|
|
1734
|
-
set: (quantity) => {
|
|
1735
|
-
var _a;
|
|
1736
|
-
const currency = (_a = selectedFlexiblePricing.value) == null ? void 0 : _a.currency;
|
|
1737
|
-
flexibleAmount.value = quantity && currency ? { quantity, currency } : void 0;
|
|
1738
|
-
}
|
|
1739
|
-
});
|
|
1740
|
-
const entryBaseFor = (pricing) => pricing.creditsConfiguration ? "CREDITS" : "AMOUNT";
|
|
1741
|
-
const creditUnitName = computed(() => getAutoTopUpCreditUnitName(props.topUpPricingItems));
|
|
1742
|
-
const entryUnitFor = (pricing) => pricing.creditsConfiguration ? creditUnitName.value ?? pricing.creditsConfiguration.unitNamePlural ?? pricing.creditsConfiguration.unitNameSingle ?? "" : pricing.currency;
|
|
1743
|
-
const flexiblePricingFor = (optionValue) => {
|
|
1744
|
-
var _a;
|
|
1745
|
-
const flexiblePricing = (_a = findItem(String(optionValue))) == null ? void 0 : _a.flexiblePricing;
|
|
1746
|
-
return flexiblePricing ? [flexiblePricing] : [];
|
|
1747
|
-
};
|
|
1748
|
-
const isFlexibleOption = (optionValue) => {
|
|
1749
|
-
var _a;
|
|
1750
|
-
return !!((_a = findItem(String(optionValue))) == null ? void 0 : _a.flexiblePricing);
|
|
1751
|
-
};
|
|
1752
|
-
const options = computed(
|
|
1753
|
-
() => chargeableItems.value.map((item) => {
|
|
1754
|
-
var _a;
|
|
1755
|
-
return {
|
|
1756
|
-
value: item.pricingItemId,
|
|
1757
|
-
label: item.fixedPricing ? formatValue(item.fixedPricing.value) : $t({
|
|
1758
|
-
defaultMessage: "Choose your own amount",
|
|
1759
|
-
description: "Label of the choose-your-amount option in the top-up modal",
|
|
1760
|
-
id: "topup_modal.flexible_option.label"
|
|
1761
|
-
}),
|
|
1762
|
-
...((_a = item.flexiblePricing) == null ? void 0 : _a.bounds.minimum) && item.flexiblePricing.bounds.maximum && {
|
|
1763
|
-
description: $t(
|
|
1764
|
-
{
|
|
1765
|
-
defaultMessage: "Between {minimum} and {maximum}",
|
|
1766
|
-
description: "Bounds of the choose-your-amount option in the top-up modal",
|
|
1767
|
-
id: "topup_modal.flexible_option.bounds"
|
|
1768
|
-
},
|
|
1769
|
-
{
|
|
1770
|
-
minimum: formatValue(item.flexiblePricing.bounds.minimum),
|
|
1771
|
-
maximum: formatValue(item.flexiblePricing.bounds.maximum)
|
|
1772
|
-
}
|
|
1773
|
-
)
|
|
1774
|
-
}
|
|
1775
|
-
};
|
|
1776
|
-
})
|
|
1777
|
-
);
|
|
1778
|
-
const pricingItems = computed(() => {
|
|
1779
|
-
const chargeable = model.value.pricing_items.filter(
|
|
1780
|
-
(item) => {
|
|
1781
|
-
var _a;
|
|
1782
|
-
return !((_a = findItem(item.pricing_item_id)) == null ? void 0 : _a.flexiblePricing) || !!item.flexible_amount;
|
|
1783
|
-
}
|
|
1784
|
-
);
|
|
1785
|
-
return chargeable.length > 0 ? chargeable : void 0;
|
|
1786
|
-
});
|
|
1787
|
-
const autoTopUpEditor = computed(() => {
|
|
1788
|
-
const canSetUpAutoTopUp = !props.autoTopUpConfig && chargeableItems.value.some(({ flexiblePricing }) => flexiblePricing);
|
|
1789
|
-
return canSetUpAutoTopUp ? getAutoTopUpEditorConfig(props.topUpPricingItems) : void 0;
|
|
1790
|
-
});
|
|
1791
|
-
const autoTopUpFormRef = ref();
|
|
1792
|
-
const { chargeOnDemandPricingItems } = createInvoicesService();
|
|
1793
|
-
const logger = useLogger();
|
|
1794
|
-
const isCharging = ref(false);
|
|
1795
|
-
const canSubmit = computed(
|
|
1796
|
-
() => !!model.value.pricing_plan_schedule_id && !!pricingItems.value && !!model.value.payment_method_id
|
|
1797
|
-
);
|
|
1798
|
-
const validationState = reactive({
|
|
1799
|
-
paymentMethodId: computed(() => model.value.payment_method_id ?? null)
|
|
1800
|
-
});
|
|
1801
|
-
const validation = useValidation(
|
|
1802
|
-
{
|
|
1803
|
-
paymentMethodId: {
|
|
1804
|
-
required: common.withMessage(
|
|
1805
|
-
() => $t({
|
|
1806
|
-
defaultMessage: "Select a payment method to pay for this top-up.",
|
|
1807
|
-
description: "Error shown under the payment methods in the top-up modal when none is selected on submit",
|
|
1808
|
-
id: "topup_modal.payment_method_required"
|
|
1809
|
-
}),
|
|
1810
|
-
required
|
|
1811
|
-
)
|
|
1812
|
-
}
|
|
1813
|
-
},
|
|
1814
|
-
validationState
|
|
1815
|
-
);
|
|
1816
|
-
const chargedValue = computed(() => {
|
|
1817
|
-
const [chargedItem] = model.value.pricing_items;
|
|
1818
|
-
const item = findItem(chargedItem == null ? void 0 : chargedItem.pricing_item_id);
|
|
1819
|
-
return item ? getTopUpValue(item, chargedItem == null ? void 0 : chargedItem.flexible_amount) : void 0;
|
|
1820
|
-
});
|
|
1821
|
-
async function submit() {
|
|
1822
|
-
var _a, _b, _c;
|
|
1823
|
-
validation.value.$touch();
|
|
1824
|
-
const editedAutoTopUp = (_a = autoTopUpFormRef.value) == null ? void 0 : _a.validate();
|
|
1825
|
-
if (validation.value.$invalid || ((_b = autoTopUpFormRef.value) == null ? void 0 : _b.isInvalid) || !canSubmit.value || isCharging.value) {
|
|
1826
|
-
return;
|
|
1827
|
-
}
|
|
1828
|
-
isCharging.value = true;
|
|
1829
|
-
try {
|
|
1830
|
-
const invoice = await chargeOnDemandPricingItems({
|
|
1831
|
-
pricing_plan_schedule_id: model.value.pricing_plan_schedule_id,
|
|
1832
|
-
pricing_items: pricingItems.value ?? [],
|
|
1833
|
-
payment_method_id: model.value.payment_method_id,
|
|
1834
|
-
preview: false
|
|
1835
|
-
});
|
|
1836
|
-
if (editedAutoTopUp && ((_c = autoTopUpFormRef.value) == null ? void 0 : _c.hasChanges) && model.value.payment_method_id) {
|
|
1837
|
-
emit("save-auto-top-up", {
|
|
1838
|
-
rule: editedAutoTopUp,
|
|
1839
|
-
paymentMethodId: model.value.payment_method_id
|
|
1840
|
-
});
|
|
1841
|
-
}
|
|
1842
|
-
emit("success", invoice);
|
|
1843
|
-
} catch (error) {
|
|
1844
|
-
logger.error("TOP_UP_FAILED", "Failed to charge the wallet top-up", {}, error);
|
|
1845
|
-
emit("failure", error);
|
|
1846
|
-
} finally {
|
|
1847
|
-
isCharging.value = false;
|
|
1848
|
-
}
|
|
1849
|
-
}
|
|
1850
|
-
__expose({ submit, isCharging, canSubmit, chargedValue });
|
|
1851
|
-
const selectedPaymentMethodId = computed({
|
|
1852
|
-
get: () => model.value.payment_method_id ?? void 0,
|
|
1853
|
-
set: (paymentMethodId) => {
|
|
1854
|
-
model.value.payment_method_id = paymentMethodId;
|
|
1855
|
-
}
|
|
1856
|
-
});
|
|
1857
|
-
const { sortedPaymentMethods } = useDefaultPaymentMethod({
|
|
1858
|
-
paymentMethods: computed(() => props.paymentMethods),
|
|
1859
|
-
selectedPaymentMethodId
|
|
1860
|
-
});
|
|
1861
|
-
return (_ctx, _cache) => {
|
|
1862
|
-
return openBlock(), createElementBlock("form", _hoisted_1$6, [
|
|
1863
|
-
createElementVNode("div", _hoisted_2$1, [
|
|
1864
|
-
createElementVNode("div", _hoisted_3$1, [
|
|
1865
|
-
options.value.length > 0 ? (openBlock(), createBlock(unref(_sfc_main$r), {
|
|
1866
|
-
key: 0,
|
|
1867
|
-
modelValue: selectedPricingItemId.value,
|
|
1868
|
-
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => selectedPricingItemId.value = $event),
|
|
1869
|
-
class: "sv-top-up-form__options",
|
|
1870
|
-
name: "top-up-pricing-item",
|
|
1871
|
-
direction: "column",
|
|
1872
|
-
required: "",
|
|
1873
|
-
disabled: isCharging.value,
|
|
1874
|
-
options: options.value,
|
|
1875
|
-
"show-radio": false,
|
|
1876
|
-
label: unref($t)({
|
|
1877
|
-
defaultMessage: "Top up amount",
|
|
1878
|
-
description: "Label above the list of ways to top up the wallet in the top-up modal",
|
|
1879
|
-
id: "topup_modal.pricing_items.label"
|
|
1880
|
-
})
|
|
1881
|
-
}, {
|
|
1882
|
-
label: withCtx(({ option, optionValue }) => [
|
|
1883
|
-
createElementVNode("span", null, toDisplayString(option.label), 1),
|
|
1884
|
-
getCostLabel(optionValue) ? (openBlock(), createBlock(unref(_sfc_main$h), {
|
|
1885
|
-
key: 0,
|
|
1886
|
-
tag: "span",
|
|
1887
|
-
variant: "body-sm",
|
|
1888
|
-
color: "subtle",
|
|
1889
|
-
weight: "normal",
|
|
1890
|
-
"no-spacing": "",
|
|
1891
|
-
class: "sv-top-up-form__option-cost"
|
|
1892
|
-
}, {
|
|
1893
|
-
default: withCtx(() => [
|
|
1894
|
-
createTextVNode(toDisplayString(getCostLabel(optionValue)), 1)
|
|
1895
|
-
]),
|
|
1896
|
-
_: 2
|
|
1897
|
-
}, 1024)) : createCommentVNode("", true)
|
|
1898
|
-
]),
|
|
1899
|
-
description: withCtx(({ option, optionValue }) => [
|
|
1900
|
-
createElementVNode("div", _hoisted_4, [
|
|
1901
|
-
option.description && !isFlexibleOption(optionValue) ? (openBlock(), createBlock(unref(_sfc_main$h), {
|
|
1902
|
-
key: 0,
|
|
1903
|
-
tag: "span",
|
|
1904
|
-
variant: "body-xs",
|
|
1905
|
-
color: "subtle",
|
|
1906
|
-
"no-spacing": ""
|
|
1907
|
-
}, {
|
|
1908
|
-
default: withCtx(() => [
|
|
1909
|
-
createTextVNode(toDisplayString(option.description), 1)
|
|
1910
|
-
]),
|
|
1911
|
-
_: 2
|
|
1912
|
-
}, 1024)) : createCommentVNode("", true),
|
|
1913
|
-
flexiblePricingFor(optionValue).length > 0 ? (openBlock(), createBlock(unref(_sfc_main$q), {
|
|
1914
|
-
key: 1,
|
|
1915
|
-
"is-open": String(optionValue) === selectedPricingItemId.value,
|
|
1916
|
-
lazy: ""
|
|
1917
|
-
}, {
|
|
1918
|
-
default: withCtx(() => [
|
|
1919
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(flexiblePricingFor(optionValue), (flexiblePricing) => {
|
|
1920
|
-
var _a;
|
|
1921
|
-
return openBlock(), createElementBlock("div", {
|
|
1922
|
-
key: flexiblePricing.currency,
|
|
1923
|
-
class: "sv-top-up-form__amount grid grid-cols-1 gap-3",
|
|
1924
|
-
onClick: _cache[1] || (_cache[1] = withModifiers(() => {
|
|
1925
|
-
}, ["stop"])),
|
|
1926
|
-
onKeydown: _cache[2] || (_cache[2] = withModifiers(() => {
|
|
1927
|
-
}, ["stop"]))
|
|
1928
|
-
}, [
|
|
1929
|
-
option.description ? (openBlock(), createBlock(unref(_sfc_main$h), {
|
|
1930
|
-
key: 0,
|
|
1931
|
-
tag: "span",
|
|
1932
|
-
variant: "body-xs",
|
|
1933
|
-
color: "subtle",
|
|
1934
|
-
"no-spacing": ""
|
|
1935
|
-
}, {
|
|
1936
|
-
default: withCtx(() => [
|
|
1937
|
-
createTextVNode(toDisplayString(option.description), 1)
|
|
1938
|
-
]),
|
|
1939
|
-
_: 2
|
|
1940
|
-
}, 1024)) : createCommentVNode("", true),
|
|
1941
|
-
createVNode(_sfc_main$a, {
|
|
1942
|
-
modelValue: flexibleAmountQuantity.value,
|
|
1943
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => flexibleAmountQuantity.value = $event),
|
|
1944
|
-
name: "top-up-amount",
|
|
1945
|
-
"model-base": "AMOUNT",
|
|
1946
|
-
unit: entryUnitFor(flexiblePricing),
|
|
1947
|
-
"entry-base": entryBaseFor(flexiblePricing),
|
|
1948
|
-
currency: flexiblePricing.currency,
|
|
1949
|
-
"conversion-rate": (_a = flexiblePricing.creditsConfiguration) == null ? void 0 : _a.conversionRate,
|
|
1950
|
-
required: "",
|
|
1951
|
-
disabled: isCharging.value
|
|
1952
|
-
}, null, 8, ["modelValue", "unit", "entry-base", "currency", "conversion-rate", "disabled"])
|
|
1953
|
-
], 32);
|
|
1954
|
-
}), 128))
|
|
1955
|
-
]),
|
|
1956
|
-
_: 2
|
|
1957
|
-
}, 1032, ["is-open"])) : createCommentVNode("", true)
|
|
1958
|
-
])
|
|
1959
|
-
]),
|
|
1960
|
-
_: 1
|
|
1961
|
-
}, 8, ["modelValue", "disabled", "options", "label"])) : createCommentVNode("", true)
|
|
1962
|
-
]),
|
|
1963
|
-
createElementVNode("div", null, [
|
|
1964
|
-
createVNode(_sfc_main$b, {
|
|
1965
|
-
"pricing-plan-schedule-id": pricingPlanScheduleId.value,
|
|
1966
|
-
"pricing-items": pricingItems.value
|
|
1967
|
-
}, null, 8, ["pricing-plan-schedule-id", "pricing-items"])
|
|
1968
|
-
]),
|
|
1969
|
-
autoTopUpEditor.value ? (openBlock(), createElementBlock("div", _hoisted_5, [
|
|
1970
|
-
createVNode(_sfc_main$8, mergeProps({
|
|
1971
|
-
ref_key: "autoTopUpFormRef",
|
|
1972
|
-
ref: autoTopUpFormRef,
|
|
1973
|
-
class: "sv-top-up-form__auto-top-up"
|
|
1974
|
-
}, autoTopUpEditor.value, {
|
|
1975
|
-
contained: "",
|
|
1976
|
-
"show-threshold-conversion": false,
|
|
1977
|
-
disabled: isCharging.value
|
|
1978
|
-
}), null, 16, ["disabled"])
|
|
1979
|
-
])) : createCommentVNode("", true),
|
|
1980
|
-
createElementVNode("div", null, [
|
|
1981
|
-
createVNode(unref(_sfc_main$s), { spacing: "xs" })
|
|
1982
|
-
]),
|
|
1983
|
-
createElementVNode("div", null, [
|
|
1984
|
-
renderSlot(_ctx.$slots, "payment-method", {}, () => [
|
|
1985
|
-
createVNode(_sfc_main$t, {
|
|
1986
|
-
modelValue: selectedPaymentMethodId.value,
|
|
1987
|
-
"onUpdate:modelValue": _cache[4] || (_cache[4] = ($event) => selectedPaymentMethodId.value = $event),
|
|
1988
|
-
class: "sv-top-up-form__payment-methods",
|
|
1989
|
-
"payment-methods": unref(sortedPaymentMethods),
|
|
1990
|
-
required: "",
|
|
1991
|
-
error: unref(validation).paymentMethodId.$errors,
|
|
1992
|
-
"payment-method-options": __props.paymentMethodOptions,
|
|
1993
|
-
disabled: isCharging.value,
|
|
1994
|
-
label: unref($t)({
|
|
1995
|
-
defaultMessage: "Payment method",
|
|
1996
|
-
description: "Label above the payment method that pays for the top-up, in the top-up modal",
|
|
1997
|
-
id: "topup_modal.payment_method_selector.label"
|
|
1998
|
-
}),
|
|
1999
|
-
onAddPaymentMethod: _cache[5] || (_cache[5] = ($event) => emit("add-payment-method"))
|
|
2000
|
-
}, null, 8, ["modelValue", "payment-methods", "error", "payment-method-options", "disabled", "label"])
|
|
2001
|
-
])
|
|
2002
|
-
])
|
|
2003
|
-
])
|
|
2004
|
-
]);
|
|
2005
|
-
};
|
|
2006
|
-
}
|
|
2007
|
-
});
|
|
2008
|
-
const _hoisted_1$5 = { class: "sv-top-up-success grid grid-cols-1 gap-4" };
|
|
2009
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
2010
|
-
__name: "TopUpModalSuccess",
|
|
2011
|
-
props: {
|
|
2012
|
-
addedValue: { type: Object },
|
|
2013
|
-
invoice: { type: Object }
|
|
2014
|
-
},
|
|
2015
|
-
setup(__props) {
|
|
2016
|
-
const { $t } = useIntl();
|
|
2017
|
-
return (_ctx, _cache) => {
|
|
2018
|
-
return openBlock(), createElementBlock("div", _hoisted_1$5, [
|
|
2019
|
-
__props.invoice ? (openBlock(), createBlock(unref(_sfc_main$k), {
|
|
2020
|
-
key: 0,
|
|
2021
|
-
"content-background": "none"
|
|
2022
|
-
}, {
|
|
2023
|
-
default: withCtx(() => [
|
|
2024
|
-
createVNode(unref(_sfc_main$h), {
|
|
2025
|
-
tag: "span",
|
|
2026
|
-
variant: "body-sm",
|
|
2027
|
-
weight: "semibold",
|
|
2028
|
-
class: "mb-2 block"
|
|
2029
|
-
}, {
|
|
2030
|
-
default: withCtx(() => [
|
|
2031
|
-
createTextVNode(toDisplayString(unref($t)({
|
|
2032
|
-
defaultMessage: "Receipt",
|
|
2033
|
-
description: "Heading above the invoice a completed top-up produced",
|
|
2034
|
-
id: "topup_modal.success.receipt.heading"
|
|
2035
|
-
})), 1)
|
|
2036
|
-
]),
|
|
2037
|
-
_: 1
|
|
2038
|
-
}),
|
|
2039
|
-
createVNode(unref(_sfc_main$n), {
|
|
2040
|
-
invoice: __props.invoice,
|
|
2041
|
-
"is-customer-facing": ""
|
|
2042
|
-
}, null, 8, ["invoice"])
|
|
2043
|
-
]),
|
|
2044
|
-
_: 1
|
|
2045
|
-
})) : createCommentVNode("", true)
|
|
2046
|
-
]);
|
|
2047
|
-
};
|
|
2048
|
-
}
|
|
2049
|
-
});
|
|
2050
|
-
function useTopUpModalLabels({
|
|
2051
|
-
step,
|
|
2052
|
-
currentBalance,
|
|
2053
|
-
topUpValue
|
|
2054
|
-
}) {
|
|
2055
|
-
const { $t, formatNumber } = useIntl();
|
|
2056
|
-
const title = computed(() => {
|
|
2057
|
-
if (step.value === "ADD_PAYMENT_METHOD") {
|
|
2058
|
-
return $t({
|
|
2059
|
-
defaultMessage: "Add payment method",
|
|
2060
|
-
description: "Title of the top-up modal while the customer is adding a payment method",
|
|
2061
|
-
id: "topup_modal.add_payment_method.title"
|
|
2062
|
-
});
|
|
2063
|
-
}
|
|
2064
|
-
if (step.value === "SUCCESS") {
|
|
2065
|
-
return $t({
|
|
2066
|
-
defaultMessage: "Top-up complete",
|
|
2067
|
-
description: "Title of the top-up modal once the top-up has been charged",
|
|
2068
|
-
id: "topup_modal.success.modal_title"
|
|
2069
|
-
});
|
|
2070
|
-
}
|
|
2071
|
-
return $t({
|
|
2072
|
-
defaultMessage: "Top up balance",
|
|
2073
|
-
description: "Title of the wallet top-up modal",
|
|
2074
|
-
id: "topup_modal.title"
|
|
2075
|
-
});
|
|
2076
|
-
});
|
|
2077
|
-
const subTitle = computed(() => {
|
|
2078
|
-
if (step.value === "ADD_PAYMENT_METHOD") {
|
|
2079
|
-
return $t({
|
|
2080
|
-
defaultMessage: "Add a new payment method for topping up your balance.",
|
|
2081
|
-
description: "Subtitle of the top-up modal while the customer is adding a payment method",
|
|
2082
|
-
id: "topup_modal.add_payment_method.subtitle"
|
|
2083
|
-
});
|
|
2084
|
-
}
|
|
2085
|
-
if (step.value === "SUCCESS") {
|
|
2086
|
-
return $t({
|
|
2087
|
-
defaultMessage: "Your payment went through.",
|
|
2088
|
-
description: "Subtitle of the top-up modal once the top-up has been charged",
|
|
2089
|
-
id: "topup_modal.success.modal_subtitle"
|
|
2090
|
-
});
|
|
2091
|
-
}
|
|
2092
|
-
return $t(
|
|
2093
|
-
{
|
|
2094
|
-
defaultMessage: "Your current balance is {balance}.",
|
|
2095
|
-
description: "Subtitle of the top-up modal showing the current wallet balance",
|
|
2096
|
-
id: "topup_modal.subtitle"
|
|
2097
|
-
},
|
|
2098
|
-
{ balance: currentBalance.value }
|
|
2099
|
-
);
|
|
2100
|
-
});
|
|
2101
|
-
const cancelButtonText = computed(
|
|
2102
|
-
() => step.value === "ADD_PAYMENT_METHOD" ? $t({
|
|
2103
|
-
defaultMessage: "Back",
|
|
2104
|
-
description: "Label of the button that leaves the add payment method step in the top-up modal",
|
|
2105
|
-
id: "topup_modal.back_button.label"
|
|
2106
|
-
}) : $t({
|
|
2107
|
-
defaultMessage: "Cancel",
|
|
2108
|
-
description: "Label of the button that closes the top-up modal",
|
|
2109
|
-
id: "topup_modal.cancel_button.label"
|
|
2110
|
-
})
|
|
2111
|
-
);
|
|
2112
|
-
const confirmButtonText = computed(() => {
|
|
2113
|
-
if (step.value === "ADD_PAYMENT_METHOD") {
|
|
2114
|
-
return $t({
|
|
2115
|
-
defaultMessage: "Save payment method",
|
|
2116
|
-
description: "Label of the confirm button in the top-up modal while adding a payment method",
|
|
2117
|
-
id: "topup_modal.save_payment_method.label"
|
|
2118
|
-
});
|
|
2119
|
-
}
|
|
2120
|
-
if (step.value === "SUCCESS") {
|
|
2121
|
-
return $t({
|
|
2122
|
-
defaultMessage: "Done",
|
|
2123
|
-
description: "Label of the button that dismisses the top-up modal once the top-up has been charged",
|
|
2124
|
-
id: "topup_modal.done_button.label"
|
|
2125
|
-
});
|
|
2126
|
-
}
|
|
2127
|
-
if (!topUpValue.value) {
|
|
2128
|
-
return $t({
|
|
2129
|
-
defaultMessage: "Top up balance",
|
|
2130
|
-
description: "Label of the confirm button in the top-up modal while no amount is entered",
|
|
2131
|
-
id: "topup_modal.confirm_button.empty.label"
|
|
2132
|
-
});
|
|
2133
|
-
}
|
|
2134
|
-
return $t(
|
|
2135
|
-
{
|
|
2136
|
-
defaultMessage: "Top up balance with {value}",
|
|
2137
|
-
description: "Label of the confirm button in the top-up modal once an amount is entered",
|
|
2138
|
-
id: "topup_modal.confirm_button.label"
|
|
2139
|
-
},
|
|
2140
|
-
{ value: formatWalletBalanceValue($t, formatNumber, topUpValue.value) }
|
|
2141
|
-
);
|
|
2142
|
-
});
|
|
2143
|
-
return { title, subTitle, cancelButtonText, confirmButtonText };
|
|
2144
|
-
}
|
|
2145
|
-
function useCustomerPaymentMethodOptions({
|
|
2146
|
-
isOpen,
|
|
2147
|
-
customer
|
|
2148
|
-
}) {
|
|
2149
|
-
const { paymentMethodOptions, get, isPending } = usePaymentMethodOptions();
|
|
2150
|
-
watch(
|
|
2151
|
-
() => [isOpen.value, customer.value],
|
|
2152
|
-
([open, currentCustomer]) => {
|
|
2153
|
-
if (!open || !currentCustomer) {
|
|
2154
|
-
return;
|
|
2155
|
-
}
|
|
2156
|
-
void get({
|
|
2157
|
-
customerId: currentCustomer.id,
|
|
2158
|
-
country: getCustomerCountry(currentCustomer)
|
|
2159
|
-
});
|
|
2160
|
-
},
|
|
2161
|
-
{ immediate: true }
|
|
2162
|
-
);
|
|
2163
|
-
const settledOptions = computed(
|
|
2164
|
-
() => isPending.value ? void 0 : paymentMethodOptions.value
|
|
2165
|
-
);
|
|
2166
|
-
return { paymentMethodOptions, settledOptions, isPending };
|
|
2167
|
-
}
|
|
2168
|
-
function useElementHeight(target) {
|
|
2169
|
-
const height = ref(0);
|
|
2170
|
-
const measure = (element) => {
|
|
2171
|
-
height.value = (element == null ? void 0 : element.offsetHeight) ?? 0;
|
|
2172
|
-
};
|
|
2173
|
-
const observer = typeof ResizeObserver === "undefined" ? void 0 : new ResizeObserver((entries) => {
|
|
2174
|
-
var _a;
|
|
2175
|
-
const element = (_a = entries[0]) == null ? void 0 : _a.target;
|
|
2176
|
-
measure(element instanceof HTMLElement ? element : void 0);
|
|
2177
|
-
});
|
|
2178
|
-
watch(
|
|
2179
|
-
target,
|
|
2180
|
-
(element, previousElement) => {
|
|
2181
|
-
if (previousElement) {
|
|
2182
|
-
observer == null ? void 0 : observer.unobserve(previousElement);
|
|
2183
|
-
}
|
|
2184
|
-
measure(element);
|
|
2185
|
-
if (element) {
|
|
2186
|
-
observer == null ? void 0 : observer.observe(element);
|
|
2187
|
-
}
|
|
2188
|
-
},
|
|
2189
|
-
// `post` so the callback runs after the render that assigns the template ref, not before.
|
|
2190
|
-
{ immediate: true, flush: "post" }
|
|
2191
|
-
);
|
|
2192
|
-
onBeforeUnmount(() => {
|
|
2193
|
-
observer == null ? void 0 : observer.disconnect();
|
|
2194
|
-
});
|
|
2195
|
-
return height;
|
|
2196
|
-
}
|
|
2197
|
-
const _hoisted_1$4 = ["inert"];
|
|
2198
|
-
const PANE_TRANSITION_MS = 300;
|
|
2199
|
-
const PANE_GAP = "1rem";
|
|
2200
|
-
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
2201
|
-
__name: "SlidingPanes",
|
|
2202
|
-
props: {
|
|
2203
|
-
panes: { type: Array },
|
|
2204
|
-
current: { type: String }
|
|
2205
|
-
},
|
|
2206
|
-
setup(__props) {
|
|
2207
|
-
const props = __props;
|
|
2208
|
-
const isSwitchingPanes = ref(false);
|
|
2209
|
-
let switchTimeout;
|
|
2210
|
-
watch(
|
|
2211
|
-
() => props.current,
|
|
2212
|
-
() => {
|
|
2213
|
-
isSwitchingPanes.value = true;
|
|
2214
|
-
clearTimeout(switchTimeout);
|
|
2215
|
-
switchTimeout = setTimeout(() => {
|
|
2216
|
-
isSwitchingPanes.value = false;
|
|
2217
|
-
}, PANE_TRANSITION_MS);
|
|
2218
|
-
}
|
|
2219
|
-
);
|
|
2220
|
-
onBeforeUnmount(() => {
|
|
2221
|
-
clearTimeout(switchTimeout);
|
|
2222
|
-
});
|
|
2223
|
-
const paneElements = ref({});
|
|
2224
|
-
const paneRefSetters = {};
|
|
2225
|
-
const setPaneElement = (pane) => paneRefSetters[pane] ?? (paneRefSetters[pane] = (element) => {
|
|
2226
|
-
paneElements.value[pane] = element instanceof HTMLElement ? element : void 0;
|
|
2227
|
-
});
|
|
2228
|
-
const currentPaneElement = computed(() => paneElements.value[props.current]);
|
|
2229
|
-
const paneHeight = useElementHeight(currentPaneElement);
|
|
2230
|
-
const trackOffset = computed(() => {
|
|
2231
|
-
const index = props.panes.indexOf(props.current);
|
|
2232
|
-
return index > 0 ? `translateX(calc(${-index} * (100% + ${PANE_GAP})))` : "translateX(0px)";
|
|
2233
|
-
});
|
|
2234
|
-
return (_ctx, _cache) => {
|
|
2235
|
-
return openBlock(), createElementBlock("div", {
|
|
2236
|
-
class: normalizeClass([
|
|
2237
|
-
"sv-sliding-panes__viewport relative -mx-2 overflow-hidden px-2",
|
|
2238
|
-
isSwitchingPanes.value ? "transition-[height] duration-300 ease-in-out motion-reduce:transition-none" : ""
|
|
2239
|
-
]),
|
|
2240
|
-
style: normalizeStyle(unref(paneHeight) ? { height: `${unref(paneHeight)}px` } : void 0)
|
|
2241
|
-
}, [
|
|
2242
|
-
createElementVNode("div", {
|
|
2243
|
-
class: "sv-sliding-panes__track flex items-start gap-4 transition-transform duration-300 ease-in-out motion-reduce:transition-none",
|
|
2244
|
-
style: normalizeStyle({ transform: trackOffset.value })
|
|
2245
|
-
}, [
|
|
2246
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.panes, (pane) => {
|
|
2247
|
-
return openBlock(), createElementBlock("div", {
|
|
2248
|
-
key: pane,
|
|
2249
|
-
class: "sv-sliding-panes__pane w-full shrink-0",
|
|
2250
|
-
inert: pane !== __props.current || void 0
|
|
2251
|
-
}, [
|
|
2252
|
-
createElementVNode("div", {
|
|
2253
|
-
ref_for: true,
|
|
2254
|
-
ref: setPaneElement(pane)
|
|
2255
|
-
}, [
|
|
2256
|
-
renderSlot(_ctx.$slots, pane)
|
|
2257
|
-
], 512)
|
|
2258
|
-
], 8, _hoisted_1$4);
|
|
2259
|
-
}), 128))
|
|
2260
|
-
], 4)
|
|
2261
|
-
], 6);
|
|
2262
|
-
};
|
|
2263
|
-
}
|
|
2264
|
-
});
|
|
2265
|
-
const _hoisted_1$3 = { class: "grid grid-cols-1 gap-4 pb-4" };
|
|
2266
|
-
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
2267
|
-
__name: "WalletModalShell",
|
|
2268
|
-
props: {
|
|
2269
|
-
showModal: { type: Boolean },
|
|
2270
|
-
title: { type: String },
|
|
2271
|
-
subTitle: { type: String },
|
|
2272
|
-
cancelButtonText: { type: String },
|
|
2273
|
-
confirmButtonText: { type: String },
|
|
2274
|
-
isPending: { type: Boolean },
|
|
2275
|
-
panes: { type: Array },
|
|
2276
|
-
step: { type: String },
|
|
2277
|
-
addPaymentMethodPane: { type: String },
|
|
2278
|
-
customer: { type: Object },
|
|
2279
|
-
paymentMethodOptions: { type: Array },
|
|
2280
|
-
isPaymentMethodOptionsPending: { type: Boolean },
|
|
2281
|
-
isAddingPaymentMethod: { type: Boolean }
|
|
2282
|
-
},
|
|
2283
|
-
emits: ["confirm", "cancel", "payment-success", "payment-failed"],
|
|
2284
|
-
setup(__props, { expose: __expose }) {
|
|
2285
|
-
const props = __props;
|
|
2286
|
-
const paneRef = ref();
|
|
2287
|
-
const hostPanes = computed(() => props.panes.filter((pane) => pane !== props.addPaymentMethodPane));
|
|
2288
|
-
__expose({
|
|
2289
|
-
submit: () => {
|
|
2290
|
-
var _a;
|
|
2291
|
-
return (_a = paneRef.value) == null ? void 0 : _a.submit();
|
|
2292
|
-
},
|
|
2293
|
-
isSaving: computed(() => {
|
|
2294
|
-
var _a;
|
|
2295
|
-
return !!((_a = paneRef.value) == null ? void 0 : _a.isSaving);
|
|
2296
|
-
})
|
|
2297
|
-
});
|
|
2298
|
-
return (_ctx, _cache) => {
|
|
2299
|
-
return openBlock(), createBlock(unref(Modal), {
|
|
2300
|
-
"no-click-away": "",
|
|
2301
|
-
"show-modal": __props.showModal,
|
|
2302
|
-
size: "lg",
|
|
2303
|
-
title: __props.title,
|
|
2304
|
-
"sub-title": __props.subTitle,
|
|
2305
|
-
"cancel-button-text": __props.cancelButtonText,
|
|
2306
|
-
"confirm-button-text": __props.confirmButtonText,
|
|
2307
|
-
"is-loading": __props.isPending,
|
|
2308
|
-
onConfirm: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("confirm")),
|
|
2309
|
-
onClose: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("cancel"))
|
|
2310
|
-
}, createSlots({
|
|
2311
|
-
body: withCtx(() => [
|
|
2312
|
-
createElementVNode("div", _hoisted_1$3, [
|
|
2313
|
-
createVNode(_sfc_main$5, {
|
|
2314
|
-
panes: __props.panes,
|
|
2315
|
-
current: __props.step
|
|
2316
|
-
}, createSlots({
|
|
2317
|
-
[__props.addPaymentMethodPane]: withCtx(() => [
|
|
2318
|
-
createVNode(_sfc_main$u, {
|
|
2319
|
-
ref_key: "paneRef",
|
|
2320
|
-
ref: paneRef,
|
|
2321
|
-
customer: __props.customer,
|
|
2322
|
-
"payment-method-options": __props.paymentMethodOptions,
|
|
2323
|
-
"is-loading": __props.isPaymentMethodOptionsPending,
|
|
2324
|
-
"is-active": __props.isAddingPaymentMethod,
|
|
2325
|
-
onSuccess: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("payment-success")),
|
|
2326
|
-
onFailure: _cache[1] || (_cache[1] = (error) => _ctx.$emit("payment-failed", error))
|
|
2327
|
-
}, null, 8, ["customer", "payment-method-options", "is-loading", "is-active"])
|
|
2328
|
-
]),
|
|
2329
|
-
_: 2
|
|
2330
|
-
}, [
|
|
2331
|
-
renderList(hostPanes.value, (pane) => {
|
|
2332
|
-
return {
|
|
2333
|
-
name: pane,
|
|
2334
|
-
fn: withCtx(() => [
|
|
2335
|
-
renderSlot(_ctx.$slots, pane)
|
|
2336
|
-
])
|
|
2337
|
-
};
|
|
2338
|
-
})
|
|
2339
|
-
]), 1032, ["panes", "current"])
|
|
2340
|
-
])
|
|
2341
|
-
]),
|
|
2342
|
-
_: 2
|
|
2343
|
-
}, [
|
|
2344
|
-
_ctx.$slots.footer ? {
|
|
2345
|
-
name: "footer",
|
|
2346
|
-
fn: withCtx(() => [
|
|
2347
|
-
renderSlot(_ctx.$slots, "footer")
|
|
2348
|
-
]),
|
|
2349
|
-
key: "0"
|
|
2350
|
-
} : void 0
|
|
2351
|
-
]), 1032, ["show-modal", "title", "sub-title", "cancel-button-text", "confirm-button-text", "is-loading"]);
|
|
2352
|
-
};
|
|
2353
|
-
}
|
|
2354
|
-
});
|
|
2355
|
-
const getActiveAutoTopUpConfig = (walletBalanceItem) => {
|
|
2356
|
-
var _a;
|
|
2357
|
-
return (((_a = walletBalanceItem == null ? void 0 : walletBalanceItem.wallet) == null ? void 0 : _a.auto_top_up_configs) ?? []).find(
|
|
2358
|
-
({ status }) => status === "ACTIVE"
|
|
2359
|
-
);
|
|
2360
|
-
};
|
|
2361
|
-
const toAutoTopUpRule = (config) => config ? {
|
|
2362
|
-
status: config.status,
|
|
2363
|
-
threshold: config.threshold,
|
|
2364
|
-
...config.topup_amount && { topup_amount: config.topup_amount }
|
|
2365
|
-
} : void 0;
|
|
2366
|
-
const getAutoTopUpChargeTarget = (topUpItem, topUpPricingItems = []) => {
|
|
2367
|
-
if ((topUpItem == null ? void 0 : topUpItem.pricing_item_id) && topUpItem.pricing_plan_schedule_id) {
|
|
2368
|
-
return {
|
|
2369
|
-
pricingItemId: topUpItem.pricing_item_id,
|
|
2370
|
-
pricingPlanScheduleId: topUpItem.pricing_plan_schedule_id
|
|
2371
|
-
};
|
|
2372
|
-
}
|
|
2373
|
-
const flexible = topUpPricingItems.find(
|
|
2374
|
-
({ flexiblePricing, pricingPlanScheduleId }) => flexiblePricing && pricingPlanScheduleId
|
|
2375
|
-
);
|
|
2376
|
-
return (flexible == null ? void 0 : flexible.pricingPlanScheduleId) ? {
|
|
2377
|
-
pricingItemId: flexible.pricingItemId,
|
|
2378
|
-
pricingPlanScheduleId: flexible.pricingPlanScheduleId
|
|
2379
|
-
} : void 0;
|
|
2380
|
-
};
|
|
2381
|
-
const toCreateAutoTopUpConfigPayload = ({
|
|
2382
|
-
rule,
|
|
2383
|
-
walletBalanceItem,
|
|
2384
|
-
chargeTarget,
|
|
2385
|
-
paymentMethodId
|
|
2386
|
-
}) => {
|
|
2387
|
-
var _a, _b;
|
|
2388
|
-
const hasThreshold = !!(((_a = rule == null ? void 0 : rule.threshold) == null ? void 0 : _a.amount) ?? ((_b = rule == null ? void 0 : rule.threshold) == null ? void 0 : _b.credits));
|
|
2389
|
-
if (!rule || !hasThreshold || !(walletBalanceItem == null ? void 0 : walletBalanceItem.wallet_id) || !chargeTarget || !paymentMethodId) {
|
|
2390
|
-
return void 0;
|
|
2391
|
-
}
|
|
2392
|
-
return {
|
|
2393
|
-
wallet_id: walletBalanceItem.wallet_id,
|
|
2394
|
-
status: rule.status,
|
|
2395
|
-
threshold: rule.threshold,
|
|
2396
|
-
pricing_plan_schedule_id: chargeTarget.pricingPlanScheduleId,
|
|
2397
|
-
pricing_item_id: chargeTarget.pricingItemId,
|
|
2398
|
-
payment_method_id: paymentMethodId,
|
|
2399
|
-
...rule.topup_amount && { topup_amount: rule.topup_amount }
|
|
2400
|
-
};
|
|
2401
|
-
};
|
|
2402
|
-
function useAddPaymentMethodStep({
|
|
2403
|
-
step,
|
|
2404
|
-
name,
|
|
2405
|
-
returnTo
|
|
2406
|
-
}) {
|
|
2407
|
-
const paneRef = ref();
|
|
2408
|
-
return {
|
|
2409
|
-
paneRef,
|
|
2410
|
-
isActive: computed(() => step.value === name),
|
|
2411
|
-
isSaving: computed(() => {
|
|
2412
|
-
var _a;
|
|
2413
|
-
return !!((_a = paneRef.value) == null ? void 0 : _a.isSaving);
|
|
2414
|
-
}),
|
|
2415
|
-
open: () => {
|
|
2416
|
-
step.value = name;
|
|
2417
|
-
},
|
|
2418
|
-
leave: () => {
|
|
2419
|
-
step.value = returnTo;
|
|
2420
|
-
},
|
|
2421
|
-
submit: () => {
|
|
2422
|
-
var _a;
|
|
2423
|
-
return (_a = paneRef.value) == null ? void 0 : _a.submit();
|
|
2424
|
-
}
|
|
2425
|
-
};
|
|
2426
|
-
}
|
|
2427
|
-
function createAutoTopUpConfigsService() {
|
|
2428
|
-
const request = createRequestService();
|
|
2429
|
-
const config = useConfig();
|
|
2430
|
-
const BASE_URL = "/portal/auto-top-up-configs";
|
|
2431
|
-
function getAutoTopUpConfigs(filters) {
|
|
2432
|
-
return request({
|
|
2433
|
-
url: `${config.apiUrls.config}${BASE_URL}`,
|
|
2434
|
-
query: { ...filters },
|
|
2435
|
-
isCollection: true
|
|
2436
|
-
});
|
|
2437
|
-
}
|
|
2438
|
-
function getAutoTopUpConfig(configId) {
|
|
2439
|
-
return request({
|
|
2440
|
-
url: `${config.apiUrls.config}${BASE_URL}/${configId}`
|
|
2441
|
-
});
|
|
2442
|
-
}
|
|
2443
|
-
function createAutoTopUpConfig(payload) {
|
|
2444
|
-
return request({
|
|
2445
|
-
url: `${config.apiUrls.config}${BASE_URL}`,
|
|
2446
|
-
options: { method: "POST" },
|
|
2447
|
-
data: payload
|
|
2448
|
-
});
|
|
2449
|
-
}
|
|
2450
|
-
function deactivateAutoTopUpConfig(configId) {
|
|
2451
|
-
return request({
|
|
2452
|
-
url: `${config.apiUrls.config}${BASE_URL}/${configId}/deactivate`,
|
|
2453
|
-
options: { method: "POST" }
|
|
2454
|
-
});
|
|
2455
|
-
}
|
|
2456
|
-
return {
|
|
2457
|
-
getAutoTopUpConfigs,
|
|
2458
|
-
getAutoTopUpConfig,
|
|
2459
|
-
createAutoTopUpConfig,
|
|
2460
|
-
deactivateAutoTopUpConfig
|
|
2461
|
-
};
|
|
2462
|
-
}
|
|
2463
|
-
function useSaveAutoTopUpConfig() {
|
|
2464
|
-
const { createAutoTopUpConfig } = createAutoTopUpConfigsService();
|
|
2465
|
-
const logger = useLogger();
|
|
2466
|
-
const isSaving = ref(false);
|
|
2467
|
-
const save = async (payload) => {
|
|
2468
|
-
if (!payload || isSaving.value) {
|
|
2469
|
-
return { saved: false };
|
|
2470
|
-
}
|
|
2471
|
-
isSaving.value = true;
|
|
2472
|
-
try {
|
|
2473
|
-
await createAutoTopUpConfig(payload);
|
|
2474
|
-
return { saved: true };
|
|
2475
|
-
} catch (error) {
|
|
2476
|
-
logger.error(
|
|
2477
|
-
"AUTO_TOP_UP_SAVE_FAILED",
|
|
2478
|
-
"Failed to save the automatic top-up rule",
|
|
2479
|
-
{},
|
|
2480
|
-
error
|
|
2481
|
-
);
|
|
2482
|
-
return { saved: false, error };
|
|
2483
|
-
} finally {
|
|
2484
|
-
isSaving.value = false;
|
|
2485
|
-
}
|
|
2486
|
-
};
|
|
2487
|
-
return { save, isSaving };
|
|
2488
|
-
}
|
|
2489
|
-
const _hoisted_1$2 = {
|
|
2490
|
-
key: 0,
|
|
2491
|
-
class: "mb-4"
|
|
2492
|
-
};
|
|
2493
|
-
const _hoisted_2 = { class: "sr-only" };
|
|
2494
|
-
const _hoisted_3 = { class: "flex flex-col gap-2" };
|
|
2495
|
-
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
2496
|
-
__name: "TopUpModal",
|
|
2497
|
-
props: {
|
|
2498
|
-
showModal: { type: Boolean },
|
|
2499
|
-
selectedBalanceItem: { type: Object },
|
|
2500
|
-
paymentMethods: { type: Array },
|
|
2501
|
-
customer: { type: Object },
|
|
2502
|
-
subscriptions: { type: Array }
|
|
2503
|
-
},
|
|
2504
|
-
emits: ["confirm", "close", "auto-top-up-saved", "payment-success", "payment-failed"],
|
|
2505
|
-
setup(__props, { emit: __emit }) {
|
|
2506
|
-
const props = __props;
|
|
2507
|
-
const emit = __emit;
|
|
2508
|
-
const { $t } = useIntl();
|
|
2509
|
-
const { formatOpenBalance } = useWalletBalanceFormat();
|
|
2510
|
-
const savedAutoTopUpRule = computed(
|
|
2511
|
-
() => toAutoTopUpRule(getActiveAutoTopUpConfig(props.selectedBalanceItem))
|
|
2512
|
-
);
|
|
2513
|
-
const currentBalance = computed(() => formatOpenBalance(props.selectedBalanceItem));
|
|
2514
|
-
const topUpSubscriptions = computed(
|
|
2515
|
-
() => getTopUpSubscriptions(props.selectedBalanceItem, props.subscriptions ?? [])
|
|
2516
|
-
);
|
|
2517
|
-
const selectedSubscriptionId = ref();
|
|
2518
|
-
watch(
|
|
2519
|
-
topUpSubscriptions,
|
|
2520
|
-
(available) => {
|
|
2521
|
-
var _a;
|
|
2522
|
-
const chosenIsStillOffered = available.some(
|
|
2523
|
-
({ id }) => id === selectedSubscriptionId.value
|
|
2524
|
-
);
|
|
2525
|
-
if (!chosenIsStillOffered) {
|
|
2526
|
-
selectedSubscriptionId.value = (_a = available[0]) == null ? void 0 : _a.id;
|
|
2527
|
-
}
|
|
2528
|
-
},
|
|
2529
|
-
{ immediate: true }
|
|
2530
|
-
);
|
|
2531
|
-
const hasSubscriptionChoice = computed(() => topUpSubscriptions.value.length > 1);
|
|
2532
|
-
const subscriptionOptions = computed(
|
|
2533
|
-
() => topUpSubscriptions.value.map(({ id, name }) => ({ value: id, label: name }))
|
|
2534
|
-
);
|
|
2535
|
-
const summaryById = computed(
|
|
2536
|
-
() => Object.fromEntries(
|
|
2537
|
-
topUpSubscriptions.value.flatMap(({ id, enabledPricingIds }) => {
|
|
2538
|
-
const subscription = (props.subscriptions ?? []).find(({ id: it }) => it === id);
|
|
2539
|
-
return subscription ? [[id, { subscription, enabledPricingIds }]] : [];
|
|
2540
|
-
})
|
|
2541
|
-
)
|
|
2542
|
-
);
|
|
2543
|
-
const balanceItemForSubscription = computed(() => {
|
|
2544
|
-
var _a;
|
|
2545
|
-
if (!props.selectedBalanceItem || !((_a = props.subscriptions) == null ? void 0 : _a.length)) {
|
|
2546
|
-
return props.selectedBalanceItem;
|
|
2547
|
-
}
|
|
2548
|
-
const selected = topUpSubscriptions.value.find(({ id }) => id === selectedSubscriptionId.value);
|
|
2549
|
-
if (!selected) {
|
|
2550
|
-
return { ...props.selectedBalanceItem, charge_on_demand_pricing_items: [] };
|
|
2551
|
-
}
|
|
2552
|
-
return withTopUpPricingItemsForSchedules(props.selectedBalanceItem, selected.scheduleIds);
|
|
2553
|
-
});
|
|
2554
|
-
const topUpPricingItems = computed(() => getTopUpPricingItems(balanceItemForSubscription.value));
|
|
2555
|
-
const {
|
|
2556
|
-
paymentMethodOptions,
|
|
2557
|
-
settledOptions,
|
|
2558
|
-
isPending: isPaymentMethodOptionsPending
|
|
2559
|
-
} = useCustomerPaymentMethodOptions({
|
|
2560
|
-
isOpen: computed(() => props.showModal),
|
|
2561
|
-
customer: computed(() => props.customer)
|
|
2562
|
-
});
|
|
2563
|
-
const step = ref("TOP_UP");
|
|
2564
|
-
const hasStoredPaymentMethods = computed(() => (props.paymentMethods ?? []).length > 0);
|
|
2565
|
-
const hasNoPaymentMethodOptions = computed(
|
|
2566
|
-
() => !isPaymentMethodOptionsPending.value && (paymentMethodOptions.value ?? []).length === 0
|
|
2567
|
-
);
|
|
2568
|
-
const isTopUpUnavailable = computed(
|
|
2569
|
-
() => step.value === "TOP_UP" && !hasStoredPaymentMethods.value && hasNoPaymentMethodOptions.value
|
|
2570
|
-
);
|
|
2571
|
-
const chargedInvoice = ref();
|
|
2572
|
-
const chargedValue = ref();
|
|
2573
|
-
const handlePaymentSuccess = () => {
|
|
2574
|
-
leaveAddPaymentMethod();
|
|
2575
|
-
emit("payment-success");
|
|
2576
|
-
};
|
|
2577
|
-
const {
|
|
2578
|
-
paneRef: addPaymentMethodRef,
|
|
2579
|
-
isActive: isAddingPaymentMethod,
|
|
2580
|
-
isSaving: isSavingPaymentMethod,
|
|
2581
|
-
open: openAddPaymentMethod,
|
|
2582
|
-
leave: leaveAddPaymentMethod,
|
|
2583
|
-
submit: submitPaymentMethod
|
|
2584
|
-
} = useAddPaymentMethodStep({ step, name: "ADD_PAYMENT_METHOD", returnTo: "TOP_UP" });
|
|
2585
|
-
const { save: saveRule } = useSaveAutoTopUpConfig();
|
|
2586
|
-
const topUpFormRef = ref();
|
|
2587
|
-
const topUpValue = computed(() => {
|
|
2588
|
-
var _a;
|
|
2589
|
-
return (_a = topUpFormRef.value) == null ? void 0 : _a.chargedValue;
|
|
2590
|
-
});
|
|
2591
|
-
const isPending = computed(() => {
|
|
2592
|
-
var _a;
|
|
2593
|
-
return isSavingPaymentMethod.value || !!((_a = topUpFormRef.value) == null ? void 0 : _a.isCharging);
|
|
2594
|
-
});
|
|
2595
|
-
const { title, subTitle, cancelButtonText, confirmButtonText } = useTopUpModalLabels({
|
|
2596
|
-
step,
|
|
2597
|
-
currentBalance,
|
|
2598
|
-
topUpValue
|
|
2599
|
-
});
|
|
2600
|
-
const handleConfirm = () => {
|
|
2601
|
-
var _a;
|
|
2602
|
-
if (isAddingPaymentMethod.value) {
|
|
2603
|
-
submitPaymentMethod();
|
|
2604
|
-
return;
|
|
2605
|
-
}
|
|
2606
|
-
void ((_a = topUpFormRef.value) == null ? void 0 : _a.submit());
|
|
2607
|
-
};
|
|
2608
|
-
const handleSaveAutoTopUp = async ({
|
|
2609
|
-
rule,
|
|
2610
|
-
paymentMethodId
|
|
2611
|
-
}) => {
|
|
2612
|
-
const { saved } = await saveRule(
|
|
2613
|
-
toCreateAutoTopUpConfigPayload({
|
|
2614
|
-
rule,
|
|
2615
|
-
walletBalanceItem: props.selectedBalanceItem,
|
|
2616
|
-
chargeTarget: getAutoTopUpChargeTarget(void 0, topUpPricingItems.value),
|
|
2617
|
-
paymentMethodId
|
|
2618
|
-
})
|
|
2619
|
-
);
|
|
2620
|
-
if (saved) {
|
|
2621
|
-
emit("auto-top-up-saved");
|
|
2622
|
-
}
|
|
2623
|
-
};
|
|
2624
|
-
const handleTopUpSuccess = (invoice) => {
|
|
2625
|
-
var _a;
|
|
2626
|
-
chargedInvoice.value = invoice;
|
|
2627
|
-
chargedValue.value = (_a = topUpFormRef.value) == null ? void 0 : _a.chargedValue;
|
|
2628
|
-
step.value = "SUCCESS";
|
|
2629
|
-
};
|
|
2630
|
-
const handleDone = () => {
|
|
2631
|
-
emit("confirm");
|
|
2632
|
-
emit("close");
|
|
2633
|
-
};
|
|
2634
|
-
const handleCancel = () => {
|
|
2635
|
-
if (isPending.value) {
|
|
2636
|
-
return;
|
|
2637
|
-
}
|
|
2638
|
-
if (isAddingPaymentMethod.value) {
|
|
2639
|
-
leaveAddPaymentMethod();
|
|
2640
|
-
return;
|
|
2641
|
-
}
|
|
2642
|
-
if (step.value === "SUCCESS") {
|
|
2643
|
-
handleDone();
|
|
2644
|
-
return;
|
|
2645
|
-
}
|
|
2646
|
-
emit("close");
|
|
2647
|
-
};
|
|
2648
|
-
const topUpFormKey = ref(0);
|
|
2649
|
-
watch(
|
|
2650
|
-
() => props.showModal,
|
|
2651
|
-
(showModal) => {
|
|
2652
|
-
if (!showModal) {
|
|
2653
|
-
return;
|
|
2654
|
-
}
|
|
2655
|
-
step.value = "TOP_UP";
|
|
2656
|
-
chargedInvoice.value = void 0;
|
|
2657
|
-
chargedValue.value = void 0;
|
|
2658
|
-
topUpFormKey.value += 1;
|
|
2659
|
-
}
|
|
2660
|
-
);
|
|
2661
|
-
return (_ctx, _cache) => {
|
|
2662
|
-
return openBlock(), createBlock(_sfc_main$4, {
|
|
2663
|
-
ref_key: "addPaymentMethodRef",
|
|
2664
|
-
ref: addPaymentMethodRef,
|
|
2665
|
-
"show-modal": __props.showModal,
|
|
2666
|
-
title: unref(title),
|
|
2667
|
-
"sub-title": unref(subTitle),
|
|
2668
|
-
"cancel-button-text": unref(cancelButtonText),
|
|
2669
|
-
"confirm-button-text": unref(confirmButtonText),
|
|
2670
|
-
"is-pending": isPending.value,
|
|
2671
|
-
panes: unref(TOP_UP_MODAL_STEPS),
|
|
2672
|
-
step: step.value,
|
|
2673
|
-
"add-payment-method-pane": "ADD_PAYMENT_METHOD",
|
|
2674
|
-
customer: __props.customer,
|
|
2675
|
-
"payment-method-options": unref(paymentMethodOptions),
|
|
2676
|
-
"is-payment-method-options-pending": unref(isPaymentMethodOptionsPending),
|
|
2677
|
-
"is-adding-payment-method": unref(isAddingPaymentMethod),
|
|
2678
|
-
onConfirm: handleConfirm,
|
|
2679
|
-
onCancel: handleCancel,
|
|
2680
|
-
onPaymentSuccess: handlePaymentSuccess,
|
|
2681
|
-
onPaymentFailed: _cache[1] || (_cache[1] = (error) => _ctx.$emit("payment-failed", error))
|
|
2682
|
-
}, createSlots({
|
|
2683
|
-
TOP_UP: withCtx(() => [
|
|
2684
|
-
hasSubscriptionChoice.value ? (openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
2685
|
-
createVNode(unref(_sfc_main$r), {
|
|
2686
|
-
modelValue: selectedSubscriptionId.value,
|
|
2687
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedSubscriptionId.value = $event),
|
|
2688
|
-
class: "sv-topup-modal__subscription",
|
|
2689
|
-
name: "top-up-subscription",
|
|
2690
|
-
direction: "column",
|
|
2691
|
-
required: "",
|
|
2692
|
-
options: subscriptionOptions.value,
|
|
2693
|
-
"show-radio": false,
|
|
2694
|
-
label: unref($t)({
|
|
2695
|
-
defaultMessage: "Subscription to top up",
|
|
2696
|
-
description: "Label above the list of subscriptions a top-up can be charged against, in the top-up modal",
|
|
2697
|
-
id: "topup_modal.subscriptions.label"
|
|
2698
|
-
})
|
|
2699
|
-
}, {
|
|
2700
|
-
prefix: withCtx(({ optionValue }) => [
|
|
2701
|
-
summaryById.value[String(optionValue)] ? (openBlock(), createBlock(_sfc_main$v, {
|
|
2702
|
-
key: 0,
|
|
2703
|
-
class: "sv-topup-modal__subscription-option grow",
|
|
2704
|
-
"no-spacing": "",
|
|
2705
|
-
subscription: summaryById.value[String(optionValue)].subscription,
|
|
2706
|
-
"enabled-pricing-ids": summaryById.value[String(optionValue)].enabledPricingIds
|
|
2707
|
-
}, null, 8, ["subscription", "enabled-pricing-ids"])) : createCommentVNode("", true)
|
|
2708
|
-
]),
|
|
2709
|
-
label: withCtx(({ option }) => [
|
|
2710
|
-
createElementVNode("span", _hoisted_2, toDisplayString(option.label), 1)
|
|
2711
|
-
]),
|
|
2712
|
-
_: 1
|
|
2713
|
-
}, 8, ["modelValue", "options", "label"])
|
|
2714
|
-
])) : createCommentVNode("", true),
|
|
2715
|
-
(openBlock(), createBlock(_sfc_main$7, {
|
|
2716
|
-
key: topUpFormKey.value,
|
|
2717
|
-
ref_key: "topUpFormRef",
|
|
2718
|
-
ref: topUpFormRef,
|
|
2719
|
-
"top-up-pricing-items": topUpPricingItems.value,
|
|
2720
|
-
"payment-methods": __props.paymentMethods,
|
|
2721
|
-
"auto-top-up-config": savedAutoTopUpRule.value,
|
|
2722
|
-
"payment-method-options": unref(settledOptions),
|
|
2723
|
-
onAddPaymentMethod: unref(openAddPaymentMethod),
|
|
2724
|
-
onSuccess: handleTopUpSuccess,
|
|
2725
|
-
onSaveAutoTopUp: handleSaveAutoTopUp
|
|
2726
|
-
}, null, 8, ["top-up-pricing-items", "payment-methods", "auto-top-up-config", "payment-method-options", "onAddPaymentMethod"]))
|
|
2727
|
-
]),
|
|
2728
|
-
SUCCESS: withCtx(() => [
|
|
2729
|
-
chargedInvoice.value ? (openBlock(), createBlock(_sfc_main$6, {
|
|
2730
|
-
key: 0,
|
|
2731
|
-
"added-value": chargedValue.value,
|
|
2732
|
-
invoice: chargedInvoice.value
|
|
2733
|
-
}, null, 8, ["added-value", "invoice"])) : createCommentVNode("", true)
|
|
2734
|
-
]),
|
|
2735
|
-
_: 2
|
|
2736
|
-
}, [
|
|
2737
|
-
step.value === "SUCCESS" || isTopUpUnavailable.value ? {
|
|
2738
|
-
name: "footer",
|
|
2739
|
-
fn: withCtx(() => [
|
|
2740
|
-
createElementVNode("div", _hoisted_3, [
|
|
2741
|
-
step.value === "SUCCESS" ? (openBlock(), createBlock(unref(_sfc_main$i), {
|
|
2742
|
-
key: 0,
|
|
2743
|
-
size: "lg",
|
|
2744
|
-
"data-testid": "done",
|
|
2745
|
-
onClick: handleDone
|
|
2746
|
-
}, {
|
|
2747
|
-
default: withCtx(() => [
|
|
2748
|
-
createTextVNode(toDisplayString(unref(confirmButtonText)), 1)
|
|
2749
|
-
]),
|
|
2750
|
-
_: 1
|
|
2751
|
-
})) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
2752
|
-
createVNode(unref(_sfc_main$i), {
|
|
2753
|
-
size: "lg",
|
|
2754
|
-
disabled: "",
|
|
2755
|
-
"data-testid": "confirm"
|
|
2756
|
-
}, {
|
|
2757
|
-
default: withCtx(() => [
|
|
2758
|
-
createTextVNode(toDisplayString(unref(confirmButtonText)), 1)
|
|
2759
|
-
]),
|
|
2760
|
-
_: 1
|
|
2761
|
-
}),
|
|
2762
|
-
createVNode(unref(_sfc_main$i), {
|
|
2763
|
-
size: "lg",
|
|
2764
|
-
intent: "subtle",
|
|
2765
|
-
"data-testid": "cancel",
|
|
2766
|
-
onClick: handleCancel
|
|
2767
|
-
}, {
|
|
2768
|
-
default: withCtx(() => [
|
|
2769
|
-
createTextVNode(toDisplayString(unref(cancelButtonText)), 1)
|
|
2770
|
-
]),
|
|
2771
|
-
_: 1
|
|
2772
|
-
})
|
|
2773
|
-
], 64))
|
|
2774
|
-
])
|
|
2775
|
-
]),
|
|
2776
|
-
key: "0"
|
|
2777
|
-
} : void 0
|
|
2778
|
-
]), 1032, ["show-modal", "title", "sub-title", "cancel-button-text", "confirm-button-text", "is-pending", "panes", "step", "customer", "payment-method-options", "is-payment-method-options-pending", "is-adding-payment-method"]);
|
|
2779
|
-
};
|
|
2780
|
-
}
|
|
2781
|
-
});
|
|
2782
|
-
const AUTO_TOP_UP_MODAL_STEPS = ["AUTO_TOP_UP", "ADD_PAYMENT_METHOD"];
|
|
2783
|
-
const _hoisted_1$1 = { class: "grid grid-cols-1 gap-4" };
|
|
2784
|
-
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
2785
|
-
__name: "AutoTopUpModal",
|
|
2786
|
-
props: {
|
|
2787
|
-
showModal: { type: Boolean },
|
|
2788
|
-
walletBalanceItem: { type: Object },
|
|
2789
|
-
topUpItem: { type: Object },
|
|
2790
|
-
paymentMethods: { type: Array },
|
|
2791
|
-
customer: { type: Object }
|
|
2792
|
-
},
|
|
2793
|
-
emits: ["saved", "close", "payment-success", "payment-failed"],
|
|
2794
|
-
setup(__props, { emit: __emit }) {
|
|
2795
|
-
const props = __props;
|
|
2796
|
-
const emit = __emit;
|
|
2797
|
-
const { $t } = useIntl();
|
|
2798
|
-
const { formatOpenBalance } = useWalletBalanceFormat();
|
|
2799
|
-
const step = ref("AUTO_TOP_UP");
|
|
2800
|
-
const currentBalance = computed(() => formatOpenBalance(props.walletBalanceItem));
|
|
2801
|
-
const topUpPricingItems = computed(() => getTopUpPricingItems(props.walletBalanceItem));
|
|
2802
|
-
const autoTopUpEditor = computed(() => getAutoTopUpEditorConfig(topUpPricingItems.value));
|
|
2803
|
-
const savedConfig = computed(() => getActiveAutoTopUpConfig(props.walletBalanceItem));
|
|
2804
|
-
const savedRule = computed(() => toAutoTopUpRule(savedConfig.value));
|
|
2805
|
-
const chargeTarget = computed(
|
|
2806
|
-
() => getAutoTopUpChargeTarget(props.topUpItem, topUpPricingItems.value)
|
|
2807
|
-
);
|
|
2808
|
-
const autoTopUpFormRef = ref();
|
|
2809
|
-
const previewPricingItems = computed(() => {
|
|
2810
|
-
var _a, _b;
|
|
2811
|
-
const amount = (_b = (_a = autoTopUpFormRef.value) == null ? void 0 : _a.rule) == null ? void 0 : _b.topup_amount;
|
|
2812
|
-
return (amount == null ? void 0 : amount.quantity) && chargeTarget.value ? [{ pricing_item_id: chargeTarget.value.pricingItemId, flexible_amount: amount }] : void 0;
|
|
2813
|
-
});
|
|
2814
|
-
const previewScheduleId = computed(() => {
|
|
2815
|
-
var _a;
|
|
2816
|
-
return (_a = chargeTarget.value) == null ? void 0 : _a.pricingPlanScheduleId;
|
|
2817
|
-
});
|
|
2818
|
-
const selectedPaymentMethodId = ref();
|
|
2819
|
-
const { sortedPaymentMethods } = useDefaultPaymentMethod({
|
|
2820
|
-
paymentMethods: computed(() => props.paymentMethods),
|
|
2821
|
-
selectedPaymentMethodId,
|
|
2822
|
-
preferredPaymentMethodId: computed(() => {
|
|
2823
|
-
var _a;
|
|
2824
|
-
return (_a = savedConfig.value) == null ? void 0 : _a.payment_method_id;
|
|
2825
|
-
})
|
|
2826
|
-
});
|
|
2827
|
-
const {
|
|
2828
|
-
paymentMethodOptions,
|
|
2829
|
-
settledOptions,
|
|
2830
|
-
isPending: isPaymentMethodOptionsPending
|
|
2831
|
-
} = useCustomerPaymentMethodOptions({
|
|
2832
|
-
isOpen: computed(() => props.showModal),
|
|
2833
|
-
customer: computed(() => props.customer)
|
|
2834
|
-
});
|
|
2835
|
-
const {
|
|
2836
|
-
paneRef: addPaymentMethodRef,
|
|
2837
|
-
isActive: isAddingPaymentMethod,
|
|
2838
|
-
isSaving: isSavingPaymentMethod,
|
|
2839
|
-
open: openAddPaymentMethod,
|
|
2840
|
-
leave: leaveAddPaymentMethod,
|
|
2841
|
-
submit: submitPaymentMethod
|
|
2842
|
-
} = useAddPaymentMethodStep({ step, name: "ADD_PAYMENT_METHOD", returnTo: "AUTO_TOP_UP" });
|
|
2843
|
-
const { save: saveRule, isSaving: isSavingRule } = useSaveAutoTopUpConfig();
|
|
2844
|
-
const isPending = computed(() => isSavingPaymentMethod.value || isSavingRule.value);
|
|
2845
|
-
const validationState = reactive({
|
|
2846
|
-
paymentMethodId: computed(() => selectedPaymentMethodId.value ?? null)
|
|
2847
|
-
});
|
|
2848
|
-
const validation = useValidation(
|
|
2849
|
-
{
|
|
2850
|
-
paymentMethodId: {
|
|
2851
|
-
required: common.withMessage(
|
|
2852
|
-
() => $t({
|
|
2853
|
-
defaultMessage: "Select a payment method to pay for automatic top-ups.",
|
|
2854
|
-
description: "Error shown in the auto top-up modal when no payment method is selected",
|
|
2855
|
-
id: "auto_topup_modal.payment_method.required"
|
|
2856
|
-
}),
|
|
2857
|
-
required
|
|
2858
|
-
)
|
|
2859
|
-
}
|
|
2860
|
-
},
|
|
2861
|
-
validationState
|
|
2862
|
-
);
|
|
2863
|
-
const title = computed(
|
|
2864
|
-
() => step.value === "ADD_PAYMENT_METHOD" ? $t({
|
|
2865
|
-
defaultMessage: "Add payment method",
|
|
2866
|
-
description: "Title of the auto top-up modal while the customer is adding a payment method",
|
|
2867
|
-
id: "auto_topup_modal.add_payment_method.title"
|
|
2868
|
-
}) : $t({
|
|
2869
|
-
defaultMessage: "Automatic top-up",
|
|
2870
|
-
description: "Title of the automatic wallet top-up modal",
|
|
2871
|
-
id: "auto_topup_modal.title"
|
|
2872
|
-
})
|
|
2873
|
-
);
|
|
2874
|
-
const subTitle = computed(
|
|
2875
|
-
() => step.value === "ADD_PAYMENT_METHOD" ? $t({
|
|
2876
|
-
defaultMessage: "This method pays for every automatic top-up.",
|
|
2877
|
-
description: "Subtitle of the auto top-up modal while the customer is adding a payment method",
|
|
2878
|
-
id: "auto_topup_modal.add_payment_method.subtitle"
|
|
2879
|
-
}) : $t(
|
|
2880
|
-
{
|
|
2881
|
-
defaultMessage: "Your current balance is {balance}. Enable auto top so you can stay productive",
|
|
2882
|
-
description: "Subtitle of the automatic wallet top-up modal, naming the balance",
|
|
2883
|
-
id: "auto_topup_modal.subtitle"
|
|
2884
|
-
},
|
|
2885
|
-
{ balance: currentBalance.value }
|
|
2886
|
-
)
|
|
2887
|
-
);
|
|
2888
|
-
const cancelButtonText = computed(
|
|
2889
|
-
() => step.value === "ADD_PAYMENT_METHOD" ? $t({
|
|
2890
|
-
defaultMessage: "Back",
|
|
2891
|
-
description: "Button returning from adding a payment method to the auto top-up rule",
|
|
2892
|
-
id: "auto_topup_modal.add_payment_method.cancel"
|
|
2893
|
-
}) : $t({
|
|
2894
|
-
defaultMessage: "Cancel",
|
|
2895
|
-
description: "Button dismissing the auto top-up modal",
|
|
2896
|
-
id: "auto_topup_modal.cancel"
|
|
2897
|
-
})
|
|
2898
|
-
);
|
|
2899
|
-
const confirmButtonText = computed(
|
|
2900
|
-
() => step.value === "ADD_PAYMENT_METHOD" ? $t({
|
|
2901
|
-
defaultMessage: "Add payment method",
|
|
2902
|
-
description: "Button storing the payment method being added in the auto top-up modal",
|
|
2903
|
-
id: "auto_topup_modal.add_payment_method.confirm"
|
|
2904
|
-
}) : $t({
|
|
2905
|
-
defaultMessage: "Save",
|
|
2906
|
-
description: "Button saving the automatic top-up rule",
|
|
2907
|
-
id: "auto_topup_modal.confirm"
|
|
2908
|
-
})
|
|
2909
|
-
);
|
|
2910
|
-
async function save() {
|
|
2911
|
-
var _a;
|
|
2912
|
-
validation.value.$touch();
|
|
2913
|
-
if (isPending.value) {
|
|
2914
|
-
return;
|
|
2915
|
-
}
|
|
2916
|
-
const { saved, error } = await saveRule(
|
|
2917
|
-
toCreateAutoTopUpConfigPayload({
|
|
2918
|
-
rule: (_a = autoTopUpFormRef.value) == null ? void 0 : _a.validate(),
|
|
2919
|
-
walletBalanceItem: props.walletBalanceItem,
|
|
2920
|
-
chargeTarget: chargeTarget.value,
|
|
2921
|
-
paymentMethodId: selectedPaymentMethodId.value
|
|
2922
|
-
})
|
|
2923
|
-
);
|
|
2924
|
-
if (saved) {
|
|
2925
|
-
emit("saved");
|
|
2926
|
-
emit("close");
|
|
2927
|
-
return;
|
|
2928
|
-
}
|
|
2929
|
-
if (error) {
|
|
2930
|
-
emit("payment-failed", error);
|
|
2931
|
-
}
|
|
2932
|
-
}
|
|
2933
|
-
const handleConfirm = () => {
|
|
2934
|
-
if (isAddingPaymentMethod.value) {
|
|
2935
|
-
submitPaymentMethod();
|
|
2936
|
-
return;
|
|
2937
|
-
}
|
|
2938
|
-
void save();
|
|
2939
|
-
};
|
|
2940
|
-
const handlePaymentSuccess = () => {
|
|
2941
|
-
leaveAddPaymentMethod();
|
|
2942
|
-
emit("payment-success");
|
|
2943
|
-
};
|
|
2944
|
-
const handleCancel = () => {
|
|
2945
|
-
if (isPending.value) {
|
|
2946
|
-
return;
|
|
2947
|
-
}
|
|
2948
|
-
if (isAddingPaymentMethod.value) {
|
|
2949
|
-
leaveAddPaymentMethod();
|
|
2950
|
-
return;
|
|
2951
|
-
}
|
|
2952
|
-
emit("close");
|
|
2953
|
-
};
|
|
2954
|
-
const formKey = ref(0);
|
|
2955
|
-
watch(
|
|
2956
|
-
() => props.showModal,
|
|
2957
|
-
(showModal) => {
|
|
2958
|
-
if (!showModal) {
|
|
2959
|
-
return;
|
|
2960
|
-
}
|
|
2961
|
-
step.value = "AUTO_TOP_UP";
|
|
2962
|
-
selectedPaymentMethodId.value = void 0;
|
|
2963
|
-
formKey.value += 1;
|
|
2964
|
-
}
|
|
2965
|
-
);
|
|
2966
|
-
return (_ctx, _cache) => {
|
|
2967
|
-
return openBlock(), createBlock(_sfc_main$4, {
|
|
2968
|
-
ref_key: "addPaymentMethodRef",
|
|
2969
|
-
ref: addPaymentMethodRef,
|
|
2970
|
-
"show-modal": __props.showModal,
|
|
2971
|
-
title: title.value,
|
|
2972
|
-
"sub-title": subTitle.value,
|
|
2973
|
-
"cancel-button-text": cancelButtonText.value,
|
|
2974
|
-
"confirm-button-text": confirmButtonText.value,
|
|
2975
|
-
"is-pending": isPending.value,
|
|
2976
|
-
panes: unref(AUTO_TOP_UP_MODAL_STEPS),
|
|
2977
|
-
step: step.value,
|
|
2978
|
-
"add-payment-method-pane": "ADD_PAYMENT_METHOD",
|
|
2979
|
-
customer: __props.customer,
|
|
2980
|
-
"payment-method-options": unref(paymentMethodOptions),
|
|
2981
|
-
"is-payment-method-options-pending": unref(isPaymentMethodOptionsPending),
|
|
2982
|
-
"is-adding-payment-method": unref(isAddingPaymentMethod),
|
|
2983
|
-
onConfirm: handleConfirm,
|
|
2984
|
-
onCancel: handleCancel,
|
|
2985
|
-
onPaymentSuccess: handlePaymentSuccess,
|
|
2986
|
-
onPaymentFailed: _cache[1] || (_cache[1] = (error) => _ctx.$emit("payment-failed", error))
|
|
2987
|
-
}, {
|
|
2988
|
-
AUTO_TOP_UP: withCtx(() => [
|
|
2989
|
-
createElementVNode("div", _hoisted_1$1, [
|
|
2990
|
-
autoTopUpEditor.value ? (openBlock(), createBlock(_sfc_main$8, mergeProps({
|
|
2991
|
-
key: formKey.value,
|
|
2992
|
-
ref_key: "autoTopUpFormRef",
|
|
2993
|
-
ref: autoTopUpFormRef,
|
|
2994
|
-
class: "sv-auto-topup-modal__rule"
|
|
2995
|
-
}, autoTopUpEditor.value, {
|
|
2996
|
-
config: savedRule.value,
|
|
2997
|
-
"always-enabled": "",
|
|
2998
|
-
disabled: isPending.value
|
|
2999
|
-
}), null, 16, ["config", "disabled"])) : createCommentVNode("", true),
|
|
3000
|
-
createVNode(_sfc_main$b, {
|
|
3001
|
-
"pricing-plan-schedule-id": previewScheduleId.value,
|
|
3002
|
-
"pricing-items": previewPricingItems.value
|
|
3003
|
-
}, null, 8, ["pricing-plan-schedule-id", "pricing-items"]),
|
|
3004
|
-
createVNode(_sfc_main$t, {
|
|
3005
|
-
modelValue: selectedPaymentMethodId.value,
|
|
3006
|
-
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => selectedPaymentMethodId.value = $event),
|
|
3007
|
-
class: "sv-auto-topup-modal__payment-method",
|
|
3008
|
-
"payment-methods": unref(sortedPaymentMethods),
|
|
3009
|
-
"payment-method-options": unref(settledOptions),
|
|
3010
|
-
disabled: isPending.value,
|
|
3011
|
-
error: unref(validation).paymentMethodId.$errors,
|
|
3012
|
-
label: unref($t)({
|
|
3013
|
-
defaultMessage: "Pay automatic top-ups with",
|
|
3014
|
-
description: "Label above the payment method an automatic top-up is charged to",
|
|
3015
|
-
id: "auto_topup_modal.payment_method.label"
|
|
3016
|
-
}),
|
|
3017
|
-
onAddPaymentMethod: unref(openAddPaymentMethod)
|
|
3018
|
-
}, null, 8, ["modelValue", "payment-methods", "payment-method-options", "disabled", "error", "label", "onAddPaymentMethod"])
|
|
3019
|
-
])
|
|
3020
|
-
]),
|
|
3021
|
-
_: 1
|
|
3022
|
-
}, 8, ["show-modal", "title", "sub-title", "cancel-button-text", "confirm-button-text", "is-pending", "panes", "step", "customer", "payment-method-options", "is-payment-method-options-pending", "is-adding-payment-method"]);
|
|
3023
|
-
};
|
|
3024
|
-
}
|
|
3025
|
-
});
|
|
3026
|
-
const _hoisted_1 = { class: "sv-auto-topup-cancellation-modal sv-auto-topup-cancellation-modal__body flex flex-col gap-3" };
|
|
3027
|
-
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
3028
|
-
__name: "AutoTopUpCancellationModal",
|
|
3029
|
-
props: {
|
|
3030
|
-
showModal: { type: Boolean },
|
|
3031
|
-
config: { type: Object }
|
|
3032
|
-
},
|
|
3033
|
-
emits: ["confirmed", "close"],
|
|
3034
|
-
setup(__props, { emit: __emit }) {
|
|
3035
|
-
const props = __props;
|
|
3036
|
-
const emit = __emit;
|
|
3037
|
-
const { $t } = useIntl();
|
|
3038
|
-
const logger = useLogger();
|
|
3039
|
-
const { formatValue } = useWalletBalanceFormat();
|
|
3040
|
-
const { deactivateAutoTopUpConfig } = createAutoTopUpConfigsService();
|
|
3041
|
-
const isSubmitting = ref(false);
|
|
3042
|
-
const hasFailed = ref(false);
|
|
3043
|
-
watch(
|
|
3044
|
-
() => props.showModal,
|
|
3045
|
-
(showModal) => {
|
|
3046
|
-
if (showModal) {
|
|
3047
|
-
hasFailed.value = false;
|
|
3048
|
-
}
|
|
3049
|
-
}
|
|
3050
|
-
);
|
|
3051
|
-
const explanation = computed(() => {
|
|
3052
|
-
var _a, _b;
|
|
3053
|
-
const threshold = (_a = props.config) == null ? void 0 : _a.threshold;
|
|
3054
|
-
const topUpAmount = (_b = props.config) == null ? void 0 : _b.topup_amount;
|
|
3055
|
-
if (!(threshold == null ? void 0 : threshold.amount) && !(threshold == null ? void 0 : threshold.credits)) {
|
|
3056
|
-
return $t({
|
|
3057
|
-
defaultMessage: "Your balance will no longer be topped up automatically. You can still top up whenever you want to.",
|
|
3058
|
-
description: "Explanation in the modal that turns a wallet automatic top-up off",
|
|
3059
|
-
id: "auto_topup_cancellation_modal.explanation"
|
|
3060
|
-
});
|
|
3061
|
-
}
|
|
3062
|
-
if (!topUpAmount) {
|
|
3063
|
-
return $t(
|
|
3064
|
-
{
|
|
3065
|
-
defaultMessage: "Your balance will no longer be topped up automatically when it falls below {threshold}. You can still top up whenever you want to.",
|
|
3066
|
-
description: "Explanation in the modal that turns a wallet automatic top-up off, naming the threshold",
|
|
3067
|
-
id: "auto_topup_cancellation_modal.explanation_with_threshold"
|
|
3068
|
-
},
|
|
3069
|
-
{ threshold: formatValue(threshold) }
|
|
3070
|
-
);
|
|
3071
|
-
}
|
|
3072
|
-
return $t(
|
|
3073
|
-
{
|
|
3074
|
-
defaultMessage: "Your balance will no longer be topped up with {amount} when it falls below {threshold}. You can still top up whenever you want to.",
|
|
3075
|
-
description: "Explanation in the modal that turns a wallet automatic top-up off, naming what it charged and when",
|
|
3076
|
-
id: "auto_topup_cancellation_modal.explanation_with_amount"
|
|
3077
|
-
},
|
|
3078
|
-
{ amount: formatValue({ amount: topUpAmount }), threshold: formatValue(threshold) }
|
|
3079
|
-
);
|
|
3080
|
-
});
|
|
3081
|
-
const handleConfirm = async () => {
|
|
3082
|
-
var _a;
|
|
3083
|
-
const configId = (_a = props.config) == null ? void 0 : _a.id;
|
|
3084
|
-
if (!configId || isSubmitting.value) {
|
|
3085
|
-
return;
|
|
3086
|
-
}
|
|
3087
|
-
isSubmitting.value = true;
|
|
3088
|
-
hasFailed.value = false;
|
|
3089
|
-
try {
|
|
3090
|
-
await deactivateAutoTopUpConfig(configId);
|
|
3091
|
-
emit("confirmed");
|
|
3092
|
-
emit("close");
|
|
3093
|
-
} catch (error) {
|
|
3094
|
-
logger.error(
|
|
3095
|
-
"AUTO_TOP_UP_CANCELLATION_FAILED",
|
|
3096
|
-
"Failed to turn off a wallet's automatic top-up",
|
|
3097
|
-
{},
|
|
3098
|
-
error
|
|
3099
|
-
);
|
|
3100
|
-
hasFailed.value = true;
|
|
3101
|
-
} finally {
|
|
3102
|
-
isSubmitting.value = false;
|
|
3103
|
-
}
|
|
3104
|
-
};
|
|
3105
|
-
const handleClose = () => {
|
|
3106
|
-
if (isSubmitting.value) {
|
|
3107
|
-
return;
|
|
3108
|
-
}
|
|
3109
|
-
emit("close");
|
|
3110
|
-
};
|
|
3111
|
-
return (_ctx, _cache) => {
|
|
3112
|
-
return openBlock(), createBlock(unref(Modal), {
|
|
3113
|
-
size: "sm",
|
|
3114
|
-
"show-modal": __props.showModal,
|
|
3115
|
-
"is-loading": isSubmitting.value,
|
|
3116
|
-
"no-click-away": isSubmitting.value,
|
|
3117
|
-
"no-backdrop-close": isSubmitting.value,
|
|
3118
|
-
title: unref($t)({
|
|
3119
|
-
defaultMessage: "Turn off automatic top-up",
|
|
3120
|
-
description: "Title of the modal that turns a wallet automatic top-up off",
|
|
3121
|
-
id: "auto_topup_cancellation_modal.title"
|
|
3122
|
-
}),
|
|
3123
|
-
"confirm-button-text": unref($t)({
|
|
3124
|
-
defaultMessage: "Yes, turn it off",
|
|
3125
|
-
description: "Button confirming that a wallet automatic top-up is turned off",
|
|
3126
|
-
id: "auto_topup_cancellation_modal.confirm"
|
|
3127
|
-
}),
|
|
3128
|
-
"cancel-button-text": unref($t)({
|
|
3129
|
-
defaultMessage: "Cancel",
|
|
3130
|
-
description: "Button dismissing the modal that turns a wallet automatic top-up off",
|
|
3131
|
-
id: "auto_topup_cancellation_modal.cancel"
|
|
3132
|
-
}),
|
|
3133
|
-
onConfirm: handleConfirm,
|
|
3134
|
-
onClose: handleClose
|
|
3135
|
-
}, {
|
|
3136
|
-
body: withCtx(() => [
|
|
3137
|
-
createElementVNode("div", _hoisted_1, [
|
|
3138
|
-
createVNode(unref(_sfc_main$h), {
|
|
3139
|
-
variant: "body-sm",
|
|
3140
|
-
color: "subtle",
|
|
3141
|
-
tag: "p",
|
|
3142
|
-
class: "sv-auto-topup-cancellation-modal__explanation"
|
|
3143
|
-
}, {
|
|
3144
|
-
default: withCtx(() => [
|
|
3145
|
-
createTextVNode(toDisplayString(explanation.value), 1)
|
|
3146
|
-
]),
|
|
3147
|
-
_: 1
|
|
3148
|
-
}),
|
|
3149
|
-
hasFailed.value ? (openBlock(), createBlock(unref(_sfc_main$w), {
|
|
3150
|
-
key: 0,
|
|
3151
|
-
class: "sv-auto-topup-cancellation-modal__error sv-error",
|
|
3152
|
-
title: unref($t)({
|
|
3153
|
-
defaultMessage: "Could not turn off the automatic top-up. Please try again later.",
|
|
3154
|
-
description: "Error shown when turning a wallet automatic top-up off failed",
|
|
3155
|
-
id: "auto_topup_cancellation_modal.failed"
|
|
3156
|
-
})
|
|
3157
|
-
}, null, 8, ["title"])) : createCommentVNode("", true)
|
|
3158
|
-
])
|
|
3159
|
-
]),
|
|
3160
|
-
_: 1
|
|
3161
|
-
}, 8, ["show-modal", "is-loading", "no-click-away", "no-backdrop-close", "title", "confirm-button-text", "cancel-button-text"]);
|
|
3162
|
-
};
|
|
3163
|
-
}
|
|
3164
|
-
});
|
|
3165
|
-
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
3166
|
-
...{ inheritAttrs: false },
|
|
3167
|
-
__name: "CustomerWalletBalances",
|
|
3168
|
-
props: {
|
|
3169
|
-
hasError: { type: Boolean },
|
|
3170
|
-
isLoading: { type: Boolean },
|
|
3171
|
-
walletBalances: { type: Array },
|
|
3172
|
-
showTopUpButton: { type: Boolean },
|
|
3173
|
-
customer: { type: Object },
|
|
3174
|
-
paymentMethods: { type: Array },
|
|
3175
|
-
subscriptions: { type: Array }
|
|
3176
|
-
},
|
|
3177
|
-
emits: ["top-up-charged", "auto-top-up-saved", "auto-top-up-cancelled", "payment-method-stored", "payment-failed"],
|
|
3178
|
-
setup(__props, { emit: __emit }) {
|
|
3179
|
-
const props = __props;
|
|
3180
|
-
const emit = __emit;
|
|
3181
|
-
const { $t } = useIntl();
|
|
3182
|
-
const selectedTopUpItem = ref();
|
|
3183
|
-
const selectedBalanceItem = computed(
|
|
3184
|
-
() => getWalletBalanceForTopUpItem(props.walletBalances, selectedTopUpItem.value)
|
|
3185
|
-
);
|
|
3186
|
-
const showTopUpModal = computed(() => !!selectedBalanceItem.value);
|
|
3187
|
-
const selectedAutoTopUpItem = ref();
|
|
3188
|
-
const showAutoTopUpModal = computed(() => !!selectedAutoTopUpItem.value);
|
|
3189
|
-
const autoTopUpWallet = computed(
|
|
3190
|
-
() => getWalletBalanceForTopUpItem(props.walletBalances, selectedAutoTopUpItem.value)
|
|
3191
|
-
);
|
|
3192
|
-
const cancellingAutoTopUpConfig = ref();
|
|
3193
|
-
const showAutoTopUpCancellation = computed(() => !!cancellingAutoTopUpConfig.value);
|
|
3194
|
-
return (_ctx, _cache) => {
|
|
3195
|
-
return openBlock(), createElementBlock(Fragment, null, [
|
|
3196
|
-
__props.isLoading ? (openBlock(), createBlock(_sfc_main$l, mergeProps({
|
|
3197
|
-
key: 0,
|
|
3198
|
-
variant: "section"
|
|
3199
|
-
}, _ctx.$attrs, {
|
|
3200
|
-
class: "sv-wallet-balances sv-root sv-component sv-loading min-h-48",
|
|
3201
|
-
"data-testid": "customer-wallet-balances-skeleton"
|
|
3202
|
-
}), null, 16)) : __props.hasError ? (openBlock(), createBlock(unref(_sfc_main$w), mergeProps({ key: 1 }, _ctx.$attrs, {
|
|
3203
|
-
class: "sv-wallet-balances sv-root sv-component sv-error",
|
|
3204
|
-
title: unref($t)({
|
|
3205
|
-
defaultMessage: "Could not load wallet balances",
|
|
3206
|
-
description: "Error shown when wallet balances fail to load",
|
|
3207
|
-
id: "wallet_balance.load_failed"
|
|
3208
|
-
})
|
|
3209
|
-
}), null, 16, ["title"])) : __props.walletBalances.length > 0 ? (openBlock(), createBlock(unref(_sfc_main$c), mergeProps({ key: 2 }, _ctx.$attrs, {
|
|
3210
|
-
class: "sv-wallet-balances sv-root sv-component",
|
|
3211
|
-
"customer-wallet-balances": __props.walletBalances,
|
|
3212
|
-
"show-auto-top-up": "",
|
|
3213
|
-
"show-manual-top-up": "",
|
|
3214
|
-
title: unref($t)(
|
|
3215
|
-
{
|
|
3216
|
-
defaultMessage: "{count, plural, one {Wallet} other {Wallets}}",
|
|
3217
|
-
description: "Title for the wallets block on the customer overview page",
|
|
3218
|
-
id: "customer_overview.wallet_balances_block.title"
|
|
3219
|
-
},
|
|
3220
|
-
{ count: String(__props.walletBalances.length) }
|
|
3221
|
-
),
|
|
3222
|
-
onTopUp: _cache[0] || (_cache[0] = ($event) => selectedTopUpItem.value = $event),
|
|
3223
|
-
onAutoTopUp: _cache[1] || (_cache[1] = ($event) => selectedAutoTopUpItem.value = $event),
|
|
3224
|
-
onCancelAutoTopUp: _cache[2] || (_cache[2] = ($event) => cancellingAutoTopUpConfig.value = $event)
|
|
3225
|
-
}), null, 16, ["customer-wallet-balances", "title"])) : createCommentVNode("", true),
|
|
3226
|
-
__props.showTopUpButton ? (openBlock(), createBlock(_sfc_main$3, {
|
|
3227
|
-
key: 3,
|
|
3228
|
-
"show-modal": showTopUpModal.value,
|
|
3229
|
-
"selected-balance-item": selectedBalanceItem.value,
|
|
3230
|
-
"payment-methods": __props.paymentMethods,
|
|
3231
|
-
customer: __props.customer,
|
|
3232
|
-
subscriptions: __props.subscriptions,
|
|
3233
|
-
onClose: _cache[3] || (_cache[3] = ($event) => selectedTopUpItem.value = void 0),
|
|
3234
|
-
onConfirm: _cache[4] || (_cache[4] = ($event) => emit("top-up-charged")),
|
|
3235
|
-
onPaymentSuccess: _cache[5] || (_cache[5] = ($event) => emit("payment-method-stored")),
|
|
3236
|
-
onPaymentFailed: _cache[6] || (_cache[6] = (error) => emit("payment-failed", error))
|
|
3237
|
-
}, null, 8, ["show-modal", "selected-balance-item", "payment-methods", "customer", "subscriptions"])) : createCommentVNode("", true),
|
|
3238
|
-
__props.showTopUpButton ? (openBlock(), createBlock(_sfc_main$2, {
|
|
3239
|
-
key: 4,
|
|
3240
|
-
"show-modal": showAutoTopUpModal.value,
|
|
3241
|
-
"wallet-balance-item": autoTopUpWallet.value,
|
|
3242
|
-
"top-up-item": selectedAutoTopUpItem.value,
|
|
3243
|
-
"payment-methods": __props.paymentMethods,
|
|
3244
|
-
customer: __props.customer,
|
|
3245
|
-
onClose: _cache[7] || (_cache[7] = ($event) => selectedAutoTopUpItem.value = void 0),
|
|
3246
|
-
onSaved: _cache[8] || (_cache[8] = ($event) => emit("auto-top-up-saved")),
|
|
3247
|
-
onPaymentSuccess: _cache[9] || (_cache[9] = ($event) => emit("payment-method-stored")),
|
|
3248
|
-
onPaymentFailed: _cache[10] || (_cache[10] = (error) => emit("payment-failed", error))
|
|
3249
|
-
}, null, 8, ["show-modal", "wallet-balance-item", "top-up-item", "payment-methods", "customer"])) : createCommentVNode("", true),
|
|
3250
|
-
__props.showTopUpButton ? (openBlock(), createBlock(_sfc_main$1, {
|
|
3251
|
-
key: 5,
|
|
3252
|
-
"show-modal": showAutoTopUpCancellation.value,
|
|
3253
|
-
config: cancellingAutoTopUpConfig.value,
|
|
3254
|
-
onClose: _cache[11] || (_cache[11] = ($event) => cancellingAutoTopUpConfig.value = void 0),
|
|
3255
|
-
onConfirmed: _cache[12] || (_cache[12] = ($event) => emit("auto-top-up-cancelled"))
|
|
3256
|
-
}, null, 8, ["show-modal", "config"])) : createCommentVNode("", true)
|
|
3257
|
-
], 64);
|
|
3258
|
-
};
|
|
3259
|
-
}
|
|
3260
|
-
});
|
|
3261
|
-
export {
|
|
3262
|
-
_sfc_main as _,
|
|
3263
|
-
useCustomerWalletBalances as u
|
|
3264
|
-
};
|