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