@solvimon/solvimon-web 0.1.0-alpha.13 → 0.1.0-alpha.15
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-CX8vlY2Z.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-ugPPvTKf.mjs} +2 -2
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-DGisvmez.js → BillingInformation.vue_vue_type_script_setup_true_lang-xuCWAVgf.js} +1 -1
- package/dist/ContentWithAsideLayout-DHpnJfGA.js +1 -0
- package/dist/{ContentWithAsideLayout-DhfUkZZg.mjs → ContentWithAsideLayout-Dy9xgxuF.mjs} +6 -3
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-BpN9nSMC.js +1 -0
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Bus-5gC3.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D_PE2UbX.mjs} +8 -23
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DU6X3zxr.js +1 -0
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-Bc2hkpTb.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-ryvFEQMV.mjs} +1 -1
- package/dist/InvoiceHeader.vue_vue_type_script_setup_true_lang-DdpPrYxi.js +1 -0
- package/dist/InvoiceHeader.vue_vue_type_script_setup_true_lang-bAiAbtMi.mjs +27 -0
- package/dist/{PaymentHistoryBlock-BiiFJkpT.js → PaymentHistoryBlock-BGbTy4Se.js} +1 -1
- package/dist/{PaymentHistoryBlock-D_B099M7.mjs → PaymentHistoryBlock-BKMttUyk.mjs} +1 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js +1 -0
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CaMDtHrL.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-CkXYj9xs.mjs → PaymentIntegrationForm-BGxjGJGz.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-bfGmfwQT.js → PaymentIntegrationForm-liOVNKEG.js} +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BxdcIX-Z.js +1 -0
- package/dist/{PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BnMmcoAu.mjs → PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-aP-gCq7V.mjs} +736 -162
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-DfdaWRO0.js +1 -0
- package/dist/PaymentMethodForm.vue_vue_type_script_setup_true_lang-h-JUw1DV.mjs +145 -0
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-DxndhDxR.js +1 -0
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-j5VNsyu7.mjs +139 -0
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BVoS3ZXS.js +1 -0
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs +170 -0
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-BkzLj8n2.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-Cv6lz35J.mjs} +48 -23
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-D6hHXndB.js +1 -0
- package/dist/component-B53Df2Rt.js +1 -0
- package/dist/component-BSnccqm1.mjs +933 -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 +14 -13
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
- package/dist/components/InvoiceHeader/InvoiceHeader.ce.d.ts +3 -0
- package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -0
- package/dist/components/InvoiceHeader/InvoiceHeader.es.js +123 -0
- 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 +11 -110
- 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/core/types.d.ts +4 -0
- package/dist/{customer-hDxW1Dbp.js → customer-B5b2tLhw.js} +1 -1
- package/dist/{customer-B31QzznT.mjs → customer-CANPEYH9.mjs} +1 -1
- package/dist/en-US-C0gIE4Q1.js +1 -0
- package/dist/{en-US-N3CUCsVy.mjs → en-US-DAgOSlgv.mjs} +33 -18
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/invoices-BCmE_nnb.js +1 -0
- package/dist/{invoices-DIYPN2j_.mjs → invoices-DBv0qkgm.mjs} +22 -3
- package/dist/nl-NL-Br7muSHK.js +1 -0
- package/dist/{nl-NL-B8U9b85I.mjs → nl-NL-DCsmrA8A.mjs} +33 -14
- package/dist/{paymentMethods-67b3UlTZ.mjs → paymentMethods-D-5FNN8W.mjs} +11 -3
- package/dist/paymentMethods-u5y9B5ng.js +1 -0
- package/dist/{payments-Dq6R37Fz.mjs → payments-BK8yzqJ5.mjs} +1 -1
- package/dist/{payments-DkHhTHto.js → payments-BTTtcfyI.js} +1 -1
- package/dist/{registry-Df_26rJy.mjs → registry-CMo7X2FD.mjs} +9 -3
- package/dist/registry-Cx7p19-6.js +1 -0
- package/dist/screens/Checkout/Checkout.cjs.js +1 -1
- package/dist/screens/Checkout/Checkout.es.js +330 -414
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +13 -13
- package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
- package/dist/screens/PayInvoice/PayInvoice.es.js +45 -34
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.ce.d.ts +3 -0
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -0
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +231 -0
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.cjs.js +1 -1
- package/dist/screens/UpgradeSubscription/UpgradeSubscription.es.js +756 -720
- package/dist/solvimon-web.css +1 -1
- package/dist/{subscriptions-jelITJcX.js → subscriptions-AMC4DirD.js} +1 -1
- package/dist/{subscriptions-ClGIr_aS.mjs → subscriptions-DHjXDyH1.mjs} +2 -2
- package/dist/{adyen-Bwewy3HC.mjs → url-1Lbg5Yni.mjs} +35 -35
- package/dist/url-B6-3PkW2.js +1 -0
- package/dist/{useActionDispatchProvider-rw9kWeE0.js → useActionDispatchProvider-CizNgRwv.js} +1 -1
- package/dist/{useActionDispatchProvider-BC57-Ufn.mjs → useActionDispatchProvider-DmhD9mYX.mjs} +1 -1
- package/dist/{useCustomer-Ba9WRtuT.mjs → useCustomer-DCPq7eHM.mjs} +2 -2
- package/dist/{useCustomer-CUcaeQn_.js → useCustomer-DYc54GVD.js} +1 -1
- package/dist/useIncrementalLoading-CuSndpP2.js +1 -0
- package/dist/{useIncrementalLoading-Cnzh2mAz.mjs → useIncrementalLoading-DmOT2MXH.mjs} +4 -4
- package/dist/{useInvoiceData-lIMEwwMy.js → useInvoiceData-BajCyf-x.js} +1 -1
- package/dist/{useInvoiceData-D7YN2SAd.mjs → useInvoiceData-BgtUKbHY.mjs} +2 -2
- package/dist/{useInvoicesList-CFzAxyae.mjs → useInvoicesList-DRD5yix0.mjs} +4 -4
- package/dist/useInvoicesList-wnvjyB_H.js +1 -0
- package/dist/{useLoadInitialData-DjwRHcAH.js → useLoadInitialData-BObRB7Vo.js} +1 -1
- package/dist/{useLoadInitialData-5sgImpzc.mjs → useLoadInitialData-IlbmC6p0.mjs} +1 -1
- package/dist/{usePaymentMethodOptions-DYO6xr3-.js → usePaymentMethodOptions-CzqsebhN.js} +1 -1
- package/dist/{usePaymentMethodOptions-C2k4npCQ.mjs → usePaymentMethodOptions-DRkWBjv6.mjs} +2 -2
- package/dist/{usePaymentMethods-CRWbH48K.mjs → usePaymentMethods-DFkRNreh.mjs} +2 -2
- package/dist/{usePaymentMethods-ryN_YohI.js → usePaymentMethods-ZPxKg5Y3.js} +1 -1
- package/dist/{usePayments-DWXPGFvp.js → usePayments-DwiGafZj.js} +1 -1
- package/dist/{usePayments-Cw5PPEJa.mjs → usePayments-E_Jsqo98.mjs} +3 -3
- package/dist/{usePortal-CxX4nrE4.js → usePortal-CxTS2TQh.js} +1 -1
- package/dist/{usePortal-cmE08vYs.mjs → usePortal-DcOz9FEL.mjs} +1 -1
- package/dist/{useService-Bb9r_sOQ.js → useService-CHrkefKd.js} +1 -1
- package/dist/{useService-BsSEI8DZ.mjs → useService-DF57xuDd.mjs} +1 -1
- package/dist/{useWalletBalanceItems-CpZ1NWPr.js → useWalletBalanceItems-BQEXDCBg.js} +1 -1
- package/dist/{useWalletBalanceItems-CkDqmk36.mjs → useWalletBalanceItems-MlHgedWR.mjs} +3 -3
- package/dist/{vendor-ui-C0K3osvz.mjs → vendor-ui-B8IlviSs.mjs} +6482 -5866
- package/dist/vendor-ui-C3Tq-qY_.js +1 -0
- package/package.json +5 -4
- package/dist/ContentWithAsideLayout-B5B8Kwaw.js +0 -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/paymentMethods-C_sdTkSF.js +0 -1
- package/dist/registry-BkViv4tv.js +0 -1
- package/dist/useIncrementalLoading-DoTTXM2Y.js +0 -1
- package/dist/useInvoicesList-CaBCGs4h.js +0 -1
- package/dist/vendor-ui-5pJF5KBP.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 {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { u as
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
id: "pric_ywDeeN0vhvcPguAadr1V",
|
|
27
|
-
name: "Integration setup",
|
|
28
|
-
products: [{ name: "Integration setup" }],
|
|
29
|
-
items: [
|
|
30
|
-
{
|
|
31
|
-
id: "prii_NwDeeN0vhvcPguAxds12",
|
|
32
|
-
product_items: [
|
|
33
|
-
{
|
|
34
|
-
name: "Rillet integration setup",
|
|
35
|
-
model_type: "ONE_OFF"
|
|
36
|
-
}
|
|
37
|
-
],
|
|
38
|
-
configs: [
|
|
39
|
-
{
|
|
40
|
-
on_demand: true,
|
|
41
|
-
bands: [
|
|
42
|
-
{
|
|
43
|
-
fixed_amount: {
|
|
44
|
-
quantity: "5000.00",
|
|
45
|
-
currency: "EUR"
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
]
|
|
49
|
-
}
|
|
50
|
-
]
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
id: "prii_IwDeeN0vhvcPgvAsdS1Q",
|
|
54
|
-
product_items: [
|
|
55
|
-
{
|
|
56
|
-
name: "Attio integration setup",
|
|
57
|
-
model_type: "ONE_OFF"
|
|
58
|
-
}
|
|
59
|
-
],
|
|
60
|
-
configs: [
|
|
61
|
-
{
|
|
62
|
-
on_demand: true,
|
|
63
|
-
// FLAT type: price is in `amount`, not `fixed_amount`
|
|
64
|
-
bands: [
|
|
65
|
-
{
|
|
66
|
-
amount: {
|
|
67
|
-
quantity: "50000.00",
|
|
68
|
-
currency: "EUR"
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
]
|
|
72
|
-
}
|
|
73
|
-
]
|
|
74
|
-
}
|
|
75
|
-
]
|
|
76
|
-
}
|
|
77
|
-
],
|
|
78
|
-
pricing_groups: []
|
|
79
|
-
}
|
|
80
|
-
]
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
]
|
|
84
|
-
};
|
|
85
|
-
const isOnDemandOneOffItem = (item) => {
|
|
86
|
-
var _a, _b;
|
|
87
|
-
return (((_a = item.configs) == null ? void 0 : _a.some((c) => c.on_demand)) ?? false) && (((_b = item.product_items) == null ? void 0 : _b.some((pi) => pi.model_type === "ONE_OFF")) ?? false);
|
|
88
|
-
};
|
|
89
|
-
const itemToRow = (item) => {
|
|
90
|
-
var _a, _b;
|
|
91
|
-
return {
|
|
92
|
-
id: item.id,
|
|
93
|
-
name: (_b = (_a = item.product_items) == null ? void 0 : _a[0]) == null ? void 0 : _b.name,
|
|
94
|
-
items: [
|
|
95
|
-
{
|
|
96
|
-
id: item.id,
|
|
97
|
-
configs: (item.configs ?? []).map((config) => ({
|
|
98
|
-
bands: (config.bands ?? []).map((band) => ({
|
|
99
|
-
fixed_amount: band.fixed_amount ?? band.amount
|
|
100
|
-
}))
|
|
101
|
-
}))
|
|
102
|
-
}
|
|
103
|
-
]
|
|
104
|
-
};
|
|
105
|
-
};
|
|
106
|
-
const pricingToRows = (pricing) => (pricing.items ?? []).filter(isOnDemandOneOffItem).map(itemToRow);
|
|
107
|
-
const categoryToOnDemand = (category) => ({
|
|
108
|
-
display_order: category.display_order,
|
|
109
|
-
product_category: category.product_category,
|
|
110
|
-
pricings: (category.pricings ?? []).flatMap(pricingToRows),
|
|
111
|
-
pricing_groups: (category.pricing_groups ?? []).map((group) => ({
|
|
112
|
-
id: group.id,
|
|
113
|
-
name: group.name,
|
|
114
|
-
pricings: (group.pricings ?? []).flatMap(pricingToRows)
|
|
115
|
-
})).filter((g) => g.pricings.length > 0)
|
|
116
|
-
});
|
|
117
|
-
const ITEM_PRICES_EUR = Object.fromEntries(
|
|
118
|
-
mockSubscriptionGetResponse.pricing_plan_schedule_infos.flatMap((s) => s.pricing_plan_version.pricing_categories).flatMap((cat) => cat.pricings).flatMap((p) => p.items).filter(isOnDemandOneOffItem).map((item) => {
|
|
119
|
-
var _a, _b, _c, _d, _e;
|
|
120
|
-
const band = (_c = (_b = (_a = item.configs) == null ? void 0 : _a[0]) == null ? void 0 : _b.bands) == null ? void 0 : _c[0];
|
|
121
|
-
const raw = ((_d = band == null ? void 0 : band.fixed_amount) == null ? void 0 : _d.quantity) ?? ((_e = band == null ? void 0 : band.amount) == null ? void 0 : _e.quantity) ?? "0";
|
|
122
|
-
return [item.id, parseFloat(raw)];
|
|
123
|
-
})
|
|
124
|
-
);
|
|
125
|
-
const VAT_RATE = 0.21;
|
|
126
|
-
const eur = (amount) => ({ quantity: amount.toFixed(2), currency: "EUR" });
|
|
127
|
-
const mockPaymentAcceptor = {
|
|
128
|
-
id: "paya_NwDeeN0vgXgeP1AyNx14",
|
|
129
|
-
object_type: "PAYMENT_ACCEPTOR",
|
|
130
|
-
status: "ACTIVE",
|
|
131
|
-
reference: "mock-payment-acceptor",
|
|
132
|
-
name: "Mock payment acceptor",
|
|
133
|
-
type: "PAYMENT_GATEWAY"
|
|
134
|
-
};
|
|
135
|
-
const mockPaymentIntegration = {
|
|
136
|
-
id: "intg_zwDeeN0vgXgeM6APNW1g",
|
|
137
|
-
object_type: "INTEGRATION",
|
|
138
|
-
reference: "mock-payment-integration",
|
|
139
|
-
name: "Mock payment integration",
|
|
140
|
-
description: "Mock payment integration",
|
|
141
|
-
status: "ACTIVE",
|
|
142
|
-
type: "PAYMENT_GATEWAY"
|
|
143
|
-
};
|
|
144
|
-
const getMockPreviewResponse = (selectedItemIds) => {
|
|
145
|
-
const base = selectedItemIds.reduce((sum, id) => sum + (ITEM_PRICES_EUR[id] ?? 0), 0);
|
|
146
|
-
const tax = Math.round(base * VAT_RATE * 100) / 100;
|
|
147
|
-
const total = base + tax;
|
|
148
|
-
return {
|
|
149
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
150
|
-
invoice: {
|
|
151
|
-
tax_summary: {
|
|
152
|
-
base_amount: eur(base),
|
|
153
|
-
tax_amount: eur(tax),
|
|
154
|
-
total_amount: eur(total),
|
|
155
|
-
country_code: "NL"
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
// eslint-disable-next-line @typescript-eslint/consistent-type-assertions
|
|
159
|
-
first_invoice: {},
|
|
160
|
-
invoice_infos: []
|
|
161
|
-
};
|
|
162
|
-
};
|
|
163
|
-
const getMockOnDemandPricingItemsResponse = (subscriptionId) => {
|
|
164
|
-
var _a;
|
|
165
|
-
const now = Date.now();
|
|
166
|
-
const schedules = mockSubscriptionGetResponse.pricing_plan_schedule_infos;
|
|
167
|
-
const activeSchedule = schedules.find((s) => {
|
|
168
|
-
const start = Date.parse(s.start_at);
|
|
169
|
-
return Number.isFinite(start) && start <= now;
|
|
170
|
-
}) ?? schedules[0];
|
|
171
|
-
const categories = (((_a = activeSchedule == null ? void 0 : activeSchedule.pricing_plan_version) == null ? void 0 : _a.pricing_categories) ?? []).map(categoryToOnDemand).filter((c) => {
|
|
172
|
-
var _a2, _b;
|
|
173
|
-
return (((_a2 = c.pricings) == null ? void 0 : _a2.length) ?? 0) > 0 || (((_b = c.pricing_groups) == null ? void 0 : _b.length) ?? 0) > 0;
|
|
174
|
-
});
|
|
175
|
-
return {
|
|
176
|
-
pricing_plan_subscription_id: subscriptionId || mockSubscriptionGetResponse.id,
|
|
177
|
-
pricing_plan_schedule_id: (activeSchedule == null ? void 0 : activeSchedule.id) ?? "",
|
|
178
|
-
pricing_plan_version_id: (activeSchedule == null ? void 0 : activeSchedule.pricing_plan_version_id) ?? "",
|
|
179
|
-
billing_period: { type: "MONTH", value: 1 },
|
|
180
|
-
billing_currency: "EUR",
|
|
181
|
-
pricing_categories: categories
|
|
182
|
-
};
|
|
183
|
-
};
|
|
184
|
-
const getMockPaymentMethodOptionsResponse = () => [
|
|
185
|
-
{
|
|
186
|
-
payment_acceptor: mockPaymentAcceptor,
|
|
187
|
-
integration: mockPaymentIntegration,
|
|
188
|
-
options: [
|
|
189
|
-
{
|
|
190
|
-
name: "iDeal",
|
|
191
|
-
payment_method_variant: "ONLINE_BANKING",
|
|
192
|
-
payment_gateway_variant: "ADYEN",
|
|
193
|
-
adyen: { name: "iDEAL | Wero", type: "ideal" }
|
|
194
|
-
},
|
|
195
|
-
{
|
|
196
|
-
name: "Cards",
|
|
197
|
-
payment_method_variant: "CARD",
|
|
198
|
-
payment_gateway_variant: "ADYEN",
|
|
199
|
-
adyen: {
|
|
200
|
-
name: "Cards",
|
|
201
|
-
type: "scheme",
|
|
202
|
-
brands: [
|
|
203
|
-
"maestro",
|
|
204
|
-
"accel",
|
|
205
|
-
"amex",
|
|
206
|
-
"cup",
|
|
207
|
-
"diners",
|
|
208
|
-
"hipercard",
|
|
209
|
-
"jcb",
|
|
210
|
-
"mc",
|
|
211
|
-
"nyce",
|
|
212
|
-
"pulse",
|
|
213
|
-
"star",
|
|
214
|
-
"visa"
|
|
215
|
-
]
|
|
216
|
-
}
|
|
217
|
-
},
|
|
218
|
-
{
|
|
219
|
-
name: "PayPal",
|
|
220
|
-
payment_method_variant: "DIGITAL_WALLET",
|
|
221
|
-
payment_gateway_variant: "ADYEN",
|
|
222
|
-
adyen: { name: "PayPal", type: "paypal", configuration: { intent: "capture" } }
|
|
223
|
-
},
|
|
224
|
-
{
|
|
225
|
-
name: "Trustly",
|
|
226
|
-
payment_method_variant: "ONLINE_BANKING",
|
|
227
|
-
payment_gateway_variant: "ADYEN",
|
|
228
|
-
adyen: { name: "Trustly - Instant Bank Payment", type: "trustly" }
|
|
229
|
-
}
|
|
230
|
-
]
|
|
231
|
-
}
|
|
232
|
-
];
|
|
233
|
-
const _hoisted_1$4 = { class: "sv-order-summary__items mb-3 flex flex-col gap-2" };
|
|
234
|
-
const _hoisted_2$2 = { class: "sv-order-summary__tax flex flex-col gap-1 border-t pt-3" };
|
|
235
|
-
const _hoisted_3$1 = { class: "sv-order-summary__subtotal flex items-center justify-between" };
|
|
236
|
-
const _hoisted_4$1 = { class: "sv-order-summary__tax-row flex items-center justify-between" };
|
|
237
|
-
const _hoisted_5$1 = { class: "sv-order-summary__total flex items-center justify-between border-t pt-3" };
|
|
238
|
-
const _sfc_main$6 = /* @__PURE__ */ defineComponent({
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createElementBlock, Fragment, createCommentVNode, renderList, ref, onMounted, watch, onUnmounted, normalizeClass } from "vue";
|
|
2
|
+
import { u as useIntl, _ as _sfc_main$5, A as _sfc_main$6, e as _sfc_main$7, x as _sfc_main$8, F as _sfc_main$9, B as formatAmount, c as _sfc_main$b, E as _sfc_main$e, g as getCustomerCountry } from "../../vendor-ui-B8IlviSs.mjs";
|
|
3
|
+
import { _ as _sfc_main$a, a as _sfc_main$f, b as _sfc_main$g } from "../../SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs";
|
|
4
|
+
import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
|
|
5
|
+
import { c as createRequestService, u as useConfig, a as useLogger, _ as _sfc_main$i, d as defineCustomElement, g as getComponentName } from "../../component-BSnccqm1.mjs";
|
|
6
|
+
import { u as useActionDispatchProvider } from "../../useActionDispatchProvider-DmhD9mYX.mjs";
|
|
7
|
+
import { u as usePortal } from "../../usePortal-DcOz9FEL.mjs";
|
|
8
|
+
import { c as createSubscriptionsService } from "../../subscriptions-DHjXDyH1.mjs";
|
|
9
|
+
import { c as createCustomerService } from "../../customer-CANPEYH9.mjs";
|
|
10
|
+
import { c as createPaymentMethodsService } from "../../paymentMethods-D-5FNN8W.mjs";
|
|
11
|
+
import { c as createInvoicesService } from "../../invoices-DBv0qkgm.mjs";
|
|
12
|
+
import { _ as _sfc_main$h } from "../../PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-aP-gCq7V.mjs";
|
|
13
|
+
import { _ as _sfc_main$d } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
|
|
14
|
+
import { _ as _sfc_main$c } from "../../url-1Lbg5Yni.mjs";
|
|
15
|
+
import { u as useViewport } from "../../useViewport-Bu0cyeSi.mjs";
|
|
16
|
+
const _hoisted_1$2 = { class: "sv-order-summary__body grid grid-cols-1 gap-1" };
|
|
17
|
+
const _hoisted_2$1 = { class: "flex items-center justify-center gap-2 px-3 py-5" };
|
|
18
|
+
const _hoisted_3$1 = { class: "flex flex-row gap-3 px-3 py-2" };
|
|
19
|
+
const _hoisted_4$1 = { class: "grow" };
|
|
20
|
+
const _hoisted_5$1 = { class: "sv-order-summary__items grid grid-cols-1 gap-1" };
|
|
21
|
+
const _hoisted_6$1 = { class: "flex flex-row gap-2 px-3 py-2" };
|
|
22
|
+
const _hoisted_7$1 = { class: "flex flex-row gap-3 px-3 py-2" };
|
|
23
|
+
const _hoisted_8$1 = { class: "grow" };
|
|
24
|
+
const _hoisted_9$1 = { class: "flex flex-row gap-2 px-3 py-2" };
|
|
25
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
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,36 @@ 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__order-summary" };
|
|
561
|
+
const _hoisted_10 = { class: "flex flex-col gap-2" };
|
|
789
562
|
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
790
563
|
__name: "UpgradeSubscription",
|
|
791
564
|
props: {
|
|
@@ -794,21 +567,143 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
794
567
|
setup(__props) {
|
|
795
568
|
const props = __props;
|
|
796
569
|
const { $t } = useIntl();
|
|
797
|
-
const {
|
|
798
|
-
const {
|
|
570
|
+
const { getSubscription } = createSubscriptionsService();
|
|
571
|
+
const { getCustomer } = createCustomerService();
|
|
572
|
+
const { getOnDemandPricingItems } = createPricingPlanSchedulesService();
|
|
573
|
+
const { getPaymentMethodOptions } = createPaymentMethodsService();
|
|
574
|
+
const { previewChargeOnDemandPricingItems } = createInvoicesService();
|
|
799
575
|
const portal = usePortal();
|
|
800
576
|
const logger = useLogger();
|
|
577
|
+
const { dispatchAction } = useActionDispatchProvider();
|
|
578
|
+
const { isMobileViewport } = useViewport();
|
|
801
579
|
const customerId = computed(() => portal.value.customer_id);
|
|
580
|
+
const DEFAULT_PAYMENT_FORM_AMOUNT = {
|
|
581
|
+
currency: "EUR",
|
|
582
|
+
quantity: "0"
|
|
583
|
+
};
|
|
802
584
|
const selectedPricingIds = ref([]);
|
|
803
|
-
const selectedPaymentMethodId = ref(void 0);
|
|
804
|
-
const isPurchasePending = ref(false);
|
|
805
585
|
const isPurchased = ref(false);
|
|
806
|
-
const
|
|
586
|
+
const categories = ref([]);
|
|
587
|
+
const paymentMethodOptions = ref([]);
|
|
588
|
+
const isLoadingItems = ref(false);
|
|
807
589
|
const isPreviewPending = ref(false);
|
|
808
|
-
const
|
|
809
|
-
|
|
590
|
+
const isPurchasePending = ref(false);
|
|
591
|
+
const previewPendingPricingId = ref(void 0);
|
|
592
|
+
const loadError = ref(void 0);
|
|
593
|
+
const paymentIntegrationFormRef = ref();
|
|
594
|
+
const activeScheduleId = ref(void 0);
|
|
595
|
+
const previewInvoice = ref(void 0);
|
|
596
|
+
const countryCode = ref(void 0);
|
|
597
|
+
const getActiveSchedule = async () => {
|
|
598
|
+
const subscription = await getSubscription({
|
|
599
|
+
id: props.configuration.subscriptionId,
|
|
600
|
+
expanded: true
|
|
601
|
+
});
|
|
602
|
+
const schedules = subscription.pricing_plan_schedule_infos ?? [];
|
|
603
|
+
const sortedSchedules = [...schedules].sort(
|
|
604
|
+
(a, b) => Date.parse(b.start_at) - Date.parse(a.start_at)
|
|
605
|
+
);
|
|
606
|
+
const now = Date.now();
|
|
607
|
+
const activeSchedule = sortedSchedules.find((schedule) => {
|
|
608
|
+
var _a;
|
|
609
|
+
const scheduleType = ((_a = schedule.pricing_plan_schedule) == null ? void 0 : _a.type) ?? schedule.type;
|
|
610
|
+
const startAt = Date.parse(schedule.start_at);
|
|
611
|
+
const endAt = schedule.end_at ? Date.parse(schedule.end_at) : void 0;
|
|
612
|
+
const hasStarted = Number.isFinite(startAt) && startAt <= now;
|
|
613
|
+
const hasNotEnded = endAt === void 0 || !Number.isFinite(endAt) || endAt > now;
|
|
614
|
+
return scheduleType === "DEFAULT" && hasStarted && hasNotEnded;
|
|
615
|
+
});
|
|
616
|
+
if (!(activeSchedule == null ? void 0 : activeSchedule.id)) {
|
|
617
|
+
throw new Error("No pricing plan schedule found for subscription");
|
|
618
|
+
}
|
|
619
|
+
return activeSchedule;
|
|
620
|
+
};
|
|
621
|
+
const findSourceCategory = (category, sourceCategories) => sourceCategories.find(
|
|
622
|
+
(sourceCategory) => sourceCategory.product_category_id === category.product_category_id
|
|
810
623
|
);
|
|
811
|
-
const
|
|
624
|
+
const findSourcePricing = (pricing, sourcePricings = []) => sourcePricings.find((sourcePricing) => sourcePricing.id === pricing.id);
|
|
625
|
+
const normalizePricingRows = (pricing, sourcePricing) => (pricing.items ?? []).map((item) => {
|
|
626
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
627
|
+
const sourceItem = (_a = sourcePricing == null ? void 0 : sourcePricing.items) == null ? void 0 : _a.find((candidate) => candidate.id === item.id);
|
|
628
|
+
const productItems = item.product_items ?? (sourceItem == null ? void 0 : sourceItem.product_items);
|
|
629
|
+
return {
|
|
630
|
+
...pricing,
|
|
631
|
+
id: item.id,
|
|
632
|
+
name: ((_c = (_b = item.product_items) == null ? void 0 : _b[0]) == null ? void 0 : _c.name) ?? ((_e = (_d = sourceItem == null ? void 0 : sourceItem.product_items) == null ? void 0 : _d[0]) == null ? void 0 : _e.name) ?? pricing.name ?? (sourcePricing == null ? void 0 : sourcePricing.name) ?? ((_g = (_f = sourcePricing == null ? void 0 : sourcePricing.products) == null ? void 0 : _f[0]) == null ? void 0 : _g.name),
|
|
633
|
+
products: pricing.products ?? (sourcePricing == null ? void 0 : sourcePricing.products),
|
|
634
|
+
items: [
|
|
635
|
+
{
|
|
636
|
+
...item,
|
|
637
|
+
product_items: productItems
|
|
638
|
+
}
|
|
639
|
+
]
|
|
640
|
+
};
|
|
641
|
+
});
|
|
642
|
+
const normalizeOnDemandCategories = (categories2, sourceCategories) => categories2.map((category) => {
|
|
643
|
+
var _a;
|
|
644
|
+
const sourceCategory = findSourceCategory(category, sourceCategories);
|
|
645
|
+
return {
|
|
646
|
+
...category,
|
|
647
|
+
name: category.name ?? ((_a = sourceCategory == null ? void 0 : sourceCategory.product_category) == null ? void 0 : _a.name),
|
|
648
|
+
product_category: category.product_category ?? (sourceCategory == null ? void 0 : sourceCategory.product_category),
|
|
649
|
+
pricings: (category.pricings ?? []).flatMap(
|
|
650
|
+
(pricing) => normalizePricingRows(pricing, findSourcePricing(pricing, sourceCategory == null ? void 0 : sourceCategory.pricings))
|
|
651
|
+
),
|
|
652
|
+
pricing_groups: (category.pricing_groups ?? []).map((group) => {
|
|
653
|
+
var _a2;
|
|
654
|
+
const sourceGroup = (_a2 = sourceCategory == null ? void 0 : sourceCategory.pricing_groups) == null ? void 0 : _a2.find(
|
|
655
|
+
(candidate) => candidate.id === group.id
|
|
656
|
+
);
|
|
657
|
+
return {
|
|
658
|
+
...group,
|
|
659
|
+
name: group.name ?? (sourceGroup == null ? void 0 : sourceGroup.name),
|
|
660
|
+
pricings: (group.pricings ?? []).flatMap(
|
|
661
|
+
(pricing) => normalizePricingRows(
|
|
662
|
+
pricing,
|
|
663
|
+
findSourcePricing(pricing, sourceGroup == null ? void 0 : sourceGroup.pricings)
|
|
664
|
+
)
|
|
665
|
+
)
|
|
666
|
+
};
|
|
667
|
+
})
|
|
668
|
+
};
|
|
669
|
+
});
|
|
670
|
+
const loadOnDemandPricingItems = async () => {
|
|
671
|
+
var _a;
|
|
672
|
+
isLoadingItems.value = true;
|
|
673
|
+
loadError.value = void 0;
|
|
674
|
+
try {
|
|
675
|
+
const activeSchedule = await getActiveSchedule();
|
|
676
|
+
activeScheduleId.value = activeSchedule.id;
|
|
677
|
+
const [itemsResponse, optionsResponse, customer] = await Promise.all([
|
|
678
|
+
getOnDemandPricingItems({ scheduleId: activeScheduleId.value }),
|
|
679
|
+
getPaymentMethodOptions({ customerId: customerId.value }),
|
|
680
|
+
getCustomer(customerId.value)
|
|
681
|
+
]);
|
|
682
|
+
categories.value = normalizeOnDemandCategories(
|
|
683
|
+
itemsResponse.pricing_categories ?? [],
|
|
684
|
+
((_a = activeSchedule.pricing_plan_version) == null ? void 0 : _a.pricing_categories) ?? []
|
|
685
|
+
);
|
|
686
|
+
paymentMethodOptions.value = optionsResponse;
|
|
687
|
+
countryCode.value = getCustomerCountry(customer);
|
|
688
|
+
} catch (error) {
|
|
689
|
+
logger.error(
|
|
690
|
+
"INITIAL_DATA_LOAD_FAILED",
|
|
691
|
+
"Failed to load on-demand pricing items",
|
|
692
|
+
{},
|
|
693
|
+
error
|
|
694
|
+
);
|
|
695
|
+
loadError.value = $t({
|
|
696
|
+
defaultMessage: "Unable to load items. Please try again later.",
|
|
697
|
+
id: "upgrade_subscription.load_error",
|
|
698
|
+
description: "Error message shown when the one-off items cannot be loaded on the upgrade subscription page"
|
|
699
|
+
});
|
|
700
|
+
} finally {
|
|
701
|
+
isLoadingItems.value = false;
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
onMounted(() => {
|
|
705
|
+
void loadOnDemandPricingItems();
|
|
706
|
+
});
|
|
812
707
|
const allOnDemandPricings = computed(
|
|
813
708
|
() => categories.value.flatMap((cat) => [
|
|
814
709
|
...cat.pricings ?? [],
|
|
@@ -818,21 +713,73 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
818
713
|
const selectedPricings = computed(
|
|
819
714
|
() => allOnDemandPricings.value.filter((p) => selectedPricingIds.value.includes(p.id))
|
|
820
715
|
);
|
|
716
|
+
const selectedPricingItemIds = computed(
|
|
717
|
+
() => selectedPricings.value.flatMap((pricing) => pricing.items ?? []).map((item) => item.id).filter((id) => !!id)
|
|
718
|
+
);
|
|
719
|
+
const amount = computed(() => {
|
|
720
|
+
var _a, _b;
|
|
721
|
+
return (_b = (_a = previewInvoice.value) == null ? void 0 : _a.tax_summary) == null ? void 0 : _b.total_amount;
|
|
722
|
+
});
|
|
723
|
+
const paymentFormAmount = computed(() => amount.value ?? DEFAULT_PAYMENT_FORM_AMOUNT);
|
|
821
724
|
let previewTimer;
|
|
822
|
-
|
|
725
|
+
let previewRequestId = 0;
|
|
726
|
+
watch([selectedPricingItemIds, activeScheduleId], ([pricingItemIds, scheduleId]) => {
|
|
823
727
|
clearTimeout(previewTimer);
|
|
824
|
-
|
|
728
|
+
const requestId = ++previewRequestId;
|
|
729
|
+
purchaseError.value = void 0;
|
|
730
|
+
if (!scheduleId || pricingItemIds.length === 0) {
|
|
825
731
|
previewInvoice.value = void 0;
|
|
826
732
|
isPreviewPending.value = false;
|
|
733
|
+
previewPendingPricingId.value = void 0;
|
|
827
734
|
return;
|
|
828
735
|
}
|
|
829
736
|
isPreviewPending.value = true;
|
|
830
737
|
previewTimer = setTimeout(() => {
|
|
831
|
-
|
|
832
|
-
|
|
738
|
+
previewChargeOnDemandPricingItems({
|
|
739
|
+
pricingPlanScheduleId: scheduleId,
|
|
740
|
+
pricingItemIds
|
|
741
|
+
}).then((invoice) => {
|
|
742
|
+
if (requestId === previewRequestId) {
|
|
743
|
+
previewInvoice.value = invoice;
|
|
744
|
+
}
|
|
745
|
+
}).catch((error) => {
|
|
746
|
+
if (requestId !== previewRequestId) return;
|
|
747
|
+
logger.error(
|
|
748
|
+
"INVOICE_PREVIEW_FAILED",
|
|
749
|
+
"Failed to load charge-on-demand invoice preview",
|
|
750
|
+
{},
|
|
751
|
+
error
|
|
752
|
+
);
|
|
753
|
+
purchaseError.value = $t({
|
|
754
|
+
defaultMessage: "Unable to calculate the total. Please try again.",
|
|
755
|
+
id: "upgrade_subscription.preview_error",
|
|
756
|
+
description: "Error message shown when the upgrade subscription invoice preview cannot be loaded"
|
|
757
|
+
});
|
|
758
|
+
previewInvoice.value = void 0;
|
|
759
|
+
}).finally(() => {
|
|
760
|
+
if (requestId === previewRequestId) {
|
|
761
|
+
isPreviewPending.value = false;
|
|
762
|
+
previewPendingPricingId.value = void 0;
|
|
763
|
+
}
|
|
764
|
+
});
|
|
833
765
|
}, 400);
|
|
834
766
|
});
|
|
767
|
+
const authorizationContext = computed(() => {
|
|
768
|
+
if (!activeScheduleId.value) {
|
|
769
|
+
throw new Error("Cannot create charge-on-demand authorization context without a schedule.");
|
|
770
|
+
}
|
|
771
|
+
return {
|
|
772
|
+
type: "CHARGE_ON_DEMAND",
|
|
773
|
+
charge_on_demand: {
|
|
774
|
+
pricing_plan_schedule_id: activeScheduleId.value,
|
|
775
|
+
pricing_items: selectedPricingItemIds.value.map((pricingItemId) => ({
|
|
776
|
+
pricing_item_id: pricingItemId
|
|
777
|
+
}))
|
|
778
|
+
}
|
|
779
|
+
};
|
|
780
|
+
});
|
|
835
781
|
const handleToggle = (pricingId) => {
|
|
782
|
+
previewPendingPricingId.value = pricingId;
|
|
836
783
|
if (selectedPricingIds.value.includes(pricingId)) {
|
|
837
784
|
selectedPricingIds.value = selectedPricingIds.value.filter((id) => id !== pricingId);
|
|
838
785
|
} else {
|
|
@@ -840,78 +787,76 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
840
787
|
}
|
|
841
788
|
};
|
|
842
789
|
const canPurchase = computed(
|
|
843
|
-
() =>
|
|
790
|
+
() => selectedPricingItemIds.value.length > 0 && !!activeScheduleId.value && !!amount.value && !isPreviewPending.value && paymentMethodOptions.value.length > 0
|
|
844
791
|
);
|
|
845
792
|
const purchaseError = ref(void 0);
|
|
846
|
-
const isSavedPaymentMethod = (id) => id.startsWith("pmet_");
|
|
847
793
|
const handlePurchase = async () => {
|
|
848
|
-
|
|
849
|
-
isPurchasePending.value
|
|
794
|
+
var _a;
|
|
795
|
+
if (!canPurchase.value || isPurchasePending.value) return;
|
|
850
796
|
purchaseError.value = void 0;
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
}
|
|
870
|
-
logger.error("PURCHASE_FAILED", "Failed to complete upgrade subscription purchase", {}, error);
|
|
871
|
-
purchaseError.value = $t({
|
|
872
|
-
defaultMessage: "Something went wrong. Please try again.",
|
|
873
|
-
id: "upgrade_subscription.purchase_error",
|
|
874
|
-
description: "Error message shown when the purchase call fails on the upgrade subscription page"
|
|
875
|
-
});
|
|
876
|
-
} finally {
|
|
877
|
-
isPurchasePending.value = false;
|
|
878
|
-
}
|
|
797
|
+
isPurchasePending.value = true;
|
|
798
|
+
(_a = paymentIntegrationFormRef.value) == null ? void 0 : _a.submit();
|
|
799
|
+
};
|
|
800
|
+
const handleValidatePaymentSubmit = async () => canPurchase.value;
|
|
801
|
+
let redirectTimer;
|
|
802
|
+
const handlePaymentSuccess = () => {
|
|
803
|
+
isPurchasePending.value = false;
|
|
804
|
+
isPurchased.value = true;
|
|
805
|
+
redirectTimer = setTimeout(() => {
|
|
806
|
+
dispatchAction({ action: "navigate-to-customer-overview" });
|
|
807
|
+
}, 3e3);
|
|
808
|
+
};
|
|
809
|
+
const handlePaymentFailed = (error) => {
|
|
810
|
+
isPurchasePending.value = false;
|
|
811
|
+
purchaseError.value = error.message || $t({
|
|
812
|
+
defaultMessage: "Something went wrong. Please try again.",
|
|
813
|
+
id: "upgrade_subscription.purchase_error",
|
|
814
|
+
description: "Error message shown when the purchase call fails on the upgrade subscription page"
|
|
815
|
+
});
|
|
879
816
|
};
|
|
817
|
+
onUnmounted(() => {
|
|
818
|
+
clearTimeout(previewTimer);
|
|
819
|
+
clearTimeout(redirectTimer);
|
|
820
|
+
});
|
|
880
821
|
return (_ctx, _cache) => {
|
|
881
822
|
return isPurchased.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
882
|
-
createVNode(
|
|
823
|
+
createVNode(_sfc_main$c, {
|
|
824
|
+
class: "sv-upgrade-subscription__success",
|
|
825
|
+
status: "success",
|
|
826
|
+
title: unref($t)({
|
|
827
|
+
defaultMessage: "Payment successful",
|
|
828
|
+
id: "upgrade_subscription.success.title",
|
|
829
|
+
description: "Title shown after a successful upgrade purchase"
|
|
830
|
+
})
|
|
831
|
+
}, {
|
|
883
832
|
default: withCtx(() => [
|
|
884
833
|
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"
|
|
834
|
+
createVNode(unref(_sfc_main$7), {
|
|
835
|
+
variant: "body-sm",
|
|
836
|
+
shade: "lighter",
|
|
837
|
+
tag: "div",
|
|
838
|
+
class: "sv-upgrade-subscription__success-message mt-1"
|
|
894
839
|
}, {
|
|
895
840
|
default: withCtx(() => [
|
|
896
841
|
createTextVNode(toDisplayString(unref($t)({
|
|
897
|
-
defaultMessage: "
|
|
898
|
-
id: "upgrade_subscription.success.
|
|
899
|
-
description: "
|
|
842
|
+
defaultMessage: "Your purchase has been completed.",
|
|
843
|
+
id: "upgrade_subscription.success.subtitle",
|
|
844
|
+
description: "Subtitle shown after a successful upgrade purchase"
|
|
900
845
|
})), 1)
|
|
901
846
|
]),
|
|
902
847
|
_: 1
|
|
903
848
|
}),
|
|
904
|
-
createVNode(unref(_sfc_main$
|
|
849
|
+
createVNode(unref(_sfc_main$7), {
|
|
905
850
|
variant: "body-sm",
|
|
906
851
|
shade: "lighter",
|
|
907
|
-
tag: "
|
|
908
|
-
class: "sv-upgrade-subscription__success-
|
|
852
|
+
tag: "div",
|
|
853
|
+
class: "sv-upgrade-subscription__success-redirect mt-1"
|
|
909
854
|
}, {
|
|
910
855
|
default: withCtx(() => [
|
|
911
856
|
createTextVNode(toDisplayString(unref($t)({
|
|
912
|
-
defaultMessage: "
|
|
913
|
-
id: "upgrade_subscription.success.
|
|
914
|
-
description: "
|
|
857
|
+
defaultMessage: "You will be redirected shortly…",
|
|
858
|
+
id: "upgrade_subscription.success.redirect",
|
|
859
|
+
description: "Shown below the success message while the redirect timer is running"
|
|
915
860
|
})), 1)
|
|
916
861
|
]),
|
|
917
862
|
_: 1
|
|
@@ -919,89 +864,180 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
919
864
|
])
|
|
920
865
|
]),
|
|
921
866
|
_: 1
|
|
922
|
-
})
|
|
867
|
+
}, 8, ["title"])
|
|
923
868
|
])) : (openBlock(), createBlock(unref(ContentWithAsideLayout), {
|
|
924
869
|
key: 1,
|
|
925
870
|
class: "sv-upgrade-subscription sv-root sv-screen"
|
|
926
871
|
}, {
|
|
872
|
+
header: withCtx(() => [
|
|
873
|
+
createElementVNode("div", _hoisted_3, [
|
|
874
|
+
createVNode(unref(_sfc_main$7), {
|
|
875
|
+
variant: "heading-2",
|
|
876
|
+
tag: "h1",
|
|
877
|
+
class: "sv-upgrade-subscription__title"
|
|
878
|
+
}, {
|
|
879
|
+
default: withCtx(() => [
|
|
880
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
881
|
+
defaultMessage: "Upgrade subscription",
|
|
882
|
+
id: "upgrade_subscription.title",
|
|
883
|
+
description: "Title for the upgrade subscription page"
|
|
884
|
+
})), 1)
|
|
885
|
+
]),
|
|
886
|
+
_: 1
|
|
887
|
+
})
|
|
888
|
+
])
|
|
889
|
+
]),
|
|
927
890
|
content: withCtx(() => [
|
|
928
|
-
|
|
891
|
+
unref(isMobileViewport) ? (openBlock(), createBlock(_sfc_main$4, {
|
|
929
892
|
key: 0,
|
|
930
|
-
class: "sv-upgrade-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
}, null, 8, ["
|
|
935
|
-
|
|
893
|
+
class: "sv-upgrade-subscription__mobile-order-summary",
|
|
894
|
+
"selected-pricings": selectedPricings.value,
|
|
895
|
+
invoice: previewInvoice.value,
|
|
896
|
+
loading: isPreviewPending.value
|
|
897
|
+
}, null, 8, ["selected-pricings", "invoice", "loading"])) : createCommentVNode("", true),
|
|
898
|
+
!isLoadingItems.value && !loadError.value && categories.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
899
|
+
createVNode(_sfc_main$2, {
|
|
900
|
+
categories: categories.value,
|
|
901
|
+
"selected-pricing-ids": selectedPricingIds.value,
|
|
902
|
+
"loading-pricing-id": previewPendingPricingId.value,
|
|
903
|
+
onToggle: handleToggle
|
|
904
|
+
}, null, 8, ["categories", "selected-pricing-ids", "loading-pricing-id"])
|
|
905
|
+
])) : isLoadingItems.value ? (openBlock(), createElementBlock("div", _hoisted_5, [..._cache[0] || (_cache[0] = [
|
|
906
|
+
createElementVNode("div", { class: "sv-skeleton h-[72px] animate-pulse rounded-md bg-gray-100" }, null, -1),
|
|
907
|
+
createElementVNode("div", { class: "sv-skeleton mt-2 h-[72px] animate-pulse rounded-md bg-gray-100" }, null, -1),
|
|
908
|
+
createElementVNode("div", { class: "sv-skeleton mt-2 h-[72px] animate-pulse rounded-md bg-gray-100" }, null, -1)
|
|
909
|
+
])])) : loadError.value ? (openBlock(), createBlock(unref(_sfc_main$e), {
|
|
910
|
+
key: 3,
|
|
911
|
+
class: "sv-upgrade-subscription__load-error sv-error m-4",
|
|
912
|
+
title: loadError.value
|
|
913
|
+
}, null, 8, ["title"])) : (openBlock(), createBlock(unref(_sfc_main$7), {
|
|
914
|
+
key: 4,
|
|
936
915
|
variant: "body-sm",
|
|
937
916
|
shade: "lighter",
|
|
938
917
|
class: "sv-upgrade-subscription__empty-state p-4"
|
|
939
918
|
}, {
|
|
940
919
|
default: withCtx(() => [
|
|
941
920
|
createTextVNode(toDisplayString(unref($t)({
|
|
942
|
-
defaultMessage: "No
|
|
921
|
+
defaultMessage: "No one-off items are available for this subscription.",
|
|
943
922
|
id: "upgrade_subscription.empty_state",
|
|
944
|
-
description: "Shown when there are no
|
|
923
|
+
description: "Shown when there are no one-off items available for the subscription"
|
|
945
924
|
})), 1)
|
|
946
925
|
]),
|
|
947
926
|
_: 1
|
|
948
927
|
})),
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
928
|
+
createElementVNode("div", _hoisted_6, [
|
|
929
|
+
createVNode(_sfc_main$d, {
|
|
930
|
+
variant: "section",
|
|
931
|
+
class: "min-h-[130px]"
|
|
932
|
+
}, {
|
|
933
|
+
default: withCtx(() => [
|
|
934
|
+
!isLoadingItems.value || isLoadingItems.value && paymentMethodOptions.value.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_7, [
|
|
935
|
+
createVNode(unref(_sfc_main$7), {
|
|
936
|
+
variant: "heading-3",
|
|
937
|
+
tag: "h2",
|
|
938
|
+
class: "sv-upgrade-subscription__payment-methods-title mb-2"
|
|
939
|
+
}, {
|
|
940
|
+
default: withCtx(() => [
|
|
941
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
942
|
+
defaultMessage: "Payment method",
|
|
943
|
+
id: "upgrade_subscription.payment_method_block.title",
|
|
944
|
+
description: "The title of the payment method block in the upgrade subscription flow"
|
|
945
|
+
})), 1)
|
|
946
|
+
]),
|
|
947
|
+
_: 1
|
|
948
|
+
}),
|
|
949
|
+
paymentMethodOptions.value.length === 0 ? (openBlock(), createBlock(_sfc_main$g, {
|
|
950
|
+
key: 0,
|
|
951
|
+
class: "sv-upgrade-subscription__payment-methods-empty",
|
|
952
|
+
icon: "credit_card_off"
|
|
953
|
+
}, {
|
|
954
|
+
title: withCtx(() => [
|
|
955
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
956
|
+
defaultMessage: "No payment methods available",
|
|
957
|
+
id: "upgrade_subscription.payment_method_block.no_payment_methods_available_title",
|
|
958
|
+
description: "The title shown when there are no available payment methods"
|
|
959
|
+
})), 1)
|
|
960
|
+
]),
|
|
961
|
+
message: withCtx(() => [
|
|
962
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
963
|
+
defaultMessage: "There are no available payment methods. Please contact support for more information.",
|
|
964
|
+
id: "upgrade_subscription.payment_method_block.no_payment_methods_available_message",
|
|
965
|
+
description: "The message shown when there are no available payment methods"
|
|
966
|
+
})), 1)
|
|
967
|
+
]),
|
|
968
|
+
_: 1
|
|
969
|
+
})) : countryCode.value && activeScheduleId.value ? (openBlock(), createElementBlock("div", _hoisted_8, [
|
|
970
|
+
createElementVNode("div", {
|
|
971
|
+
class: normalizeClass(["sv-upgrade-subscription__payment-method-picker", { "pointer-events-none opacity-60": isPurchasePending.value }])
|
|
972
|
+
}, [
|
|
973
|
+
createVNode(_sfc_main$h, {
|
|
974
|
+
ref_key: "paymentIntegrationFormRef",
|
|
975
|
+
ref: paymentIntegrationFormRef,
|
|
976
|
+
"customer-id": customerId.value,
|
|
977
|
+
"country-code": countryCode.value,
|
|
978
|
+
context: authorizationContext.value,
|
|
979
|
+
amount: paymentFormAmount.value,
|
|
980
|
+
variant: "AUTHORIZE",
|
|
981
|
+
"payment-method-options": paymentMethodOptions.value,
|
|
982
|
+
"validate-on-submit": handleValidatePaymentSubmit,
|
|
983
|
+
"force-store-payment-method": "",
|
|
984
|
+
onPaymentSuccess: handlePaymentSuccess,
|
|
985
|
+
onPaymentFailed: handlePaymentFailed
|
|
986
|
+
}, null, 8, ["customer-id", "country-code", "context", "amount", "payment-method-options"])
|
|
987
|
+
], 2)
|
|
988
|
+
])) : createCommentVNode("", true)
|
|
989
|
+
])) : createCommentVNode("", true)
|
|
990
|
+
]),
|
|
991
|
+
_: 1
|
|
992
|
+
})
|
|
993
|
+
])
|
|
957
994
|
]),
|
|
958
995
|
aside: withCtx(() => [
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
996
|
+
createElementVNode("div", _hoisted_9, [
|
|
997
|
+
createVNode(_sfc_main$d, {
|
|
998
|
+
variant: "section",
|
|
999
|
+
class: "min-h-[220px]"
|
|
1000
|
+
}, {
|
|
1001
|
+
default: withCtx(() => [
|
|
1002
|
+
createVNode(_sfc_main$4, {
|
|
1003
|
+
"selected-pricings": selectedPricings.value,
|
|
1004
|
+
invoice: previewInvoice.value,
|
|
1005
|
+
loading: isPreviewPending.value
|
|
1006
|
+
}, null, 8, ["selected-pricings", "invoice", "loading"])
|
|
1007
|
+
]),
|
|
1008
|
+
_: 1
|
|
1009
|
+
})
|
|
1010
|
+
]),
|
|
1011
|
+
purchaseError.value ? (openBlock(), createBlock(unref(_sfc_main$e), {
|
|
966
1012
|
key: 0,
|
|
967
1013
|
class: "sv-upgrade-subscription__error sv-error",
|
|
968
1014
|
title: purchaseError.value
|
|
969
1015
|
}, 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
|
-
})
|
|
1016
|
+
createElementVNode("div", _hoisted_10, [
|
|
1017
|
+
createVNode(_sfc_main$d, { class: "sv-upgrade-subscription__submit-skeleton min-h-[44px]" }, {
|
|
1018
|
+
default: withCtx(() => [
|
|
1019
|
+
createVNode(unref(_sfc_main$b), {
|
|
1020
|
+
size: "lg",
|
|
1021
|
+
class: "sv-action sv-action--primary sv-action--full-width sv-upgrade-subscription__purchase w-full",
|
|
1022
|
+
type: "button",
|
|
1023
|
+
disabled: !canPurchase.value || isPurchasePending.value,
|
|
1024
|
+
loading: isPurchasePending.value,
|
|
1025
|
+
onClick: handlePurchase
|
|
1026
|
+
}, {
|
|
1027
|
+
default: withCtx(() => [
|
|
1028
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
1029
|
+
defaultMessage: "Purchase",
|
|
1030
|
+
id: "upgrade_subscription.purchase_button.label",
|
|
1031
|
+
description: "Label for the purchase button on the upgrade subscription page"
|
|
1032
|
+
})), 1)
|
|
1033
|
+
]),
|
|
1034
|
+
_: 1
|
|
1035
|
+
}, 8, ["disabled", "loading"])
|
|
1036
|
+
]),
|
|
1037
|
+
_: 1
|
|
1038
|
+
}),
|
|
1039
|
+
createVNode(_sfc_main$f, { "payment-method-options": paymentMethodOptions.value }, null, 8, ["payment-method-options"])
|
|
1040
|
+
])
|
|
1005
1041
|
]),
|
|
1006
1042
|
_: 1
|
|
1007
1043
|
}));
|
|
@@ -1030,7 +1066,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
1030
1066
|
setup(__props) {
|
|
1031
1067
|
return (_ctx, _cache) => {
|
|
1032
1068
|
var _a, _b, _c, _d;
|
|
1033
|
-
return openBlock(), createBlock(_sfc_main$
|
|
1069
|
+
return openBlock(), createBlock(_sfc_main$i, {
|
|
1034
1070
|
"custom-element-name": unref(COMPONENT_NAME),
|
|
1035
1071
|
environment: __props.environment,
|
|
1036
1072
|
locale: __props.locale,
|