@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,889 @@
1
+ import { computed, ref, defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, shallowRef, watch, toRef, renderSlot, normalizeProps, guardReactiveProps } from "vue";
2
+ import { a as useLogger, _ as _sfc_main$i, d as defineCustomElement, g as getComponentName } from "../../component--Y7Igv5i.mjs";
3
+ import { u as useIntl, E as formatAmount, a2 as formatBillingPeriod, b as _sfc_main$6, a as _sfc_main$7, k as _sfc_main$8, g as getPaginatedFullList, h as isApiSuccessCollectionResponse, M as Modal, n as _sfc_main$a, D as _sfc_main$b, a3 as _sfc_main$e } from "../../vendor-ui-ItGf7wJV.mjs";
4
+ import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
5
+ import { u as useActionDispatchProvider } from "../../useActionDispatchProvider-BlEf-RZ5.mjs";
6
+ import { b as getMostRecentScheduleInfo, a as getSubscriptionName } from "../../subscription-C41lG-rH.mjs";
7
+ import { _ as _sfc_main$g } from "../../SubscriptionSchedules.vue_vue_type_script_setup_true_lang-CyYhYYRp.mjs";
8
+ import { _ as _sfc_main$c, u as useCustomerWalletBalances } from "../../CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs";
9
+ import { _ as _sfc_main$d } from "../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs";
10
+ import { _ as _sfc_main$h } from "../../EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BIpg-MSJ.mjs";
11
+ import { _ as _sfc_main$f } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
12
+ import { g as getNameFromPricing } from "../../pricing-GwLCiSzs.mjs";
13
+ import { c as createSubscriptionsService } from "../../subscriptions-vEE4Y7qm.mjs";
14
+ import { _ as _sfc_main$9 } from "../../SubscriptionSummary.vue_vue_type_script_setup_true_lang-z8P1u1Gi.mjs";
15
+ import { c as createPaymentMethodsService } from "../../paymentMethods-BnF1XYS1.mjs";
16
+ import { A as ApiStatus } from "../../ApiStatus-CyNDp_op.mjs";
17
+ import { u as useSubscription } from "../../useSubscription-9rJpFNUF.mjs";
18
+ import { u as useCustomer } from "../../useCustomer-Cw8LXT6S.mjs";
19
+ import { u as usePaymentMethods } from "../../usePaymentMethods-Cyk4cjoE.mjs";
20
+ import { u as useLoadInitialData } from "../../useLoadInitialData-BP1v7qhd.mjs";
21
+ function useSubscriptionActions({
22
+ subscription
23
+ }) {
24
+ const { dispatchAction } = useActionDispatchProvider();
25
+ const isCancellable = computed(() => {
26
+ if (!subscription.value) return false;
27
+ const inactivePeriods = subscription.value.inactive_periods;
28
+ return !inactivePeriods || inactivePeriods.length === 0;
29
+ });
30
+ const isRenewable = computed(() => {
31
+ var _a;
32
+ const inactivePeriods = (_a = subscription.value) == null ? void 0 : _a.inactive_periods;
33
+ return Array.isArray(inactivePeriods) && inactivePeriods.length > 0;
34
+ });
35
+ const pendingVariant = ref();
36
+ const cancel = () => {
37
+ if (!subscription.value) return;
38
+ pendingVariant.value = "CANCEL";
39
+ };
40
+ const renew = () => {
41
+ if (!subscription.value) return;
42
+ pendingVariant.value = "RENEW";
43
+ };
44
+ const dismiss = () => {
45
+ pendingVariant.value = void 0;
46
+ };
47
+ const manage = () => {
48
+ if (!subscription.value) return;
49
+ dispatchAction({
50
+ action: "manage-subscription",
51
+ data: { subscriptionId: subscription.value.id }
52
+ });
53
+ };
54
+ return { isCancellable, isRenewable, pendingVariant, cancel, renew, dismiss, manage };
55
+ }
56
+ function getHeadlinePrice(pricing) {
57
+ var _a, _b, _c, _d, _e, _f, _g;
58
+ const config = (_c = (_b = (_a = pricing.items) == null ? void 0 : _a[0]) == null ? void 0 : _b.configs) == null ? void 0 : _c[0];
59
+ const band = (_e = (_d = config == null ? void 0 : config.details) == null ? void 0 : _d.bands) == null ? void 0 : _e[0];
60
+ return {
61
+ amount: (band == null ? void 0 : band.amount) ?? (band == null ? void 0 : band.fixed_amount),
62
+ billingPeriod: ((_f = config == null ? void 0 : config.details) == null ? void 0 : _f.pricing_period) ?? ((_g = config == null ? void 0 : config.details) == null ? void 0 : _g.billing_period)
63
+ };
64
+ }
65
+ function getEnabledPricingsEntries(scheduleInfo) {
66
+ var _a, _b, _c;
67
+ const enabledPricingIds = new Set(
68
+ (((_a = scheduleInfo.pricing_plan_schedule) == null ? void 0 : _a.enabled_pricings) ?? []).map(
69
+ ({ pricing_id }) => pricing_id
70
+ )
71
+ );
72
+ if (enabledPricingIds.size === 0) {
73
+ return [];
74
+ }
75
+ const pricingGroups = ((_c = (_b = scheduleInfo.pricing_plan_version) == null ? void 0 : _b.pricing_categories) == null ? void 0 : _c.flatMap(
76
+ (category) => category.pricing_groups ?? []
77
+ )) ?? [];
78
+ return pricingGroups.flatMap(
79
+ (group) => (group.pricings ?? []).filter((pricing) => enabledPricingIds.has(pricing.id)).map((pricing) => ({
80
+ pricingId: pricing.id,
81
+ pricingGroupId: group.id,
82
+ groupName: group.name,
83
+ // A pricing without a name of its own is only identifiable by the choice it belongs to.
84
+ name: getNameFromPricing(pricing) || group.name,
85
+ ...getHeadlinePrice(pricing)
86
+ }))
87
+ );
88
+ }
89
+ const _hoisted_1$3 = { class: "sv-enabled-pricings-list__item-body flex items-center gap-4" };
90
+ const _hoisted_2$1 = { class: "sv-enabled-pricings-list__item-content grow" };
91
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
92
+ __name: "EnabledPricingsListItem",
93
+ props: {
94
+ entry: { type: Object }
95
+ },
96
+ emits: ["upgrade"],
97
+ setup(__props) {
98
+ const props = __props;
99
+ const { $t } = useIntl();
100
+ const price = computed(() => {
101
+ const { amount, billingPeriod } = props.entry;
102
+ if (!amount) {
103
+ return void 0;
104
+ }
105
+ if (!billingPeriod) {
106
+ return formatAmount(amount);
107
+ }
108
+ return $t(
109
+ {
110
+ defaultMessage: "{amount} per {period}",
111
+ id: "enabled_pricings_list.item.price",
112
+ description: 'The recurring price of an enabled pricing, e.g. "€ 100,00 per month"'
113
+ },
114
+ {
115
+ amount: formatAmount(amount),
116
+ period: formatBillingPeriod(billingPeriod, {
117
+ short: true,
118
+ hideValueForExactPeriods: true
119
+ })
120
+ }
121
+ );
122
+ });
123
+ return (_ctx, _cache) => {
124
+ return openBlock(), createBlock(unref(_sfc_main$6), { class: "sv-enabled-pricings-list__item" }, {
125
+ default: withCtx(() => [
126
+ createElementVNode("div", _hoisted_1$3, [
127
+ createElementVNode("div", _hoisted_2$1, [
128
+ createVNode(unref(_sfc_main$7), {
129
+ tag: "span",
130
+ variant: "body-xs",
131
+ shade: "lighter",
132
+ class: "sv-enabled-pricings-list__item-group"
133
+ }, {
134
+ default: withCtx(() => [
135
+ createTextVNode(toDisplayString(__props.entry.groupName), 1)
136
+ ]),
137
+ _: 1
138
+ }),
139
+ createVNode(unref(_sfc_main$7), {
140
+ tag: "h3",
141
+ variant: "heading-3",
142
+ "no-spacing": "",
143
+ class: "sv-enabled-pricings-list__item-name"
144
+ }, {
145
+ default: withCtx(() => [
146
+ createTextVNode(toDisplayString(__props.entry.name), 1)
147
+ ]),
148
+ _: 1
149
+ }),
150
+ price.value ? (openBlock(), createBlock(unref(_sfc_main$7), {
151
+ key: 0,
152
+ tag: "span",
153
+ variant: "body-sm",
154
+ shade: "lighter",
155
+ class: "sv-enabled-pricings-list__item-price"
156
+ }, {
157
+ default: withCtx(() => [
158
+ createTextVNode(toDisplayString(price.value), 1)
159
+ ]),
160
+ _: 1
161
+ })) : createCommentVNode("", true)
162
+ ]),
163
+ createVNode(unref(_sfc_main$8), {
164
+ variant: "outline",
165
+ color: "gray",
166
+ class: "sv-action sv-action--secondary sv-enabled-pricings-list__item-upgrade shrink-0",
167
+ type: "button",
168
+ size: "xs",
169
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("upgrade", __props.entry))
170
+ }, {
171
+ default: withCtx(() => [
172
+ createTextVNode(toDisplayString(unref($t)({
173
+ defaultMessage: "Upgrade",
174
+ id: "enabled_pricings_list.item.upgrade_button.label",
175
+ description: "Label for the button that changes which pricing is enabled for a group"
176
+ })), 1)
177
+ ]),
178
+ _: 1
179
+ })
180
+ ])
181
+ ]),
182
+ _: 1
183
+ });
184
+ };
185
+ }
186
+ });
187
+ const _hoisted_1$2 = { class: "sv-enabled-pricings-list__items grid grid-cols-1 gap-2" };
188
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
189
+ __name: "EnabledPricingsList",
190
+ props: {
191
+ pricingPlanSchedule: { type: Object }
192
+ },
193
+ emits: ["upgrade"],
194
+ setup(__props) {
195
+ const props = __props;
196
+ const { $t } = useIntl();
197
+ const entries = computed(() => getEnabledPricingsEntries(props.pricingPlanSchedule));
198
+ return (_ctx, _cache) => {
199
+ return entries.value.length > 0 ? (openBlock(), createBlock(unref(_sfc_main$6), {
200
+ key: 0,
201
+ class: "sv-enabled-pricings-list",
202
+ "content-background": "none",
203
+ "no-border": "",
204
+ "no-spacing": "",
205
+ title: unref($t)({
206
+ defaultMessage: "Upgrades",
207
+ id: "enabled_pricings_list.title",
208
+ description: "Title for the block listing the pricings enabled on a subscription"
209
+ })
210
+ }, {
211
+ default: withCtx(() => [
212
+ createElementVNode("div", _hoisted_1$2, [
213
+ (openBlock(true), createElementBlock(Fragment, null, renderList(entries.value, (entry) => {
214
+ return openBlock(), createBlock(_sfc_main$5, {
215
+ key: entry.pricingId,
216
+ entry,
217
+ onUpgrade: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("upgrade", $event))
218
+ }, null, 8, ["entry"]);
219
+ }), 128))
220
+ ])
221
+ ]),
222
+ _: 1
223
+ }, 8, ["title"])) : createCommentVNode("", true);
224
+ };
225
+ }
226
+ });
227
+ function useSubscriptionCancellationModalLabels({
228
+ variant,
229
+ renewableUntil,
230
+ billingPeriodEndsAt
231
+ }) {
232
+ const { $t } = useIntl();
233
+ const isRenewing = computed(() => variant.value === "RENEW");
234
+ const title = computed(
235
+ () => isRenewing.value ? $t({
236
+ defaultMessage: "Renew subscription",
237
+ description: "Title of the renew subscription confirmation modal",
238
+ id: "subscription_cancellation_modal.renew.title"
239
+ }) : $t({
240
+ defaultMessage: "Cancel subscription",
241
+ description: "Title of the cancel subscription confirmation modal",
242
+ id: "subscription_cancellation_modal.cancel.title"
243
+ })
244
+ );
245
+ const explanation = computed(() => {
246
+ if (!isRenewing.value) {
247
+ if (billingPeriodEndsAt.value) {
248
+ return $t(
249
+ {
250
+ defaultMessage: "Your subscription will be canceled, but you’ll continue to have access until {date}.",
251
+ description: "Explanation of what happens when a running subscription is cancelled, naming the date access ends, shown in the cancel subscription modal",
252
+ id: "subscription_cancellation_modal.cancel.explanation_with_date"
253
+ },
254
+ { date: billingPeriodEndsAt.value }
255
+ );
256
+ }
257
+ return $t({
258
+ defaultMessage: "Your subscription will be canceled, but you’ll continue to have access until the end of the billing period.",
259
+ description: "Explanation of what happens when a running subscription is cancelled, shown in the cancel subscription modal",
260
+ id: "subscription_cancellation_modal.cancel.explanation"
261
+ });
262
+ }
263
+ if (!renewableUntil.value) {
264
+ return $t({
265
+ defaultMessage: "Your subscription will continue as before, and billing will resume on its usual schedule.",
266
+ description: "Explanation of what happens when a cancellation is undone, shown in the renew subscription modal when no end date is known",
267
+ id: "subscription_cancellation_modal.renew.explanation"
268
+ });
269
+ }
270
+ return $t(
271
+ {
272
+ defaultMessage: "You can renew your subscription until {date}. After this period you can only create a new subscription.",
273
+ description: "Explanation of the deadline for undoing a cancellation, shown in the renew subscription modal",
274
+ id: "subscription_cancellation_modal.renew.explanation_with_date"
275
+ },
276
+ { date: renewableUntil.value }
277
+ );
278
+ });
279
+ const confirmButtonText = computed(
280
+ () => isRenewing.value ? $t({
281
+ defaultMessage: "Renew subscription",
282
+ description: "Label of the confirm button in the renew subscription modal",
283
+ id: "subscription_cancellation_modal.renew.confirm_button.label"
284
+ }) : $t({
285
+ defaultMessage: "Cancel subscription",
286
+ description: "Label of the confirm button in the cancel subscription modal",
287
+ id: "subscription_cancellation_modal.cancel.confirm_button.label"
288
+ })
289
+ );
290
+ const cancelButtonText = computed(
291
+ () => $t({
292
+ defaultMessage: "Cancel",
293
+ description: "Label of the button that dismisses the cancellation modal",
294
+ id: "subscription_cancellation_modal.cancel_button.label"
295
+ })
296
+ );
297
+ const errorMessage = computed(
298
+ () => isRenewing.value ? $t({
299
+ defaultMessage: "We could not renew your subscription. Please try again.",
300
+ description: "Error shown when undoing a cancellation fails",
301
+ id: "subscription_cancellation_modal.renew.error"
302
+ }) : $t({
303
+ defaultMessage: "We could not cancel your subscription. Please try again.",
304
+ description: "Error shown when cancelling a subscription fails",
305
+ id: "subscription_cancellation_modal.cancel.error"
306
+ })
307
+ );
308
+ return { title, explanation, confirmButtonText, cancelButtonText, errorMessage };
309
+ }
310
+ const PAGE_SIZE = 50;
311
+ function usePaymentMethod() {
312
+ const { getPaymentMethods } = createPaymentMethodsService();
313
+ const paymentMethod = shallowRef();
314
+ const get = async ({
315
+ customerId,
316
+ paymentMethodId
317
+ }) => {
318
+ const response = await getPaginatedFullList(async (page) => {
319
+ const pageResponse = await getPaymentMethods({
320
+ customerId,
321
+ pagination: { page, pageSize: PAGE_SIZE }
322
+ });
323
+ if (!isApiSuccessCollectionResponse(pageResponse)) {
324
+ throw new Error("Could not load the customer’s payment methods.");
325
+ }
326
+ return pageResponse;
327
+ });
328
+ paymentMethod.value = response.data.find(({ id }) => id === paymentMethodId);
329
+ return paymentMethod.value;
330
+ };
331
+ return { paymentMethod, get };
332
+ }
333
+ const _hoisted_1$1 = { class: "sv-subscription-cancellation-modal sv-subscription-cancellation-modal__body flex flex-col gap-3" };
334
+ const _hoisted_2 = {
335
+ key: 0,
336
+ class: "sv-subscription-cancellation-modal__meta flex flex-wrap items-center gap-x-6 gap-y-2 px-3 pb-2"
337
+ };
338
+ const _hoisted_3 = {
339
+ key: 0,
340
+ class: "sv-subscription-cancellation-modal__renews flex gap-1"
341
+ };
342
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
343
+ __name: "SubscriptionCancellationModal",
344
+ props: {
345
+ showModal: { type: Boolean },
346
+ variant: { type: null },
347
+ subscription: { type: Object },
348
+ avatar: { type: String }
349
+ },
350
+ emits: ["confirmed", "close"],
351
+ setup(__props, { emit: __emit }) {
352
+ const props = __props;
353
+ const emit = __emit;
354
+ const { $t, formatDate } = useIntl();
355
+ const logger = useLogger();
356
+ const { setSubscriptionCancellation } = createSubscriptionsService();
357
+ const variant = computed(() => props.variant);
358
+ const renewableUntil = computed(() => {
359
+ var _a;
360
+ const periods = ((_a = props.subscription) == null ? void 0 : _a.inactive_periods) ?? [];
361
+ const cancellation = periods.find(({ type }) => type === "CANCEL") ?? periods[0];
362
+ if (!cancellation) return void 0;
363
+ return formatDate({
364
+ date: cancellation.start_at,
365
+ format: "date",
366
+ offsetType: "local"
367
+ });
368
+ });
369
+ const billingPeriodEndsAt = computed(() => {
370
+ var _a, _b;
371
+ const invoiceDate = (_b = (_a = props.subscription) == null ? void 0 : _a.next_invoice) == null ? void 0 : _b.invoice_date;
372
+ if (!invoiceDate) return void 0;
373
+ return formatDate({
374
+ date: invoiceDate,
375
+ format: "date",
376
+ offsetType: "local"
377
+ });
378
+ });
379
+ const renewsOn = billingPeriodEndsAt;
380
+ const enabledPricingIds = computed(
381
+ () => {
382
+ var _a, _b;
383
+ return (((_b = (_a = getMostRecentScheduleInfo(props.subscription)) == null ? void 0 : _a.pricing_plan_schedule) == null ? void 0 : _b.enabled_pricings) ?? []).map(({ pricing_id }) => pricing_id).filter((pricingId) => Boolean(pricingId));
384
+ }
385
+ );
386
+ const { title, explanation, confirmButtonText, cancelButtonText, errorMessage } = useSubscriptionCancellationModalLabels({ variant, renewableUntil, billingPeriodEndsAt });
387
+ const { paymentMethod, get: fetchPaymentMethod } = usePaymentMethod();
388
+ watch(
389
+ [
390
+ () => props.showModal,
391
+ () => {
392
+ var _a;
393
+ return (_a = props.subscription) == null ? void 0 : _a.payment_method_id;
394
+ },
395
+ () => {
396
+ var _a;
397
+ return (_a = props.subscription) == null ? void 0 : _a.customer_id;
398
+ }
399
+ ],
400
+ ([showModal, paymentMethodId, customerId]) => {
401
+ var _a;
402
+ if (!showModal || !paymentMethodId || !customerId) return;
403
+ if (paymentMethodId === ((_a = paymentMethod.value) == null ? void 0 : _a.id)) return;
404
+ void fetchPaymentMethod({ customerId, paymentMethodId }).catch(() => void 0);
405
+ },
406
+ { immediate: true }
407
+ );
408
+ const isSubmitting = ref(false);
409
+ const hasFailed = ref(false);
410
+ watch(
411
+ () => props.showModal,
412
+ (showModal) => {
413
+ if (!showModal) return;
414
+ hasFailed.value = false;
415
+ }
416
+ );
417
+ const handleConfirm = async () => {
418
+ if (!props.subscription || !props.variant || isSubmitting.value) {
419
+ return;
420
+ }
421
+ isSubmitting.value = true;
422
+ hasFailed.value = false;
423
+ try {
424
+ await setSubscriptionCancellation({
425
+ id: props.subscription.id,
426
+ variant: props.variant
427
+ });
428
+ emit("confirmed");
429
+ emit("close");
430
+ } catch (error) {
431
+ logger.error(
432
+ "SUBSCRIPTION_CANCELLATION_FAILED",
433
+ "Failed to change the cancellation state of a subscription",
434
+ { variant: props.variant },
435
+ error
436
+ );
437
+ hasFailed.value = true;
438
+ } finally {
439
+ isSubmitting.value = false;
440
+ }
441
+ };
442
+ const handleClose = () => {
443
+ if (isSubmitting.value) return;
444
+ emit("close");
445
+ };
446
+ return (_ctx, _cache) => {
447
+ return openBlock(), createBlock(unref(Modal), {
448
+ size: "md",
449
+ "show-modal": __props.showModal,
450
+ title: unref(title),
451
+ "confirm-button-text": unref(confirmButtonText),
452
+ "cancel-button-text": unref(cancelButtonText),
453
+ "is-loading": isSubmitting.value,
454
+ "no-click-away": isSubmitting.value,
455
+ "no-backdrop-close": isSubmitting.value,
456
+ onConfirm: handleConfirm,
457
+ onClose: handleClose
458
+ }, {
459
+ body: withCtx(() => [
460
+ createElementVNode("div", _hoisted_1$1, [
461
+ createVNode(unref(_sfc_main$7), {
462
+ variant: "body-sm",
463
+ shade: "lighter",
464
+ tag: "p",
465
+ class: "sv-subscription-cancellation-modal__explanation"
466
+ }, {
467
+ default: withCtx(() => [
468
+ createTextVNode(toDisplayString(unref(explanation)), 1)
469
+ ]),
470
+ _: 1
471
+ }),
472
+ __props.subscription ? (openBlock(), createBlock(unref(_sfc_main$6), {
473
+ key: 0,
474
+ "no-spacing": "",
475
+ class: "sv-subscription-cancellation-modal__subscription"
476
+ }, {
477
+ default: withCtx(() => [
478
+ createVNode(_sfc_main$9, {
479
+ subscription: __props.subscription,
480
+ avatar: __props.avatar,
481
+ "enabled-pricing-ids": enabledPricingIds.value
482
+ }, null, 8, ["subscription", "avatar", "enabled-pricing-ids"]),
483
+ unref(renewsOn) || unref(paymentMethod) ? (openBlock(), createElementBlock("div", _hoisted_2, [
484
+ unref(renewsOn) ? (openBlock(), createElementBlock("div", _hoisted_3, [
485
+ createVNode(unref(_sfc_main$7), {
486
+ tag: "span",
487
+ variant: "body-xs",
488
+ shade: "light",
489
+ weight: "semibold"
490
+ }, {
491
+ default: withCtx(() => [
492
+ createTextVNode(toDisplayString(unref($t)({
493
+ defaultMessage: "Renews",
494
+ description: "Label before the date the subscription renews, shown in the cancel subscription modal",
495
+ id: "subscription_cancellation_modal.renews_label"
496
+ })), 1)
497
+ ]),
498
+ _: 1
499
+ }),
500
+ createVNode(unref(_sfc_main$7), {
501
+ tag: "span",
502
+ variant: "body-xs",
503
+ shade: "light"
504
+ }, {
505
+ default: withCtx(() => [
506
+ createTextVNode(toDisplayString(unref(renewsOn)), 1)
507
+ ]),
508
+ _: 1
509
+ })
510
+ ])) : createCommentVNode("", true),
511
+ unref(paymentMethod) ? (openBlock(), createBlock(unref(_sfc_main$a), {
512
+ key: 1,
513
+ variant: "condensed",
514
+ class: "sv-subscription-cancellation-modal__payment-method",
515
+ "payment-method": unref(paymentMethod)
516
+ }, null, 8, ["payment-method"])) : createCommentVNode("", true)
517
+ ])) : createCommentVNode("", true)
518
+ ]),
519
+ _: 1
520
+ })) : createCommentVNode("", true),
521
+ hasFailed.value ? (openBlock(), createBlock(unref(_sfc_main$b), {
522
+ key: 1,
523
+ class: "sv-subscription-cancellation-modal__error sv-error",
524
+ title: unref(errorMessage)
525
+ }, null, 8, ["title"])) : createCommentVNode("", true)
526
+ ])
527
+ ]),
528
+ _: 1
529
+ }, 8, ["show-modal", "title", "confirm-button-text", "cancel-button-text", "is-loading", "no-click-away", "no-backdrop-close"]);
530
+ };
531
+ }
532
+ });
533
+ const _hoisted_1 = { class: "sv-subscription-details__header flex flex-col gap-2 md:flex-row md:items-center" };
534
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
535
+ __name: "SubscriptionDetails",
536
+ props: {
537
+ subscription: { type: Object },
538
+ schedulesData: { type: Array },
539
+ customer: { type: Object },
540
+ paymentMethods: { type: Array },
541
+ walletBalances: { default: () => [], type: Array },
542
+ hasWalletBalancesError: { type: Boolean },
543
+ avatar: { type: String },
544
+ isLoading: { type: Boolean },
545
+ error: { type: null }
546
+ },
547
+ emits: ["top-up-charged", "auto-top-up-saved", "auto-top-up-cancelled", "payment-method-stored", "subscription-changed"],
548
+ setup(__props, { emit: __emit }) {
549
+ const props = __props;
550
+ const emit = __emit;
551
+ const { $t } = useIntl();
552
+ const {
553
+ isCancellable,
554
+ isRenewable,
555
+ pendingVariant,
556
+ cancel: handleCancel,
557
+ renew: handleRenew,
558
+ dismiss: handleDismissCancellation,
559
+ manage: handleUpgrade
560
+ } = useSubscriptionActions({ subscription: toRef(props, "subscription") });
561
+ const confirmedVariant = ref();
562
+ watch(pendingVariant, (variant) => {
563
+ if (variant) confirmedVariant.value = void 0;
564
+ });
565
+ const handleCancellationConfirmed = () => {
566
+ confirmedVariant.value = pendingVariant.value;
567
+ emit("subscription-changed");
568
+ };
569
+ const cancellationSuccessMessage = computed(() => {
570
+ if (!confirmedVariant.value) return void 0;
571
+ return confirmedVariant.value === "RENEW" ? $t({
572
+ defaultMessage: "Your subscription has been renewed.",
573
+ id: "subscription_details.renew_success",
574
+ description: "Confirmation shown after a cancellation has been undone"
575
+ }) : $t({
576
+ defaultMessage: "Your subscription has been cancelled. You keep access until the end of the billing period.",
577
+ id: "subscription_details.cancel_success",
578
+ description: "Confirmation shown after a subscription has been cancelled"
579
+ });
580
+ });
581
+ const currentScheduleInfo = computed(() => getMostRecentScheduleInfo(props.subscription));
582
+ const subscriptionPaymentMethod = computed(
583
+ () => (props.paymentMethods ?? []).find(({ id }) => {
584
+ var _a;
585
+ return id === ((_a = props.subscription) == null ? void 0 : _a.payment_method_id);
586
+ })
587
+ );
588
+ const topUpSubscriptions = computed(() => props.subscription ? [props.subscription] : []);
589
+ const title = computed(
590
+ () => getSubscriptionName({
591
+ subscription: props.subscription,
592
+ fallback: $t({
593
+ defaultMessage: "Subscription details",
594
+ id: "subscription_details.title",
595
+ description: "Title for the subscription details page"
596
+ })
597
+ })
598
+ );
599
+ return (_ctx, _cache) => {
600
+ return openBlock(), createBlock(unref(ContentWithAsideLayout), { class: "sv-subscription-details sv-root sv-screen" }, {
601
+ header: withCtx(() => [
602
+ createElementVNode("div", _hoisted_1, [
603
+ createVNode(unref(_sfc_main$7), {
604
+ variant: "heading-2",
605
+ tag: "h1",
606
+ class: "sv-subscription-details__title grow"
607
+ }, {
608
+ default: withCtx(() => [
609
+ createTextVNode(toDisplayString(title.value), 1)
610
+ ]),
611
+ _: 1
612
+ }),
613
+ unref(isRenewable) ? (openBlock(), createBlock(unref(_sfc_main$8), {
614
+ key: 0,
615
+ variant: "outline",
616
+ color: "gray",
617
+ class: "sv-action sv-action--secondary sv-subscription-details__renew w-full md:w-auto",
618
+ type: "button",
619
+ onClick: unref(handleRenew)
620
+ }, {
621
+ default: withCtx(() => [
622
+ createTextVNode(toDisplayString(unref($t)({
623
+ defaultMessage: "Renew subscription",
624
+ id: "subscription_details.renew_button.label",
625
+ description: "Label for the renew subscription button on the subscription details page"
626
+ })), 1)
627
+ ]),
628
+ _: 1
629
+ }, 8, ["onClick"])) : createCommentVNode("", true),
630
+ unref(isCancellable) ? (openBlock(), createBlock(unref(_sfc_main$8), {
631
+ key: 1,
632
+ variant: "outline",
633
+ color: "gray",
634
+ class: "sv-action sv-action--secondary sv-subscription-details__cancel w-full md:w-auto",
635
+ type: "button",
636
+ onClick: unref(handleCancel)
637
+ }, {
638
+ default: withCtx(() => [
639
+ createTextVNode(toDisplayString(unref($t)({
640
+ defaultMessage: "Cancel subscription",
641
+ id: "subscription_details.cancel_button.label",
642
+ description: "Label for the cancel subscription button on the subscription details page"
643
+ })), 1)
644
+ ]),
645
+ _: 1
646
+ }, 8, ["onClick"])) : createCommentVNode("", true)
647
+ ])
648
+ ]),
649
+ content: withCtx(() => [
650
+ cancellationSuccessMessage.value ? (openBlock(), createBlock(unref(_sfc_main$e), {
651
+ key: 0,
652
+ class: "sv-subscription-details__cancellation-success",
653
+ type: "success",
654
+ title: cancellationSuccessMessage.value
655
+ }, null, 8, ["title"])) : createCommentVNode("", true),
656
+ __props.error ? (openBlock(), createBlock(unref(_sfc_main$b), {
657
+ key: 1,
658
+ class: "sv-subscription-details__error sv-error",
659
+ title: unref($t)({
660
+ defaultMessage: "Unable to load this subscription. Please try again later.",
661
+ id: "subscription_details.load_error",
662
+ description: "Error message shown when the subscription cannot be loaded on the subscription details page"
663
+ })
664
+ }, null, 8, ["title"])) : __props.isLoading ? (openBlock(), createBlock(_sfc_main$f, {
665
+ key: 2,
666
+ variant: "section",
667
+ class: "min-h-[220px]"
668
+ })) : __props.subscription ? (openBlock(), createBlock(_sfc_main$g, {
669
+ key: 3,
670
+ class: "sv-subscription-details__schedules",
671
+ "schedules-data": __props.schedulesData ?? [],
672
+ configuration: { subscriptionId: __props.subscription.id },
673
+ "is-loading": __props.isLoading
674
+ }, null, 8, ["schedules-data", "configuration", "is-loading"])) : (openBlock(), createBlock(_sfc_main$h, {
675
+ key: 4,
676
+ class: "sv-subscription-details__empty-state",
677
+ icon: "receipt_long"
678
+ }, {
679
+ title: withCtx(() => [
680
+ createTextVNode(toDisplayString(unref($t)({
681
+ defaultMessage: "Subscription not found",
682
+ id: "subscription_details.empty_state.title",
683
+ description: "Title shown when the requested subscription does not exist"
684
+ })), 1)
685
+ ]),
686
+ message: withCtx(() => [
687
+ createTextVNode(toDisplayString(unref($t)({
688
+ defaultMessage: "This subscription is no longer available.",
689
+ id: "subscription_details.empty_state.message",
690
+ description: "Message shown when the requested subscription does not exist"
691
+ })), 1)
692
+ ]),
693
+ _: 1
694
+ }))
695
+ ]),
696
+ aside: withCtx(() => [
697
+ createVNode(_sfc_main$c, {
698
+ class: "sv-subscription-details__wallet-balances",
699
+ "has-error": Boolean(__props.hasWalletBalancesError),
700
+ "is-loading": __props.isLoading,
701
+ "wallet-balances": __props.walletBalances,
702
+ "show-top-up-button": "",
703
+ customer: __props.customer,
704
+ "payment-methods": __props.paymentMethods,
705
+ subscriptions: topUpSubscriptions.value,
706
+ onTopUpCharged: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("top-up-charged")),
707
+ onAutoTopUpSaved: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("auto-top-up-saved")),
708
+ onAutoTopUpCancelled: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("auto-top-up-cancelled")),
709
+ onPaymentMethodStored: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("payment-method-stored"))
710
+ }, null, 8, ["has-error", "is-loading", "wallet-balances", "customer", "payment-methods", "subscriptions"]),
711
+ currentScheduleInfo.value ? (openBlock(), createBlock(_sfc_main$4, {
712
+ key: 0,
713
+ class: "sv-subscription-details__upgrades",
714
+ "pricing-plan-schedule": currentScheduleInfo.value,
715
+ onUpgrade: unref(handleUpgrade)
716
+ }, null, 8, ["pricing-plan-schedule", "onUpgrade"])) : createCommentVNode("", true),
717
+ subscriptionPaymentMethod.value ? (openBlock(), createBlock(_sfc_main$d, {
718
+ key: 1,
719
+ class: "sv-subscription-details__payment-method",
720
+ "is-loading": __props.isLoading,
721
+ "payment-methods": [subscriptionPaymentMethod.value],
722
+ configuration: { showViewAllButton: false, showAddButton: false }
723
+ }, null, 8, ["is-loading", "payment-methods"])) : createCommentVNode("", true),
724
+ createVNode(_sfc_main$3, {
725
+ "show-modal": Boolean(unref(pendingVariant)),
726
+ variant: unref(pendingVariant),
727
+ subscription: __props.subscription,
728
+ avatar: __props.avatar,
729
+ onConfirmed: handleCancellationConfirmed,
730
+ onClose: unref(handleDismissCancellation)
731
+ }, null, 8, ["show-modal", "variant", "subscription", "avatar", "onClose"])
732
+ ]),
733
+ _: 1
734
+ });
735
+ };
736
+ }
737
+ });
738
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
739
+ __name: "SubscriptionDetails.entry.view",
740
+ props: {
741
+ configuration: { type: Object },
742
+ environment: { type: String },
743
+ locale: { type: String },
744
+ dateLocale: { type: String },
745
+ messages: { type: Object },
746
+ primaryColor: { type: String },
747
+ secondaryColor: { type: String },
748
+ isShadowRoot: { type: Boolean },
749
+ experimentalFeatures: { type: Array },
750
+ logLevel: { type: String },
751
+ onLog: { type: Function },
752
+ allowedPortalTypes: { type: Array },
753
+ portalObject: { type: Object },
754
+ cssOverrides: { type: [String, Array] },
755
+ branding: { type: Object }
756
+ },
757
+ setup(__props) {
758
+ const props = __props;
759
+ const customerId = props.portalObject.customer_id;
760
+ const {
761
+ subscription,
762
+ withPlanData,
763
+ get: fetchSubscription,
764
+ error
765
+ } = useSubscription({ subscriptionId: props.configuration.subscriptionId });
766
+ const { customer, get: fetchCustomer } = useCustomer({ customerId });
767
+ const { items: paymentMethods, fetchAll: fetchPaymentMethods } = usePaymentMethods({ customerId });
768
+ const {
769
+ walletBalances,
770
+ apiStatus: walletBalancesApiStatus,
771
+ fetch: fetchWalletBalances
772
+ } = useCustomerWalletBalances({ customerId });
773
+ const { isLoading } = useLoadInitialData(
774
+ fetchSubscription(),
775
+ fetchCustomer.execute(),
776
+ fetchPaymentMethods(),
777
+ fetchWalletBalances()
778
+ );
779
+ const schedulesData = computed(() => subscription.value ? withPlanData(subscription.value) : []);
780
+ const walletBalanceItems = computed(() => {
781
+ var _a;
782
+ return ((_a = walletBalances.value) == null ? void 0 : _a.wallet_balances) ?? [];
783
+ });
784
+ const hasWalletBalancesError = computed(() => walletBalancesApiStatus.value === ApiStatus.Failed);
785
+ return (_ctx, _cache) => {
786
+ return renderSlot(_ctx.$slots, "default", {
787
+ subscription: unref(subscription),
788
+ schedulesData: schedulesData.value,
789
+ customer: unref(customer),
790
+ paymentMethods: unref(paymentMethods),
791
+ walletBalances: walletBalanceItems.value,
792
+ hasWalletBalancesError: hasWalletBalancesError.value,
793
+ isLoading: unref(isLoading),
794
+ error: unref(error),
795
+ refreshWalletBalances: unref(fetchWalletBalances),
796
+ refreshPaymentMethods: unref(fetchPaymentMethods),
797
+ refreshSubscription: unref(fetchSubscription)
798
+ });
799
+ };
800
+ }
801
+ });
802
+ const _sfc_main = /* @__PURE__ */ defineComponent({
803
+ __name: "SubscriptionDetails.entry",
804
+ props: {
805
+ configuration: { type: Object },
806
+ environment: { type: String },
807
+ locale: { type: String },
808
+ dateLocale: { type: String },
809
+ messages: { type: Object },
810
+ primaryColor: { type: String },
811
+ secondaryColor: { type: String },
812
+ isShadowRoot: { type: Boolean },
813
+ experimentalFeatures: { type: Array },
814
+ logLevel: { type: String },
815
+ onLog: { type: Function },
816
+ allowedPortalTypes: { type: Array },
817
+ portalObject: { type: Object },
818
+ cssOverrides: { type: [String, Array] },
819
+ branding: { type: Object }
820
+ },
821
+ setup(__props) {
822
+ return (_ctx, _cache) => {
823
+ var _a, _b, _c, _d;
824
+ return openBlock(), createBlock(unref(_sfc_main$i), {
825
+ "custom-element-name": unref(COMPONENT_NAME),
826
+ environment: __props.environment,
827
+ locale: __props.locale,
828
+ "portal-object": __props.portalObject,
829
+ "allowed-portal-types": ["CUSTOMER"],
830
+ "primary-color": (_b = (_a = __props.branding) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary,
831
+ "secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
832
+ "experimental-features": __props.experimentalFeatures,
833
+ "log-level": __props.logLevel,
834
+ "on-log": __props.onLog,
835
+ "css-overrides": __props.cssOverrides,
836
+ onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
837
+ }, {
838
+ default: withCtx(() => [
839
+ createVNode(_sfc_main$1, normalizeProps(guardReactiveProps(_ctx.$props)), {
840
+ default: withCtx(({
841
+ subscription,
842
+ schedulesData,
843
+ customer,
844
+ paymentMethods,
845
+ walletBalances,
846
+ hasWalletBalancesError,
847
+ isLoading,
848
+ error,
849
+ refreshWalletBalances,
850
+ refreshPaymentMethods,
851
+ refreshSubscription
852
+ }) => [
853
+ createVNode(_sfc_main$2, {
854
+ subscription,
855
+ "schedules-data": schedulesData,
856
+ customer,
857
+ avatar: __props.configuration.avatar,
858
+ "payment-methods": paymentMethods,
859
+ "wallet-balances": walletBalances,
860
+ "has-wallet-balances-error": hasWalletBalancesError,
861
+ "is-loading": isLoading,
862
+ error,
863
+ onTopUpCharged: refreshWalletBalances,
864
+ onAutoTopUpSaved: refreshWalletBalances,
865
+ onAutoTopUpCancelled: refreshWalletBalances,
866
+ onPaymentMethodStored: refreshPaymentMethods,
867
+ onSubscriptionChanged: refreshSubscription
868
+ }, null, 8, ["subscription", "schedules-data", "customer", "avatar", "payment-methods", "wallet-balances", "has-wallet-balances-error", "is-loading", "error", "onTopUpCharged", "onAutoTopUpSaved", "onAutoTopUpCancelled", "onPaymentMethodStored", "onSubscriptionChanged"])
869
+ ]),
870
+ _: 1
871
+ }, 16)
872
+ ]),
873
+ _: 1
874
+ }, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log", "css-overrides"]);
875
+ };
876
+ }
877
+ });
878
+ const SolvimonSubscriptionDetails = defineCustomElement(_sfc_main);
879
+ const COMPONENT_NAME = getComponentName("subscription-details");
880
+ const defineSolvimonSubscriptionDetails = () => {
881
+ if (!customElements.get(COMPONENT_NAME)) {
882
+ customElements.define(COMPONENT_NAME, SolvimonSubscriptionDetails);
883
+ }
884
+ };
885
+ export {
886
+ COMPONENT_NAME,
887
+ SolvimonSubscriptionDetails,
888
+ defineSolvimonSubscriptionDetails
889
+ };