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