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