@solvimon/solvimon-web 0.1.0-alpha.26 → 0.1.0-alpha.28
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/README.md +138 -27
- package/dist/ApiStatus-CSFKl_ra.mjs +9 -0
- package/dist/{Avatar.vue.es-BqQHvLGA.mjs → Avatar.vue.es-Beg7umjO.mjs} +1 -1
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BFza7Nf9.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-DBGe1PvD.mjs} +17 -19
- package/dist/{Button.vue.es-C32_baQN.mjs → Button.vue.es-rh6mITmN.mjs} +1 -1
- package/dist/{ChargeOnDemandModal-CIiI74ls.mjs → ChargeOnDemandModal-CPjPa_uq.mjs} +233 -253
- package/dist/Checkbox.vue.es-DsyiJ-VY.mjs +50 -0
- package/dist/Checkout.entry.ce-BZ1rYQvt.mjs +5279 -0
- package/dist/{Chip.vue.es-CKCOY5T6.mjs → Chip.vue.es-Cn2R_0mE.mjs} +34 -20
- package/dist/Comparators.vue.es-DQBI3f7m.mjs +103 -0
- package/dist/{ContextMenu.vue.es-Da-lAmTl.mjs → ContextMenu.vue.es-DRxsa7bZ.mjs} +4 -4
- package/dist/{CustomerBillingInformation.vue.es-BxBQt4Q0.mjs → CustomerBillingInformation.vue.es-DQfL5RMR.mjs} +2 -2
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-BcTZgshS.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Ct-eYaEN.mjs} +31 -36
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-BzTSwo4i.mjs +2921 -0
- package/dist/{DividerText.vue.es-DKl3FnDJ.mjs → DividerText.vue.es-M0XqSz55.mjs} +1 -1
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-Bk4zwyWa.mjs +362 -0
- package/dist/{ErrorNotification.vue.es-rRKgmkzV.mjs → ErrorNotification.vue.es-CKlt4hr2.mjs} +1 -1
- package/dist/{IconButton.vue.es-UlqwNPAX.mjs → IconButton.vue.es-oe4MVBK1.mjs} +2 -2
- package/dist/{IconTitle.vue.es-CK9k69tV.mjs → IconTitle.vue.es-BO6KBS4v.mjs} +3 -3
- package/dist/Input.vue.es-DAlPmtE_.mjs +249 -0
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DUfJl07Y.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-CCTl5GWa.mjs} +14 -13
- package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-DMGqj_Uk.mjs +56 -0
- package/dist/{InvoiceSummary.vue.es-DQ4KvTaw.mjs → InvoiceSummary.vue.es-DbNoGfYN.mjs} +9 -9
- package/dist/{Modal.vue.es-B9xMiyn3.mjs → Modal.vue.es-CTNACAst.mjs} +5 -5
- package/dist/{PaymentErrorCard.vue_vue_type_script_setup_true_lang-BVzL2PGe.mjs → PaymentErrorCard.vue_vue_type_script_setup_true_lang-DLfAfB_m.mjs} +73 -75
- package/dist/{PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-nLTPnH4j.mjs → PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CKm-XYuF.mjs} +3 -3
- package/dist/{PaymentHistoryBlock-DYa99P1M.mjs → PaymentHistoryBlock-BmA8jbMb.mjs} +1 -1
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-D0KnSy0y.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-BDMse2lO.mjs} +24 -24
- package/dist/{PaymentIntegrationForm-UWoyZgsR.mjs → PaymentIntegrationForm-D1Xw-xIt.mjs} +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CCxw0PCv.mjs +182 -0
- package/dist/{PaymentIntegrationFormAdyen-D4qfNtZ_.mjs → PaymentIntegrationFormAdyen-CfT5aD4L.mjs} +395 -297
- package/dist/PaymentIntegrationFormStripe-DKXJ-mjd.mjs +743 -0
- package/dist/{PaymentMethod.vue.es-CKu5nApX.mjs → PaymentMethod.vue.es-Cauxx4Xr.mjs} +3 -3
- package/dist/{PaymentMethodForm-B05sHWcW.mjs → PaymentMethodForm-CypZOYUZ.mjs} +1 -1
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-D1yIYsb_.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-De8FgdYD.mjs} +65 -75
- package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-Dw28tfpD.mjs +168 -0
- package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-DGpXRtp4.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-OtjVO7lR.mjs} +13 -8
- package/dist/PlanCustomizationEditor-Xtww2r9K.mjs +711 -0
- package/dist/PortalNotAvailable-B_59GUwN.mjs +25 -0
- package/dist/{PricingGroupRangeInput.vue.es-CJpvUP3-.mjs → PricingGroupRangeInput.vue.es-C9LJW3b8.mjs} +5 -5
- package/dist/{PricingGroupSingleEditor.vue_vue_type_script_setup_true_lang-DJ81eUJX.mjs → PricingGroupSingleEditor.vue_vue_type_script_setup_true_lang-DdWxoB8q.mjs} +30 -30
- package/dist/{RadioGroupExtended.vue.es-BalV7gwp.mjs → RadioGroupExtended.vue.es-UtKsdmiv.mjs} +2 -2
- package/dist/{Section.vue.es-D7eiXUbk.mjs → Section.vue.es-iS8hVGWA.mjs} +1 -1
- package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DudMRVka.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Djc1SkEU.mjs} +13 -12
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-D7MFjvrP.mjs +32 -0
- package/dist/{StepInput.vue.es-C3Zm6Wc9.mjs → StepInput.vue.es-Dpan1RQd.mjs} +5 -4
- package/dist/{SubscriptionDetails.entry.ce-WEimiOex.mjs → SubscriptionDetails.entry.ce-DufQX3uI.mjs} +451 -468
- package/dist/{SubscriptionSchedules-DrrEAPlx.mjs → SubscriptionSchedules-DAahcNoI.mjs} +1 -1
- package/dist/{SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DHp_KtbF.mjs → SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DNr1CqVj.mjs} +750 -763
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-Wmjqy7RZ.mjs +203 -0
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DFU0IULg.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BeRLuEyR.mjs} +124 -90
- package/dist/{TooltipParagraph.vue.es-BXbOJmjr.mjs → TooltipParagraph.vue.es-BjCn2BF6.mjs} +1 -1
- package/dist/{TrialChip.vue.es-C_yRujip.mjs → TrialChip.vue.es-B-XBSHWE.mjs} +2 -2
- package/dist/addressFormats.data-dzBx49dw.mjs +278 -0
- package/dist/amount-CondixVt.mjs +36 -0
- package/dist/{cn.es-CGa6b2Lt.mjs → cn.es-2bVdkiFV.mjs} +87 -83
- package/dist/{comparators.es-D8WGL-c4.mjs → comparators.es-C8rHpb70.mjs} +17 -13
- package/dist/components/BillingInformation/BillingInformation.mjs +7 -8
- package/dist/components/BillingInformationForm/BillingInformationForm.mjs +394 -350
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.mjs +16 -17
- package/dist/components/Invoice/Invoice.mjs +206 -209
- package/dist/components/InvoiceDetails/InvoiceDetails.mjs +64 -63
- package/dist/components/InvoiceHeader/InvoiceHeader.mjs +40 -41
- package/dist/components/InvoicesList/InvoicesList.mjs +14 -14
- package/dist/components/PaymentHistory/PaymentHistory.mjs +70 -65
- package/dist/components/PaymentMethodForm/PaymentMethodForm.mjs +31 -31
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.mjs +47 -45
- package/dist/components/SubscriptionsList/SubscriptionsList.mjs +50 -36
- package/dist/components/WalletBalances/WalletBalances.mjs +9 -10
- package/dist/core/index.mjs +61 -95
- package/dist/customElements-Di3zwlEU.mjs +6447 -0
- package/dist/customer-CqddTiOr.mjs +31 -0
- package/dist/{de-DE-jkW2dJrX.mjs → de-DE-BNMj3boy.mjs} +16 -10
- package/dist/{de-DE-CLfzTbbX.mjs → de-DE-BW8dMvhW.mjs} +87 -19
- package/dist/formControl-CsITfsBk.mjs +749 -0
- package/dist/index.mjs +2 -2
- package/dist/invoiceState-BJVHaKs7.mjs +14 -0
- package/dist/{invoices-DJTwftJv.mjs → invoices-Cf1qDAv4.mjs} +40 -35
- package/dist/{it-IT-Cym1UvvK.mjs → it-IT-Byg06KWc.mjs} +87 -19
- package/dist/{it-IT-CaaFToGB.mjs → it-IT-DRvuxM1F.mjs} +9 -3
- package/dist/{nl-NL-D0MQKaql.mjs → nl-NL-DLUwWbMG.mjs} +12 -6
- package/dist/{nl-NL-D0c4x5C0.mjs → nl-NL-x3zQqzZ7.mjs} +93 -25
- package/dist/paymentMethods-BUuOmDq9.mjs +77 -0
- package/dist/paymentOutcome-D17VD4MV.mjs +67 -0
- package/dist/payments-Ci8bF4C6.mjs +45 -0
- package/dist/pricingItemConfigs.es-D3pX_9AJ.mjs +78 -0
- package/dist/pricingPlanScheduleOverrides-COr9F8DO.mjs +233 -0
- package/dist/pricingPlanSchedules-BK_o9p6h.mjs +38 -0
- package/dist/sanitization.es-C6dbuxUJ.mjs +4 -0
- package/dist/screens/Checkout/Checkout.mjs +2 -2
- package/dist/screens/CustomerOverview/CustomerOverview.mjs +98 -91
- package/dist/screens/PayInvoice/PayInvoice.mjs +181 -210
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.mjs +98 -86
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.mjs +2 -2
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.mjs +363 -334
- package/dist/sessionReference-B8Dbmx5t.mjs +38 -0
- package/dist/sorting.es-qtEN8J8T.mjs +77 -0
- package/dist/subscription-BhxoqwcT.mjs +83 -0
- package/dist/subscriptions-CwogJODR.mjs +54 -0
- package/dist/types/components/InvoiceTable/InvoiceTable.types.d.ts +2 -0
- package/dist/types/components/checkout/CheckoutTitle.types.d.ts +10 -0
- package/dist/types/components/checkout/PromotionCodeSection.types.d.ts +2 -0
- package/dist/types/components/customer/CheckoutForm/CheckoutAddressFields.types.d.ts +20 -0
- package/dist/types/components/customer/CheckoutForm/CheckoutForm.types.d.ts +15 -0
- package/dist/types/components/customer/CustomerPaymentMethodsBlock/CustomerPaymentMethodsBlock.types.d.ts +0 -2
- package/dist/types/components/payments/ExpressPaymentMethod/ExpressPaymentMethod.types.d.ts +9 -5
- package/dist/types/components/payments/ExpressPaymentMethod/ExpressPaymentMethodApplePay.types.d.ts +3 -1
- package/dist/types/components/payments/ExpressPaymentMethods/ExpressPaymentMethods.types.d.ts +5 -1
- package/dist/types/components/payments/OnDemandPaymentModalShell/OnDemandPaymentModalShell.types.d.ts +0 -1
- package/dist/types/components/payments/PaymentCompletedCard/PaymentCompletedCard.types.d.ts +0 -2
- package/dist/types/components/payments/PaymentErrorCard/PaymentErrorCard.types.d.ts +9 -2
- package/dist/types/components/payments/PaymentIntegrationForm/PaymentIntegrationForm.types.d.ts +36 -4
- package/dist/types/components/payments/PaymentIntegrationFormStripe/PaymentIntegrationFormStripeFrame.types.d.ts +7 -0
- package/dist/types/components/payments/PaymentMethodSelector/PaymentMethodSelector.types.d.ts +0 -4
- package/dist/types/components/providers/AuthProvider/AuthProvider.lib.d.ts +9 -4
- package/dist/types/components/providers/AuthProvider/composables/useAuth.d.ts +1 -3
- package/dist/types/components/providers/ConfigProvider/ConfigProvider.lib.d.ts +2 -4
- package/dist/types/components/providers/CssOverridesProvider/CssOverridesProvider.lib.d.ts +11 -0
- package/dist/types/components/providers/EntryProvider/EntryProvider.lib.d.ts +7 -0
- package/dist/types/components/providers/EntryProvider/EntryProvider.types.d.ts +2 -0
- package/dist/types/components/providers/EntryProvider/EntryProvider.vue.d.ts +3 -1
- package/dist/types/components/providers/ErrorBoundary/ErrorBoundary.vue.d.ts +5 -1
- package/dist/types/components/providers/ExperimentalFeatureProvider/ExperimentalFeatureProvider.lib.d.ts +2 -2
- package/dist/types/components/providers/HostElementProvider/HostElementProvider.lib.d.ts +6 -1
- package/dist/types/components/providers/LoggerProvider/LoggerProvider.types.d.ts +2 -2
- package/dist/types/components/providers/LoggerProvider/LoggerProvider.vue.d.ts +5 -1
- package/dist/types/components/providers/PortalProvider/PortalProvider.lib.d.ts +10 -7
- package/dist/types/components/providers/PortalProvider/PortalProvider.types.d.ts +1 -1
- package/dist/types/components/providers/PortalProvider/PortalProvider.vue.d.ts +3 -1
- package/dist/types/components/providers/PortalProvider/composables/usePortal.d.ts +2 -2
- package/dist/types/components/providers/Provider/Provider.types.d.ts +1 -1
- package/dist/types/components/providers/Provider/Provider.vue.d.ts +11 -4
- package/dist/types/components/providers/RequiredPropertiesGuard/RequiredPropertiesGuard.vue.d.ts +17 -0
- package/dist/types/components/providers/TranslationProvider/TranslationProvider.lib.d.ts +7 -2
- package/dist/types/components/providers/TranslationProvider/TranslationProvider.types.d.ts +1 -1
- package/dist/types/components/subscriptions/ChargeOnDemandModal/ChargeOnDemandModal.types.d.ts +1 -2
- package/dist/types/components/subscriptions/EnabledPricingsList/EnabledPricingsListItem.types.d.ts +2 -0
- package/dist/types/components/subscriptions/OrderSummary.types.d.ts +1 -10
- package/dist/types/components/subscriptions/SubscriptionCancellationModal/SubscriptionCancellationModal.types.d.ts +5 -1
- package/dist/types/components/subscriptions/SubscriptionManagement/SubscriptionManagementForm.types.d.ts +8 -16
- package/dist/types/components/subscriptions/SubscriptionSummary.types.d.ts +1 -14
- package/dist/types/components/subscriptions/SubscriptionsList/SubscriptionsList.types.d.ts +4 -1
- package/dist/types/components/subscriptions/SubscriptionsList/SubscriptionsListItem.types.d.ts +1 -2
- package/dist/types/components/wallets/AutoTopUpConfig/AutoTopUpConfig.types.d.ts +0 -3
- package/dist/types/components/wallets/TopUpModal/TopUpModalForm.types.d.ts +3 -1
- package/dist/types/components/wallets/TopUpModal/TopUpModalSuccess.types.d.ts +1 -7
- package/dist/types/public/components/BillingInformation/BillingInformation.entry.ce.d.ts +1 -1
- package/dist/types/public/components/BillingInformation/BillingInformation.types.d.ts +0 -3
- package/dist/types/public/components/BillingInformationForm/BillingInformationForm.entry.ce.d.ts +1 -1
- package/dist/types/public/components/CustomerPaymentMethods/CustomerPaymentMethods.entry.ce.d.ts +1 -1
- package/dist/types/public/components/CustomerPaymentMethods/CustomerPaymentMethods.types.d.ts +0 -1
- package/dist/types/public/components/Invoice/Invoice.entry.ce.d.ts +1 -1
- package/dist/types/public/components/Invoice/Invoice.types.d.ts +0 -1
- package/dist/types/public/components/InvoiceDetails/InvoiceDetails.entry.ce.d.ts +1 -1
- package/dist/types/public/components/InvoiceDetails/InvoiceDetails.entry.types.d.ts +3 -2
- package/dist/types/public/components/InvoiceDetails/InvoiceDetails.types.d.ts +0 -2
- package/dist/types/public/components/InvoiceHeader/InvoiceHeader.entry.ce.d.ts +1 -1
- package/dist/types/public/components/InvoiceHeader/InvoiceHeader.types.d.ts +0 -1
- package/dist/types/public/components/InvoicesList/InvoicesList.entry.ce.d.ts +1 -1
- package/dist/types/public/components/InvoicesList/InvoicesList.types.d.ts +2 -0
- package/dist/types/public/components/PaymentHistory/PaymentHistory.entry.ce.d.ts +1 -1
- package/dist/types/public/components/PaymentHistory/PaymentHistory.entry.types.d.ts +3 -2
- package/dist/types/public/components/PaymentHistory/PaymentHistory.types.d.ts +0 -2
- package/dist/types/public/components/PaymentMethodForm/PaymentMethodForm.entry.ce.d.ts +1 -1
- package/dist/types/public/components/SubscriptionSchedules/SubscriptionSchedules.entry.ce.d.ts +1 -1
- package/dist/types/public/components/SubscriptionSchedules/SubscriptionSchedules.entry.types.d.ts +3 -2
- package/dist/types/public/components/SubscriptionSchedules/SubscriptionSchedules.types.d.ts +0 -2
- package/dist/types/public/components/SubscriptionsList/SubscriptionsList.entry.ce.d.ts +1 -1
- package/dist/types/public/components/SubscriptionsList/SubscriptionsList.types.d.ts +3 -0
- package/dist/types/public/components/WalletBalances/WalletBalances.entry.ce.d.ts +1 -1
- package/dist/types/public/components/WalletBalances/WalletBalances.entry.types.d.ts +1 -3
- package/dist/types/public/core/action-request.types.d.ts +5 -0
- package/dist/types/public/core/registry.ce.d.ts +3 -3
- package/dist/types/public/core/registry.d.ts +0 -3
- package/dist/types/public/screens/Checkout/Checkout.entry.ce.d.ts +1 -1
- package/dist/types/public/screens/Checkout/Checkout.entry.types.d.ts +0 -7
- package/dist/types/public/screens/Checkout/Checkout.types.d.ts +2 -2
- package/dist/types/public/screens/CustomerOverview/CustomerOverview.entry.ce.d.ts +1 -1
- package/dist/types/public/screens/PayInvoice/PayInvoice.entry.ce.d.ts +1 -1
- package/dist/types/public/screens/PayInvoice/PayInvoice.types.d.ts +2 -0
- package/dist/types/public/screens/PaymentMethodsManagement/PaymentMethodsManagement.entry.ce.d.ts +1 -1
- package/dist/types/public/screens/SubscriptionDetails/SubscriptionDetails.entry.ce.d.ts +1 -1
- package/dist/types/public/screens/SubscriptionDetails/SubscriptionDetails.types.d.ts +1 -2
- package/dist/types/public/screens/SubscriptionManagement/SubscriptionManagement.entry.ce.d.ts +1 -1
- package/dist/types/services/paymentMethods.types.d.ts +2 -10
- package/dist/types/services/requests.types.d.ts +16 -6
- package/dist/types/types/errors.d.ts +3 -2
- package/dist/types/vendor/@adyen/adyen-web/index.d.ts +2 -0
- package/dist/types/vendor/@solvimon/solvimon-types/types/Payment.d.ts +1 -1
- package/dist/types/vendor/@solvimon/solvimon-types/utils.d.ts +1 -1
- package/dist/types/vendor/@solvimon/solvimon-ui/components/providers/BrandProvider/BrandProvider.types.d.ts +16 -0
- package/dist/types/vendor/@solvimon/solvimon-ui/components/providers/IntlProvider/IntlProvider.types.d.ts +66 -0
- package/dist/types/vendor/@solvimon/solvimon-ui/index.d.ts +2 -0
- package/dist/useActionDispatchProvider-DC_fUykI.mjs +9 -0
- package/dist/{useCustomer-XZKWsolE.mjs → useCustomer-C3kTh7wn.mjs} +2 -2
- package/dist/useCustomerFormLabels-CK7K50nB.mjs +1369 -0
- package/dist/useIncrementalLoading-C_sHmW7d.mjs +60 -0
- package/dist/useInvoiceData-BIh8-h8b.mjs +21 -0
- package/dist/useInvoicesList-Y6p0Pqpy.mjs +674 -0
- package/dist/{useLoadInitialData-CR0kbYw8.mjs → useLoadInitialData-4k_Cyqef.mjs} +1 -1
- package/dist/usePaymentFormHold-FfNc578l.mjs +189 -0
- package/dist/{usePaymentMethodAvailability-ZH-m3B-A.mjs → usePaymentMethodAvailability-CnYTvG15.mjs} +17 -18
- package/dist/usePaymentMethodOptions-1QBcmgUf.mjs +40 -0
- package/dist/{usePaymentMethods-B-OKRyKd.mjs → usePaymentMethods-gvr-rmwE.mjs} +2 -2
- package/dist/{usePayments-CV85OV8V.mjs → usePayments-CykCZPG2.mjs} +7 -7
- package/dist/usePortal-CxzKGhbK.mjs +7 -0
- package/dist/useService-B0OQJmif.mjs +56 -0
- package/dist/{useTimePeriod.es-B22-fno3.mjs → useTimePeriod.es-JkXdHNWr.mjs} +1 -1
- package/dist/useViewport-psZejz_H.mjs +19 -0
- package/package.json +35 -59
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-DcrLNA_x.mjs +0 -223
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-DwbIiJBY.js +0 -1
- package/dist/Alert.vue.es-RyK53a2P.js +0 -1
- package/dist/Amount.vue.es-DExaYBqm.js +0 -1
- package/dist/Avatar.vue.es-Bm6MCMAL.js +0 -1
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-0JHnqIpC.js +0 -1
- package/dist/Button.vue.es-qGvnOKnK.js +0 -1
- package/dist/ChargeOnDemandModal-DIQaGnRs.js +0 -1
- package/dist/Checkout.entry.ce-8EcavNgT.js +0 -2
- package/dist/Checkout.entry.ce-BA5ljKj8.mjs +0 -3924
- package/dist/Chip.vue.es-D60gTbfe.js +0 -1
- package/dist/Comparators.vue.es-CwhX3rbx.mjs +0 -93
- package/dist/Comparators.vue.es-DmkxV0gb.js +0 -1
- package/dist/ContentWithAsideLayout-RSdKXqAf.js +0 -1
- package/dist/ContextMenu.vue.es-C7KI8Gz6.js +0 -1
- package/dist/CustomerBillingInformation.vue.es-bFUx81Ig.js +0 -1
- package/dist/CustomerPaymentMethods.lib-BKgQTCtc.js +0 -1
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-C0lJ_ESU.js +0 -1
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-DkbQ2MiR.mjs +0 -2701
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-hBo2Y2mJ.js +0 -1
- package/dist/Divider.vue.es-UwnWvUTl.js +0 -1
- package/dist/DividerText.vue.es-BF3gnr4e.js +0 -1
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-C3QYra1x.mjs +0 -335
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-cSQeqr0A.js +0 -1
- package/dist/ErrorNotification.vue.es-BX9dHEc-.js +0 -1
- package/dist/Expand.vue.es-BtM0EZEr.js +0 -1
- package/dist/FormMessage.vue.es-dqATjC2N.js +0 -1
- package/dist/IconButton.vue.es-Bwdfu-jm.js +0 -1
- package/dist/IconTitle.vue.es-Cei98MBw.js +0 -1
- package/dist/Input.vue.es-B47l_feL.js +0 -1
- package/dist/Input.vue.es-D9IjIWc-.mjs +0 -235
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DKlPrxQS.js +0 -1
- package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-D9Rtgapa.mjs +0 -41
- package/dist/InvoiceEntryView.vue_vue_type_script_setup_true_lang-DlJ6lELc.js +0 -1
- package/dist/InvoiceSummary.vue.es-DBnR9Hs7.js +0 -1
- package/dist/Modal.vue.es-8LN4gBh0.js +0 -1
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-B1yGKkWN.js +0 -1
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-DSGf6uFP.js +0 -1
- package/dist/PaymentHistoryBlock-Ds93gNvh.js +0 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CBZhXQfC.js +0 -1
- package/dist/PaymentIntegrationForm-B_Db4DG1.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-C0J37ZVe.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-J15IDbMc.mjs +0 -154
- package/dist/PaymentIntegrationFormAdyen-HeA9XIj-.js +0 -98
- package/dist/PaymentIntegrationFormStripe-BIiMCWlV.mjs +0 -587
- package/dist/PaymentIntegrationFormStripe-DUCJTIAq.js +0 -102
- package/dist/PaymentMethod.vue.es-CJcSZ9lN.js +0 -1
- package/dist/PaymentMethodForm-1d0YIGOu.js +0 -1
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-BDm8l_6N.js +0 -1
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-BE4S26JX.js +0 -1
- package/dist/PlanCustomizationEditor-CEMP_Dhz.js +0 -1
- package/dist/PlanCustomizationEditor-CpZeilm5.mjs +0 -694
- package/dist/PricingGroupRangeInput.vue.es-DZSJ5Mz0.js +0 -185
- package/dist/PricingGroupSingleEditor.vue_vue_type_script_setup_true_lang-jrkraJMu.js +0 -1
- package/dist/RadioGroupExtended.vue.es-Dt6LH9Yh.js +0 -1
- package/dist/Section.vue.es-zVXBHAL6.js +0 -1
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BdjYFrVC.js +0 -1
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-D4sbq9nA.js +0 -1
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-D60YtA9z.mjs +0 -51
- package/dist/StepInput.vue.es-mAnuCuDQ.js +0 -1
- package/dist/SubscriptionDetails.entry.ce-D4CsSoR9.js +0 -1
- package/dist/SubscriptionSchedules-Cm5Dt-1H.js +0 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-t2Awijf5.js +0 -1
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-3VYfm6Hm.mjs +0 -91
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-B41qZmcL.js +0 -1
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-Bu-_clEa.js +0 -1
- package/dist/TooltipParagraph.vue.es-Cph6zT31.js +0 -1
- package/dist/TrialChip.vue.es-C_wgHGuN.js +0 -1
- package/dist/accel.svg.es-DFJXdioD.js +0 -1
- package/dist/ach.svg.es-BYP873jU.js +0 -1
- package/dist/adyen-BJfC7N6f.js +0 -1
- package/dist/adyen-CvsH5fok.mjs +0 -117
- package/dist/adyen-Druit6gz.js +0 -1
- package/dist/adyenSdk-BP2XXzeJ.js +0 -1
- package/dist/amazon-pay.svg.es-CQWgtowB.js +0 -1
- package/dist/amex.svg.es-DKhW4Txt.js +0 -1
- package/dist/api.es-duCDtZD9.js +0 -1
- package/dist/apple-pay.svg.es-Dyojd0F-.js +0 -1
- package/dist/bacs.svg.es-GJpZs1sD.js +0 -1
- package/dist/bancontact.svg.es-BQh7nAup.js +0 -1
- package/dist/carnet.svg.es-DY04-F2L.js +0 -1
- package/dist/cartes-bancaires.svg.es-BleHMlkN.js +0 -1
- package/dist/cashapp.svg.es-MwXGYom6.js +0 -1
- package/dist/cn.es-D9YMDvG2.js +0 -1
- package/dist/comparators.es-OGt19O9U.js +0 -1
- package/dist/components/BillingInformation/BillingInformation.cjs +0 -1
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs +0 -1
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs +0 -1
- package/dist/components/Invoice/Invoice.cjs +0 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs +0 -1
- package/dist/components/InvoiceHeader/InvoiceHeader.cjs +0 -1
- package/dist/components/InvoicesList/InvoicesList.cjs +0 -1
- package/dist/components/PaymentHistory/PaymentHistory.cjs +0 -1
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs +0 -1
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs +0 -1
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs +0 -1
- package/dist/components/WalletBalances/WalletBalances.cjs +0 -1
- package/dist/configuration-akTS7Wiw.js +0 -1
- package/dist/core/index.cjs +0 -1
- package/dist/countryData.es-C4jHBzfo.js +0 -1
- package/dist/customElements-C963-LtW.js +0 -1215
- package/dist/customElements-D5DAoHRI.mjs +0 -6633
- package/dist/customer-DKa1B2vp.mjs +0 -31
- package/dist/customer-TE1FnGT0.js +0 -1
- package/dist/customer.es-BButyYo0.js +0 -1
- package/dist/dana.svg.es-BDtZLpwd.js +0 -1
- package/dist/dankort.svg.es-CksaipXF.js +0 -1
- package/dist/de-DE-B4TUdnUf.js +0 -1
- package/dist/de-DE-DaBBl-Ak.js +0 -1
- package/dist/diners.svg.es-D6Mu1pqP.js +0 -1
- package/dist/discover.svg.es-DgqWCMUM.js +0 -1
- package/dist/eftpos.svg.es-Dk2DOT8W.js +0 -1
- package/dist/elo.svg.es-C-BzjuRP.js +0 -1
- package/dist/en-US-BNevqm0M.js +0 -1
- package/dist/en-US-D6SGRAch.mjs +0 -325
- package/dist/en-US-J85TQRI8.js +0 -1
- package/dist/en-US-SDhjlY_v.mjs +0 -301
- package/dist/eps.svg.es-B_85bP-W.js +0 -1
- package/dist/error-BHVZJGwD.mjs +0 -13
- package/dist/error-CmduqgVq.js +0 -1
- package/dist/floating-ui.vue.es-Bly3DGWm.js +0 -1
- package/dist/formControl-ODrpUvcA.js +0 -1
- package/dist/formControl-dX7l8o3c.mjs +0 -845
- package/dist/formatting.es-C72Nsrmh.js +0 -1
- package/dist/gcash.svg.es-BKAdhWzv.js +0 -1
- package/dist/getComposedString.es-haS4bAj7.js +0 -1
- package/dist/getCountryNameByCode.es-Xxc0nZsH.js +0 -1
- package/dist/girocard.svg.es-HSOEvDif.js +0 -1
- package/dist/go-pay.svg.es-DQjtunZ_.js +0 -1
- package/dist/google-pay.svg.es-hzc_EgiJ.js +0 -1
- package/dist/hipercard.svg.es-CbCsRY2q.js +0 -1
- package/dist/icon-sprite.svg.es-Ds6lDf5p.js +0 -1
- package/dist/ideal.svg.es-Booz1IML.js +0 -1
- package/dist/index-BPZPnOQQ.js +0 -7
- package/dist/index.cjs +0 -1
- package/dist/index.es-BclokHQX.js +0 -1
- package/dist/invoices-ClqTWYF9.js +0 -1
- package/dist/it-IT-BkPbTueL.js +0 -1
- package/dist/it-IT-CSYvGmpT.js +0 -1
- package/dist/jcb.svg.es-B3WPB8c2.js +0 -1
- package/dist/kakao-pay.svg.es-Cs-lCW74.js +0 -1
- package/dist/klarna.svg.es-Cs6XaHD7.js +0 -1
- package/dist/maestro.svg.es-BvK4oPg4.js +0 -1
- package/dist/mastercard.svg.es-lp4AXyyV.js +0 -1
- package/dist/momo.svg.es-C5aLYf_R.js +0 -1
- package/dist/nl-NL-CpE4IgwO.js +0 -1
- package/dist/nl-NL-jIfAVGv0.js +0 -1
- package/dist/nyce.svg.es-ArAivAZW.js +0 -1
- package/dist/object.es-CdriXMPs.js +0 -1
- package/dist/open-banking.svg.es-Q3rRkCvP.js +0 -1
- package/dist/paymentFailure-Bh60UhxA.mjs +0 -47
- package/dist/paymentFailure-Cki8c5BX.js +0 -1
- package/dist/paymentMethods-AL2U_byg.js +0 -1
- package/dist/paymentMethods-CWzJhcWK.mjs +0 -77
- package/dist/payments-BmiHMlQt.js +0 -1
- package/dist/payments-aXyfylwk.mjs +0 -45
- package/dist/paypal.svg.es-Cjp5sNI3.js +0 -1
- package/dist/pricing-BVAld27Y.js +0 -1
- package/dist/pricing-DLOeiAIB.mjs +0 -16
- package/dist/pricing.es-C07bgEZx.js +0 -1
- package/dist/pricingItemConfigs.es-D4aYkYcf.js +0 -1
- package/dist/pricingItemConfigs.es-ORxsk_YS.mjs +0 -77
- package/dist/pricingPlanSchedule-BM8vsKkV.js +0 -1
- package/dist/pricingPlanSchedules-BD4GIP_F.mjs +0 -32
- package/dist/pricingPlanSchedules-BfsMSvN0.js +0 -1
- package/dist/pulse.svg.es-Dit33E8S.js +0 -1
- package/dist/screens/Checkout/Checkout.cjs +0 -1
- package/dist/screens/CustomerOverview/CustomerOverview.cjs +0 -1
- package/dist/screens/PayInvoice/PayInvoice.cjs +0 -1
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs +0 -1
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs +0 -1
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs +0 -1
- package/dist/sepa.svg.es-0t4DKeA1.js +0 -1
- package/dist/sessionReference-3h-6FdrC.mjs +0 -43
- package/dist/sessionReference-m_6Rp4X1.js +0 -1
- package/dist/slots.es-T9ZJRGtG.js +0 -1
- package/dist/sorting.es-DCihKqD2.mjs +0 -77
- package/dist/sorting.es-DQsjKr8A.js +0 -1
- package/dist/star.svg.es-D2JncY7b.js +0 -1
- package/dist/subscription-D1yHKUNc.mjs +0 -69
- package/dist/subscription-ZA62t4E9.js +0 -1
- package/dist/subscriptions-Cm83ckfl.js +0 -1
- package/dist/subscriptions-cnR5fnf7.mjs +0 -55
- package/dist/trustly.svg.es-GJByiFAs.js +0 -1
- package/dist/twint.svg.es-BJ2f48og.js +0 -1
- package/dist/typeGuards.es-DS3vZaJn.js +0 -1
- package/dist/types/components/payments/AddPaymentMethodModal/AddPaymentMethodModal.types.d.ts +0 -14
- package/dist/types/components/payments/SubscriptionPaymentCompletedCard/SubscriptionPaymentCompletedCard.types.d.ts +0 -3
- package/dist/types/components/subscriptions/PlanCustomizationForm/AddonSingleEditor.types.d.ts +0 -5
- package/dist/types/services/portals.types.d.ts +0 -70
- package/dist/types/types/subscription.d.ts +0 -4
- package/dist/unionpay.svg.es-DjFZ5EMQ.js +0 -1
- package/dist/url-TNRgVI8A.mjs +0 -21
- package/dist/url-vloPOiXd.js +0 -1
- package/dist/useActionDispatchProvider-CHkVQMaE.js +0 -1
- package/dist/useActionDispatchProvider-DDYqIh3r.mjs +0 -11
- package/dist/useCustomer-DGYtowRy.js +0 -1
- package/dist/useCustomerFormLabels-CcnkJLcB.mjs +0 -968
- package/dist/useCustomerFormLabels-DAZziqYt.js +0 -1
- package/dist/useExperimentalFeature-COOU6IZd.js +0 -1
- package/dist/useExperimentalFeature-ierhOt9Q.mjs +0 -6
- package/dist/useIncrementalLoading-CaWOE8Xl.js +0 -1
- package/dist/useIncrementalLoading-Cgxw2GD7.mjs +0 -48
- package/dist/useInvoiceData-BEK-7msA.mjs +0 -38
- package/dist/useInvoiceData-CQRn8l9C.js +0 -1
- package/dist/useInvoicesList-BQkKyyXa.js +0 -1
- package/dist/useInvoicesList-C4I118KM.mjs +0 -500
- package/dist/useLoadInitialData-CrKnBZs_.js +0 -1
- package/dist/usePaymentMethodAvailability-Ci6LeYKt.js +0 -1
- package/dist/usePaymentMethodOptions-Ciifjo6c.mjs +0 -39
- package/dist/usePaymentMethodOptions-Cqe92ZBn.js +0 -1
- package/dist/usePaymentMethods-BKwrl82-.js +0 -1
- package/dist/usePayments-Bauj16B-.js +0 -1
- package/dist/usePortal-DSLImEfr.js +0 -1
- package/dist/usePortal-H8Tv2TnZ.mjs +0 -11
- package/dist/useService-Bh47bllz.mjs +0 -50
- package/dist/useService-H7BjLg8P.js +0 -1
- package/dist/useSubscription-BiYNJT2e.js +0 -1
- package/dist/useSubscription-DqnxWNKg.mjs +0 -210
- package/dist/useTimePeriod.es-D2aiyfd-.js +0 -1
- package/dist/useViewport-BgdA2PPt.mjs +0 -29
- package/dist/useViewport-hPRVDWCm.js +0 -1
- package/dist/useWatchDebounced-B8iX7ykx.js +0 -1
- package/dist/useWatchDebounced-BHlBPcXB.mjs +0 -20
- package/dist/visa.svg.es-NY3BHhda.js +0 -1
- package/dist/vpay.svg.es-VViQi42w.js +0 -1
- package/dist/wallets.es-CNIMW5ay.js +0 -1
- package/dist/zip.svg.es-C9S_F31W.js +0 -1
|
@@ -0,0 +1,2921 @@
|
|
|
1
|
+
import { defineComponent as Y, ref as O, onMounted as Lt, onBeforeUnmount as Oe, computed as u, openBlock as b, createBlock as x, withCtx as y, createElementVNode as N, toDisplayString as R, createVNode as E, createTextVNode as q, createElementBlock as V, unref as r, createCommentVNode as D, renderSlot as ue, createSlots as re, Fragment as we, renderList as Me, toRaw as We, watch as j, normalizeClass as $e, useModel as Yt, isRef as Ht, mergeProps as ae, mergeModels as Wt, reactive as Ie, withModifiers as ze, defineAsyncComponent as zt, normalizeStyle as je } from "vue";
|
|
2
|
+
import { w as jt } from "./api.es-QaC926Xu.mjs";
|
|
3
|
+
import { a as Q, _ as ee, c as ot, u as nt, b as ye, E as Qt, d as Ae, m as Gt, j as Kt } from "./customElements-Di3zwlEU.mjs";
|
|
4
|
+
import { u as Xt } from "./useService-B0OQJmif.mjs";
|
|
5
|
+
import { _ as me } from "./ErrorNotification.vue.es-CKlt4hr2.mjs";
|
|
6
|
+
import { i as Jt, a as Ce, h as Zt } from "./pricingItemConfigs.es-D3pX_9AJ.mjs";
|
|
7
|
+
import { b as Be } from "./wallets.es-eH2C2ygn.mjs";
|
|
8
|
+
import { _ as ie, a as eo } from "./Button.vue.es-rh6mITmN.mjs";
|
|
9
|
+
import { _ as at, T as it, a as st } from "./TooltipParagraph.vue.es-BjCn2BF6.mjs";
|
|
10
|
+
import { _ as be } from "./Section.vue.es-iS8hVGWA.mjs";
|
|
11
|
+
import { _ as lt } from "./Skeleton.vue_vue_type_script_setup_true_lang-D7MFjvrP.mjs";
|
|
12
|
+
import { _ as ut } from "./RadioGroupExtended.vue.es-UtKsdmiv.mjs";
|
|
13
|
+
import { g as to } from "./subscription-BhxoqwcT.mjs";
|
|
14
|
+
import { b as oo, u as De, d as J, a as rt, r as dt } from "./formControl-CsITfsBk.mjs";
|
|
15
|
+
import { f as Ne } from "./formatting.es-RclXHhKo.mjs";
|
|
16
|
+
import { _ as no } from "./Divider.vue.es-DnP_HqLz.mjs";
|
|
17
|
+
import { _ as ct } from "./Expand.vue.es-BleuAfDz.mjs";
|
|
18
|
+
import { a as pt } from "./EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-Bk4zwyWa.mjs";
|
|
19
|
+
import { _ as ao } from "./cn.es-2bVdkiFV.mjs";
|
|
20
|
+
import { c as mt } from "./invoices-Cf1qDAv4.mjs";
|
|
21
|
+
import { u as io, _ as so, a as lo } from "./SubscriptionSummary.vue_vue_type_script_setup_true_lang-Wmjqy7RZ.mjs";
|
|
22
|
+
import { _ as uo } from "./Input.vue.es-DAlPmtE_.mjs";
|
|
23
|
+
import { g as ro } from "./amount-CondixVt.mjs";
|
|
24
|
+
import { _ as vt } from "./PaymentMethodSelector.vue_vue_type_script_setup_true_lang-Dw28tfpD.mjs";
|
|
25
|
+
import { g as co } from "./customer.es-B5ppZf0j.mjs";
|
|
26
|
+
import { u as po } from "./usePaymentMethodOptions-1QBcmgUf.mjs";
|
|
27
|
+
import { M as ft } from "./Modal.vue.es-CTNACAst.mjs";
|
|
28
|
+
import { _ as mo } from "./Alert.vue.es-lIiAWf2S.mjs";
|
|
29
|
+
const vo = 3e4, Se = 60, Pe = 12, fo = /* @__PURE__ */ Y({
|
|
30
|
+
__name: "DateTimeAgo",
|
|
31
|
+
props: {
|
|
32
|
+
date: {},
|
|
33
|
+
actionVerb: {}
|
|
34
|
+
},
|
|
35
|
+
setup(e) {
|
|
36
|
+
const t = 60 * Se, o = 24 * t, n = e, { $t: a, formatDate: i } = Q(), l = O(Date.now());
|
|
37
|
+
let s;
|
|
38
|
+
Lt(() => {
|
|
39
|
+
s = setInterval(() => {
|
|
40
|
+
l.value = Date.now();
|
|
41
|
+
}, vo);
|
|
42
|
+
}), Oe(() => {
|
|
43
|
+
clearInterval(s);
|
|
44
|
+
});
|
|
45
|
+
const m = (c, w) => {
|
|
46
|
+
const P = (w.getFullYear() - c.getFullYear()) * Pe + (w.getMonth() - c.getMonth());
|
|
47
|
+
return w.getDate() < c.getDate() ? P - 1 : P;
|
|
48
|
+
}, h = u(() => {
|
|
49
|
+
const c = Math.max(0, (l.value - n.date.getTime()) / 1e3);
|
|
50
|
+
if (c < Se)
|
|
51
|
+
return a(
|
|
52
|
+
{
|
|
53
|
+
defaultMessage: "{count, plural, one {# second} other {# seconds}} ago",
|
|
54
|
+
id: "dateTimeAgo.seconds",
|
|
55
|
+
description: "Relative time in whole seconds"
|
|
56
|
+
},
|
|
57
|
+
{ count: Math.trunc(c) }
|
|
58
|
+
);
|
|
59
|
+
if (c < t)
|
|
60
|
+
return a(
|
|
61
|
+
{
|
|
62
|
+
defaultMessage: "{count, plural, one {# minute} other {# minutes}} ago",
|
|
63
|
+
id: "dateTimeAgo.minutes",
|
|
64
|
+
description: "Relative time in whole minutes"
|
|
65
|
+
},
|
|
66
|
+
{ count: Math.trunc(c / Se) }
|
|
67
|
+
);
|
|
68
|
+
if (c < o)
|
|
69
|
+
return a(
|
|
70
|
+
{
|
|
71
|
+
defaultMessage: "{count, plural, one {# hour} other {# hours}} ago",
|
|
72
|
+
id: "dateTimeAgo.hours",
|
|
73
|
+
description: "Relative time in whole hours"
|
|
74
|
+
},
|
|
75
|
+
{ count: Math.trunc(c / t) }
|
|
76
|
+
);
|
|
77
|
+
const w = m(n.date, new Date(l.value));
|
|
78
|
+
if (w < 1) {
|
|
79
|
+
const P = Math.trunc(c / o);
|
|
80
|
+
return P === 1 ? a({
|
|
81
|
+
defaultMessage: "yesterday",
|
|
82
|
+
id: "dateTimeAgo.yesterday",
|
|
83
|
+
description: 'Relative time for a single day ago, reading as "updated yesterday" once the action verb is in front'
|
|
84
|
+
}) : a(
|
|
85
|
+
{
|
|
86
|
+
defaultMessage: "{count, plural, one {# day} other {# days}} ago",
|
|
87
|
+
id: "dateTimeAgo.days",
|
|
88
|
+
description: "Relative time in whole days"
|
|
89
|
+
},
|
|
90
|
+
{ count: P }
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
return w < Pe ? a(
|
|
94
|
+
{
|
|
95
|
+
defaultMessage: "{count, plural, one {# month} other {# months}} ago",
|
|
96
|
+
id: "dateTimeAgo.months",
|
|
97
|
+
description: "Relative time in whole months"
|
|
98
|
+
},
|
|
99
|
+
{ count: w }
|
|
100
|
+
) : a(
|
|
101
|
+
{
|
|
102
|
+
defaultMessage: "{count, plural, one {# year} other {# years}} ago",
|
|
103
|
+
id: "dateTimeAgo.years",
|
|
104
|
+
description: "Relative time in whole years"
|
|
105
|
+
},
|
|
106
|
+
{ count: Math.trunc(w / Pe) }
|
|
107
|
+
);
|
|
108
|
+
}), M = u(
|
|
109
|
+
() => n.actionVerb ? `${n.actionVerb} ${h.value}` : h.value
|
|
110
|
+
), A = u(
|
|
111
|
+
() => i({ date: n.date, format: "dateTime", offsetType: "local" })
|
|
112
|
+
);
|
|
113
|
+
return (c, w) => (b(), x(at, null, {
|
|
114
|
+
tooltip: y(() => [
|
|
115
|
+
E(it, null, {
|
|
116
|
+
default: y(() => [
|
|
117
|
+
E(st, null, {
|
|
118
|
+
default: y(() => [
|
|
119
|
+
q(R(A.value), 1)
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
})
|
|
123
|
+
]),
|
|
124
|
+
_: 1
|
|
125
|
+
})
|
|
126
|
+
]),
|
|
127
|
+
default: y(() => [
|
|
128
|
+
N("span", null, R(M.value), 1)
|
|
129
|
+
]),
|
|
130
|
+
_: 1
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
}), ho = (e) => {
|
|
134
|
+
const { $t: t, formatNumber: o } = Q(), n = (_) => Be(t, o, _), a = u(
|
|
135
|
+
() => {
|
|
136
|
+
var _, p;
|
|
137
|
+
return ((p = (_ = e.walletBalance.wallet) == null ? void 0 : _.wallet_type) == null ? void 0 : p.name) || t({
|
|
138
|
+
defaultMessage: "Balance",
|
|
139
|
+
id: "wallet_balance.balance_label",
|
|
140
|
+
description: "Label shown above a wallet's balance amount"
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
), i = (_) => {
|
|
144
|
+
var p;
|
|
145
|
+
return (((p = _.pricing_item) == null ? void 0 : p.configs) ?? []).filter((S) => !!S.on_demand);
|
|
146
|
+
}, l = u(
|
|
147
|
+
() => (e.walletBalance.charge_on_demand_pricing_items ?? []).filter(
|
|
148
|
+
(_) => i(_).some(
|
|
149
|
+
(p) => Jt(p) || Ce(p)
|
|
150
|
+
)
|
|
151
|
+
)
|
|
152
|
+
), s = u(
|
|
153
|
+
() => l.value.find(
|
|
154
|
+
(_) => i(_).some((p) => Ce(p))
|
|
155
|
+
)
|
|
156
|
+
), m = u(
|
|
157
|
+
() => !!e.showManualTopUp && l.value.length > 0
|
|
158
|
+
), h = u(() => !!e.showAutoTopUp && !!s.value), M = u(
|
|
159
|
+
() => {
|
|
160
|
+
var _, p;
|
|
161
|
+
return (p = (_ = e.walletBalance.wallet) == null ? void 0 : _.auto_top_up_configs) == null ? void 0 : p.find(
|
|
162
|
+
(S) => S.status === "ACTIVE"
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
), A = u(
|
|
166
|
+
() => {
|
|
167
|
+
var _, p;
|
|
168
|
+
return (p = (_ = e.walletBalance.wallet_balance.open_balance) == null ? void 0 : _.credits) == null ? void 0 : p.credit_type;
|
|
169
|
+
}
|
|
170
|
+
), c = (_, p) => n({
|
|
171
|
+
credits: {
|
|
172
|
+
quantity: _,
|
|
173
|
+
credit_type_id: p,
|
|
174
|
+
credit_type: A.value
|
|
175
|
+
}
|
|
176
|
+
}), w = (_) => _.amount ? n({ amount: _.amount }) : _.credits ? c(_.credits.quantity, _.credits.credit_type_id) : "", P = u(() => {
|
|
177
|
+
var _, p;
|
|
178
|
+
const S = (_ = M.value) == null ? void 0 : _.pricing_item_id;
|
|
179
|
+
if (!S)
|
|
180
|
+
return;
|
|
181
|
+
const I = (e.walletBalance.charge_on_demand_pricing_items ?? []).filter((U) => U.pricing_item_id === S).flatMap((U) => i(U)).flatMap((U) => U.wallet_grants ?? []), f = (p = e.walletBalance.wallet) == null ? void 0 : p.wallet_type_id;
|
|
182
|
+
return I.find((U) => U.wallet_type_id === f) ?? I[0];
|
|
183
|
+
}), g = u(() => {
|
|
184
|
+
var _, p;
|
|
185
|
+
const S = (_ = M.value) == null ? void 0 : _.topup_amount, I = (p = P.value) == null ? void 0 : p.credits_grant;
|
|
186
|
+
if (!S || !I)
|
|
187
|
+
return "";
|
|
188
|
+
if (I.credits)
|
|
189
|
+
return c(
|
|
190
|
+
I.credits.quantity,
|
|
191
|
+
I.credits.credit_type_id
|
|
192
|
+
);
|
|
193
|
+
if (I.conversion) {
|
|
194
|
+
const f = Number(S.quantity) * Number(I.conversion.rate);
|
|
195
|
+
return c(String(f), I.conversion.credit_type_id);
|
|
196
|
+
}
|
|
197
|
+
return "";
|
|
198
|
+
}), C = u(
|
|
199
|
+
() => M.value ? t({
|
|
200
|
+
defaultMessage: "Auto top-up enabled",
|
|
201
|
+
id: "wallet_balance.auto_top_up_enabled_label",
|
|
202
|
+
description: "Label shown when a wallet tops itself up automatically"
|
|
203
|
+
}) : t({
|
|
204
|
+
defaultMessage: "No auto top-up enabled",
|
|
205
|
+
id: "wallet_balance.auto_top_up_disabled_label",
|
|
206
|
+
description: "Label shown when a wallet has no automatic top-up configured"
|
|
207
|
+
})
|
|
208
|
+
), G = u(() => {
|
|
209
|
+
const _ = M.value;
|
|
210
|
+
if (!_)
|
|
211
|
+
return t({
|
|
212
|
+
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.",
|
|
213
|
+
id: "wallet_balance.auto_top_up_setup_explanation",
|
|
214
|
+
description: "Tooltip explaining what automatic top-ups do, shown when none is configured yet"
|
|
215
|
+
});
|
|
216
|
+
const p = _.topup_amount ? n({ amount: _.topup_amount }) : "", S = w(_.threshold);
|
|
217
|
+
return !p || !S ? t({
|
|
218
|
+
defaultMessage: "Your balance is topped up automatically once it runs low.",
|
|
219
|
+
id: "wallet_balance.auto_top_up_generic_explanation",
|
|
220
|
+
description: "Tooltip shown for an active automatic top-up whose amount or threshold is unknown"
|
|
221
|
+
}) : g.value ? t(
|
|
222
|
+
{
|
|
223
|
+
defaultMessage: "Your balance is automatically increased with {topUpCredits} ({topUpAmount}) when it drops below {threshold}.",
|
|
224
|
+
id: "wallet_balance.auto_top_up_credits_explanation",
|
|
225
|
+
description: "Tooltip explaining an automatic top-up that grants credits for a paid amount"
|
|
226
|
+
},
|
|
227
|
+
{ topUpCredits: g.value, topUpAmount: p, threshold: S }
|
|
228
|
+
) : t(
|
|
229
|
+
{
|
|
230
|
+
defaultMessage: "Your balance is automatically increased with {topUpAmount} when it drops below {threshold}.",
|
|
231
|
+
id: "wallet_balance.auto_top_up_explanation",
|
|
232
|
+
description: "Tooltip explaining how the automatic top-up of a wallet balance works"
|
|
233
|
+
},
|
|
234
|
+
{ topUpAmount: p, threshold: S }
|
|
235
|
+
);
|
|
236
|
+
});
|
|
237
|
+
return {
|
|
238
|
+
walletName: a,
|
|
239
|
+
formatBalance: n,
|
|
240
|
+
manualTopUpItems: l,
|
|
241
|
+
flexibleManualTopUpItem: s,
|
|
242
|
+
showManualTopUp: m,
|
|
243
|
+
showAutoTopUp: h,
|
|
244
|
+
activeTopUpConfig: M,
|
|
245
|
+
autoTopUpLabel: C,
|
|
246
|
+
autoTopUpExplanation: G
|
|
247
|
+
};
|
|
248
|
+
}, go = { class: "flex flex-col gap-3 py-3" }, _o = { class: "flex flex-col gap-1 px-4" }, yo = { class: "flex w-full justify-between gap-3" }, bo = { class: "flex w-full items-center gap-4" }, wo = { key: 0 }, To = {
|
|
249
|
+
key: 1,
|
|
250
|
+
class: "flex w-full justify-between gap-3 px-4"
|
|
251
|
+
}, Mo = { class: "flex min-w-0 items-center gap-1" }, Ao = { class: "flex min-w-0 items-center gap-1" }, Uo = { class: "shrink-0" }, So = /* @__PURE__ */ Y({
|
|
252
|
+
__name: "WalletBalancesItem",
|
|
253
|
+
props: {
|
|
254
|
+
walletBalance: {},
|
|
255
|
+
showAutoTopUp: { type: Boolean },
|
|
256
|
+
showManualTopUp: { type: Boolean }
|
|
257
|
+
},
|
|
258
|
+
emits: ["top-up", "auto-top-up", "cancel-auto-top-up"],
|
|
259
|
+
setup(e) {
|
|
260
|
+
const t = e, { $t: o } = Q(), {
|
|
261
|
+
walletName: n,
|
|
262
|
+
formatBalance: a,
|
|
263
|
+
manualTopUpItems: i,
|
|
264
|
+
flexibleManualTopUpItem: l,
|
|
265
|
+
showManualTopUp: s,
|
|
266
|
+
showAutoTopUp: m,
|
|
267
|
+
activeTopUpConfig: h,
|
|
268
|
+
autoTopUpLabel: M,
|
|
269
|
+
autoTopUpExplanation: A
|
|
270
|
+
} = ho(t);
|
|
271
|
+
return (c, w) => (b(), V("div", go, [
|
|
272
|
+
N("div", _o, [
|
|
273
|
+
N("div", yo, [
|
|
274
|
+
E(ee, {
|
|
275
|
+
variant: "body-xs",
|
|
276
|
+
color: "subtle",
|
|
277
|
+
"no-spacing": ""
|
|
278
|
+
}, {
|
|
279
|
+
default: y(() => [
|
|
280
|
+
q(R(r(n)), 1)
|
|
281
|
+
]),
|
|
282
|
+
_: 1
|
|
283
|
+
}),
|
|
284
|
+
E(ee, {
|
|
285
|
+
variant: "body-xs",
|
|
286
|
+
color: "subtle",
|
|
287
|
+
"no-spacing": ""
|
|
288
|
+
}, {
|
|
289
|
+
default: y(() => {
|
|
290
|
+
var P, g;
|
|
291
|
+
return [
|
|
292
|
+
(P = e.walletBalance.wallet_balance) != null && P.balance_at ? (b(), x(fo, {
|
|
293
|
+
key: 0,
|
|
294
|
+
date: new Date((g = e.walletBalance.wallet_balance) == null ? void 0 : g.balance_at),
|
|
295
|
+
"action-verb": r(o)({
|
|
296
|
+
defaultMessage: "updated",
|
|
297
|
+
id: "wallet_balance.updated_action_verb",
|
|
298
|
+
description: "Verb in front of when a wallet balance was last updated, e.g. 'updated 5 minutes ago'"
|
|
299
|
+
})
|
|
300
|
+
}, null, 8, ["date", "action-verb"])) : D("", !0)
|
|
301
|
+
];
|
|
302
|
+
}),
|
|
303
|
+
_: 1
|
|
304
|
+
})
|
|
305
|
+
]),
|
|
306
|
+
N("div", bo, [
|
|
307
|
+
E(ee, {
|
|
308
|
+
variant: "body-lg",
|
|
309
|
+
weight: "semibold",
|
|
310
|
+
"no-spacing": "",
|
|
311
|
+
class: "grow"
|
|
312
|
+
}, {
|
|
313
|
+
default: y(() => [
|
|
314
|
+
q(R(r(a)(t.walletBalance.wallet_balance.open_balance)), 1)
|
|
315
|
+
]),
|
|
316
|
+
_: 1
|
|
317
|
+
}),
|
|
318
|
+
r(s) ? (b(), x(r(ie), {
|
|
319
|
+
key: 0,
|
|
320
|
+
size: "xs",
|
|
321
|
+
onClick: w[0] || (w[0] = (P) => c.$emit("top-up", r(i)[0]))
|
|
322
|
+
}, {
|
|
323
|
+
default: y(() => [
|
|
324
|
+
q(R(r(o)({
|
|
325
|
+
defaultMessage: "Top up",
|
|
326
|
+
id: "v1V8kA",
|
|
327
|
+
description: "Button to top up a wallet balance"
|
|
328
|
+
})), 1)
|
|
329
|
+
]),
|
|
330
|
+
_: 1
|
|
331
|
+
})) : D("", !0)
|
|
332
|
+
])
|
|
333
|
+
]),
|
|
334
|
+
c.$slots.graph ? (b(), V("div", wo, [
|
|
335
|
+
ue(c.$slots, "graph")
|
|
336
|
+
])) : D("", !0),
|
|
337
|
+
r(m) ? (b(), V("div", To, [
|
|
338
|
+
N("div", Mo, [
|
|
339
|
+
E(at, { class: "min-w-0" }, {
|
|
340
|
+
tooltip: y(() => [
|
|
341
|
+
E(it, null, {
|
|
342
|
+
default: y(() => [
|
|
343
|
+
E(st, null, {
|
|
344
|
+
default: y(() => [
|
|
345
|
+
q(R(r(A)), 1)
|
|
346
|
+
]),
|
|
347
|
+
_: 1
|
|
348
|
+
})
|
|
349
|
+
]),
|
|
350
|
+
_: 1
|
|
351
|
+
})
|
|
352
|
+
]),
|
|
353
|
+
default: y(() => [
|
|
354
|
+
N("div", Ao, [
|
|
355
|
+
E(ee, {
|
|
356
|
+
variant: "body-sm",
|
|
357
|
+
color: "secondary",
|
|
358
|
+
"no-spacing": "",
|
|
359
|
+
class: "truncate"
|
|
360
|
+
}, {
|
|
361
|
+
default: y(() => [
|
|
362
|
+
q(R(r(M)), 1)
|
|
363
|
+
]),
|
|
364
|
+
_: 1
|
|
365
|
+
}),
|
|
366
|
+
E(eo, {
|
|
367
|
+
icon: "info",
|
|
368
|
+
size: "2xs",
|
|
369
|
+
class: "shrink-0 cursor-help text-gray-400"
|
|
370
|
+
})
|
|
371
|
+
])
|
|
372
|
+
]),
|
|
373
|
+
_: 1
|
|
374
|
+
})
|
|
375
|
+
]),
|
|
376
|
+
N("div", Uo, [
|
|
377
|
+
r(h) ? (b(), x(r(ie), {
|
|
378
|
+
key: 0,
|
|
379
|
+
size: "xs",
|
|
380
|
+
intent: "secondary",
|
|
381
|
+
onClick: w[1] || (w[1] = (P) => c.$emit("cancel-auto-top-up", r(h)))
|
|
382
|
+
}, {
|
|
383
|
+
default: y(() => [
|
|
384
|
+
q(R(r(o)({
|
|
385
|
+
defaultMessage: "Disable",
|
|
386
|
+
id: "wallet_balance.auto_top_up_disable_button",
|
|
387
|
+
description: "Button to turn off a wallet's automatic top-up"
|
|
388
|
+
})), 1)
|
|
389
|
+
]),
|
|
390
|
+
_: 1
|
|
391
|
+
})) : (b(), x(r(ie), {
|
|
392
|
+
key: 1,
|
|
393
|
+
size: "xs",
|
|
394
|
+
intent: "secondary",
|
|
395
|
+
onClick: w[2] || (w[2] = (P) => c.$emit("auto-top-up", r(l)))
|
|
396
|
+
}, {
|
|
397
|
+
default: y(() => [
|
|
398
|
+
q(R(r(o)({
|
|
399
|
+
defaultMessage: "Enable",
|
|
400
|
+
id: "wallet_balance.auto_top_up_enable_button",
|
|
401
|
+
description: "Button to set up a wallet's automatic top-up"
|
|
402
|
+
})), 1)
|
|
403
|
+
]),
|
|
404
|
+
_: 1
|
|
405
|
+
}))
|
|
406
|
+
])
|
|
407
|
+
])) : D("", !0)
|
|
408
|
+
]));
|
|
409
|
+
}
|
|
410
|
+
}), Po = { class: "flex flex-col gap-2" }, Co = /* @__PURE__ */ Y({
|
|
411
|
+
__name: "WalletBalances",
|
|
412
|
+
props: {
|
|
413
|
+
customerWalletBalances: {},
|
|
414
|
+
title: { default: void 0 },
|
|
415
|
+
showAutoTopUp: { type: Boolean, default: !1 },
|
|
416
|
+
showManualTopUp: { type: Boolean, default: !1 }
|
|
417
|
+
},
|
|
418
|
+
emits: ["top-up", "auto-top-up", "cancel-auto-top-up"],
|
|
419
|
+
setup(e) {
|
|
420
|
+
return (t, o) => (b(), x(be, {
|
|
421
|
+
"no-spacing": "",
|
|
422
|
+
"no-border": "",
|
|
423
|
+
title: e.title
|
|
424
|
+
}, re({
|
|
425
|
+
default: y(() => [
|
|
426
|
+
N("div", Po, [
|
|
427
|
+
(b(!0), V(we, null, Me(e.customerWalletBalances, (n) => (b(), x(be, {
|
|
428
|
+
key: n.wallet_id,
|
|
429
|
+
"no-spacing": ""
|
|
430
|
+
}, {
|
|
431
|
+
default: y(() => [
|
|
432
|
+
E(So, {
|
|
433
|
+
"wallet-balance": n,
|
|
434
|
+
"show-auto-top-up": e.showAutoTopUp,
|
|
435
|
+
"show-manual-top-up": e.showManualTopUp,
|
|
436
|
+
onTopUp: o[0] || (o[0] = (a) => t.$emit("top-up", a)),
|
|
437
|
+
onAutoTopUp: o[1] || (o[1] = (a) => t.$emit("auto-top-up", a)),
|
|
438
|
+
onCancelAutoTopUp: o[2] || (o[2] = (a) => t.$emit("cancel-auto-top-up", a))
|
|
439
|
+
}, null, 8, ["wallet-balance", "show-auto-top-up", "show-manual-top-up"])
|
|
440
|
+
]),
|
|
441
|
+
_: 2
|
|
442
|
+
}, 1024))), 128))
|
|
443
|
+
])
|
|
444
|
+
]),
|
|
445
|
+
_: 2
|
|
446
|
+
}, [
|
|
447
|
+
t.$slots["heading-right"] ? {
|
|
448
|
+
name: "right",
|
|
449
|
+
fn: y(() => [
|
|
450
|
+
ue(t.$slots, "heading-right")
|
|
451
|
+
]),
|
|
452
|
+
key: "0"
|
|
453
|
+
} : void 0
|
|
454
|
+
]), 1032, ["title"]));
|
|
455
|
+
}
|
|
456
|
+
});
|
|
457
|
+
function Eo() {
|
|
458
|
+
const e = ot(), t = nt();
|
|
459
|
+
async function o(n) {
|
|
460
|
+
return e({
|
|
461
|
+
url: ye(
|
|
462
|
+
t.apiUrls.config,
|
|
463
|
+
"portal",
|
|
464
|
+
"customers",
|
|
465
|
+
n,
|
|
466
|
+
"wallets",
|
|
467
|
+
"balance"
|
|
468
|
+
),
|
|
469
|
+
query: jt({ expandParams: Qt }),
|
|
470
|
+
options: { method: "POST" },
|
|
471
|
+
data: {}
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
return {
|
|
475
|
+
getCustomerWalletBalances: o
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
function ea({ customerId: e }) {
|
|
479
|
+
const { getCustomerWalletBalances: t } = Eo(), { data: o, execute: n, apiStatus: a, error: i, isPending: l } = Xt({
|
|
480
|
+
service: () => t(e)
|
|
481
|
+
});
|
|
482
|
+
return { walletBalances: u(
|
|
483
|
+
() => o.value ?? null
|
|
484
|
+
), apiStatus: a, error: i, fetch: n, isPending: l };
|
|
485
|
+
}
|
|
486
|
+
const Qe = (e = [], t) => {
|
|
487
|
+
if (!(t != null && t.pricing_item_id))
|
|
488
|
+
return;
|
|
489
|
+
const o = (a) => a.charge_on_demand_pricing_items ?? [], n = We(t);
|
|
490
|
+
return e.find(
|
|
491
|
+
(a) => o(a).some((i) => We(i) === n)
|
|
492
|
+
) ?? e.find(
|
|
493
|
+
(a) => o(a).some(
|
|
494
|
+
({ pricing_item_id: i }) => i === t.pricing_item_id
|
|
495
|
+
)
|
|
496
|
+
);
|
|
497
|
+
}, xo = (e, t) => {
|
|
498
|
+
const o = new Set(
|
|
499
|
+
(t ?? []).flatMap(
|
|
500
|
+
({ pricing_plan_schedule_infos: n }) => (n ?? []).map(({ id: a }) => a)
|
|
501
|
+
)
|
|
502
|
+
);
|
|
503
|
+
return o.size === 0 ? e : e.map((n) => ({
|
|
504
|
+
...n,
|
|
505
|
+
charge_on_demand_pricing_items: (n.charge_on_demand_pricing_items ?? []).filter(
|
|
506
|
+
({ pricing_plan_schedule_id: a }) => !!a && o.has(a)
|
|
507
|
+
)
|
|
508
|
+
}));
|
|
509
|
+
}, Oo = ["TOP_UP", "ADD_PAYMENT_METHOD", "SUCCESS"], Re = (e) => typeof e == "object" && e !== null && "pricing_item" in e, $o = (e) => [
|
|
510
|
+
...new Set(
|
|
511
|
+
((e == null ? void 0 : e.charge_on_demand_pricing_items) ?? []).flatMap(
|
|
512
|
+
(t) => Re(t) && t.pricing_plan_schedule_id ? [t.pricing_plan_schedule_id] : []
|
|
513
|
+
)
|
|
514
|
+
)
|
|
515
|
+
], Io = (e, t) => {
|
|
516
|
+
const o = new Set($o(e));
|
|
517
|
+
return t.flatMap((n) => {
|
|
518
|
+
var i;
|
|
519
|
+
const a = (n.pricing_plan_schedule_infos ?? []).filter(
|
|
520
|
+
({ id: l }) => o.has(l)
|
|
521
|
+
);
|
|
522
|
+
return a.length === 0 ? [] : [
|
|
523
|
+
{
|
|
524
|
+
id: n.id,
|
|
525
|
+
name: n.name || n.reference || ((i = to(n)) == null ? void 0 : i.name) || void 0,
|
|
526
|
+
scheduleIds: a.map(({ id: l }) => l),
|
|
527
|
+
enabledPricingIds: a.flatMap(
|
|
528
|
+
(l) => {
|
|
529
|
+
var s;
|
|
530
|
+
return (((s = l.pricing_plan_schedule) == null ? void 0 : s.enabled_pricings) ?? []).flatMap(
|
|
531
|
+
({ pricing_id: m }) => m ? [m] : []
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
)
|
|
535
|
+
}
|
|
536
|
+
];
|
|
537
|
+
});
|
|
538
|
+
}, Bo = (e, t) => {
|
|
539
|
+
if (!e || t.length === 0)
|
|
540
|
+
return e;
|
|
541
|
+
const o = new Set(t);
|
|
542
|
+
return {
|
|
543
|
+
...e,
|
|
544
|
+
charge_on_demand_pricing_items: (e.charge_on_demand_pricing_items ?? []).filter(
|
|
545
|
+
(n) => Re(n) && !!n.pricing_plan_schedule_id && o.has(n.pricing_plan_schedule_id)
|
|
546
|
+
)
|
|
547
|
+
};
|
|
548
|
+
}, ht = (e) => ((e == null ? void 0 : e.charge_on_demand_pricing_items) ?? []).flatMap((t) => {
|
|
549
|
+
var n, a;
|
|
550
|
+
if (!Re(t))
|
|
551
|
+
return [];
|
|
552
|
+
const o = t.pricing_item_id ?? ((n = t.pricing_item) == null ? void 0 : n.id);
|
|
553
|
+
return o ? (((a = t.pricing_item) == null ? void 0 : a.configs) ?? []).map((i) => {
|
|
554
|
+
const l = ko(i, e), s = Do(i, e);
|
|
555
|
+
return {
|
|
556
|
+
pricingItemId: o,
|
|
557
|
+
...t.pricing_plan_schedule_id && {
|
|
558
|
+
pricingPlanScheduleId: t.pricing_plan_schedule_id
|
|
559
|
+
},
|
|
560
|
+
config: i,
|
|
561
|
+
...l && { flexiblePricing: l },
|
|
562
|
+
...s && { fixedPricing: s }
|
|
563
|
+
};
|
|
564
|
+
}) : [];
|
|
565
|
+
});
|
|
566
|
+
function Do(e, t) {
|
|
567
|
+
var i, l, s;
|
|
568
|
+
if (!e.on_demand || !Zt(e, ["FIXED"]))
|
|
569
|
+
return;
|
|
570
|
+
const o = (s = (l = (i = e.details) == null ? void 0 : i.bands) == null ? void 0 : l[0]) == null ? void 0 : s.fixed_amount;
|
|
571
|
+
if (!o)
|
|
572
|
+
return;
|
|
573
|
+
const n = gt(t), a = n ? Ro(e, t) : void 0;
|
|
574
|
+
return {
|
|
575
|
+
amount: o,
|
|
576
|
+
value: a && n ? ke(a.quantity, n) : { amount: o }
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
const gt = (e) => {
|
|
580
|
+
var t;
|
|
581
|
+
return (t = e == null ? void 0 : e.wallet_balance.balance) == null ? void 0 : t.credits;
|
|
582
|
+
}, _t = (e, t) => {
|
|
583
|
+
var n;
|
|
584
|
+
const o = (n = t == null ? void 0 : t.wallet) == null ? void 0 : n.wallet_type_id;
|
|
585
|
+
return (e.wallet_grants ?? []).filter(
|
|
586
|
+
({ wallet_type_id: a }) => !o || a === o
|
|
587
|
+
);
|
|
588
|
+
}, No = (e, t) => {
|
|
589
|
+
var o, n;
|
|
590
|
+
return (n = (o = _t(e, t).find(
|
|
591
|
+
({ credits_grant: a }) => a == null ? void 0 : a.conversion
|
|
592
|
+
)) == null ? void 0 : o.credits_grant) == null ? void 0 : n.conversion;
|
|
593
|
+
}, Ro = (e, t) => {
|
|
594
|
+
var o, n;
|
|
595
|
+
return (n = (o = _t(e, t).find(({ credits_grant: a }) => a == null ? void 0 : a.credits)) == null ? void 0 : o.credits_grant) == null ? void 0 : n.credits;
|
|
596
|
+
}, ke = (e, t) => ({ credits: { ...t, quantity: e } }), yt = (e, t) => {
|
|
597
|
+
const o = Number(e), n = Number(t);
|
|
598
|
+
return Number.isFinite(o) && Number.isFinite(n) ? String(o * n) : void 0;
|
|
599
|
+
};
|
|
600
|
+
function ko(e, t) {
|
|
601
|
+
var m, h, M, A, c, w, P;
|
|
602
|
+
if (!e.on_demand || !Ce(e))
|
|
603
|
+
return;
|
|
604
|
+
const o = (h = (m = e.details) == null ? void 0 : m.bands) == null ? void 0 : h[0], n = ((M = o == null ? void 0 : o.minimum_amount) == null ? void 0 : M.currency) ?? ((A = o == null ? void 0 : o.maximum_amount) == null ? void 0 : A.currency) ?? ((w = (c = t == null ? void 0 : t.wallet_balance.balance) == null ? void 0 : c.amount) == null ? void 0 : w.currency);
|
|
605
|
+
if (!n)
|
|
606
|
+
return;
|
|
607
|
+
const a = gt(t), i = a ? No(e, t) : void 0, l = (P = a == null ? void 0 : a.credit_type) == null ? void 0 : P.unit_name, s = (g) => {
|
|
608
|
+
if (!g)
|
|
609
|
+
return;
|
|
610
|
+
const C = a && i ? yt(g.quantity, i.rate) : void 0;
|
|
611
|
+
return C !== void 0 && a ? ke(C, a) : { amount: g };
|
|
612
|
+
};
|
|
613
|
+
return {
|
|
614
|
+
config: {
|
|
615
|
+
...(o == null ? void 0 : o.minimum_amount) && { minimum_amount: o.minimum_amount },
|
|
616
|
+
...(o == null ? void 0 : o.maximum_amount) && { maximum_amount: o.maximum_amount }
|
|
617
|
+
},
|
|
618
|
+
currency: n,
|
|
619
|
+
...i && {
|
|
620
|
+
creditsConfiguration: {
|
|
621
|
+
conversionRate: i.rate,
|
|
622
|
+
...(l == null ? void 0 : l.singular) && { unitNameSingle: l.singular },
|
|
623
|
+
...(l == null ? void 0 : l.plural) && { unitNamePlural: l.plural }
|
|
624
|
+
}
|
|
625
|
+
},
|
|
626
|
+
bounds: {
|
|
627
|
+
...s(o == null ? void 0 : o.minimum_amount) && { minimum: s(o == null ? void 0 : o.minimum_amount) },
|
|
628
|
+
...s(o == null ? void 0 : o.maximum_amount) && { maximum: s(o == null ? void 0 : o.maximum_amount) }
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
}
|
|
632
|
+
const Fe = ({ fixedPricing: e, flexiblePricing: t }) => {
|
|
633
|
+
var o;
|
|
634
|
+
return (e == null ? void 0 : e.value.credits) ?? ((o = (t == null ? void 0 : t.bounds.minimum) ?? (t == null ? void 0 : t.bounds.maximum)) == null ? void 0 : o.credits);
|
|
635
|
+
}, Fo = (e) => {
|
|
636
|
+
var t;
|
|
637
|
+
return !!Fe(e) || !!((t = e.flexiblePricing) != null && t.creditsConfiguration);
|
|
638
|
+
}, qo = (e) => {
|
|
639
|
+
var t;
|
|
640
|
+
return (t = e.map(Fe).find((o) => o == null ? void 0 : o.credit_type_id)) == null ? void 0 : t.credit_type_id;
|
|
641
|
+
}, bt = (e = []) => {
|
|
642
|
+
for (const { flexiblePricing: t, fixedPricing: o } of e) {
|
|
643
|
+
const n = (t == null ? void 0 : t.currency) ?? (o == null ? void 0 : o.amount.currency);
|
|
644
|
+
if (n)
|
|
645
|
+
return n;
|
|
646
|
+
}
|
|
647
|
+
}, wt = (e = []) => {
|
|
648
|
+
var t, o, n;
|
|
649
|
+
return (n = (o = (t = e.map(Fe).find((a) => {
|
|
650
|
+
var i, l;
|
|
651
|
+
return (l = (i = a == null ? void 0 : a.credit_type) == null ? void 0 : i.unit_name) == null ? void 0 : l.plural;
|
|
652
|
+
})) == null ? void 0 : t.credit_type) == null ? void 0 : o.unit_name) == null ? void 0 : n.plural;
|
|
653
|
+
}, Vo = (e = []) => {
|
|
654
|
+
var t;
|
|
655
|
+
for (const { flexiblePricing: o } of e) {
|
|
656
|
+
const n = (t = o == null ? void 0 : o.creditsConfiguration) == null ? void 0 : t.conversionRate;
|
|
657
|
+
if (n)
|
|
658
|
+
return n;
|
|
659
|
+
}
|
|
660
|
+
}, Lo = (e = []) => {
|
|
661
|
+
for (const { flexiblePricing: t } of e) {
|
|
662
|
+
const { minimum_amount: o, maximum_amount: n } = (t == null ? void 0 : t.config) ?? {};
|
|
663
|
+
if (o || n)
|
|
664
|
+
return { ...o && { minimum: o }, ...n && { maximum: n } };
|
|
665
|
+
}
|
|
666
|
+
return {};
|
|
667
|
+
}, Yo = (e = []) => {
|
|
668
|
+
if (e.some(Fo)) {
|
|
669
|
+
const o = qo(e);
|
|
670
|
+
return o ? { creditTypeId: o } : void 0;
|
|
671
|
+
}
|
|
672
|
+
const t = bt(e);
|
|
673
|
+
return t ? { currency: t } : void 0;
|
|
674
|
+
}, Ho = (e, t) => {
|
|
675
|
+
var l;
|
|
676
|
+
if (e.fixedPricing)
|
|
677
|
+
return e.fixedPricing.value;
|
|
678
|
+
if (!e.flexiblePricing || !t)
|
|
679
|
+
return;
|
|
680
|
+
const { bounds: o, creditsConfiguration: n } = e.flexiblePricing, a = (l = o.minimum ?? o.maximum) == null ? void 0 : l.credits, i = n ? yt(t.quantity, n.conversionRate) : void 0;
|
|
681
|
+
return a && i !== void 0 ? ke(i, a) : { amount: t };
|
|
682
|
+
}, Tt = (e = []) => {
|
|
683
|
+
const t = Yo(e);
|
|
684
|
+
if (t)
|
|
685
|
+
return {
|
|
686
|
+
denomination: t,
|
|
687
|
+
chargeCurrency: bt(e) ?? "",
|
|
688
|
+
creditUnitName: wt(e),
|
|
689
|
+
conversionRate: Vo(e),
|
|
690
|
+
topUpBounds: Lo(e)
|
|
691
|
+
};
|
|
692
|
+
}, Wo = 400;
|
|
693
|
+
function zo({
|
|
694
|
+
pricingPlanScheduleId: e,
|
|
695
|
+
pricingItems: t
|
|
696
|
+
}) {
|
|
697
|
+
const { previewChargeOnDemandPricingItems: o } = mt(), n = Ae(), a = O(), i = O(!1), l = O(!1), s = u(() => i.value || l.value), m = O(!1), h = Gt(), M = async () => {
|
|
698
|
+
const A = e.value, c = h();
|
|
699
|
+
if (l.value = !1, !A || !t.value) {
|
|
700
|
+
t.value && !A && n.warn(
|
|
701
|
+
"INVOICE_PREVIEW_SKIPPED",
|
|
702
|
+
"Skipped the on-demand charge invoice preview: no schedule to charge it on",
|
|
703
|
+
{ missing: ["pricingPlanScheduleId"] }
|
|
704
|
+
), a.value = void 0, i.value = !1, m.value = !1;
|
|
705
|
+
return;
|
|
706
|
+
}
|
|
707
|
+
i.value = !0, m.value = !1;
|
|
708
|
+
try {
|
|
709
|
+
const w = await o({
|
|
710
|
+
pricingPlanScheduleId: A,
|
|
711
|
+
pricingItems: t.value
|
|
712
|
+
});
|
|
713
|
+
c() && (a.value = w);
|
|
714
|
+
} catch (w) {
|
|
715
|
+
c() && (a.value = void 0, m.value = !0), n.error(
|
|
716
|
+
"INVOICE_PREVIEW_FAILED",
|
|
717
|
+
"Failed to load the invoice preview",
|
|
718
|
+
{ preview: "ON_DEMAND_CHARGE" },
|
|
719
|
+
w
|
|
720
|
+
);
|
|
721
|
+
} finally {
|
|
722
|
+
c() && (i.value = !1);
|
|
723
|
+
}
|
|
724
|
+
};
|
|
725
|
+
return io(t, () => void M(), {
|
|
726
|
+
debounce: () => a.value || i.value || m.value ? Wo : 0,
|
|
727
|
+
deep: !0
|
|
728
|
+
}), j(
|
|
729
|
+
t,
|
|
730
|
+
(A) => {
|
|
731
|
+
l.value = !!A, A || (h(), a.value = void 0, m.value = !1, i.value = !1);
|
|
732
|
+
},
|
|
733
|
+
{ deep: !0, flush: "sync" }
|
|
734
|
+
), M(), { invoicePreview: a, isPreviewPending: s, hasPreviewFailed: m, loadPreview: M };
|
|
735
|
+
}
|
|
736
|
+
const jo = ["aria-busy"], Mt = /* @__PURE__ */ Y({
|
|
737
|
+
__name: "TopUpInvoicePreview",
|
|
738
|
+
props: {
|
|
739
|
+
pricingPlanScheduleId: { type: String },
|
|
740
|
+
pricingItems: { type: Array }
|
|
741
|
+
},
|
|
742
|
+
setup(e) {
|
|
743
|
+
const t = e, { $t: o } = Q(), n = u(() => t.pricingPlanScheduleId), a = u(() => t.pricingItems), { invoicePreview: i, isPreviewPending: l, hasPreviewFailed: s } = zo({
|
|
744
|
+
pricingPlanScheduleId: n,
|
|
745
|
+
pricingItems: a
|
|
746
|
+
}), m = u(
|
|
747
|
+
() => s.value && !l.value ? o({
|
|
748
|
+
defaultMessage: "Unable to calculate the total. Please try again.",
|
|
749
|
+
description: "Shown in place of the top-up total when it failed to load",
|
|
750
|
+
id: "topup_modal.invoice_preview.error"
|
|
751
|
+
}) : void 0
|
|
752
|
+
);
|
|
753
|
+
return (h, M) => m.value ? (b(), x(r(me), {
|
|
754
|
+
key: 0,
|
|
755
|
+
class: "sv-top-up-invoice-preview sv-top-up-invoice-preview--error sv-error",
|
|
756
|
+
title: m.value
|
|
757
|
+
}, null, 8, ["title"])) : (b(), x(lt, {
|
|
758
|
+
key: 1,
|
|
759
|
+
class: "sv-top-up-invoice-preview h-[152px]"
|
|
760
|
+
}, {
|
|
761
|
+
default: y(() => [
|
|
762
|
+
r(i) ? (b(), V("div", {
|
|
763
|
+
key: 0,
|
|
764
|
+
class: $e({ "opacity-60": r(l) }),
|
|
765
|
+
"aria-busy": r(l)
|
|
766
|
+
}, [
|
|
767
|
+
E(r(ao), { required: "" }, {
|
|
768
|
+
default: y(() => [
|
|
769
|
+
q(R(r(o)({
|
|
770
|
+
defaultMessage: "You will pay",
|
|
771
|
+
description: "Label above the preview of what topping up will be invoiced for",
|
|
772
|
+
id: "topup_modal.invoice_preview.label"
|
|
773
|
+
})), 1)
|
|
774
|
+
]),
|
|
775
|
+
_: 1
|
|
776
|
+
}),
|
|
777
|
+
E(r(be), { "content-background": "none" }, {
|
|
778
|
+
default: y(() => [
|
|
779
|
+
E(r(pt), {
|
|
780
|
+
invoice: r(i),
|
|
781
|
+
"is-customer-facing": ""
|
|
782
|
+
}, null, 8, ["invoice"])
|
|
783
|
+
]),
|
|
784
|
+
_: 1
|
|
785
|
+
})
|
|
786
|
+
], 10, jo)) : D("", !0)
|
|
787
|
+
]),
|
|
788
|
+
_: 1
|
|
789
|
+
}));
|
|
790
|
+
}
|
|
791
|
+
}), At = (e, t) => e.currency ?? t ?? e.creditTypeId ?? "", Ge = (e, t) => ({
|
|
792
|
+
quantity: e ?? null,
|
|
793
|
+
currency: t
|
|
794
|
+
}), Ee = (e, { denomination: t, chargeCurrency: o, creditUnitName: n, minimumTopUp: a }) => {
|
|
795
|
+
var i, l, s, m, h;
|
|
796
|
+
return {
|
|
797
|
+
enabled: (e == null ? void 0 : e.status) === "ACTIVE",
|
|
798
|
+
threshold: Ge(
|
|
799
|
+
((l = (i = e == null ? void 0 : e.threshold) == null ? void 0 : i.amount) == null ? void 0 : l.quantity) ?? ((m = (s = e == null ? void 0 : e.threshold) == null ? void 0 : s.credits) == null ? void 0 : m.quantity),
|
|
800
|
+
At(t, n)
|
|
801
|
+
),
|
|
802
|
+
topUpAmount: Ge(((h = e == null ? void 0 : e.topup_amount) == null ? void 0 : h.quantity) ?? a, o)
|
|
803
|
+
};
|
|
804
|
+
}, Qo = (e, t) => {
|
|
805
|
+
var n;
|
|
806
|
+
const o = (n = e.threshold) == null ? void 0 : n.quantity;
|
|
807
|
+
return o ? t.creditTypeId ? { credits: { quantity: o, credit_type_id: t.creditTypeId } } : { amount: { quantity: o, currency: t.currency ?? "" } } : {};
|
|
808
|
+
}, Ke = (e, t) => {
|
|
809
|
+
var o;
|
|
810
|
+
return (o = e.topUpAmount) != null && o.quantity ? {
|
|
811
|
+
quantity: e.topUpAmount.quantity,
|
|
812
|
+
currency: e.topUpAmount.currency ?? t
|
|
813
|
+
} : void 0;
|
|
814
|
+
}, Ut = (e, { denomination: t, chargeCurrency: o }) => ({
|
|
815
|
+
status: e.enabled ? "ACTIVE" : "INACTIVE",
|
|
816
|
+
threshold: Qo(e, t),
|
|
817
|
+
...Ke(e, o) && {
|
|
818
|
+
topup_amount: Ke(e, o)
|
|
819
|
+
}
|
|
820
|
+
}), Xe = (e, t) => Ut(Ee(e, t), t), Je = (e, t) => JSON.stringify(e) === JSON.stringify(t), St = (e, t) => {
|
|
821
|
+
const o = Number(t == null ? void 0 : t.quantity);
|
|
822
|
+
return e === null || !(t != null && t.quantity) || !Number.isFinite(o) || e >= o;
|
|
823
|
+
}, Pt = (e, t) => {
|
|
824
|
+
const o = Number(t == null ? void 0 : t.quantity);
|
|
825
|
+
return e === null || !(t != null && t.quantity) || !Number.isFinite(o) || e <= o;
|
|
826
|
+
}, se = (e) => {
|
|
827
|
+
const t = Number(e);
|
|
828
|
+
return e != null && e !== "" && Number.isFinite(t) ? t : void 0;
|
|
829
|
+
}, qe = (e, t, o) => {
|
|
830
|
+
const n = se(e), a = se(o);
|
|
831
|
+
if (!(n === void 0 || a === void 0 || a <= 0))
|
|
832
|
+
return t === "CREDITS" ? n / a : n * a;
|
|
833
|
+
}, Ze = (e, t, o, n) => t === o ? se(e) : qe(e, t, n), Go = (e, t, o) => t === "CREDITS" ? qe(e, "AMOUNT", o) : se(e), Ve = (e, t) => e.toFixed(ro(t)), et = (e, t, o) => t === "AMOUNT" ? Ve(e, o) : String(Number(e.toFixed(6))), Ct = (e, t, o, n) => {
|
|
834
|
+
const a = Go(e == null ? void 0 : e.quantity, t, o);
|
|
835
|
+
if (a !== void 0)
|
|
836
|
+
return t === "CREDITS" ? n(a) : Ve(a, e == null ? void 0 : e.currency);
|
|
837
|
+
}, xe = /* @__PURE__ */ Y({
|
|
838
|
+
__name: "ConvertedAmountInput",
|
|
839
|
+
props: /* @__PURE__ */ Wt({
|
|
840
|
+
unit: { type: String },
|
|
841
|
+
modelBase: { type: String },
|
|
842
|
+
entryBase: { type: String },
|
|
843
|
+
conversionRate: { type: String },
|
|
844
|
+
showConversionHint: { type: Boolean },
|
|
845
|
+
currency: { type: String },
|
|
846
|
+
creditUnitName: { type: String },
|
|
847
|
+
bounds: { type: Object },
|
|
848
|
+
label: { type: String },
|
|
849
|
+
name: { type: String },
|
|
850
|
+
required: { type: Boolean },
|
|
851
|
+
disabled: { type: Boolean },
|
|
852
|
+
error: { type: [String, Object, Array] }
|
|
853
|
+
}, {
|
|
854
|
+
modelValue: { default: "" },
|
|
855
|
+
modelModifiers: {}
|
|
856
|
+
}),
|
|
857
|
+
emits: ["update:modelValue"],
|
|
858
|
+
setup(e) {
|
|
859
|
+
const t = e, o = Yt(e, "modelValue"), { $t: n, formatNumber: a } = Q(), i = u(() => t.entryBase ?? t.modelBase), l = u(
|
|
860
|
+
() => i.value !== t.modelBase && se(t.conversionRate) !== void 0
|
|
861
|
+
), s = O("");
|
|
862
|
+
j(
|
|
863
|
+
() => [o.value, i.value, t.modelBase, t.conversionRate],
|
|
864
|
+
([p]) => {
|
|
865
|
+
if (!l.value) {
|
|
866
|
+
s.value = p ?? "";
|
|
867
|
+
return;
|
|
868
|
+
}
|
|
869
|
+
if (p === m(s.value))
|
|
870
|
+
return;
|
|
871
|
+
const S = Ze(
|
|
872
|
+
p,
|
|
873
|
+
t.modelBase,
|
|
874
|
+
i.value,
|
|
875
|
+
t.conversionRate
|
|
876
|
+
);
|
|
877
|
+
s.value = S === void 0 ? "" : et(S, i.value, t.currency);
|
|
878
|
+
},
|
|
879
|
+
{ immediate: !0 }
|
|
880
|
+
);
|
|
881
|
+
function m(p) {
|
|
882
|
+
const S = Ze(p, i.value, t.modelBase, t.conversionRate);
|
|
883
|
+
return S === void 0 ? "" : et(S, t.modelBase, t.currency);
|
|
884
|
+
}
|
|
885
|
+
const h = u({
|
|
886
|
+
get: () => s.value,
|
|
887
|
+
set: (p) => {
|
|
888
|
+
s.value = oo(p), o.value = l.value ? m(s.value) : s.value;
|
|
889
|
+
}
|
|
890
|
+
}), M = u(
|
|
891
|
+
() => qe(s.value, i.value, t.conversionRate)
|
|
892
|
+
), A = u(() => t.creditUnitName ? t.creditUnitName : i.value === "CREDITS" ? t.unit : n({
|
|
893
|
+
defaultMessage: "credits",
|
|
894
|
+
description: "Generic name for a wallet credit, where its credit type does not name one",
|
|
895
|
+
id: "converted_amount_input.credits"
|
|
896
|
+
})), c = (p, S) => Ne({ quantity: Ve(p, S), currency: S }), w = (p) => `${a(p)} ${A.value}`, P = u(() => {
|
|
897
|
+
const p = t.error;
|
|
898
|
+
return Array.isArray(p) ? p.length > 0 : !!(Ht(p) ? p.value : p);
|
|
899
|
+
}), g = u(() => {
|
|
900
|
+
const p = M.value;
|
|
901
|
+
if (!(P.value || !t.showConversionHint || p === void 0))
|
|
902
|
+
return i.value === "CREDITS" ? t.currency ? n(
|
|
903
|
+
{
|
|
904
|
+
defaultMessage: "Will cost {amount} excluding taxes",
|
|
905
|
+
description: "Helper text under a credits field, naming what those credits cost in money",
|
|
906
|
+
id: "converted_amount_input.cost"
|
|
907
|
+
},
|
|
908
|
+
{ amount: c(p, t.currency) }
|
|
909
|
+
) : void 0 : n(
|
|
910
|
+
{
|
|
911
|
+
defaultMessage: "Buys about {credits}",
|
|
912
|
+
description: "Helper text under a money field, naming the credits that amount converts into",
|
|
913
|
+
id: "converted_amount_input.buys"
|
|
914
|
+
},
|
|
915
|
+
{ credits: w(p) }
|
|
916
|
+
);
|
|
917
|
+
}), C = (p) => Ct(p, i.value, t.conversionRate, a), G = u(
|
|
918
|
+
() => {
|
|
919
|
+
var p, S, I, f;
|
|
920
|
+
return i.value === "CREDITS" ? A.value : ((S = (p = t.bounds) == null ? void 0 : p.minimum) == null ? void 0 : S.currency) ?? ((f = (I = t.bounds) == null ? void 0 : I.maximum) == null ? void 0 : f.currency) ?? t.unit;
|
|
921
|
+
}
|
|
922
|
+
), _ = u(() => {
|
|
923
|
+
var f, U;
|
|
924
|
+
const p = C((f = t.bounds) == null ? void 0 : f.minimum), S = C((U = t.bounds) == null ? void 0 : U.maximum), I = G.value;
|
|
925
|
+
if (p && S)
|
|
926
|
+
return n(
|
|
927
|
+
{
|
|
928
|
+
defaultMessage: "Between {minimum} and {maximum} {unit}",
|
|
929
|
+
description: "Range of what a flexible top-up may be charged for, beside its label",
|
|
930
|
+
id: "converted_amount_input.bounds.range"
|
|
931
|
+
},
|
|
932
|
+
{ minimum: p, maximum: S, unit: I }
|
|
933
|
+
);
|
|
934
|
+
if (p)
|
|
935
|
+
return n(
|
|
936
|
+
{
|
|
937
|
+
defaultMessage: "At least {minimum} {unit}",
|
|
938
|
+
description: "Smallest amount a flexible top-up may be charged for, beside its label",
|
|
939
|
+
id: "converted_amount_input.bounds.minimum"
|
|
940
|
+
},
|
|
941
|
+
{ minimum: p, unit: I }
|
|
942
|
+
);
|
|
943
|
+
if (S)
|
|
944
|
+
return n(
|
|
945
|
+
{
|
|
946
|
+
defaultMessage: "Up to {maximum} {unit}",
|
|
947
|
+
description: "Largest amount a flexible top-up may be charged for, beside its label",
|
|
948
|
+
id: "converted_amount_input.bounds.maximum"
|
|
949
|
+
},
|
|
950
|
+
{ maximum: S, unit: I }
|
|
951
|
+
);
|
|
952
|
+
});
|
|
953
|
+
return (p, S) => (b(), x(r(uo), ae({
|
|
954
|
+
modelValue: h.value,
|
|
955
|
+
"onUpdate:modelValue": S[0] || (S[0] = (I) => h.value = I),
|
|
956
|
+
class: "sv-converted-amount-input",
|
|
957
|
+
type: "number",
|
|
958
|
+
"as-text-type": "",
|
|
959
|
+
name: e.name,
|
|
960
|
+
label: e.label,
|
|
961
|
+
required: e.required,
|
|
962
|
+
disabled: e.disabled,
|
|
963
|
+
error: e.error
|
|
964
|
+
}, P.value ? { "aria-invalid": "true" } : {}), re({
|
|
965
|
+
suffix: y(() => [
|
|
966
|
+
N("span", null, R(e.unit), 1)
|
|
967
|
+
]),
|
|
968
|
+
_: 2
|
|
969
|
+
}, [
|
|
970
|
+
_.value ? {
|
|
971
|
+
name: "label-suffix",
|
|
972
|
+
fn: y(() => [
|
|
973
|
+
E(r(ee), {
|
|
974
|
+
tag: "span",
|
|
975
|
+
variant: "body-xs",
|
|
976
|
+
color: "subtle",
|
|
977
|
+
"no-spacing": ""
|
|
978
|
+
}, {
|
|
979
|
+
default: y(() => [
|
|
980
|
+
q(R(_.value), 1)
|
|
981
|
+
]),
|
|
982
|
+
_: 1
|
|
983
|
+
})
|
|
984
|
+
]),
|
|
985
|
+
key: "0"
|
|
986
|
+
} : void 0,
|
|
987
|
+
g.value ? {
|
|
988
|
+
name: "helper",
|
|
989
|
+
fn: y(() => [
|
|
990
|
+
E(r(ee), {
|
|
991
|
+
tag: "span",
|
|
992
|
+
variant: "body-xs",
|
|
993
|
+
color: "subtle",
|
|
994
|
+
"no-spacing": ""
|
|
995
|
+
}, {
|
|
996
|
+
default: y(() => [
|
|
997
|
+
q(R(g.value), 1)
|
|
998
|
+
]),
|
|
999
|
+
_: 1
|
|
1000
|
+
})
|
|
1001
|
+
]),
|
|
1002
|
+
key: "1"
|
|
1003
|
+
} : void 0
|
|
1004
|
+
]), 1040, ["modelValue", "name", "label", "required", "disabled", "error"]));
|
|
1005
|
+
}
|
|
1006
|
+
}), Ko = /* @__PURE__ */ Y({
|
|
1007
|
+
__name: "Section",
|
|
1008
|
+
props: {
|
|
1009
|
+
emphasized: { type: Boolean, default: !1 },
|
|
1010
|
+
contentClasses: { type: String },
|
|
1011
|
+
contentBackground: { type: String },
|
|
1012
|
+
title: { type: String },
|
|
1013
|
+
noSpacing: { type: Boolean },
|
|
1014
|
+
hasError: { type: Boolean },
|
|
1015
|
+
noBorder: { type: Boolean }
|
|
1016
|
+
},
|
|
1017
|
+
setup(e) {
|
|
1018
|
+
const t = e, o = [
|
|
1019
|
+
"sv-section__accent relative",
|
|
1020
|
+
"before:absolute before:inset-y-0.5 before:left-0.5 before:w-0.5",
|
|
1021
|
+
"before:rounded-full before:bg-primary-600"
|
|
1022
|
+
].join(" "), n = u(
|
|
1023
|
+
() => [t.emphasized ? o : void 0, t.contentClasses].filter(Boolean).join(" ")
|
|
1024
|
+
), a = u(() => {
|
|
1025
|
+
const { emphasized: i, ...l } = t;
|
|
1026
|
+
return l;
|
|
1027
|
+
});
|
|
1028
|
+
return (i, l) => (b(), x(r(be), ae(a.value, {
|
|
1029
|
+
class: "sv-section",
|
|
1030
|
+
"content-classes": n.value
|
|
1031
|
+
}), re({
|
|
1032
|
+
default: y(() => [
|
|
1033
|
+
ue(i.$slots, "default")
|
|
1034
|
+
]),
|
|
1035
|
+
_: 2
|
|
1036
|
+
}, [
|
|
1037
|
+
i.$slots.right ? {
|
|
1038
|
+
name: "right",
|
|
1039
|
+
fn: y(() => [
|
|
1040
|
+
ue(i.$slots, "right")
|
|
1041
|
+
]),
|
|
1042
|
+
key: "0"
|
|
1043
|
+
} : void 0
|
|
1044
|
+
]), 1040, ["content-classes"]));
|
|
1045
|
+
}
|
|
1046
|
+
}), Xo = { class: "flex grow flex-col" }, Et = /* @__PURE__ */ Y({
|
|
1047
|
+
__name: "AutoTopUpConfig",
|
|
1048
|
+
props: {
|
|
1049
|
+
config: { type: Object },
|
|
1050
|
+
denomination: { type: Object },
|
|
1051
|
+
creditUnitName: { type: String },
|
|
1052
|
+
chargeCurrency: { type: String },
|
|
1053
|
+
conversionRate: { type: String },
|
|
1054
|
+
topUpBounds: { type: Object },
|
|
1055
|
+
showThresholdConversion: { type: Boolean, default: !0 },
|
|
1056
|
+
contained: { type: Boolean },
|
|
1057
|
+
alwaysEnabled: { type: Boolean },
|
|
1058
|
+
disabled: { type: Boolean }
|
|
1059
|
+
},
|
|
1060
|
+
setup(e, { expose: t }) {
|
|
1061
|
+
const o = e, { $t: n, formatNumber: a } = Q(), i = u(() => {
|
|
1062
|
+
var f, U;
|
|
1063
|
+
return {
|
|
1064
|
+
denomination: o.denomination,
|
|
1065
|
+
chargeCurrency: o.chargeCurrency,
|
|
1066
|
+
creditUnitName: o.creditUnitName,
|
|
1067
|
+
minimumTopUp: (U = (f = o.topUpBounds) == null ? void 0 : f.minimum) == null ? void 0 : U.quantity
|
|
1068
|
+
};
|
|
1069
|
+
}), l = O(Ee(o.config, i.value)), s = u(() => At(o.denomination, o.creditUnitName)), m = u(
|
|
1070
|
+
() => o.denomination.creditTypeId ? "CREDITS" : "AMOUNT"
|
|
1071
|
+
), h = u(
|
|
1072
|
+
() => m.value === "CREDITS" ? s.value : o.chargeCurrency
|
|
1073
|
+
), M = u({
|
|
1074
|
+
get: () => {
|
|
1075
|
+
var f;
|
|
1076
|
+
return ((f = l.value.threshold) == null ? void 0 : f.quantity) ?? "";
|
|
1077
|
+
},
|
|
1078
|
+
set: (f) => {
|
|
1079
|
+
l.value.threshold = { quantity: f || null, currency: s.value };
|
|
1080
|
+
}
|
|
1081
|
+
}), A = u({
|
|
1082
|
+
get: () => {
|
|
1083
|
+
var f;
|
|
1084
|
+
return ((f = l.value.topUpAmount) == null ? void 0 : f.quantity) ?? "";
|
|
1085
|
+
},
|
|
1086
|
+
set: (f) => {
|
|
1087
|
+
l.value.topUpAmount = { quantity: f || null, currency: o.chargeCurrency };
|
|
1088
|
+
}
|
|
1089
|
+
});
|
|
1090
|
+
j(
|
|
1091
|
+
() => [o.config, i.value],
|
|
1092
|
+
([f, U]) => {
|
|
1093
|
+
Je(Xe(f, U), P()) || (l.value = Ee(f, U));
|
|
1094
|
+
}
|
|
1095
|
+
);
|
|
1096
|
+
const c = u({
|
|
1097
|
+
get: () => o.alwaysEnabled || l.value.enabled,
|
|
1098
|
+
set: (f) => {
|
|
1099
|
+
l.value.enabled = f;
|
|
1100
|
+
}
|
|
1101
|
+
}), w = u(
|
|
1102
|
+
() => Ut({ ...l.value, enabled: c.value }, i.value)
|
|
1103
|
+
), P = () => w.value, g = Ie({
|
|
1104
|
+
threshold: u(() => {
|
|
1105
|
+
var f;
|
|
1106
|
+
return se((f = l.value.threshold) == null ? void 0 : f.quantity) ?? null;
|
|
1107
|
+
}),
|
|
1108
|
+
topUpAmount: u(() => {
|
|
1109
|
+
var f;
|
|
1110
|
+
return se((f = l.value.topUpAmount) == null ? void 0 : f.quantity) ?? null;
|
|
1111
|
+
})
|
|
1112
|
+
}), C = (f) => {
|
|
1113
|
+
if (!f)
|
|
1114
|
+
return "";
|
|
1115
|
+
const U = Ct(f, m.value, o.conversionRate, a);
|
|
1116
|
+
return U === void 0 ? Ne(f) : `${U} ${h.value}`;
|
|
1117
|
+
}, G = rt(() => c.value), _ = (f) => (U) => !c.value || f(U), p = De(
|
|
1118
|
+
{
|
|
1119
|
+
threshold: {
|
|
1120
|
+
required: J.withMessage(
|
|
1121
|
+
() => n({
|
|
1122
|
+
defaultMessage: "Enter the balance to top up at.",
|
|
1123
|
+
description: "Error shown under the auto top-up threshold when it is left empty",
|
|
1124
|
+
id: "auto_topup_config.threshold.required"
|
|
1125
|
+
}),
|
|
1126
|
+
G
|
|
1127
|
+
),
|
|
1128
|
+
notNegative: J.withMessage(
|
|
1129
|
+
() => n({
|
|
1130
|
+
defaultMessage: "The balance to top up at cannot be negative.",
|
|
1131
|
+
description: "Error shown under the auto top-up threshold when it is below zero",
|
|
1132
|
+
id: "auto_topup_config.threshold.not_negative"
|
|
1133
|
+
}),
|
|
1134
|
+
_((f) => f === null || f >= 0)
|
|
1135
|
+
)
|
|
1136
|
+
},
|
|
1137
|
+
topUpAmount: {
|
|
1138
|
+
required: J.withMessage(
|
|
1139
|
+
() => n({
|
|
1140
|
+
defaultMessage: "Enter the amount to top up with.",
|
|
1141
|
+
description: "Error shown under the auto top-up amount when it is left empty",
|
|
1142
|
+
id: "auto_topup_config.amount.required"
|
|
1143
|
+
}),
|
|
1144
|
+
G
|
|
1145
|
+
),
|
|
1146
|
+
positive: J.withMessage(
|
|
1147
|
+
() => n({
|
|
1148
|
+
defaultMessage: "Top up with more than zero.",
|
|
1149
|
+
description: "Error shown under the auto top-up amount when it is zero or negative",
|
|
1150
|
+
id: "auto_topup_config.amount.positive"
|
|
1151
|
+
}),
|
|
1152
|
+
_((f) => f === null || f > 0)
|
|
1153
|
+
),
|
|
1154
|
+
atLeastMinimum: J.withMessage(
|
|
1155
|
+
() => {
|
|
1156
|
+
var f;
|
|
1157
|
+
return n(
|
|
1158
|
+
{
|
|
1159
|
+
defaultMessage: "Top up with at least {minimum}.",
|
|
1160
|
+
description: "Error shown under the auto top-up amount when it is below what the pricing allows",
|
|
1161
|
+
id: "auto_topup_config.amount.at_least_minimum"
|
|
1162
|
+
},
|
|
1163
|
+
{ minimum: C((f = o.topUpBounds) == null ? void 0 : f.minimum) }
|
|
1164
|
+
);
|
|
1165
|
+
},
|
|
1166
|
+
_((f) => {
|
|
1167
|
+
var U;
|
|
1168
|
+
return St(f, (U = o.topUpBounds) == null ? void 0 : U.minimum);
|
|
1169
|
+
})
|
|
1170
|
+
),
|
|
1171
|
+
withinMaximum: J.withMessage(
|
|
1172
|
+
() => {
|
|
1173
|
+
var f;
|
|
1174
|
+
return n(
|
|
1175
|
+
{
|
|
1176
|
+
defaultMessage: "Top up with at most {maximum}.",
|
|
1177
|
+
description: "Error shown under the auto top-up amount when it is above what the pricing allows",
|
|
1178
|
+
id: "auto_topup_config.amount.within_maximum"
|
|
1179
|
+
},
|
|
1180
|
+
{ maximum: C((f = o.topUpBounds) == null ? void 0 : f.maximum) }
|
|
1181
|
+
);
|
|
1182
|
+
},
|
|
1183
|
+
_((f) => {
|
|
1184
|
+
var U;
|
|
1185
|
+
return Pt(f, (U = o.topUpBounds) == null ? void 0 : U.maximum);
|
|
1186
|
+
})
|
|
1187
|
+
)
|
|
1188
|
+
}
|
|
1189
|
+
},
|
|
1190
|
+
g
|
|
1191
|
+
), S = u(
|
|
1192
|
+
() => !Je(
|
|
1193
|
+
P(),
|
|
1194
|
+
Xe(o.config, i.value)
|
|
1195
|
+
)
|
|
1196
|
+
);
|
|
1197
|
+
function I() {
|
|
1198
|
+
return p.value.$touch(), p.value.$invalid ? void 0 : P();
|
|
1199
|
+
}
|
|
1200
|
+
return t({
|
|
1201
|
+
validate: I,
|
|
1202
|
+
rule: w,
|
|
1203
|
+
hasChanges: S,
|
|
1204
|
+
isInvalid: u(() => p.value.$invalid)
|
|
1205
|
+
}), (f, U) => (b(), x(Ko, {
|
|
1206
|
+
class: "sv-auto-topup-config",
|
|
1207
|
+
"content-background": e.contained ? "gray" : "none",
|
|
1208
|
+
"no-spacing": !e.contained,
|
|
1209
|
+
"no-border": !e.contained
|
|
1210
|
+
}, {
|
|
1211
|
+
default: y(() => [
|
|
1212
|
+
e.alwaysEnabled ? D("", !0) : (b(), x(r(so), {
|
|
1213
|
+
key: 0,
|
|
1214
|
+
modelValue: c.value,
|
|
1215
|
+
"onUpdate:modelValue": U[0] || (U[0] = (K) => c.value = K),
|
|
1216
|
+
"no-spacing": "",
|
|
1217
|
+
"label-position": "before",
|
|
1218
|
+
class: "!flex",
|
|
1219
|
+
disabled: e.disabled
|
|
1220
|
+
}, {
|
|
1221
|
+
"inline-label": y(() => [
|
|
1222
|
+
N("div", Xo, [
|
|
1223
|
+
E(r(ee), {
|
|
1224
|
+
tag: "span",
|
|
1225
|
+
variant: "body-sm"
|
|
1226
|
+
}, {
|
|
1227
|
+
default: y(() => [
|
|
1228
|
+
q(R(r(n)({
|
|
1229
|
+
defaultMessage: "Auto top-up",
|
|
1230
|
+
description: "Title of the automatic wallet top-up settings",
|
|
1231
|
+
id: "auto_topup_config.title"
|
|
1232
|
+
})), 1)
|
|
1233
|
+
]),
|
|
1234
|
+
_: 1
|
|
1235
|
+
}),
|
|
1236
|
+
E(r(ee), {
|
|
1237
|
+
tag: "span",
|
|
1238
|
+
variant: "body-xs",
|
|
1239
|
+
color: "subtle"
|
|
1240
|
+
}, {
|
|
1241
|
+
default: y(() => [
|
|
1242
|
+
q(R(r(n)({
|
|
1243
|
+
defaultMessage: "Automatically top up your balance when it runs low.",
|
|
1244
|
+
description: "Subtitle of the automatic wallet top-up settings",
|
|
1245
|
+
id: "auto_topup_config.subtitle"
|
|
1246
|
+
})), 1)
|
|
1247
|
+
]),
|
|
1248
|
+
_: 1
|
|
1249
|
+
})
|
|
1250
|
+
])
|
|
1251
|
+
]),
|
|
1252
|
+
_: 1
|
|
1253
|
+
}, 8, ["modelValue", "disabled"])),
|
|
1254
|
+
E(r(ct), { "is-open": c.value }, {
|
|
1255
|
+
default: y(() => [
|
|
1256
|
+
c.value ? (b(), V("div", {
|
|
1257
|
+
key: 0,
|
|
1258
|
+
class: $e(["grid grid-cols-1 gap-3", { "mt-4": !e.alwaysEnabled }])
|
|
1259
|
+
}, [
|
|
1260
|
+
E(xe, {
|
|
1261
|
+
modelValue: M.value,
|
|
1262
|
+
"onUpdate:modelValue": U[1] || (U[1] = (K) => M.value = K),
|
|
1263
|
+
name: "auto-top-up-threshold",
|
|
1264
|
+
unit: s.value,
|
|
1265
|
+
"model-base": m.value,
|
|
1266
|
+
"entry-base": m.value,
|
|
1267
|
+
currency: e.chargeCurrency,
|
|
1268
|
+
"conversion-rate": e.conversionRate,
|
|
1269
|
+
"show-conversion-hint": e.showThresholdConversion,
|
|
1270
|
+
required: "",
|
|
1271
|
+
disabled: e.disabled,
|
|
1272
|
+
error: r(p).threshold.$errors,
|
|
1273
|
+
label: r(n)({
|
|
1274
|
+
defaultMessage: "When your balance falls below",
|
|
1275
|
+
description: "Label of the balance at which an automatic top-up is charged",
|
|
1276
|
+
id: "auto_topup_config.threshold.label"
|
|
1277
|
+
})
|
|
1278
|
+
}, null, 8, ["modelValue", "unit", "model-base", "entry-base", "currency", "conversion-rate", "show-conversion-hint", "disabled", "error", "label"]),
|
|
1279
|
+
E(xe, {
|
|
1280
|
+
modelValue: A.value,
|
|
1281
|
+
"onUpdate:modelValue": U[2] || (U[2] = (K) => A.value = K),
|
|
1282
|
+
name: "auto-top-up-amount",
|
|
1283
|
+
unit: h.value,
|
|
1284
|
+
"model-base": "AMOUNT",
|
|
1285
|
+
"entry-base": m.value,
|
|
1286
|
+
currency: e.chargeCurrency,
|
|
1287
|
+
"credit-unit-name": e.creditUnitName,
|
|
1288
|
+
"conversion-rate": e.conversionRate,
|
|
1289
|
+
bounds: e.topUpBounds,
|
|
1290
|
+
"show-conversion-hint": "",
|
|
1291
|
+
required: "",
|
|
1292
|
+
disabled: e.disabled,
|
|
1293
|
+
error: r(p).topUpAmount.$errors,
|
|
1294
|
+
label: r(n)({
|
|
1295
|
+
defaultMessage: "Top-up with",
|
|
1296
|
+
description: "Label of the amount every automatic top-up adds",
|
|
1297
|
+
id: "auto_topup_config.amount.label"
|
|
1298
|
+
})
|
|
1299
|
+
}, null, 8, ["modelValue", "unit", "entry-base", "currency", "credit-unit-name", "conversion-rate", "bounds", "disabled", "error", "label"])
|
|
1300
|
+
], 2)) : D("", !0)
|
|
1301
|
+
]),
|
|
1302
|
+
_: 1
|
|
1303
|
+
}, 8, ["is-open"])
|
|
1304
|
+
]),
|
|
1305
|
+
_: 1
|
|
1306
|
+
}, 8, ["content-background", "no-spacing", "no-border"]));
|
|
1307
|
+
}
|
|
1308
|
+
}), tt = (e) => {
|
|
1309
|
+
const t = Date.parse(e ?? "");
|
|
1310
|
+
return Number.isFinite(t) ? t : 0;
|
|
1311
|
+
};
|
|
1312
|
+
function xt({
|
|
1313
|
+
paymentMethods: e,
|
|
1314
|
+
selectedPaymentMethodId: t,
|
|
1315
|
+
preferredPaymentMethodId: o
|
|
1316
|
+
}) {
|
|
1317
|
+
const n = u(
|
|
1318
|
+
() => [...e.value ?? []].sort(
|
|
1319
|
+
(a, i) => tt(i.created_at) - tt(a.created_at)
|
|
1320
|
+
)
|
|
1321
|
+
);
|
|
1322
|
+
return j(
|
|
1323
|
+
() => [
|
|
1324
|
+
e.value,
|
|
1325
|
+
o == null ? void 0 : o.value,
|
|
1326
|
+
t.value
|
|
1327
|
+
],
|
|
1328
|
+
([a, i, l], s) => {
|
|
1329
|
+
var A;
|
|
1330
|
+
const m = s == null ? void 0 : s[0], h = a == null ? void 0 : a.find(
|
|
1331
|
+
({ id: c }) => !(m != null && m.some((w) => w.id === c))
|
|
1332
|
+
);
|
|
1333
|
+
if (h && (m != null && m.length)) {
|
|
1334
|
+
t.value = h.id;
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
const M = (c) => !!c && !!(a != null && a.some((w) => w.id === c));
|
|
1338
|
+
M(l) || (t.value = M(i) ? i : (A = (a == null ? void 0 : a.find(({ is_default: c }) => c)) ?? n.value[0]) == null ? void 0 : A.id);
|
|
1339
|
+
},
|
|
1340
|
+
{ immediate: !0 }
|
|
1341
|
+
), { sortedPaymentMethods: n };
|
|
1342
|
+
}
|
|
1343
|
+
function Ue() {
|
|
1344
|
+
const { $t: e, formatNumber: t } = Q(), o = (a) => Be(e, t, a);
|
|
1345
|
+
return { formatValue: o, formatOpenBalance: (a) => o(a == null ? void 0 : a.wallet_balance.open_balance) };
|
|
1346
|
+
}
|
|
1347
|
+
const Jo = { class: "sv-top-up-form" }, Zo = { class: "grid grid-cols-1 gap-4" }, en = { class: "grid grid-cols-1 gap-1" }, tn = { class: "sv-top-up-form__option-details" }, on = { key: 0 }, nn = /* @__PURE__ */ Y({
|
|
1348
|
+
__name: "TopUpModalForm",
|
|
1349
|
+
props: {
|
|
1350
|
+
topUpPricingItems: { type: null },
|
|
1351
|
+
paymentMethods: { type: Array },
|
|
1352
|
+
paymentMethodOptions: { type: Array },
|
|
1353
|
+
autoTopUpConfig: { type: Object }
|
|
1354
|
+
},
|
|
1355
|
+
emits: ["add-payment-method", "success", "save-auto-top-up", "failure"],
|
|
1356
|
+
setup(e, { expose: t, emit: o }) {
|
|
1357
|
+
const n = e, a = o, { $t: i } = Q(), { formatValue: l } = Ue(), s = O({
|
|
1358
|
+
pricing_plan_schedule_id: "",
|
|
1359
|
+
pricing_items: [],
|
|
1360
|
+
start_at: "",
|
|
1361
|
+
finalize_immediately: !1,
|
|
1362
|
+
payment_method_id: void 0,
|
|
1363
|
+
preview: !0
|
|
1364
|
+
}), m = u(() => {
|
|
1365
|
+
const d = (n.topUpPricingItems ?? []).filter(
|
|
1366
|
+
(v) => v.flexiblePricing || v.fixedPricing
|
|
1367
|
+
);
|
|
1368
|
+
return [
|
|
1369
|
+
...d.filter(({ flexiblePricing: v }) => v),
|
|
1370
|
+
...d.filter(({ flexiblePricing: v }) => !v)
|
|
1371
|
+
];
|
|
1372
|
+
}), h = (d) => m.value.find((v) => v.pricingItemId === d), M = (d) => {
|
|
1373
|
+
const { config: v, currency: T } = d.flexiblePricing ?? {}, B = v == null ? void 0 : v.minimum_amount;
|
|
1374
|
+
return B && T ? { quantity: B.quantity, currency: T } : void 0;
|
|
1375
|
+
}, A = u({
|
|
1376
|
+
get: () => {
|
|
1377
|
+
var d;
|
|
1378
|
+
return (d = s.value.pricing_items[0]) == null ? void 0 : d.pricing_item_id;
|
|
1379
|
+
},
|
|
1380
|
+
set: (d) => {
|
|
1381
|
+
const v = h(typeof d == "string" ? d : void 0);
|
|
1382
|
+
if (!v) {
|
|
1383
|
+
s.value.pricing_items = [];
|
|
1384
|
+
return;
|
|
1385
|
+
}
|
|
1386
|
+
const T = M(v);
|
|
1387
|
+
s.value.pricing_items = [
|
|
1388
|
+
{
|
|
1389
|
+
pricing_item_id: v.pricingItemId,
|
|
1390
|
+
...T && { flexible_amount: T }
|
|
1391
|
+
}
|
|
1392
|
+
];
|
|
1393
|
+
}
|
|
1394
|
+
});
|
|
1395
|
+
j(
|
|
1396
|
+
m,
|
|
1397
|
+
(d) => {
|
|
1398
|
+
if (d.some(
|
|
1399
|
+
({ pricingItemId: B }) => {
|
|
1400
|
+
var L;
|
|
1401
|
+
return B === ((L = s.value.pricing_items[0]) == null ? void 0 : L.pricing_item_id);
|
|
1402
|
+
}
|
|
1403
|
+
))
|
|
1404
|
+
return;
|
|
1405
|
+
const T = d.find(({ flexiblePricing: B }) => B) ?? d[0];
|
|
1406
|
+
A.value = T == null ? void 0 : T.pricingItemId;
|
|
1407
|
+
},
|
|
1408
|
+
{ immediate: !0 }
|
|
1409
|
+
);
|
|
1410
|
+
const c = u(
|
|
1411
|
+
() => {
|
|
1412
|
+
var d, v;
|
|
1413
|
+
return (v = h((d = s.value.pricing_items[0]) == null ? void 0 : d.pricing_item_id)) == null ? void 0 : v.pricingPlanScheduleId;
|
|
1414
|
+
}
|
|
1415
|
+
);
|
|
1416
|
+
j(
|
|
1417
|
+
c,
|
|
1418
|
+
(d) => {
|
|
1419
|
+
s.value.pricing_plan_schedule_id = d ?? "";
|
|
1420
|
+
},
|
|
1421
|
+
{ immediate: !0 }
|
|
1422
|
+
);
|
|
1423
|
+
const w = u({
|
|
1424
|
+
get: () => {
|
|
1425
|
+
var d;
|
|
1426
|
+
return (d = s.value.pricing_items[0]) == null ? void 0 : d.flexible_amount;
|
|
1427
|
+
},
|
|
1428
|
+
set: (d) => {
|
|
1429
|
+
var T;
|
|
1430
|
+
const v = (T = s.value.pricing_items[0]) == null ? void 0 : T.pricing_item_id;
|
|
1431
|
+
v && (s.value.pricing_items = [
|
|
1432
|
+
{ pricing_item_id: v, ...d && { flexible_amount: d } }
|
|
1433
|
+
]);
|
|
1434
|
+
}
|
|
1435
|
+
}), P = (d) => {
|
|
1436
|
+
var T;
|
|
1437
|
+
const v = (T = h(String(d))) == null ? void 0 : T.fixedPricing;
|
|
1438
|
+
return v != null && v.value.credits ? Ne(v.amount) : void 0;
|
|
1439
|
+
}, g = u(
|
|
1440
|
+
() => {
|
|
1441
|
+
var d;
|
|
1442
|
+
return (d = h(String(A.value))) == null ? void 0 : d.flexiblePricing;
|
|
1443
|
+
}
|
|
1444
|
+
), C = u({
|
|
1445
|
+
get: () => {
|
|
1446
|
+
var d;
|
|
1447
|
+
return ((d = w.value) == null ? void 0 : d.quantity) ?? "";
|
|
1448
|
+
},
|
|
1449
|
+
set: (d) => {
|
|
1450
|
+
var T;
|
|
1451
|
+
const v = (T = g.value) == null ? void 0 : T.currency;
|
|
1452
|
+
w.value = d && v ? { quantity: d, currency: v } : void 0;
|
|
1453
|
+
}
|
|
1454
|
+
}), G = (d) => d.creditsConfiguration ? "CREDITS" : "AMOUNT", _ = u(() => wt(n.topUpPricingItems)), p = (d) => d.creditsConfiguration ? _.value ?? d.creditsConfiguration.unitNamePlural ?? d.creditsConfiguration.unitNameSingle ?? "" : d.currency, S = ({ config: d }) => ({
|
|
1455
|
+
...(d == null ? void 0 : d.minimum_amount) && { minimum: d.minimum_amount },
|
|
1456
|
+
...(d == null ? void 0 : d.maximum_amount) && { maximum: d.maximum_amount }
|
|
1457
|
+
}), I = (d) => {
|
|
1458
|
+
var T;
|
|
1459
|
+
const v = (T = h(String(d))) == null ? void 0 : T.flexiblePricing;
|
|
1460
|
+
return v ? [v] : [];
|
|
1461
|
+
}, f = u(
|
|
1462
|
+
() => m.value.map((d) => ({
|
|
1463
|
+
value: d.pricingItemId,
|
|
1464
|
+
label: d.fixedPricing ? l(d.fixedPricing.value) : i({
|
|
1465
|
+
defaultMessage: "Choose your own amount",
|
|
1466
|
+
description: "Label of the choose-your-amount option in the top-up modal",
|
|
1467
|
+
id: "topup_modal.flexible_option.label"
|
|
1468
|
+
})
|
|
1469
|
+
}))
|
|
1470
|
+
), U = u(() => {
|
|
1471
|
+
const d = s.value.pricing_items.filter(
|
|
1472
|
+
(v) => {
|
|
1473
|
+
var T;
|
|
1474
|
+
return !((T = h(v.pricing_item_id)) != null && T.flexiblePricing) || !!v.flexible_amount;
|
|
1475
|
+
}
|
|
1476
|
+
);
|
|
1477
|
+
return d.length > 0 ? d : void 0;
|
|
1478
|
+
}), K = u(() => !n.autoTopUpConfig && m.value.some(({ flexiblePricing: v }) => v) ? Tt(n.topUpPricingItems) : void 0), te = O(), { chargeOnDemandPricingItems: ve } = mt(), fe = Ae(), H = O(!1), de = u(
|
|
1479
|
+
() => !!s.value.pricing_plan_schedule_id && !!U.value && !!s.value.payment_method_id
|
|
1480
|
+
), he = Ie({
|
|
1481
|
+
paymentMethodId: u(() => s.value.payment_method_id ?? null),
|
|
1482
|
+
flexibleAmount: u(() => {
|
|
1483
|
+
var d;
|
|
1484
|
+
return se((d = w.value) == null ? void 0 : d.quantity) ?? null;
|
|
1485
|
+
})
|
|
1486
|
+
}), ce = (d) => {
|
|
1487
|
+
var T;
|
|
1488
|
+
const v = (T = g.value) == null ? void 0 : T.bounds[d];
|
|
1489
|
+
return v ? l(v) : "";
|
|
1490
|
+
}, W = De(
|
|
1491
|
+
{
|
|
1492
|
+
flexibleAmount: {
|
|
1493
|
+
required: J.withMessage(
|
|
1494
|
+
() => i({
|
|
1495
|
+
defaultMessage: "Enter the amount to top up with.",
|
|
1496
|
+
description: "Error shown under the choose-your-amount input in the top-up modal when it is left empty",
|
|
1497
|
+
id: "topup_modal.amount.required"
|
|
1498
|
+
}),
|
|
1499
|
+
rt(() => !!g.value)
|
|
1500
|
+
),
|
|
1501
|
+
positive: J.withMessage(
|
|
1502
|
+
() => i({
|
|
1503
|
+
defaultMessage: "Top up with more than zero.",
|
|
1504
|
+
description: "Error shown under the choose-your-amount input in the top-up modal when it is zero or negative",
|
|
1505
|
+
id: "topup_modal.amount.positive"
|
|
1506
|
+
}),
|
|
1507
|
+
(d) => d === null || d > 0
|
|
1508
|
+
),
|
|
1509
|
+
atLeastMinimum: J.withMessage(
|
|
1510
|
+
() => i(
|
|
1511
|
+
{
|
|
1512
|
+
defaultMessage: "Top up with at least {minimum}.",
|
|
1513
|
+
description: "Error shown under the choose-your-amount input in the top-up modal when it is below what the pricing allows",
|
|
1514
|
+
id: "topup_modal.amount.at_least_minimum"
|
|
1515
|
+
},
|
|
1516
|
+
{ minimum: ce("minimum") }
|
|
1517
|
+
),
|
|
1518
|
+
(d) => {
|
|
1519
|
+
var v, T;
|
|
1520
|
+
return St(d, (T = (v = g.value) == null ? void 0 : v.config) == null ? void 0 : T.minimum_amount);
|
|
1521
|
+
}
|
|
1522
|
+
),
|
|
1523
|
+
withinMaximum: J.withMessage(
|
|
1524
|
+
() => i(
|
|
1525
|
+
{
|
|
1526
|
+
defaultMessage: "Top up with at most {maximum}.",
|
|
1527
|
+
description: "Error shown under the choose-your-amount input in the top-up modal when it is above what the pricing allows",
|
|
1528
|
+
id: "topup_modal.amount.within_maximum"
|
|
1529
|
+
},
|
|
1530
|
+
{ maximum: ce("maximum") }
|
|
1531
|
+
),
|
|
1532
|
+
(d) => {
|
|
1533
|
+
var v, T;
|
|
1534
|
+
return Pt(d, (T = (v = g.value) == null ? void 0 : v.config) == null ? void 0 : T.maximum_amount);
|
|
1535
|
+
}
|
|
1536
|
+
)
|
|
1537
|
+
},
|
|
1538
|
+
paymentMethodId: {
|
|
1539
|
+
required: J.withMessage(
|
|
1540
|
+
() => i({
|
|
1541
|
+
defaultMessage: "Select a payment method to pay for this top-up.",
|
|
1542
|
+
description: "Error shown under the payment methods in the top-up modal when none is selected on submit",
|
|
1543
|
+
id: "topup_modal.payment_method_required"
|
|
1544
|
+
}),
|
|
1545
|
+
dt
|
|
1546
|
+
)
|
|
1547
|
+
}
|
|
1548
|
+
},
|
|
1549
|
+
he
|
|
1550
|
+
), ne = u(() => {
|
|
1551
|
+
const [d] = s.value.pricing_items, v = h(d == null ? void 0 : d.pricing_item_id);
|
|
1552
|
+
return v ? Ho(v, d == null ? void 0 : d.flexible_amount) : void 0;
|
|
1553
|
+
});
|
|
1554
|
+
async function pe() {
|
|
1555
|
+
var v, T, B;
|
|
1556
|
+
W.value.$touch();
|
|
1557
|
+
const d = (v = te.value) == null ? void 0 : v.validate();
|
|
1558
|
+
if (!(W.value.$invalid || (T = te.value) != null && T.isInvalid || !de.value || H.value)) {
|
|
1559
|
+
H.value = !0;
|
|
1560
|
+
try {
|
|
1561
|
+
const L = await ve({
|
|
1562
|
+
pricing_plan_schedule_id: s.value.pricing_plan_schedule_id,
|
|
1563
|
+
pricing_items: U.value ?? [],
|
|
1564
|
+
payment_method_id: s.value.payment_method_id,
|
|
1565
|
+
preview: !1
|
|
1566
|
+
});
|
|
1567
|
+
(d == null ? void 0 : d.status) === "ACTIVE" && ((B = te.value) != null && B.hasChanges) && s.value.payment_method_id && a("save-auto-top-up", {
|
|
1568
|
+
rule: d,
|
|
1569
|
+
paymentMethodId: s.value.payment_method_id,
|
|
1570
|
+
pricingPlanScheduleId: s.value.pricing_plan_schedule_id
|
|
1571
|
+
}), a("success", L);
|
|
1572
|
+
} catch (L) {
|
|
1573
|
+
fe.error("TOP_UP_FAILED", "Failed to charge the wallet top-up", {}, L), a("failure", L);
|
|
1574
|
+
} finally {
|
|
1575
|
+
H.value = !1;
|
|
1576
|
+
}
|
|
1577
|
+
}
|
|
1578
|
+
}
|
|
1579
|
+
t({ submit: pe, isCharging: H, canSubmit: de, chargedValue: ne });
|
|
1580
|
+
const oe = u({
|
|
1581
|
+
get: () => s.value.payment_method_id ?? void 0,
|
|
1582
|
+
set: (d) => {
|
|
1583
|
+
s.value.payment_method_id = d;
|
|
1584
|
+
}
|
|
1585
|
+
}), { sortedPaymentMethods: ge } = xt({
|
|
1586
|
+
paymentMethods: u(() => n.paymentMethods),
|
|
1587
|
+
selectedPaymentMethodId: oe
|
|
1588
|
+
});
|
|
1589
|
+
return (d, v) => (b(), V("form", Jo, [
|
|
1590
|
+
N("div", Zo, [
|
|
1591
|
+
N("div", en, [
|
|
1592
|
+
f.value.length > 0 ? (b(), x(r(ut), {
|
|
1593
|
+
key: 0,
|
|
1594
|
+
modelValue: A.value,
|
|
1595
|
+
"onUpdate:modelValue": v[3] || (v[3] = (T) => A.value = T),
|
|
1596
|
+
class: "sv-top-up-form__options",
|
|
1597
|
+
name: "top-up-pricing-item",
|
|
1598
|
+
direction: "column",
|
|
1599
|
+
required: "",
|
|
1600
|
+
disabled: H.value,
|
|
1601
|
+
options: f.value,
|
|
1602
|
+
"show-radio": !1,
|
|
1603
|
+
label: r(i)({
|
|
1604
|
+
defaultMessage: "Top up amount",
|
|
1605
|
+
description: "Label above the list of ways to top up the wallet in the top-up modal",
|
|
1606
|
+
id: "topup_modal.pricing_items.label"
|
|
1607
|
+
})
|
|
1608
|
+
}, {
|
|
1609
|
+
label: y(({ option: T, optionValue: B }) => [
|
|
1610
|
+
N("span", null, R(T.label), 1),
|
|
1611
|
+
P(B) ? (b(), x(r(ee), {
|
|
1612
|
+
key: 0,
|
|
1613
|
+
tag: "span",
|
|
1614
|
+
variant: "body-sm",
|
|
1615
|
+
color: "subtle",
|
|
1616
|
+
weight: "normal",
|
|
1617
|
+
"no-spacing": "",
|
|
1618
|
+
class: "sv-top-up-form__option-cost"
|
|
1619
|
+
}, {
|
|
1620
|
+
default: y(() => [
|
|
1621
|
+
q(R(P(B)), 1)
|
|
1622
|
+
]),
|
|
1623
|
+
_: 2
|
|
1624
|
+
}, 1024)) : D("", !0)
|
|
1625
|
+
]),
|
|
1626
|
+
description: y(({ optionValue: T }) => [
|
|
1627
|
+
N("div", tn, [
|
|
1628
|
+
I(T).length > 0 ? (b(), x(r(ct), {
|
|
1629
|
+
key: 0,
|
|
1630
|
+
"is-open": String(T) === A.value,
|
|
1631
|
+
lazy: ""
|
|
1632
|
+
}, {
|
|
1633
|
+
default: y(() => [
|
|
1634
|
+
(b(!0), V(we, null, Me(I(T), (B) => {
|
|
1635
|
+
var L;
|
|
1636
|
+
return b(), V("div", {
|
|
1637
|
+
key: B.currency,
|
|
1638
|
+
class: "sv-top-up-form__amount grid grid-cols-1 gap-3",
|
|
1639
|
+
onClick: v[1] || (v[1] = ze(() => {
|
|
1640
|
+
}, ["stop"])),
|
|
1641
|
+
onKeydown: v[2] || (v[2] = ze(() => {
|
|
1642
|
+
}, ["stop"]))
|
|
1643
|
+
}, [
|
|
1644
|
+
E(xe, {
|
|
1645
|
+
modelValue: C.value,
|
|
1646
|
+
"onUpdate:modelValue": v[0] || (v[0] = (le) => C.value = le),
|
|
1647
|
+
name: "top-up-amount",
|
|
1648
|
+
label: r(i)({
|
|
1649
|
+
defaultMessage: "Amount",
|
|
1650
|
+
description: "Label of the amount input of the choose-your-amount top-up",
|
|
1651
|
+
id: "topup_modal.amount.label"
|
|
1652
|
+
}),
|
|
1653
|
+
bounds: S(B),
|
|
1654
|
+
"model-base": "AMOUNT",
|
|
1655
|
+
unit: p(B),
|
|
1656
|
+
"entry-base": G(B),
|
|
1657
|
+
currency: B.currency,
|
|
1658
|
+
"conversion-rate": (L = B.creditsConfiguration) == null ? void 0 : L.conversionRate,
|
|
1659
|
+
required: "",
|
|
1660
|
+
disabled: H.value,
|
|
1661
|
+
error: r(W).flexibleAmount.$errors
|
|
1662
|
+
}, null, 8, ["modelValue", "label", "bounds", "unit", "entry-base", "currency", "conversion-rate", "disabled", "error"])
|
|
1663
|
+
], 32);
|
|
1664
|
+
}), 128))
|
|
1665
|
+
]),
|
|
1666
|
+
_: 2
|
|
1667
|
+
}, 1032, ["is-open"])) : D("", !0)
|
|
1668
|
+
])
|
|
1669
|
+
]),
|
|
1670
|
+
_: 1
|
|
1671
|
+
}, 8, ["modelValue", "disabled", "options", "label"])) : D("", !0)
|
|
1672
|
+
]),
|
|
1673
|
+
N("div", null, [
|
|
1674
|
+
E(Mt, {
|
|
1675
|
+
"pricing-plan-schedule-id": c.value,
|
|
1676
|
+
"pricing-items": U.value
|
|
1677
|
+
}, null, 8, ["pricing-plan-schedule-id", "pricing-items"])
|
|
1678
|
+
]),
|
|
1679
|
+
K.value ? (b(), V("div", on, [
|
|
1680
|
+
E(Et, ae({
|
|
1681
|
+
ref_key: "autoTopUpFormRef",
|
|
1682
|
+
ref: te,
|
|
1683
|
+
class: "sv-top-up-form__auto-top-up"
|
|
1684
|
+
}, K.value, {
|
|
1685
|
+
contained: "",
|
|
1686
|
+
"show-threshold-conversion": !1,
|
|
1687
|
+
disabled: H.value
|
|
1688
|
+
}), null, 16, ["disabled"])
|
|
1689
|
+
])) : D("", !0),
|
|
1690
|
+
N("div", null, [
|
|
1691
|
+
E(r(no), { spacing: "xs" })
|
|
1692
|
+
]),
|
|
1693
|
+
N("div", null, [
|
|
1694
|
+
E(vt, {
|
|
1695
|
+
modelValue: oe.value,
|
|
1696
|
+
"onUpdate:modelValue": v[4] || (v[4] = (T) => oe.value = T),
|
|
1697
|
+
class: "sv-top-up-form__payment-methods",
|
|
1698
|
+
"payment-methods": r(ge),
|
|
1699
|
+
required: "",
|
|
1700
|
+
error: r(W).paymentMethodId.$errors,
|
|
1701
|
+
"payment-method-options": e.paymentMethodOptions,
|
|
1702
|
+
disabled: H.value,
|
|
1703
|
+
label: r(i)({
|
|
1704
|
+
defaultMessage: "Payment method",
|
|
1705
|
+
description: "Label above the payment method that pays for the top-up, in the top-up modal",
|
|
1706
|
+
id: "topup_modal.payment_method_selector.label"
|
|
1707
|
+
}),
|
|
1708
|
+
onAddPaymentMethod: v[5] || (v[5] = (T) => a("add-payment-method"))
|
|
1709
|
+
}, null, 8, ["modelValue", "payment-methods", "error", "payment-method-options", "disabled", "label"])
|
|
1710
|
+
])
|
|
1711
|
+
])
|
|
1712
|
+
]));
|
|
1713
|
+
}
|
|
1714
|
+
}), an = { class: "sv-top-up-success grid grid-cols-1 gap-4" }, sn = /* @__PURE__ */ Y({
|
|
1715
|
+
__name: "TopUpModalSuccess",
|
|
1716
|
+
props: {
|
|
1717
|
+
invoice: { type: Object }
|
|
1718
|
+
},
|
|
1719
|
+
setup(e) {
|
|
1720
|
+
const { $t: t } = Q();
|
|
1721
|
+
return (o, n) => (b(), V("div", an, [
|
|
1722
|
+
e.invoice ? (b(), x(r(be), {
|
|
1723
|
+
key: 0,
|
|
1724
|
+
"content-background": "none"
|
|
1725
|
+
}, {
|
|
1726
|
+
default: y(() => [
|
|
1727
|
+
E(r(ee), {
|
|
1728
|
+
tag: "span",
|
|
1729
|
+
variant: "body-sm",
|
|
1730
|
+
weight: "semibold",
|
|
1731
|
+
class: "mb-2 block"
|
|
1732
|
+
}, {
|
|
1733
|
+
default: y(() => [
|
|
1734
|
+
q(R(r(t)({
|
|
1735
|
+
defaultMessage: "Receipt",
|
|
1736
|
+
description: "Heading above the invoice a completed top-up produced",
|
|
1737
|
+
id: "topup_modal.success.receipt.heading"
|
|
1738
|
+
})), 1)
|
|
1739
|
+
]),
|
|
1740
|
+
_: 1
|
|
1741
|
+
}),
|
|
1742
|
+
E(r(pt), {
|
|
1743
|
+
invoice: e.invoice,
|
|
1744
|
+
"is-customer-facing": ""
|
|
1745
|
+
}, null, 8, ["invoice"])
|
|
1746
|
+
]),
|
|
1747
|
+
_: 1
|
|
1748
|
+
})) : D("", !0)
|
|
1749
|
+
]));
|
|
1750
|
+
}
|
|
1751
|
+
});
|
|
1752
|
+
function ln({
|
|
1753
|
+
step: e,
|
|
1754
|
+
currentBalance: t,
|
|
1755
|
+
topUpValue: o
|
|
1756
|
+
}) {
|
|
1757
|
+
const { $t: n, formatNumber: a } = Q(), i = u(() => e.value === "ADD_PAYMENT_METHOD" ? n({
|
|
1758
|
+
defaultMessage: "Add payment method",
|
|
1759
|
+
description: "Title of the top-up modal while the customer is adding a payment method",
|
|
1760
|
+
id: "topup_modal.add_payment_method.title"
|
|
1761
|
+
}) : e.value === "SUCCESS" ? n({
|
|
1762
|
+
defaultMessage: "Top-up complete",
|
|
1763
|
+
description: "Title of the top-up modal once the top-up has been charged",
|
|
1764
|
+
id: "topup_modal.success.modal_title"
|
|
1765
|
+
}) : n({
|
|
1766
|
+
defaultMessage: "Top up balance",
|
|
1767
|
+
description: "Title of the wallet top-up modal",
|
|
1768
|
+
id: "topup_modal.title"
|
|
1769
|
+
})), l = u(() => e.value === "ADD_PAYMENT_METHOD" ? n({
|
|
1770
|
+
defaultMessage: "Add a new payment method for topping up your balance.",
|
|
1771
|
+
description: "Subtitle of the top-up modal while the customer is adding a payment method",
|
|
1772
|
+
id: "topup_modal.add_payment_method.subtitle"
|
|
1773
|
+
}) : e.value === "SUCCESS" ? n({
|
|
1774
|
+
defaultMessage: "Your payment went through.",
|
|
1775
|
+
description: "Subtitle of the top-up modal once the top-up has been charged",
|
|
1776
|
+
id: "topup_modal.success.modal_subtitle"
|
|
1777
|
+
}) : n(
|
|
1778
|
+
{
|
|
1779
|
+
defaultMessage: "Your current balance is {balance}.",
|
|
1780
|
+
description: "Subtitle of the top-up modal showing the current wallet balance",
|
|
1781
|
+
id: "topup_modal.subtitle"
|
|
1782
|
+
},
|
|
1783
|
+
{ balance: t.value }
|
|
1784
|
+
)), s = u(
|
|
1785
|
+
() => e.value === "ADD_PAYMENT_METHOD" ? n({
|
|
1786
|
+
defaultMessage: "Back",
|
|
1787
|
+
description: "Label of the button that leaves the add payment method step in the top-up modal",
|
|
1788
|
+
id: "topup_modal.back_button.label"
|
|
1789
|
+
}) : n({
|
|
1790
|
+
defaultMessage: "Cancel",
|
|
1791
|
+
description: "Label of the button that closes the top-up modal",
|
|
1792
|
+
id: "topup_modal.cancel_button.label"
|
|
1793
|
+
})
|
|
1794
|
+
), m = u(() => e.value === "ADD_PAYMENT_METHOD" ? n({
|
|
1795
|
+
defaultMessage: "Save payment method",
|
|
1796
|
+
description: "Label of the confirm button in the top-up modal while adding a payment method",
|
|
1797
|
+
id: "topup_modal.save_payment_method.label"
|
|
1798
|
+
}) : e.value === "SUCCESS" ? n({
|
|
1799
|
+
defaultMessage: "Done",
|
|
1800
|
+
description: "Label of the button that dismisses the top-up modal once the top-up has been charged",
|
|
1801
|
+
id: "topup_modal.done_button.label"
|
|
1802
|
+
}) : o.value ? n(
|
|
1803
|
+
{
|
|
1804
|
+
defaultMessage: "Top up balance with {value}",
|
|
1805
|
+
description: "Label of the confirm button in the top-up modal once an amount is entered",
|
|
1806
|
+
id: "topup_modal.confirm_button.label"
|
|
1807
|
+
},
|
|
1808
|
+
{ value: Be(n, a, o.value) }
|
|
1809
|
+
) : n({
|
|
1810
|
+
defaultMessage: "Top up balance",
|
|
1811
|
+
description: "Label of the confirm button in the top-up modal while no amount is entered",
|
|
1812
|
+
id: "topup_modal.confirm_button.empty.label"
|
|
1813
|
+
}));
|
|
1814
|
+
return { title: i, subTitle: l, cancelButtonText: s, confirmButtonText: m };
|
|
1815
|
+
}
|
|
1816
|
+
function Ot({
|
|
1817
|
+
isOpen: e,
|
|
1818
|
+
customer: t,
|
|
1819
|
+
subscriptionId: o,
|
|
1820
|
+
onError: n
|
|
1821
|
+
}) {
|
|
1822
|
+
const { paymentMethodOptions: a, get: i, isPending: l } = po(), s = async () => {
|
|
1823
|
+
const h = t.value;
|
|
1824
|
+
if (!(!e.value || !h))
|
|
1825
|
+
try {
|
|
1826
|
+
await i({
|
|
1827
|
+
customerId: h.id,
|
|
1828
|
+
...o != null && o.value ? { subscriptionId: o.value } : {},
|
|
1829
|
+
country: co(h)
|
|
1830
|
+
});
|
|
1831
|
+
} catch (M) {
|
|
1832
|
+
n == null || n(M);
|
|
1833
|
+
}
|
|
1834
|
+
};
|
|
1835
|
+
j(
|
|
1836
|
+
() => [e.value, t.value, o == null ? void 0 : o.value],
|
|
1837
|
+
() => void s(),
|
|
1838
|
+
{ immediate: !0 }
|
|
1839
|
+
);
|
|
1840
|
+
const m = u(
|
|
1841
|
+
() => l.value ? void 0 : a.value
|
|
1842
|
+
);
|
|
1843
|
+
return { paymentMethodOptions: a, settledOptions: m, isPending: l, load: s };
|
|
1844
|
+
}
|
|
1845
|
+
const un = /* @__PURE__ */ Y({
|
|
1846
|
+
__name: "AddPaymentMethodPane",
|
|
1847
|
+
props: {
|
|
1848
|
+
customer: { type: Object },
|
|
1849
|
+
paymentMethodOptions: { type: Array },
|
|
1850
|
+
isLoading: { type: Boolean },
|
|
1851
|
+
isActive: { type: Boolean }
|
|
1852
|
+
},
|
|
1853
|
+
emits: ["success", "failure"],
|
|
1854
|
+
setup(e, { expose: t }) {
|
|
1855
|
+
const o = zt(
|
|
1856
|
+
() => import("./PaymentMethodForm-CypZOYUZ.mjs").then((s) => s.default)
|
|
1857
|
+
), n = e, a = u(() => ({
|
|
1858
|
+
variant: "TOKENIZE"
|
|
1859
|
+
})), i = O(!1);
|
|
1860
|
+
j(
|
|
1861
|
+
() => n.isActive,
|
|
1862
|
+
(s) => {
|
|
1863
|
+
i.value = i.value || !!s;
|
|
1864
|
+
},
|
|
1865
|
+
{ immediate: !0 }
|
|
1866
|
+
);
|
|
1867
|
+
const l = O();
|
|
1868
|
+
return t({
|
|
1869
|
+
/** Submits the form, for a host whose own chrome owns the button — a modal footer, say. */
|
|
1870
|
+
submit: () => {
|
|
1871
|
+
var s;
|
|
1872
|
+
return (s = l.value) == null ? void 0 : s.submit();
|
|
1873
|
+
},
|
|
1874
|
+
/**
|
|
1875
|
+
* Whether the gateway is working on it, so the host can show it and hold everything else. Read
|
|
1876
|
+
* through the pane being on screen: a form left behind on another pane is not what is pending.
|
|
1877
|
+
*/
|
|
1878
|
+
isSaving: u(() => {
|
|
1879
|
+
var s;
|
|
1880
|
+
return !!n.isActive && !!((s = l.value) != null && s.isPaymentPending);
|
|
1881
|
+
})
|
|
1882
|
+
}), (s, m) => e.customer && i.value ? (b(), x(r(o), {
|
|
1883
|
+
key: 0,
|
|
1884
|
+
ref_key: "formRef",
|
|
1885
|
+
ref: l,
|
|
1886
|
+
class: "sv-add-payment-method-pane",
|
|
1887
|
+
"hide-submit-button": "",
|
|
1888
|
+
customer: e.customer,
|
|
1889
|
+
"payment-method-options": e.paymentMethodOptions ?? [],
|
|
1890
|
+
"is-loading": e.isLoading,
|
|
1891
|
+
configuration: a.value,
|
|
1892
|
+
onSuccess: m[0] || (m[0] = (h) => s.$emit("success")),
|
|
1893
|
+
onFailure: m[1] || (m[1] = (h) => s.$emit("failure", h))
|
|
1894
|
+
}, null, 8, ["customer", "payment-method-options", "is-loading", "configuration"])) : D("", !0);
|
|
1895
|
+
}
|
|
1896
|
+
});
|
|
1897
|
+
function rn(e) {
|
|
1898
|
+
const t = O(0), o = (a) => {
|
|
1899
|
+
t.value = (a == null ? void 0 : a.offsetHeight) ?? 0;
|
|
1900
|
+
}, n = typeof ResizeObserver > "u" ? void 0 : new ResizeObserver((a) => {
|
|
1901
|
+
var l;
|
|
1902
|
+
const i = (l = a[0]) == null ? void 0 : l.target;
|
|
1903
|
+
o(i instanceof HTMLElement ? i : void 0);
|
|
1904
|
+
});
|
|
1905
|
+
return j(
|
|
1906
|
+
e,
|
|
1907
|
+
(a, i) => {
|
|
1908
|
+
i && (n == null || n.unobserve(i)), o(a), a && (n == null || n.observe(a));
|
|
1909
|
+
},
|
|
1910
|
+
// `post` so the callback runs after the render that assigns the template ref, not before.
|
|
1911
|
+
{ immediate: !0, flush: "post" }
|
|
1912
|
+
), Oe(() => {
|
|
1913
|
+
n == null || n.disconnect();
|
|
1914
|
+
}), t;
|
|
1915
|
+
}
|
|
1916
|
+
const dn = ["inert"], cn = 300, pn = "1rem", mn = /* @__PURE__ */ Y({
|
|
1917
|
+
__name: "SlidingPanes",
|
|
1918
|
+
props: {
|
|
1919
|
+
panes: { type: Array },
|
|
1920
|
+
current: { type: String }
|
|
1921
|
+
},
|
|
1922
|
+
setup(e) {
|
|
1923
|
+
const t = e, o = O(!1);
|
|
1924
|
+
let n;
|
|
1925
|
+
j(
|
|
1926
|
+
() => t.current,
|
|
1927
|
+
() => {
|
|
1928
|
+
o.value = !0, clearTimeout(n), n = setTimeout(() => {
|
|
1929
|
+
o.value = !1;
|
|
1930
|
+
}, cn);
|
|
1931
|
+
}
|
|
1932
|
+
), Oe(() => {
|
|
1933
|
+
clearTimeout(n);
|
|
1934
|
+
});
|
|
1935
|
+
const a = O({}), i = {}, l = (M) => i[M] ?? (i[M] = (A) => {
|
|
1936
|
+
a.value[M] = A instanceof HTMLElement ? A : void 0;
|
|
1937
|
+
}), s = u(() => a.value[t.current]), m = rn(s), h = u(() => {
|
|
1938
|
+
const M = t.panes.indexOf(t.current);
|
|
1939
|
+
return M > 0 ? `translateX(calc(${-M} * (100% + ${pn})))` : "translateX(0px)";
|
|
1940
|
+
});
|
|
1941
|
+
return (M, A) => (b(), V("div", {
|
|
1942
|
+
class: $e([
|
|
1943
|
+
"sv-sliding-panes__viewport relative -mx-2 overflow-hidden px-2",
|
|
1944
|
+
o.value ? "transition-[height] duration-300 ease-in-out motion-reduce:transition-none" : ""
|
|
1945
|
+
]),
|
|
1946
|
+
style: je(r(m) ? { height: `${r(m)}px` } : void 0)
|
|
1947
|
+
}, [
|
|
1948
|
+
N("div", {
|
|
1949
|
+
class: "sv-sliding-panes__track flex items-start gap-4 transition-transform duration-300 ease-in-out motion-reduce:transition-none",
|
|
1950
|
+
style: je({ transform: h.value })
|
|
1951
|
+
}, [
|
|
1952
|
+
(b(!0), V(we, null, Me(e.panes, (c) => (b(), V("div", {
|
|
1953
|
+
key: c,
|
|
1954
|
+
class: "sv-sliding-panes__pane w-full shrink-0",
|
|
1955
|
+
inert: c !== e.current || void 0
|
|
1956
|
+
}, [
|
|
1957
|
+
N("div", {
|
|
1958
|
+
ref_for: !0,
|
|
1959
|
+
ref: l(c)
|
|
1960
|
+
}, [
|
|
1961
|
+
ue(M.$slots, c)
|
|
1962
|
+
], 512)
|
|
1963
|
+
], 8, dn))), 128))
|
|
1964
|
+
], 4)
|
|
1965
|
+
], 6));
|
|
1966
|
+
}
|
|
1967
|
+
}), $t = /* @__PURE__ */ Y({
|
|
1968
|
+
inheritAttrs: !1,
|
|
1969
|
+
__name: "OnDemandPaymentModalShell",
|
|
1970
|
+
props: {
|
|
1971
|
+
showModal: { type: Boolean },
|
|
1972
|
+
title: { type: String },
|
|
1973
|
+
subTitle: { type: String },
|
|
1974
|
+
cancelButtonText: { type: String },
|
|
1975
|
+
confirmButtonText: { type: String },
|
|
1976
|
+
isPending: { type: Boolean },
|
|
1977
|
+
panes: { type: Array },
|
|
1978
|
+
step: { type: String },
|
|
1979
|
+
addPaymentMethodPane: { type: String },
|
|
1980
|
+
customer: { type: Object },
|
|
1981
|
+
paymentMethodOptions: { type: Array },
|
|
1982
|
+
isPaymentMethodOptionsPending: { type: Boolean }
|
|
1983
|
+
},
|
|
1984
|
+
emits: ["confirm", "cancel", "payment-success", "payment-failed"],
|
|
1985
|
+
setup(e, { expose: t }) {
|
|
1986
|
+
const o = e, n = O(), a = u(() => o.panes.filter((i) => i !== o.addPaymentMethodPane));
|
|
1987
|
+
return t({
|
|
1988
|
+
submit: () => {
|
|
1989
|
+
var i;
|
|
1990
|
+
return (i = n.value) == null ? void 0 : i.submit();
|
|
1991
|
+
},
|
|
1992
|
+
isSaving: u(() => {
|
|
1993
|
+
var i;
|
|
1994
|
+
return !!((i = n.value) != null && i.isSaving);
|
|
1995
|
+
})
|
|
1996
|
+
}), (i, l) => (b(), x(r(ft), {
|
|
1997
|
+
"no-click-away": "",
|
|
1998
|
+
"show-modal": e.showModal,
|
|
1999
|
+
size: "lg",
|
|
2000
|
+
title: e.title,
|
|
2001
|
+
"sub-title": e.subTitle,
|
|
2002
|
+
"cancel-button-text": e.cancelButtonText,
|
|
2003
|
+
"confirm-button-text": e.confirmButtonText,
|
|
2004
|
+
"is-loading": e.isPending,
|
|
2005
|
+
onConfirm: l[2] || (l[2] = (s) => i.$emit("confirm")),
|
|
2006
|
+
onClose: l[3] || (l[3] = (s) => i.$emit("cancel"))
|
|
2007
|
+
}, re({
|
|
2008
|
+
body: y(() => [
|
|
2009
|
+
N("div", ae({ class: "grid grid-cols-1 gap-4 pb-4" }, i.$attrs), [
|
|
2010
|
+
E(mn, {
|
|
2011
|
+
panes: e.panes,
|
|
2012
|
+
current: e.step
|
|
2013
|
+
}, re({
|
|
2014
|
+
[e.addPaymentMethodPane]: y(() => [
|
|
2015
|
+
E(un, {
|
|
2016
|
+
ref_key: "paneRef",
|
|
2017
|
+
ref: n,
|
|
2018
|
+
customer: e.customer,
|
|
2019
|
+
"payment-method-options": e.paymentMethodOptions,
|
|
2020
|
+
"is-loading": e.isPaymentMethodOptionsPending,
|
|
2021
|
+
"is-active": e.step === e.addPaymentMethodPane,
|
|
2022
|
+
onSuccess: l[0] || (l[0] = (s) => i.$emit("payment-success")),
|
|
2023
|
+
onFailure: l[1] || (l[1] = (s) => i.$emit("payment-failed", s))
|
|
2024
|
+
}, null, 8, ["customer", "payment-method-options", "is-loading", "is-active"])
|
|
2025
|
+
]),
|
|
2026
|
+
_: 2
|
|
2027
|
+
}, [
|
|
2028
|
+
Me(a.value, (s) => ({
|
|
2029
|
+
name: s,
|
|
2030
|
+
fn: y(() => [
|
|
2031
|
+
ue(i.$slots, s)
|
|
2032
|
+
])
|
|
2033
|
+
}))
|
|
2034
|
+
]), 1032, ["panes", "current"])
|
|
2035
|
+
], 16)
|
|
2036
|
+
]),
|
|
2037
|
+
_: 2
|
|
2038
|
+
}, [
|
|
2039
|
+
i.$slots.footer ? {
|
|
2040
|
+
name: "footer",
|
|
2041
|
+
fn: y(() => [
|
|
2042
|
+
ue(i.$slots, "footer")
|
|
2043
|
+
]),
|
|
2044
|
+
key: "0"
|
|
2045
|
+
} : void 0
|
|
2046
|
+
]), 1032, ["show-modal", "title", "sub-title", "cancel-button-text", "confirm-button-text", "is-loading"]));
|
|
2047
|
+
}
|
|
2048
|
+
}), It = (e) => {
|
|
2049
|
+
var t;
|
|
2050
|
+
return (((t = e == null ? void 0 : e.wallet) == null ? void 0 : t.auto_top_up_configs) ?? []).find(
|
|
2051
|
+
({ status: o }) => o === "ACTIVE"
|
|
2052
|
+
);
|
|
2053
|
+
}, Bt = (e) => e ? {
|
|
2054
|
+
status: e.status,
|
|
2055
|
+
threshold: e.threshold,
|
|
2056
|
+
...e.topup_amount && { topup_amount: e.topup_amount }
|
|
2057
|
+
} : void 0, Dt = (e, t = []) => {
|
|
2058
|
+
if (e != null && e.pricing_item_id && e.pricing_plan_schedule_id)
|
|
2059
|
+
return {
|
|
2060
|
+
pricingItemId: e.pricing_item_id,
|
|
2061
|
+
pricingPlanScheduleId: e.pricing_plan_schedule_id
|
|
2062
|
+
};
|
|
2063
|
+
const o = t.find(
|
|
2064
|
+
({ flexiblePricing: n, pricingPlanScheduleId: a }) => n && a
|
|
2065
|
+
);
|
|
2066
|
+
return o != null && o.pricingPlanScheduleId ? {
|
|
2067
|
+
pricingItemId: o.pricingItemId,
|
|
2068
|
+
pricingPlanScheduleId: o.pricingPlanScheduleId
|
|
2069
|
+
} : void 0;
|
|
2070
|
+
}, Nt = ({
|
|
2071
|
+
rule: e,
|
|
2072
|
+
walletBalanceItem: t,
|
|
2073
|
+
chargeTarget: o,
|
|
2074
|
+
paymentMethodId: n
|
|
2075
|
+
}) => {
|
|
2076
|
+
var i, l;
|
|
2077
|
+
const a = !!(((i = e == null ? void 0 : e.threshold) == null ? void 0 : i.amount) ?? ((l = e == null ? void 0 : e.threshold) == null ? void 0 : l.credits));
|
|
2078
|
+
if (!(!e || !a || !(t != null && t.wallet_id) || !o || !n))
|
|
2079
|
+
return {
|
|
2080
|
+
wallet_id: t.wallet_id,
|
|
2081
|
+
status: e.status,
|
|
2082
|
+
threshold: e.threshold,
|
|
2083
|
+
pricing_plan_schedule_id: o.pricingPlanScheduleId,
|
|
2084
|
+
pricing_item_id: o.pricingItemId,
|
|
2085
|
+
payment_method_id: n,
|
|
2086
|
+
...e.topup_amount && { topup_amount: e.topup_amount }
|
|
2087
|
+
};
|
|
2088
|
+
};
|
|
2089
|
+
function Rt({
|
|
2090
|
+
step: e,
|
|
2091
|
+
name: t,
|
|
2092
|
+
returnTo: o
|
|
2093
|
+
}) {
|
|
2094
|
+
const n = O();
|
|
2095
|
+
return {
|
|
2096
|
+
paneRef: n,
|
|
2097
|
+
isActive: u(() => e.value === t),
|
|
2098
|
+
isSaving: u(() => {
|
|
2099
|
+
var a;
|
|
2100
|
+
return !!((a = n.value) != null && a.isSaving);
|
|
2101
|
+
}),
|
|
2102
|
+
open: () => {
|
|
2103
|
+
e.value = t;
|
|
2104
|
+
},
|
|
2105
|
+
leave: () => {
|
|
2106
|
+
e.value = o;
|
|
2107
|
+
},
|
|
2108
|
+
submit: () => {
|
|
2109
|
+
var a;
|
|
2110
|
+
return (a = n.value) == null ? void 0 : a.submit();
|
|
2111
|
+
}
|
|
2112
|
+
};
|
|
2113
|
+
}
|
|
2114
|
+
function kt() {
|
|
2115
|
+
const e = ot(), t = nt(), o = ["portal", "auto-top-up-configs"];
|
|
2116
|
+
function n(s) {
|
|
2117
|
+
return e({
|
|
2118
|
+
url: ye(t.apiUrls.config, ...o),
|
|
2119
|
+
query: { ...s },
|
|
2120
|
+
isCollection: !0
|
|
2121
|
+
});
|
|
2122
|
+
}
|
|
2123
|
+
async function a(s) {
|
|
2124
|
+
return e({
|
|
2125
|
+
url: ye(t.apiUrls.config, ...o, s)
|
|
2126
|
+
});
|
|
2127
|
+
}
|
|
2128
|
+
function i(s) {
|
|
2129
|
+
return e({
|
|
2130
|
+
url: ye(t.apiUrls.config, ...o),
|
|
2131
|
+
options: { method: "POST" },
|
|
2132
|
+
data: s
|
|
2133
|
+
});
|
|
2134
|
+
}
|
|
2135
|
+
async function l(s) {
|
|
2136
|
+
return e({
|
|
2137
|
+
url: ye(t.apiUrls.config, ...o, s, "deactivate"),
|
|
2138
|
+
options: { method: "POST" }
|
|
2139
|
+
});
|
|
2140
|
+
}
|
|
2141
|
+
return {
|
|
2142
|
+
getAutoTopUpConfigs: n,
|
|
2143
|
+
getAutoTopUpConfig: a,
|
|
2144
|
+
createAutoTopUpConfig: i,
|
|
2145
|
+
deactivateAutoTopUpConfig: l
|
|
2146
|
+
};
|
|
2147
|
+
}
|
|
2148
|
+
function Ft() {
|
|
2149
|
+
const { createAutoTopUpConfig: e } = kt(), t = Ae(), o = O(!1);
|
|
2150
|
+
return { save: async (a) => {
|
|
2151
|
+
if (!a || o.value)
|
|
2152
|
+
return { saved: !1 };
|
|
2153
|
+
o.value = !0;
|
|
2154
|
+
try {
|
|
2155
|
+
return await e(a), { saved: !0 };
|
|
2156
|
+
} catch (i) {
|
|
2157
|
+
return t.error(
|
|
2158
|
+
"AUTO_TOP_UP_SAVE_FAILED",
|
|
2159
|
+
"Failed to save the automatic top-up rule",
|
|
2160
|
+
{},
|
|
2161
|
+
i
|
|
2162
|
+
), { saved: !1, error: i };
|
|
2163
|
+
} finally {
|
|
2164
|
+
o.value = !1;
|
|
2165
|
+
}
|
|
2166
|
+
}, isSaving: o };
|
|
2167
|
+
}
|
|
2168
|
+
function vn(e) {
|
|
2169
|
+
var t;
|
|
2170
|
+
return Kt(e) ? e.statusCode === 422 ? e.resourceType === "PAYMENT" ? "PAYMENT_FAILED" : "FAILED" : e.statusCode !== 400 ? "FAILED" : e.field === "payment_method_id" ? "PAYMENT_METHOD" : e.field === "pricing_plan_subscription_id" ? "SUBSCRIPTION_INACTIVE" : e.field === "pricing_items" || (t = e.field) != null && t.startsWith("pricing_items.") ? "PRICING_ITEMS" : "FAILED" : "FAILED";
|
|
2171
|
+
}
|
|
2172
|
+
function ta(e) {
|
|
2173
|
+
return e === "PAYMENT_METHOD" || e === "PRICING_ITEMS" || e === "SUBSCRIPTION_INACTIVE";
|
|
2174
|
+
}
|
|
2175
|
+
const fn = {
|
|
2176
|
+
key: 0,
|
|
2177
|
+
class: "mb-4"
|
|
2178
|
+
}, hn = { class: "sr-only" }, gn = { class: "flex flex-col gap-2" }, _n = /* @__PURE__ */ Y({
|
|
2179
|
+
__name: "TopUpModal",
|
|
2180
|
+
props: {
|
|
2181
|
+
showModal: { type: Boolean },
|
|
2182
|
+
selectedBalanceItem: { type: Object },
|
|
2183
|
+
paymentMethods: { type: Array },
|
|
2184
|
+
customer: { type: Object },
|
|
2185
|
+
subscriptions: { type: Array }
|
|
2186
|
+
},
|
|
2187
|
+
emits: ["confirm", "close", "auto-top-up-saved", "payment-success", "payment-failed"],
|
|
2188
|
+
setup(e, { emit: t }) {
|
|
2189
|
+
const o = e, n = t, { $t: a } = Q(), { formatOpenBalance: i } = Ue(), l = u(
|
|
2190
|
+
() => Bt(It(o.selectedBalanceItem))
|
|
2191
|
+
), s = u(() => i(o.selectedBalanceItem)), m = u(
|
|
2192
|
+
() => Io(o.selectedBalanceItem, o.subscriptions ?? [])
|
|
2193
|
+
), h = O();
|
|
2194
|
+
j(
|
|
2195
|
+
m,
|
|
2196
|
+
($) => {
|
|
2197
|
+
var F;
|
|
2198
|
+
$.some(
|
|
2199
|
+
({ id: _e }) => _e === h.value
|
|
2200
|
+
) || (h.value = (F = $[0]) == null ? void 0 : F.id);
|
|
2201
|
+
},
|
|
2202
|
+
{ immediate: !0 }
|
|
2203
|
+
);
|
|
2204
|
+
const M = u(() => m.value.length > 1), A = u(
|
|
2205
|
+
() => m.value.map(({ id: $, name: z }, F) => ({
|
|
2206
|
+
value: $,
|
|
2207
|
+
label: z ?? a(
|
|
2208
|
+
{
|
|
2209
|
+
defaultMessage: "Subscription {number}",
|
|
2210
|
+
description: "Accessible name of a subscription in the top-up modal when it has no name, numbered by its place in the list",
|
|
2211
|
+
id: "topup_modal.subscriptions.unnamed"
|
|
2212
|
+
},
|
|
2213
|
+
{ number: String(F + 1) }
|
|
2214
|
+
)
|
|
2215
|
+
}))
|
|
2216
|
+
), c = u(
|
|
2217
|
+
() => Object.fromEntries(
|
|
2218
|
+
m.value.flatMap(({ id: $, enabledPricingIds: z }) => {
|
|
2219
|
+
const F = (o.subscriptions ?? []).find(({ id: _e }) => _e === $);
|
|
2220
|
+
return F ? [[$, { subscription: F, enabledPricingIds: z }]] : [];
|
|
2221
|
+
})
|
|
2222
|
+
)
|
|
2223
|
+
), w = u(() => {
|
|
2224
|
+
var z;
|
|
2225
|
+
if (!o.selectedBalanceItem || !((z = o.subscriptions) != null && z.length))
|
|
2226
|
+
return o.selectedBalanceItem;
|
|
2227
|
+
const $ = m.value.find(({ id: F }) => F === h.value);
|
|
2228
|
+
return $ ? Bo(o.selectedBalanceItem, $.scheduleIds) : { ...o.selectedBalanceItem, charge_on_demand_pricing_items: [] };
|
|
2229
|
+
}), P = u(() => ht(w.value)), {
|
|
2230
|
+
paymentMethodOptions: g,
|
|
2231
|
+
settledOptions: C,
|
|
2232
|
+
isPending: G
|
|
2233
|
+
} = Ot({
|
|
2234
|
+
isOpen: u(() => o.showModal),
|
|
2235
|
+
customer: u(() => o.customer)
|
|
2236
|
+
}), _ = O("TOP_UP"), p = u(() => (o.paymentMethods ?? []).length > 0), S = u(
|
|
2237
|
+
() => !G.value && (g.value ?? []).length === 0
|
|
2238
|
+
), I = u(
|
|
2239
|
+
() => _.value === "TOP_UP" && !p.value && S.value
|
|
2240
|
+
), f = O(), U = () => {
|
|
2241
|
+
H(), n("payment-success");
|
|
2242
|
+
}, {
|
|
2243
|
+
paneRef: K,
|
|
2244
|
+
isActive: te,
|
|
2245
|
+
isSaving: ve,
|
|
2246
|
+
open: fe,
|
|
2247
|
+
leave: H,
|
|
2248
|
+
submit: de
|
|
2249
|
+
} = Rt({ step: _, name: "ADD_PAYMENT_METHOD", returnTo: "TOP_UP" }), { save: he, isSaving: ce } = Ft();
|
|
2250
|
+
let W = 0;
|
|
2251
|
+
const ne = O(), pe = u(() => {
|
|
2252
|
+
var $;
|
|
2253
|
+
return ($ = ne.value) == null ? void 0 : $.chargedValue;
|
|
2254
|
+
}), oe = u(
|
|
2255
|
+
() => {
|
|
2256
|
+
var $;
|
|
2257
|
+
return ve.value || ce.value || !!(($ = ne.value) != null && $.isCharging);
|
|
2258
|
+
}
|
|
2259
|
+
), { title: ge, subTitle: d, cancelButtonText: v, confirmButtonText: T } = ln({
|
|
2260
|
+
step: _,
|
|
2261
|
+
currentBalance: s,
|
|
2262
|
+
topUpValue: pe
|
|
2263
|
+
}), B = O(), L = O(!1), le = u(
|
|
2264
|
+
() => L.value ? a({
|
|
2265
|
+
defaultMessage: "Your wallet was topped up, but we couldn't save your automatic top-up. You can set it up from your wallet.",
|
|
2266
|
+
description: "Error shown on the top-up receipt when the automatic top-up rule set alongside it failed to save",
|
|
2267
|
+
id: "topup_modal.success.auto_top_up_failed"
|
|
2268
|
+
}) : void 0
|
|
2269
|
+
), Te = () => {
|
|
2270
|
+
var $;
|
|
2271
|
+
if (te.value) {
|
|
2272
|
+
de();
|
|
2273
|
+
return;
|
|
2274
|
+
}
|
|
2275
|
+
B.value = void 0, ($ = ne.value) == null || $.submit();
|
|
2276
|
+
}, k = ($) => {
|
|
2277
|
+
B.value = vn($) === "PAYMENT_FAILED" ? a({
|
|
2278
|
+
defaultMessage: "Your payment was declined. Try another payment method.",
|
|
2279
|
+
description: "Error shown in the top-up modal when the payment was declined",
|
|
2280
|
+
id: "topup_modal.error.payment_declined"
|
|
2281
|
+
}) : a({
|
|
2282
|
+
defaultMessage: "We couldn't top up your wallet. Please try again.",
|
|
2283
|
+
description: "Error shown in the top-up modal when charging the top-up failed",
|
|
2284
|
+
id: "topup_modal.error.charge_failed"
|
|
2285
|
+
}), n("payment-failed", $);
|
|
2286
|
+
}, X = async ({
|
|
2287
|
+
rule: $,
|
|
2288
|
+
paymentMethodId: z,
|
|
2289
|
+
pricingPlanScheduleId: F
|
|
2290
|
+
}) => {
|
|
2291
|
+
const _e = W, { saved: qt } = await he(
|
|
2292
|
+
Nt({
|
|
2293
|
+
rule: $,
|
|
2294
|
+
walletBalanceItem: o.selectedBalanceItem,
|
|
2295
|
+
chargeTarget: Dt(
|
|
2296
|
+
void 0,
|
|
2297
|
+
P.value.filter(
|
|
2298
|
+
(Vt) => Vt.pricingPlanScheduleId === F
|
|
2299
|
+
)
|
|
2300
|
+
),
|
|
2301
|
+
paymentMethodId: z
|
|
2302
|
+
})
|
|
2303
|
+
);
|
|
2304
|
+
if (qt) {
|
|
2305
|
+
n("auto-top-up-saved");
|
|
2306
|
+
return;
|
|
2307
|
+
}
|
|
2308
|
+
_e === W && (L.value = !0);
|
|
2309
|
+
}, Z = ($) => {
|
|
2310
|
+
f.value = $, _.value = "SUCCESS";
|
|
2311
|
+
}, Le = () => {
|
|
2312
|
+
oe.value || (n("confirm"), n("close"));
|
|
2313
|
+
}, Ye = () => {
|
|
2314
|
+
if (!oe.value) {
|
|
2315
|
+
if (te.value) {
|
|
2316
|
+
H();
|
|
2317
|
+
return;
|
|
2318
|
+
}
|
|
2319
|
+
if (_.value === "SUCCESS") {
|
|
2320
|
+
Le();
|
|
2321
|
+
return;
|
|
2322
|
+
}
|
|
2323
|
+
n("close");
|
|
2324
|
+
}
|
|
2325
|
+
}, He = O(0);
|
|
2326
|
+
return j(
|
|
2327
|
+
() => o.showModal,
|
|
2328
|
+
($) => {
|
|
2329
|
+
$ && (W += 1, _.value = "TOP_UP", f.value = void 0, B.value = void 0, L.value = !1, He.value += 1);
|
|
2330
|
+
}
|
|
2331
|
+
), ($, z) => (b(), x($t, {
|
|
2332
|
+
ref_key: "addPaymentMethodRef",
|
|
2333
|
+
ref: K,
|
|
2334
|
+
"show-modal": e.showModal,
|
|
2335
|
+
title: r(ge),
|
|
2336
|
+
"sub-title": r(d),
|
|
2337
|
+
"cancel-button-text": r(v),
|
|
2338
|
+
"confirm-button-text": r(T),
|
|
2339
|
+
"is-pending": oe.value,
|
|
2340
|
+
panes: r(Oo),
|
|
2341
|
+
step: _.value,
|
|
2342
|
+
"add-payment-method-pane": "ADD_PAYMENT_METHOD",
|
|
2343
|
+
customer: e.customer,
|
|
2344
|
+
"payment-method-options": r(g),
|
|
2345
|
+
"is-payment-method-options-pending": r(G),
|
|
2346
|
+
onConfirm: Te,
|
|
2347
|
+
onCancel: Ye,
|
|
2348
|
+
onPaymentSuccess: U,
|
|
2349
|
+
onPaymentFailed: z[1] || (z[1] = (F) => $.$emit("payment-failed", F))
|
|
2350
|
+
}, re({
|
|
2351
|
+
TOP_UP: y(() => [
|
|
2352
|
+
M.value ? (b(), V("div", fn, [
|
|
2353
|
+
E(r(ut), {
|
|
2354
|
+
modelValue: h.value,
|
|
2355
|
+
"onUpdate:modelValue": z[0] || (z[0] = (F) => h.value = F),
|
|
2356
|
+
class: "sv-topup-modal__subscription",
|
|
2357
|
+
name: "top-up-subscription",
|
|
2358
|
+
direction: "column",
|
|
2359
|
+
required: "",
|
|
2360
|
+
options: A.value,
|
|
2361
|
+
"show-radio": !1,
|
|
2362
|
+
label: r(a)({
|
|
2363
|
+
defaultMessage: "Subscription to top up",
|
|
2364
|
+
description: "Label above the list of subscriptions a top-up can be charged against, in the top-up modal",
|
|
2365
|
+
id: "topup_modal.subscriptions.label"
|
|
2366
|
+
})
|
|
2367
|
+
}, {
|
|
2368
|
+
prefix: y(({ optionValue: F }) => [
|
|
2369
|
+
c.value[String(F)] ? (b(), x(lo, {
|
|
2370
|
+
key: 0,
|
|
2371
|
+
class: "sv-topup-modal__subscription-option grow",
|
|
2372
|
+
"no-spacing": "",
|
|
2373
|
+
subscription: c.value[String(F)].subscription,
|
|
2374
|
+
"enabled-pricing-ids": c.value[String(F)].enabledPricingIds
|
|
2375
|
+
}, null, 8, ["subscription", "enabled-pricing-ids"])) : D("", !0)
|
|
2376
|
+
]),
|
|
2377
|
+
label: y(({ option: F }) => [
|
|
2378
|
+
N("span", hn, R(F.label), 1)
|
|
2379
|
+
]),
|
|
2380
|
+
_: 1
|
|
2381
|
+
}, 8, ["modelValue", "options", "label"])
|
|
2382
|
+
])) : D("", !0),
|
|
2383
|
+
(b(), x(nn, {
|
|
2384
|
+
key: He.value,
|
|
2385
|
+
ref_key: "topUpFormRef",
|
|
2386
|
+
ref: ne,
|
|
2387
|
+
"top-up-pricing-items": P.value,
|
|
2388
|
+
"payment-methods": e.paymentMethods,
|
|
2389
|
+
"auto-top-up-config": l.value,
|
|
2390
|
+
"payment-method-options": r(C),
|
|
2391
|
+
onAddPaymentMethod: r(fe),
|
|
2392
|
+
onSuccess: Z,
|
|
2393
|
+
onFailure: k,
|
|
2394
|
+
onSaveAutoTopUp: X
|
|
2395
|
+
}, null, 8, ["top-up-pricing-items", "payment-methods", "auto-top-up-config", "payment-method-options", "onAddPaymentMethod"])),
|
|
2396
|
+
B.value ? (b(), x(r(me), {
|
|
2397
|
+
key: 1,
|
|
2398
|
+
class: "sv-topup-modal__error sv-error mt-4",
|
|
2399
|
+
title: B.value
|
|
2400
|
+
}, null, 8, ["title"])) : D("", !0)
|
|
2401
|
+
]),
|
|
2402
|
+
SUCCESS: y(() => [
|
|
2403
|
+
le.value ? (b(), x(r(me), {
|
|
2404
|
+
key: 0,
|
|
2405
|
+
class: "sv-topup-modal__auto-top-up-error sv-error mb-4",
|
|
2406
|
+
title: le.value
|
|
2407
|
+
}, null, 8, ["title"])) : D("", !0),
|
|
2408
|
+
f.value ? (b(), x(sn, {
|
|
2409
|
+
key: 1,
|
|
2410
|
+
invoice: f.value
|
|
2411
|
+
}, null, 8, ["invoice"])) : D("", !0)
|
|
2412
|
+
]),
|
|
2413
|
+
_: 2
|
|
2414
|
+
}, [
|
|
2415
|
+
_.value === "SUCCESS" || I.value ? {
|
|
2416
|
+
name: "footer",
|
|
2417
|
+
fn: y(() => [
|
|
2418
|
+
N("div", gn, [
|
|
2419
|
+
_.value === "SUCCESS" ? (b(), x(r(ie), {
|
|
2420
|
+
key: 0,
|
|
2421
|
+
size: "lg",
|
|
2422
|
+
loading: oe.value,
|
|
2423
|
+
onClick: Le
|
|
2424
|
+
}, {
|
|
2425
|
+
default: y(() => [
|
|
2426
|
+
q(R(r(T)), 1)
|
|
2427
|
+
]),
|
|
2428
|
+
_: 1
|
|
2429
|
+
}, 8, ["loading"])) : (b(), V(we, { key: 1 }, [
|
|
2430
|
+
E(r(ie), {
|
|
2431
|
+
size: "lg",
|
|
2432
|
+
disabled: ""
|
|
2433
|
+
}, {
|
|
2434
|
+
default: y(() => [
|
|
2435
|
+
q(R(r(T)), 1)
|
|
2436
|
+
]),
|
|
2437
|
+
_: 1
|
|
2438
|
+
}),
|
|
2439
|
+
E(r(ie), {
|
|
2440
|
+
size: "lg",
|
|
2441
|
+
intent: "subtle",
|
|
2442
|
+
onClick: Ye
|
|
2443
|
+
}, {
|
|
2444
|
+
default: y(() => [
|
|
2445
|
+
q(R(r(v)), 1)
|
|
2446
|
+
]),
|
|
2447
|
+
_: 1
|
|
2448
|
+
})
|
|
2449
|
+
], 64))
|
|
2450
|
+
])
|
|
2451
|
+
]),
|
|
2452
|
+
key: "0"
|
|
2453
|
+
} : void 0
|
|
2454
|
+
]), 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"]));
|
|
2455
|
+
}
|
|
2456
|
+
}), yn = ["AUTO_TOP_UP", "ADD_PAYMENT_METHOD"], bn = { class: "grid grid-cols-1 gap-4" }, wn = { class: "flex flex-col gap-2" }, Tn = /* @__PURE__ */ Y({
|
|
2457
|
+
__name: "AutoTopUpModal",
|
|
2458
|
+
props: {
|
|
2459
|
+
showModal: { type: Boolean },
|
|
2460
|
+
walletBalanceItem: { type: Object },
|
|
2461
|
+
topUpItem: { type: Object },
|
|
2462
|
+
paymentMethods: { type: Array },
|
|
2463
|
+
customer: { type: Object }
|
|
2464
|
+
},
|
|
2465
|
+
emits: ["saved", "close", "payment-success", "payment-failed"],
|
|
2466
|
+
setup(e, { emit: t }) {
|
|
2467
|
+
const o = e, n = t, { $t: a } = Q(), { formatOpenBalance: i } = Ue(), l = O("AUTO_TOP_UP"), s = u(() => i(o.walletBalanceItem)), m = u(() => ht(o.walletBalanceItem)), h = u(() => Tt(m.value)), M = u(() => It(o.walletBalanceItem)), A = u(() => Bt(M.value)), c = u(
|
|
2468
|
+
() => Dt(o.topUpItem, m.value)
|
|
2469
|
+
), w = O(), P = u(
|
|
2470
|
+
() => {
|
|
2471
|
+
var k;
|
|
2472
|
+
return !!h.value && !!c.value && !!((k = o.walletBalanceItem) != null && k.wallet_id);
|
|
2473
|
+
}
|
|
2474
|
+
), g = u(() => l.value === "AUTO_TOP_UP" && !P.value), C = O(), G = u(() => {
|
|
2475
|
+
var X, Z;
|
|
2476
|
+
const k = (Z = (X = w.value) == null ? void 0 : X.rule) == null ? void 0 : Z.topup_amount;
|
|
2477
|
+
return k != null && k.quantity && c.value ? [{ pricing_item_id: c.value.pricingItemId, flexible_amount: k }] : void 0;
|
|
2478
|
+
}), _ = u(() => {
|
|
2479
|
+
var k;
|
|
2480
|
+
return (k = c.value) == null ? void 0 : k.pricingPlanScheduleId;
|
|
2481
|
+
}), p = O(), { sortedPaymentMethods: S } = xt({
|
|
2482
|
+
paymentMethods: u(() => o.paymentMethods),
|
|
2483
|
+
selectedPaymentMethodId: p,
|
|
2484
|
+
preferredPaymentMethodId: u(() => {
|
|
2485
|
+
var k;
|
|
2486
|
+
return (k = M.value) == null ? void 0 : k.payment_method_id;
|
|
2487
|
+
})
|
|
2488
|
+
}), {
|
|
2489
|
+
paymentMethodOptions: I,
|
|
2490
|
+
settledOptions: f,
|
|
2491
|
+
isPending: U
|
|
2492
|
+
} = Ot({
|
|
2493
|
+
isOpen: u(() => o.showModal),
|
|
2494
|
+
customer: u(() => o.customer)
|
|
2495
|
+
}), {
|
|
2496
|
+
paneRef: K,
|
|
2497
|
+
isActive: te,
|
|
2498
|
+
isSaving: ve,
|
|
2499
|
+
open: fe,
|
|
2500
|
+
leave: H,
|
|
2501
|
+
submit: de
|
|
2502
|
+
} = Rt({ step: l, name: "ADD_PAYMENT_METHOD", returnTo: "AUTO_TOP_UP" }), { save: he, isSaving: ce } = Ft(), W = u(() => ve.value || ce.value), ne = Ie({
|
|
2503
|
+
paymentMethodId: u(() => p.value ?? null)
|
|
2504
|
+
}), pe = De(
|
|
2505
|
+
{
|
|
2506
|
+
paymentMethodId: {
|
|
2507
|
+
required: J.withMessage(
|
|
2508
|
+
() => a({
|
|
2509
|
+
defaultMessage: "Select a payment method to pay for automatic top-ups.",
|
|
2510
|
+
description: "Error shown in the auto top-up modal when no payment method is selected",
|
|
2511
|
+
id: "auto_topup_modal.payment_method.required"
|
|
2512
|
+
}),
|
|
2513
|
+
dt
|
|
2514
|
+
)
|
|
2515
|
+
}
|
|
2516
|
+
},
|
|
2517
|
+
ne
|
|
2518
|
+
), oe = u(
|
|
2519
|
+
() => l.value === "ADD_PAYMENT_METHOD" ? a({
|
|
2520
|
+
defaultMessage: "Add payment method",
|
|
2521
|
+
description: "Title of the auto top-up modal while the customer is adding a payment method",
|
|
2522
|
+
id: "auto_topup_modal.add_payment_method.title"
|
|
2523
|
+
}) : a({
|
|
2524
|
+
defaultMessage: "Automatic top-up",
|
|
2525
|
+
description: "Title of the automatic wallet top-up modal",
|
|
2526
|
+
id: "auto_topup_modal.title"
|
|
2527
|
+
})
|
|
2528
|
+
), ge = u(
|
|
2529
|
+
() => l.value === "ADD_PAYMENT_METHOD" ? a({
|
|
2530
|
+
defaultMessage: "This method pays for every automatic top-up.",
|
|
2531
|
+
description: "Subtitle of the auto top-up modal while the customer is adding a payment method",
|
|
2532
|
+
id: "auto_topup_modal.add_payment_method.subtitle"
|
|
2533
|
+
}) : a(
|
|
2534
|
+
{
|
|
2535
|
+
defaultMessage: "Your current balance is {balance}. Enable auto top-up so you can stay productive.",
|
|
2536
|
+
description: "Subtitle of the automatic wallet top-up modal, naming the balance",
|
|
2537
|
+
id: "auto_topup_modal.subtitle"
|
|
2538
|
+
},
|
|
2539
|
+
{ balance: s.value }
|
|
2540
|
+
)
|
|
2541
|
+
), d = u(
|
|
2542
|
+
() => l.value === "ADD_PAYMENT_METHOD" ? a({
|
|
2543
|
+
defaultMessage: "Back",
|
|
2544
|
+
description: "Button returning from adding a payment method to the auto top-up rule",
|
|
2545
|
+
id: "auto_topup_modal.add_payment_method.cancel"
|
|
2546
|
+
}) : a({
|
|
2547
|
+
defaultMessage: "Cancel",
|
|
2548
|
+
description: "Button dismissing the auto top-up modal",
|
|
2549
|
+
id: "auto_topup_modal.cancel"
|
|
2550
|
+
})
|
|
2551
|
+
), v = u(
|
|
2552
|
+
() => l.value === "ADD_PAYMENT_METHOD" ? a({
|
|
2553
|
+
defaultMessage: "Add payment method",
|
|
2554
|
+
description: "Button storing the payment method being added in the auto top-up modal",
|
|
2555
|
+
id: "auto_topup_modal.add_payment_method.confirm"
|
|
2556
|
+
}) : a({
|
|
2557
|
+
defaultMessage: "Save",
|
|
2558
|
+
description: "Button saving the automatic top-up rule",
|
|
2559
|
+
id: "auto_topup_modal.confirm"
|
|
2560
|
+
})
|
|
2561
|
+
);
|
|
2562
|
+
async function T() {
|
|
2563
|
+
var Z;
|
|
2564
|
+
if (pe.value.$touch(), W.value || !P.value)
|
|
2565
|
+
return;
|
|
2566
|
+
C.value = void 0;
|
|
2567
|
+
const { saved: k, error: X } = await he(
|
|
2568
|
+
Nt({
|
|
2569
|
+
rule: (Z = w.value) == null ? void 0 : Z.validate(),
|
|
2570
|
+
walletBalanceItem: o.walletBalanceItem,
|
|
2571
|
+
chargeTarget: c.value,
|
|
2572
|
+
paymentMethodId: p.value
|
|
2573
|
+
})
|
|
2574
|
+
);
|
|
2575
|
+
if (k) {
|
|
2576
|
+
n("saved"), n("close");
|
|
2577
|
+
return;
|
|
2578
|
+
}
|
|
2579
|
+
X && (C.value = a({
|
|
2580
|
+
defaultMessage: "We couldn't save your automatic top-up. Please try again.",
|
|
2581
|
+
description: "Error shown in the auto top-up modal when saving the rule failed",
|
|
2582
|
+
id: "auto_topup_modal.save_failed"
|
|
2583
|
+
}), n("payment-failed", X));
|
|
2584
|
+
}
|
|
2585
|
+
const B = () => {
|
|
2586
|
+
if (te.value) {
|
|
2587
|
+
de();
|
|
2588
|
+
return;
|
|
2589
|
+
}
|
|
2590
|
+
T();
|
|
2591
|
+
}, L = () => {
|
|
2592
|
+
H(), n("payment-success");
|
|
2593
|
+
}, le = () => {
|
|
2594
|
+
if (!W.value) {
|
|
2595
|
+
if (te.value) {
|
|
2596
|
+
H();
|
|
2597
|
+
return;
|
|
2598
|
+
}
|
|
2599
|
+
n("close");
|
|
2600
|
+
}
|
|
2601
|
+
}, Te = O(0);
|
|
2602
|
+
return j(
|
|
2603
|
+
() => o.showModal,
|
|
2604
|
+
(k) => {
|
|
2605
|
+
k && (l.value = "AUTO_TOP_UP", p.value = void 0, C.value = void 0, Te.value += 1);
|
|
2606
|
+
}
|
|
2607
|
+
), (k, X) => (b(), x($t, {
|
|
2608
|
+
ref_key: "addPaymentMethodRef",
|
|
2609
|
+
ref: K,
|
|
2610
|
+
"show-modal": e.showModal,
|
|
2611
|
+
title: oe.value,
|
|
2612
|
+
"sub-title": ge.value,
|
|
2613
|
+
"cancel-button-text": d.value,
|
|
2614
|
+
"confirm-button-text": v.value,
|
|
2615
|
+
"is-pending": W.value,
|
|
2616
|
+
panes: r(yn),
|
|
2617
|
+
step: l.value,
|
|
2618
|
+
"add-payment-method-pane": "ADD_PAYMENT_METHOD",
|
|
2619
|
+
customer: e.customer,
|
|
2620
|
+
"payment-method-options": r(I),
|
|
2621
|
+
"is-payment-method-options-pending": r(U),
|
|
2622
|
+
onConfirm: B,
|
|
2623
|
+
onCancel: le,
|
|
2624
|
+
onPaymentSuccess: L,
|
|
2625
|
+
onPaymentFailed: X[1] || (X[1] = (Z) => k.$emit("payment-failed", Z))
|
|
2626
|
+
}, re({
|
|
2627
|
+
AUTO_TOP_UP: y(() => [
|
|
2628
|
+
N("div", bn, [
|
|
2629
|
+
P.value ? D("", !0) : (b(), x(r(mo), {
|
|
2630
|
+
key: 0,
|
|
2631
|
+
type: "warning",
|
|
2632
|
+
class: "sv-auto-topup-modal__unavailable",
|
|
2633
|
+
title: r(a)({
|
|
2634
|
+
defaultMessage: "Automatic top-up is not available for this wallet.",
|
|
2635
|
+
description: "Shown in the auto top-up modal when the wallet has nothing an automatic top-up could charge",
|
|
2636
|
+
id: "auto_topup_modal.unavailable"
|
|
2637
|
+
})
|
|
2638
|
+
}, null, 8, ["title"])),
|
|
2639
|
+
h.value ? (b(), x(Et, ae({
|
|
2640
|
+
key: Te.value,
|
|
2641
|
+
ref_key: "autoTopUpFormRef",
|
|
2642
|
+
ref: w,
|
|
2643
|
+
class: "sv-auto-topup-modal__rule"
|
|
2644
|
+
}, h.value, {
|
|
2645
|
+
config: A.value,
|
|
2646
|
+
"always-enabled": "",
|
|
2647
|
+
disabled: W.value
|
|
2648
|
+
}), null, 16, ["config", "disabled"])) : D("", !0),
|
|
2649
|
+
E(Mt, {
|
|
2650
|
+
"pricing-plan-schedule-id": _.value,
|
|
2651
|
+
"pricing-items": G.value
|
|
2652
|
+
}, null, 8, ["pricing-plan-schedule-id", "pricing-items"]),
|
|
2653
|
+
E(vt, {
|
|
2654
|
+
modelValue: p.value,
|
|
2655
|
+
"onUpdate:modelValue": X[0] || (X[0] = (Z) => p.value = Z),
|
|
2656
|
+
class: "sv-auto-topup-modal__payment-method",
|
|
2657
|
+
"payment-methods": r(S),
|
|
2658
|
+
"payment-method-options": r(f),
|
|
2659
|
+
disabled: W.value,
|
|
2660
|
+
error: r(pe).paymentMethodId.$errors,
|
|
2661
|
+
label: r(a)({
|
|
2662
|
+
defaultMessage: "Pay automatic top-ups with",
|
|
2663
|
+
description: "Label above the payment method an automatic top-up is charged to",
|
|
2664
|
+
id: "auto_topup_modal.payment_method.label"
|
|
2665
|
+
}),
|
|
2666
|
+
onAddPaymentMethod: r(fe)
|
|
2667
|
+
}, null, 8, ["modelValue", "payment-methods", "payment-method-options", "disabled", "error", "label", "onAddPaymentMethod"]),
|
|
2668
|
+
C.value ? (b(), x(r(me), {
|
|
2669
|
+
key: 2,
|
|
2670
|
+
class: "sv-auto-topup-modal__error sv-error",
|
|
2671
|
+
title: C.value
|
|
2672
|
+
}, null, 8, ["title"])) : D("", !0)
|
|
2673
|
+
])
|
|
2674
|
+
]),
|
|
2675
|
+
_: 2
|
|
2676
|
+
}, [
|
|
2677
|
+
g.value ? {
|
|
2678
|
+
name: "footer",
|
|
2679
|
+
fn: y(() => [
|
|
2680
|
+
N("div", wn, [
|
|
2681
|
+
E(r(ie), {
|
|
2682
|
+
size: "lg",
|
|
2683
|
+
disabled: ""
|
|
2684
|
+
}, {
|
|
2685
|
+
default: y(() => [
|
|
2686
|
+
q(R(v.value), 1)
|
|
2687
|
+
]),
|
|
2688
|
+
_: 1
|
|
2689
|
+
}),
|
|
2690
|
+
E(r(ie), {
|
|
2691
|
+
size: "lg",
|
|
2692
|
+
intent: "subtle",
|
|
2693
|
+
onClick: le
|
|
2694
|
+
}, {
|
|
2695
|
+
default: y(() => [
|
|
2696
|
+
q(R(d.value), 1)
|
|
2697
|
+
]),
|
|
2698
|
+
_: 1
|
|
2699
|
+
})
|
|
2700
|
+
])
|
|
2701
|
+
]),
|
|
2702
|
+
key: "0"
|
|
2703
|
+
} : void 0
|
|
2704
|
+
]), 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"]));
|
|
2705
|
+
}
|
|
2706
|
+
});
|
|
2707
|
+
function Mn() {
|
|
2708
|
+
const { deactivateAutoTopUpConfig: e } = kt(), t = Ae(), o = O(!1);
|
|
2709
|
+
return { deactivate: async (a) => {
|
|
2710
|
+
if (!a || o.value)
|
|
2711
|
+
return !1;
|
|
2712
|
+
o.value = !0;
|
|
2713
|
+
try {
|
|
2714
|
+
return await e(a), !0;
|
|
2715
|
+
} catch (i) {
|
|
2716
|
+
return t.error(
|
|
2717
|
+
"AUTO_TOP_UP_CANCELLATION_FAILED",
|
|
2718
|
+
"Failed to turn off a wallet's automatic top-up",
|
|
2719
|
+
{},
|
|
2720
|
+
i
|
|
2721
|
+
), !1;
|
|
2722
|
+
} finally {
|
|
2723
|
+
o.value = !1;
|
|
2724
|
+
}
|
|
2725
|
+
}, isDeactivating: o };
|
|
2726
|
+
}
|
|
2727
|
+
const An = { class: "sv-auto-topup-cancellation-modal sv-auto-topup-cancellation-modal__body flex flex-col gap-3" }, Un = /* @__PURE__ */ Y({
|
|
2728
|
+
__name: "AutoTopUpCancellationModal",
|
|
2729
|
+
props: {
|
|
2730
|
+
showModal: { type: Boolean },
|
|
2731
|
+
config: { type: Object }
|
|
2732
|
+
},
|
|
2733
|
+
emits: ["confirmed", "close"],
|
|
2734
|
+
setup(e, { emit: t }) {
|
|
2735
|
+
const o = e, n = t, { $t: a } = Q(), { formatValue: i } = Ue(), { deactivate: l, isDeactivating: s } = Mn(), m = O(!1);
|
|
2736
|
+
j(
|
|
2737
|
+
() => o.showModal,
|
|
2738
|
+
(c) => {
|
|
2739
|
+
c && (m.value = !1);
|
|
2740
|
+
}
|
|
2741
|
+
);
|
|
2742
|
+
const h = u(() => {
|
|
2743
|
+
var P, g;
|
|
2744
|
+
const c = (P = o.config) == null ? void 0 : P.threshold, w = (g = o.config) == null ? void 0 : g.topup_amount;
|
|
2745
|
+
return !(c != null && c.amount) && !(c != null && c.credits) ? a({
|
|
2746
|
+
defaultMessage: "Your balance will no longer be topped up automatically. You can still top up whenever you want to.",
|
|
2747
|
+
description: "Explanation in the modal that turns a wallet automatic top-up off",
|
|
2748
|
+
id: "auto_topup_cancellation_modal.explanation"
|
|
2749
|
+
}) : w ? a(
|
|
2750
|
+
{
|
|
2751
|
+
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.",
|
|
2752
|
+
description: "Explanation in the modal that turns a wallet automatic top-up off, naming what it charged and when",
|
|
2753
|
+
id: "auto_topup_cancellation_modal.explanation_with_amount"
|
|
2754
|
+
},
|
|
2755
|
+
{ amount: i({ amount: w }), threshold: i(c) }
|
|
2756
|
+
) : a(
|
|
2757
|
+
{
|
|
2758
|
+
defaultMessage: "Your balance will no longer be topped up automatically when it falls below {threshold}. You can still top up whenever you want to.",
|
|
2759
|
+
description: "Explanation in the modal that turns a wallet automatic top-up off, naming the threshold",
|
|
2760
|
+
id: "auto_topup_cancellation_modal.explanation_with_threshold"
|
|
2761
|
+
},
|
|
2762
|
+
{ threshold: i(c) }
|
|
2763
|
+
);
|
|
2764
|
+
}), M = async () => {
|
|
2765
|
+
var w;
|
|
2766
|
+
const c = (w = o.config) == null ? void 0 : w.id;
|
|
2767
|
+
if (!(!c || s.value)) {
|
|
2768
|
+
if (m.value = !1, !await l(c)) {
|
|
2769
|
+
m.value = !0;
|
|
2770
|
+
return;
|
|
2771
|
+
}
|
|
2772
|
+
n("confirmed"), n("close");
|
|
2773
|
+
}
|
|
2774
|
+
}, A = () => {
|
|
2775
|
+
s.value || n("close");
|
|
2776
|
+
};
|
|
2777
|
+
return (c, w) => (b(), x(r(ft), {
|
|
2778
|
+
size: "sm",
|
|
2779
|
+
"show-modal": e.showModal,
|
|
2780
|
+
"is-loading": r(s),
|
|
2781
|
+
"no-click-away": r(s),
|
|
2782
|
+
"no-backdrop-close": r(s),
|
|
2783
|
+
title: r(a)({
|
|
2784
|
+
defaultMessage: "Turn off automatic top-up",
|
|
2785
|
+
description: "Title of the modal that turns a wallet automatic top-up off",
|
|
2786
|
+
id: "auto_topup_cancellation_modal.title"
|
|
2787
|
+
}),
|
|
2788
|
+
"confirm-button-text": r(a)({
|
|
2789
|
+
defaultMessage: "Yes, turn it off",
|
|
2790
|
+
description: "Button confirming that a wallet automatic top-up is turned off",
|
|
2791
|
+
id: "auto_topup_cancellation_modal.confirm"
|
|
2792
|
+
}),
|
|
2793
|
+
"cancel-button-text": r(a)({
|
|
2794
|
+
defaultMessage: "Cancel",
|
|
2795
|
+
description: "Button dismissing the modal that turns a wallet automatic top-up off",
|
|
2796
|
+
id: "auto_topup_cancellation_modal.cancel"
|
|
2797
|
+
}),
|
|
2798
|
+
onConfirm: M,
|
|
2799
|
+
onClose: A
|
|
2800
|
+
}, {
|
|
2801
|
+
body: y(() => [
|
|
2802
|
+
N("div", An, [
|
|
2803
|
+
E(r(ee), {
|
|
2804
|
+
variant: "body-sm",
|
|
2805
|
+
color: "subtle",
|
|
2806
|
+
tag: "p",
|
|
2807
|
+
class: "sv-auto-topup-cancellation-modal__explanation"
|
|
2808
|
+
}, {
|
|
2809
|
+
default: y(() => [
|
|
2810
|
+
q(R(h.value), 1)
|
|
2811
|
+
]),
|
|
2812
|
+
_: 1
|
|
2813
|
+
}),
|
|
2814
|
+
m.value ? (b(), x(r(me), {
|
|
2815
|
+
key: 0,
|
|
2816
|
+
class: "sv-auto-topup-cancellation-modal__error sv-error",
|
|
2817
|
+
title: r(a)({
|
|
2818
|
+
defaultMessage: "Could not turn off the automatic top-up. Please try again later.",
|
|
2819
|
+
description: "Error shown when turning a wallet automatic top-up off failed",
|
|
2820
|
+
id: "auto_topup_cancellation_modal.failed"
|
|
2821
|
+
})
|
|
2822
|
+
}, null, 8, ["title"])) : D("", !0)
|
|
2823
|
+
])
|
|
2824
|
+
]),
|
|
2825
|
+
_: 1
|
|
2826
|
+
}, 8, ["show-modal", "is-loading", "no-click-away", "no-backdrop-close", "title", "confirm-button-text", "cancel-button-text"]));
|
|
2827
|
+
}
|
|
2828
|
+
}), oa = /* @__PURE__ */ Y({
|
|
2829
|
+
inheritAttrs: !1,
|
|
2830
|
+
__name: "CustomerWalletBalances",
|
|
2831
|
+
props: {
|
|
2832
|
+
hasError: { type: Boolean },
|
|
2833
|
+
isLoading: { type: Boolean },
|
|
2834
|
+
walletBalances: { type: Array },
|
|
2835
|
+
showTopUpButton: { type: Boolean },
|
|
2836
|
+
customer: { type: Object },
|
|
2837
|
+
paymentMethods: { type: Array },
|
|
2838
|
+
subscriptions: { type: Array }
|
|
2839
|
+
},
|
|
2840
|
+
emits: ["top-up-charged", "auto-top-up-saved", "auto-top-up-cancelled", "payment-method-stored", "payment-failed"],
|
|
2841
|
+
setup(e, { emit: t }) {
|
|
2842
|
+
const o = e, n = t, { $t: a } = Q(), i = u(
|
|
2843
|
+
() => xo(o.walletBalances, o.subscriptions)
|
|
2844
|
+
), l = O(), s = u(
|
|
2845
|
+
() => Qe(i.value, l.value)
|
|
2846
|
+
), m = u(() => !!s.value), h = O(), M = u(() => !!h.value), A = u(
|
|
2847
|
+
() => Qe(i.value, h.value)
|
|
2848
|
+
), c = O(), w = u(() => !!c.value);
|
|
2849
|
+
return (P, g) => (b(), V(we, null, [
|
|
2850
|
+
e.isLoading ? (b(), x(lt, ae({
|
|
2851
|
+
key: 0,
|
|
2852
|
+
variant: "section"
|
|
2853
|
+
}, P.$attrs, { class: "sv-wallet-balances sv-root sv-component sv-loading min-h-48" }), null, 16)) : e.hasError ? (b(), x(r(me), ae({ key: 1 }, P.$attrs, {
|
|
2854
|
+
class: "sv-wallet-balances sv-root sv-component sv-error",
|
|
2855
|
+
title: r(a)({
|
|
2856
|
+
defaultMessage: "Could not load wallet balances",
|
|
2857
|
+
description: "Error shown when wallet balances fail to load",
|
|
2858
|
+
id: "wallet_balance.load_failed"
|
|
2859
|
+
})
|
|
2860
|
+
}), null, 16, ["title"])) : e.walletBalances.length > 0 ? (b(), x(r(Co), ae({ key: 2 }, P.$attrs, {
|
|
2861
|
+
class: "sv-wallet-balances sv-root sv-component",
|
|
2862
|
+
"customer-wallet-balances": i.value,
|
|
2863
|
+
"show-auto-top-up": e.showTopUpButton,
|
|
2864
|
+
"show-manual-top-up": e.showTopUpButton,
|
|
2865
|
+
title: r(a)(
|
|
2866
|
+
{
|
|
2867
|
+
defaultMessage: "{count, plural, one {Wallet} other {Wallets}}",
|
|
2868
|
+
description: "Title for the wallets block on the customer overview page",
|
|
2869
|
+
id: "customer_overview.wallet_balances_block.title"
|
|
2870
|
+
},
|
|
2871
|
+
{ count: String(e.walletBalances.length) }
|
|
2872
|
+
),
|
|
2873
|
+
onTopUp: g[0] || (g[0] = (C) => l.value = C),
|
|
2874
|
+
onAutoTopUp: g[1] || (g[1] = (C) => h.value = C),
|
|
2875
|
+
onCancelAutoTopUp: g[2] || (g[2] = (C) => c.value = C)
|
|
2876
|
+
}), null, 16, ["customer-wallet-balances", "show-auto-top-up", "show-manual-top-up", "title"])) : D("", !0),
|
|
2877
|
+
e.showTopUpButton ? (b(), x(_n, {
|
|
2878
|
+
key: 3,
|
|
2879
|
+
"show-modal": m.value,
|
|
2880
|
+
"selected-balance-item": s.value,
|
|
2881
|
+
"payment-methods": e.paymentMethods,
|
|
2882
|
+
customer: e.customer,
|
|
2883
|
+
subscriptions: e.subscriptions,
|
|
2884
|
+
onClose: g[3] || (g[3] = (C) => l.value = void 0),
|
|
2885
|
+
onConfirm: g[4] || (g[4] = (C) => n("top-up-charged")),
|
|
2886
|
+
onAutoTopUpSaved: g[5] || (g[5] = (C) => n("auto-top-up-saved")),
|
|
2887
|
+
onPaymentSuccess: g[6] || (g[6] = (C) => n("payment-method-stored")),
|
|
2888
|
+
onPaymentFailed: g[7] || (g[7] = (C) => n("payment-failed", C))
|
|
2889
|
+
}, null, 8, ["show-modal", "selected-balance-item", "payment-methods", "customer", "subscriptions"])) : D("", !0),
|
|
2890
|
+
e.showTopUpButton ? (b(), x(Tn, {
|
|
2891
|
+
key: 4,
|
|
2892
|
+
"show-modal": M.value,
|
|
2893
|
+
"wallet-balance-item": A.value,
|
|
2894
|
+
"top-up-item": h.value,
|
|
2895
|
+
"payment-methods": e.paymentMethods,
|
|
2896
|
+
customer: e.customer,
|
|
2897
|
+
onClose: g[8] || (g[8] = (C) => h.value = void 0),
|
|
2898
|
+
onSaved: g[9] || (g[9] = (C) => n("auto-top-up-saved")),
|
|
2899
|
+
onPaymentSuccess: g[10] || (g[10] = (C) => n("payment-method-stored")),
|
|
2900
|
+
onPaymentFailed: g[11] || (g[11] = (C) => n("payment-failed", C))
|
|
2901
|
+
}, null, 8, ["show-modal", "wallet-balance-item", "top-up-item", "payment-methods", "customer"])) : D("", !0),
|
|
2902
|
+
e.showTopUpButton ? (b(), x(Un, {
|
|
2903
|
+
key: 5,
|
|
2904
|
+
"show-modal": w.value,
|
|
2905
|
+
config: c.value,
|
|
2906
|
+
onClose: g[12] || (g[12] = (C) => c.value = void 0),
|
|
2907
|
+
onConfirmed: g[13] || (g[13] = (C) => n("auto-top-up-cancelled"))
|
|
2908
|
+
}, null, 8, ["show-modal", "config"])) : D("", !0)
|
|
2909
|
+
], 64));
|
|
2910
|
+
}
|
|
2911
|
+
});
|
|
2912
|
+
export {
|
|
2913
|
+
oa as _,
|
|
2914
|
+
Rt as a,
|
|
2915
|
+
Ot as b,
|
|
2916
|
+
zo as c,
|
|
2917
|
+
$t as d,
|
|
2918
|
+
vn as g,
|
|
2919
|
+
ta as i,
|
|
2920
|
+
ea as u
|
|
2921
|
+
};
|