@solvimon/solvimon-web 0.1.0-alpha.17 → 0.1.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -26
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-C2IRj-FB.mjs +238 -0
- package/dist/AddPaymentMethodPane.vue_vue_type_script_setup_true_lang-Rub9ifBk.js +1 -0
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BrPsTuoW.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-BWnZ98RQ.mjs} +2 -2
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-BuQ8bzar.js → BillingInformation.vue_vue_type_script_setup_true_lang-DurgWlLC.js} +1 -1
- package/dist/{CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-CuWrBcoK.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs} +3 -3
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-Df7CsbiW.js +1 -0
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs +2654 -0
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-mM5udvi8.js +1 -0
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BIpg-MSJ.mjs +53 -0
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BM3p8Pk8.js +1 -0
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-D5eSNYH2.js +1 -0
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-wxP5IaGt.mjs → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DbY35gE_.mjs} +1 -1
- package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-05NKI2A0.js → InvoiceHeader.vue_vue_type_script_setup_true_lang-Ci8r6tuC.js} +1 -1
- package/dist/{InvoiceHeader.vue_vue_type_script_setup_true_lang-17v07F58.mjs → InvoiceHeader.vue_vue_type_script_setup_true_lang-jshby9pF.mjs} +1 -1
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-CNKxTtO7.js +1 -0
- package/dist/PaymentErrorCard.vue_vue_type_script_setup_true_lang-DBMgilG2.mjs +153 -0
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-CupZFJSF.mjs +52 -0
- package/dist/PaymentFeedbackCard.vue_vue_type_script_setup_true_lang-D6lpD1zo.js +1 -0
- package/dist/{PaymentHistoryBlock-BitwS9Re.mjs → PaymentHistoryBlock-Bxr8lUGs.mjs} +1 -1
- package/dist/{PaymentHistoryBlock-ZtmPXXwI.js → PaymentHistoryBlock-COjIVYX4.js} +1 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-Bmgx7PSt.js +1 -0
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-C3ZUDUdw.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CDjGab5p.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-BZTzCUiu.js → PaymentIntegrationForm-BSauhuKv.js} +1 -1
- package/dist/{PaymentIntegrationForm-BK2aLPCo.mjs → PaymentIntegrationForm-PIT8gHYN.mjs} +1 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-5XKz3kop.js +1 -0
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-COO2ZUhN.mjs +148 -0
- package/dist/PaymentIntegrationFormAdyen-B-Jbu2hU.js +1 -0
- package/dist/PaymentIntegrationFormAdyen-Cjj9aK0E.mjs +729 -0
- package/dist/PaymentIntegrationFormStripe-Bnn8S1o5.js +1 -0
- package/dist/PaymentIntegrationFormStripe-arpua_ZT.mjs +545 -0
- package/dist/PaymentMethodForm-B7T5rrNz.mjs +4 -0
- package/dist/PaymentMethodForm-CLz3ZS-b.js +1 -0
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-CIQ0vsko.mjs → PaymentMethodForm.vue_vue_type_script_setup_true_lang-C4Zf92QP.mjs} +2 -2
- package/dist/{PaymentMethodForm.vue_vue_type_script_setup_true_lang-zRr8iihy.js → PaymentMethodForm.vue_vue_type_script_setup_true_lang-UH9AVXnG.js} +1 -1
- package/dist/{PaymentMethodsList.vue_vue_type_script_setup_true_lang-DVeB_mqK.mjs → PaymentMethodsList.vue_vue_type_script_setup_true_lang-CIIt6fGp.mjs} +76 -30
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-ifai5HVr.js +1 -0
- package/dist/{SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-D1TcP9PR.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DaWlLor0.mjs} +2 -2
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-DdUoeTUL.js +1 -0
- package/dist/{SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BMXr26gF.mjs → SubscriptionSchedules.vue_vue_type_script_setup_true_lang-CyYhYYRp.mjs} +1 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-DdjYVNku.js +1 -0
- package/dist/SubscriptionSummary.vue_vue_type_script_setup_true_lang-Cu55ZvCH.js +1 -0
- package/dist/{EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-C3cqlbGY.mjs → SubscriptionSummary.vue_vue_type_script_setup_true_lang-z8P1u1Gi.mjs} +16 -63
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-BKDMwuyh.js +1 -0
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-BDqX6OaE.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-BOUSk2ZB.mjs} +5 -5
- package/dist/adyen-BMDZQBUG.js +1 -0
- package/dist/{url-BjZ1Pg0l.mjs → adyen-Ba-mF3Jy.mjs} +31 -73
- package/dist/component--Y7Igv5i.mjs +1022 -0
- package/dist/component-DIy1hvJM.js +1 -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 +4 -4
- 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 +7 -7
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -1
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +3 -3
- package/dist/components/InvoiceHeader/InvoiceHeader.cjs.js +1 -1
- package/dist/components/InvoiceHeader/InvoiceHeader.es.js +4 -4
- 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 +4 -4
- 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 +21 -7
- package/dist/core/action-request.types.d.ts +1 -13
- package/dist/core/index.cjs.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/{customer-DAgdegIW.mjs → customer-DovIxTG1.mjs} +1 -1
- package/dist/{customer-AfRcAZ5P.js → customer-brfznoHY.js} +1 -1
- package/dist/en-US-BvOHPudj.js +1 -0
- package/dist/{en-US-DSzSbgL5.mjs → en-US-CXDO3qhq.mjs} +53 -0
- package/dist/index-BMWWP8xj.js +1 -0
- package/dist/index-Do7kzLpg.mjs +265 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{invoices-BHgajZHq.js → invoices-Cf3dSYSj.js} +1 -1
- package/dist/{invoices-BXDgW8ch.mjs → invoices-Dk-z04lg.mjs} +2 -2
- package/dist/{nl-NL-Li7RW89R.mjs → nl-NL-BgL_PuBn.mjs} +55 -1
- package/dist/nl-NL-COGUFg60.js +1 -0
- package/dist/{paymentMethods-xzFD2L30.mjs → paymentMethods-BnF1XYS1.mjs} +21 -5
- package/dist/paymentMethods-DVDC_WfL.js +1 -0
- package/dist/{payments-DMvmB5vg.js → payments-DVZFO5yb.js} +1 -1
- package/dist/{payments-DV6csRej.mjs → payments-TnRjtlOw.mjs} +1 -1
- package/dist/{pricing-BEjY_5wb.js → pricing-CuYndX6t.js} +1 -1
- package/dist/{pricing-B1uImUm4.mjs → pricing-GwLCiSzs.mjs} +1 -1
- package/dist/{pricingPlanSchedule-C_cqUyTk.mjs → pricingPlanSchedule-CXG3CQ61.mjs} +3 -1
- package/dist/{registry-CyENvS6l.mjs → registry-Ck0Gb6rj.mjs} +1 -1
- package/dist/{registry-CeMxLjwU.js → registry-Cra6yoB4.js} +1 -1
- package/dist/screens/Checkout/Checkout.cjs.js +1 -1
- package/dist/screens/Checkout/Checkout.es.js +37 -36
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -1
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +32 -56
- package/dist/screens/PayInvoice/PayInvoice.cjs.js +1 -1
- package/dist/screens/PayInvoice/PayInvoice.es.js +28 -12
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.cjs.js +1 -1
- package/dist/screens/PaymentMethodsManagement/PaymentMethodsManagement.es.js +28 -18
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.cjs.js +1 -1
- package/dist/screens/SubscriptionDetails/SubscriptionDetails.es.js +436 -89
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.cjs.js +1 -1
- package/dist/screens/SubscriptionManagement/SubscriptionManagement.es.js +28 -37
- package/dist/solvimon-web.css +1 -1
- package/dist/{subscription-B4dBAY9C.mjs → subscription-C41lG-rH.mjs} +1 -1
- package/dist/subscriptions-BFCKVHnP.js +1 -0
- package/dist/subscriptions-vEE4Y7qm.mjs +58 -0
- package/dist/{useActionDispatchProvider-zB_GKeUR.mjs → useActionDispatchProvider-BlEf-RZ5.mjs} +1 -1
- package/dist/{useActionDispatchProvider-bqR_FeM4.js → useActionDispatchProvider-aJOy3kr1.js} +1 -1
- package/dist/{useCustomer-bO4D6e4Z.js → useCustomer-C1XTqmrQ.js} +1 -1
- package/dist/{useCustomer-VfeQ6rG2.mjs → useCustomer-Cw8LXT6S.mjs} +2 -2
- package/dist/{useIncrementalLoading-C59FXHzp.mjs → useIncrementalLoading-8WtKZ-mP.mjs} +2 -2
- package/dist/useIncrementalLoading-CkY2klIW.js +1 -0
- package/dist/{useInvoiceData-CxxkBTGY.js → useInvoiceData-BrxMo4Zt.js} +1 -1
- package/dist/{useInvoiceData-Dhg-hx8C.mjs → useInvoiceData-Cy_ysMsq.mjs} +2 -2
- package/dist/{useInvoicesList-DBz7T7sM.mjs → useInvoicesList-DMsZn1tE.mjs} +4 -4
- package/dist/{useInvoicesList-BXZ9uV9i.js → useInvoicesList-DmisMQzy.js} +1 -1
- package/dist/{useLoadInitialData-BhpIg7OF.mjs → useLoadInitialData-BP1v7qhd.mjs} +1 -1
- package/dist/{useLoadInitialData-BqiAFNFi.js → useLoadInitialData-_BjCD0Jc.js} +1 -1
- package/dist/{usePaymentMethodOptions-PcMjtMSF.mjs → usePaymentMethodOptions-CWfGvW0U.mjs} +9 -3
- package/dist/{usePaymentMethodOptions-DszFvgKX.js → usePaymentMethodOptions-xeSTmaVo.js} +1 -1
- package/dist/{usePaymentMethods-Bb1Xbads.js → usePaymentMethods-CAFMvSOr.js} +1 -1
- package/dist/{usePaymentMethods-B5AbGWsn.mjs → usePaymentMethods-Cyk4cjoE.mjs} +2 -2
- package/dist/{usePayments-is5c66Z6.js → usePayments-BieVBaz-.js} +1 -1
- package/dist/{usePayments-DgoZoBZh.mjs → usePayments-D88XSZfS.mjs} +10 -4
- package/dist/{usePortal-DWLtNqBB.mjs → usePortal-0NDlbFr9.mjs} +1 -1
- package/dist/{usePortal-C4qWsJeq.js → usePortal-B954nyEB.js} +1 -1
- package/dist/{useService-DKm3QtT4.js → useService-BiljI7XA.js} +1 -1
- package/dist/{useService-BZqFkz7p.mjs → useService-CqfJi5ST.mjs} +1 -1
- package/dist/{useSubscription-CEZJw6wZ.mjs → useSubscription-9rJpFNUF.mjs} +9 -3
- package/dist/{useSubscription-DuUNc1_l.js → useSubscription-k3limdu_.js} +1 -1
- package/dist/vendor-ui-Dfh3_g4q.js +1 -0
- package/dist/{vendor-ui-BoGKOJ36.mjs → vendor-ui-ItGf7wJV.mjs} +1912 -1800
- package/package.json +12 -5
- package/dist/CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-1Op9GjGZ.js +0 -1
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-C66beqgf.js +0 -1
- package/dist/CustomerWalletBalances.vue_vue_type_script_setup_true_lang-D2BhuXsh.mjs +0 -77
- package/dist/EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BbuEBiY3.js +0 -1
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-dwIv_xxf.js +0 -1
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CMGK71zZ.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-B_yDNGK8.mjs +0 -1537
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-GN3WAr10.js +0 -1
- package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-BQIN3zuf.mjs +0 -156
- package/dist/PaymentMethodSelector.vue_vue_type_script_setup_true_lang-DyL2-vV0.js +0 -1
- package/dist/PaymentMethodsList.vue_vue_type_script_setup_true_lang-OvGGejpX.js +0 -1
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BxqIfmkK.js +0 -1
- package/dist/SubscriptionSchedules.vue_vue_type_script_setup_true_lang-BKz2QQn9.js +0 -1
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-CyAFjCh7.js +0 -1
- package/dist/component-CUJ_G2Nw.mjs +0 -962
- package/dist/component-CiKxWtdx.js +0 -1
- package/dist/en-US-QzQnGXP1.js +0 -1
- package/dist/index-CzL1ZcGi.mjs +0 -85
- package/dist/index-DRdBmZ2-.js +0 -1
- package/dist/nl-NL-C4rr-1tr.js +0 -1
- package/dist/paymentMethods-BMcc-eTl.js +0 -1
- package/dist/subscriptions-CrNDM9qa.mjs +0 -79
- package/dist/subscriptions-DC-mxa17.js +0 -1
- package/dist/url-D8GJi5rF.js +0 -1
- package/dist/useIncrementalLoading-BgWuwoMo.js +0 -1
- package/dist/useTopUpModal-DNyWrHDv.mjs +0 -1012
- package/dist/useTopUpModal-DeF-cfCK.js +0 -1
- package/dist/vendor-ui-BuRqLx74.js +0 -1
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import { computed, defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList,
|
|
2
|
-
import { _ as _sfc_main$
|
|
3
|
-
import { u as useIntl, E as formatAmount,
|
|
1
|
+
import { computed, ref, defineComponent, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, Fragment, renderList, shallowRef, watch, toRef, renderSlot, normalizeProps, guardReactiveProps } from "vue";
|
|
2
|
+
import { a as useLogger, _ as _sfc_main$i, d as defineCustomElement, g as getComponentName } from "../../component--Y7Igv5i.mjs";
|
|
3
|
+
import { u as useIntl, E as formatAmount, a2 as formatBillingPeriod, b as _sfc_main$6, a as _sfc_main$7, k as _sfc_main$8, g as getPaginatedFullList, h as isApiSuccessCollectionResponse, M as Modal, n as _sfc_main$a, D as _sfc_main$b, a3 as _sfc_main$e } from "../../vendor-ui-ItGf7wJV.mjs";
|
|
4
4
|
import { C as ContentWithAsideLayout } from "../../ContentWithAsideLayout-Dy9xgxuF.mjs";
|
|
5
|
-
import { u as useActionDispatchProvider } from "../../useActionDispatchProvider-
|
|
6
|
-
import { b as getMostRecentScheduleInfo, a as getSubscriptionName } from "../../subscription-
|
|
7
|
-
import { _ as _sfc_main$
|
|
8
|
-
import { _ as _sfc_main$
|
|
9
|
-
import { _ as _sfc_main$
|
|
10
|
-
import {
|
|
11
|
-
import { _ as _sfc_main$
|
|
12
|
-
import { g as getNameFromPricing } from "../../pricing-
|
|
5
|
+
import { u as useActionDispatchProvider } from "../../useActionDispatchProvider-BlEf-RZ5.mjs";
|
|
6
|
+
import { b as getMostRecentScheduleInfo, a as getSubscriptionName } from "../../subscription-C41lG-rH.mjs";
|
|
7
|
+
import { _ as _sfc_main$g } from "../../SubscriptionSchedules.vue_vue_type_script_setup_true_lang-CyYhYYRp.mjs";
|
|
8
|
+
import { _ as _sfc_main$c, u as useCustomerWalletBalances } from "../../CustomerWalletBalances.vue_vue_type_script_setup_true_lang-OUg4yv7r.mjs";
|
|
9
|
+
import { _ as _sfc_main$d } from "../../CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D7gL7dZX.mjs";
|
|
10
|
+
import { _ as _sfc_main$h } from "../../EmptyStatePlaceholder.vue_vue_type_script_setup_true_lang-BIpg-MSJ.mjs";
|
|
11
|
+
import { _ as _sfc_main$f } from "../../Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
|
|
12
|
+
import { g as getNameFromPricing } from "../../pricing-GwLCiSzs.mjs";
|
|
13
|
+
import { c as createSubscriptionsService } from "../../subscriptions-vEE4Y7qm.mjs";
|
|
14
|
+
import { _ as _sfc_main$9 } from "../../SubscriptionSummary.vue_vue_type_script_setup_true_lang-z8P1u1Gi.mjs";
|
|
15
|
+
import { c as createPaymentMethodsService } from "../../paymentMethods-BnF1XYS1.mjs";
|
|
13
16
|
import { A as ApiStatus } from "../../ApiStatus-CyNDp_op.mjs";
|
|
14
|
-
import { u as useSubscription } from "../../useSubscription-
|
|
15
|
-
import { u as useCustomer } from "../../useCustomer-
|
|
16
|
-
import { u as usePaymentMethods } from "../../usePaymentMethods-
|
|
17
|
-
import { u as useLoadInitialData } from "../../useLoadInitialData-
|
|
17
|
+
import { u as useSubscription } from "../../useSubscription-9rJpFNUF.mjs";
|
|
18
|
+
import { u as useCustomer } from "../../useCustomer-Cw8LXT6S.mjs";
|
|
19
|
+
import { u as usePaymentMethods } from "../../usePaymentMethods-Cyk4cjoE.mjs";
|
|
20
|
+
import { u as useLoadInitialData } from "../../useLoadInitialData-BP1v7qhd.mjs";
|
|
18
21
|
function useSubscriptionActions({
|
|
19
22
|
subscription
|
|
20
23
|
}) {
|
|
@@ -29,19 +32,17 @@ function useSubscriptionActions({
|
|
|
29
32
|
const inactivePeriods = (_a = subscription.value) == null ? void 0 : _a.inactive_periods;
|
|
30
33
|
return Array.isArray(inactivePeriods) && inactivePeriods.length > 0;
|
|
31
34
|
});
|
|
35
|
+
const pendingVariant = ref();
|
|
32
36
|
const cancel = () => {
|
|
33
37
|
if (!subscription.value) return;
|
|
34
|
-
|
|
35
|
-
action: "cancel-subscription",
|
|
36
|
-
data: { subscriptionId: subscription.value.id }
|
|
37
|
-
});
|
|
38
|
+
pendingVariant.value = "CANCEL";
|
|
38
39
|
};
|
|
39
40
|
const renew = () => {
|
|
40
41
|
if (!subscription.value) return;
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
42
|
+
pendingVariant.value = "RENEW";
|
|
43
|
+
};
|
|
44
|
+
const dismiss = () => {
|
|
45
|
+
pendingVariant.value = void 0;
|
|
45
46
|
};
|
|
46
47
|
const manage = () => {
|
|
47
48
|
if (!subscription.value) return;
|
|
@@ -50,7 +51,7 @@ function useSubscriptionActions({
|
|
|
50
51
|
data: { subscriptionId: subscription.value.id }
|
|
51
52
|
});
|
|
52
53
|
};
|
|
53
|
-
return { isCancellable, isRenewable, cancel, renew, manage };
|
|
54
|
+
return { isCancellable, isRenewable, pendingVariant, cancel, renew, dismiss, manage };
|
|
54
55
|
}
|
|
55
56
|
function getHeadlinePrice(pricing) {
|
|
56
57
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
@@ -85,9 +86,9 @@ function getEnabledPricingsEntries(scheduleInfo) {
|
|
|
85
86
|
}))
|
|
86
87
|
);
|
|
87
88
|
}
|
|
88
|
-
const _hoisted_1$
|
|
89
|
-
const _hoisted_2 = { class: "sv-enabled-pricings-list__item-content grow" };
|
|
90
|
-
const _sfc_main$
|
|
89
|
+
const _hoisted_1$3 = { class: "sv-enabled-pricings-list__item-body flex items-center gap-4" };
|
|
90
|
+
const _hoisted_2$1 = { class: "sv-enabled-pricings-list__item-content grow" };
|
|
91
|
+
const _sfc_main$5 = /* @__PURE__ */ defineComponent({
|
|
91
92
|
__name: "EnabledPricingsListItem",
|
|
92
93
|
props: {
|
|
93
94
|
entry: { type: Object }
|
|
@@ -120,14 +121,13 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
120
121
|
);
|
|
121
122
|
});
|
|
122
123
|
return (_ctx, _cache) => {
|
|
123
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
124
|
+
return openBlock(), createBlock(unref(_sfc_main$6), { class: "sv-enabled-pricings-list__item" }, {
|
|
124
125
|
default: withCtx(() => [
|
|
125
|
-
createElementVNode("div", _hoisted_1$
|
|
126
|
-
createElementVNode("div", _hoisted_2, [
|
|
127
|
-
createVNode(unref(_sfc_main$
|
|
126
|
+
createElementVNode("div", _hoisted_1$3, [
|
|
127
|
+
createElementVNode("div", _hoisted_2$1, [
|
|
128
|
+
createVNode(unref(_sfc_main$7), {
|
|
128
129
|
tag: "span",
|
|
129
|
-
variant: "body-
|
|
130
|
-
weight: "semibold",
|
|
130
|
+
variant: "body-xs",
|
|
131
131
|
shade: "lighter",
|
|
132
132
|
class: "sv-enabled-pricings-list__item-group"
|
|
133
133
|
}, {
|
|
@@ -136,7 +136,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
136
136
|
]),
|
|
137
137
|
_: 1
|
|
138
138
|
}),
|
|
139
|
-
createVNode(unref(_sfc_main$
|
|
139
|
+
createVNode(unref(_sfc_main$7), {
|
|
140
140
|
tag: "h3",
|
|
141
141
|
variant: "heading-3",
|
|
142
142
|
"no-spacing": "",
|
|
@@ -147,7 +147,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
147
147
|
]),
|
|
148
148
|
_: 1
|
|
149
149
|
}),
|
|
150
|
-
price.value ? (openBlock(), createBlock(unref(_sfc_main$
|
|
150
|
+
price.value ? (openBlock(), createBlock(unref(_sfc_main$7), {
|
|
151
151
|
key: 0,
|
|
152
152
|
tag: "span",
|
|
153
153
|
variant: "body-sm",
|
|
@@ -160,7 +160,7 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
160
160
|
_: 1
|
|
161
161
|
})) : createCommentVNode("", true)
|
|
162
162
|
]),
|
|
163
|
-
createVNode(unref(_sfc_main$
|
|
163
|
+
createVNode(unref(_sfc_main$8), {
|
|
164
164
|
variant: "outline",
|
|
165
165
|
color: "gray",
|
|
166
166
|
class: "sv-action sv-action--secondary sv-enabled-pricings-list__item-upgrade shrink-0",
|
|
@@ -184,8 +184,8 @@ const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
186
|
});
|
|
187
|
-
const _hoisted_1$
|
|
188
|
-
const _sfc_main$
|
|
187
|
+
const _hoisted_1$2 = { class: "sv-enabled-pricings-list__items grid grid-cols-1 gap-2" };
|
|
188
|
+
const _sfc_main$4 = /* @__PURE__ */ defineComponent({
|
|
189
189
|
__name: "EnabledPricingsList",
|
|
190
190
|
props: {
|
|
191
191
|
pricingPlanSchedule: { type: Object }
|
|
@@ -196,7 +196,7 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
196
196
|
const { $t } = useIntl();
|
|
197
197
|
const entries = computed(() => getEnabledPricingsEntries(props.pricingPlanSchedule));
|
|
198
198
|
return (_ctx, _cache) => {
|
|
199
|
-
return entries.value.length > 0 ? (openBlock(), createBlock(unref(_sfc_main$
|
|
199
|
+
return entries.value.length > 0 ? (openBlock(), createBlock(unref(_sfc_main$6), {
|
|
200
200
|
key: 0,
|
|
201
201
|
class: "sv-enabled-pricings-list",
|
|
202
202
|
"content-background": "none",
|
|
@@ -209,9 +209,9 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
209
209
|
})
|
|
210
210
|
}, {
|
|
211
211
|
default: withCtx(() => [
|
|
212
|
-
createElementVNode("div", _hoisted_1$
|
|
212
|
+
createElementVNode("div", _hoisted_1$2, [
|
|
213
213
|
(openBlock(true), createElementBlock(Fragment, null, renderList(entries.value, (entry) => {
|
|
214
|
-
return openBlock(), createBlock(_sfc_main$
|
|
214
|
+
return openBlock(), createBlock(_sfc_main$5, {
|
|
215
215
|
key: entry.pricingId,
|
|
216
216
|
entry,
|
|
217
217
|
onUpgrade: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("upgrade", $event))
|
|
@@ -224,6 +224,312 @@ const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
|
224
224
|
};
|
|
225
225
|
}
|
|
226
226
|
});
|
|
227
|
+
function useSubscriptionCancellationModalLabels({
|
|
228
|
+
variant,
|
|
229
|
+
renewableUntil,
|
|
230
|
+
billingPeriodEndsAt
|
|
231
|
+
}) {
|
|
232
|
+
const { $t } = useIntl();
|
|
233
|
+
const isRenewing = computed(() => variant.value === "RENEW");
|
|
234
|
+
const title = computed(
|
|
235
|
+
() => isRenewing.value ? $t({
|
|
236
|
+
defaultMessage: "Renew subscription",
|
|
237
|
+
description: "Title of the renew subscription confirmation modal",
|
|
238
|
+
id: "subscription_cancellation_modal.renew.title"
|
|
239
|
+
}) : $t({
|
|
240
|
+
defaultMessage: "Cancel subscription",
|
|
241
|
+
description: "Title of the cancel subscription confirmation modal",
|
|
242
|
+
id: "subscription_cancellation_modal.cancel.title"
|
|
243
|
+
})
|
|
244
|
+
);
|
|
245
|
+
const explanation = computed(() => {
|
|
246
|
+
if (!isRenewing.value) {
|
|
247
|
+
if (billingPeriodEndsAt.value) {
|
|
248
|
+
return $t(
|
|
249
|
+
{
|
|
250
|
+
defaultMessage: "Your subscription will be canceled, but you’ll continue to have access until {date}.",
|
|
251
|
+
description: "Explanation of what happens when a running subscription is cancelled, naming the date access ends, shown in the cancel subscription modal",
|
|
252
|
+
id: "subscription_cancellation_modal.cancel.explanation_with_date"
|
|
253
|
+
},
|
|
254
|
+
{ date: billingPeriodEndsAt.value }
|
|
255
|
+
);
|
|
256
|
+
}
|
|
257
|
+
return $t({
|
|
258
|
+
defaultMessage: "Your subscription will be canceled, but you’ll continue to have access until the end of the billing period.",
|
|
259
|
+
description: "Explanation of what happens when a running subscription is cancelled, shown in the cancel subscription modal",
|
|
260
|
+
id: "subscription_cancellation_modal.cancel.explanation"
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
if (!renewableUntil.value) {
|
|
264
|
+
return $t({
|
|
265
|
+
defaultMessage: "Your subscription will continue as before, and billing will resume on its usual schedule.",
|
|
266
|
+
description: "Explanation of what happens when a cancellation is undone, shown in the renew subscription modal when no end date is known",
|
|
267
|
+
id: "subscription_cancellation_modal.renew.explanation"
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
return $t(
|
|
271
|
+
{
|
|
272
|
+
defaultMessage: "You can renew your subscription until {date}. After this period you can only create a new subscription.",
|
|
273
|
+
description: "Explanation of the deadline for undoing a cancellation, shown in the renew subscription modal",
|
|
274
|
+
id: "subscription_cancellation_modal.renew.explanation_with_date"
|
|
275
|
+
},
|
|
276
|
+
{ date: renewableUntil.value }
|
|
277
|
+
);
|
|
278
|
+
});
|
|
279
|
+
const confirmButtonText = computed(
|
|
280
|
+
() => isRenewing.value ? $t({
|
|
281
|
+
defaultMessage: "Renew subscription",
|
|
282
|
+
description: "Label of the confirm button in the renew subscription modal",
|
|
283
|
+
id: "subscription_cancellation_modal.renew.confirm_button.label"
|
|
284
|
+
}) : $t({
|
|
285
|
+
defaultMessage: "Cancel subscription",
|
|
286
|
+
description: "Label of the confirm button in the cancel subscription modal",
|
|
287
|
+
id: "subscription_cancellation_modal.cancel.confirm_button.label"
|
|
288
|
+
})
|
|
289
|
+
);
|
|
290
|
+
const cancelButtonText = computed(
|
|
291
|
+
() => $t({
|
|
292
|
+
defaultMessage: "Cancel",
|
|
293
|
+
description: "Label of the button that dismisses the cancellation modal",
|
|
294
|
+
id: "subscription_cancellation_modal.cancel_button.label"
|
|
295
|
+
})
|
|
296
|
+
);
|
|
297
|
+
const errorMessage = computed(
|
|
298
|
+
() => isRenewing.value ? $t({
|
|
299
|
+
defaultMessage: "We could not renew your subscription. Please try again.",
|
|
300
|
+
description: "Error shown when undoing a cancellation fails",
|
|
301
|
+
id: "subscription_cancellation_modal.renew.error"
|
|
302
|
+
}) : $t({
|
|
303
|
+
defaultMessage: "We could not cancel your subscription. Please try again.",
|
|
304
|
+
description: "Error shown when cancelling a subscription fails",
|
|
305
|
+
id: "subscription_cancellation_modal.cancel.error"
|
|
306
|
+
})
|
|
307
|
+
);
|
|
308
|
+
return { title, explanation, confirmButtonText, cancelButtonText, errorMessage };
|
|
309
|
+
}
|
|
310
|
+
const PAGE_SIZE = 50;
|
|
311
|
+
function usePaymentMethod() {
|
|
312
|
+
const { getPaymentMethods } = createPaymentMethodsService();
|
|
313
|
+
const paymentMethod = shallowRef();
|
|
314
|
+
const get = async ({
|
|
315
|
+
customerId,
|
|
316
|
+
paymentMethodId
|
|
317
|
+
}) => {
|
|
318
|
+
const response = await getPaginatedFullList(async (page) => {
|
|
319
|
+
const pageResponse = await getPaymentMethods({
|
|
320
|
+
customerId,
|
|
321
|
+
pagination: { page, pageSize: PAGE_SIZE }
|
|
322
|
+
});
|
|
323
|
+
if (!isApiSuccessCollectionResponse(pageResponse)) {
|
|
324
|
+
throw new Error("Could not load the customer’s payment methods.");
|
|
325
|
+
}
|
|
326
|
+
return pageResponse;
|
|
327
|
+
});
|
|
328
|
+
paymentMethod.value = response.data.find(({ id }) => id === paymentMethodId);
|
|
329
|
+
return paymentMethod.value;
|
|
330
|
+
};
|
|
331
|
+
return { paymentMethod, get };
|
|
332
|
+
}
|
|
333
|
+
const _hoisted_1$1 = { class: "sv-subscription-cancellation-modal sv-subscription-cancellation-modal__body flex flex-col gap-3" };
|
|
334
|
+
const _hoisted_2 = {
|
|
335
|
+
key: 0,
|
|
336
|
+
class: "sv-subscription-cancellation-modal__meta flex flex-wrap items-center gap-x-6 gap-y-2 px-3 pb-2"
|
|
337
|
+
};
|
|
338
|
+
const _hoisted_3 = {
|
|
339
|
+
key: 0,
|
|
340
|
+
class: "sv-subscription-cancellation-modal__renews flex gap-1"
|
|
341
|
+
};
|
|
342
|
+
const _sfc_main$3 = /* @__PURE__ */ defineComponent({
|
|
343
|
+
__name: "SubscriptionCancellationModal",
|
|
344
|
+
props: {
|
|
345
|
+
showModal: { type: Boolean },
|
|
346
|
+
variant: { type: null },
|
|
347
|
+
subscription: { type: Object },
|
|
348
|
+
avatar: { type: String }
|
|
349
|
+
},
|
|
350
|
+
emits: ["confirmed", "close"],
|
|
351
|
+
setup(__props, { emit: __emit }) {
|
|
352
|
+
const props = __props;
|
|
353
|
+
const emit = __emit;
|
|
354
|
+
const { $t, formatDate } = useIntl();
|
|
355
|
+
const logger = useLogger();
|
|
356
|
+
const { setSubscriptionCancellation } = createSubscriptionsService();
|
|
357
|
+
const variant = computed(() => props.variant);
|
|
358
|
+
const renewableUntil = computed(() => {
|
|
359
|
+
var _a;
|
|
360
|
+
const periods = ((_a = props.subscription) == null ? void 0 : _a.inactive_periods) ?? [];
|
|
361
|
+
const cancellation = periods.find(({ type }) => type === "CANCEL") ?? periods[0];
|
|
362
|
+
if (!cancellation) return void 0;
|
|
363
|
+
return formatDate({
|
|
364
|
+
date: cancellation.start_at,
|
|
365
|
+
format: "date",
|
|
366
|
+
offsetType: "local"
|
|
367
|
+
});
|
|
368
|
+
});
|
|
369
|
+
const billingPeriodEndsAt = computed(() => {
|
|
370
|
+
var _a, _b;
|
|
371
|
+
const invoiceDate = (_b = (_a = props.subscription) == null ? void 0 : _a.next_invoice) == null ? void 0 : _b.invoice_date;
|
|
372
|
+
if (!invoiceDate) return void 0;
|
|
373
|
+
return formatDate({
|
|
374
|
+
date: invoiceDate,
|
|
375
|
+
format: "date",
|
|
376
|
+
offsetType: "local"
|
|
377
|
+
});
|
|
378
|
+
});
|
|
379
|
+
const renewsOn = billingPeriodEndsAt;
|
|
380
|
+
const enabledPricingIds = computed(
|
|
381
|
+
() => {
|
|
382
|
+
var _a, _b;
|
|
383
|
+
return (((_b = (_a = getMostRecentScheduleInfo(props.subscription)) == null ? void 0 : _a.pricing_plan_schedule) == null ? void 0 : _b.enabled_pricings) ?? []).map(({ pricing_id }) => pricing_id).filter((pricingId) => Boolean(pricingId));
|
|
384
|
+
}
|
|
385
|
+
);
|
|
386
|
+
const { title, explanation, confirmButtonText, cancelButtonText, errorMessage } = useSubscriptionCancellationModalLabels({ variant, renewableUntil, billingPeriodEndsAt });
|
|
387
|
+
const { paymentMethod, get: fetchPaymentMethod } = usePaymentMethod();
|
|
388
|
+
watch(
|
|
389
|
+
[
|
|
390
|
+
() => props.showModal,
|
|
391
|
+
() => {
|
|
392
|
+
var _a;
|
|
393
|
+
return (_a = props.subscription) == null ? void 0 : _a.payment_method_id;
|
|
394
|
+
},
|
|
395
|
+
() => {
|
|
396
|
+
var _a;
|
|
397
|
+
return (_a = props.subscription) == null ? void 0 : _a.customer_id;
|
|
398
|
+
}
|
|
399
|
+
],
|
|
400
|
+
([showModal, paymentMethodId, customerId]) => {
|
|
401
|
+
var _a;
|
|
402
|
+
if (!showModal || !paymentMethodId || !customerId) return;
|
|
403
|
+
if (paymentMethodId === ((_a = paymentMethod.value) == null ? void 0 : _a.id)) return;
|
|
404
|
+
void fetchPaymentMethod({ customerId, paymentMethodId }).catch(() => void 0);
|
|
405
|
+
},
|
|
406
|
+
{ immediate: true }
|
|
407
|
+
);
|
|
408
|
+
const isSubmitting = ref(false);
|
|
409
|
+
const hasFailed = ref(false);
|
|
410
|
+
watch(
|
|
411
|
+
() => props.showModal,
|
|
412
|
+
(showModal) => {
|
|
413
|
+
if (!showModal) return;
|
|
414
|
+
hasFailed.value = false;
|
|
415
|
+
}
|
|
416
|
+
);
|
|
417
|
+
const handleConfirm = async () => {
|
|
418
|
+
if (!props.subscription || !props.variant || isSubmitting.value) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
isSubmitting.value = true;
|
|
422
|
+
hasFailed.value = false;
|
|
423
|
+
try {
|
|
424
|
+
await setSubscriptionCancellation({
|
|
425
|
+
id: props.subscription.id,
|
|
426
|
+
variant: props.variant
|
|
427
|
+
});
|
|
428
|
+
emit("confirmed");
|
|
429
|
+
emit("close");
|
|
430
|
+
} catch (error) {
|
|
431
|
+
logger.error(
|
|
432
|
+
"SUBSCRIPTION_CANCELLATION_FAILED",
|
|
433
|
+
"Failed to change the cancellation state of a subscription",
|
|
434
|
+
{ variant: props.variant },
|
|
435
|
+
error
|
|
436
|
+
);
|
|
437
|
+
hasFailed.value = true;
|
|
438
|
+
} finally {
|
|
439
|
+
isSubmitting.value = false;
|
|
440
|
+
}
|
|
441
|
+
};
|
|
442
|
+
const handleClose = () => {
|
|
443
|
+
if (isSubmitting.value) return;
|
|
444
|
+
emit("close");
|
|
445
|
+
};
|
|
446
|
+
return (_ctx, _cache) => {
|
|
447
|
+
return openBlock(), createBlock(unref(Modal), {
|
|
448
|
+
size: "md",
|
|
449
|
+
"show-modal": __props.showModal,
|
|
450
|
+
title: unref(title),
|
|
451
|
+
"confirm-button-text": unref(confirmButtonText),
|
|
452
|
+
"cancel-button-text": unref(cancelButtonText),
|
|
453
|
+
"is-loading": isSubmitting.value,
|
|
454
|
+
"no-click-away": isSubmitting.value,
|
|
455
|
+
"no-backdrop-close": isSubmitting.value,
|
|
456
|
+
onConfirm: handleConfirm,
|
|
457
|
+
onClose: handleClose
|
|
458
|
+
}, {
|
|
459
|
+
body: withCtx(() => [
|
|
460
|
+
createElementVNode("div", _hoisted_1$1, [
|
|
461
|
+
createVNode(unref(_sfc_main$7), {
|
|
462
|
+
variant: "body-sm",
|
|
463
|
+
shade: "lighter",
|
|
464
|
+
tag: "p",
|
|
465
|
+
class: "sv-subscription-cancellation-modal__explanation"
|
|
466
|
+
}, {
|
|
467
|
+
default: withCtx(() => [
|
|
468
|
+
createTextVNode(toDisplayString(unref(explanation)), 1)
|
|
469
|
+
]),
|
|
470
|
+
_: 1
|
|
471
|
+
}),
|
|
472
|
+
__props.subscription ? (openBlock(), createBlock(unref(_sfc_main$6), {
|
|
473
|
+
key: 0,
|
|
474
|
+
"no-spacing": "",
|
|
475
|
+
class: "sv-subscription-cancellation-modal__subscription"
|
|
476
|
+
}, {
|
|
477
|
+
default: withCtx(() => [
|
|
478
|
+
createVNode(_sfc_main$9, {
|
|
479
|
+
subscription: __props.subscription,
|
|
480
|
+
avatar: __props.avatar,
|
|
481
|
+
"enabled-pricing-ids": enabledPricingIds.value
|
|
482
|
+
}, null, 8, ["subscription", "avatar", "enabled-pricing-ids"]),
|
|
483
|
+
unref(renewsOn) || unref(paymentMethod) ? (openBlock(), createElementBlock("div", _hoisted_2, [
|
|
484
|
+
unref(renewsOn) ? (openBlock(), createElementBlock("div", _hoisted_3, [
|
|
485
|
+
createVNode(unref(_sfc_main$7), {
|
|
486
|
+
tag: "span",
|
|
487
|
+
variant: "body-xs",
|
|
488
|
+
shade: "light",
|
|
489
|
+
weight: "semibold"
|
|
490
|
+
}, {
|
|
491
|
+
default: withCtx(() => [
|
|
492
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
493
|
+
defaultMessage: "Renews",
|
|
494
|
+
description: "Label before the date the subscription renews, shown in the cancel subscription modal",
|
|
495
|
+
id: "subscription_cancellation_modal.renews_label"
|
|
496
|
+
})), 1)
|
|
497
|
+
]),
|
|
498
|
+
_: 1
|
|
499
|
+
}),
|
|
500
|
+
createVNode(unref(_sfc_main$7), {
|
|
501
|
+
tag: "span",
|
|
502
|
+
variant: "body-xs",
|
|
503
|
+
shade: "light"
|
|
504
|
+
}, {
|
|
505
|
+
default: withCtx(() => [
|
|
506
|
+
createTextVNode(toDisplayString(unref(renewsOn)), 1)
|
|
507
|
+
]),
|
|
508
|
+
_: 1
|
|
509
|
+
})
|
|
510
|
+
])) : createCommentVNode("", true),
|
|
511
|
+
unref(paymentMethod) ? (openBlock(), createBlock(unref(_sfc_main$a), {
|
|
512
|
+
key: 1,
|
|
513
|
+
variant: "condensed",
|
|
514
|
+
class: "sv-subscription-cancellation-modal__payment-method",
|
|
515
|
+
"payment-method": unref(paymentMethod)
|
|
516
|
+
}, null, 8, ["payment-method"])) : createCommentVNode("", true)
|
|
517
|
+
])) : createCommentVNode("", true)
|
|
518
|
+
]),
|
|
519
|
+
_: 1
|
|
520
|
+
})) : createCommentVNode("", true),
|
|
521
|
+
hasFailed.value ? (openBlock(), createBlock(unref(_sfc_main$b), {
|
|
522
|
+
key: 1,
|
|
523
|
+
class: "sv-subscription-cancellation-modal__error sv-error",
|
|
524
|
+
title: unref(errorMessage)
|
|
525
|
+
}, null, 8, ["title"])) : createCommentVNode("", true)
|
|
526
|
+
])
|
|
527
|
+
]),
|
|
528
|
+
_: 1
|
|
529
|
+
}, 8, ["show-modal", "title", "confirm-button-text", "cancel-button-text", "is-loading", "no-click-away", "no-backdrop-close"]);
|
|
530
|
+
};
|
|
531
|
+
}
|
|
532
|
+
});
|
|
227
533
|
const _hoisted_1 = { class: "sv-subscription-details__header flex flex-col gap-2 md:flex-row md:items-center" };
|
|
228
534
|
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
229
535
|
__name: "SubscriptionDetails",
|
|
@@ -234,23 +540,52 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
234
540
|
paymentMethods: { type: Array },
|
|
235
541
|
walletBalances: { default: () => [], type: Array },
|
|
236
542
|
hasWalletBalancesError: { type: Boolean },
|
|
543
|
+
avatar: { type: String },
|
|
237
544
|
isLoading: { type: Boolean },
|
|
238
545
|
error: { type: null }
|
|
239
546
|
},
|
|
240
|
-
emits: ["top-up-charged", "payment-method-stored"],
|
|
241
|
-
setup(__props) {
|
|
547
|
+
emits: ["top-up-charged", "auto-top-up-saved", "auto-top-up-cancelled", "payment-method-stored", "subscription-changed"],
|
|
548
|
+
setup(__props, { emit: __emit }) {
|
|
242
549
|
const props = __props;
|
|
550
|
+
const emit = __emit;
|
|
243
551
|
const { $t } = useIntl();
|
|
244
552
|
const {
|
|
245
553
|
isCancellable,
|
|
246
554
|
isRenewable,
|
|
555
|
+
pendingVariant,
|
|
247
556
|
cancel: handleCancel,
|
|
248
557
|
renew: handleRenew,
|
|
558
|
+
dismiss: handleDismissCancellation,
|
|
249
559
|
manage: handleUpgrade
|
|
250
560
|
} = useSubscriptionActions({ subscription: toRef(props, "subscription") });
|
|
561
|
+
const confirmedVariant = ref();
|
|
562
|
+
watch(pendingVariant, (variant) => {
|
|
563
|
+
if (variant) confirmedVariant.value = void 0;
|
|
564
|
+
});
|
|
565
|
+
const handleCancellationConfirmed = () => {
|
|
566
|
+
confirmedVariant.value = pendingVariant.value;
|
|
567
|
+
emit("subscription-changed");
|
|
568
|
+
};
|
|
569
|
+
const cancellationSuccessMessage = computed(() => {
|
|
570
|
+
if (!confirmedVariant.value) return void 0;
|
|
571
|
+
return confirmedVariant.value === "RENEW" ? $t({
|
|
572
|
+
defaultMessage: "Your subscription has been renewed.",
|
|
573
|
+
id: "subscription_details.renew_success",
|
|
574
|
+
description: "Confirmation shown after a cancellation has been undone"
|
|
575
|
+
}) : $t({
|
|
576
|
+
defaultMessage: "Your subscription has been cancelled. You keep access until the end of the billing period.",
|
|
577
|
+
id: "subscription_details.cancel_success",
|
|
578
|
+
description: "Confirmation shown after a subscription has been cancelled"
|
|
579
|
+
});
|
|
580
|
+
});
|
|
251
581
|
const currentScheduleInfo = computed(() => getMostRecentScheduleInfo(props.subscription));
|
|
252
|
-
const
|
|
253
|
-
|
|
582
|
+
const subscriptionPaymentMethod = computed(
|
|
583
|
+
() => (props.paymentMethods ?? []).find(({ id }) => {
|
|
584
|
+
var _a;
|
|
585
|
+
return id === ((_a = props.subscription) == null ? void 0 : _a.payment_method_id);
|
|
586
|
+
})
|
|
587
|
+
);
|
|
588
|
+
const topUpSubscriptions = computed(() => props.subscription ? [props.subscription] : []);
|
|
254
589
|
const title = computed(
|
|
255
590
|
() => getSubscriptionName({
|
|
256
591
|
subscription: props.subscription,
|
|
@@ -265,7 +600,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
265
600
|
return openBlock(), createBlock(unref(ContentWithAsideLayout), { class: "sv-subscription-details sv-root sv-screen" }, {
|
|
266
601
|
header: withCtx(() => [
|
|
267
602
|
createElementVNode("div", _hoisted_1, [
|
|
268
|
-
createVNode(unref(_sfc_main$
|
|
603
|
+
createVNode(unref(_sfc_main$7), {
|
|
269
604
|
variant: "heading-2",
|
|
270
605
|
tag: "h1",
|
|
271
606
|
class: "sv-subscription-details__title grow"
|
|
@@ -275,7 +610,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
275
610
|
]),
|
|
276
611
|
_: 1
|
|
277
612
|
}),
|
|
278
|
-
unref(isRenewable) ? (openBlock(), createBlock(unref(_sfc_main$
|
|
613
|
+
unref(isRenewable) ? (openBlock(), createBlock(unref(_sfc_main$8), {
|
|
279
614
|
key: 0,
|
|
280
615
|
variant: "outline",
|
|
281
616
|
color: "gray",
|
|
@@ -292,7 +627,7 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
292
627
|
]),
|
|
293
628
|
_: 1
|
|
294
629
|
}, 8, ["onClick"])) : createCommentVNode("", true),
|
|
295
|
-
unref(isCancellable) ? (openBlock(), createBlock(unref(_sfc_main$
|
|
630
|
+
unref(isCancellable) ? (openBlock(), createBlock(unref(_sfc_main$8), {
|
|
296
631
|
key: 1,
|
|
297
632
|
variant: "outline",
|
|
298
633
|
color: "gray",
|
|
@@ -312,36 +647,32 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
312
647
|
])
|
|
313
648
|
]),
|
|
314
649
|
content: withCtx(() => [
|
|
315
|
-
|
|
650
|
+
cancellationSuccessMessage.value ? (openBlock(), createBlock(unref(_sfc_main$e), {
|
|
316
651
|
key: 0,
|
|
652
|
+
class: "sv-subscription-details__cancellation-success",
|
|
653
|
+
type: "success",
|
|
654
|
+
title: cancellationSuccessMessage.value
|
|
655
|
+
}, null, 8, ["title"])) : createCommentVNode("", true),
|
|
656
|
+
__props.error ? (openBlock(), createBlock(unref(_sfc_main$b), {
|
|
657
|
+
key: 1,
|
|
317
658
|
class: "sv-subscription-details__error sv-error",
|
|
318
659
|
title: unref($t)({
|
|
319
660
|
defaultMessage: "Unable to load this subscription. Please try again later.",
|
|
320
661
|
id: "subscription_details.load_error",
|
|
321
662
|
description: "Error message shown when the subscription cannot be loaded on the subscription details page"
|
|
322
663
|
})
|
|
323
|
-
}, null, 8, ["title"])) : __props.isLoading ? (openBlock(), createBlock(_sfc_main$
|
|
324
|
-
key:
|
|
664
|
+
}, null, 8, ["title"])) : __props.isLoading ? (openBlock(), createBlock(_sfc_main$f, {
|
|
665
|
+
key: 2,
|
|
325
666
|
variant: "section",
|
|
326
667
|
class: "min-h-[220px]"
|
|
327
|
-
})) : __props.subscription ? (openBlock(),
|
|
328
|
-
createVNode(unref(_sfc_main$5), {
|
|
329
|
-
"no-spacing": "",
|
|
330
|
-
class: "sv-subscription-details__summary"
|
|
331
|
-
}, {
|
|
332
|
-
default: withCtx(() => [
|
|
333
|
-
createVNode(_sfc_main$c, { subscription: __props.subscription }, null, 8, ["subscription"])
|
|
334
|
-
]),
|
|
335
|
-
_: 1
|
|
336
|
-
}),
|
|
337
|
-
createVNode(_sfc_main$d, {
|
|
338
|
-
class: "sv-subscription-details__schedules",
|
|
339
|
-
"schedules-data": __props.schedulesData ?? [],
|
|
340
|
-
configuration: { subscriptionId: __props.subscription.id },
|
|
341
|
-
"is-loading": __props.isLoading
|
|
342
|
-
}, null, 8, ["schedules-data", "configuration", "is-loading"])
|
|
343
|
-
], 64)) : (openBlock(), createBlock(_sfc_main$e, {
|
|
668
|
+
})) : __props.subscription ? (openBlock(), createBlock(_sfc_main$g, {
|
|
344
669
|
key: 3,
|
|
670
|
+
class: "sv-subscription-details__schedules",
|
|
671
|
+
"schedules-data": __props.schedulesData ?? [],
|
|
672
|
+
configuration: { subscriptionId: __props.subscription.id },
|
|
673
|
+
"is-loading": __props.isLoading
|
|
674
|
+
}, null, 8, ["schedules-data", "configuration", "is-loading"])) : (openBlock(), createBlock(_sfc_main$h, {
|
|
675
|
+
key: 4,
|
|
345
676
|
class: "sv-subscription-details__empty-state",
|
|
346
677
|
icon: "receipt_long"
|
|
347
678
|
}, {
|
|
@@ -363,29 +694,41 @@ const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
|
363
694
|
}))
|
|
364
695
|
]),
|
|
365
696
|
aside: withCtx(() => [
|
|
366
|
-
createVNode(_sfc_main$
|
|
697
|
+
createVNode(_sfc_main$c, {
|
|
367
698
|
class: "sv-subscription-details__wallet-balances",
|
|
368
699
|
"has-error": Boolean(__props.hasWalletBalancesError),
|
|
369
700
|
"is-loading": __props.isLoading,
|
|
370
701
|
"wallet-balances": __props.walletBalances,
|
|
371
702
|
"show-top-up-button": "",
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
703
|
+
customer: __props.customer,
|
|
704
|
+
"payment-methods": __props.paymentMethods,
|
|
705
|
+
subscriptions: topUpSubscriptions.value,
|
|
706
|
+
onTopUpCharged: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("top-up-charged")),
|
|
707
|
+
onAutoTopUpSaved: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("auto-top-up-saved")),
|
|
708
|
+
onAutoTopUpCancelled: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("auto-top-up-cancelled")),
|
|
709
|
+
onPaymentMethodStored: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("payment-method-stored"))
|
|
710
|
+
}, null, 8, ["has-error", "is-loading", "wallet-balances", "customer", "payment-methods", "subscriptions"]),
|
|
711
|
+
currentScheduleInfo.value ? (openBlock(), createBlock(_sfc_main$4, {
|
|
375
712
|
key: 0,
|
|
376
713
|
class: "sv-subscription-details__upgrades",
|
|
377
714
|
"pricing-plan-schedule": currentScheduleInfo.value,
|
|
378
715
|
onUpgrade: unref(handleUpgrade)
|
|
379
716
|
}, null, 8, ["pricing-plan-schedule", "onUpgrade"])) : createCommentVNode("", true),
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
"
|
|
383
|
-
|
|
384
|
-
"
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
717
|
+
subscriptionPaymentMethod.value ? (openBlock(), createBlock(_sfc_main$d, {
|
|
718
|
+
key: 1,
|
|
719
|
+
class: "sv-subscription-details__payment-method",
|
|
720
|
+
"is-loading": __props.isLoading,
|
|
721
|
+
"payment-methods": [subscriptionPaymentMethod.value],
|
|
722
|
+
configuration: { showViewAllButton: false, showAddButton: false }
|
|
723
|
+
}, null, 8, ["is-loading", "payment-methods"])) : createCommentVNode("", true),
|
|
724
|
+
createVNode(_sfc_main$3, {
|
|
725
|
+
"show-modal": Boolean(unref(pendingVariant)),
|
|
726
|
+
variant: unref(pendingVariant),
|
|
727
|
+
subscription: __props.subscription,
|
|
728
|
+
avatar: __props.avatar,
|
|
729
|
+
onConfirmed: handleCancellationConfirmed,
|
|
730
|
+
onClose: unref(handleDismissCancellation)
|
|
731
|
+
}, null, 8, ["show-modal", "variant", "subscription", "avatar", "onClose"])
|
|
389
732
|
]),
|
|
390
733
|
_: 1
|
|
391
734
|
});
|
|
@@ -433,9 +776,7 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
433
776
|
fetchPaymentMethods(),
|
|
434
777
|
fetchWalletBalances()
|
|
435
778
|
);
|
|
436
|
-
const schedulesData = computed(
|
|
437
|
-
() => subscription.value ? withPlanData(subscription.value) : []
|
|
438
|
-
);
|
|
779
|
+
const schedulesData = computed(() => subscription.value ? withPlanData(subscription.value) : []);
|
|
439
780
|
const walletBalanceItems = computed(() => {
|
|
440
781
|
var _a;
|
|
441
782
|
return ((_a = walletBalances.value) == null ? void 0 : _a.wallet_balances) ?? [];
|
|
@@ -452,7 +793,8 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
452
793
|
isLoading: unref(isLoading),
|
|
453
794
|
error: unref(error),
|
|
454
795
|
refreshWalletBalances: unref(fetchWalletBalances),
|
|
455
|
-
refreshPaymentMethods: unref(fetchPaymentMethods)
|
|
796
|
+
refreshPaymentMethods: unref(fetchPaymentMethods),
|
|
797
|
+
refreshSubscription: unref(fetchSubscription)
|
|
456
798
|
});
|
|
457
799
|
};
|
|
458
800
|
}
|
|
@@ -479,7 +821,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
479
821
|
setup(__props) {
|
|
480
822
|
return (_ctx, _cache) => {
|
|
481
823
|
var _a, _b, _c, _d;
|
|
482
|
-
return openBlock(), createBlock(unref(_sfc_main$
|
|
824
|
+
return openBlock(), createBlock(unref(_sfc_main$i), {
|
|
483
825
|
"custom-element-name": unref(COMPONENT_NAME),
|
|
484
826
|
environment: __props.environment,
|
|
485
827
|
locale: __props.locale,
|
|
@@ -505,20 +847,25 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
505
847
|
isLoading,
|
|
506
848
|
error,
|
|
507
849
|
refreshWalletBalances,
|
|
508
|
-
refreshPaymentMethods
|
|
850
|
+
refreshPaymentMethods,
|
|
851
|
+
refreshSubscription
|
|
509
852
|
}) => [
|
|
510
853
|
createVNode(_sfc_main$2, {
|
|
511
854
|
subscription,
|
|
512
855
|
"schedules-data": schedulesData,
|
|
513
856
|
customer,
|
|
857
|
+
avatar: __props.configuration.avatar,
|
|
514
858
|
"payment-methods": paymentMethods,
|
|
515
859
|
"wallet-balances": walletBalances,
|
|
516
860
|
"has-wallet-balances-error": hasWalletBalancesError,
|
|
517
861
|
"is-loading": isLoading,
|
|
518
862
|
error,
|
|
519
863
|
onTopUpCharged: refreshWalletBalances,
|
|
520
|
-
|
|
521
|
-
|
|
864
|
+
onAutoTopUpSaved: refreshWalletBalances,
|
|
865
|
+
onAutoTopUpCancelled: refreshWalletBalances,
|
|
866
|
+
onPaymentMethodStored: refreshPaymentMethods,
|
|
867
|
+
onSubscriptionChanged: refreshSubscription
|
|
868
|
+
}, null, 8, ["subscription", "schedules-data", "customer", "avatar", "payment-methods", "wallet-balances", "has-wallet-balances-error", "is-loading", "error", "onTopUpCharged", "onAutoTopUpSaved", "onAutoTopUpCancelled", "onPaymentMethodStored", "onSubscriptionChanged"])
|
|
522
869
|
]),
|
|
523
870
|
_: 1
|
|
524
871
|
}, 16)
|