@solvimon/solvimon-web 0.1.0-alpha.16 → 0.1.0-alpha.18

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 (175) hide show
  1. package/README.md +33 -31
  2. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-C2IRj-FB.mjs +238 -0
  3. package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Rub9ifBk.js +1 -0
  4. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BYBAO4Au.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BWnZ98RQ.mjs} +2 -2
  5. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BI3Lg7nO.js → BillingInformation.vue_vue_type_script_setup_true_lang-DurgWlLC.js} +1 -1
  6. package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CTnn1gkW.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs} +3 -3
  7. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Df7CsbiW.js +1 -0
  8. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs +2654 -0
  9. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-mM5udvi8.js +1 -0
  10. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BIpg-MSJ.mjs +53 -0
  11. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BM3p8Pk8.js +1 -0
  12. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D5eSNYH2.js +1 -0
  13. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-ryvFEQMV.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DbY35gE_.mjs} +1 -1
  14. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-DdpPrYxi.js → InvoiceHeader.vue_vue_type_script_setup_true_lang-Ci8r6tuC.js} +1 -1
  15. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-bAiAbtMi.mjs → InvoiceHeader.vue_vue_type_script_setup_true_lang-jshby9pF.mjs} +1 -1
  16. package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-CNKxTtO7.js +1 -0
  17. package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-DBMgilG2.mjs +153 -0
  18. package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs +52 -0
  19. package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-D6lpD1zo.js +1 -0
  20. package/dist/{PaymentHistoryBlock-BKMttUyk.mjs → PaymentHistoryBlock-Bxr8lUGs.mjs} +1 -1
  21. package/dist/{PaymentHistoryBlock-BGbTy4Se.js → PaymentHistoryBlock-COjIVYX4.js} +1 -1
  22. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Bmgx7PSt.js +1 -0
  23. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CDjGab5p.mjs} +1 -1
  24. package/dist/{PaymentIntegrationForm-D4QupHWl.js → PaymentIntegrationForm-BSauhuKv.js} +1 -1
  25. package/dist/{PaymentIntegrationForm-CypW6fZY.mjs → PaymentIntegrationForm-PIT8gHYN.mjs} +1 -1
  26. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js +1 -0
  27. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs +148 -0
  28. package/dist/PaymentIntegrationFormAdyen-B-Jbu2hU.js +1 -0
  29. package/dist/PaymentIntegrationFormAdyen-Cjj9aK0E.mjs +729 -0
  30. package/dist/PaymentIntegrationFormStripe-Bnn8S1o5.js +1 -0
  31. package/dist/PaymentIntegrationFormStripe-arpua_ZT.mjs +545 -0
  32. package/dist/PaymentMethodForm-B7T5rrNz.mjs +4 -0
  33. package/dist/PaymentMethodForm-CLz3ZS-b.js +1 -0
  34. package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-B8eNptZp.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-C4Zf92QP.mjs} +25 -14
  35. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-UH9AVXnG.js +1 -0
  36. package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-BUTqn4Ey.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-CIIt6fGp.mjs} +77 -31
  37. package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-ifai5HVr.js +1 -0
  38. package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DaWlLor0.mjs} +115 -68
  39. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DdUoeTUL.js +1 -0
  40. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-CyYhYYRp.mjs +37 -0
  41. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DdjYVNku.js +1 -0
  42. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-Cu55ZvCH.js +1 -0
  43. package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-z8P1u1Gi.mjs +100 -0
  44. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-BKDMwuyh.js +1 -0
  45. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DB1p61kZ.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BOUSk2ZB.mjs} +22 -119
  46. package/dist/adyen-BMDZQBUG.js +1 -0
  47. package/dist/{url-1Lbg5Yni.mjs → adyen-Ba-mF3Jy.mjs} +31 -73
  48. package/dist/component--Y7Igv5i.mjs +1022 -0
  49. package/dist/component-DIy1hvJM.js +1 -0
  50. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
  51. package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
  52. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
  53. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +4 -4
  54. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
  55. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
  56. package/dist/components/Invoice/Invoice.cjs.js +1 -1
  57. package/dist/components/Invoice/Invoice.es.js +7 -7
  58. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  59. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
  60. package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
  61. package/dist/components/InvoiceHeader/InvoiceHeader.es.js +4 -4
  62. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
  63. package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
  64. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  65. package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -3
  66. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  67. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +6 -6
  68. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
  69. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +7 -58
  70. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
  71. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
  72. package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
  73. package/dist/components/WalletBalances/WalletBalances.es.js +25 -9
  74. package/dist/core/action-request.types.d.ts +3 -15
  75. package/dist/core/index.cjs.js +1 -1
  76. package/dist/core/index.es.js +1 -1
  77. package/dist/core/types.d.ts +4 -2
  78. package/dist/{customer-Bv_fqXzO.mjs → customer-DovIxTG1.mjs} +1 -1
  79. package/dist/{customer-_W8gIX5m.js → customer-brfznoHY.js} +1 -1
  80. package/dist/en-US-BvOHPudj.js +1 -0
  81. package/dist/{en-US-DAgOSlgv.mjs → en-US-CXDO3qhq.mjs} +121 -36
  82. package/dist/index-BMWWP8xj.js +1 -0
  83. package/dist/index-Do7kzLpg.mjs +265 -0
  84. package/dist/index.cjs.js +1 -1
  85. package/dist/index.d.ts +2 -1
  86. package/dist/index.es.js +7 -4
  87. package/dist/invoices-Cf3dSYSj.js +1 -0
  88. package/dist/{invoices-BGb0AwVF.mjs → invoices-Dk-z04lg.mjs} +32 -16
  89. package/dist/{nl-NL-DCsmrA8A.mjs → nl-NL-BgL_PuBn.mjs} +126 -40
  90. package/dist/nl-NL-COGUFg60.js +1 -0
  91. package/dist/{paymentMethods-DvqlWe96.mjs → paymentMethods-BnF1XYS1.mjs} +21 -5
  92. package/dist/paymentMethods-DVDC_WfL.js +1 -0
  93. package/dist/{payments-DMDDI3MK.js → payments-DVZFO5yb.js} +1 -1
  94. package/dist/{payments-CpzTVrQM.mjs → payments-TnRjtlOw.mjs} +1 -1
  95. package/dist/pricing-CuYndX6t.js +1 -0
  96. package/dist/pricing-GwLCiSzs.mjs +19 -0
  97. package/dist/pricingPlanSchedule-B9HFiXy-.js +1 -0
  98. package/dist/pricingPlanSchedule-CXG3CQ61.mjs +146 -0
  99. package/dist/{registry-B-If1W_u.mjs → registry-Ck0Gb6rj.mjs} +7 -4
  100. package/dist/registry-Cra6yoB4.js +1 -0
  101. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  102. package/dist/screens/Checkout/Checkout.es.js +429 -689
  103. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
  104. package/dist/screens/CustomerOverview/CustomerOverview.es.js +61 -39
  105. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
  106. package/dist/screens/PayInvoice/PayInvoice.es.js +30 -13
  107. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
  108. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +28 -18
  109. package/dist/screens/SubscriptionDetails/SubscriptionDetails.ce.d.ts +3 -0
  110. package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs.js +1 -0
  111. package/dist/screens/SubscriptionDetails/SubscriptionDetails.es.js +889 -0
  112. package/dist/screens/SubscriptionManagement/SubscriptionManagement.ce.d.ts +3 -0
  113. package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs.js +1 -0
  114. package/dist/screens/SubscriptionManagement/SubscriptionManagement.es.js +716 -0
  115. package/dist/solvimon-web.css +1 -1
  116. package/dist/subscription-C41lG-rH.mjs +89 -0
  117. package/dist/subscription-b0OPx8Du.js +1 -0
  118. package/dist/subscriptions-BFCKVHnP.js +1 -0
  119. package/dist/subscriptions-vEE4Y7qm.mjs +58 -0
  120. package/dist/{useActionDispatchProvider-Dz8-e4gZ.mjs → useActionDispatchProvider-BlEf-RZ5.mjs} +1 -1
  121. package/dist/{useActionDispatchProvider-BHTknMoH.js → useActionDispatchProvider-aJOy3kr1.js} +1 -1
  122. package/dist/{useCustomer-Z24KchWC.js → useCustomer-C1XTqmrQ.js} +1 -1
  123. package/dist/{useCustomer-VVJi8z2w.mjs → useCustomer-Cw8LXT6S.mjs} +2 -2
  124. package/dist/{useIncrementalLoading-DmOT2MXH.mjs → useIncrementalLoading-8WtKZ-mP.mjs} +2 -2
  125. package/dist/useIncrementalLoading-CkY2klIW.js +1 -0
  126. package/dist/{useInvoiceData-Bl87gzIS.js → useInvoiceData-BrxMo4Zt.js} +1 -1
  127. package/dist/{useInvoiceData-Di5pLPM0.mjs → useInvoiceData-Cy_ysMsq.mjs} +2 -2
  128. package/dist/{useInvoicesList-z19cteaD.mjs → useInvoicesList-DMsZn1tE.mjs} +4 -4
  129. package/dist/useInvoicesList-DmisMQzy.js +1 -0
  130. package/dist/{useLoadInitialData-CkpryfjF.mjs → useLoadInitialData-BP1v7qhd.mjs} +1 -1
  131. package/dist/{useLoadInitialData-CTqfiMTN.js → useLoadInitialData-_BjCD0Jc.js} +1 -1
  132. package/dist/{usePaymentMethodOptions-BoGHJjng.mjs → usePaymentMethodOptions-CWfGvW0U.mjs} +9 -3
  133. package/dist/{usePaymentMethodOptions-BsCZnCQW.js → usePaymentMethodOptions-xeSTmaVo.js} +1 -1
  134. package/dist/{usePaymentMethods-AC-4rrR9.js → usePaymentMethods-CAFMvSOr.js} +1 -1
  135. package/dist/{usePaymentMethods-ocHmNoP7.mjs → usePaymentMethods-Cyk4cjoE.mjs} +2 -2
  136. package/dist/{usePayments-CgXZeWrU.js → usePayments-BieVBaz-.js} +1 -1
  137. package/dist/{usePayments-D85eB5l4.mjs → usePayments-D88XSZfS.mjs} +10 -4
  138. package/dist/{usePortal-B1O1zgdV.mjs → usePortal-0NDlbFr9.mjs} +1 -1
  139. package/dist/{usePortal-DVD7PcWI.js → usePortal-B954nyEB.js} +1 -1
  140. package/dist/{useService-CHrkefKd.js → useService-BiljI7XA.js} +1 -1
  141. package/dist/{useService-DF57xuDd.mjs → useService-CqfJi5ST.mjs} +1 -1
  142. package/dist/useSubscription-9rJpFNUF.mjs +29 -0
  143. package/dist/useSubscription-k3limdu_.js +1 -0
  144. package/dist/vendor-ui-Dfh3_g4q.js +1 -0
  145. package/dist/{vendor-ui-B8IlviSs.mjs → vendor-ui-ItGf7wJV.mjs} +8006 -6329
  146. package/package.json +23 -9
  147. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-C_uHr21N.js +0 -1
  148. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DU6X3zxr.js +0 -1
  149. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js +0 -1
  150. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BBEM-YPz.js +0 -1
  151. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs +0 -1537
  152. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-eWmC5GOT.js +0 -1
  153. package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-Be_fF-R_.js +0 -1
  154. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js +0 -1
  155. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-56vu59V4.js +0 -1
  156. package/dist/component-Bg2JVC_O.mjs +0 -933
  157. package/dist/component-Bs8oszfD.js +0 -1
  158. package/dist/en-US-C0gIE4Q1.js +0 -1
  159. package/dist/index-CzL1ZcGi.mjs +0 -85
  160. package/dist/index-DRdBmZ2-.js +0 -1
  161. package/dist/invoices-D-OKipCg.js +0 -1
  162. package/dist/nl-NL-Br7muSHK.js +0 -1
  163. package/dist/paymentMethods-DIbB759g.js +0 -1
  164. package/dist/registry-uG2isab0.js +0 -1
  165. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +0 -3
  166. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +0 -1
  167. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +0 -1102
  168. package/dist/subscriptions-BPYyv09M.mjs +0 -75
  169. package/dist/subscriptions-CC61I6Nj.js +0 -1
  170. package/dist/url-B6-3PkW2.js +0 -1
  171. package/dist/useIncrementalLoading-CuSndpP2.js +0 -1
  172. package/dist/useInvoicesList-CFk-_oVK.js +0 -1
  173. package/dist/useWalletBalanceItems-BL-R5foK.js +0 -1
  174. package/dist/useWalletBalanceItems-COQDLfoZ.mjs +0 -109
  175. package/dist/vendor-ui-C3Tq-qY_.js +0 -1
@@ -0,0 +1,716 @@
1
+ import { ref, defineComponent, useModel, computed, watch, openBlock, createElementBlock, withModifiers, createElementVNode, createVNode, unref, mergeModels, inject, createBlock, withCtx, renderSlot, createTextVNode, toDisplayString, createCommentVNode, Fragment } from "vue";
2
+ import { u as useIntl, $ as _sfc_main$8, a0 as _sfc_main$a, b as _sfc_main$b, D as _sfc_main$c, a as _sfc_main$e, a1 as _sfc_main$f, M as Modal, k as _sfc_main$i } from "../../vendor-ui-ItGf7wJV.mjs";
3
+ import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
4
+ import { a as useLogger, c as createRequestService, u as useConfig, T as TRANSLATION_SETTINGS_KEY, _ as _sfc_main$k, d as defineCustomElement, g as getComponentName } from "../../component--Y7Igv5i.mjs";
5
+ import { u as useActionDispatchProvider } from "../../useActionDispatchProvider-BlEf-RZ5.mjs";
6
+ import { u as usePortal } from "../../usePortal-0NDlbFr9.mjs";
7
+ import { u as useSubscription } from "../../useSubscription-9rJpFNUF.mjs";
8
+ import { u as useCustomer } from "../../useCustomer-Cw8LXT6S.mjs";
9
+ import { u as usePaymentMethods } from "../../usePaymentMethods-Cyk4cjoE.mjs";
10
+ import { u as usePaymentMethodOptions } from "../../usePaymentMethodOptions-CWfGvW0U.mjs";
11
+ import { u as useLoadInitialData } from "../../useLoadInitialData-BP1v7qhd.mjs";
12
+ import { c as createInvoicesService } from "../../invoices-Dk-z04lg.mjs";
13
+ import { b as getScheduleCustomizations, c as getActiveDefaultScheduleInfo, d as getPricingGroupByPricingId } from "../../pricingPlanSchedule-CXG3CQ61.mjs";
14
+ import { _ as _sfc_main$7, a as _sfc_main$j } from "../../SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DaWlLor0.mjs";
15
+ import { _ as _sfc_main$9, a as _sfc_main$h } from "../../AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-C2IRj-FB.mjs";
16
+ import { _ as _sfc_main$d } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
17
+ import { _ as _sfc_main$g } from "../../PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs";
18
+ function useSubscriptionUpgradePreview() {
19
+ const { getInvoicePreview } = createInvoicesService();
20
+ const logger = useLogger();
21
+ const invoice = ref();
22
+ const isPending = ref(false);
23
+ const error = ref();
24
+ let latestRequestId = 0;
25
+ const load = async ({
26
+ subscription,
27
+ enabledPricingIds
28
+ }) => {
29
+ const customizations = getScheduleCustomizations({
30
+ enabledPricings: enabledPricingIds.map((pricingId) => ({ pricing_id: pricingId })),
31
+ pricingPlanScheduleInfos: subscription.pricing_plan_schedule_infos
32
+ });
33
+ if (!customizations) {
34
+ invoice.value = void 0;
35
+ return;
36
+ }
37
+ const requestId = ++latestRequestId;
38
+ isPending.value = true;
39
+ error.value = void 0;
40
+ try {
41
+ const response = await getInvoicePreview({
42
+ // The subscription is running already, so it is priced as itself rather than as the
43
+ // template for a new one — and the customer it is invoiced to is known.
44
+ forExistingSubscription: true,
45
+ pricingPlanSubscriptionId: subscription.id,
46
+ customizations
47
+ });
48
+ if (requestId !== latestRequestId) return;
49
+ invoice.value = response.invoice;
50
+ } catch (previewError) {
51
+ if (requestId !== latestRequestId) return;
52
+ logger.error(
53
+ "INVOICE_PREVIEW_FAILED",
54
+ "Failed to preview the subscription upgrade",
55
+ {},
56
+ previewError
57
+ );
58
+ error.value = previewError;
59
+ invoice.value = void 0;
60
+ } finally {
61
+ if (requestId === latestRequestId) {
62
+ isPending.value = false;
63
+ }
64
+ }
65
+ };
66
+ return { invoice, isPending, error, load };
67
+ }
68
+ function createPricingPlanSchedulesService() {
69
+ const request = createRequestService();
70
+ const config = useConfig();
71
+ function getOnDemandPricingItems({
72
+ scheduleId
73
+ }) {
74
+ return request({
75
+ url: `${config.apiUrls.config}/portal/pricing-plan-schedules/${scheduleId}/on-demand-pricing-items`
76
+ });
77
+ }
78
+ function createPricingPlanSchedule({
79
+ pricingPlanSubscriptionId,
80
+ enabledPricings
81
+ }) {
82
+ return request({
83
+ url: `${config.apiUrls.config}/portal/pricing-plan-schedules`,
84
+ options: { method: "POST" },
85
+ data: {
86
+ pricing_plan_subscription_id: pricingPlanSubscriptionId,
87
+ enabled_pricings: enabledPricings,
88
+ start_at: (/* @__PURE__ */ new Date()).toJSON()
89
+ }
90
+ });
91
+ }
92
+ return {
93
+ getOnDemandPricingItems,
94
+ createPricingPlanSchedule
95
+ };
96
+ }
97
+ const _hoisted_1$2 = { class: "sv-subscription-management-form__body grid grid-cols-1 gap-4" };
98
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
99
+ __name: "SubscriptionManagementForm",
100
+ props: /* @__PURE__ */ mergeModels({
101
+ pricingGroup: { type: Object },
102
+ paymentMethods: { type: Array },
103
+ paymentMethodOptions: { type: Array },
104
+ billingPeriod: { type: Object },
105
+ currency: { type: String },
106
+ disabled: { type: Boolean }
107
+ }, {
108
+ "enabledPricingIds": { required: true },
109
+ "enabledPricingIdsModifiers": {},
110
+ "paymentMethodId": {},
111
+ "paymentMethodIdModifiers": {}
112
+ }),
113
+ emits: /* @__PURE__ */ mergeModels(["add-payment-method"], ["update:enabledPricingIds", "update:paymentMethodId"]),
114
+ setup(__props, { emit: __emit }) {
115
+ const props = __props;
116
+ const emit = __emit;
117
+ const enabledPricingIds = useModel(__props, "enabledPricingIds");
118
+ const paymentMethodId = useModel(__props, "paymentMethodId");
119
+ const { $t } = useIntl();
120
+ const toTime = (value) => {
121
+ const parsed = value ? Date.parse(value) : NaN;
122
+ return Number.isFinite(parsed) ? parsed : 0;
123
+ };
124
+ const sortedPaymentMethods = computed(
125
+ () => [...props.paymentMethods ?? []].sort((a, b) => toTime(b.created_at) - toTime(a.created_at))
126
+ );
127
+ watch(
128
+ () => props.paymentMethods,
129
+ (paymentMethods, previousPaymentMethods) => {
130
+ var _a;
131
+ const addedPaymentMethod = paymentMethods == null ? void 0 : paymentMethods.find(
132
+ ({ id }) => !(previousPaymentMethods == null ? void 0 : previousPaymentMethods.some((previous) => previous.id === id))
133
+ );
134
+ if (addedPaymentMethod && (previousPaymentMethods == null ? void 0 : previousPaymentMethods.length)) {
135
+ paymentMethodId.value = addedPaymentMethod.id;
136
+ return;
137
+ }
138
+ if (paymentMethods == null ? void 0 : paymentMethods.some(({ id }) => id === paymentMethodId.value)) {
139
+ return;
140
+ }
141
+ paymentMethodId.value = (_a = (paymentMethods == null ? void 0 : paymentMethods.find(({ is_default }) => is_default)) ?? sortedPaymentMethods.value[0]) == null ? void 0 : _a.id;
142
+ },
143
+ { immediate: true }
144
+ );
145
+ return (_ctx, _cache) => {
146
+ return openBlock(), createElementBlock("form", {
147
+ class: "sv-subscription-management-form",
148
+ onSubmit: _cache[3] || (_cache[3] = withModifiers(() => {
149
+ }, ["prevent"]))
150
+ }, [
151
+ createElementVNode("div", _hoisted_1$2, [
152
+ createVNode(_sfc_main$7, {
153
+ modelValue: enabledPricingIds.value,
154
+ "onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => enabledPricingIds.value = $event),
155
+ class: "sv-subscription-management-form__pricing-group",
156
+ "group-name": __props.pricingGroup.name,
157
+ pricings: __props.pricingGroup.pricings,
158
+ "billing-period": __props.billingPeriod,
159
+ currency: __props.currency
160
+ }, null, 8, ["modelValue", "group-name", "pricings", "billing-period", "currency"]),
161
+ createElementVNode("div", null, [
162
+ createVNode(unref(_sfc_main$8), { spacing: "xs" })
163
+ ]),
164
+ createVNode(_sfc_main$9, {
165
+ modelValue: paymentMethodId.value,
166
+ "onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => paymentMethodId.value = $event),
167
+ class: "sv-subscription-management-form__payment-methods",
168
+ "payment-methods": sortedPaymentMethods.value,
169
+ "payment-method-options": __props.paymentMethodOptions,
170
+ required: "",
171
+ disabled: __props.disabled,
172
+ label: unref($t)({
173
+ defaultMessage: "Payment method",
174
+ id: "subscription_management.payment_method_selector.label",
175
+ description: "Label above the payment method that pays for the subscription change"
176
+ }),
177
+ onAddPaymentMethod: _cache[2] || (_cache[2] = ($event) => emit("add-payment-method"))
178
+ }, null, 8, ["modelValue", "payment-methods", "payment-method-options", "disabled", "label"])
179
+ ])
180
+ ], 32);
181
+ };
182
+ }
183
+ });
184
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
185
+ __name: "TranslationOverride",
186
+ props: {
187
+ messages: { type: Object }
188
+ },
189
+ setup(__props) {
190
+ const props = __props;
191
+ const settings = inject(TRANSLATION_SETTINGS_KEY, void 0);
192
+ const messages = computed(() => ({
193
+ ...settings == null ? void 0 : settings.messages.value,
194
+ ...props.messages
195
+ }));
196
+ return (_ctx, _cache) => {
197
+ var _a, _b;
198
+ return openBlock(), createBlock(unref(_sfc_main$a), {
199
+ locale: (_a = unref(settings)) == null ? void 0 : _a.locale.value,
200
+ "date-locale": (_b = unref(settings)) == null ? void 0 : _b.dateLocale.value,
201
+ messages: messages.value,
202
+ "show-timezones": false
203
+ }, {
204
+ default: withCtx(() => [
205
+ renderSlot(_ctx.$slots, "default")
206
+ ]),
207
+ _: 3
208
+ }, 8, ["locale", "date-locale", "messages"]);
209
+ };
210
+ }
211
+ });
212
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
213
+ __name: "SubscriptionManagementSummary",
214
+ props: {
215
+ invoice: { type: Object },
216
+ isPending: { type: Boolean },
217
+ hasError: { type: Boolean }
218
+ },
219
+ setup(__props) {
220
+ const { $t } = useIntl();
221
+ const invoicePreviewMessages = computed(() => ({
222
+ "invoice_preview.total_due_today_heading": $t({
223
+ defaultMessage: "Total due",
224
+ id: "subscription_management.summary.total_due_heading",
225
+ description: 'Heading above the total of the invoice previewing a subscription change, replacing the shared preview’s "Total due today"'
226
+ })
227
+ }));
228
+ return (_ctx, _cache) => {
229
+ return openBlock(), createBlock(unref(_sfc_main$b), {
230
+ class: "sv-subscription-management-summary",
231
+ title: unref($t)({
232
+ defaultMessage: "Order summary",
233
+ id: "subscription_management.summary.title",
234
+ description: "Title of the block previewing what a subscription change is invoiced for"
235
+ })
236
+ }, {
237
+ default: withCtx(() => [
238
+ __props.hasError ? (openBlock(), createBlock(unref(_sfc_main$c), {
239
+ key: 0,
240
+ class: "sv-subscription-management-summary__error sv-error",
241
+ title: unref($t)({
242
+ defaultMessage: "Unable to calculate the total. Please try again.",
243
+ id: "subscription_management.summary.error",
244
+ description: "Error shown when the invoice preview for a subscription change cannot be loaded"
245
+ })
246
+ }, null, 8, ["title"])) : __props.isPending || !__props.invoice ? (openBlock(), createBlock(_sfc_main$d, {
247
+ key: 1,
248
+ variant: "section",
249
+ class: "sv-subscription-management-summary__skeleton min-h-[120px]"
250
+ }, {
251
+ default: withCtx(() => [
252
+ !__props.isPending ? (openBlock(), createBlock(unref(_sfc_main$e), {
253
+ key: 0,
254
+ variant: "body-sm",
255
+ shade: "lighter",
256
+ tag: "div",
257
+ class: "sv-subscription-management-summary__empty-state"
258
+ }, {
259
+ default: withCtx(() => [
260
+ createTextVNode(toDisplayString(unref($t)({
261
+ defaultMessage: "Select your plan to see what it costs.",
262
+ id: "subscription_management.summary.empty_state",
263
+ description: "Shown in the order summary before a plan has been picked to preview"
264
+ })), 1)
265
+ ]),
266
+ _: 1
267
+ })) : createCommentVNode("", true)
268
+ ]),
269
+ _: 1
270
+ })) : (openBlock(), createBlock(_sfc_main$5, {
271
+ key: 2,
272
+ messages: invoicePreviewMessages.value
273
+ }, {
274
+ default: withCtx(() => [
275
+ createVNode(unref(_sfc_main$f), {
276
+ class: "sv-subscription-management-summary__invoice",
277
+ invoice: __props.invoice,
278
+ "is-customer-facing": ""
279
+ }, null, 8, ["invoice"])
280
+ ]),
281
+ _: 1
282
+ }, 8, ["messages"]))
283
+ ]),
284
+ _: 1
285
+ }, 8, ["title"]);
286
+ };
287
+ }
288
+ });
289
+ const _hoisted_1$1 = { class: "sv-subscription-management-success grid grid-cols-1 gap-4" };
290
+ const _hoisted_2$1 = { class: "sv-subscription-management-success__message" };
291
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
292
+ __name: "SubscriptionManagementSuccess",
293
+ props: {
294
+ pricingGroupName: { type: String }
295
+ },
296
+ setup(__props) {
297
+ const props = __props;
298
+ const { $t } = useIntl();
299
+ const title = computed(
300
+ () => $t({
301
+ defaultMessage: "Subscription updated",
302
+ description: "Title shown on the manage subscription screen once the change is committed",
303
+ id: "subscription_management.success.title"
304
+ })
305
+ );
306
+ const message = computed(
307
+ () => props.pricingGroupName ? $t(
308
+ {
309
+ defaultMessage: "Your {subject} has been changed. Please be aware that it can take some time to reflect this change in your subscription.",
310
+ description: "Confirmation of the pricing group a committed subscription change applied to",
311
+ id: "subscription_management.success.message"
312
+ },
313
+ { subject: props.pricingGroupName }
314
+ ) : $t({
315
+ defaultMessage: "Your subscription has been changed. Please be aware that it can take some time to reflect this change in your subscription.",
316
+ description: "Confirmation of a committed subscription change when the pricing group is not known",
317
+ id: "subscription_management.success.message_generic"
318
+ })
319
+ );
320
+ return (_ctx, _cache) => {
321
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
322
+ createVNode(_sfc_main$g, {
323
+ status: "success",
324
+ title: title.value
325
+ }, {
326
+ default: withCtx(() => [
327
+ createElementVNode("span", _hoisted_2$1, toDisplayString(message.value), 1)
328
+ ]),
329
+ _: 1
330
+ }, 8, ["title"])
331
+ ]);
332
+ };
333
+ }
334
+ });
335
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
336
+ __name: "AddPaymentMethodModal",
337
+ props: {
338
+ showModal: { type: Boolean },
339
+ customer: { type: Object },
340
+ paymentMethodOptions: { type: Array },
341
+ isLoading: { type: Boolean }
342
+ },
343
+ emits: ["success", "failure", "close"],
344
+ setup(__props, { emit: __emit }) {
345
+ const emit = __emit;
346
+ const { $t } = useIntl();
347
+ const addPaymentMethodRef = ref();
348
+ const isSaving = computed(() => {
349
+ var _a;
350
+ return !!((_a = addPaymentMethodRef.value) == null ? void 0 : _a.isSaving);
351
+ });
352
+ const handleConfirm = () => {
353
+ var _a;
354
+ (_a = addPaymentMethodRef.value) == null ? void 0 : _a.submit();
355
+ };
356
+ return (_ctx, _cache) => {
357
+ return openBlock(), createBlock(unref(Modal), {
358
+ "no-click-away": "",
359
+ size: "lg",
360
+ "show-modal": __props.showModal,
361
+ "is-loading": isSaving.value,
362
+ title: unref($t)({
363
+ defaultMessage: "Add payment method",
364
+ id: "add_payment_method_modal.title",
365
+ description: "Title of the modal for adding a payment method"
366
+ }),
367
+ "sub-title": unref($t)({
368
+ defaultMessage: "Add a new payment method to pay with.",
369
+ id: "add_payment_method_modal.subtitle",
370
+ description: "Subtitle of the modal for adding a payment method"
371
+ }),
372
+ "confirm-button-text": unref($t)({
373
+ defaultMessage: "Save payment method",
374
+ id: "add_payment_method_modal.confirm_button.label",
375
+ description: "Label of the button that stores the payment method being added"
376
+ }),
377
+ "cancel-button-text": unref($t)({
378
+ defaultMessage: "Cancel",
379
+ id: "add_payment_method_modal.cancel_button.label",
380
+ description: "Label of the button that abandons adding a payment method"
381
+ }),
382
+ onConfirm: handleConfirm,
383
+ onClose: _cache[2] || (_cache[2] = ($event) => emit("close"))
384
+ }, {
385
+ body: withCtx(() => [
386
+ createVNode(_sfc_main$h, {
387
+ ref_key: "addPaymentMethodRef",
388
+ ref: addPaymentMethodRef,
389
+ class: "sv-add-payment-method-modal sv-add-payment-method-modal__form",
390
+ customer: __props.customer,
391
+ "payment-method-options": __props.paymentMethodOptions,
392
+ "is-loading": __props.isLoading,
393
+ "is-active": __props.showModal,
394
+ onSuccess: _cache[0] || (_cache[0] = ($event) => emit("success")),
395
+ onFailure: _cache[1] || (_cache[1] = (error) => emit("failure", error))
396
+ }, null, 8, ["customer", "payment-method-options", "is-loading", "is-active"])
397
+ ]),
398
+ _: 1
399
+ }, 8, ["show-modal", "is-loading", "title", "sub-title", "confirm-button-text", "cancel-button-text"]);
400
+ };
401
+ }
402
+ });
403
+ const _hoisted_1 = { class: "sv-subscription-management__header" };
404
+ const _hoisted_2 = { class: "flex flex-col gap-2" };
405
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
406
+ __name: "SubscriptionManagement",
407
+ props: {
408
+ configuration: { type: Object }
409
+ },
410
+ setup(__props) {
411
+ const props = __props;
412
+ const { $t } = useIntl();
413
+ const portal = usePortal();
414
+ const logger = useLogger();
415
+ const { dispatchAction } = useActionDispatchProvider();
416
+ const { createPricingPlanSchedule } = createPricingPlanSchedulesService();
417
+ const { subscription, get: fetchSubscription } = useSubscription({
418
+ subscriptionId: props.configuration.subscriptionId
419
+ });
420
+ const { items: paymentMethods, fetchAll: fetchPaymentMethods } = usePaymentMethods({
421
+ customerId: portal.value.customer_id
422
+ });
423
+ const { customer, get: fetchCustomer } = useCustomer({ customerId: portal.value.customer_id });
424
+ const { paymentMethodOptions, get: fetchPaymentMethodOptions } = usePaymentMethodOptions();
425
+ const { isLoading } = useLoadInitialData(
426
+ fetchSubscription(),
427
+ fetchPaymentMethods(),
428
+ fetchCustomer.execute(),
429
+ fetchPaymentMethodOptions({ customerId: portal.value.customer_id })
430
+ );
431
+ const isAddingPaymentMethod = ref(false);
432
+ const handlePaymentMethodAdded = async () => {
433
+ await fetchPaymentMethods();
434
+ isAddingPaymentMethod.value = false;
435
+ };
436
+ const activeScheduleInfo = computed(
437
+ () => {
438
+ var _a;
439
+ return getActiveDefaultScheduleInfo(((_a = subscription.value) == null ? void 0 : _a.pricing_plan_schedule_infos) ?? []);
440
+ }
441
+ );
442
+ const pricingGroup = computed(() => {
443
+ var _a;
444
+ const scheduleInfo = activeScheduleInfo.value;
445
+ if (!scheduleInfo) {
446
+ return void 0;
447
+ }
448
+ const { enabledPricingId } = props.configuration;
449
+ const pricingIds = enabledPricingId ? [enabledPricingId] : (((_a = scheduleInfo.pricing_plan_schedule) == null ? void 0 : _a.enabled_pricings) ?? []).map(
450
+ ({ pricing_id }) => pricing_id
451
+ );
452
+ return pricingIds.map(
453
+ (pricingId) => getPricingGroupByPricingId({ pricingPlanScheduleInfo: scheduleInfo, pricingId })
454
+ ).find((group) => Boolean(group));
455
+ });
456
+ const title = computed(
457
+ () => {
458
+ var _a;
459
+ return $t(
460
+ {
461
+ defaultMessage: "Manage {subject}",
462
+ id: "subscription_management.title",
463
+ description: "Title for the manage subscription page, naming the pricing group being changed"
464
+ },
465
+ {
466
+ subject: ((_a = pricingGroup.value) == null ? void 0 : _a.name) || $t({
467
+ defaultMessage: "subscription",
468
+ id: "subscription_management.title.default_subject",
469
+ description: 'Stands in for the pricing group name in the manage subscription title when no group is known, e.g. "Manage subscription"'
470
+ })
471
+ }
472
+ );
473
+ }
474
+ );
475
+ const enabledPricingIds = ref([]);
476
+ const paymentMethodId = ref();
477
+ watch(
478
+ [activeScheduleInfo, pricingGroup],
479
+ ([scheduleInfo, group]) => {
480
+ var _a;
481
+ const scheduled = (((_a = scheduleInfo == null ? void 0 : scheduleInfo.pricing_plan_schedule) == null ? void 0 : _a.enabled_pricings) ?? []).map(
482
+ ({ pricing_id }) => pricing_id
483
+ );
484
+ const { enabledPricingId } = props.configuration;
485
+ const groupPricingIds = ((group == null ? void 0 : group.pricings) ?? []).map(({ id }) => id);
486
+ enabledPricingIds.value = enabledPricingId && groupPricingIds.includes(enabledPricingId) ? [...scheduled.filter((id) => !groupPricingIds.includes(id)), enabledPricingId] : scheduled;
487
+ },
488
+ { immediate: true }
489
+ );
490
+ const {
491
+ invoice: previewInvoice,
492
+ isPending: isPreviewPending,
493
+ error: previewError,
494
+ load: loadPreview
495
+ } = useSubscriptionUpgradePreview();
496
+ watch(
497
+ [enabledPricingIds, subscription],
498
+ ([pricingIds, loadedSubscription]) => {
499
+ if (!loadedSubscription || pricingIds.length === 0) {
500
+ return;
501
+ }
502
+ void loadPreview({
503
+ subscription: loadedSubscription,
504
+ enabledPricingIds: pricingIds
505
+ });
506
+ },
507
+ { immediate: true }
508
+ );
509
+ const isUpdating = ref(false);
510
+ const updateError = ref();
511
+ const isUpdated = ref(false);
512
+ const canUpdate = computed(
513
+ () => !isLoading.value && !isUpdating.value && enabledPricingIds.value.length > 0 && Boolean(subscription.value) && Boolean(paymentMethodId.value)
514
+ );
515
+ const handleUpdate = async () => {
516
+ if (!canUpdate.value || !subscription.value) {
517
+ return;
518
+ }
519
+ isUpdating.value = true;
520
+ updateError.value = void 0;
521
+ try {
522
+ await createPricingPlanSchedule({
523
+ pricingPlanSubscriptionId: subscription.value.id,
524
+ enabledPricings: enabledPricingIds.value.map((pricingId) => ({
525
+ pricing_id: pricingId
526
+ }))
527
+ });
528
+ isUpdated.value = true;
529
+ } catch (error) {
530
+ logger.error(
531
+ "SUBSCRIPTION_UPDATE_FAILED",
532
+ "Failed to start a new pricing plan schedule",
533
+ {},
534
+ error
535
+ );
536
+ updateError.value = $t({
537
+ defaultMessage: "Something went wrong. Please try again.",
538
+ id: "subscription_management.update_error",
539
+ description: "Error shown when committing a subscription change fails"
540
+ });
541
+ } finally {
542
+ isUpdating.value = false;
543
+ }
544
+ };
545
+ const billingPeriod = computed(
546
+ () => {
547
+ var _a, _b, _c;
548
+ return ((_b = (_a = activeScheduleInfo.value) == null ? void 0 : _a.pricing_plan_schedule) == null ? void 0 : _b.billing_period) ?? ((_c = subscription.value) == null ? void 0 : _c.billing_period);
549
+ }
550
+ );
551
+ return (_ctx, _cache) => {
552
+ return openBlock(), createBlock(unref(ContentWithAsideLayout), { class: "sv-subscription-management sv-root sv-screen" }, {
553
+ header: withCtx(() => [
554
+ createElementVNode("div", _hoisted_1, [
555
+ createVNode(unref(_sfc_main$e), {
556
+ variant: "heading-2",
557
+ tag: "h1",
558
+ class: "sv-subscription-management__title"
559
+ }, {
560
+ default: withCtx(() => [
561
+ createTextVNode(toDisplayString(title.value), 1)
562
+ ]),
563
+ _: 1
564
+ })
565
+ ])
566
+ ]),
567
+ content: withCtx(() => {
568
+ var _a, _b;
569
+ return [
570
+ isUpdated.value ? (openBlock(), createBlock(_sfc_main$3, {
571
+ key: 0,
572
+ class: "sv-subscription-management__success",
573
+ "pricing-group-name": (_a = pricingGroup.value) == null ? void 0 : _a.name
574
+ }, null, 8, ["pricing-group-name"])) : unref(isLoading) ? (openBlock(), createBlock(_sfc_main$d, {
575
+ key: 1,
576
+ variant: "section",
577
+ class: "min-h-[220px]"
578
+ })) : pricingGroup.value && billingPeriod.value ? (openBlock(), createBlock(_sfc_main$6, {
579
+ key: 2,
580
+ "enabled-pricing-ids": enabledPricingIds.value,
581
+ "onUpdate:enabledPricingIds": _cache[0] || (_cache[0] = ($event) => enabledPricingIds.value = $event),
582
+ "payment-method-id": paymentMethodId.value,
583
+ "onUpdate:paymentMethodId": _cache[1] || (_cache[1] = ($event) => paymentMethodId.value = $event),
584
+ class: "sv-subscription-management__form",
585
+ "pricing-group": pricingGroup.value,
586
+ "payment-methods": unref(paymentMethods),
587
+ "payment-method-options": unref(paymentMethodOptions),
588
+ "billing-period": billingPeriod.value,
589
+ currency: (_b = unref(subscription)) == null ? void 0 : _b.billing_currency,
590
+ onAddPaymentMethod: _cache[2] || (_cache[2] = ($event) => isAddingPaymentMethod.value = true)
591
+ }, null, 8, ["enabled-pricing-ids", "payment-method-id", "pricing-group", "payment-methods", "payment-method-options", "billing-period", "currency"])) : createCommentVNode("", true),
592
+ createVNode(_sfc_main$2, {
593
+ "show-modal": isAddingPaymentMethod.value,
594
+ customer: unref(customer),
595
+ "payment-method-options": unref(paymentMethodOptions),
596
+ onSuccess: handlePaymentMethodAdded,
597
+ onClose: _cache[3] || (_cache[3] = ($event) => isAddingPaymentMethod.value = false)
598
+ }, null, 8, ["show-modal", "customer", "payment-method-options"])
599
+ ];
600
+ }),
601
+ aside: withCtx(() => [
602
+ isUpdated.value ? (openBlock(), createBlock(unref(_sfc_main$i), {
603
+ key: 0,
604
+ size: "lg",
605
+ class: "sv-action sv-action--primary sv-action--full-width sv-subscription-management__done w-full",
606
+ type: "button",
607
+ onClick: _cache[4] || (_cache[4] = ($event) => unref(dispatchAction)({ action: "navigate-to-customer-overview" }))
608
+ }, {
609
+ default: withCtx(() => [
610
+ createTextVNode(toDisplayString(unref($t)({
611
+ defaultMessage: "Done",
612
+ id: "subscription_management.done_button.label",
613
+ description: "Label of the button that leaves the manage subscription screen once the change is committed"
614
+ })), 1)
615
+ ]),
616
+ _: 1
617
+ })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
618
+ createVNode(_sfc_main$4, {
619
+ class: "sv-subscription-management__summary",
620
+ invoice: unref(previewInvoice),
621
+ "is-pending": unref(isLoading) || unref(isPreviewPending),
622
+ "has-error": Boolean(unref(previewError))
623
+ }, null, 8, ["invoice", "is-pending", "has-error"]),
624
+ updateError.value ? (openBlock(), createBlock(unref(_sfc_main$c), {
625
+ key: 0,
626
+ class: "sv-subscription-management__update-error sv-error",
627
+ title: updateError.value
628
+ }, null, 8, ["title"])) : createCommentVNode("", true),
629
+ createElementVNode("div", _hoisted_2, [
630
+ createVNode(unref(_sfc_main$i), {
631
+ size: "lg",
632
+ class: "sv-action sv-action--primary sv-action--full-width sv-subscription-management__update w-full",
633
+ type: "button",
634
+ disabled: !canUpdate.value,
635
+ loading: isUpdating.value,
636
+ onClick: handleUpdate
637
+ }, {
638
+ default: withCtx(() => [
639
+ createTextVNode(toDisplayString(unref($t)({
640
+ defaultMessage: "Update subscription",
641
+ id: "subscription_management.update_button.label",
642
+ description: "Label of the button that commits the subscription change"
643
+ })), 1)
644
+ ]),
645
+ _: 1
646
+ }, 8, ["disabled", "loading"]),
647
+ createVNode(_sfc_main$j, {
648
+ class: "sv-subscription-management__kpi",
649
+ "payment-method-options": unref(paymentMethodOptions)
650
+ }, null, 8, ["payment-method-options"])
651
+ ])
652
+ ], 64))
653
+ ]),
654
+ _: 1
655
+ });
656
+ };
657
+ }
658
+ });
659
+ const _sfc_main = /* @__PURE__ */ defineComponent({
660
+ __name: "SubscriptionManagement.entry",
661
+ props: {
662
+ environment: { type: String },
663
+ locale: { type: String },
664
+ dateLocale: { type: String },
665
+ messages: { type: Object },
666
+ primaryColor: { type: String },
667
+ secondaryColor: { type: String },
668
+ isShadowRoot: { type: Boolean },
669
+ experimentalFeatures: { type: Array },
670
+ logLevel: { type: String },
671
+ onLog: { type: Function },
672
+ allowedPortalTypes: { type: Array },
673
+ portalObject: { type: Object },
674
+ cssOverrides: { type: [String, Array] },
675
+ branding: { type: Object },
676
+ configuration: { type: Object }
677
+ },
678
+ setup(__props) {
679
+ return (_ctx, _cache) => {
680
+ var _a, _b, _c, _d;
681
+ return openBlock(), createBlock(_sfc_main$k, {
682
+ "custom-element-name": unref(COMPONENT_NAME),
683
+ environment: __props.environment,
684
+ locale: __props.locale,
685
+ "portal-object": __props.portalObject,
686
+ "allowed-portal-types": ["CUSTOMER"],
687
+ "primary-color": (_b = (_a = __props.branding) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary,
688
+ "secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
689
+ "experimental-features": __props.experimentalFeatures,
690
+ "log-level": __props.logLevel,
691
+ "on-log": __props.onLog,
692
+ "css-overrides": __props.cssOverrides,
693
+ onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
694
+ }, {
695
+ default: withCtx(() => [
696
+ createVNode(_sfc_main$1, { configuration: __props.configuration }, null, 8, ["configuration"])
697
+ ]),
698
+ _: 1
699
+ }, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log", "css-overrides"]);
700
+ };
701
+ }
702
+ });
703
+ const SolvimonSubscriptionManagement = defineCustomElement(
704
+ _sfc_main
705
+ );
706
+ const COMPONENT_NAME = getComponentName("subscription-management");
707
+ const defineSolvimonSubscriptionManagement = () => {
708
+ if (!customElements.get(COMPONENT_NAME)) {
709
+ customElements.define(COMPONENT_NAME, SolvimonSubscriptionManagement);
710
+ }
711
+ };
712
+ export {
713
+ COMPONENT_NAME,
714
+ SolvimonSubscriptionManagement,
715
+ defineSolvimonSubscriptionManagement
716
+ };