@solvimon/solvimon-web 0.1.0-alpha.26 → 0.1.0-alpha.28

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