@solvimon/solvimon-web 0.1.0-alpha.14 → 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-D8ZeVBWO.mjs → BillingInformation.vue_vue_type_script_setup_true_lang-ugPPvTKf.mjs} +2 -2
- package/dist/{BillingInformation.vue_vue_type_script_setup_true_lang-0_VYW5Wu.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-DEqfojR8.mjs → CustomerPaymentMethods.vue_vue_type_script_setup_true_lang-D_PE2UbX.mjs} +8 -23
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-CFLR4ptB.js → InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-DU6X3zxr.js} +1 -1
- package/dist/{InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-COnrD4ew.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-DUeSRR3k.js → PaymentHistoryBlock-BGbTy4Se.js} +1 -1
- package/dist/{PaymentHistoryBlock-BTRFc4ki.mjs → PaymentHistoryBlock-BKMttUyk.mjs} +1 -1
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-TgZYSSQe.js → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CixdxEGm.js} +1 -1
- package/dist/{PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-GeyErAW6.mjs → PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-tM7f_fQS.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-DX6kv0_v.mjs → PaymentIntegrationForm-BGxjGJGz.mjs} +1 -1
- package/dist/{PaymentIntegrationForm-CQntx0TH.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-Dkd-Cp8c.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-D-BFQZiM.mjs → SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-Cqk-vonA.mjs} +24 -23
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-B7IOIy-v.mjs → SubscriptionsList.vue_vue_type_script_setup_true_lang-Cv6lz35J.mjs} +4 -4
- package/dist/{SubscriptionsList.vue_vue_type_script_setup_true_lang-D-hpJL8I.js → SubscriptionsList.vue_vue_type_script_setup_true_lang-D6hHXndB.js} +1 -1
- 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/index.cjs.js +1 -1
- package/dist/core/index.es.js +1 -1
- package/dist/core/types.d.ts +4 -0
- package/dist/{customer-CGyZojAB.js → customer-B5b2tLhw.js} +1 -1
- package/dist/{customer-Bn6GdxP8.mjs → customer-CANPEYH9.mjs} +1 -1
- package/dist/{en-US-G2HBHqjq.js → en-US-C0gIE4Q1.js} +1 -1
- package/dist/{en-US-BKhsdJQ2.mjs → en-US-DAgOSlgv.mjs} +19 -12
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +1 -1
- package/dist/{invoices-DDeL8tvI.js → invoices-BCmE_nnb.js} +1 -1
- package/dist/{invoices-Rs-QBUGS.mjs → invoices-DBv0qkgm.mjs} +2 -2
- package/dist/{nl-NL-DvVsMfhA.js → nl-NL-Br7muSHK.js} +1 -1
- package/dist/{nl-NL-BdeAy1tY.mjs → nl-NL-DCsmrA8A.mjs} +9 -2
- package/dist/{paymentMethods-DOH9-6M1.mjs → paymentMethods-D-5FNN8W.mjs} +11 -3
- package/dist/paymentMethods-u5y9B5ng.js +1 -0
- package/dist/{payments-DGPENXiS.mjs → payments-BK8yzqJ5.mjs} +1 -1
- package/dist/{payments-C0vYbn5Q.js → payments-BTTtcfyI.js} +1 -1
- package/dist/{registry-7UKVW93Q.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 +103 -70
- 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 +29 -34
- package/dist/solvimon-web.css +1 -1
- package/dist/{subscriptions-CcpEwubd.js → subscriptions-AMC4DirD.js} +1 -1
- package/dist/{subscriptions-BIGqt2N0.mjs → subscriptions-DHjXDyH1.mjs} +2 -2
- package/dist/{adyen-D0yvZvq5.mjs → url-1Lbg5Yni.mjs} +35 -35
- package/dist/url-B6-3PkW2.js +1 -0
- package/dist/{useActionDispatchProvider-aqYyqIdb.js → useActionDispatchProvider-CizNgRwv.js} +1 -1
- package/dist/{useActionDispatchProvider-Ca1YbU61.mjs → useActionDispatchProvider-DmhD9mYX.mjs} +1 -1
- package/dist/{useCustomer-DUA8Y-2I.mjs → useCustomer-DCPq7eHM.mjs} +2 -2
- package/dist/{useCustomer-D9ZrqMFY.js → useCustomer-DYc54GVD.js} +1 -1
- package/dist/useIncrementalLoading-CuSndpP2.js +1 -0
- package/dist/{useIncrementalLoading-C1LKdVP8.mjs → useIncrementalLoading-DmOT2MXH.mjs} +4 -4
- package/dist/{useInvoiceData-HNnt3703.js → useInvoiceData-BajCyf-x.js} +1 -1
- package/dist/{useInvoiceData-Bz4a2Mfa.mjs → useInvoiceData-BgtUKbHY.mjs} +2 -2
- package/dist/{useInvoicesList-b2_fiHsc.mjs → useInvoicesList-DRD5yix0.mjs} +4 -4
- package/dist/{useInvoicesList-DXBTGdcI.js → useInvoicesList-wnvjyB_H.js} +1 -1
- package/dist/{useLoadInitialData-D0t-Lk3k.js → useLoadInitialData-BObRB7Vo.js} +1 -1
- package/dist/{useLoadInitialData-Cyp1xpuv.mjs → useLoadInitialData-IlbmC6p0.mjs} +1 -1
- package/dist/{usePaymentMethodOptions-DgGDcVeE.js → usePaymentMethodOptions-CzqsebhN.js} +1 -1
- package/dist/{usePaymentMethodOptions-r0Opz7BC.mjs → usePaymentMethodOptions-DRkWBjv6.mjs} +2 -2
- package/dist/{usePaymentMethods-C-NCtOom.mjs → usePaymentMethods-DFkRNreh.mjs} +2 -2
- package/dist/{usePaymentMethods-BHLXXaCa.js → usePaymentMethods-ZPxKg5Y3.js} +1 -1
- package/dist/{usePayments-DADpdoI7.js → usePayments-DwiGafZj.js} +1 -1
- package/dist/{usePayments-BtByiIMy.mjs → usePayments-E_Jsqo98.mjs} +3 -3
- package/dist/{usePortal-DhaZBAGi.js → usePortal-CxTS2TQh.js} +1 -1
- package/dist/{usePortal-CpW3EDD-.mjs → usePortal-DcOz9FEL.mjs} +1 -1
- package/dist/{useService-C0h9UlQW.js → useService-CHrkefKd.js} +1 -1
- package/dist/{useService-BcYQRxPS.mjs → useService-DF57xuDd.mjs} +1 -1
- package/dist/{useWalletBalanceItems-COzKSpmt.js → useWalletBalanceItems-BQEXDCBg.js} +1 -1
- package/dist/{useWalletBalanceItems-DKz-2vUy.mjs → useWalletBalanceItems-MlHgedWR.mjs} +3 -3
- package/dist/{vendor-ui-CdOX_IS-.mjs → vendor-ui-B8IlviSs.mjs} +6483 -5867
- 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-zdBaVj-K.js +0 -1
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BhGQB-c9.js +0 -1
- package/dist/SecurePaymentsKPI.vue_vue_type_script_setup_true_lang-BuJGxitV.js +0 -1
- package/dist/adyen-BvNyYAg-.js +0 -1
- package/dist/component-By_A1VHh.js +0 -1
- package/dist/component-CGfjV_7z.mjs +0 -889
- package/dist/paymentMethods-BR9w3qy8.js +0 -1
- package/dist/registry-DrV0jFnM.js +0 -1
- package/dist/useIncrementalLoading-FNH4k4a3.js +0 -1
- package/dist/vendor-ui-1SHma7t1.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("vue"),t=require("./vendor-ui-C3Tq-qY_.js"),n=require("./Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),o=require("./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BxdcIX-Z.js"),a=e.defineComponent({__name:"PaymentMethodForm",props:{customer:{type:Object},paymentMethodOptions:{type:Array},configuration:{type:Object},isLoading:{type:Boolean,default:!1},countryCode:{type:String}},emits:["payment-success","payment-failed"],setup(a,{emit:r}){const i={currency:"EUR",quantity:"0"},u=a,s=r,{$t:m}=t.useIntl(),c=e.ref(),l=e.ref(),d=e.ref(!1);function p(){var e;d.value=!0,null==(e=c.value)||e.submit()}function v(){d.value=!1,s("payment-success")}function y(e){d.value=!1,s("payment-failed",e)}const f=e.computed(()=>{return"AUTHORIZE"===(null==(e=u.configuration)?void 0:e.variant)?e:{...e,variant:"TOKENIZE"};var e}),_=e.computed(()=>{let e="NL";if(u.countryCode)return e=u.countryCode,e;if(u.customer){const n=t.getCustomerCountry(u.customer);if(n)return e=n,e}return"NL"}),g=e.computed(()=>{const e=f.value.variant,n=t.getCustomerName(u.customer),o={amount:f.value.amount??i,paymentMethodOptions:u.paymentMethodOptions,countryCode:_.value,...u.customer.email?{email:u.customer.email}:{},...n?{name:n}:{},validateOnSubmit:f.value.validateOnSubmit,forceStorePaymentMethod:f.value.forceStorePaymentMethod,selectedOption:f.value.selectedOption,invoiceId:f.value.invoiceId};return"AUTHORIZE"===e?{...o,variant:e,context:f.value.context}:{...o,variant:"TOKENIZE",customerId:u.customer.id}});return(r,i)=>a.isLoading?(e.openBlock(),e.createBlock(n._sfc_main,{key:0,variant:"section",class:"sv-payment-method-form sv-root sv-component sv-loading min-h-[180px]","data-testid":"payment-method-form-skeleton"})):(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:1,class:"sv-payment-method-form sv-root sv-component","no-border":"","no-spacing":"","content-background":"none",title:e.unref(m)({defaultMessage:"Available payment methods",description:"Title of the available payment methods form",id:"components.payment_method_form.section_title"})},{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass({"pointer-events-none opacity-60":d.value})},[e.createVNode(o._sfc_main,e.mergeProps({ref_key:"paymentIntegrationFormRef",ref:c,class:"sv-payment-method-form__integration"},g.value,{onSelect:i[0]||(i[0]=e=>l.value=e),onPaymentSuccess:v,onPaymentFailed:y}),null,16)],2),e.createVNode(e.unref(t._sfc_main$1),{color:"primary",class:"mt-4 w-full",loading:d.value,onClick:p},{default:e.withCtx(()=>[...i[1]||(i[1]=[e.createTextVNode("Save payment method",-1)])]),_:1},8,["loading"])]),_:1},8,["title"]))}});exports._sfc_main=a;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { defineComponent, ref, computed, openBlock, createBlock, unref, withCtx, createElementVNode, normalizeClass, createVNode, mergeProps, createTextVNode } from "vue";
|
|
2
|
+
import { u as useIntl, g as getCustomerCountry, b as getCustomerName, _ as _sfc_main$2, c as _sfc_main$4 } from "./vendor-ui-B8IlviSs.mjs";
|
|
3
|
+
import { _ as _sfc_main$1 } from "./Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
|
|
4
|
+
import { _ as _sfc_main$3 } from "./PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-aP-gCq7V.mjs";
|
|
5
|
+
const FALLBACK_COUNTRY_CODE = "NL";
|
|
6
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
7
|
+
__name: "PaymentMethodForm",
|
|
8
|
+
props: {
|
|
9
|
+
customer: { type: Object },
|
|
10
|
+
paymentMethodOptions: { type: Array },
|
|
11
|
+
configuration: { type: Object },
|
|
12
|
+
isLoading: { type: Boolean, default: false },
|
|
13
|
+
countryCode: { type: String }
|
|
14
|
+
},
|
|
15
|
+
emits: ["payment-success", "payment-failed"],
|
|
16
|
+
setup(__props, { emit: __emit }) {
|
|
17
|
+
const DEFAULT_AMOUNT = {
|
|
18
|
+
currency: "EUR",
|
|
19
|
+
quantity: "0"
|
|
20
|
+
};
|
|
21
|
+
const props = __props;
|
|
22
|
+
const emit = __emit;
|
|
23
|
+
const { $t } = useIntl();
|
|
24
|
+
const paymentIntegrationFormRef = ref();
|
|
25
|
+
const selectedPaymentMethod = ref();
|
|
26
|
+
const isPaymentPending = ref(false);
|
|
27
|
+
function handleSubmit() {
|
|
28
|
+
var _a;
|
|
29
|
+
isPaymentPending.value = true;
|
|
30
|
+
(_a = paymentIntegrationFormRef.value) == null ? void 0 : _a.submit();
|
|
31
|
+
}
|
|
32
|
+
function handlePaymentSuccess() {
|
|
33
|
+
isPaymentPending.value = false;
|
|
34
|
+
emit("payment-success");
|
|
35
|
+
}
|
|
36
|
+
function handlePaymentFailed(error) {
|
|
37
|
+
isPaymentPending.value = false;
|
|
38
|
+
emit("payment-failed", error);
|
|
39
|
+
}
|
|
40
|
+
const resolveConfiguration = (configuration2) => {
|
|
41
|
+
if ((configuration2 == null ? void 0 : configuration2.variant) === "AUTHORIZE") {
|
|
42
|
+
return configuration2;
|
|
43
|
+
}
|
|
44
|
+
return {
|
|
45
|
+
...configuration2,
|
|
46
|
+
variant: "TOKENIZE"
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
const configuration = computed(
|
|
50
|
+
() => resolveConfiguration(props.configuration)
|
|
51
|
+
);
|
|
52
|
+
const countryCode = computed(() => {
|
|
53
|
+
let result = FALLBACK_COUNTRY_CODE;
|
|
54
|
+
if (props.countryCode) {
|
|
55
|
+
result = props.countryCode;
|
|
56
|
+
return result;
|
|
57
|
+
}
|
|
58
|
+
if (props.customer) {
|
|
59
|
+
const country = getCustomerCountry(props.customer);
|
|
60
|
+
if (country) {
|
|
61
|
+
result = country;
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return FALLBACK_COUNTRY_CODE;
|
|
66
|
+
});
|
|
67
|
+
const paymentIntegrationProps = computed(() => {
|
|
68
|
+
const variant = configuration.value.variant;
|
|
69
|
+
const customerName = getCustomerName(props.customer);
|
|
70
|
+
const commonProps = {
|
|
71
|
+
amount: configuration.value.amount ?? DEFAULT_AMOUNT,
|
|
72
|
+
paymentMethodOptions: props.paymentMethodOptions,
|
|
73
|
+
countryCode: countryCode.value,
|
|
74
|
+
...props.customer.email ? { email: props.customer.email } : {},
|
|
75
|
+
...customerName ? { name: customerName } : {},
|
|
76
|
+
validateOnSubmit: configuration.value.validateOnSubmit,
|
|
77
|
+
forceStorePaymentMethod: configuration.value.forceStorePaymentMethod,
|
|
78
|
+
selectedOption: configuration.value.selectedOption,
|
|
79
|
+
invoiceId: configuration.value.invoiceId
|
|
80
|
+
};
|
|
81
|
+
if (variant === "AUTHORIZE") {
|
|
82
|
+
return {
|
|
83
|
+
...commonProps,
|
|
84
|
+
variant,
|
|
85
|
+
context: configuration.value.context
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
...commonProps,
|
|
90
|
+
variant: "TOKENIZE",
|
|
91
|
+
customerId: props.customer.id
|
|
92
|
+
};
|
|
93
|
+
});
|
|
94
|
+
return (_ctx, _cache) => {
|
|
95
|
+
return __props.isLoading ? (openBlock(), createBlock(_sfc_main$1, {
|
|
96
|
+
key: 0,
|
|
97
|
+
variant: "section",
|
|
98
|
+
class: "sv-payment-method-form sv-root sv-component sv-loading min-h-[180px]",
|
|
99
|
+
"data-testid": "payment-method-form-skeleton"
|
|
100
|
+
})) : (openBlock(), createBlock(unref(_sfc_main$2), {
|
|
101
|
+
key: 1,
|
|
102
|
+
class: "sv-payment-method-form sv-root sv-component",
|
|
103
|
+
"no-border": "",
|
|
104
|
+
"no-spacing": "",
|
|
105
|
+
"content-background": "none",
|
|
106
|
+
title: unref($t)({
|
|
107
|
+
defaultMessage: "Available payment methods",
|
|
108
|
+
description: "Title of the available payment methods form",
|
|
109
|
+
id: "components.payment_method_form.section_title"
|
|
110
|
+
})
|
|
111
|
+
}, {
|
|
112
|
+
default: withCtx(() => [
|
|
113
|
+
createElementVNode("div", {
|
|
114
|
+
class: normalizeClass({ "pointer-events-none opacity-60": isPaymentPending.value })
|
|
115
|
+
}, [
|
|
116
|
+
createVNode(_sfc_main$3, mergeProps({
|
|
117
|
+
ref_key: "paymentIntegrationFormRef",
|
|
118
|
+
ref: paymentIntegrationFormRef,
|
|
119
|
+
class: "sv-payment-method-form__integration"
|
|
120
|
+
}, paymentIntegrationProps.value, {
|
|
121
|
+
onSelect: _cache[0] || (_cache[0] = (payload) => selectedPaymentMethod.value = payload),
|
|
122
|
+
onPaymentSuccess: handlePaymentSuccess,
|
|
123
|
+
onPaymentFailed: handlePaymentFailed
|
|
124
|
+
}), null, 16)
|
|
125
|
+
], 2),
|
|
126
|
+
createVNode(unref(_sfc_main$4), {
|
|
127
|
+
color: "primary",
|
|
128
|
+
class: "mt-4 w-full",
|
|
129
|
+
loading: isPaymentPending.value,
|
|
130
|
+
onClick: handleSubmit
|
|
131
|
+
}, {
|
|
132
|
+
default: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
133
|
+
createTextVNode("Save payment method", -1)
|
|
134
|
+
])]),
|
|
135
|
+
_: 1
|
|
136
|
+
}, 8, ["loading"])
|
|
137
|
+
]),
|
|
138
|
+
_: 1
|
|
139
|
+
}, 8, ["title"]));
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
});
|
|
143
|
+
export {
|
|
144
|
+
_sfc_main as _
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("vue"),t=require("./vendor-ui-C3Tq-qY_.js"),n=require("./useService-CHrkefKd.js"),o=require("./paymentMethods-u5y9B5ng.js");const a={key:0,class:"sv-payment-methods__list grid grid-cols-1 gap-4"},l=e.defineComponent({__name:"PaymentMethodsList",props:{paymentMethods:{type:Array}},emits:["delete","set-default"],setup(l,{emit:d}){const s=d,{$t:m}=t.useIntl(),i=e.ref(null),{execute:u}=function(){const{setDefaultPaymentMethod:e}=o.createPaymentMethodsService(),{data:t,execute:a,error:l,isPending:d}=n.useService({service:t=>e({paymentMethodId:t})});return{data:t,execute:a,error:l,isPending:d}}(),{getContextMenuItems:r}=function({onSetDefault:e,onDeleteRequest:n}){const{$t:o}=t.useIntl();return{getContextMenuItems:t=>{const a=[];return t.is_default||a.push({label:o({defaultMessage:"Set as default",id:"payment_method.context_menu.set_as_default.label",description:"Context menu option for setting the default payment method"}),onClick:()=>e(t)}),a.push({label:o({defaultMessage:"Delete",id:"payment_method.context_menu.delete.label",description:"Context menu option for deleting the payment method"}),onClick:()=>n(t)}),a}}}({onDeleteRequest:e=>{i.value=e},onSetDefault:async e=>{await u(e.id),s("set-default",e)}});function c(){i.value&&s("delete",i.value),i.value=null}return(n,o)=>(e.openBlock(),e.createElementBlock(e.Fragment,null,[l.paymentMethods.length>0?(e.openBlock(),e.createElementBlock("div",a,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.paymentMethods,n=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{key:n.id,class:"sv-payment-methods__item"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$6),{class:"sv-payment-methods__item-content","payment-method":n,options:e.unref(r)(n)},null,8,["payment-method","options"])]),_:2},1024))),128))])):e.createCommentVNode("",!0),e.createVNode(e.unref(t._sfc_main$12),{"show-modal":!!i.value,title:e.unref(m)({id:"payment_methods_list.delete_modal.title",defaultMessage:"Delete payment method",description:"Title of the delete payment method confirmation modal"}),"confirm-button-text":e.unref(m)({id:"payment_methods_list.delete_modal.confirm",defaultMessage:"Delete",description:"Confirm button in the delete payment method modal"}),"cancel-button-text":e.unref(m)({id:"payment_methods_list.delete_modal.cancel",defaultMessage:"Cancel",description:"Cancel button in the delete payment method modal"}),onConfirm:c,onClose:o[0]||(o[0]=e=>i.value=null)},e.createSlots({_:2},[i.value?{name:"body",fn:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$3),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(m)({id:"payment_methods_list.delete_modal.body",defaultMessage:"Are you sure you want to delete this payment method?",description:"Confirmation message in the delete payment method modal"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$6),{"payment-method":i.value},null,8,["payment-method"])]),_:1})]),key:"0"}:void 0]),1032,["show-modal","title","confirm-button-text","cancel-button-text"])],64))}});exports._sfc_main=l;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { defineComponent, ref, openBlock, createElementBlock, Fragment, renderList, createBlock, unref, withCtx, createVNode, createCommentVNode, createSlots, createTextVNode, toDisplayString } from "vue";
|
|
2
|
+
import { u as useIntl, _ as _sfc_main$1, m as _sfc_main$2, y as _sfc_main$3, e as _sfc_main$4 } from "./vendor-ui-B8IlviSs.mjs";
|
|
3
|
+
import { u as useService } from "./useService-DF57xuDd.mjs";
|
|
4
|
+
import { c as createPaymentMethodsService } from "./paymentMethods-D-5FNN8W.mjs";
|
|
5
|
+
function usePaymentMethodContextMenuOptions({
|
|
6
|
+
onSetDefault,
|
|
7
|
+
onDeleteRequest
|
|
8
|
+
}) {
|
|
9
|
+
const { $t } = useIntl();
|
|
10
|
+
const getContextMenuItems = (paymentMethod) => {
|
|
11
|
+
const items = [];
|
|
12
|
+
if (!paymentMethod.is_default) {
|
|
13
|
+
items.push({
|
|
14
|
+
label: $t({
|
|
15
|
+
defaultMessage: "Set as default",
|
|
16
|
+
id: "payment_method.context_menu.set_as_default.label",
|
|
17
|
+
description: "Context menu option for setting the default payment method"
|
|
18
|
+
}),
|
|
19
|
+
onClick: () => onSetDefault(paymentMethod)
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
items.push({
|
|
23
|
+
label: $t({
|
|
24
|
+
defaultMessage: "Delete",
|
|
25
|
+
id: "payment_method.context_menu.delete.label",
|
|
26
|
+
description: "Context menu option for deleting the payment method"
|
|
27
|
+
}),
|
|
28
|
+
onClick: () => onDeleteRequest(paymentMethod)
|
|
29
|
+
});
|
|
30
|
+
return items;
|
|
31
|
+
};
|
|
32
|
+
return { getContextMenuItems };
|
|
33
|
+
}
|
|
34
|
+
function useSetDefaultPaymentMethod() {
|
|
35
|
+
const { setDefaultPaymentMethod } = createPaymentMethodsService();
|
|
36
|
+
const { data, execute, error, isPending } = useService({
|
|
37
|
+
service: (paymentMethodId) => setDefaultPaymentMethod({ paymentMethodId })
|
|
38
|
+
});
|
|
39
|
+
return { data, execute, error, isPending };
|
|
40
|
+
}
|
|
41
|
+
const _hoisted_1 = {
|
|
42
|
+
key: 0,
|
|
43
|
+
class: "sv-payment-methods__list grid grid-cols-1 gap-4"
|
|
44
|
+
};
|
|
45
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
46
|
+
__name: "PaymentMethodsList",
|
|
47
|
+
props: {
|
|
48
|
+
paymentMethods: { type: Array }
|
|
49
|
+
},
|
|
50
|
+
emits: ["delete", "set-default"],
|
|
51
|
+
setup(__props, { emit: __emit }) {
|
|
52
|
+
const emit = __emit;
|
|
53
|
+
const { $t } = useIntl();
|
|
54
|
+
const pendingDeletePaymentMethod = ref(null);
|
|
55
|
+
const { execute: setDefault } = useSetDefaultPaymentMethod();
|
|
56
|
+
const { getContextMenuItems } = usePaymentMethodContextMenuOptions({
|
|
57
|
+
onDeleteRequest: (paymentMethod) => {
|
|
58
|
+
pendingDeletePaymentMethod.value = paymentMethod;
|
|
59
|
+
},
|
|
60
|
+
onSetDefault: async (paymentMethod) => {
|
|
61
|
+
await setDefault(paymentMethod.id);
|
|
62
|
+
emit("set-default", paymentMethod);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
function handleConfirmDelete() {
|
|
66
|
+
if (pendingDeletePaymentMethod.value) {
|
|
67
|
+
emit("delete", pendingDeletePaymentMethod.value);
|
|
68
|
+
}
|
|
69
|
+
pendingDeletePaymentMethod.value = null;
|
|
70
|
+
}
|
|
71
|
+
return (_ctx, _cache) => {
|
|
72
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
73
|
+
__props.paymentMethods.length > 0 ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
74
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.paymentMethods, (paymentMethod) => {
|
|
75
|
+
return openBlock(), createBlock(unref(_sfc_main$1), {
|
|
76
|
+
key: paymentMethod.id,
|
|
77
|
+
class: "sv-payment-methods__item"
|
|
78
|
+
}, {
|
|
79
|
+
default: withCtx(() => [
|
|
80
|
+
createVNode(unref(_sfc_main$2), {
|
|
81
|
+
class: "sv-payment-methods__item-content",
|
|
82
|
+
"payment-method": paymentMethod,
|
|
83
|
+
options: unref(getContextMenuItems)(paymentMethod)
|
|
84
|
+
}, null, 8, ["payment-method", "options"])
|
|
85
|
+
]),
|
|
86
|
+
_: 2
|
|
87
|
+
}, 1024);
|
|
88
|
+
}), 128))
|
|
89
|
+
])) : createCommentVNode("", true),
|
|
90
|
+
createVNode(unref(_sfc_main$3), {
|
|
91
|
+
"show-modal": !!pendingDeletePaymentMethod.value,
|
|
92
|
+
title: unref($t)({
|
|
93
|
+
id: "payment_methods_list.delete_modal.title",
|
|
94
|
+
defaultMessage: "Delete payment method",
|
|
95
|
+
description: "Title of the delete payment method confirmation modal"
|
|
96
|
+
}),
|
|
97
|
+
"confirm-button-text": unref($t)({
|
|
98
|
+
id: "payment_methods_list.delete_modal.confirm",
|
|
99
|
+
defaultMessage: "Delete",
|
|
100
|
+
description: "Confirm button in the delete payment method modal"
|
|
101
|
+
}),
|
|
102
|
+
"cancel-button-text": unref($t)({
|
|
103
|
+
id: "payment_methods_list.delete_modal.cancel",
|
|
104
|
+
defaultMessage: "Cancel",
|
|
105
|
+
description: "Cancel button in the delete payment method modal"
|
|
106
|
+
}),
|
|
107
|
+
onConfirm: handleConfirmDelete,
|
|
108
|
+
onClose: _cache[0] || (_cache[0] = ($event) => pendingDeletePaymentMethod.value = null)
|
|
109
|
+
}, createSlots({ _: 2 }, [
|
|
110
|
+
pendingDeletePaymentMethod.value ? {
|
|
111
|
+
name: "body",
|
|
112
|
+
fn: withCtx(() => [
|
|
113
|
+
createVNode(unref(_sfc_main$4), null, {
|
|
114
|
+
default: withCtx(() => [
|
|
115
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
116
|
+
id: "payment_methods_list.delete_modal.body",
|
|
117
|
+
defaultMessage: "Are you sure you want to delete this payment method?",
|
|
118
|
+
description: "Confirmation message in the delete payment method modal"
|
|
119
|
+
})), 1)
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}),
|
|
123
|
+
createVNode(unref(_sfc_main$1), null, {
|
|
124
|
+
default: withCtx(() => [
|
|
125
|
+
createVNode(unref(_sfc_main$2), { "payment-method": pendingDeletePaymentMethod.value }, null, 8, ["payment-method"])
|
|
126
|
+
]),
|
|
127
|
+
_: 1
|
|
128
|
+
})
|
|
129
|
+
]),
|
|
130
|
+
key: "0"
|
|
131
|
+
} : void 0
|
|
132
|
+
]), 1032, ["show-modal", "title", "confirm-button-text", "cancel-button-text"])
|
|
133
|
+
], 64);
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
export {
|
|
138
|
+
_sfc_main as _
|
|
139
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("vue"),t=require("./vendor-ui-C3Tq-qY_.js"),a={class:"flex items-start"},n={class:"flex flex-col grow"},s={class:"flex items-center gap-1"},l={class:"flex items-center ml-4 self-center"},r=e.defineComponent({__name:"PricingGroupContent",props:{name:{type:String},description:{type:String}},setup:r=>(c,i)=>(e.openBlock(),e.createElementBlock("div",a,[e.createElementVNode("div",n,[e.createElementVNode("div",s,[e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-sm",weight:"semibold"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.name),1)]),_:1}),e.renderSlot(c.$slots,"badge")]),e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(r.description),1)]),_:1})]),e.createElementVNode("div",l,[e.renderSlot(c.$slots,"default")])]))}),c={class:"sv-empty-state__body flex flex-col items-center justify-center py-4"},i=e.defineComponent({__name:"EmptyStatePlaceholder",props:{icon:{type:null}},setup:a=>(n,s)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main),{class:"sv-empty-state"},{default:e.withCtx(()=>[e.createElementVNode("div",c,[e.createVNode(e.unref(t._sfc_main$14),{icon:a.icon,size:"lg",class:"sv-empty-state__icon text-gray-500"},null,8,["icon"]),e.createVNode(e.unref(t._sfc_main$3),{center:"",tag:"span",variant:"body-sm",weight:"semibold",shade:"lighter",class:"sv-empty-state__title mt-2"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"title")]),_:3}),e.createVNode(e.unref(t._sfc_main$3),{center:"",tag:"span",variant:"body-xs",shade:"lightest",class:"sv-empty-state__message mt-1"},{default:e.withCtx(()=>[e.renderSlot(n.$slots,"message")]),_:3})])]),_:3}))}),o={class:"flex justify-around"},d={class:"flex items-center gap-0.5"},p=["aria-label","innerHTML"],m=e.defineComponent({__name:"SecurePaymentsKPI",props:{paymentMethodOptions:{type:Array}},setup(a){const n=a,{$t:s}=t.useIntl(),l={ADYEN:{svg:'<svg xmlns="http://www.w3.org/2000/svg" width="40" height="15" fill="none" viewBox="0 0 40 15"><path fill="currentColor" d="M.049 2.917h5.845c.646 0 1.17.522 1.17 1.166v5.834H1.217c-.646 0-1.17-.522-1.17-1.167V5.833h2.924v2.334H4.14v-3.5H.049zm32.735 0v7h2.922v-5.25h1.17v5.25h2.922V4.083c0-.644-.523-1.166-1.169-1.166zm-16.367 9.916h5.845c.646 0 1.17-.522 1.17-1.166v-8.75h-2.924v5.25H19.34v-5.25h-2.922V8.75c0 .645.523 1.167 1.169 1.167h2.922v1.166h-4.091zm15.197-2.916H25.77c-.646 0-1.17-.522-1.17-1.167V2.917h5.846c.646 0 1.17.522 1.17 1.166V7h-2.923V4.667h-1.17v3.5h4.092zM15.248 0v9.917H9.402c-.646 0-1.17-.522-1.17-1.167V4.083c0-.644.524-1.166 1.17-1.166h1.754v5.25h1.169V0z"/></svg>',label:"Adyen"},STRIPE:{svg:'<svg xmlns="http://www.w3.org/2000/svg" width="36" height="15" viewBox="0 0 36 15"><path d="M35.996 7.746c0-2.559-1.238-4.578-3.61-4.578-2.378 0-3.816 2.02-3.816 4.559 0 3.011 1.7 4.53 4.137 4.53 1.191 0 2.09-.269 2.77-.648v-2c-.68.34-1.457.547-2.45.547-.968 0-1.828-.34-1.937-1.52h4.887c0-.128.02-.648.02-.89m-4.937-.95c0-1.128.691-1.597 1.32-1.597.61 0 1.258.469 1.258 1.598ZM24.707 3.168c-.977 0-1.61.46-1.957.781l-.133-.62h-2.199v11.66l2.5-.532.012-2.828c.36.258.89.629 1.77.629 1.788 0 3.417-1.442 3.417-4.61-.008-2.898-1.66-4.48-3.41-4.48m-.598 6.89c-.59 0-.941-.21-1.18-.472l-.011-3.707c.262-.29.621-.492 1.191-.492.91 0 1.54 1.02 1.54 2.332 0 1.34-.622 2.34-1.54 2.34M16.98 2.578l2.508-.539V.008L16.98.539ZM16.98 3.34h2.508v8.746H16.98ZM14.29 4.078l-.161-.738h-2.16v8.746h2.5v-5.93c.59-.77 1.59-.629 1.898-.52V3.34c-.316-.121-1.488-.34-2.078.738M9.29 1.168l-2.438.52-.012 8.011c0 1.48 1.11 2.57 2.59 2.57.82 0 1.418-.152 1.75-.332v-2.03c-.32.132-1.899.59-1.899-.887V5.469h1.899v-2.13H9.28ZM2.531 5.879c0-.39.32-.54.848-.54a5.56 5.56 0 0 1 2.48.638V3.629a6.55 6.55 0 0 0-2.48-.461C1.352 3.168 0 4.227 0 6c0 2.758 3.8 2.316 3.8 3.508 0 .46-.402.61-.96.61-.828 0-1.89-.34-2.73-.802V11.7c.93.399 1.87.57 2.73.57 2.078 0 3.512-1.03 3.512-2.82-.012-2.98-3.82-2.453-3.82-3.57m0 0" style="stroke:none;fill-rule:evenodd;fill:currentColor;fill-opacity:1"/></svg>',label:"Stripe"}},r=e.computed(()=>{const e=n.paymentMethodOptions.find(({integration:e})=>{var t;return null!=(null==(t=e.payment_gateway)?void 0:t.variant)&&e.payment_gateway.variant in l});return e?l[e.integration.payment_gateway.variant]:null}),c=e.computed(()=>r.value?s({defaultMessage:"Secure and encrypted payments by",description:"Secure encrypted payments KPI for a specific vendor, followed by a vendor logo",id:"secure_payments_kpi.specific_vendor"}):s({defaultMessage:"Secure and encrypted payments",description:"Secure encrypted payments KPI",id:"secure_payments_kpi.generic"}));return(a,n)=>(e.openBlock(),e.createElementBlock("div",o,[e.createElementVNode("div",d,[e.createVNode(e.unref(t._sfc_main$14),{icon:"lock",size:"xs"}),e.createVNode(e.unref(t._sfc_main$3),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createElementVNode("span",null,e.toDisplayString(c.value),1),n[0]||(n[0]=e.createTextVNode(e.toDisplayString(" ")+" ",-1)),r.value?(e.openBlock(),e.createElementBlock("span",{key:0,"aria-label":r.value.label,role:"img",class:"inline-block h-[15px] align-middle",innerHTML:r.value.svg},null,8,p)):e.createCommentVNode("",!0)]),_:1})])]))}});exports._sfc_main=r,exports._sfc_main$1=m,exports._sfc_main$2=i;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineComponent, openBlock, createElementBlock, createElementVNode, createVNode, unref, withCtx, createTextVNode, toDisplayString, renderSlot, createBlock, computed, createCommentVNode } from "vue";
|
|
2
|
-
import {
|
|
2
|
+
import { e as _sfc_main$3, _ as _sfc_main$4, A as _sfc_main$5, u as useIntl } from "./vendor-ui-B8IlviSs.mjs";
|
|
3
3
|
const _hoisted_1$2 = { class: "flex items-start" };
|
|
4
4
|
const _hoisted_2$1 = { class: "flex flex-col grow" };
|
|
5
5
|
const _hoisted_3$1 = { class: "flex items-center gap-1" };
|
|
@@ -93,17 +93,11 @@ const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
});
|
|
96
|
+
const adyenLogo = '<svg xmlns="http://www.w3.org/2000/svg" width="40" height="15" fill="none" viewBox="0 0 40 15"><path fill="currentColor" d="M.049 2.917h5.845c.646 0 1.17.522 1.17 1.166v5.834H1.217c-.646 0-1.17-.522-1.17-1.167V5.833h2.924v2.334H4.14v-3.5H.049zm32.735 0v7h2.922v-5.25h1.17v5.25h2.922V4.083c0-.644-.523-1.166-1.169-1.166zm-16.367 9.916h5.845c.646 0 1.17-.522 1.17-1.166v-8.75h-2.924v5.25H19.34v-5.25h-2.922V8.75c0 .645.523 1.167 1.169 1.167h2.922v1.166h-4.091zm15.197-2.916H25.77c-.646 0-1.17-.522-1.17-1.167V2.917h5.846c.646 0 1.17.522 1.17 1.166V7h-2.923V4.667h-1.17v3.5h4.092zM15.248 0v9.917H9.402c-.646 0-1.17-.522-1.17-1.167V4.083c0-.644.524-1.166 1.17-1.166h1.754v5.25h1.169V0z"/></svg>';
|
|
97
|
+
const stripeLogo = '<svg xmlns="http://www.w3.org/2000/svg" width="36" height="15" viewBox="0 0 36 15"><path d="M35.996 7.746c0-2.559-1.238-4.578-3.61-4.578-2.378 0-3.816 2.02-3.816 4.559 0 3.011 1.7 4.53 4.137 4.53 1.191 0 2.09-.269 2.77-.648v-2c-.68.34-1.457.547-2.45.547-.968 0-1.828-.34-1.937-1.52h4.887c0-.128.02-.648.02-.89m-4.937-.95c0-1.128.691-1.597 1.32-1.597.61 0 1.258.469 1.258 1.598ZM24.707 3.168c-.977 0-1.61.46-1.957.781l-.133-.62h-2.199v11.66l2.5-.532.012-2.828c.36.258.89.629 1.77.629 1.788 0 3.417-1.442 3.417-4.61-.008-2.898-1.66-4.48-3.41-4.48m-.598 6.89c-.59 0-.941-.21-1.18-.472l-.011-3.707c.262-.29.621-.492 1.191-.492.91 0 1.54 1.02 1.54 2.332 0 1.34-.622 2.34-1.54 2.34M16.98 2.578l2.508-.539V.008L16.98.539ZM16.98 3.34h2.508v8.746H16.98ZM14.29 4.078l-.161-.738h-2.16v8.746h2.5v-5.93c.59-.77 1.59-.629 1.898-.52V3.34c-.316-.121-1.488-.34-2.078.738M9.29 1.168l-2.438.52-.012 8.011c0 1.48 1.11 2.57 2.59 2.57.82 0 1.418-.152 1.75-.332v-2.03c-.32.132-1.899.59-1.899-.887V5.469h1.899v-2.13H9.28ZM2.531 5.879c0-.39.32-.54.848-.54a5.56 5.56 0 0 1 2.48.638V3.629a6.55 6.55 0 0 0-2.48-.461C1.352 3.168 0 4.227 0 6c0 2.758 3.8 2.316 3.8 3.508 0 .46-.402.61-.96.61-.828 0-1.89-.34-2.73-.802V11.7c.93.399 1.87.57 2.73.57 2.078 0 3.512-1.03 3.512-2.82-.012-2.98-3.82-2.453-3.82-3.57m0 0" style="stroke:none;fill-rule:evenodd;fill:currentColor;fill-opacity:1"/></svg>';
|
|
96
98
|
const _hoisted_1 = { class: "flex justify-around" };
|
|
97
99
|
const _hoisted_2 = { class: "flex items-center gap-0.5" };
|
|
98
|
-
const _hoisted_3 =
|
|
99
|
-
key: 0,
|
|
100
|
-
xmlns: "http://www.w3.org/2000/svg",
|
|
101
|
-
width: "40",
|
|
102
|
-
height: "15",
|
|
103
|
-
fill: "none",
|
|
104
|
-
viewBox: "0 0 40 15",
|
|
105
|
-
class: "inline-block translate-y-[1px]"
|
|
106
|
-
};
|
|
100
|
+
const _hoisted_3 = ["aria-label", "innerHTML"];
|
|
107
101
|
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
108
102
|
__name: "SecurePaymentsKPI",
|
|
109
103
|
props: {
|
|
@@ -112,16 +106,21 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
112
106
|
setup(__props) {
|
|
113
107
|
const props = __props;
|
|
114
108
|
const { $t } = useIntl();
|
|
115
|
-
const
|
|
116
|
-
|
|
109
|
+
const VENDOR_LOGOS = {
|
|
110
|
+
ADYEN: { svg: adyenLogo, label: "Adyen" },
|
|
111
|
+
STRIPE: { svg: stripeLogo, label: "Stripe" }
|
|
112
|
+
};
|
|
113
|
+
const vendorLogo = computed(() => {
|
|
114
|
+
const entry = props.paymentMethodOptions.find(
|
|
117
115
|
({ integration }) => {
|
|
118
116
|
var _a;
|
|
119
|
-
return ((_a = integration.payment_gateway) == null ? void 0 : _a.variant)
|
|
117
|
+
return ((_a = integration.payment_gateway) == null ? void 0 : _a.variant) != null && integration.payment_gateway.variant in VENDOR_LOGOS;
|
|
120
118
|
}
|
|
121
|
-
)
|
|
122
|
-
|
|
119
|
+
);
|
|
120
|
+
return entry ? VENDOR_LOGOS[entry.integration.payment_gateway.variant] : null;
|
|
121
|
+
});
|
|
123
122
|
const securePaymentsText = computed(() => {
|
|
124
|
-
if (
|
|
123
|
+
if (vendorLogo.value) {
|
|
125
124
|
return $t({
|
|
126
125
|
defaultMessage: "Secure and encrypted payments by",
|
|
127
126
|
description: "Secure encrypted payments KPI for a specific vendor, followed by a vendor logo",
|
|
@@ -147,13 +146,15 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
|
147
146
|
shade: "lighter"
|
|
148
147
|
}, {
|
|
149
148
|
default: withCtx(() => [
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
149
|
+
createElementVNode("span", null, toDisplayString(securePaymentsText.value), 1),
|
|
150
|
+
_cache[0] || (_cache[0] = createTextVNode(toDisplayString(" ") + " ", -1)),
|
|
151
|
+
vendorLogo.value ? (openBlock(), createElementBlock("span", {
|
|
152
|
+
key: 0,
|
|
153
|
+
"aria-label": vendorLogo.value.label,
|
|
154
|
+
role: "img",
|
|
155
|
+
class: "inline-block h-[15px] align-middle",
|
|
156
|
+
innerHTML: vendorLogo.value.svg
|
|
157
|
+
}, null, 8, _hoisted_3)) : createCommentVNode("", true)
|
|
157
158
|
]),
|
|
158
159
|
_: 1
|
|
159
160
|
})
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { u as useIncrementalLoading } from "./useIncrementalLoading-
|
|
2
|
-
import { c as createSubscriptionsService } from "./subscriptions-
|
|
1
|
+
import { u as useIncrementalLoading } from "./useIncrementalLoading-DmOT2MXH.mjs";
|
|
2
|
+
import { c as createSubscriptionsService } from "./subscriptions-DHjXDyH1.mjs";
|
|
3
3
|
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, createSlots, Fragment, renderList } from "vue";
|
|
4
|
-
import { u as useIntl, _ as _sfc_main$3,
|
|
4
|
+
import { u as useIntl, _ as _sfc_main$3, e as _sfc_main$4, m as _sfc_main$5, c as _sfc_main$6, z as _sfc_main$7 } from "./vendor-ui-B8IlviSs.mjs";
|
|
5
5
|
import { _ as _sfc_main$8 } from "./Skeleton.vue_vue_type_script_setup_true_lang-DGMxHc20.mjs";
|
|
6
|
-
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-
|
|
6
|
+
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-DmhD9mYX.mjs";
|
|
7
7
|
function useSubscriptionsList({
|
|
8
8
|
customerId,
|
|
9
9
|
batchSize: pageSize = 15
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const e=require("./useIncrementalLoading-FNH4k4a3.js"),t=require("./subscriptions-CcpEwubd.js"),i=require("vue"),s=require("./vendor-ui-1SHma7t1.js"),o=require("./Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),n=require("./useActionDispatchProvider-aqYyqIdb.js");const r={class:"sv-subscriptions-list__item-body flex flex-col gap-4 md:flex-row"},c={class:"sv-subscriptions-list__item-content grow"},a={class:"sv-subscriptions-list__item-meta mt-4 flex items-center gap-6"},u={key:1,class:"sv-subscriptions-list__item-next-invoice flex gap-1"},l={class:"sv-subscriptions-list__item-actions flex flex-col items-center gap-2 md:flex-row"},p=i.defineComponent({__name:"SubscriptionsListItem",props:{subscription:{type:Object},paymentMethod:{type:Object},customer:{type:Object},showViewSubscriptionDetailsButton:{type:Boolean,default:!0},showCancelSubscriptionButton:{type:Boolean,default:!0},showRenewSubscriptionButton:{type:Boolean,default:!0},showUpgradeSubscriptionButton:{type:Boolean,default:!0}},emits:["view-subscription-details","cancel-subscription","renew-subscription","upgrade-subscription"],setup(e){const t=e,{$t:o}=s.useIntl(),{formatDate:n}=s.useIntl(),p=i.computed(()=>{var e;const i=t.subscription.pricing_plan_schedule_infos;if(0===i.length)return;const s=i[i.length-1];return null==(e=null==s?void 0:s.pricing_plan_version)?void 0:e.pricing_plan}),d=i.computed(()=>{var e;return t.subscription.name||(null==(e=p.value)?void 0:e.name)||o({defaultMessage:"Subscription",description:"The fallback name for when no subscription name can be determined",id:"customer_overview.subscriptions_block.fallback_subscription_name"})}),b=i.computed(()=>{var e;return null==(e=p.value)?void 0:e.description}),m=i.computed(()=>{const e=t.subscription.inactive_periods;return!e||0===e.length}),_=i.computed(()=>{const e=t.subscription.inactive_periods;return Array.isArray(e)&&e.length>0}),v=i.computed(()=>m.value&&t.showCancelSubscriptionButton),h=i.computed(()=>_.value&&t.showRenewSubscriptionButton),f=i.computed(()=>t.showViewSubscriptionDetailsButton);return(t,p)=>(i.openBlock(),i.createBlock(i.unref(s._sfc_main),{class:"sv-subscriptions-list__item"},{default:i.withCtx(()=>[i.createElementVNode("div",r,[i.createElementVNode("div",c,[i.createVNode(i.unref(s._sfc_main$1),{tag:"h3",variant:"heading-2",class:"sv-subscriptions-list__item-title"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(d.value),1)]),_:1}),b.value?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$1),{key:0,variant:"body-sm",tag:"span",shade:"lighter",class:"sv-subscriptions-list__item-description"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(b.value),1)]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",a,[e.paymentMethod?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$5),{key:0,variant:"condensed",class:"sv-payment-methods__item","payment-method":e.paymentMethod},null,8,["payment-method"])):i.createCommentVNode("",!0),e.subscription.next_invoice?(i.openBlock(),i.createElementBlock("div",u,[i.createVNode(i.unref(s._sfc_main$1),{tag:"span",variant:"body-xs",shade:"light",weight:"semibold"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"Next billing date",description:"The label for the next billing date",id:"customer.subscriptions_block.next_billing_date"})),1)]),_:1}),i.createVNode(i.unref(s._sfc_main$1),{tag:"span",variant:"body-xs",shade:"light"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(n)({date:e.subscription.next_invoice.invoice_date,format:"date",offsetType:"offsetted",timezone:e.customer.timezone})),1)]),_:1})])):i.createCommentVNode("",!0)])]),i.createElementVNode("div",l,[f.value?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$3),{key:0,color:"primary",class:"sv-action sv-action--primary sv-subscriptions-list__item-details w-full md:w-auto",type:"button",onClick:p[0]||(p[0]=i=>t.$emit("view-subscription-details",{subscriptionId:e.subscription.id}))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"Subscription details",description:"The label for the subscription details button in the subscriptions block",id:"customer.subscriptions_block.show_details_button_label"})),1)]),_:1})):i.createCommentVNode("",!0),e.showUpgradeSubscriptionButton?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$3),{key:1,variant:"outline",color:"gray",class:"sv-action sv-action--secondary sv-subscriptions-list__item-upgrade w-full md:w-auto",type:"button",onClick:p[1]||(p[1]=i=>t.$emit("upgrade-subscription",{subscriptionId:e.subscription.id}))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"Upgrade subscription",description:"The label for the upgrade subscription button in the subscriptions block",id:"customer.subscriptions_block.upgrade_button_label"})),1)]),_:1})):i.createCommentVNode("",!0),v.value?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$12),{key:2,icon:"delete",variant:"outline",color:"gray",size:"md",class:"sv-action sv-subscriptions-list__item-cancel",type:"button","aria-label":i.unref(o)({defaultMessage:"Cancel subscription",description:"Aria label for the cancel subscription icon button",id:"customer.subscriptions_block.cancel_button_label"}),onClick:p[2]||(p[2]=i=>t.$emit("cancel-subscription",{subscriptionId:e.subscription.id}))},null,8,["aria-label"])):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$3),{key:3,variant:"outline",color:"gray",class:"sv-action sv-action--secondary sv-subscriptions-list__item-renew w-full md:w-auto",type:"button",onClick:p[3]||(p[3]=i=>t.$emit("renew-subscription",{subscriptionId:e.subscription.id}))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"Renew subscription",description:"The label for the renew subscription button in the subscriptions block",id:"customer.subscriptions_block.renew_button_label"})),1)]),_:1})):i.createCommentVNode("",!0)])])]),_:1}))}}),d={key:1,class:"sv-subscriptions-list__items grid grid-cols-1 gap-4"},b=i.defineComponent({__name:"SubscriptionsList",props:{customer:{type:Object},subscriptions:{type:Array},paymentMethods:{default:()=>[],type:Array},isLoading:{type:Boolean},showViewAllButton:{type:Boolean,default:!0},showViewDetailsButton:{type:Boolean,default:!0},showCancelButton:{type:Boolean,default:!0},showRenewButton:{type:Boolean,default:!0},showUpgradeButton:{type:Boolean,default:!0}},emits:["view-subscription-details","view-all-subscriptions","cancel-subscription","renew-subscription","upgrade-subscription","load-more"],setup(e){const t=e,{$t:o}=s.useIntl(),n=i.computed(()=>t.subscriptions.length>0),r=e=>{if(e)return t.paymentMethods.find(({id:t})=>t===e)},c=i.computed(()=>t.showViewAllButton);return(t,a)=>(i.openBlock(),i.createBlock(i.unref(s._sfc_main),{class:"sv-subscriptions-list","no-spacing":"","no-border":"",title:i.unref(o)({defaultMessage:"{count, plural, one {My subscription} other {My subscriptions}}",description:"Title for the subscriptions block on the customer overview page",id:"customer_overview.subscriptions_block.title"},{count:String(e.subscriptions.length)})},i.createSlots({default:i.withCtx(()=>[n.value?(i.openBlock(),i.createElementBlock("div",d,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.subscriptions,s=>(i.openBlock(),i.createBlock(p,{key:s.id,subscription:s,"payment-method":r(s.payment_method_id),customer:e.customer,"show-view-subscription-details-button":e.showViewDetailsButton,"show-cancel-subscription-button":e.showCancelButton,"show-renew-subscription-button":e.showRenewButton,"show-upgrade-subscription-button":e.showUpgradeButton,onViewSubscriptionDetails:a[1]||(a[1]=e=>t.$emit("view-subscription-details",e)),onCancelSubscription:a[2]||(a[2]=e=>t.$emit("cancel-subscription",e)),onRenewSubscription:a[3]||(a[3]=e=>t.$emit("renew-subscription",e)),onUpgradeSubscription:a[4]||(a[4]=e=>t.$emit("upgrade-subscription",e))},null,8,["subscription","payment-method","customer","show-view-subscription-details-button","show-cancel-subscription-button","show-renew-subscription-button","show-upgrade-subscription-button"]))),128))])):(i.openBlock(),i.createBlock(i.unref(s._sfc_main),{key:0,class:"sv-empty-state sv-subscriptions-list__empty"},{default:i.withCtx(()=>[i.createVNode(i.unref(s._sfc_main$1),{tag:"h3",variant:"heading-3"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"No subscriptions",description:"Title for the my subscriptions block on the customer overview page",id:"customer_overview.subscriptions_block.no_active_subscription_title"})),1)]),_:1}),i.createVNode(i.unref(s._sfc_main$1),{variant:"body-xs",shade:"lighter"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"There’s no active subscription to display.",description:"Text that is being displayed when there is no active subscription in the subscriptions block",id:"customer_overview.subscriptions_block.no_active_subscription_content"})),1)]),_:1})]),_:1}))]),_:2},[c.value?{name:"right",fn:i.withCtx(()=>[i.createVNode(i.unref(s._sfc_main$3),{size:"sm",variant:"ghost",color:"gray","icon-suffix":"arrow_right_alt",class:"sv-action sv-action--ghost sv-subscriptions-list__view-all",type:"button",onClick:a[0]||(a[0]=e=>t.$emit("view-all-subscriptions"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"View all",description:"The text for the view all subscriptions button",id:"customer_overview.subscriptions_block.view_all_button_label"})),1)]),_:1})]),key:"0"}:void 0]),1032,["title"]))}}),m=i.defineComponent({__name:"SubscriptionsList",props:{customer:{type:null},subscriptions:{type:Array},paymentMethods:{type:Array},isLoading:{type:Boolean},configuration:{type:Object}},emits:["load-more"],setup(e){const{dispatchAction:t}=n.useActionDispatchProvider();return(s,n)=>{var r,c,a,u,l;return e.isLoading?(i.openBlock(),i.createBlock(o._sfc_main,{key:0,variant:"section",class:"sv-subscriptions-list sv-root sv-component sv-loading min-h-[100px]","data-testid":"subscriptions-list-skeleton"})):e.customer?(i.openBlock(),i.createBlock(b,{key:1,class:"sv-subscriptions-list sv-root sv-component",customer:e.customer,subscriptions:e.subscriptions,"payment-methods":e.paymentMethods,"is-loading":e.isLoading,"show-view-all-button":null==(r=e.configuration)?void 0:r.showViewAllButton,"show-view-details-button":null==(c=e.configuration)?void 0:c.showViewDetailsButton,"show-cancel-button":null==(a=e.configuration)?void 0:a.showCancelButton,"show-renew-button":null==(u=e.configuration)?void 0:u.showRenewButton,"show-upgrade-button":null==(l=e.configuration)?void 0:l.showUpgradeButton,onViewSubscriptionDetails:n[0]||(n[0]=e=>i.unref(t)({action:"view-subscription-details",data:{subscriptionId:e.subscriptionId}})),onViewAllSubscriptions:n[1]||(n[1]=e=>i.unref(t)({action:"view-all-subscriptions"})),onCancelSubscription:n[2]||(n[2]=e=>i.unref(t)({action:"cancel-subscription",data:{subscriptionId:e.subscriptionId}})),onRenewSubscription:n[3]||(n[3]=e=>i.unref(t)({action:"renew-subscription",data:{subscriptionId:e.subscriptionId}})),onUpgradeSubscription:n[4]||(n[4]=e=>i.unref(t)({action:"upgrade-subscription",data:{subscriptionId:e.subscriptionId}})),onLoadMore:n[5]||(n[5]=e=>s.$emit("load-more"))},null,8,["customer","subscriptions","payment-methods","is-loading","show-view-all-button","show-view-details-button","show-cancel-button","show-renew-button","show-upgrade-button"])):i.createCommentVNode("",!0)}}});exports._sfc_main=m,exports.useSubscriptionsList=function({customerId:i,batchSize:s=15}){const o=t.createSubscriptionsService();return e.useIncrementalLoading({service:async e=>o.getActiveSubscriptions({customerId:i,pagination:{page:e,pageSize:s}})})};
|
|
1
|
+
const e=require("./useIncrementalLoading-CuSndpP2.js"),t=require("./subscriptions-AMC4DirD.js"),i=require("vue"),s=require("./vendor-ui-C3Tq-qY_.js"),o=require("./Skeleton.vue_vue_type_script_setup_true_lang-DfMgIsGm.js"),n=require("./useActionDispatchProvider-CizNgRwv.js");const r={class:"sv-subscriptions-list__item-body flex flex-col gap-4 md:flex-row"},c={class:"sv-subscriptions-list__item-content grow"},a={class:"sv-subscriptions-list__item-meta mt-4 flex items-center gap-6"},u={key:1,class:"sv-subscriptions-list__item-next-invoice flex gap-1"},l={class:"sv-subscriptions-list__item-actions flex flex-col items-center gap-2 md:flex-row"},p=i.defineComponent({__name:"SubscriptionsListItem",props:{subscription:{type:Object},paymentMethod:{type:Object},customer:{type:Object},showViewSubscriptionDetailsButton:{type:Boolean,default:!0},showCancelSubscriptionButton:{type:Boolean,default:!0},showRenewSubscriptionButton:{type:Boolean,default:!0},showUpgradeSubscriptionButton:{type:Boolean,default:!0}},emits:["view-subscription-details","cancel-subscription","renew-subscription","upgrade-subscription"],setup(e){const t=e,{$t:o}=s.useIntl(),{formatDate:n}=s.useIntl(),p=i.computed(()=>{var e;const i=t.subscription.pricing_plan_schedule_infos;if(0===i.length)return;const s=i[i.length-1];return null==(e=null==s?void 0:s.pricing_plan_version)?void 0:e.pricing_plan}),d=i.computed(()=>{var e;return t.subscription.name||(null==(e=p.value)?void 0:e.name)||o({defaultMessage:"Subscription",description:"The fallback name for when no subscription name can be determined",id:"customer_overview.subscriptions_block.fallback_subscription_name"})}),b=i.computed(()=>{var e;return null==(e=p.value)?void 0:e.description}),m=i.computed(()=>{const e=t.subscription.inactive_periods;return!e||0===e.length}),_=i.computed(()=>{const e=t.subscription.inactive_periods;return Array.isArray(e)&&e.length>0}),v=i.computed(()=>m.value&&t.showCancelSubscriptionButton),h=i.computed(()=>_.value&&t.showRenewSubscriptionButton),f=i.computed(()=>t.showViewSubscriptionDetailsButton);return(t,p)=>(i.openBlock(),i.createBlock(i.unref(s._sfc_main),{class:"sv-subscriptions-list__item"},{default:i.withCtx(()=>[i.createElementVNode("div",r,[i.createElementVNode("div",c,[i.createVNode(i.unref(s._sfc_main$3),{tag:"h3",variant:"heading-2",class:"sv-subscriptions-list__item-title"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(d.value),1)]),_:1}),b.value?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$3),{key:0,variant:"body-sm",tag:"span",shade:"lighter",class:"sv-subscriptions-list__item-description"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(b.value),1)]),_:1})):i.createCommentVNode("",!0),i.createElementVNode("div",a,[e.paymentMethod?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$6),{key:0,variant:"condensed",class:"sv-payment-methods__item","payment-method":e.paymentMethod},null,8,["payment-method"])):i.createCommentVNode("",!0),e.subscription.next_invoice?(i.openBlock(),i.createElementBlock("div",u,[i.createVNode(i.unref(s._sfc_main$3),{tag:"span",variant:"body-xs",shade:"light",weight:"semibold"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"Next billing date",description:"The label for the next billing date",id:"customer.subscriptions_block.next_billing_date"})),1)]),_:1}),i.createVNode(i.unref(s._sfc_main$3),{tag:"span",variant:"body-xs",shade:"light"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(n)({date:e.subscription.next_invoice.invoice_date,format:"date",offsetType:"offsetted",timezone:e.customer.timezone})),1)]),_:1})])):i.createCommentVNode("",!0)])]),i.createElementVNode("div",l,[f.value?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$1),{key:0,color:"primary",class:"sv-action sv-action--primary sv-subscriptions-list__item-details w-full md:w-auto",type:"button",onClick:p[0]||(p[0]=i=>t.$emit("view-subscription-details",{subscriptionId:e.subscription.id}))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"Subscription details",description:"The label for the subscription details button in the subscriptions block",id:"customer.subscriptions_block.show_details_button_label"})),1)]),_:1})):i.createCommentVNode("",!0),e.showUpgradeSubscriptionButton?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$1),{key:1,variant:"outline",color:"gray",class:"sv-action sv-action--secondary sv-subscriptions-list__item-upgrade w-full md:w-auto",type:"button",onClick:p[1]||(p[1]=i=>t.$emit("upgrade-subscription",{subscriptionId:e.subscription.id}))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"Upgrade subscription",description:"The label for the upgrade subscription button in the subscriptions block",id:"customer.subscriptions_block.upgrade_button_label"})),1)]),_:1})):i.createCommentVNode("",!0),v.value?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$13),{key:2,icon:"delete",variant:"outline",color:"gray",size:"md",class:"sv-action sv-subscriptions-list__item-cancel",type:"button","aria-label":i.unref(o)({defaultMessage:"Cancel subscription",description:"Aria label for the cancel subscription icon button",id:"customer.subscriptions_block.cancel_button_label"}),onClick:p[2]||(p[2]=i=>t.$emit("cancel-subscription",{subscriptionId:e.subscription.id}))},null,8,["aria-label"])):i.createCommentVNode("",!0),h.value?(i.openBlock(),i.createBlock(i.unref(s._sfc_main$1),{key:3,variant:"outline",color:"gray",class:"sv-action sv-action--secondary sv-subscriptions-list__item-renew w-full md:w-auto",type:"button",onClick:p[3]||(p[3]=i=>t.$emit("renew-subscription",{subscriptionId:e.subscription.id}))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"Renew subscription",description:"The label for the renew subscription button in the subscriptions block",id:"customer.subscriptions_block.renew_button_label"})),1)]),_:1})):i.createCommentVNode("",!0)])])]),_:1}))}}),d={key:1,class:"sv-subscriptions-list__items grid grid-cols-1 gap-4"},b=i.defineComponent({__name:"SubscriptionsList",props:{customer:{type:Object},subscriptions:{type:Array},paymentMethods:{default:()=>[],type:Array},isLoading:{type:Boolean},showViewAllButton:{type:Boolean,default:!0},showViewDetailsButton:{type:Boolean,default:!0},showCancelButton:{type:Boolean,default:!0},showRenewButton:{type:Boolean,default:!0},showUpgradeButton:{type:Boolean,default:!0}},emits:["view-subscription-details","view-all-subscriptions","cancel-subscription","renew-subscription","upgrade-subscription","load-more"],setup(e){const t=e,{$t:o}=s.useIntl(),n=i.computed(()=>t.subscriptions.length>0),r=e=>{if(e)return t.paymentMethods.find(({id:t})=>t===e)},c=i.computed(()=>t.showViewAllButton);return(t,a)=>(i.openBlock(),i.createBlock(i.unref(s._sfc_main),{class:"sv-subscriptions-list","no-spacing":"","no-border":"",title:i.unref(o)({defaultMessage:"{count, plural, one {My subscription} other {My subscriptions}}",description:"Title for the subscriptions block on the customer overview page",id:"customer_overview.subscriptions_block.title"},{count:String(e.subscriptions.length)})},i.createSlots({default:i.withCtx(()=>[n.value?(i.openBlock(),i.createElementBlock("div",d,[(i.openBlock(!0),i.createElementBlock(i.Fragment,null,i.renderList(e.subscriptions,s=>(i.openBlock(),i.createBlock(p,{key:s.id,subscription:s,"payment-method":r(s.payment_method_id),customer:e.customer,"show-view-subscription-details-button":e.showViewDetailsButton,"show-cancel-subscription-button":e.showCancelButton,"show-renew-subscription-button":e.showRenewButton,"show-upgrade-subscription-button":e.showUpgradeButton,onViewSubscriptionDetails:a[1]||(a[1]=e=>t.$emit("view-subscription-details",e)),onCancelSubscription:a[2]||(a[2]=e=>t.$emit("cancel-subscription",e)),onRenewSubscription:a[3]||(a[3]=e=>t.$emit("renew-subscription",e)),onUpgradeSubscription:a[4]||(a[4]=e=>t.$emit("upgrade-subscription",e))},null,8,["subscription","payment-method","customer","show-view-subscription-details-button","show-cancel-subscription-button","show-renew-subscription-button","show-upgrade-subscription-button"]))),128))])):(i.openBlock(),i.createBlock(i.unref(s._sfc_main),{key:0,class:"sv-empty-state sv-subscriptions-list__empty"},{default:i.withCtx(()=>[i.createVNode(i.unref(s._sfc_main$3),{tag:"h3",variant:"heading-3"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"No subscriptions",description:"Title for the my subscriptions block on the customer overview page",id:"customer_overview.subscriptions_block.no_active_subscription_title"})),1)]),_:1}),i.createVNode(i.unref(s._sfc_main$3),{variant:"body-xs",shade:"lighter"},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"There’s no active subscription to display.",description:"Text that is being displayed when there is no active subscription in the subscriptions block",id:"customer_overview.subscriptions_block.no_active_subscription_content"})),1)]),_:1})]),_:1}))]),_:2},[c.value?{name:"right",fn:i.withCtx(()=>[i.createVNode(i.unref(s._sfc_main$1),{size:"sm",variant:"ghost",color:"gray","icon-suffix":"arrow_right_alt",class:"sv-action sv-action--ghost sv-subscriptions-list__view-all",type:"button",onClick:a[0]||(a[0]=e=>t.$emit("view-all-subscriptions"))},{default:i.withCtx(()=>[i.createTextVNode(i.toDisplayString(i.unref(o)({defaultMessage:"View all",description:"The text for the view all subscriptions button",id:"customer_overview.subscriptions_block.view_all_button_label"})),1)]),_:1})]),key:"0"}:void 0]),1032,["title"]))}}),m=i.defineComponent({__name:"SubscriptionsList",props:{customer:{type:null},subscriptions:{type:Array},paymentMethods:{type:Array},isLoading:{type:Boolean},configuration:{type:Object}},emits:["load-more"],setup(e){const{dispatchAction:t}=n.useActionDispatchProvider();return(s,n)=>{var r,c,a,u,l;return e.isLoading?(i.openBlock(),i.createBlock(o._sfc_main,{key:0,variant:"section",class:"sv-subscriptions-list sv-root sv-component sv-loading min-h-[100px]","data-testid":"subscriptions-list-skeleton"})):e.customer?(i.openBlock(),i.createBlock(b,{key:1,class:"sv-subscriptions-list sv-root sv-component",customer:e.customer,subscriptions:e.subscriptions,"payment-methods":e.paymentMethods,"is-loading":e.isLoading,"show-view-all-button":null==(r=e.configuration)?void 0:r.showViewAllButton,"show-view-details-button":null==(c=e.configuration)?void 0:c.showViewDetailsButton,"show-cancel-button":null==(a=e.configuration)?void 0:a.showCancelButton,"show-renew-button":null==(u=e.configuration)?void 0:u.showRenewButton,"show-upgrade-button":null==(l=e.configuration)?void 0:l.showUpgradeButton,onViewSubscriptionDetails:n[0]||(n[0]=e=>i.unref(t)({action:"view-subscription-details",data:{subscriptionId:e.subscriptionId}})),onViewAllSubscriptions:n[1]||(n[1]=e=>i.unref(t)({action:"view-all-subscriptions"})),onCancelSubscription:n[2]||(n[2]=e=>i.unref(t)({action:"cancel-subscription",data:{subscriptionId:e.subscriptionId}})),onRenewSubscription:n[3]||(n[3]=e=>i.unref(t)({action:"renew-subscription",data:{subscriptionId:e.subscriptionId}})),onUpgradeSubscription:n[4]||(n[4]=e=>i.unref(t)({action:"upgrade-subscription",data:{subscriptionId:e.subscriptionId}})),onLoadMore:n[5]||(n[5]=e=>s.$emit("load-more"))},null,8,["customer","subscriptions","payment-methods","is-loading","show-view-all-button","show-view-details-button","show-cancel-button","show-renew-button","show-upgrade-button"])):i.createCommentVNode("",!0)}}});exports._sfc_main=m,exports.useSubscriptionsList=function({customerId:i,batchSize:s=15}){const o=t.createSubscriptionsService();return e.useIncrementalLoading({service:async e=>o.getActiveSubscriptions({customerId:i,pagination:{page:e,pageSize:s}})})};
|