@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
@@ -1,1102 +0,0 @@
1
- import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, Fragment, createCommentVNode, renderList, ref, onMounted, watch, onUnmounted, normalizeClass } from "vue";
2
- import { u as useIntl, _ as _sfc_main$5, A as _sfc_main$6, e as _sfc_main$7, x as _sfc_main$8, F as _sfc_main$9, B as formatAmount, c as _sfc_main$b, E as _sfc_main$e, g as getCustomerCountry } from "../../vendor-ui-B8IlviSs.mjs";
3
- import { _ as _sfc_main$a, a as _sfc_main$f, b as _sfc_main$g } from "../../SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs";
4
- import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
5
- import { c as createRequestService, u as useConfig, a as useLogger, _ as _sfc_main$i, d as defineCustomElement, g as getComponentName } from "../../component-Bg2JVC_O.mjs";
6
- import { u as useActionDispatchProvider } from "../../useActionDispatchProvider-Dz8-e4gZ.mjs";
7
- import { u as usePortal } from "../../usePortal-B1O1zgdV.mjs";
8
- import { c as createSubscriptionsService } from "../../subscriptions-BPYyv09M.mjs";
9
- import { c as createCustomerService } from "../../customer-Bv_fqXzO.mjs";
10
- import { c as createPaymentMethodsService } from "../../paymentMethods-DvqlWe96.mjs";
11
- import { c as createInvoicesService } from "../../invoices-BGb0AwVF.mjs";
12
- import { _ as _sfc_main$h } from "../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-CrGSfZZs.mjs";
13
- import { _ as _sfc_main$d } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
14
- import { _ as _sfc_main$c } from "../../url-1Lbg5Yni.mjs";
15
- import { u as useViewport } from "../../useViewport-Bu0cyeSi.mjs";
16
- const _hoisted_1$2 = { class: "sv-order-summary__body grid grid-cols-1 gap-1" };
17
- const _hoisted_2$1 = { class: "flex items-center justify-center gap-2 px-3 py-5" };
18
- const _hoisted_3$1 = { class: "flex flex-row gap-3 px-3 py-2" };
19
- const _hoisted_4$1 = { class: "grow" };
20
- const _hoisted_5$1 = { class: "sv-order-summary__items grid grid-cols-1 gap-1" };
21
- const _hoisted_6$1 = { class: "flex flex-row gap-2 px-3 py-2" };
22
- const _hoisted_7$1 = { class: "flex flex-row gap-3 px-3 py-2" };
23
- const _hoisted_8$1 = { class: "grow" };
24
- const _hoisted_9$1 = { class: "flex flex-row gap-2 px-3 py-2" };
25
- const _sfc_main$4 = /* @__PURE__ */ defineComponent({
26
- __name: "UpgradeOrderSummary",
27
- props: {
28
- selectedPricings: { type: Array },
29
- invoice: { type: Object },
30
- loading: { type: Boolean }
31
- },
32
- setup(__props) {
33
- const props = __props;
34
- const { $t } = useIntl();
35
- const isEmpty = computed(() => props.selectedPricings.length === 0);
36
- const getPrice = (pricing) => {
37
- var _a, _b, _c, _d, _e;
38
- const band = (_e = (_d = (_c = (_b = (_a = pricing.items) == null ? void 0 : _a[0]) == null ? void 0 : _b.configs) == null ? void 0 : _c[0]) == null ? void 0 : _d.bands) == null ? void 0 : _e[0];
39
- return (band == null ? void 0 : band.fixed_amount) ?? (band == null ? void 0 : band.amount);
40
- };
41
- const invoiceHeader = computed(() => {
42
- var _a, _b, _c, _d, _e, _f, _g, _h;
43
- const group = (_d = (_c = (_b = (_a = props.invoice) == null ? void 0 : _a.periods) == null ? void 0 : _b[0]) == null ? void 0 : _c.groups) == null ? void 0 : _d[0];
44
- const product = (_e = group == null ? void 0 : group.products) == null ? void 0 : _e[0];
45
- const lineCount = invoiceLineRows.value.length;
46
- return {
47
- title: (product == null ? void 0 : product.name) ?? ((_f = group == null ? void 0 : group.product_category) == null ? void 0 : _f.name) ?? ((_g = invoiceLineRows.value[0]) == null ? void 0 : _g.description),
48
- subtitle: lineCount > 1 ? $t(
49
- {
50
- defaultMessage: "{count} items",
51
- id: "upgrade_subscription.order_summary.item_count",
52
- description: "Subtitle shown below the product name when multiple one-off items are selected"
53
- },
54
- { count: String(lineCount) }
55
- ) : (_h = invoiceLineRows.value[0]) == null ? void 0 : _h.description
56
- };
57
- });
58
- const invoiceLineRows = computed(
59
- () => {
60
- var _a;
61
- return (((_a = props.invoice) == null ? void 0 : _a.periods) ?? []).flatMap(
62
- (period, periodIndex) => period.groups.flatMap(
63
- (group, groupIndex) => (group.lines ?? []).map((line, lineIndex) => {
64
- var _a2, _b, _c, _d, _e;
65
- return {
66
- key: `${periodIndex}-${groupIndex}-${lineIndex}`,
67
- description: line.description ?? ((_b = (_a2 = line.product_items) == null ? void 0 : _a2[0]) == null ? void 0 : _b.name) ?? ((_d = (_c = group.products) == null ? void 0 : _c[0]) == null ? void 0 : _d.name) ?? ((_e = group.product_category) == null ? void 0 : _e.name) ?? "—",
68
- amount: line.amount_excluding_tax
69
- };
70
- })
71
- )
72
- );
73
- }
74
- );
75
- const selectedPricingRows = computed(
76
- () => props.selectedPricings.map((pricing) => {
77
- var _a, _b;
78
- return {
79
- key: pricing.id,
80
- description: pricing.name ?? ((_b = (_a = pricing.products) == null ? void 0 : _a[0]) == null ? void 0 : _b.name) ?? "—",
81
- amount: getPrice(pricing)
82
- };
83
- })
84
- );
85
- const title = computed(
86
- () => $t({
87
- defaultMessage: "Order summary",
88
- id: "upgrade_subscription.order_summary.title",
89
- description: "Title for the order summary section on the upgrade subscription page"
90
- })
91
- );
92
- return (_ctx, _cache) => {
93
- return openBlock(), createBlock(unref(_sfc_main$5), {
94
- class: "sv-order-summary sv-upgrade-subscription__order-summary",
95
- "no-border": "",
96
- "no-spacing": "",
97
- "content-background": "none",
98
- title: title.value
99
- }, {
100
- default: withCtx(() => [
101
- createElementVNode("div", _hoisted_1$2, [
102
- isEmpty.value ? (openBlock(), createBlock(unref(_sfc_main$5), {
103
- key: 0,
104
- "no-spacing": "",
105
- class: "sv-order-summary__empty-state"
106
- }, {
107
- default: withCtx(() => [
108
- createElementVNode("div", _hoisted_2$1, [
109
- createVNode(unref(_sfc_main$6), {
110
- icon: "shopping_cart",
111
- class: "text-gray-500"
112
- }),
113
- createVNode(unref(_sfc_main$7), {
114
- variant: "body-sm",
115
- weight: "semibold",
116
- shade: "lighter",
117
- "no-spacing": ""
118
- }, {
119
- default: withCtx(() => [
120
- createTextVNode(toDisplayString(unref($t)({
121
- defaultMessage: "Select your items",
122
- id: "upgrade_subscription.order_summary.empty_state",
123
- description: "Placeholder shown when no items are selected in the order summary"
124
- })), 1)
125
- ]),
126
- _: 1
127
- })
128
- ])
129
- ]),
130
- _: 1
131
- })) : __props.invoice ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [
132
- invoiceHeader.value.title ? (openBlock(), createBlock(unref(_sfc_main$5), {
133
- key: 0,
134
- "no-spacing": "",
135
- class: "sv-order-summary__subscription"
136
- }, {
137
- default: withCtx(() => [
138
- createElementVNode("div", _hoisted_3$1, [
139
- createElementVNode("div", _hoisted_4$1, [
140
- createVNode(unref(_sfc_main$7), {
141
- variant: "body-sm",
142
- weight: "semibold",
143
- "no-spacing": ""
144
- }, {
145
- default: withCtx(() => [
146
- createTextVNode(toDisplayString(invoiceHeader.value.title), 1)
147
- ]),
148
- _: 1
149
- }),
150
- invoiceHeader.value.subtitle ? (openBlock(), createBlock(unref(_sfc_main$7), {
151
- key: 0,
152
- variant: "body-xs",
153
- shade: "lighter",
154
- "no-spacing": ""
155
- }, {
156
- default: withCtx(() => [
157
- createTextVNode(toDisplayString(invoiceHeader.value.subtitle), 1)
158
- ]),
159
- _: 1
160
- })) : createCommentVNode("", true)
161
- ])
162
- ])
163
- ]),
164
- _: 1
165
- })) : createCommentVNode("", true),
166
- createElementVNode("div", _hoisted_5$1, [
167
- (openBlock(true), createElementBlock(Fragment, null, renderList(invoiceLineRows.value, (line) => {
168
- return openBlock(), createBlock(unref(_sfc_main$5), {
169
- key: line.key,
170
- "no-spacing": "",
171
- class: "sv-order-summary__item"
172
- }, {
173
- default: withCtx(() => [
174
- createElementVNode("div", _hoisted_6$1, [
175
- createVNode(unref(_sfc_main$7), {
176
- tag: "span",
177
- variant: "body-xs",
178
- class: "grow"
179
- }, {
180
- default: withCtx(() => [
181
- createTextVNode(toDisplayString(line.description), 1)
182
- ]),
183
- _: 2
184
- }, 1024),
185
- line.amount ? (openBlock(), createBlock(unref(_sfc_main$7), {
186
- key: 0,
187
- tag: "span",
188
- variant: "body-xs",
189
- "no-spacing": ""
190
- }, {
191
- default: withCtx(() => [
192
- createVNode(unref(_sfc_main$8), {
193
- value: line.amount
194
- }, null, 8, ["value"])
195
- ]),
196
- _: 2
197
- }, 1024)) : createCommentVNode("", true)
198
- ])
199
- ]),
200
- _: 2
201
- }, 1024);
202
- }), 128))
203
- ]),
204
- createVNode(unref(_sfc_main$5), { class: "sv-order-summary__totals" }, {
205
- default: withCtx(() => [
206
- createVNode(unref(_sfc_main$9), {
207
- class: "sv-order-summary__invoice-preview",
208
- variant: "without-products",
209
- invoice: __props.invoice,
210
- "is-customer-facing": ""
211
- }, null, 8, ["invoice"])
212
- ]),
213
- _: 1
214
- })
215
- ], 64)) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
216
- __props.loading ? (openBlock(), createBlock(unref(_sfc_main$5), {
217
- key: 0,
218
- "no-spacing": "",
219
- class: "sv-order-summary__subscription"
220
- }, {
221
- default: withCtx(() => [
222
- createElementVNode("div", _hoisted_7$1, [
223
- createElementVNode("div", _hoisted_8$1, [
224
- createVNode(unref(_sfc_main$7), {
225
- variant: "body-sm",
226
- weight: "semibold",
227
- "no-spacing": ""
228
- }, {
229
- default: withCtx(() => {
230
- var _a;
231
- return [
232
- createTextVNode(toDisplayString(selectedPricingRows.value.length > 1 ? unref($t)({
233
- defaultMessage: "Selected items",
234
- id: "upgrade_subscription.order_summary.selected_items_title",
235
- description: "Temporary order summary title shown while the invoice preview is loading"
236
- }) : (_a = selectedPricingRows.value[0]) == null ? void 0 : _a.description), 1)
237
- ];
238
- }),
239
- _: 1
240
- }),
241
- createVNode(unref(_sfc_main$7), {
242
- variant: "body-xs",
243
- shade: "lighter",
244
- "no-spacing": ""
245
- }, {
246
- default: withCtx(() => [
247
- createTextVNode(toDisplayString(selectedPricingRows.value.length > 1 ? unref($t)(
248
- {
249
- defaultMessage: "{count} items",
250
- id: "upgrade_subscription.order_summary.selected_item_count",
251
- description: "Temporary order summary subtitle shown while the invoice preview is loading"
252
- },
253
- { count: String(selectedPricingRows.value.length) }
254
- ) : unref($t)({
255
- defaultMessage: "one-off",
256
- id: "upgrade_subscription.order_summary.one_off_label",
257
- description: "One-off payment label next to a line item in order summary"
258
- })), 1)
259
- ]),
260
- _: 1
261
- })
262
- ])
263
- ])
264
- ]),
265
- _: 1
266
- })) : createCommentVNode("", true),
267
- (openBlock(true), createElementBlock(Fragment, null, renderList(selectedPricingRows.value, (pricing) => {
268
- return openBlock(), createBlock(unref(_sfc_main$5), {
269
- key: pricing.key,
270
- "no-spacing": "",
271
- class: "sv-order-summary__item"
272
- }, {
273
- default: withCtx(() => [
274
- createElementVNode("div", _hoisted_9$1, [
275
- createVNode(unref(_sfc_main$7), {
276
- tag: "span",
277
- variant: "body-xs",
278
- class: "grow"
279
- }, {
280
- default: withCtx(() => [
281
- createTextVNode(toDisplayString(pricing.description), 1)
282
- ]),
283
- _: 2
284
- }, 1024),
285
- pricing.amount ? (openBlock(), createBlock(unref(_sfc_main$7), {
286
- key: 0,
287
- tag: "span",
288
- variant: "body-xs",
289
- "no-spacing": ""
290
- }, {
291
- default: withCtx(() => [
292
- createVNode(unref(_sfc_main$8), {
293
- value: pricing.amount
294
- }, null, 8, ["value"])
295
- ]),
296
- _: 2
297
- }, 1024)) : createCommentVNode("", true)
298
- ])
299
- ]),
300
- _: 2
301
- }, 1024);
302
- }), 128)),
303
- __props.loading ? (openBlock(), createBlock(unref(_sfc_main$5), {
304
- key: 1,
305
- class: "sv-order-summary__totals"
306
- }, {
307
- default: withCtx(() => [..._cache[0] || (_cache[0] = [
308
- createElementVNode("div", { class: "grid grid-cols-1 gap-2" }, [
309
- createElementVNode("div", { class: "flex items-center justify-between gap-4" }, [
310
- createElementVNode("div", { class: "h-4 w-40 animate-pulse rounded bg-gray-100" }),
311
- createElementVNode("div", { class: "h-4 w-20 animate-pulse rounded bg-gray-100" })
312
- ]),
313
- createElementVNode("div", { class: "flex items-center justify-between gap-4" }, [
314
- createElementVNode("div", { class: "h-4 w-16 animate-pulse rounded bg-gray-100" }),
315
- createElementVNode("div", { class: "h-4 w-20 animate-pulse rounded bg-gray-100" })
316
- ]),
317
- createElementVNode("div", { class: "border-t border-gray-200 pt-2" }, [
318
- createElementVNode("div", { class: "flex items-center justify-between gap-4" }, [
319
- createElementVNode("div", { class: "h-5 w-36 animate-pulse rounded bg-gray-100" }),
320
- createElementVNode("div", { class: "h-5 w-24 animate-pulse rounded bg-gray-100" })
321
- ])
322
- ])
323
- ], -1)
324
- ])]),
325
- _: 1
326
- })) : createCommentVNode("", true)
327
- ], 64))
328
- ])
329
- ]),
330
- _: 1
331
- }, 8, ["title"]);
332
- };
333
- }
334
- });
335
- const _sfc_main$3 = /* @__PURE__ */ defineComponent({
336
- __name: "OnDemandPricingRow",
337
- props: {
338
- pricing: { type: Object },
339
- selected: { type: Boolean },
340
- loading: { type: Boolean }
341
- },
342
- emits: ["toggle"],
343
- setup(__props, { emit: __emit }) {
344
- const props = __props;
345
- const emit = __emit;
346
- const { $t } = useIntl();
347
- const title = computed(
348
- () => {
349
- var _a, _b, _c, _d, _e, _f;
350
- return props.pricing.name ?? ((_d = (_c = (_b = (_a = props.pricing.items) == null ? void 0 : _a[0]) == null ? void 0 : _b.product_items) == null ? void 0 : _c[0]) == null ? void 0 : _d.name) ?? ((_f = (_e = props.pricing.products) == null ? void 0 : _e[0]) == null ? void 0 : _f.name) ?? "—";
351
- }
352
- );
353
- const price = computed(() => {
354
- var _a, _b, _c, _d, _e;
355
- const band = (_e = (_d = (_c = (_b = (_a = props.pricing.items) == null ? void 0 : _a[0]) == null ? void 0 : _b.configs) == null ? void 0 : _c[0]) == null ? void 0 : _d.bands) == null ? void 0 : _e[0];
356
- return (band == null ? void 0 : band.fixed_amount) ?? (band == null ? void 0 : band.amount);
357
- });
358
- const description = computed(
359
- () => price.value ? `${formatAmount(price.value)} ${$t({
360
- defaultMessage: "one-off",
361
- id: "on_demand_pricing_row.one_off_label",
362
- description: "One-off label shown next to the price in an on-demand pricing row"
363
- })}` : ""
364
- );
365
- return (_ctx, _cache) => {
366
- return openBlock(), createBlock(unref(_sfc_main$5), {
367
- "content-background": __props.selected ? "none" : "gray",
368
- "content-classes": __props.selected ? "!border-primary-600 ring-1 ring-primary-600" : void 0
369
- }, {
370
- default: withCtx(() => [
371
- createVNode(_sfc_main$a, {
372
- name: title.value,
373
- description: description.value
374
- }, {
375
- default: withCtx(() => [
376
- __props.selected ? (openBlock(), createBlock(unref(_sfc_main$b), {
377
- key: 0,
378
- color: "gray",
379
- variant: "outline",
380
- size: "sm",
381
- "icon-prefix": "remove_shopping_cart",
382
- loading: __props.loading,
383
- onClick: _cache[0] || (_cache[0] = ($event) => emit("toggle", __props.pricing.id))
384
- }, {
385
- default: withCtx(() => [
386
- createTextVNode(toDisplayString(unref($t)({
387
- defaultMessage: "Remove",
388
- id: "on_demand_pricing_row.remove_button_label",
389
- description: "Label for the remove button in an on-demand pricing row"
390
- })), 1)
391
- ]),
392
- _: 1
393
- }, 8, ["loading"])) : (openBlock(), createBlock(unref(_sfc_main$b), {
394
- key: 1,
395
- color: "primary",
396
- size: "sm",
397
- "icon-prefix": "add",
398
- loading: __props.loading,
399
- onClick: _cache[1] || (_cache[1] = ($event) => emit("toggle", __props.pricing.id))
400
- }, {
401
- default: withCtx(() => [
402
- createTextVNode(toDisplayString(unref($t)({
403
- defaultMessage: "Add to cart",
404
- id: "on_demand_pricing_row.add_to_cart_button_label",
405
- description: "Label for the add to cart button in an on-demand pricing row"
406
- })), 1)
407
- ]),
408
- _: 1
409
- }, 8, ["loading"]))
410
- ]),
411
- _: 1
412
- }, 8, ["name", "description"])
413
- ]),
414
- _: 1
415
- }, 8, ["content-background", "content-classes"]);
416
- };
417
- }
418
- });
419
- const _hoisted_1$1 = { class: "sv-pricing-list__items grid grid-cols-1 gap-1" };
420
- const _sfc_main$2 = /* @__PURE__ */ defineComponent({
421
- __name: "OnDemandPricingList",
422
- props: {
423
- categories: { type: Array },
424
- selectedPricingIds: { type: Array },
425
- loadingPricingId: { type: String }
426
- },
427
- emits: ["toggle"],
428
- setup(__props, { emit: __emit }) {
429
- const props = __props;
430
- const emit = __emit;
431
- const { $t } = useIntl();
432
- const sortedCategories = computed(
433
- () => [...props.categories].sort((a, b) => (a.display_order ?? 0) - (b.display_order ?? 0))
434
- );
435
- const getCategoryTitle = (category) => {
436
- var _a;
437
- return ((_a = category.product_category) == null ? void 0 : _a.name) ?? category.name ?? $t({
438
- defaultMessage: "Items",
439
- id: "on_demand_pricing_list.category_fallback_title",
440
- description: "Fallback title for the selectable pricing items when no product category name is available"
441
- });
442
- };
443
- return (_ctx, _cache) => {
444
- return openBlock(true), createElementBlock(Fragment, null, renderList(sortedCategories.value, (category) => {
445
- return openBlock(), createElementBlock("div", {
446
- key: category.id ?? category.display_order,
447
- class: "sv-pricing-list__category flex flex-col gap-2"
448
- }, [
449
- createVNode(unref(_sfc_main$7), {
450
- variant: "heading-3",
451
- tag: "h2",
452
- class: "sv-pricing-list__category-title"
453
- }, {
454
- default: withCtx(() => [
455
- createTextVNode(toDisplayString(getCategoryTitle(category)), 1)
456
- ]),
457
- _: 2
458
- }, 1024),
459
- createElementVNode("div", _hoisted_1$1, [
460
- (openBlock(true), createElementBlock(Fragment, null, renderList(category.pricings, (pricing) => {
461
- return openBlock(), createBlock(_sfc_main$3, {
462
- key: pricing.id,
463
- class: "sv-pricing-list__row",
464
- pricing,
465
- selected: __props.selectedPricingIds.includes(pricing.id),
466
- loading: __props.loadingPricingId === pricing.id,
467
- onToggle: _cache[0] || (_cache[0] = ($event) => emit("toggle", $event))
468
- }, null, 8, ["pricing", "selected", "loading"]);
469
- }), 128)),
470
- (openBlock(true), createElementBlock(Fragment, null, renderList(category.pricing_groups, (group) => {
471
- return openBlock(), createElementBlock(Fragment, {
472
- key: group.id
473
- }, [
474
- createVNode(unref(_sfc_main$7), {
475
- variant: "body-sm",
476
- weight: "semibold",
477
- class: "sv-pricing-list__group-title mt-2"
478
- }, {
479
- default: withCtx(() => [
480
- createTextVNode(toDisplayString(group.name), 1)
481
- ]),
482
- _: 2
483
- }, 1024),
484
- (openBlock(true), createElementBlock(Fragment, null, renderList(group.pricings, (pricing) => {
485
- return openBlock(), createBlock(_sfc_main$3, {
486
- key: pricing.id,
487
- class: "sv-pricing-list__row",
488
- pricing,
489
- selected: __props.selectedPricingIds.includes(pricing.id),
490
- loading: __props.loadingPricingId === pricing.id,
491
- onToggle: _cache[1] || (_cache[1] = ($event) => emit("toggle", $event))
492
- }, null, 8, ["pricing", "selected", "loading"]);
493
- }), 128))
494
- ], 64);
495
- }), 128))
496
- ])
497
- ]);
498
- }), 128);
499
- };
500
- }
501
- });
502
- function createPricingPlanSchedulesService() {
503
- const request = createRequestService();
504
- const config = useConfig();
505
- function getOnDemandPricingItems({
506
- scheduleId
507
- }) {
508
- return request({
509
- url: `${config.apiUrls.config}/portal/pricing-plan-schedules/${scheduleId}/on-demand-pricing-items`
510
- });
511
- }
512
- function chargeOnDemandPricingItems({
513
- scheduleId,
514
- pricingPlanVersionId,
515
- pricingItemIds,
516
- startAt,
517
- finalizeImmediately = true,
518
- paymentMethodId
519
- }) {
520
- return request({
521
- url: `${config.apiUrls.config}/portal/pricing-plan-schedules/${scheduleId}/charge-on-demand-pricing-items`,
522
- options: { method: "POST" },
523
- data: {
524
- ...pricingPlanVersionId ? { pricing_plan_version_id: pricingPlanVersionId } : {},
525
- pricing_item_ids: pricingItemIds,
526
- ...startAt ? { start_at: startAt } : {},
527
- finalize_immediately: finalizeImmediately,
528
- ...paymentMethodId ? { payment_method_id: paymentMethodId } : {}
529
- }
530
- });
531
- }
532
- return {
533
- chargeOnDemandPricingItems,
534
- getOnDemandPricingItems
535
- };
536
- }
537
- const _hoisted_1 = {
538
- key: 0,
539
- class: "sv-upgrade-subscription sv-root sv-screen sv-upgrade-subscription--purchased flex h-full items-center justify-center p-8"
540
- };
541
- const _hoisted_2 = { class: "flex flex-col items-center text-center" };
542
- const _hoisted_3 = { class: "sv-upgrade-subscription__header" };
543
- const _hoisted_4 = {
544
- key: 1,
545
- class: "sv-upgrade-subscription__pricing-list"
546
- };
547
- const _hoisted_5 = {
548
- key: 2,
549
- class: "sv-upgrade-subscription__loading p-4"
550
- };
551
- const _hoisted_6 = { class: "sv-upgrade-subscription__payment-methods" };
552
- const _hoisted_7 = {
553
- key: 0,
554
- class: "sv-upgrade-subscription__payment-methods-body"
555
- };
556
- const _hoisted_8 = {
557
- key: 1,
558
- class: "sv-upgrade-subscription__payment-form"
559
- };
560
- const _hoisted_9 = { class: "sv-upgrade-subscription__order-summary" };
561
- const _hoisted_10 = { class: "flex flex-col gap-2" };
562
- const _sfc_main$1 = /* @__PURE__ */ defineComponent({
563
- __name: "UpgradeSubscription",
564
- props: {
565
- configuration: { type: Object }
566
- },
567
- setup(__props) {
568
- const props = __props;
569
- const { $t } = useIntl();
570
- const { getSubscription } = createSubscriptionsService();
571
- const { getCustomer } = createCustomerService();
572
- const { getOnDemandPricingItems } = createPricingPlanSchedulesService();
573
- const { getPaymentMethodOptions } = createPaymentMethodsService();
574
- const { previewChargeOnDemandPricingItems } = createInvoicesService();
575
- const portal = usePortal();
576
- const logger = useLogger();
577
- const { dispatchAction } = useActionDispatchProvider();
578
- const { isMobileViewport } = useViewport();
579
- const customerId = computed(() => portal.value.customer_id);
580
- const DEFAULT_PAYMENT_FORM_AMOUNT = {
581
- currency: "EUR",
582
- quantity: "0"
583
- };
584
- const selectedPricingIds = ref([]);
585
- const isPurchased = ref(false);
586
- const categories = ref([]);
587
- const paymentMethodOptions = ref([]);
588
- const isLoadingItems = ref(false);
589
- const isPreviewPending = ref(false);
590
- const isPurchasePending = ref(false);
591
- const previewPendingPricingId = ref(void 0);
592
- const loadError = ref(void 0);
593
- const paymentIntegrationFormRef = ref();
594
- const activeScheduleId = ref(void 0);
595
- const previewInvoice = ref(void 0);
596
- const countryCode = ref(void 0);
597
- const getActiveSchedule = async () => {
598
- const subscription = await getSubscription({
599
- id: props.configuration.subscriptionId,
600
- expanded: true
601
- });
602
- const schedules = subscription.pricing_plan_schedule_infos ?? [];
603
- const sortedSchedules = [...schedules].sort(
604
- (a, b) => Date.parse(b.start_at) - Date.parse(a.start_at)
605
- );
606
- const now = Date.now();
607
- const activeSchedule = sortedSchedules.find((schedule) => {
608
- var _a;
609
- const scheduleType = ((_a = schedule.pricing_plan_schedule) == null ? void 0 : _a.type) ?? schedule.type;
610
- const startAt = Date.parse(schedule.start_at);
611
- const endAt = schedule.end_at ? Date.parse(schedule.end_at) : void 0;
612
- const hasStarted = Number.isFinite(startAt) && startAt <= now;
613
- const hasNotEnded = endAt === void 0 || !Number.isFinite(endAt) || endAt > now;
614
- return scheduleType === "DEFAULT" && hasStarted && hasNotEnded;
615
- });
616
- if (!(activeSchedule == null ? void 0 : activeSchedule.id)) {
617
- throw new Error("No pricing plan schedule found for subscription");
618
- }
619
- return activeSchedule;
620
- };
621
- const findSourceCategory = (category, sourceCategories) => sourceCategories.find(
622
- (sourceCategory) => sourceCategory.product_category_id === category.product_category_id
623
- );
624
- const findSourcePricing = (pricing, sourcePricings = []) => sourcePricings.find((sourcePricing) => sourcePricing.id === pricing.id);
625
- const normalizePricingRows = (pricing, sourcePricing) => (pricing.items ?? []).map((item) => {
626
- var _a, _b, _c, _d, _e, _f, _g;
627
- const sourceItem = (_a = sourcePricing == null ? void 0 : sourcePricing.items) == null ? void 0 : _a.find((candidate) => candidate.id === item.id);
628
- const productItems = item.product_items ?? (sourceItem == null ? void 0 : sourceItem.product_items);
629
- return {
630
- ...pricing,
631
- id: item.id,
632
- name: ((_c = (_b = item.product_items) == null ? void 0 : _b[0]) == null ? void 0 : _c.name) ?? ((_e = (_d = sourceItem == null ? void 0 : sourceItem.product_items) == null ? void 0 : _d[0]) == null ? void 0 : _e.name) ?? pricing.name ?? (sourcePricing == null ? void 0 : sourcePricing.name) ?? ((_g = (_f = sourcePricing == null ? void 0 : sourcePricing.products) == null ? void 0 : _f[0]) == null ? void 0 : _g.name),
633
- products: pricing.products ?? (sourcePricing == null ? void 0 : sourcePricing.products),
634
- items: [
635
- {
636
- ...item,
637
- product_items: productItems
638
- }
639
- ]
640
- };
641
- });
642
- const normalizeOnDemandCategories = (categories2, sourceCategories) => categories2.map((category) => {
643
- var _a;
644
- const sourceCategory = findSourceCategory(category, sourceCategories);
645
- return {
646
- ...category,
647
- name: category.name ?? ((_a = sourceCategory == null ? void 0 : sourceCategory.product_category) == null ? void 0 : _a.name),
648
- product_category: category.product_category ?? (sourceCategory == null ? void 0 : sourceCategory.product_category),
649
- pricings: (category.pricings ?? []).flatMap(
650
- (pricing) => normalizePricingRows(pricing, findSourcePricing(pricing, sourceCategory == null ? void 0 : sourceCategory.pricings))
651
- ),
652
- pricing_groups: (category.pricing_groups ?? []).map((group) => {
653
- var _a2;
654
- const sourceGroup = (_a2 = sourceCategory == null ? void 0 : sourceCategory.pricing_groups) == null ? void 0 : _a2.find(
655
- (candidate) => candidate.id === group.id
656
- );
657
- return {
658
- ...group,
659
- name: group.name ?? (sourceGroup == null ? void 0 : sourceGroup.name),
660
- pricings: (group.pricings ?? []).flatMap(
661
- (pricing) => normalizePricingRows(
662
- pricing,
663
- findSourcePricing(pricing, sourceGroup == null ? void 0 : sourceGroup.pricings)
664
- )
665
- )
666
- };
667
- })
668
- };
669
- });
670
- const loadOnDemandPricingItems = async () => {
671
- var _a;
672
- isLoadingItems.value = true;
673
- loadError.value = void 0;
674
- try {
675
- const activeSchedule = await getActiveSchedule();
676
- activeScheduleId.value = activeSchedule.id;
677
- const [itemsResponse, optionsResponse, customer] = await Promise.all([
678
- getOnDemandPricingItems({ scheduleId: activeScheduleId.value }),
679
- getPaymentMethodOptions({ customerId: customerId.value }),
680
- getCustomer(customerId.value)
681
- ]);
682
- categories.value = normalizeOnDemandCategories(
683
- itemsResponse.pricing_categories ?? [],
684
- ((_a = activeSchedule.pricing_plan_version) == null ? void 0 : _a.pricing_categories) ?? []
685
- );
686
- paymentMethodOptions.value = optionsResponse;
687
- countryCode.value = getCustomerCountry(customer);
688
- } catch (error) {
689
- logger.error(
690
- "INITIAL_DATA_LOAD_FAILED",
691
- "Failed to load on-demand pricing items",
692
- {},
693
- error
694
- );
695
- loadError.value = $t({
696
- defaultMessage: "Unable to load items. Please try again later.",
697
- id: "upgrade_subscription.load_error",
698
- description: "Error message shown when the one-off items cannot be loaded on the upgrade subscription page"
699
- });
700
- } finally {
701
- isLoadingItems.value = false;
702
- }
703
- };
704
- onMounted(() => {
705
- void loadOnDemandPricingItems();
706
- });
707
- const allOnDemandPricings = computed(
708
- () => categories.value.flatMap((cat) => [
709
- ...cat.pricings ?? [],
710
- ...(cat.pricing_groups ?? []).flatMap((g) => g.pricings ?? [])
711
- ])
712
- );
713
- const selectedPricings = computed(
714
- () => allOnDemandPricings.value.filter((p) => selectedPricingIds.value.includes(p.id))
715
- );
716
- const selectedPricingItemIds = computed(
717
- () => selectedPricings.value.flatMap((pricing) => pricing.items ?? []).map((item) => item.id).filter((id) => !!id)
718
- );
719
- const amount = computed(() => {
720
- var _a, _b;
721
- return (_b = (_a = previewInvoice.value) == null ? void 0 : _a.tax_summary) == null ? void 0 : _b.total_amount;
722
- });
723
- const paymentFormAmount = computed(() => amount.value ?? DEFAULT_PAYMENT_FORM_AMOUNT);
724
- let previewTimer;
725
- let previewRequestId = 0;
726
- watch([selectedPricingItemIds, activeScheduleId], ([pricingItemIds, scheduleId]) => {
727
- clearTimeout(previewTimer);
728
- const requestId = ++previewRequestId;
729
- purchaseError.value = void 0;
730
- if (!scheduleId || pricingItemIds.length === 0) {
731
- previewInvoice.value = void 0;
732
- isPreviewPending.value = false;
733
- previewPendingPricingId.value = void 0;
734
- return;
735
- }
736
- isPreviewPending.value = true;
737
- previewTimer = setTimeout(() => {
738
- previewChargeOnDemandPricingItems({
739
- pricingPlanScheduleId: scheduleId,
740
- pricingItemIds
741
- }).then((invoice) => {
742
- if (requestId === previewRequestId) {
743
- previewInvoice.value = invoice;
744
- }
745
- }).catch((error) => {
746
- if (requestId !== previewRequestId) return;
747
- logger.error(
748
- "INVOICE_PREVIEW_FAILED",
749
- "Failed to load charge-on-demand invoice preview",
750
- {},
751
- error
752
- );
753
- purchaseError.value = $t({
754
- defaultMessage: "Unable to calculate the total. Please try again.",
755
- id: "upgrade_subscription.preview_error",
756
- description: "Error message shown when the upgrade subscription invoice preview cannot be loaded"
757
- });
758
- previewInvoice.value = void 0;
759
- }).finally(() => {
760
- if (requestId === previewRequestId) {
761
- isPreviewPending.value = false;
762
- previewPendingPricingId.value = void 0;
763
- }
764
- });
765
- }, 400);
766
- });
767
- const authorizationContext = computed(() => {
768
- if (!activeScheduleId.value) {
769
- throw new Error("Cannot create charge-on-demand authorization context without a schedule.");
770
- }
771
- return {
772
- type: "CHARGE_ON_DEMAND",
773
- charge_on_demand: {
774
- pricing_plan_schedule_id: activeScheduleId.value,
775
- pricing_items: selectedPricingItemIds.value.map((pricingItemId) => ({
776
- pricing_item_id: pricingItemId
777
- }))
778
- }
779
- };
780
- });
781
- const handleToggle = (pricingId) => {
782
- previewPendingPricingId.value = pricingId;
783
- if (selectedPricingIds.value.includes(pricingId)) {
784
- selectedPricingIds.value = selectedPricingIds.value.filter((id) => id !== pricingId);
785
- } else {
786
- selectedPricingIds.value = [...selectedPricingIds.value, pricingId];
787
- }
788
- };
789
- const canPurchase = computed(
790
- () => selectedPricingItemIds.value.length > 0 && !!activeScheduleId.value && !!amount.value && !isPreviewPending.value && paymentMethodOptions.value.length > 0
791
- );
792
- const purchaseError = ref(void 0);
793
- const handlePurchase = async () => {
794
- var _a;
795
- if (!canPurchase.value || isPurchasePending.value) return;
796
- purchaseError.value = void 0;
797
- isPurchasePending.value = true;
798
- (_a = paymentIntegrationFormRef.value) == null ? void 0 : _a.submit();
799
- };
800
- const handleValidatePaymentSubmit = async () => canPurchase.value;
801
- let redirectTimer;
802
- const handlePaymentSuccess = () => {
803
- isPurchasePending.value = false;
804
- isPurchased.value = true;
805
- redirectTimer = setTimeout(() => {
806
- dispatchAction({ action: "navigate-to-customer-overview" });
807
- }, 3e3);
808
- };
809
- const handlePaymentFailed = (error) => {
810
- isPurchasePending.value = false;
811
- purchaseError.value = error.message || $t({
812
- defaultMessage: "Something went wrong. Please try again.",
813
- id: "upgrade_subscription.purchase_error",
814
- description: "Error message shown when the purchase call fails on the upgrade subscription page"
815
- });
816
- };
817
- onUnmounted(() => {
818
- clearTimeout(previewTimer);
819
- clearTimeout(redirectTimer);
820
- });
821
- return (_ctx, _cache) => {
822
- return isPurchased.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
823
- createVNode(_sfc_main$c, {
824
- class: "sv-upgrade-subscription__success",
825
- status: "success",
826
- title: unref($t)({
827
- defaultMessage: "Payment successful",
828
- id: "upgrade_subscription.success.title",
829
- description: "Title shown after a successful upgrade purchase"
830
- })
831
- }, {
832
- default: withCtx(() => [
833
- createElementVNode("div", _hoisted_2, [
834
- createVNode(unref(_sfc_main$7), {
835
- variant: "body-sm",
836
- shade: "lighter",
837
- tag: "div",
838
- class: "sv-upgrade-subscription__success-message mt-1"
839
- }, {
840
- default: withCtx(() => [
841
- createTextVNode(toDisplayString(unref($t)({
842
- defaultMessage: "Your purchase has been completed.",
843
- id: "upgrade_subscription.success.subtitle",
844
- description: "Subtitle shown after a successful upgrade purchase"
845
- })), 1)
846
- ]),
847
- _: 1
848
- }),
849
- createVNode(unref(_sfc_main$7), {
850
- variant: "body-sm",
851
- shade: "lighter",
852
- tag: "div",
853
- class: "sv-upgrade-subscription__success-redirect mt-1"
854
- }, {
855
- default: withCtx(() => [
856
- createTextVNode(toDisplayString(unref($t)({
857
- defaultMessage: "You will be redirected shortly…",
858
- id: "upgrade_subscription.success.redirect",
859
- description: "Shown below the success message while the redirect timer is running"
860
- })), 1)
861
- ]),
862
- _: 1
863
- })
864
- ])
865
- ]),
866
- _: 1
867
- }, 8, ["title"])
868
- ])) : (openBlock(), createBlock(unref(ContentWithAsideLayout), {
869
- key: 1,
870
- class: "sv-upgrade-subscription sv-root sv-screen"
871
- }, {
872
- header: withCtx(() => [
873
- createElementVNode("div", _hoisted_3, [
874
- createVNode(unref(_sfc_main$7), {
875
- variant: "heading-2",
876
- tag: "h1",
877
- class: "sv-upgrade-subscription__title"
878
- }, {
879
- default: withCtx(() => [
880
- createTextVNode(toDisplayString(unref($t)({
881
- defaultMessage: "Upgrade subscription",
882
- id: "upgrade_subscription.title",
883
- description: "Title for the upgrade subscription page"
884
- })), 1)
885
- ]),
886
- _: 1
887
- })
888
- ])
889
- ]),
890
- content: withCtx(() => [
891
- unref(isMobileViewport) ? (openBlock(), createBlock(_sfc_main$4, {
892
- key: 0,
893
- class: "sv-upgrade-subscription__mobile-order-summary",
894
- "selected-pricings": selectedPricings.value,
895
- invoice: previewInvoice.value,
896
- loading: isPreviewPending.value
897
- }, null, 8, ["selected-pricings", "invoice", "loading"])) : createCommentVNode("", true),
898
- !isLoadingItems.value && !loadError.value && categories.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_4, [
899
- createVNode(_sfc_main$2, {
900
- categories: categories.value,
901
- "selected-pricing-ids": selectedPricingIds.value,
902
- "loading-pricing-id": previewPendingPricingId.value,
903
- onToggle: handleToggle
904
- }, null, 8, ["categories", "selected-pricing-ids", "loading-pricing-id"])
905
- ])) : isLoadingItems.value ? (openBlock(), createElementBlock("div", _hoisted_5, [..._cache[0] || (_cache[0] = [
906
- createElementVNode("div", { class: "sv-skeleton h-[72px] animate-pulse rounded-md bg-gray-100" }, null, -1),
907
- createElementVNode("div", { class: "sv-skeleton mt-2 h-[72px] animate-pulse rounded-md bg-gray-100" }, null, -1),
908
- createElementVNode("div", { class: "sv-skeleton mt-2 h-[72px] animate-pulse rounded-md bg-gray-100" }, null, -1)
909
- ])])) : loadError.value ? (openBlock(), createBlock(unref(_sfc_main$e), {
910
- key: 3,
911
- class: "sv-upgrade-subscription__load-error sv-error m-4",
912
- title: loadError.value
913
- }, null, 8, ["title"])) : (openBlock(), createBlock(unref(_sfc_main$7), {
914
- key: 4,
915
- variant: "body-sm",
916
- shade: "lighter",
917
- class: "sv-upgrade-subscription__empty-state p-4"
918
- }, {
919
- default: withCtx(() => [
920
- createTextVNode(toDisplayString(unref($t)({
921
- defaultMessage: "No one-off items are available for this subscription.",
922
- id: "upgrade_subscription.empty_state",
923
- description: "Shown when there are no one-off items available for the subscription"
924
- })), 1)
925
- ]),
926
- _: 1
927
- })),
928
- createElementVNode("div", _hoisted_6, [
929
- createVNode(_sfc_main$d, {
930
- variant: "section",
931
- class: "min-h-[130px]"
932
- }, {
933
- default: withCtx(() => [
934
- !isLoadingItems.value || isLoadingItems.value && paymentMethodOptions.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_7, [
935
- createVNode(unref(_sfc_main$7), {
936
- variant: "heading-3",
937
- tag: "h2",
938
- class: "sv-upgrade-subscription__payment-methods-title mb-2"
939
- }, {
940
- default: withCtx(() => [
941
- createTextVNode(toDisplayString(unref($t)({
942
- defaultMessage: "Payment method",
943
- id: "upgrade_subscription.payment_method_block.title",
944
- description: "The title of the payment method block in the upgrade subscription flow"
945
- })), 1)
946
- ]),
947
- _: 1
948
- }),
949
- paymentMethodOptions.value.length === 0 ? (openBlock(), createBlock(_sfc_main$g, {
950
- key: 0,
951
- class: "sv-upgrade-subscription__payment-methods-empty",
952
- icon: "credit_card_off"
953
- }, {
954
- title: withCtx(() => [
955
- createTextVNode(toDisplayString(unref($t)({
956
- defaultMessage: "No payment methods available",
957
- id: "upgrade_subscription.payment_method_block.no_payment_methods_available_title",
958
- description: "The title shown when there are no available payment methods"
959
- })), 1)
960
- ]),
961
- message: withCtx(() => [
962
- createTextVNode(toDisplayString(unref($t)({
963
- defaultMessage: "There are no available payment methods. Please contact support for more information.",
964
- id: "upgrade_subscription.payment_method_block.no_payment_methods_available_message",
965
- description: "The message shown when there are no available payment methods"
966
- })), 1)
967
- ]),
968
- _: 1
969
- })) : countryCode.value && activeScheduleId.value ? (openBlock(), createElementBlock("div", _hoisted_8, [
970
- createElementVNode("div", {
971
- class: normalizeClass(["sv-upgrade-subscription__payment-method-picker", { "pointer-events-none opacity-60": isPurchasePending.value }])
972
- }, [
973
- createVNode(_sfc_main$h, {
974
- ref_key: "paymentIntegrationFormRef",
975
- ref: paymentIntegrationFormRef,
976
- "customer-id": customerId.value,
977
- "country-code": countryCode.value,
978
- context: authorizationContext.value,
979
- amount: paymentFormAmount.value,
980
- variant: "AUTHORIZE",
981
- "payment-method-options": paymentMethodOptions.value,
982
- "validate-on-submit": handleValidatePaymentSubmit,
983
- "force-store-payment-method": "",
984
- onPaymentSuccess: handlePaymentSuccess,
985
- onPaymentFailed: handlePaymentFailed
986
- }, null, 8, ["customer-id", "country-code", "context", "amount", "payment-method-options"])
987
- ], 2)
988
- ])) : createCommentVNode("", true)
989
- ])) : createCommentVNode("", true)
990
- ]),
991
- _: 1
992
- })
993
- ])
994
- ]),
995
- aside: withCtx(() => [
996
- createElementVNode("div", _hoisted_9, [
997
- createVNode(_sfc_main$d, {
998
- variant: "section",
999
- class: "min-h-[220px]"
1000
- }, {
1001
- default: withCtx(() => [
1002
- createVNode(_sfc_main$4, {
1003
- "selected-pricings": selectedPricings.value,
1004
- invoice: previewInvoice.value,
1005
- loading: isPreviewPending.value
1006
- }, null, 8, ["selected-pricings", "invoice", "loading"])
1007
- ]),
1008
- _: 1
1009
- })
1010
- ]),
1011
- purchaseError.value ? (openBlock(), createBlock(unref(_sfc_main$e), {
1012
- key: 0,
1013
- class: "sv-upgrade-subscription__error sv-error",
1014
- title: purchaseError.value
1015
- }, null, 8, ["title"])) : createCommentVNode("", true),
1016
- createElementVNode("div", _hoisted_10, [
1017
- createVNode(_sfc_main$d, { class: "sv-upgrade-subscription__submit-skeleton min-h-[44px]" }, {
1018
- default: withCtx(() => [
1019
- createVNode(unref(_sfc_main$b), {
1020
- size: "lg",
1021
- class: "sv-action sv-action--primary sv-action--full-width sv-upgrade-subscription__purchase w-full",
1022
- type: "button",
1023
- disabled: !canPurchase.value || isPurchasePending.value,
1024
- loading: isPurchasePending.value,
1025
- onClick: handlePurchase
1026
- }, {
1027
- default: withCtx(() => [
1028
- createTextVNode(toDisplayString(unref($t)({
1029
- defaultMessage: "Purchase",
1030
- id: "upgrade_subscription.purchase_button.label",
1031
- description: "Label for the purchase button on the upgrade subscription page"
1032
- })), 1)
1033
- ]),
1034
- _: 1
1035
- }, 8, ["disabled", "loading"])
1036
- ]),
1037
- _: 1
1038
- }),
1039
- createVNode(_sfc_main$f, { "payment-method-options": paymentMethodOptions.value }, null, 8, ["payment-method-options"])
1040
- ])
1041
- ]),
1042
- _: 1
1043
- }));
1044
- };
1045
- }
1046
- });
1047
- const _sfc_main = /* @__PURE__ */ defineComponent({
1048
- __name: "UpgradeSubscription.entry",
1049
- props: {
1050
- environment: { type: String },
1051
- locale: { type: String },
1052
- dateLocale: { type: String },
1053
- messages: { type: Object },
1054
- primaryColor: { type: String },
1055
- secondaryColor: { type: String },
1056
- isShadowRoot: { type: Boolean },
1057
- experimentalFeatures: { type: Array },
1058
- logLevel: { type: String },
1059
- onLog: { type: Function },
1060
- allowedPortalTypes: { type: Array },
1061
- portalObject: { type: Object },
1062
- cssOverrides: { type: [String, Array] },
1063
- branding: { type: Object },
1064
- configuration: { type: Object }
1065
- },
1066
- setup(__props) {
1067
- return (_ctx, _cache) => {
1068
- var _a, _b, _c, _d;
1069
- return openBlock(), createBlock(_sfc_main$i, {
1070
- "custom-element-name": unref(COMPONENT_NAME),
1071
- environment: __props.environment,
1072
- locale: __props.locale,
1073
- "portal-object": __props.portalObject,
1074
- "allowed-portal-types": ["CUSTOMER"],
1075
- "primary-color": (_b = (_a = __props.branding) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary,
1076
- "secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
1077
- "experimental-features": __props.experimentalFeatures,
1078
- "log-level": __props.logLevel,
1079
- "on-log": __props.onLog,
1080
- "css-overrides": __props.cssOverrides,
1081
- onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
1082
- }, {
1083
- default: withCtx(() => [
1084
- createVNode(_sfc_main$1, { configuration: __props.configuration }, null, 8, ["configuration"])
1085
- ]),
1086
- _: 1
1087
- }, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log", "css-overrides"]);
1088
- };
1089
- }
1090
- });
1091
- const SolvimonUpgradeSubscription = defineCustomElement(_sfc_main);
1092
- const COMPONENT_NAME = getComponentName("upgrade-subscription");
1093
- const defineSolvimonUpgradeSubscription = () => {
1094
- if (!customElements.get(COMPONENT_NAME)) {
1095
- customElements.define(COMPONENT_NAME, SolvimonUpgradeSubscription);
1096
- }
1097
- };
1098
- export {
1099
- COMPONENT_NAME,
1100
- SolvimonUpgradeSubscription,
1101
- defineSolvimonUpgradeSubscription
1102
- };