@solvimon/solvimon-web 0.1.0-alpha.15 → 0.1.0-alpha.17

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 (151) hide show
  1. package/README.md +5 -5
  2. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-ugPPvTKf.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BrPsTuoW.mjs} +2 -2
  3. package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-xuCWAVgf.js → BillingInformation.vue_vue_type_script_setup_true_lang-BuQ8bzar.js} +1 -1
  4. package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-BpN9nSMC.js → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-1Op9GjGZ.js} +1 -1
  5. package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D_PE2UbX.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CuWrBcoK.mjs} +3 -3
  6. package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-C66beqgf.js +1 -0
  7. package/dist/{useWalletBalanceItems-MlHgedWR.mjs → CustomerWalletBalances.vue_vue_type_script_setup_true_lang-D2BhuXsh.mjs} +24 -56
  8. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BbuEBiY3.js +1 -0
  9. package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-C3cqlbGY.mjs +147 -0
  10. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DU6X3zxr.js → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-dwIv_xxf.js} +1 -1
  11. package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-ryvFEQMV.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-wxP5IaGt.mjs} +1 -1
  12. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-DdpPrYxi.js → InvoiceHeader.vue_vue_type_script_setup_true_lang-05NKI2A0.js} +1 -1
  13. package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-bAiAbtMi.mjs → InvoiceHeader.vue_vue_type_script_setup_true_lang-17v07F58.mjs} +1 -1
  14. package/dist/{PaymentHistoryBlock-BKMttUyk.mjs → PaymentHistoryBlock-BitwS9Re.mjs} +1 -1
  15. package/dist/{PaymentHistoryBlock-BGbTy4Se.js → PaymentHistoryBlock-ZtmPXXwI.js} +1 -1
  16. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-C3ZUDUdw.mjs} +1 -1
  17. package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CMGK71zZ.js} +1 -1
  18. package/dist/{PaymentIntegrationForm-BGxjGJGz.mjs → PaymentIntegrationForm-BK2aLPCo.mjs} +1 -1
  19. package/dist/{PaymentIntegrationForm-liOVNKEG.js → PaymentIntegrationForm-BZTzCUiu.js} +1 -1
  20. package/dist/{PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-aP-gCq7V.mjs → PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-B_yDNGK8.mjs} +7 -7
  21. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-GN3WAr10.js +1 -0
  22. package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-h-JUw1DV.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-CIQ0vsko.mjs} +25 -14
  23. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-zRr8iihy.js +1 -0
  24. package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-BQIN3zuf.mjs +156 -0
  25. package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-DyL2-vV0.js +1 -0
  26. package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-j5VNsyu7.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-DVeB_mqK.mjs} +5 -5
  27. package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-DxndhDxR.js → PaymentMethodsList.vue_vue_type_script_setup_true_lang-OvGGejpX.js} +1 -1
  28. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BxqIfmkK.js +1 -0
  29. package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-D1TcP9PR.mjs} +115 -68
  30. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BKz2QQn9.js +1 -0
  31. package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BMXr26gF.mjs +37 -0
  32. package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-Cv6lz35J.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BDqX6OaE.mjs} +22 -119
  33. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-CyAFjCh7.js +1 -0
  34. package/dist/component-CUJ_G2Nw.mjs +962 -0
  35. package/dist/component-CiKxWtdx.js +1 -0
  36. package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -1
  37. package/dist/components/BillingInformation/BillingInformation.es.js +4 -4
  38. package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -1
  39. package/dist/components/BillingInformationForm/BillingInformationForm.es.js +3 -3
  40. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -1
  41. package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +4 -4
  42. package/dist/components/Invoice/Invoice.cjs.js +1 -1
  43. package/dist/components/Invoice/Invoice.es.js +7 -7
  44. package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
  45. package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
  46. package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
  47. package/dist/components/InvoiceHeader/InvoiceHeader.es.js +4 -4
  48. package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -1
  49. package/dist/components/InvoicesList/InvoicesList.es.js +3 -3
  50. package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -1
  51. package/dist/components/PaymentHistory/PaymentHistory.es.js +3 -3
  52. package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -1
  53. package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +6 -6
  54. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -1
  55. package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +7 -58
  56. package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -1
  57. package/dist/components/SubscriptionsList/SubscriptionsList.es.js +5 -5
  58. package/dist/components/WalletBalances/WalletBalances.cjs.js +1 -1
  59. package/dist/components/WalletBalances/WalletBalances.es.js +8 -6
  60. package/dist/core/action-request.types.d.ts +3 -3
  61. package/dist/core/index.cjs.js +1 -1
  62. package/dist/core/index.es.js +1 -1
  63. package/dist/core/types.d.ts +4 -2
  64. package/dist/{customer-B5b2tLhw.js → customer-AfRcAZ5P.js} +1 -1
  65. package/dist/{customer-CANPEYH9.mjs → customer-DAgdegIW.mjs} +1 -1
  66. package/dist/{en-US-DAgOSlgv.mjs → en-US-DSzSbgL5.mjs} +68 -36
  67. package/dist/en-US-QzQnGXP1.js +1 -0
  68. package/dist/index.cjs.js +1 -1
  69. package/dist/index.d.ts +2 -1
  70. package/dist/index.es.js +7 -4
  71. package/dist/invoices-BHgajZHq.js +1 -0
  72. package/dist/{invoices-DBv0qkgm.mjs → invoices-BXDgW8ch.mjs} +32 -16
  73. package/dist/nl-NL-C4rr-1tr.js +1 -0
  74. package/dist/{nl-NL-DCsmrA8A.mjs → nl-NL-Li7RW89R.mjs} +72 -40
  75. package/dist/{paymentMethods-u5y9B5ng.js → paymentMethods-BMcc-eTl.js} +1 -1
  76. package/dist/{paymentMethods-D-5FNN8W.mjs → paymentMethods-xzFD2L30.mjs} +2 -2
  77. package/dist/{payments-BTTtcfyI.js → payments-DMvmB5vg.js} +1 -1
  78. package/dist/{payments-BK8yzqJ5.mjs → payments-DV6csRej.mjs} +1 -1
  79. package/dist/pricing-B1uImUm4.mjs +19 -0
  80. package/dist/pricing-BEjY_5wb.js +1 -0
  81. package/dist/pricingPlanSchedule-B9HFiXy-.js +1 -0
  82. package/dist/pricingPlanSchedule-C_cqUyTk.mjs +144 -0
  83. package/dist/registry-CeMxLjwU.js +1 -0
  84. package/dist/{registry-CMo7X2FD.mjs → registry-CyENvS6l.mjs} +7 -4
  85. package/dist/screens/Checkout/Checkout.cjs.js +1 -1
  86. package/dist/screens/Checkout/Checkout.es.js +414 -675
  87. package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
  88. package/dist/screens/CustomerOverview/CustomerOverview.es.js +65 -19
  89. package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
  90. package/dist/screens/PayInvoice/PayInvoice.es.js +10 -9
  91. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
  92. package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +8 -8
  93. package/dist/screens/SubscriptionDetails/SubscriptionDetails.ce.d.ts +3 -0
  94. package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs.js +1 -0
  95. package/dist/screens/SubscriptionDetails/SubscriptionDetails.es.js +542 -0
  96. package/dist/screens/SubscriptionManagement/SubscriptionManagement.ce.d.ts +3 -0
  97. package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs.js +1 -0
  98. package/dist/screens/SubscriptionManagement/SubscriptionManagement.es.js +725 -0
  99. package/dist/solvimon-web.css +1 -1
  100. package/dist/subscription-B4dBAY9C.mjs +89 -0
  101. package/dist/subscription-b0OPx8Du.js +1 -0
  102. package/dist/{subscriptions-DHjXDyH1.mjs → subscriptions-CrNDM9qa.mjs} +6 -2
  103. package/dist/{subscriptions-AMC4DirD.js → subscriptions-DC-mxa17.js} +1 -1
  104. package/dist/{url-1Lbg5Yni.mjs → url-BjZ1Pg0l.mjs} +1 -1
  105. package/dist/url-D8GJi5rF.js +1 -0
  106. package/dist/{useActionDispatchProvider-CizNgRwv.js → useActionDispatchProvider-bqR_FeM4.js} +1 -1
  107. package/dist/{useActionDispatchProvider-DmhD9mYX.mjs → useActionDispatchProvider-zB_GKeUR.mjs} +1 -1
  108. package/dist/{useCustomer-DCPq7eHM.mjs → useCustomer-VfeQ6rG2.mjs} +2 -2
  109. package/dist/{useCustomer-DYc54GVD.js → useCustomer-bO4D6e4Z.js} +1 -1
  110. package/dist/{useIncrementalLoading-CuSndpP2.js → useIncrementalLoading-BgWuwoMo.js} +1 -1
  111. package/dist/{useIncrementalLoading-DmOT2MXH.mjs → useIncrementalLoading-C59FXHzp.mjs} +1 -1
  112. package/dist/{useInvoiceData-BajCyf-x.js → useInvoiceData-CxxkBTGY.js} +1 -1
  113. package/dist/{useInvoiceData-BgtUKbHY.mjs → useInvoiceData-Dhg-hx8C.mjs} +2 -2
  114. package/dist/useInvoicesList-BXZ9uV9i.js +1 -0
  115. package/dist/{useInvoicesList-DRD5yix0.mjs → useInvoicesList-DBz7T7sM.mjs} +4 -4
  116. package/dist/{useLoadInitialData-IlbmC6p0.mjs → useLoadInitialData-BhpIg7OF.mjs} +1 -1
  117. package/dist/{useLoadInitialData-BObRB7Vo.js → useLoadInitialData-BqiAFNFi.js} +1 -1
  118. package/dist/{usePaymentMethodOptions-CzqsebhN.js → usePaymentMethodOptions-DszFvgKX.js} +1 -1
  119. package/dist/{usePaymentMethodOptions-DRkWBjv6.mjs → usePaymentMethodOptions-PcMjtMSF.mjs} +2 -2
  120. package/dist/{usePaymentMethods-DFkRNreh.mjs → usePaymentMethods-B5AbGWsn.mjs} +2 -2
  121. package/dist/{usePaymentMethods-ZPxKg5Y3.js → usePaymentMethods-Bb1Xbads.js} +1 -1
  122. package/dist/{usePayments-E_Jsqo98.mjs → usePayments-DgoZoBZh.mjs} +3 -3
  123. package/dist/{usePayments-DwiGafZj.js → usePayments-is5c66Z6.js} +1 -1
  124. package/dist/{usePortal-CxTS2TQh.js → usePortal-C4qWsJeq.js} +1 -1
  125. package/dist/{usePortal-DcOz9FEL.mjs → usePortal-DWLtNqBB.mjs} +1 -1
  126. package/dist/{useService-DF57xuDd.mjs → useService-BZqFkz7p.mjs} +1 -1
  127. package/dist/{useService-CHrkefKd.js → useService-DKm3QtT4.js} +1 -1
  128. package/dist/useSubscription-CEZJw6wZ.mjs +23 -0
  129. package/dist/useSubscription-DuUNc1_l.js +1 -0
  130. package/dist/useTopUpModal-DNyWrHDv.mjs +1012 -0
  131. package/dist/useTopUpModal-DeF-cfCK.js +1 -0
  132. package/dist/{vendor-ui-B8IlviSs.mjs → vendor-ui-BoGKOJ36.mjs} +8642 -7077
  133. package/dist/vendor-ui-BuRqLx74.js +1 -0
  134. package/package.json +14 -7
  135. package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BxdcIX-Z.js +0 -1
  136. package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-DfdaWRO0.js +0 -1
  137. package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js +0 -1
  138. package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-D6hHXndB.js +0 -1
  139. package/dist/component-B53Df2Rt.js +0 -1
  140. package/dist/component-BSnccqm1.mjs +0 -933
  141. package/dist/en-US-C0gIE4Q1.js +0 -1
  142. package/dist/invoices-BCmE_nnb.js +0 -1
  143. package/dist/nl-NL-Br7muSHK.js +0 -1
  144. package/dist/registry-Cx7p19-6.js +0 -1
  145. package/dist/screens/UpgradeSubscription/UpgradeSubscription.ce.d.ts +0 -3
  146. package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +0 -1
  147. package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +0 -1102
  148. package/dist/url-B6-3PkW2.js +0 -1
  149. package/dist/useInvoicesList-wnvjyB_H.js +0 -1
  150. package/dist/useWalletBalanceItems-BQEXDCBg.js +0 -1
  151. package/dist/vendor-ui-C3Tq-qY_.js +0 -1
@@ -0,0 +1,542 @@
1
+ import { computed, defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, toRef, ref, renderSlot, normalizeProps, guardReactiveProps } from "vue";
2
+ import { _ as _sfc_main$f, d as defineCustomElement, g as getComponentName } from "../../component-CUJ_G2Nw.mjs";
3
+ import { u as useIntl, E as formatAmount, $ as formatBillingPeriod, _ as _sfc_main$5, e as _sfc_main$6, c as _sfc_main$7, t as _sfc_main$a } from "../../vendor-ui-BoGKOJ36.mjs";
4
+ import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
5
+ import { u as useActionDispatchProvider } from "../../useActionDispatchProvider-zB_GKeUR.mjs";
6
+ import { b as getMostRecentScheduleInfo, a as getSubscriptionName } from "../../subscription-B4dBAY9C.mjs";
7
+ import { _ as _sfc_main$c, a as _sfc_main$e } from "../../EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-C3cqlbGY.mjs";
8
+ import { _ as _sfc_main$d } from "../../SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BMXr26gF.mjs";
9
+ import { _ as _sfc_main$8, u as useCustomerWalletBalances } from "../../CustomerWalletBalances.vue_vue_type_script_setup_true_lang-D2BhuXsh.mjs";
10
+ import { u as useTopUpModal, _ as _sfc_main$9 } from "../../useTopUpModal-DNyWrHDv.mjs";
11
+ import { _ as _sfc_main$b } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
12
+ import { g as getNameFromPricing } from "../../pricing-B1uImUm4.mjs";
13
+ import { A as ApiStatus } from "../../ApiStatus-CyNDp_op.mjs";
14
+ import { u as useSubscription } from "../../useSubscription-CEZJw6wZ.mjs";
15
+ import { u as useCustomer } from "../../useCustomer-VfeQ6rG2.mjs";
16
+ import { u as usePaymentMethods } from "../../usePaymentMethods-B5AbGWsn.mjs";
17
+ import { u as useLoadInitialData } from "../../useLoadInitialData-BhpIg7OF.mjs";
18
+ function useSubscriptionActions({
19
+ subscription
20
+ }) {
21
+ const { dispatchAction } = useActionDispatchProvider();
22
+ const isCancellable = computed(() => {
23
+ if (!subscription.value) return false;
24
+ const inactivePeriods = subscription.value.inactive_periods;
25
+ return !inactivePeriods || inactivePeriods.length === 0;
26
+ });
27
+ const isRenewable = computed(() => {
28
+ var _a;
29
+ const inactivePeriods = (_a = subscription.value) == null ? void 0 : _a.inactive_periods;
30
+ return Array.isArray(inactivePeriods) && inactivePeriods.length > 0;
31
+ });
32
+ const cancel = () => {
33
+ if (!subscription.value) return;
34
+ dispatchAction({
35
+ action: "cancel-subscription",
36
+ data: { subscriptionId: subscription.value.id }
37
+ });
38
+ };
39
+ const renew = () => {
40
+ if (!subscription.value) return;
41
+ dispatchAction({
42
+ action: "renew-subscription",
43
+ data: { subscriptionId: subscription.value.id }
44
+ });
45
+ };
46
+ const manage = () => {
47
+ if (!subscription.value) return;
48
+ dispatchAction({
49
+ action: "manage-subscription",
50
+ data: { subscriptionId: subscription.value.id }
51
+ });
52
+ };
53
+ return { isCancellable, isRenewable, cancel, renew, manage };
54
+ }
55
+ function getHeadlinePrice(pricing) {
56
+ var _a, _b, _c, _d, _e, _f, _g;
57
+ const config = (_c = (_b = (_a = pricing.items) == null ? void 0 : _a[0]) == null ? void 0 : _b.configs) == null ? void 0 : _c[0];
58
+ const band = (_e = (_d = config == null ? void 0 : config.details) == null ? void 0 : _d.bands) == null ? void 0 : _e[0];
59
+ return {
60
+ amount: (band == null ? void 0 : band.amount) ?? (band == null ? void 0 : band.fixed_amount),
61
+ billingPeriod: ((_f = config == null ? void 0 : config.details) == null ? void 0 : _f.pricing_period) ?? ((_g = config == null ? void 0 : config.details) == null ? void 0 : _g.billing_period)
62
+ };
63
+ }
64
+ function getEnabledPricingsEntries(scheduleInfo) {
65
+ var _a, _b, _c;
66
+ const enabledPricingIds = new Set(
67
+ (((_a = scheduleInfo.pricing_plan_schedule) == null ? void 0 : _a.enabled_pricings) ?? []).map(
68
+ ({ pricing_id }) => pricing_id
69
+ )
70
+ );
71
+ if (enabledPricingIds.size === 0) {
72
+ return [];
73
+ }
74
+ const pricingGroups = ((_c = (_b = scheduleInfo.pricing_plan_version) == null ? void 0 : _b.pricing_categories) == null ? void 0 : _c.flatMap(
75
+ (category) => category.pricing_groups ?? []
76
+ )) ?? [];
77
+ return pricingGroups.flatMap(
78
+ (group) => (group.pricings ?? []).filter((pricing) => enabledPricingIds.has(pricing.id)).map((pricing) => ({
79
+ pricingId: pricing.id,
80
+ pricingGroupId: group.id,
81
+ groupName: group.name,
82
+ // A pricing without a name of its own is only identifiable by the choice it belongs to.
83
+ name: getNameFromPricing(pricing) || group.name,
84
+ ...getHeadlinePrice(pricing)
85
+ }))
86
+ );
87
+ }
88
+ const _hoisted_1$2 = { class: "sv-enabled-pricings-list__item-body flex items-center gap-4" };
89
+ const _hoisted_2 = { class: "sv-enabled-pricings-list__item-content grow" };
90
+ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
91
+ __name: "EnabledPricingsListItem",
92
+ props: {
93
+ entry: { type: Object }
94
+ },
95
+ emits: ["upgrade"],
96
+ setup(__props) {
97
+ const props = __props;
98
+ const { $t } = useIntl();
99
+ const price = computed(() => {
100
+ const { amount, billingPeriod } = props.entry;
101
+ if (!amount) {
102
+ return void 0;
103
+ }
104
+ if (!billingPeriod) {
105
+ return formatAmount(amount);
106
+ }
107
+ return $t(
108
+ {
109
+ defaultMessage: "{amount} per {period}",
110
+ id: "enabled_pricings_list.item.price",
111
+ description: 'The recurring price of an enabled pricing, e.g. "€ 100,00 per month"'
112
+ },
113
+ {
114
+ amount: formatAmount(amount),
115
+ period: formatBillingPeriod(billingPeriod, {
116
+ short: true,
117
+ hideValueForExactPeriods: true
118
+ })
119
+ }
120
+ );
121
+ });
122
+ return (_ctx, _cache) => {
123
+ return openBlock(), createBlock(unref(_sfc_main$5), { class: "sv-enabled-pricings-list__item" }, {
124
+ default: withCtx(() => [
125
+ createElementVNode("div", _hoisted_1$2, [
126
+ createElementVNode("div", _hoisted_2, [
127
+ createVNode(unref(_sfc_main$6), {
128
+ tag: "span",
129
+ variant: "body-sm",
130
+ weight: "semibold",
131
+ shade: "lighter",
132
+ class: "sv-enabled-pricings-list__item-group"
133
+ }, {
134
+ default: withCtx(() => [
135
+ createTextVNode(toDisplayString(__props.entry.groupName), 1)
136
+ ]),
137
+ _: 1
138
+ }),
139
+ createVNode(unref(_sfc_main$6), {
140
+ tag: "h3",
141
+ variant: "heading-3",
142
+ "no-spacing": "",
143
+ class: "sv-enabled-pricings-list__item-name"
144
+ }, {
145
+ default: withCtx(() => [
146
+ createTextVNode(toDisplayString(__props.entry.name), 1)
147
+ ]),
148
+ _: 1
149
+ }),
150
+ price.value ? (openBlock(), createBlock(unref(_sfc_main$6), {
151
+ key: 0,
152
+ tag: "span",
153
+ variant: "body-sm",
154
+ shade: "lighter",
155
+ class: "sv-enabled-pricings-list__item-price"
156
+ }, {
157
+ default: withCtx(() => [
158
+ createTextVNode(toDisplayString(price.value), 1)
159
+ ]),
160
+ _: 1
161
+ })) : createCommentVNode("", true)
162
+ ]),
163
+ createVNode(unref(_sfc_main$7), {
164
+ variant: "outline",
165
+ color: "gray",
166
+ class: "sv-action sv-action--secondary sv-enabled-pricings-list__item-upgrade shrink-0",
167
+ type: "button",
168
+ size: "xs",
169
+ onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("upgrade", __props.entry))
170
+ }, {
171
+ default: withCtx(() => [
172
+ createTextVNode(toDisplayString(unref($t)({
173
+ defaultMessage: "Upgrade",
174
+ id: "enabled_pricings_list.item.upgrade_button.label",
175
+ description: "Label for the button that changes which pricing is enabled for a group"
176
+ })), 1)
177
+ ]),
178
+ _: 1
179
+ })
180
+ ])
181
+ ]),
182
+ _: 1
183
+ });
184
+ };
185
+ }
186
+ });
187
+ const _hoisted_1$1 = { class: "sv-enabled-pricings-list__items grid grid-cols-1 gap-2" };
188
+ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
189
+ __name: "EnabledPricingsList",
190
+ props: {
191
+ pricingPlanSchedule: { type: Object }
192
+ },
193
+ emits: ["upgrade"],
194
+ setup(__props) {
195
+ const props = __props;
196
+ const { $t } = useIntl();
197
+ const entries = computed(() => getEnabledPricingsEntries(props.pricingPlanSchedule));
198
+ return (_ctx, _cache) => {
199
+ return entries.value.length > 0 ? (openBlock(), createBlock(unref(_sfc_main$5), {
200
+ key: 0,
201
+ class: "sv-enabled-pricings-list",
202
+ "content-background": "none",
203
+ "no-border": "",
204
+ "no-spacing": "",
205
+ title: unref($t)({
206
+ defaultMessage: "Upgrades",
207
+ id: "enabled_pricings_list.title",
208
+ description: "Title for the block listing the pricings enabled on a subscription"
209
+ })
210
+ }, {
211
+ default: withCtx(() => [
212
+ createElementVNode("div", _hoisted_1$1, [
213
+ (openBlock(true), createElementBlock(Fragment, null, renderList(entries.value, (entry) => {
214
+ return openBlock(), createBlock(_sfc_main$4, {
215
+ key: entry.pricingId,
216
+ entry,
217
+ onUpgrade: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("upgrade", $event))
218
+ }, null, 8, ["entry"]);
219
+ }), 128))
220
+ ])
221
+ ]),
222
+ _: 1
223
+ }, 8, ["title"])) : createCommentVNode("", true);
224
+ };
225
+ }
226
+ });
227
+ const _hoisted_1 = { class: "sv-subscription-details__header flex flex-col gap-2 md:flex-row md:items-center" };
228
+ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
229
+ __name: "SubscriptionDetails",
230
+ props: {
231
+ subscription: { type: Object },
232
+ schedulesData: { type: Array },
233
+ customer: { type: Object },
234
+ paymentMethods: { type: Array },
235
+ walletBalances: { default: () => [], type: Array },
236
+ hasWalletBalancesError: { type: Boolean },
237
+ isLoading: { type: Boolean },
238
+ error: { type: null }
239
+ },
240
+ emits: ["top-up-charged", "payment-method-stored"],
241
+ setup(__props) {
242
+ const props = __props;
243
+ const { $t } = useIntl();
244
+ const {
245
+ isCancellable,
246
+ isRenewable,
247
+ cancel: handleCancel,
248
+ renew: handleRenew,
249
+ manage: handleUpgrade
250
+ } = useSubscriptionActions({ subscription: toRef(props, "subscription") });
251
+ const currentScheduleInfo = computed(() => getMostRecentScheduleInfo(props.subscription));
252
+ const selectedBalanceItem = ref();
253
+ const topUpModal = useTopUpModal(selectedBalanceItem);
254
+ const title = computed(
255
+ () => getSubscriptionName({
256
+ subscription: props.subscription,
257
+ fallback: $t({
258
+ defaultMessage: "Subscription details",
259
+ id: "subscription_details.title",
260
+ description: "Title for the subscription details page"
261
+ })
262
+ })
263
+ );
264
+ return (_ctx, _cache) => {
265
+ return openBlock(), createBlock(unref(ContentWithAsideLayout), { class: "sv-subscription-details sv-root sv-screen" }, {
266
+ header: withCtx(() => [
267
+ createElementVNode("div", _hoisted_1, [
268
+ createVNode(unref(_sfc_main$6), {
269
+ variant: "heading-2",
270
+ tag: "h1",
271
+ class: "sv-subscription-details__title grow"
272
+ }, {
273
+ default: withCtx(() => [
274
+ createTextVNode(toDisplayString(title.value), 1)
275
+ ]),
276
+ _: 1
277
+ }),
278
+ unref(isRenewable) ? (openBlock(), createBlock(unref(_sfc_main$7), {
279
+ key: 0,
280
+ variant: "outline",
281
+ color: "gray",
282
+ class: "sv-action sv-action--secondary sv-subscription-details__renew w-full md:w-auto",
283
+ type: "button",
284
+ onClick: unref(handleRenew)
285
+ }, {
286
+ default: withCtx(() => [
287
+ createTextVNode(toDisplayString(unref($t)({
288
+ defaultMessage: "Renew subscription",
289
+ id: "subscription_details.renew_button.label",
290
+ description: "Label for the renew subscription button on the subscription details page"
291
+ })), 1)
292
+ ]),
293
+ _: 1
294
+ }, 8, ["onClick"])) : createCommentVNode("", true),
295
+ unref(isCancellable) ? (openBlock(), createBlock(unref(_sfc_main$7), {
296
+ key: 1,
297
+ variant: "outline",
298
+ color: "gray",
299
+ class: "sv-action sv-action--secondary sv-subscription-details__cancel w-full md:w-auto",
300
+ type: "button",
301
+ onClick: unref(handleCancel)
302
+ }, {
303
+ default: withCtx(() => [
304
+ createTextVNode(toDisplayString(unref($t)({
305
+ defaultMessage: "Cancel subscription",
306
+ id: "subscription_details.cancel_button.label",
307
+ description: "Label for the cancel subscription button on the subscription details page"
308
+ })), 1)
309
+ ]),
310
+ _: 1
311
+ }, 8, ["onClick"])) : createCommentVNode("", true)
312
+ ])
313
+ ]),
314
+ content: withCtx(() => [
315
+ __props.error ? (openBlock(), createBlock(unref(_sfc_main$a), {
316
+ key: 0,
317
+ class: "sv-subscription-details__error sv-error",
318
+ title: unref($t)({
319
+ defaultMessage: "Unable to load this subscription. Please try again later.",
320
+ id: "subscription_details.load_error",
321
+ description: "Error message shown when the subscription cannot be loaded on the subscription details page"
322
+ })
323
+ }, null, 8, ["title"])) : __props.isLoading ? (openBlock(), createBlock(_sfc_main$b, {
324
+ key: 1,
325
+ variant: "section",
326
+ class: "min-h-[220px]"
327
+ })) : __props.subscription ? (openBlock(), createElementBlock(Fragment, { key: 2 }, [
328
+ createVNode(unref(_sfc_main$5), {
329
+ "no-spacing": "",
330
+ class: "sv-subscription-details__summary"
331
+ }, {
332
+ default: withCtx(() => [
333
+ createVNode(_sfc_main$c, { subscription: __props.subscription }, null, 8, ["subscription"])
334
+ ]),
335
+ _: 1
336
+ }),
337
+ createVNode(_sfc_main$d, {
338
+ class: "sv-subscription-details__schedules",
339
+ "schedules-data": __props.schedulesData ?? [],
340
+ configuration: { subscriptionId: __props.subscription.id },
341
+ "is-loading": __props.isLoading
342
+ }, null, 8, ["schedules-data", "configuration", "is-loading"])
343
+ ], 64)) : (openBlock(), createBlock(_sfc_main$e, {
344
+ key: 3,
345
+ class: "sv-subscription-details__empty-state",
346
+ icon: "receipt_long"
347
+ }, {
348
+ title: withCtx(() => [
349
+ createTextVNode(toDisplayString(unref($t)({
350
+ defaultMessage: "Subscription not found",
351
+ id: "subscription_details.empty_state.title",
352
+ description: "Title shown when the requested subscription does not exist"
353
+ })), 1)
354
+ ]),
355
+ message: withCtx(() => [
356
+ createTextVNode(toDisplayString(unref($t)({
357
+ defaultMessage: "This subscription is no longer available.",
358
+ id: "subscription_details.empty_state.message",
359
+ description: "Message shown when the requested subscription does not exist"
360
+ })), 1)
361
+ ]),
362
+ _: 1
363
+ }))
364
+ ]),
365
+ aside: withCtx(() => [
366
+ createVNode(_sfc_main$8, {
367
+ class: "sv-subscription-details__wallet-balances",
368
+ "has-error": Boolean(__props.hasWalletBalancesError),
369
+ "is-loading": __props.isLoading,
370
+ "wallet-balances": __props.walletBalances,
371
+ "show-top-up-button": "",
372
+ onTopUp: _cache[0] || (_cache[0] = ($event) => selectedBalanceItem.value = $event)
373
+ }, null, 8, ["has-error", "is-loading", "wallet-balances"]),
374
+ currentScheduleInfo.value ? (openBlock(), createBlock(_sfc_main$3, {
375
+ key: 0,
376
+ class: "sv-subscription-details__upgrades",
377
+ "pricing-plan-schedule": currentScheduleInfo.value,
378
+ onUpgrade: unref(handleUpgrade)
379
+ }, null, 8, ["pricing-plan-schedule", "onUpgrade"])) : createCommentVNode("", true),
380
+ createVNode(_sfc_main$9, {
381
+ "show-modal": unref(topUpModal).showModal.value,
382
+ "payment-methods": __props.paymentMethods,
383
+ customer: __props.customer,
384
+ "selected-balance-item": selectedBalanceItem.value,
385
+ onClose: _cache[1] || (_cache[1] = ($event) => selectedBalanceItem.value = void 0),
386
+ onConfirm: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("top-up-charged")),
387
+ onPaymentSuccess: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("payment-method-stored"))
388
+ }, null, 8, ["show-modal", "payment-methods", "customer", "selected-balance-item"])
389
+ ]),
390
+ _: 1
391
+ });
392
+ };
393
+ }
394
+ });
395
+ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
396
+ __name: "SubscriptionDetails.entry.view",
397
+ props: {
398
+ configuration: { type: Object },
399
+ environment: { type: String },
400
+ locale: { type: String },
401
+ dateLocale: { type: String },
402
+ messages: { type: Object },
403
+ primaryColor: { type: String },
404
+ secondaryColor: { type: String },
405
+ isShadowRoot: { type: Boolean },
406
+ experimentalFeatures: { type: Array },
407
+ logLevel: { type: String },
408
+ onLog: { type: Function },
409
+ allowedPortalTypes: { type: Array },
410
+ portalObject: { type: Object },
411
+ cssOverrides: { type: [String, Array] },
412
+ branding: { type: Object }
413
+ },
414
+ setup(__props) {
415
+ const props = __props;
416
+ const customerId = props.portalObject.customer_id;
417
+ const {
418
+ subscription,
419
+ withPlanData,
420
+ get: fetchSubscription,
421
+ error
422
+ } = useSubscription({ subscriptionId: props.configuration.subscriptionId });
423
+ const { customer, get: fetchCustomer } = useCustomer({ customerId });
424
+ const { items: paymentMethods, fetchAll: fetchPaymentMethods } = usePaymentMethods({ customerId });
425
+ const {
426
+ walletBalances,
427
+ apiStatus: walletBalancesApiStatus,
428
+ fetch: fetchWalletBalances
429
+ } = useCustomerWalletBalances({ customerId });
430
+ const { isLoading } = useLoadInitialData(
431
+ fetchSubscription(),
432
+ fetchCustomer.execute(),
433
+ fetchPaymentMethods(),
434
+ fetchWalletBalances()
435
+ );
436
+ const schedulesData = computed(
437
+ () => subscription.value ? withPlanData(subscription.value) : []
438
+ );
439
+ const walletBalanceItems = computed(() => {
440
+ var _a;
441
+ return ((_a = walletBalances.value) == null ? void 0 : _a.wallet_balances) ?? [];
442
+ });
443
+ const hasWalletBalancesError = computed(() => walletBalancesApiStatus.value === ApiStatus.Failed);
444
+ return (_ctx, _cache) => {
445
+ return renderSlot(_ctx.$slots, "default", {
446
+ subscription: unref(subscription),
447
+ schedulesData: schedulesData.value,
448
+ customer: unref(customer),
449
+ paymentMethods: unref(paymentMethods),
450
+ walletBalances: walletBalanceItems.value,
451
+ hasWalletBalancesError: hasWalletBalancesError.value,
452
+ isLoading: unref(isLoading),
453
+ error: unref(error),
454
+ refreshWalletBalances: unref(fetchWalletBalances),
455
+ refreshPaymentMethods: unref(fetchPaymentMethods)
456
+ });
457
+ };
458
+ }
459
+ });
460
+ const _sfc_main = /* @__PURE__ */ defineComponent({
461
+ __name: "SubscriptionDetails.entry",
462
+ props: {
463
+ configuration: { type: Object },
464
+ environment: { type: String },
465
+ locale: { type: String },
466
+ dateLocale: { type: String },
467
+ messages: { type: Object },
468
+ primaryColor: { type: String },
469
+ secondaryColor: { type: String },
470
+ isShadowRoot: { type: Boolean },
471
+ experimentalFeatures: { type: Array },
472
+ logLevel: { type: String },
473
+ onLog: { type: Function },
474
+ allowedPortalTypes: { type: Array },
475
+ portalObject: { type: Object },
476
+ cssOverrides: { type: [String, Array] },
477
+ branding: { type: Object }
478
+ },
479
+ setup(__props) {
480
+ return (_ctx, _cache) => {
481
+ var _a, _b, _c, _d;
482
+ return openBlock(), createBlock(unref(_sfc_main$f), {
483
+ "custom-element-name": unref(COMPONENT_NAME),
484
+ environment: __props.environment,
485
+ locale: __props.locale,
486
+ "portal-object": __props.portalObject,
487
+ "allowed-portal-types": ["CUSTOMER"],
488
+ "primary-color": (_b = (_a = __props.branding) == null ? void 0 : _a.colors) == null ? void 0 : _b.primary,
489
+ "secondary-color": (_d = (_c = __props.branding) == null ? void 0 : _c.colors) == null ? void 0 : _d.secondary,
490
+ "experimental-features": __props.experimentalFeatures,
491
+ "log-level": __props.logLevel,
492
+ "on-log": __props.onLog,
493
+ "css-overrides": __props.cssOverrides,
494
+ onError: _cache[0] || (_cache[0] = (error) => _ctx.$emit("error", error))
495
+ }, {
496
+ default: withCtx(() => [
497
+ createVNode(_sfc_main$1, normalizeProps(guardReactiveProps(_ctx.$props)), {
498
+ default: withCtx(({
499
+ subscription,
500
+ schedulesData,
501
+ customer,
502
+ paymentMethods,
503
+ walletBalances,
504
+ hasWalletBalancesError,
505
+ isLoading,
506
+ error,
507
+ refreshWalletBalances,
508
+ refreshPaymentMethods
509
+ }) => [
510
+ createVNode(_sfc_main$2, {
511
+ subscription,
512
+ "schedules-data": schedulesData,
513
+ customer,
514
+ "payment-methods": paymentMethods,
515
+ "wallet-balances": walletBalances,
516
+ "has-wallet-balances-error": hasWalletBalancesError,
517
+ "is-loading": isLoading,
518
+ error,
519
+ onTopUpCharged: refreshWalletBalances,
520
+ onPaymentMethodStored: refreshPaymentMethods
521
+ }, null, 8, ["subscription", "schedules-data", "customer", "payment-methods", "wallet-balances", "has-wallet-balances-error", "is-loading", "error", "onTopUpCharged", "onPaymentMethodStored"])
522
+ ]),
523
+ _: 1
524
+ }, 16)
525
+ ]),
526
+ _: 1
527
+ }, 8, ["custom-element-name", "environment", "locale", "portal-object", "primary-color", "secondary-color", "experimental-features", "log-level", "on-log", "css-overrides"]);
528
+ };
529
+ }
530
+ });
531
+ const SolvimonSubscriptionDetails = defineCustomElement(_sfc_main);
532
+ const COMPONENT_NAME = getComponentName("subscription-details");
533
+ const defineSolvimonSubscriptionDetails = () => {
534
+ if (!customElements.get(COMPONENT_NAME)) {
535
+ customElements.define(COMPONENT_NAME, SolvimonSubscriptionDetails);
536
+ }
537
+ };
538
+ export {
539
+ COMPONENT_NAME,
540
+ SolvimonSubscriptionDetails,
541
+ defineSolvimonSubscriptionDetails
542
+ };
@@ -0,0 +1,3 @@
1
+ export declare const SolvimonSubscriptionManagement: import('../../../../node_modules/vue/dist/vue.d.ts').VueElementConstructor<unknown>;
2
+ export declare const COMPONENT_NAME: string;
3
+ export declare const defineSolvimonSubscriptionManagement: () => void;
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),t=require("../../vendor-ui-BuRqLx74.js"),n=require("../../ContentWithAsideLayout-DHpnJfGA.js"),i=require("../../component-CiKxWtdx.js"),a=require("../../useActionDispatchProvider-bqR_FeM4.js"),o=require("../../usePortal-C4qWsJeq.js"),s=require("../../useSubscription-DuUNc1_l.js"),r=require("../../useCustomer-bO4D6e4Z.js"),l=require("../../usePaymentMethods-Bb1Xbads.js"),c=require("../../usePaymentMethodOptions-DszFvgKX.js"),u=require("../../useLoadInitialData-BqiAFNFi.js"),d=require("../../invoices-BHgajZHq.js"),m=require("../../pricingPlanSchedule-B9HFiXy-.js"),p=require("../../SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BxqIfmkK.js"),g=require("../../PaymentMethodSelector.vue_vue_type_script_setup_true_lang-DyL2-vV0.js"),v=require("../../Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),_=require("../../url-D8GJi5rF.js"),h=require("../../PaymentMethodForm.vue_vue_type_script_setup_true_lang-zRr8iihy.js");const f={class:"sv-subscription-management-form__body grid grid-cols-1 gap-4"},b=e.defineComponent({__name:"SubscriptionManagementForm",props:e.mergeModels({pricingGroup:{type:Object},paymentMethods:{type:Array},paymentMethodOptions:{type:Array},billingPeriod:{type:Object},currency:{type:String},disabled:{type:Boolean}},{enabledPricingIds:{required:!0},enabledPricingIdsModifiers:{},paymentMethodId:{},paymentMethodIdModifiers:{}}),emits:e.mergeModels(["add-payment-method"],["update:enabledPricingIds","update:paymentMethodId"]),setup(n,{emit:i}){const a=n,o=i,s=e.useModel(n,"enabledPricingIds"),r=e.useModel(n,"paymentMethodId"),{$t:l}=t.useIntl(),c=e=>{const t=e?Date.parse(e):NaN;return Number.isFinite(t)?t:0},u=e.computed(()=>[...a.paymentMethods??[]].sort((e,t)=>c(t.created_at)-c(e.created_at)));return e.watch(()=>a.paymentMethods,(e,t)=>{var n;const i=null==e?void 0:e.find(({id:e})=>!(null==t?void 0:t.some(t=>t.id===e)));i&&(null==t?void 0:t.length)?r.value=i.id:(null==e?void 0:e.some(({id:e})=>e===r.value))||(r.value=null==(n=(null==e?void 0:e.find(({is_default:e})=>e))??u.value[0])?void 0:n.id)},{immediate:!0}),(i,a)=>(e.openBlock(),e.createElementBlock("form",{class:"sv-subscription-management-form",onSubmit:a[3]||(a[3]=e.withModifiers(()=>{},["prevent"]))},[e.createElementVNode("div",f,[e.createVNode(p._sfc_main,{modelValue:s.value,"onUpdate:modelValue":a[0]||(a[0]=e=>s.value=e),class:"sv-subscription-management-form__pricing-group","group-name":n.pricingGroup.name,pricings:n.pricingGroup.pricings,"billing-period":n.billingPeriod,currency:n.currency},null,8,["modelValue","group-name","pricings","billing-period","currency"]),e.createElementVNode("div",null,[e.createVNode(e.unref(t._sfc_main$30),{spacing:"xs"})]),e.createVNode(g._sfc_main,{modelValue:r.value,"onUpdate:modelValue":a[1]||(a[1]=e=>r.value=e),class:"sv-subscription-management-form__payment-methods","payment-methods":u.value,"payment-method-options":n.paymentMethodOptions,required:"",disabled:n.disabled,label:e.unref(l)({defaultMessage:"Payment method",id:"subscription_management.payment_method_selector.label",description:"Label above the payment method that pays for the subscription change"}),onAddPaymentMethod:a[2]||(a[2]=e=>o("add-payment-method"))},null,8,["modelValue","payment-methods","payment-method-options","disabled","label"])])],32))}}),y=e.defineComponent({__name:"TranslationOverride",props:{messages:{type:Object}},setup(n){const a=n,o=e.inject(i.TRANSLATION_SETTINGS_KEY,void 0),s=e.computed(()=>({...null==o?void 0:o.messages.value,...a.messages}));return(n,i)=>{var a,r;return e.openBlock(),e.createBlock(e.unref(t._sfc_main$31),{locale:null==(a=e.unref(o))?void 0:a.locale.value,"date-locale":null==(r=e.unref(o))?void 0:r.dateLocale.value,messages:s.value,"show-timezones":!1},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"default")]),_:3},8,["locale","date-locale","messages"])}}}),w=e.defineComponent({__name:"SubscriptionManagementSummary",props:{invoice:{type:Object},isPending:{type:Boolean},hasError:{type:Boolean}},setup(n){const{$t:i}=t.useIntl(),a=e.computed(()=>({"invoice_preview.total_due_today_heading":i({defaultMessage:"Total due",id:"subscription_management.summary.total_due_heading",description:'Heading above the total of the invoice previewing a subscription change, replacing the shared preview’s "Total due today"'})}));return(o,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{class:"sv-subscription-management-summary",title:e.unref(i)({defaultMessage:"Order summary",id:"subscription_management.summary.title",description:"Title of the block previewing what a subscription change is invoiced for"})},{default:e.withCtx(()=>[n.hasError?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$10),{key:0,class:"sv-subscription-management-summary__error sv-error",title:e.unref(i)({defaultMessage:"Unable to calculate the total. Please try again.",id:"subscription_management.summary.error",description:"Error shown when the invoice preview for a subscription change cannot be loaded"})},null,8,["title"])):n.isPending||!n.invoice?(e.openBlock(),e.createBlock(v._sfc_main,{key:1,variant:"section",class:"sv-subscription-management-summary__skeleton min-h-[120px]"},{default:e.withCtx(()=>[n.isPending?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,variant:"body-sm",shade:"lighter",tag:"div",class:"sv-subscription-management-summary__empty-state"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(i)({defaultMessage:"Select your plan to see what it costs.",id:"subscription_management.summary.empty_state",description:"Shown in the order summary before a plan has been picked to preview"})),1)]),_:1}))]),_:1})):(e.openBlock(),e.createBlock(y,{key:2,messages:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$29),{class:"sv-subscription-management-summary__invoice",invoice:n.invoice,"is-customer-facing":""},null,8,["invoice"])]),_:1},8,["messages"]))]),_:1},8,["title"]))}}),M={class:"sv-subscription-management-success grid grid-cols-1 gap-4"},S={class:"sv-subscription-management-success__message"},P=e.defineComponent({__name:"SubscriptionManagementSuccess",props:{pricingGroupName:{type:String}},setup(n){const i=n,{$t:a}=t.useIntl(),o=e.computed(()=>a({defaultMessage:"Subscription updated",description:"Title shown on the manage subscription screen once the change is committed",id:"subscription_management.success.title"})),s=e.computed(()=>i.pricingGroupName?a({defaultMessage:"Your {subject} has been changed. Please be aware that it can take some time to reflect this change in your subscription.",description:"Confirmation of the pricing group a committed subscription change applied to",id:"subscription_management.success.message"},{subject:i.pricingGroupName}):a({defaultMessage:"Your subscription has been changed. Please be aware that it can take some time to reflect this change in your subscription.",description:"Confirmation of a committed subscription change when the pricing group is not known",id:"subscription_management.success.message_generic"}));return(t,n)=>(e.openBlock(),e.createElementBlock("div",M,[e.createVNode(_._sfc_main,{status:"success",title:o.value},{default:e.withCtx(()=>[e.createElementVNode("span",S,e.toDisplayString(s.value),1)]),_:1},8,["title"])]))}}),k=e.defineComponent({__name:"AddPaymentMethodModal",props:{showModal:{type:Boolean},customer:{type:Object},paymentMethodOptions:{type:Array},isLoading:{type:Boolean}},emits:["success","failure","close"],setup(n,{emit:i}){const a=n,o=i,{$t:s}=t.useIntl(),r=e.ref(),l=e.computed(()=>{var e;return Boolean(null==(e=r.value)?void 0:e.isPaymentPending)}),c=e.ref(!1);e.watch(()=>a.showModal,e=>{c.value=c.value||e},{immediate:!0});const u=()=>{var e;null==(e=r.value)||e.submit()};return(i,a)=>(e.openBlock(),e.createBlock(e.unref(t.Modal),{"no-click-away":"",class:"sv-add-payment-method-modal",size:"lg","show-modal":n.showModal,"is-loading":l.value,title:e.unref(s)({defaultMessage:"Add payment method",id:"add_payment_method_modal.title",description:"Title of the modal for adding a payment method"}),"sub-title":e.unref(s)({defaultMessage:"Add a new payment method to pay with.",id:"add_payment_method_modal.subtitle",description:"Subtitle of the modal for adding a payment method"}),"confirm-button-text":e.unref(s)({defaultMessage:"Save payment method",id:"add_payment_method_modal.confirm_button.label",description:"Label of the button that stores the payment method being added"}),"cancel-button-text":e.unref(s)({defaultMessage:"Cancel",id:"add_payment_method_modal.cancel_button.label",description:"Label of the button that abandons adding a payment method"}),onConfirm:u,onClose:a[2]||(a[2]=e=>o("close"))},{body:e.withCtx(()=>[n.customer&&c.value?(e.openBlock(),e.createBlock(h._sfc_main,{key:0,ref_key:"paymentMethodFormRef",ref:r,"hide-submit-button":"",class:"sv-add-payment-method-modal__form",customer:n.customer,"payment-method-options":n.paymentMethodOptions,"is-loading":n.isLoading,onSuccess:a[0]||(a[0]=e=>o("success")),onFailure:a[1]||(a[1]=e=>o("failure",e))},null,8,["customer","payment-method-options","is-loading"])):e.createCommentVNode("",!0)]),_:1},8,["show-modal","is-loading","title","sub-title","confirm-button-text","cancel-button-text"]))}}),B={class:"sv-subscription-management__header"},I={class:"flex flex-col gap-2"},C=e.defineComponent({__name:"SubscriptionManagement",props:{configuration:{type:Object}},setup(g){const _=g,{$t:h}=t.useIntl(),f=o.usePortal(),y=i.useLogger(),{dispatchAction:M}=a.useActionDispatchProvider(),{createPricingPlanSchedule:S}=function(){const e=i.createRequestService(),t=i.useConfig();return{getOnDemandPricingItems:function({scheduleId:n}){return e({url:`${t.apiUrls.config}/portal/pricing-plan-schedules/${n}/on-demand-pricing-items`})},createPricingPlanSchedule:function({pricingPlanSubscriptionId:n,enabledPricings:i}){return e({url:`${t.apiUrls.config}/portal/pricing-plan-schedules`,options:{method:"POST"},data:{pricing_plan_subscription_id:n,enabled_pricings:i}})}}}(),{subscription:C,get:N}=s.useSubscription({subscriptionId:_.configuration.subscriptionId}),{items:j,fetchAll:x}=l.usePaymentMethods({customerId:f.value.customer_id}),{customer:O,get:V}=r.useCustomer({customerId:f.value.customer_id}),{paymentMethodOptions:E,get:A}=c.usePaymentMethodOptions(),{isLoading:L}=u.useLoadInitialData(N(),x(),V.execute(),A({customerId:f.value.customer_id})),T=e.ref(!1),q=async()=>{await x(),T.value=!1},$=e.computed(()=>{var e;return m.getActiveDefaultScheduleInfo((null==(e=C.value)?void 0:e.pricing_plan_schedule_infos)??[])}),D=e.computed(()=>{var e;const t=$.value;if(!t)return;const{enabledPricingId:n}=_.configuration;return(n?[n]:((null==(e=t.pricing_plan_schedule)?void 0:e.enabled_pricings)??[]).map(({pricing_id:e})=>e)).map(e=>m.getPricingGroupByPricingId({pricingPlanScheduleInfo:t,pricingId:e})).find(e=>Boolean(e))}),F=e.computed(()=>{var e;return h({defaultMessage:"Manage {subject}",id:"subscription_management.title",description:"Title for the manage subscription page, naming the pricing group being changed"},{subject:(null==(e=D.value)?void 0:e.name)||h({defaultMessage:"subscription",id:"subscription_management.title.default_subject",description:'Stands in for the pricing group name in the manage subscription title when no group is known, e.g. "Manage subscription"'})})}),U=e.ref([]),G=e.ref();e.watch([$,D],([e,t])=>{var n;const i=((null==(n=null==e?void 0:e.pricing_plan_schedule)?void 0:n.enabled_pricings)??[]).map(({pricing_id:e})=>e),{enabledPricingId:a}=_.configuration,o=((null==t?void 0:t.pricings)??[]).map(({id:e})=>e);U.value=a&&o.includes(a)?[...i.filter(e=>!o.includes(e)),a]:i},{immediate:!0});const{invoice:R,isPending:z,error:W,load:Y}=function(){const{getInvoicePreview:t}=d.createInvoicesService(),n=i.useLogger(),a=e.ref(),o=e.ref(!1),s=e.ref();let r=0;return{invoice:a,isPending:o,error:s,load:async({subscription:e,enabledPricingIds:i})=>{const l=m.getScheduleCustomizations({enabledPricings:i.map(e=>({pricing_id:e})),pricingPlanScheduleInfos:e.pricing_plan_schedule_infos});if(!l)return void(a.value=void 0);const c=++r;o.value=!0,s.value=void 0;try{const n=await t({forExistingSubscription:!0,pricingPlanSubscriptionId:e.id,customizations:l});if(c!==r)return;a.value=n.invoice}catch(W){if(c!==r)return;n.error("INVOICE_PREVIEW_FAILED","Failed to preview the subscription upgrade",{},W),s.value=W,a.value=void 0}finally{c===r&&(o.value=!1)}}}}();e.watch([U,C],([e,t])=>{t&&0!==e.length&&Y({subscription:t,enabledPricingIds:e})},{immediate:!0});const K=e.ref(!1),H=e.ref(),J=e.ref(!1),Q=e.computed(()=>!L.value&&!K.value&&U.value.length>0&&Boolean(C.value)&&Boolean(G.value)),X=async()=>{if(Q.value&&C.value){K.value=!0,H.value=void 0;try{await S({pricingPlanSubscriptionId:C.value.id,enabledPricings:U.value.map(e=>({pricing_id:e}))}),J.value=!0}catch(e){y.error("SUBSCRIPTION_UPDATE_FAILED","Failed to start a new pricing plan schedule",{},e),H.value=h({defaultMessage:"Something went wrong. Please try again.",id:"subscription_management.update_error",description:"Error shown when committing a subscription change fails"})}finally{K.value=!1}}},Z=e.computed(()=>{var e,t,n;return(null==(t=null==(e=$.value)?void 0:e.pricing_plan_schedule)?void 0:t.billing_period)??(null==(n=C.value)?void 0:n.billing_period)});return(i,a)=>(e.openBlock(),e.createBlock(e.unref(n.ContentWithAsideLayout),{class:"sv-subscription-management sv-root sv-screen"},{header:e.withCtx(()=>[e.createElementVNode("div",B,[e.createVNode(e.unref(t._sfc_main$3),{variant:"heading-2",tag:"h1",class:"sv-subscription-management__title"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(F.value),1)]),_:1})])]),content:e.withCtx(()=>{var t,n;return[J.value?(e.openBlock(),e.createBlock(P,{key:0,class:"sv-subscription-management__success","pricing-group-name":null==(t=D.value)?void 0:t.name},null,8,["pricing-group-name"])):e.unref(L)?(e.openBlock(),e.createBlock(v._sfc_main,{key:1,variant:"section",class:"min-h-[220px]"})):D.value&&Z.value?(e.openBlock(),e.createBlock(b,{key:2,"enabled-pricing-ids":U.value,"onUpdate:enabledPricingIds":a[0]||(a[0]=e=>U.value=e),"payment-method-id":G.value,"onUpdate:paymentMethodId":a[1]||(a[1]=e=>G.value=e),class:"sv-subscription-management__form","pricing-group":D.value,"payment-methods":e.unref(j),"payment-method-options":e.unref(E),"billing-period":Z.value,currency:null==(n=e.unref(C))?void 0:n.billing_currency,onAddPaymentMethod:a[2]||(a[2]=e=>T.value=!0)},null,8,["enabled-pricing-ids","payment-method-id","pricing-group","payment-methods","payment-method-options","billing-period","currency"])):e.createCommentVNode("",!0),e.createVNode(k,{"show-modal":T.value,customer:e.unref(O),"payment-method-options":e.unref(E),onSuccess:q,onClose:a[3]||(a[3]=e=>T.value=!1)},null,8,["show-modal","customer","payment-method-options"])]}),aside:e.withCtx(()=>[J.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1),{key:0,size:"lg",class:"sv-action sv-action--primary sv-action--full-width sv-subscription-management__done w-full",type:"button",onClick:a[4]||(a[4]=t=>e.unref(M)({action:"navigate-to-customer-overview"}))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h)({defaultMessage:"Done",id:"subscription_management.done_button.label",description:"Label of the button that leaves the manage subscription screen once the change is committed"})),1)]),_:1})):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createVNode(w,{class:"sv-subscription-management__summary",invoice:e.unref(R),"is-pending":e.unref(L)||e.unref(z),"has-error":Boolean(e.unref(W))},null,8,["invoice","is-pending","has-error"]),H.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$10),{key:0,class:"sv-subscription-management__update-error sv-error",title:H.value},null,8,["title"])):e.createCommentVNode("",!0),e.createElementVNode("div",I,[e.createVNode(e.unref(t._sfc_main$1),{size:"lg",class:"sv-action sv-action--primary sv-action--full-width sv-subscription-management__update w-full",type:"button",disabled:!Q.value,loading:K.value,onClick:X},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(h)({defaultMessage:"Update subscription",id:"subscription_management.update_button.label",description:"Label of the button that commits the subscription change"})),1)]),_:1},8,["disabled","loading"]),e.createVNode(p._sfc_main$1,{class:"sv-subscription-management__kpi","payment-method-options":e.unref(E)},null,8,["payment-method-options"])])],64))]),_:1}))}}),N=e.defineComponent({__name:"SubscriptionManagement.entry",props:{environment:{type:String},locale:{type:String},dateLocale:{type:String},messages:{type:Object},primaryColor:{type:String},secondaryColor:{type:String},isShadowRoot:{type:Boolean},experimentalFeatures:{type:Array},logLevel:{type:String},onLog:{type:Function},allowedPortalTypes:{type:Array},portalObject:{type:Object},cssOverrides:{type:[String,Array]},branding:{type:Object},configuration:{type:Object}},setup:t=>(n,a)=>{var o,s,r,l;return e.openBlock(),e.createBlock(i._sfc_main,{"custom-element-name":e.unref(x),environment:t.environment,locale:t.locale,"portal-object":t.portalObject,"allowed-portal-types":["CUSTOMER"],"primary-color":null==(s=null==(o=t.branding)?void 0:o.colors)?void 0:s.primary,"secondary-color":null==(l=null==(r=t.branding)?void 0:r.colors)?void 0:l.secondary,"experimental-features":t.experimentalFeatures,"log-level":t.logLevel,"on-log":t.onLog,"css-overrides":t.cssOverrides,onError:a[0]||(a[0]=e=>n.$emit("error",e))},{default:e.withCtx(()=>[e.createVNode(C,{configuration:t.configuration},null,8,["configuration"])]),_:1},8,["custom-element-name","environment","locale","portal-object","primary-color","secondary-color","experimental-features","log-level","on-log","css-overrides"])}}),j=i.defineCustomElement(N),x=i.getComponentName("subscription-management");exports.COMPONENT_NAME=x,exports.SolvimonSubscriptionManagement=j,exports.defineSolvimonSubscriptionManagement=()=>{customElements.get(x)||customElements.define(x,j)};