@solvimon/solvimon-web 0.1.0-alpha.1 → 0.1.0-alpha.11

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 (196) hide show
  1. package/README.md +196 -44
  2. package/dist/ApiStatus-CyNDp_op.mjs +9 -0
  3. package/dist/ApiStatus-oqvUEWJx.js +1 -0
  4. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-B42EzZ97.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-CX8vlY2Z.mjs} +9 -6
  5. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-DGisvmez.js +1 -0
  6. package/dist/ContentWithAsideLayout-B5B8Kwaw.js +1 -0
  7. package/dist/{ContentWithAsideLayout-BC-C5Gjt.mjs → ContentWithAsideLayout-DhfUkZZg.mjs} +10 -16
  8. package/dist/{useCustomerPaymentMethodOptions-Fe_dLxfv.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Bus-5gC3.mjs} +29 -37
  9. package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CkRsyMlJ.js +1 -0
  10. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-5yBnSRap.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-Bc2hkpTb.mjs} +20 -9
  11. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D0vVUHuY.js +1 -0
  12. package/dist/PaymentHistoryBlock-BiiFJkpT.js +1 -0
  13. package/dist/PaymentHistoryBlock-D_B099M7.mjs +4 -0
  14. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CknZKCmY.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CaMDtHrL.mjs} +19 -12
  15. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-DWTEfLrE.js +1 -0
  16. package/dist/PaymentIntegrationForm-DFnwutjd.mjs +4 -0
  17. package/dist/PaymentIntegrationForm-xkf4TUaD.js +1 -0
  18. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-DTIY4s7C.js +1 -0
  19. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-uk5MO0ce.mjs +962 -0
  20. package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-BChVMzCj.mjs +50 -0
  21. package/dist/PricingGroupContent.vue_vue_type_script_setup_true_lang-Br3bEUlP.js +1 -0
  22. package/dist/{Skeleton.vue_vue_type_script_setup_true_lang-BFFJw-5h.mjs → Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs} +24 -8
  23. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js +1 -0
  24. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-AHw3iTfi.js +1 -0
  25. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-DfB5BqiH.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BkzLj8n2.mjs} +42 -36
  26. package/dist/adyen-51SvcyqV.mjs +4 -0
  27. package/dist/adyen-Bwewy3HC.mjs +172 -0
  28. package/dist/adyen-DZsyEXkw.js +1 -0
  29. package/dist/adyen-R6aSZ0Yf.js +1 -0
  30. package/dist/component-BOqPDAVk.js +1 -0
  31. package/dist/component-Djrf1L-Z.mjs +889 -0
  32. package/dist/components/BillingInformation/BillingInformation.ce.d.ts +1 -1
  33. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
  34. package/dist/components/BillingInformation/BillingInformation.es.js +99 -5
  35. package/dist/components/BillingInformationForm/BillingInformationForm.ce.d.ts +1 -1
  36. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
  37. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +582 -5
  38. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.ce.d.ts +1 -1
  39. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
  40. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +126 -5
  41. package/dist/components/Invoice/Invoice.ce.d.ts +1 -1
  42. package/dist/components/Invoice/Invoice.cjs.js +1 -1
  43. package/dist/components/Invoice/Invoice.es.js +538 -5
  44. package/dist/components/InvoiceDetails/InvoiceDetails.ce.d.ts +1 -1
  45. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  46. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +127 -5
  47. package/dist/components/InvoicesList/InvoicesList.ce.d.ts +1 -1
  48. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
  49. package/dist/components/InvoicesList/InvoicesList.es.js +106 -5
  50. package/dist/components/PaymentHistory/PaymentHistory.ce.d.ts +1 -1
  51. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  52. package/dist/components/PaymentHistory/PaymentHistory.es.js +131 -5
  53. package/dist/components/PaymentMethodForm/PaymentMethodForm.ce.d.ts +1 -1
  54. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  55. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +217 -5
  56. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.ce.d.ts +1 -1
  57. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
  58. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +154 -5
  59. package/dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts +1 -1
  60. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
  61. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +132 -5
  62. package/dist/components/WalletBalances/WalletBalances.ce.d.ts +3 -0
  63. package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -0
  64. package/dist/components/WalletBalances/WalletBalances.es.js +120 -0
  65. package/dist/core/configuration.d.ts +2 -1
  66. package/dist/core/index.cjs.js +1 -1
  67. package/dist/core/index.d.ts +1 -0
  68. package/dist/core/index.es.js +1 -1
  69. package/dist/core/registry.d.ts +1 -1
  70. package/dist/core/types.d.ts +10 -2
  71. package/dist/customer-B31QzznT.mjs +32 -0
  72. package/dist/customer-hDxW1Dbp.js +1 -0
  73. package/dist/en-US-CgPY97Vq.js +1 -0
  74. package/dist/en-US-N3CUCsVy.mjs +179 -0
  75. package/dist/index-DIFK3mcJ.js +6 -0
  76. package/dist/index-DyvRdSR7.mjs +9673 -0
  77. package/dist/index.cjs.js +1 -1
  78. package/dist/index.d.ts +3 -0
  79. package/dist/index.es.js +43 -34
  80. package/dist/{invoices-C31Wz1Bu.mjs → invoices-DIYPN2j_.mjs} +2 -1
  81. package/dist/invoices-DzkA1jDc.js +1 -0
  82. package/dist/nl-NL-B8U9b85I.mjs +197 -0
  83. package/dist/nl-NL-qMRaTRrM.js +1 -0
  84. package/dist/{paymentMethods-CrU4G_2Y.mjs → paymentMethods-67b3UlTZ.mjs} +2 -1
  85. package/dist/paymentMethods-C_sdTkSF.js +1 -0
  86. package/dist/{payments-C3LPk9k9.js → payments-DkHhTHto.js} +1 -1
  87. package/dist/{payments-NtWI8KlU.mjs → payments-Dq6R37Fz.mjs} +1 -1
  88. package/dist/registry-BkViv4tv.js +1 -0
  89. package/dist/registry-Df_26rJy.mjs +144 -0
  90. package/dist/screens/Checkout/Checkout.ce.d.ts +1 -1
  91. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  92. package/dist/screens/Checkout/Checkout.es.js +4935 -5
  93. package/dist/screens/CustomerOverview/CustomerOverview.ce.d.ts +1 -1
  94. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
  95. package/dist/screens/CustomerOverview/CustomerOverview.es.js +154 -5
  96. package/dist/screens/PayInvoice/PayInvoice.ce.d.ts +3 -0
  97. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -0
  98. package/dist/screens/PayInvoice/PayInvoice.es.js +458 -0
  99. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +3 -0
  100. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +1 -0
  101. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +1066 -0
  102. package/dist/solvimon-web.css +1 -1
  103. package/dist/{subscriptions-3R7aMoky.mjs → subscriptions-ClGIr_aS.mjs} +2 -1
  104. package/dist/subscriptions-jelITJcX.js +1 -0
  105. package/dist/{useActionDispatchProvider-CBo_Hwu5.mjs → useActionDispatchProvider-BC57-Ufn.mjs} +1 -1
  106. package/dist/useActionDispatchProvider-rw9kWeE0.js +1 -0
  107. package/dist/useCustomer-Ba9WRtuT.mjs +25 -0
  108. package/dist/useCustomer-CUcaeQn_.js +1 -0
  109. package/dist/{useIncrementalLoading-fHCizCSo.mjs → useIncrementalLoading-Cnzh2mAz.mjs} +11 -10
  110. package/dist/useIncrementalLoading-DoTTXM2Y.js +1 -0
  111. package/dist/{useInvoiceData-dyvoDwFF.mjs → useInvoiceData-BJwwDur7.mjs} +6 -12
  112. package/dist/useInvoiceData-D2jkdmlA.js +1 -0
  113. package/dist/{useInvoicesList-rDvRzMqe.mjs → useInvoicesList-CFzAxyae.mjs} +34 -30
  114. package/dist/useInvoicesList-CaBCGs4h.js +1 -0
  115. package/dist/{useLoadInitialData-Dm48tlSO.mjs → useLoadInitialData-5sgImpzc.mjs} +5 -0
  116. package/dist/useLoadInitialData-DjwRHcAH.js +1 -0
  117. package/dist/usePaymentMethodOptions-C2k4npCQ.mjs +26 -0
  118. package/dist/usePaymentMethodOptions-DYO6xr3-.js +1 -0
  119. package/dist/{usePaymentMethods-Bq5fWl1Q.mjs → usePaymentMethods-CRWbH48K.mjs} +2 -2
  120. package/dist/{usePaymentMethods-Dbimodf0.js → usePaymentMethods-ryN_YohI.js} +1 -1
  121. package/dist/usePayments-Cw5PPEJa.mjs +36 -0
  122. package/dist/usePayments-DWXPGFvp.js +1 -0
  123. package/dist/usePortal-CxX4nrE4.js +1 -0
  124. package/dist/usePortal-cmE08vYs.mjs +12 -0
  125. package/dist/useService-Bb9r_sOQ.js +1 -0
  126. package/dist/useService-BsSEI8DZ.mjs +53 -0
  127. package/dist/useViewport-Bu0cyeSi.mjs +38 -0
  128. package/dist/useViewport-CKRY1CKR.js +1 -0
  129. package/dist/useWalletBalanceItems-CkDqmk36.mjs +109 -0
  130. package/dist/useWalletBalanceItems-CpZ1NWPr.js +1 -0
  131. package/dist/useWatchDebounced-2ZLnfgvG.js +1 -0
  132. package/dist/useWatchDebounced-D1xuIX6_.mjs +12 -0
  133. package/dist/vendor-ui-5pJF5KBP.js +1 -0
  134. package/dist/vendor-ui-C0K3osvz.mjs +27645 -0
  135. package/package.json +47 -20
  136. package/dist/BillingInformation.entry.ce-1xVdsWlL.mjs +0 -99
  137. package/dist/BillingInformation.entry.ce-DkrfEvK_.js +0 -1
  138. package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-VMlVPI4O.js +0 -1
  139. package/dist/BillingInformationForm.entry.ce-MPMirEsk.js +0 -1
  140. package/dist/BillingInformationForm.entry.ce-xfT0Jqps.mjs +0 -579
  141. package/dist/Checkout.entry.ce-Bif6vR1K.mjs +0 -5185
  142. package/dist/Checkout.entry.ce-CkQnLAn4.js +0 -1
  143. package/dist/ContentWithAsideLayout-CIVSoqFr.js +0 -1
  144. package/dist/CustomerOverview.entry.ce-C__omsVl.js +0 -1
  145. package/dist/CustomerOverview.entry.ce-Ce_Yk8-i.mjs +0 -231
  146. package/dist/CustomerPaymentMethods.entry.ce-CZwy8Aqq.mjs +0 -135
  147. package/dist/CustomerPaymentMethods.entry.ce-DnjlRHPA.js +0 -1
  148. package/dist/Invoice.entry.ce-CdJ9TPZe.mjs +0 -583
  149. package/dist/Invoice.entry.ce-Cgr43ome.js +0 -1
  150. package/dist/InvoiceDetails.entry.ce-Cnpz8CLJ.mjs +0 -130
  151. package/dist/InvoiceDetails.entry.ce-jHDyWra2.js +0 -1
  152. package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-t6E9_dWJ.js +0 -1
  153. package/dist/InvoicesList.entry.ce-38iOW5qh.js +0 -1
  154. package/dist/InvoicesList.entry.ce-BBaHEtAD.mjs +0 -105
  155. package/dist/PaymentHistory.entry.ce-DDeHMhK_.js +0 -1
  156. package/dist/PaymentHistory.entry.ce-Dw2NiP4l.mjs +0 -134
  157. package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-8UxAr2hU.js +0 -1
  158. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BCdv5DbH.mjs +0 -6568
  159. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-xJ8kJbRo.js +0 -1
  160. package/dist/PaymentMethodForm.entry.ce-f4cFExKc.mjs +0 -238
  161. package/dist/PaymentMethodForm.entry.ce-zxeBXZW6.js +0 -1
  162. package/dist/Skeleton.vue_vue_type_script_setup_true_lang-CQqTurIt.js +0 -1
  163. package/dist/SubscriptionSchedules.entry.ce-B4T_yQC1.js +0 -1
  164. package/dist/SubscriptionSchedules.entry.ce-B4vQ7QLk.mjs +0 -153
  165. package/dist/SubscriptionsList.entry.ce-B5SJCQW0.js +0 -1
  166. package/dist/SubscriptionsList.entry.ce-cNYuQZZj.mjs +0 -135
  167. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DqZLFDCv.js +0 -1
  168. package/dist/_Uint8Array-DHE03FZr.mjs +0 -507
  169. package/dist/_Uint8Array-DxISR7XF.js +0 -1
  170. package/dist/auto-B_36W1Fc.js +0 -6
  171. package/dist/auto-BfMZdgp-.mjs +0 -14207
  172. package/dist/cloneDeep-Hs8Pp07F.js +0 -1
  173. package/dist/cloneDeep-sm9cY-u2.mjs +0 -212
  174. package/dist/component-BkmcE85U.mjs +0 -58654
  175. package/dist/component-Df5eNqYX.js +0 -1
  176. package/dist/index-2jo9BSPM.js +0 -1
  177. package/dist/index-BFZ0dPh9.mjs +0 -179
  178. package/dist/index-CWSXne1Q.js +0 -1
  179. package/dist/index-D3v7hAtc.mjs +0 -253
  180. package/dist/invoices-8M_3ur_U.js +0 -1
  181. package/dist/paymentMethods-CzUqDlvc.js +0 -1
  182. package/dist/registry-By94DXE2.js +0 -1
  183. package/dist/registry-shRKDl3K.mjs +0 -127
  184. package/dist/sprite-i5T7eZnk-C55G-dBo.js +0 -1
  185. package/dist/sprite-i5T7eZnk-i5T7eZnk.mjs +0 -4
  186. package/dist/subscriptions-CqK7t-fF.js +0 -1
  187. package/dist/useActionDispatchProvider-DsIljrhi.js +0 -1
  188. package/dist/useCustomer-BRY0tuBH.mjs +0 -45
  189. package/dist/useCustomer-Dp8sGHI0.js +0 -1
  190. package/dist/useCustomerPaymentMethodOptions-DYpMDnJR.js +0 -1
  191. package/dist/useIncrementalLoading-D8oKNxX7.js +0 -1
  192. package/dist/useInvoiceData-DImEH1ca.js +0 -1
  193. package/dist/useInvoicesList-BZQ9Y0qN.js +0 -1
  194. package/dist/useLoadInitialData-BRg7IWqW.js +0 -1
  195. package/dist/useService-Dz13Nxbi.mjs +0 -272
  196. package/dist/useService-bNNi4GB8.js +0 -1
@@ -0,0 +1,1066 @@
1
+ import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createVNode, createTextVNode, toDisplayString, createElementBlock, Fragment, createElementVNode, renderList, createCommentVNode, normalizeClass, ref, onMounted, watch } from "vue";
2
+ import { u as useIntl, b as _sfc_main$7, _ as _sfc_main$8, x as formatAmount, e as _sfc_main$a, j as _sfc_main$b, l as _sfc_main$c, B as _sfc_main$d, S as _sfc_main$e } from "../../vendor-ui-C0K3osvz.mjs";
3
+ import { _ as _sfc_main$9 } from "../../PricingGroupContent.vue_vue_type_script_setup_true_lang-BChVMzCj.mjs";
4
+ import { c as createPaymentMethodsService } from "../../paymentMethods-67b3UlTZ.mjs";
5
+ import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-DhfUkZZg.mjs";
6
+ import { c as createRequestService, u as useConfig, a as useLogger, _ as _sfc_main$f, d as defineCustomElement, g as getComponentName } from "../../component-Djrf1L-Z.mjs";
7
+ import { u as useActionDispatchProvider } from "../../useActionDispatchProvider-BC57-Ufn.mjs";
8
+ import { u as usePortal } from "../../usePortal-cmE08vYs.mjs";
9
+ const mockSubscriptionGetResponse = {
10
+ id: "ppsu_hwDeeN0vhvcVCsAIdp1G",
11
+ pricing_plan_schedule_infos: [
12
+ {
13
+ id: "ppsc_IwDeeN0vhvcVCIAQdq1a",
14
+ pricing_plan_version_id: "ppve_MwDeeN0vhvcEuaADdd1f",
15
+ start_at: "2026-04-05T22:00:00Z",
16
+ pricing_plan_version: {
17
+ pricing_categories: [
18
+ {
19
+ product_category: {
20
+ id: "proc_iwDeeN0vhphn6VAtBD1w",
21
+ name: "Add ons"
22
+ },
23
+ display_order: 1,
24
+ pricings: [
25
+ {
26
+ id: "pric_ywDeeN0vhvcPguAadr1V",
27
+ name: "Integration setup",
28
+ products: [{ name: "Integration setup" }],
29
+ items: [
30
+ {
31
+ id: "prii_NwDeeN0vhvcPguAxds12",
32
+ product_items: [
33
+ {
34
+ name: "Rillet integration setup",
35
+ model_type: "ONE_OFF"
36
+ }
37
+ ],
38
+ configs: [
39
+ {
40
+ on_demand: true,
41
+ bands: [
42
+ {
43
+ fixed_amount: {
44
+ quantity: "5000.00",
45
+ currency: "EUR"
46
+ }
47
+ }
48
+ ]
49
+ }
50
+ ]
51
+ },
52
+ {
53
+ id: "prii_IwDeeN0vhvcPgvAsdS1Q",
54
+ product_items: [
55
+ {
56
+ name: "Attio integration setup",
57
+ model_type: "ONE_OFF"
58
+ }
59
+ ],
60
+ configs: [
61
+ {
62
+ on_demand: true,
63
+ // FLAT type: price is in `amount`, not `fixed_amount`
64
+ bands: [
65
+ {
66
+ amount: {
67
+ quantity: "50000.00",
68
+ currency: "EUR"
69
+ }
70
+ }
71
+ ]
72
+ }
73
+ ]
74
+ }
75
+ ]
76
+ }
77
+ ],
78
+ pricing_groups: []
79
+ }
80
+ ]
81
+ }
82
+ }
83
+ ]
84
+ };
85
+ const isOnDemandOneOffItem = (item) => {
86
+ var _a, _b;
87
+ return (((_a = item.configs) == null ? void 0 : _a.some((c) => c.on_demand)) ?? false) && (((_b = item.product_items) == null ? void 0 : _b.some((pi) => pi.model_type === "ONE_OFF")) ?? false);
88
+ };
89
+ const itemToRow = (item) => {
90
+ var _a, _b;
91
+ return {
92
+ id: item.id,
93
+ name: (_b = (_a = item.product_items) == null ? void 0 : _a[0]) == null ? void 0 : _b.name,
94
+ items: [
95
+ {
96
+ id: item.id,
97
+ configs: (item.configs ?? []).map((config) => ({
98
+ bands: (config.bands ?? []).map((band) => ({
99
+ fixed_amount: band.fixed_amount ?? band.amount
100
+ }))
101
+ }))
102
+ }
103
+ ]
104
+ };
105
+ };
106
+ const pricingToRows = (pricing) => (pricing.items ?? []).filter(isOnDemandOneOffItem).map(itemToRow);
107
+ const categoryToOnDemand = (category) => ({
108
+ display_order: category.display_order,
109
+ product_category: category.product_category,
110
+ pricings: (category.pricings ?? []).flatMap(pricingToRows),
111
+ pricing_groups: (category.pricing_groups ?? []).map((group) => ({
112
+ id: group.id,
113
+ name: group.name,
114
+ pricings: (group.pricings ?? []).flatMap(pricingToRows)
115
+ })).filter((g) => g.pricings.length > 0)
116
+ });
117
+ const ITEM_PRICES_EUR = Object.fromEntries(
118
+ mockSubscriptionGetResponse.pricing_plan_schedule_infos.flatMap((s) => s.pricing_plan_version.pricing_categories).flatMap((cat) => cat.pricings).flatMap((p) => p.items).filter(isOnDemandOneOffItem).map((item) => {
119
+ var _a, _b, _c, _d, _e;
120
+ const band = (_c = (_b = (_a = item.configs) == null ? void 0 : _a[0]) == null ? void 0 : _b.bands) == null ? void 0 : _c[0];
121
+ const raw = ((_d = band == null ? void 0 : band.fixed_amount) == null ? void 0 : _d.quantity) ?? ((_e = band == null ? void 0 : band.amount) == null ? void 0 : _e.quantity) ?? "0";
122
+ return [item.id, parseFloat(raw)];
123
+ })
124
+ );
125
+ const VAT_RATE = 0.21;
126
+ const eur = (amount) => ({ quantity: amount.toFixed(2), currency: "EUR" });
127
+ const mockPaymentAcceptor = {
128
+ id: "paya_NwDeeN0vgXgeP1AyNx14",
129
+ object_type: "PAYMENT_ACCEPTOR",
130
+ status: "ACTIVE",
131
+ reference: "mock-payment-acceptor",
132
+ name: "Mock payment acceptor",
133
+ type: "PAYMENT_GATEWAY"
134
+ };
135
+ const mockPaymentIntegration = {
136
+ id: "intg_zwDeeN0vgXgeM6APNW1g",
137
+ object_type: "INTEGRATION",
138
+ reference: "mock-payment-integration",
139
+ name: "Mock payment integration",
140
+ description: "Mock payment integration",
141
+ status: "ACTIVE",
142
+ type: "PAYMENT_GATEWAY"
143
+ };
144
+ const getMockPreviewResponse = (selectedItemIds) => {
145
+ const base = selectedItemIds.reduce((sum, id) => sum + (ITEM_PRICES_EUR[id] ?? 0), 0);
146
+ const tax = Math.round(base * VAT_RATE * 100) / 100;
147
+ const total = base + tax;
148
+ return {
149
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
150
+ invoice: {
151
+ tax_summary: {
152
+ base_amount: eur(base),
153
+ tax_amount: eur(tax),
154
+ total_amount: eur(total),
155
+ country_code: "NL"
156
+ }
157
+ },
158
+ // eslint-disable-next-line @typescript-eslint/consistent-type-assertions
159
+ first_invoice: {},
160
+ invoice_infos: []
161
+ };
162
+ };
163
+ const getMockOnDemandPricingItemsResponse = (subscriptionId) => {
164
+ var _a;
165
+ const now = Date.now();
166
+ const schedules = mockSubscriptionGetResponse.pricing_plan_schedule_infos;
167
+ const activeSchedule = schedules.find((s) => {
168
+ const start = Date.parse(s.start_at);
169
+ return Number.isFinite(start) && start <= now;
170
+ }) ?? schedules[0];
171
+ const categories = (((_a = activeSchedule == null ? void 0 : activeSchedule.pricing_plan_version) == null ? void 0 : _a.pricing_categories) ?? []).map(categoryToOnDemand).filter((c) => {
172
+ var _a2, _b;
173
+ return (((_a2 = c.pricings) == null ? void 0 : _a2.length) ?? 0) > 0 || (((_b = c.pricing_groups) == null ? void 0 : _b.length) ?? 0) > 0;
174
+ });
175
+ return {
176
+ pricing_plan_subscription_id: subscriptionId || mockSubscriptionGetResponse.id,
177
+ pricing_plan_schedule_id: (activeSchedule == null ? void 0 : activeSchedule.id) ?? "",
178
+ pricing_plan_version_id: (activeSchedule == null ? void 0 : activeSchedule.pricing_plan_version_id) ?? "",
179
+ billing_period: { type: "MONTH", value: 1 },
180
+ billing_currency: "EUR",
181
+ pricing_categories: categories
182
+ };
183
+ };
184
+ const getMockPaymentMethodOptionsResponse = () => [
185
+ {
186
+ payment_acceptor: mockPaymentAcceptor,
187
+ integration: mockPaymentIntegration,
188
+ options: [
189
+ {
190
+ name: "iDeal",
191
+ payment_method_variant: "ONLINE_BANKING",
192
+ payment_gateway_variant: "ADYEN",
193
+ adyen: { name: "iDEAL | Wero", type: "ideal" }
194
+ },
195
+ {
196
+ name: "Cards",
197
+ payment_method_variant: "CARD",
198
+ payment_gateway_variant: "ADYEN",
199
+ adyen: {
200
+ name: "Cards",
201
+ type: "scheme",
202
+ brands: [
203
+ "maestro",
204
+ "accel",
205
+ "amex",
206
+ "cup",
207
+ "diners",
208
+ "hipercard",
209
+ "jcb",
210
+ "mc",
211
+ "nyce",
212
+ "pulse",
213
+ "star",
214
+ "visa"
215
+ ]
216
+ }
217
+ },
218
+ {
219
+ name: "PayPal",
220
+ payment_method_variant: "DIGITAL_WALLET",
221
+ payment_gateway_variant: "ADYEN",
222
+ adyen: { name: "PayPal", type: "paypal", configuration: { intent: "capture" } }
223
+ },
224
+ {
225
+ name: "Trustly",
226
+ payment_method_variant: "ONLINE_BANKING",
227
+ payment_gateway_variant: "ADYEN",
228
+ adyen: { name: "Trustly - Instant Bank Payment", type: "trustly" }
229
+ }
230
+ ]
231
+ }
232
+ ];
233
+ const _hoisted_1$4 = { class: "sv-order-summary__items mb-3 flex flex-col gap-2" };
234
+ const _hoisted_2$2 = { class: "sv-order-summary__tax flex flex-col gap-1 border-t pt-3" };
235
+ const _hoisted_3$1 = { class: "sv-order-summary__subtotal flex items-center justify-between" };
236
+ const _hoisted_4$1 = { class: "sv-order-summary__tax-row flex items-center justify-between" };
237
+ const _hoisted_5$1 = { class: "sv-order-summary__total flex items-center justify-between border-t pt-3" };
238
+ const _sfc_main$6 = /* @__PURE__ */ defineComponent({
239
+ __name: "UpgradeOrderSummary",
240
+ props: {
241
+ selectedPricings: { type: Array },
242
+ invoice: { type: Object },
243
+ isPending: { type: Boolean }
244
+ },
245
+ setup(__props) {
246
+ const props = __props;
247
+ const { $t } = useIntl();
248
+ const isEmpty = computed(() => props.selectedPricings.length === 0);
249
+ const getPrice = (pricing) => {
250
+ var _a, _b, _c, _d, _e, _f;
251
+ return (_f = (_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]) == null ? void 0 : _f.fixed_amount;
252
+ };
253
+ return (_ctx, _cache) => {
254
+ return openBlock(), createBlock(unref(_sfc_main$7), { class: "sv-order-summary sv-upgrade-subscription__order-summary" }, {
255
+ default: withCtx(() => {
256
+ var _a;
257
+ return [
258
+ createVNode(unref(_sfc_main$8), {
259
+ variant: "heading-3",
260
+ tag: "h2",
261
+ class: "sv-order-summary__title mb-3"
262
+ }, {
263
+ default: withCtx(() => [
264
+ createTextVNode(toDisplayString(unref($t)({
265
+ defaultMessage: "Order summary",
266
+ id: "upgrade_subscription.order_summary.title",
267
+ description: "Title for the order summary section on the upgrade subscription page"
268
+ })), 1)
269
+ ]),
270
+ _: 1
271
+ }),
272
+ isEmpty.value ? (openBlock(), createBlock(unref(_sfc_main$8), {
273
+ key: 0,
274
+ variant: "body-sm",
275
+ shade: "lighter",
276
+ class: "sv-order-summary__empty"
277
+ }, {
278
+ default: withCtx(() => [
279
+ createTextVNode(toDisplayString(unref($t)({
280
+ defaultMessage: "Select add-ons to see pricing.",
281
+ id: "upgrade_subscription.order_summary.empty_state",
282
+ description: "Placeholder shown when no add-ons are selected in the order summary"
283
+ })), 1)
284
+ ]),
285
+ _: 1
286
+ })) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
287
+ createElementVNode("div", _hoisted_1$4, [
288
+ (openBlock(true), createElementBlock(Fragment, null, renderList(__props.selectedPricings, (pricing) => {
289
+ return openBlock(), createElementBlock("div", {
290
+ key: pricing.id,
291
+ class: "sv-order-summary__item flex items-center justify-between"
292
+ }, [
293
+ createElementVNode("div", null, [
294
+ createVNode(unref(_sfc_main$8), {
295
+ variant: "body-sm",
296
+ class: "sv-order-summary__item-name"
297
+ }, {
298
+ default: withCtx(() => {
299
+ var _a2, _b;
300
+ return [
301
+ createTextVNode(toDisplayString(pricing.name ?? ((_b = (_a2 = pricing.products) == null ? void 0 : _a2[0]) == null ? void 0 : _b.name)), 1)
302
+ ];
303
+ }),
304
+ _: 2
305
+ }, 1024),
306
+ createVNode(unref(_sfc_main$8), {
307
+ variant: "body-xs",
308
+ shade: "lighter",
309
+ class: "sv-order-summary__item-meta"
310
+ }, {
311
+ default: withCtx(() => [
312
+ createTextVNode(toDisplayString(unref($t)({
313
+ defaultMessage: "one-off",
314
+ id: "upgrade_subscription.order_summary.one_off_label",
315
+ description: "One-off payment label next to a line item in order summary"
316
+ })), 1)
317
+ ]),
318
+ _: 1
319
+ })
320
+ ]),
321
+ getPrice(pricing) ? (openBlock(), createBlock(unref(_sfc_main$8), {
322
+ key: 0,
323
+ variant: "body-sm",
324
+ class: "sv-order-summary__item-price"
325
+ }, {
326
+ default: withCtx(() => [
327
+ createTextVNode(toDisplayString(unref(formatAmount)(getPrice(pricing))), 1)
328
+ ]),
329
+ _: 2
330
+ }, 1024)) : createCommentVNode("", true)
331
+ ]);
332
+ }), 128))
333
+ ]),
334
+ ((_a = __props.invoice) == null ? void 0 : _a.tax_summary) ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
335
+ createElementVNode("div", _hoisted_2$2, [
336
+ createElementVNode("div", _hoisted_3$1, [
337
+ createVNode(unref(_sfc_main$8), {
338
+ variant: "body-sm",
339
+ shade: "lighter"
340
+ }, {
341
+ default: withCtx(() => [
342
+ createTextVNode(toDisplayString(unref($t)({
343
+ defaultMessage: "Total excluding taxes",
344
+ id: "upgrade_subscription.order_summary.subtotal_label",
345
+ description: "Subtotal before tax label in order summary"
346
+ })), 1)
347
+ ]),
348
+ _: 1
349
+ }),
350
+ createVNode(unref(_sfc_main$8), { variant: "body-sm" }, {
351
+ default: withCtx(() => [
352
+ createTextVNode(toDisplayString(unref(formatAmount)(__props.invoice.tax_summary.base_amount)), 1)
353
+ ]),
354
+ _: 1
355
+ })
356
+ ]),
357
+ createElementVNode("div", _hoisted_4$1, [
358
+ createVNode(unref(_sfc_main$8), {
359
+ variant: "body-sm",
360
+ shade: "lighter"
361
+ }, {
362
+ default: withCtx(() => [
363
+ createTextVNode(toDisplayString(unref($t)({
364
+ defaultMessage: "Taxes",
365
+ id: "upgrade_subscription.order_summary.taxes_label",
366
+ description: "Tax amount label in order summary"
367
+ })), 1)
368
+ ]),
369
+ _: 1
370
+ }),
371
+ createVNode(unref(_sfc_main$8), { variant: "body-sm" }, {
372
+ default: withCtx(() => [
373
+ createTextVNode(toDisplayString(unref(formatAmount)(__props.invoice.tax_summary.tax_amount)), 1)
374
+ ]),
375
+ _: 1
376
+ })
377
+ ])
378
+ ]),
379
+ createElementVNode("div", _hoisted_5$1, [
380
+ createVNode(unref(_sfc_main$8), {
381
+ variant: "body-sm",
382
+ weight: "semibold"
383
+ }, {
384
+ default: withCtx(() => [
385
+ createTextVNode(toDisplayString(unref($t)({
386
+ defaultMessage: "Total due today",
387
+ id: "upgrade_subscription.order_summary.total_label",
388
+ description: "Total amount due today label in order summary"
389
+ })), 1)
390
+ ]),
391
+ _: 1
392
+ }),
393
+ createVNode(unref(_sfc_main$8), {
394
+ variant: "body-sm",
395
+ weight: "semibold"
396
+ }, {
397
+ default: withCtx(() => [
398
+ createTextVNode(toDisplayString(unref(formatAmount)(__props.invoice.tax_summary.total_amount)), 1)
399
+ ]),
400
+ _: 1
401
+ })
402
+ ])
403
+ ], 64)) : createCommentVNode("", true)
404
+ ], 64))
405
+ ];
406
+ }),
407
+ _: 1
408
+ });
409
+ };
410
+ }
411
+ });
412
+ const _sfc_main$5 = /* @__PURE__ */ defineComponent({
413
+ __name: "OnDemandPricingRow",
414
+ props: {
415
+ pricing: { type: Object },
416
+ selected: { type: Boolean }
417
+ },
418
+ emits: ["toggle"],
419
+ setup(__props, { emit: __emit }) {
420
+ const props = __props;
421
+ const emit = __emit;
422
+ const { $t } = useIntl();
423
+ const title = computed(() => {
424
+ var _a, _b;
425
+ return props.pricing.name ?? ((_b = (_a = props.pricing.products) == null ? void 0 : _a[0]) == null ? void 0 : _b.name) ?? "—";
426
+ });
427
+ const price = computed(() => {
428
+ var _a, _b, _c, _d, _e, _f;
429
+ return (_f = (_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]) == null ? void 0 : _f.fixed_amount;
430
+ });
431
+ const description = computed(
432
+ () => price.value ? `${formatAmount(price.value)} ${$t({
433
+ defaultMessage: "one-off",
434
+ id: "on_demand_pricing_row.one_off_label",
435
+ description: "One-off label shown next to the price in an on-demand pricing row"
436
+ })}` : ""
437
+ );
438
+ return (_ctx, _cache) => {
439
+ return openBlock(), createBlock(unref(_sfc_main$7), {
440
+ "content-background": __props.selected ? "none" : "gray",
441
+ class: normalizeClass({ "!bg-white": __props.selected })
442
+ }, {
443
+ default: withCtx(() => [
444
+ createVNode(_sfc_main$9, {
445
+ name: title.value,
446
+ description: description.value
447
+ }, {
448
+ default: withCtx(() => [
449
+ __props.selected ? (openBlock(), createBlock(unref(_sfc_main$a), {
450
+ key: 0,
451
+ color: "gray",
452
+ variant: "outline",
453
+ size: "sm",
454
+ "icon-prefix": "remove_shopping_cart",
455
+ onClick: _cache[0] || (_cache[0] = ($event) => emit("toggle", __props.pricing.id))
456
+ }, {
457
+ default: withCtx(() => [
458
+ createTextVNode(toDisplayString(unref($t)({
459
+ defaultMessage: "Remove",
460
+ id: "on_demand_pricing_row.remove_button_label",
461
+ description: "Label for the remove button in an on-demand pricing row"
462
+ })), 1)
463
+ ]),
464
+ _: 1
465
+ })) : (openBlock(), createBlock(unref(_sfc_main$a), {
466
+ key: 1,
467
+ color: "primary",
468
+ size: "sm",
469
+ "icon-prefix": "add",
470
+ onClick: _cache[1] || (_cache[1] = ($event) => emit("toggle", __props.pricing.id))
471
+ }, {
472
+ default: withCtx(() => [
473
+ createTextVNode(toDisplayString(unref($t)({
474
+ defaultMessage: "Add to cart",
475
+ id: "on_demand_pricing_row.add_to_cart_button_label",
476
+ description: "Label for the add to cart button in an on-demand pricing row"
477
+ })), 1)
478
+ ]),
479
+ _: 1
480
+ }))
481
+ ]),
482
+ _: 1
483
+ }, 8, ["name", "description"])
484
+ ]),
485
+ _: 1
486
+ }, 8, ["content-background", "class"]);
487
+ };
488
+ }
489
+ });
490
+ const _hoisted_1$3 = { class: "sv-pricing-list__items grid grid-cols-1 gap-1" };
491
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
492
+ __name: "OnDemandPricingList",
493
+ props: {
494
+ categories: { type: Array },
495
+ selectedPricingIds: { type: Array }
496
+ },
497
+ emits: ["toggle"],
498
+ setup(__props, { emit: __emit }) {
499
+ const props = __props;
500
+ const emit = __emit;
501
+ const sortedCategories = computed(
502
+ () => [...props.categories].sort((a, b) => (a.display_order ?? 0) - (b.display_order ?? 0))
503
+ );
504
+ return (_ctx, _cache) => {
505
+ return openBlock(true), createElementBlock(Fragment, null, renderList(sortedCategories.value, (category) => {
506
+ return openBlock(), createElementBlock("div", {
507
+ key: category.id ?? category.display_order,
508
+ class: "sv-pricing-list__category flex flex-col gap-2"
509
+ }, [
510
+ createVNode(unref(_sfc_main$8), {
511
+ variant: "heading-3",
512
+ tag: "h2",
513
+ class: "sv-pricing-list__category-title"
514
+ }, {
515
+ default: withCtx(() => {
516
+ var _a;
517
+ return [
518
+ createTextVNode(toDisplayString(((_a = category.product_category) == null ? void 0 : _a.name) ?? category.name), 1)
519
+ ];
520
+ }),
521
+ _: 2
522
+ }, 1024),
523
+ createElementVNode("div", _hoisted_1$3, [
524
+ (openBlock(true), createElementBlock(Fragment, null, renderList(category.pricings, (pricing) => {
525
+ return openBlock(), createBlock(_sfc_main$5, {
526
+ key: pricing.id,
527
+ class: "sv-pricing-list__row",
528
+ pricing,
529
+ selected: __props.selectedPricingIds.includes(pricing.id),
530
+ onToggle: _cache[0] || (_cache[0] = ($event) => emit("toggle", $event))
531
+ }, null, 8, ["pricing", "selected"]);
532
+ }), 128)),
533
+ (openBlock(true), createElementBlock(Fragment, null, renderList(category.pricing_groups, (group) => {
534
+ return openBlock(), createElementBlock(Fragment, {
535
+ key: group.id
536
+ }, [
537
+ createVNode(unref(_sfc_main$8), {
538
+ variant: "body-sm",
539
+ weight: "semibold",
540
+ class: "sv-pricing-list__group-title mt-2"
541
+ }, {
542
+ default: withCtx(() => [
543
+ createTextVNode(toDisplayString(group.name), 1)
544
+ ]),
545
+ _: 2
546
+ }, 1024),
547
+ (openBlock(true), createElementBlock(Fragment, null, renderList(group.pricings, (pricing) => {
548
+ return openBlock(), createBlock(_sfc_main$5, {
549
+ key: pricing.id,
550
+ class: "sv-pricing-list__row",
551
+ pricing,
552
+ selected: __props.selectedPricingIds.includes(pricing.id),
553
+ onToggle: _cache[1] || (_cache[1] = ($event) => emit("toggle", $event))
554
+ }, null, 8, ["pricing", "selected"]);
555
+ }), 128))
556
+ ], 64);
557
+ }), 128))
558
+ ])
559
+ ]);
560
+ }), 128);
561
+ };
562
+ }
563
+ });
564
+ const _hoisted_1$2 = { class: "sv-payment-method-picker flex flex-col gap-4" };
565
+ const _hoisted_2$1 = {
566
+ key: 0,
567
+ class: "sv-payment-method-picker__saved flex flex-col gap-2"
568
+ };
569
+ const _hoisted_3 = { class: "sv-payment-method-picker__options flex flex-col gap-1" };
570
+ const _hoisted_4 = {
571
+ key: 1,
572
+ class: "sv-payment-method-picker__new flex flex-col gap-2"
573
+ };
574
+ const _hoisted_5 = { class: "sv-payment-method-picker__options flex flex-col gap-1" };
575
+ const _hoisted_6 = { class: "sv-payment-method-picker__option-content flex items-center gap-3" };
576
+ const _hoisted_7 = {
577
+ key: 0,
578
+ class: "sv-payment-method-picker__option-icon flex h-9 w-9 shrink-0 items-center gap-0.5"
579
+ };
580
+ const _hoisted_8 = ["src", "alt"];
581
+ const _hoisted_9 = {
582
+ key: 1,
583
+ class: "sv-payment-method-picker__option-icon flex h-9 w-9 shrink-0 items-center justify-center overflow-clip rounded"
584
+ };
585
+ const _hoisted_10 = ["src", "alt"];
586
+ const _hoisted_11 = {
587
+ key: 2,
588
+ class: "sv-payment-method-picker__loading flex flex-col gap-1"
589
+ };
590
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
591
+ __name: "PaymentMethodPicker",
592
+ props: {
593
+ customerId: { type: String },
594
+ subscriptionId: { type: String },
595
+ selectedId: { type: String }
596
+ },
597
+ emits: ["select"],
598
+ setup(__props, { emit: __emit }) {
599
+ const props = __props;
600
+ const emit = __emit;
601
+ const { $t } = useIntl();
602
+ const { getPaymentMethods } = createPaymentMethodsService();
603
+ const savedMethods = ref([]);
604
+ const paymentMethodOptions = ref([]);
605
+ const isPending = ref(false);
606
+ const newOptions = computed(
607
+ () => paymentMethodOptions.value.flatMap((entry) => entry.options ?? [])
608
+ );
609
+ const adyenLogoUrl = (type) => `https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/${type}.svg`;
610
+ const adyenBrandLogoUrl = (brand) => `https://checkoutshopper-live.adyen.com/checkoutshopper/images/logos/small/${brand}.svg`;
611
+ const PREFERRED_BRANDS = ["visa", "mc", "amex", "maestro"];
612
+ const displayBrands = (brands) => {
613
+ if (!brands) return [];
614
+ const preferred = PREFERRED_BRANDS.filter((b) => brands.includes(b));
615
+ const rest = brands.filter((b) => !PREFERRED_BRANDS.includes(b));
616
+ return [...preferred, ...rest].slice(0, 4);
617
+ };
618
+ onMounted(async () => {
619
+ isPending.value = true;
620
+ try {
621
+ const savedResponse = await getPaymentMethods({
622
+ customerId: props.customerId,
623
+ pagination: { page: 1, pageSize: 50 }
624
+ });
625
+ savedMethods.value = savedResponse.data;
626
+ paymentMethodOptions.value = getMockPaymentMethodOptionsResponse();
627
+ } finally {
628
+ isPending.value = false;
629
+ }
630
+ });
631
+ return (_ctx, _cache) => {
632
+ return openBlock(), createElementBlock("div", _hoisted_1$2, [
633
+ savedMethods.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_2$1, [
634
+ createVNode(unref(_sfc_main$8), {
635
+ variant: "heading-3",
636
+ tag: "h2",
637
+ class: "sv-payment-method-picker__title"
638
+ }, {
639
+ default: withCtx(() => [
640
+ createTextVNode(toDisplayString(unref($t)({
641
+ defaultMessage: "Saved payment methods",
642
+ id: "upgrade_subscription.payment_picker.saved_title",
643
+ description: "Heading for the saved payment methods section in the upgrade subscription payment picker"
644
+ })), 1)
645
+ ]),
646
+ _: 1
647
+ }),
648
+ createElementVNode("div", _hoisted_3, [
649
+ (openBlock(true), createElementBlock(Fragment, null, renderList(savedMethods.value, (method) => {
650
+ return openBlock(), createBlock(unref(_sfc_main$7), {
651
+ key: method.id,
652
+ "content-background": __props.selectedId === method.id ? "none" : "gray",
653
+ class: normalizeClass([{ "sv-payment-method-picker__option--selected !bg-white": __props.selectedId === method.id }, "sv-payment-method-picker__option cursor-pointer"]),
654
+ onClick: ($event) => emit("select", method.id)
655
+ }, {
656
+ default: withCtx(() => [
657
+ createVNode(unref(_sfc_main$b), {
658
+ class: "sv-payment-method-picker__option-content",
659
+ "payment-method": method
660
+ }, null, 8, ["payment-method"])
661
+ ]),
662
+ _: 2
663
+ }, 1032, ["content-background", "class", "onClick"]);
664
+ }), 128))
665
+ ])
666
+ ])) : createCommentVNode("", true),
667
+ newOptions.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_4, [
668
+ createVNode(unref(_sfc_main$8), {
669
+ variant: "heading-3",
670
+ tag: "h2",
671
+ class: "sv-payment-method-picker__title"
672
+ }, {
673
+ default: withCtx(() => [
674
+ createTextVNode(toDisplayString(unref($t)({
675
+ defaultMessage: "All payment methods",
676
+ id: "upgrade_subscription.payment_picker.all_title",
677
+ description: "Heading for the all payment methods section in the upgrade subscription payment picker"
678
+ })), 1)
679
+ ]),
680
+ _: 1
681
+ }),
682
+ createElementVNode("div", _hoisted_5, [
683
+ (openBlock(true), createElementBlock(Fragment, null, renderList(newOptions.value, (option) => {
684
+ return openBlock(), createBlock(unref(_sfc_main$7), {
685
+ key: option.adyen.type,
686
+ "content-background": __props.selectedId === option.adyen.type ? "none" : "gray",
687
+ class: normalizeClass([{
688
+ "sv-payment-method-picker__option--selected !bg-white": __props.selectedId === option.adyen.type
689
+ }, "sv-payment-method-picker__option cursor-pointer"]),
690
+ onClick: ($event) => emit("select", option.adyen.type)
691
+ }, {
692
+ default: withCtx(() => [
693
+ createElementVNode("div", _hoisted_6, [
694
+ option.adyen.type === "scheme" ? (openBlock(), createElementBlock("div", _hoisted_7, [
695
+ (openBlock(true), createElementBlock(Fragment, null, renderList(displayBrands(option.adyen.brands), (brand) => {
696
+ return openBlock(), createElementBlock("img", {
697
+ key: brand,
698
+ src: adyenBrandLogoUrl(brand),
699
+ alt: brand,
700
+ class: "h-5 w-auto rounded"
701
+ }, null, 8, _hoisted_8);
702
+ }), 128))
703
+ ])) : (openBlock(), createElementBlock("div", _hoisted_9, [
704
+ createElementVNode("img", {
705
+ src: adyenLogoUrl(option.adyen.type),
706
+ alt: option.name,
707
+ class: "h-9 w-9 object-contain"
708
+ }, null, 8, _hoisted_10)
709
+ ])),
710
+ createVNode(unref(_sfc_main$8), {
711
+ variant: "body-sm",
712
+ class: "sv-payment-method-picker__option-label"
713
+ }, {
714
+ default: withCtx(() => [
715
+ createTextVNode(toDisplayString(option.name), 1)
716
+ ]),
717
+ _: 2
718
+ }, 1024)
719
+ ])
720
+ ]),
721
+ _: 2
722
+ }, 1032, ["content-background", "class", "onClick"]);
723
+ }), 128))
724
+ ])
725
+ ])) : createCommentVNode("", true),
726
+ isPending.value ? (openBlock(), createElementBlock("div", _hoisted_11, [..._cache[0] || (_cache[0] = [
727
+ createElementVNode("div", { class: "sv-skeleton h-[52px] animate-pulse rounded-md bg-gray-100" }, null, -1),
728
+ createElementVNode("div", { class: "sv-skeleton h-[52px] animate-pulse rounded-md bg-gray-100" }, null, -1),
729
+ createElementVNode("div", { class: "sv-skeleton h-[52px] animate-pulse rounded-md bg-gray-100" }, null, -1)
730
+ ])])) : createCommentVNode("", true)
731
+ ]);
732
+ };
733
+ }
734
+ });
735
+ const _hoisted_1$1 = { class: "flex gap-1" };
736
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
737
+ __name: "Kpi",
738
+ props: {
739
+ icon: { type: null },
740
+ kpi: { type: String }
741
+ },
742
+ setup(__props) {
743
+ return (_ctx, _cache) => {
744
+ return openBlock(), createElementBlock("div", _hoisted_1$1, [
745
+ createVNode(unref(_sfc_main$c), {
746
+ icon: __props.icon,
747
+ size: "xs"
748
+ }, null, 8, ["icon"]),
749
+ createVNode(unref(_sfc_main$8), { variant: "body-xs" }, {
750
+ default: withCtx(() => [
751
+ createTextVNode(toDisplayString(__props.kpi), 1)
752
+ ]),
753
+ _: 1
754
+ })
755
+ ]);
756
+ };
757
+ }
758
+ });
759
+ function createPricingPlanSchedulesService() {
760
+ const request = createRequestService();
761
+ const config = useConfig();
762
+ function chargeOnDemandPricingItems({
763
+ scheduleId,
764
+ pricingPlanVersionId,
765
+ pricingItemIds,
766
+ startAt,
767
+ finalizeImmediately = true,
768
+ paymentMethodId
769
+ }) {
770
+ return request({
771
+ url: `${config.apiUrls.config}/portal/pricing-plan-schedules/${scheduleId}/charge-on-demand-pricing-items`,
772
+ options: { method: "POST" },
773
+ data: {
774
+ ...pricingPlanVersionId ? { pricing_plan_version_id: pricingPlanVersionId } : {},
775
+ pricing_item_ids: pricingItemIds,
776
+ ...startAt ? { start_at: startAt } : {},
777
+ finalize_immediately: finalizeImmediately,
778
+ ...paymentMethodId ? { payment_method_id: paymentMethodId } : {}
779
+ }
780
+ });
781
+ }
782
+ return { chargeOnDemandPricingItems };
783
+ }
784
+ const _hoisted_1 = {
785
+ key: 0,
786
+ class: "sv-upgrade-subscription sv-root sv-screen sv-upgrade-subscription--purchased flex h-full items-center justify-center p-8"
787
+ };
788
+ const _hoisted_2 = { class: "sv-upgrade-subscription__success-body flex flex-col items-center py-10" };
789
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
790
+ __name: "UpgradeSubscription",
791
+ props: {
792
+ configuration: { type: Object }
793
+ },
794
+ setup(__props) {
795
+ const props = __props;
796
+ const { $t } = useIntl();
797
+ const { dispatchAction } = useActionDispatchProvider();
798
+ const { chargeOnDemandPricingItems } = createPricingPlanSchedulesService();
799
+ const portal = usePortal();
800
+ const logger = useLogger();
801
+ const customerId = computed(() => portal.value.customer_id);
802
+ const selectedPricingIds = ref([]);
803
+ const selectedPaymentMethodId = ref(void 0);
804
+ const isPurchasePending = ref(false);
805
+ const isPurchased = ref(false);
806
+ const previewInvoice = ref(void 0);
807
+ const isPreviewPending = ref(false);
808
+ const mockResponse = computed(
809
+ () => getMockOnDemandPricingItemsResponse(props.configuration.subscriptionId)
810
+ );
811
+ const categories = computed(() => mockResponse.value.pricing_categories);
812
+ const allOnDemandPricings = computed(
813
+ () => categories.value.flatMap((cat) => [
814
+ ...cat.pricings ?? [],
815
+ ...(cat.pricing_groups ?? []).flatMap((g) => g.pricings ?? [])
816
+ ])
817
+ );
818
+ const selectedPricings = computed(
819
+ () => allOnDemandPricings.value.filter((p) => selectedPricingIds.value.includes(p.id))
820
+ );
821
+ let previewTimer;
822
+ watch(selectedPricingIds, (ids) => {
823
+ clearTimeout(previewTimer);
824
+ if (ids.length === 0) {
825
+ previewInvoice.value = void 0;
826
+ isPreviewPending.value = false;
827
+ return;
828
+ }
829
+ isPreviewPending.value = true;
830
+ previewTimer = setTimeout(() => {
831
+ previewInvoice.value = getMockPreviewResponse(ids).invoice;
832
+ isPreviewPending.value = false;
833
+ }, 400);
834
+ });
835
+ const handleToggle = (pricingId) => {
836
+ if (selectedPricingIds.value.includes(pricingId)) {
837
+ selectedPricingIds.value = selectedPricingIds.value.filter((id) => id !== pricingId);
838
+ } else {
839
+ selectedPricingIds.value = [...selectedPricingIds.value, pricingId];
840
+ }
841
+ };
842
+ const canPurchase = computed(
843
+ () => selectedPricingIds.value.length > 0 && !!selectedPaymentMethodId.value
844
+ );
845
+ const purchaseError = ref(void 0);
846
+ const isSavedPaymentMethod = (id) => id.startsWith("pmet_");
847
+ const handlePurchase = async () => {
848
+ if (!canPurchase.value) return;
849
+ isPurchasePending.value = true;
850
+ purchaseError.value = void 0;
851
+ try {
852
+ const pricingItemIds = selectedPricings.value.map((p) => {
853
+ var _a, _b;
854
+ return (_b = (_a = p.items) == null ? void 0 : _a[0]) == null ? void 0 : _b.id;
855
+ }).filter((id) => !!id);
856
+ const savedMethodId = selectedPaymentMethodId.value && isSavedPaymentMethod(selectedPaymentMethodId.value) ? selectedPaymentMethodId.value : void 0;
857
+ const invoice = await chargeOnDemandPricingItems({
858
+ scheduleId: mockResponse.value.pricing_plan_schedule_id,
859
+ pricingPlanVersionId: mockResponse.value.pricing_plan_version_id,
860
+ pricingItemIds,
861
+ finalizeImmediately: true,
862
+ paymentMethodId: savedMethodId
863
+ });
864
+ if (savedMethodId) {
865
+ isPurchased.value = true;
866
+ } else {
867
+ dispatchAction({ action: "pay-invoice", data: { invoiceId: invoice.id } });
868
+ }
869
+ } catch (error) {
870
+ logger.error("PURCHASE_FAILED", "Failed to complete upgrade subscription purchase", {}, error);
871
+ purchaseError.value = $t({
872
+ defaultMessage: "Something went wrong. Please try again.",
873
+ id: "upgrade_subscription.purchase_error",
874
+ description: "Error message shown when the purchase call fails on the upgrade subscription page"
875
+ });
876
+ } finally {
877
+ isPurchasePending.value = false;
878
+ }
879
+ };
880
+ return (_ctx, _cache) => {
881
+ return isPurchased.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
882
+ createVNode(unref(_sfc_main$7), { class: "sv-upgrade-subscription__success" }, {
883
+ default: withCtx(() => [
884
+ createElementVNode("div", _hoisted_2, [
885
+ createVNode(unref(_sfc_main$c), {
886
+ icon: "check_circle",
887
+ class: "sv-upgrade-subscription__success-icon text-green-400",
888
+ size: "lg"
889
+ }),
890
+ createVNode(unref(_sfc_main$8), {
891
+ variant: "heading-3",
892
+ tag: "span",
893
+ class: "sv-upgrade-subscription__success-title mt-2"
894
+ }, {
895
+ default: withCtx(() => [
896
+ createTextVNode(toDisplayString(unref($t)({
897
+ defaultMessage: "Payment successful",
898
+ id: "upgrade_subscription.success.title",
899
+ description: "Title shown after a successful add-on purchase"
900
+ })), 1)
901
+ ]),
902
+ _: 1
903
+ }),
904
+ createVNode(unref(_sfc_main$8), {
905
+ variant: "body-sm",
906
+ shade: "lighter",
907
+ tag: "span",
908
+ class: "sv-upgrade-subscription__success-message mt-1"
909
+ }, {
910
+ default: withCtx(() => [
911
+ createTextVNode(toDisplayString(unref($t)({
912
+ defaultMessage: "Your add-ons have been activated.",
913
+ id: "upgrade_subscription.success.subtitle",
914
+ description: "Subtitle shown after a successful add-on purchase"
915
+ })), 1)
916
+ ]),
917
+ _: 1
918
+ })
919
+ ])
920
+ ]),
921
+ _: 1
922
+ })
923
+ ])) : (openBlock(), createBlock(unref(ContentWithAsideLayout), {
924
+ key: 1,
925
+ class: "sv-upgrade-subscription sv-root sv-screen"
926
+ }, {
927
+ content: withCtx(() => [
928
+ categories.value.length > 0 ? (openBlock(), createBlock(_sfc_main$4, {
929
+ key: 0,
930
+ class: "sv-upgrade-subscription__pricing-list",
931
+ categories: categories.value,
932
+ "selected-pricing-ids": selectedPricingIds.value,
933
+ onToggle: handleToggle
934
+ }, null, 8, ["categories", "selected-pricing-ids"])) : (openBlock(), createBlock(unref(_sfc_main$8), {
935
+ key: 1,
936
+ variant: "body-sm",
937
+ shade: "lighter",
938
+ class: "sv-upgrade-subscription__empty-state p-4"
939
+ }, {
940
+ default: withCtx(() => [
941
+ createTextVNode(toDisplayString(unref($t)({
942
+ defaultMessage: "No on-demand add-ons are available for this subscription.",
943
+ id: "upgrade_subscription.empty_state",
944
+ description: "Shown when there are no on-demand add-ons available for the subscription"
945
+ })), 1)
946
+ ]),
947
+ _: 1
948
+ })),
949
+ createVNode(unref(_sfc_main$e), { spacing: "sm" }),
950
+ createVNode(_sfc_main$3, {
951
+ class: "sv-upgrade-subscription__payment-method-picker",
952
+ "customer-id": customerId.value,
953
+ "subscription-id": __props.configuration.subscriptionId,
954
+ "selected-id": selectedPaymentMethodId.value,
955
+ onSelect: _cache[0] || (_cache[0] = ($event) => selectedPaymentMethodId.value = $event)
956
+ }, null, 8, ["customer-id", "subscription-id", "selected-id"])
957
+ ]),
958
+ aside: withCtx(() => [
959
+ createVNode(_sfc_main$6, {
960
+ class: "sv-upgrade-subscription__order-summary",
961
+ "selected-pricings": selectedPricings.value,
962
+ invoice: previewInvoice.value,
963
+ "is-pending": isPreviewPending.value
964
+ }, null, 8, ["selected-pricings", "invoice", "is-pending"]),
965
+ purchaseError.value ? (openBlock(), createBlock(unref(_sfc_main$d), {
966
+ key: 0,
967
+ class: "sv-upgrade-subscription__error sv-error",
968
+ title: purchaseError.value
969
+ }, null, 8, ["title"])) : createCommentVNode("", true),
970
+ createVNode(unref(_sfc_main$a), {
971
+ size: "lg",
972
+ class: "sv-action sv-action--primary sv-action--full-width sv-upgrade-subscription__purchase full-width",
973
+ type: "button",
974
+ disabled: !canPurchase.value || isPurchasePending.value,
975
+ loading: isPurchasePending.value,
976
+ onClick: handlePurchase
977
+ }, {
978
+ default: withCtx(() => [
979
+ createTextVNode(toDisplayString(unref($t)({
980
+ defaultMessage: "Purchase",
981
+ id: "upgrade_subscription.purchase_button.label",
982
+ description: "Label for the purchase button on the upgrade subscription page"
983
+ })), 1)
984
+ ]),
985
+ _: 1
986
+ }, 8, ["disabled", "loading"]),
987
+ createVNode(unref(_sfc_main$8), {
988
+ tag: "div",
989
+ variant: "body-sm",
990
+ shade: "lighter",
991
+ class: "sv-upgrade-subscription__trust-indicator flex grow justify-center"
992
+ }, {
993
+ default: withCtx(() => [
994
+ createVNode(_sfc_main$2, {
995
+ icon: "lock",
996
+ kpi: unref($t)({
997
+ defaultMessage: "Secure and encrypted payments",
998
+ id: "upgrade_subscription.kpi.encrypted_payments.label",
999
+ description: "The encrypted payments KPI shown on the upgrade subscription page"
1000
+ })
1001
+ }, null, 8, ["kpi"])
1002
+ ]),
1003
+ _: 1
1004
+ })
1005
+ ]),
1006
+ _: 1
1007
+ }));
1008
+ };
1009
+ }
1010
+ });
1011
+ const _sfc_main = /* @__PURE__ */ defineComponent({
1012
+ __name: "UpgradeSubscription.entry",
1013
+ props: {
1014
+ environment: { type: String },
1015
+ locale: { type: String },
1016
+ dateLocale: { type: String },
1017
+ messages: { type: Object },
1018
+ primaryColor: { type: String },
1019
+ secondaryColor: { type: String },
1020
+ isShadowRoot: { type: Boolean },
1021
+ experimentalFeatures: { type: Array },
1022
+ logLevel: { type: String },
1023
+ onLog: { type: Function },
1024
+ allowedPortalTypes: { type: Array },
1025
+ portalObject: { type: Object },
1026
+ cssOverrides: { type: [String, Array] },
1027
+ branding: { type: Object },
1028
+ configuration: { type: Object }
1029
+ },
1030
+ setup(__props) {
1031
+ return (_ctx, _cache) => {
1032
+ var _a, _b, _c, _d;
1033
+ return openBlock(), createBlock(_sfc_main$f, {
1034
+ "custom-element-name": unref(COMPONENT_NAME),
1035
+ environment: __props.environment,
1036
+ locale: __props.locale,
1037
+ "portal-object": __props.portalObject,
1038
+ "allowed-portal-types": ["CUSTOMER"],
1039
+ "primary-color": (_b = (_a = __props.branding) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary,
1040
+ "secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
1041
+ "experimental-features": __props.experimentalFeatures,
1042
+ "log-level": __props.logLevel,
1043
+ "on-log": __props.onLog,
1044
+ "css-overrides": __props.cssOverrides,
1045
+ onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
1046
+ }, {
1047
+ default: withCtx(() => [
1048
+ createVNode(_sfc_main$1, { configuration: __props.configuration }, null, 8, ["configuration"])
1049
+ ]),
1050
+ _: 1
1051
+ }, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log", "css-overrides"]);
1052
+ };
1053
+ }
1054
+ });
1055
+ const SolvimonUpgradeSubscription = defineCustomElement(_sfc_main);
1056
+ const COMPONENT_NAME = getComponentName("upgrade-subscription");
1057
+ const defineSolvimonUpgradeSubscription = () => {
1058
+ if (!customElements.get(COMPONENT_NAME)) {
1059
+ customElements.define(COMPONENT_NAME, SolvimonUpgradeSubscription);
1060
+ }
1061
+ };
1062
+ export {
1063
+ COMPONENT_NAME,
1064
+ SolvimonUpgradeSubscription,
1065
+ defineSolvimonUpgradeSubscription
1066
+ };