@solvimon/solvimon-web 0.1.0-alpha.1
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 +80 -0
- package/dist/BillingInformation.entry.ce-1xVdsWlL.mjs +99 -0
- package/dist/BillingInformation.entry.ce-DkrfEvK_.js +1 -0
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-B42EzZ97.mjs +56 -0
- package/dist/BillingInformation.vue_vue_type_script_setup_true_lang-VMlVPI4O.js +1 -0
- package/dist/BillingInformationForm.entry.ce-MPMirEsk.js +1 -0
- package/dist/BillingInformationForm.entry.ce-xfT0Jqps.mjs +579 -0
- package/dist/Checkout.entry.ce-Bif6vR1K.mjs +5185 -0
- package/dist/Checkout.entry.ce-CkQnLAn4.js +1 -0
- package/dist/ContentWithAsideLayout-BC-C5Gjt.mjs +42 -0
- package/dist/ContentWithAsideLayout-CIVSoqFr.js +1 -0
- package/dist/CustomerOverview.entry.ce-C__omsVl.js +1 -0
- package/dist/CustomerOverview.entry.ce-Ce_Yk8-i.mjs +231 -0
- package/dist/CustomerPaymentMethods.entry.ce-CZwy8Aqq.mjs +135 -0
- package/dist/CustomerPaymentMethods.entry.ce-DnjlRHPA.js +1 -0
- package/dist/Invoice.entry.ce-CdJ9TPZe.mjs +583 -0
- package/dist/Invoice.entry.ce-Cgr43ome.js +1 -0
- package/dist/InvoiceDetails.entry.ce-Cnpz8CLJ.mjs +130 -0
- package/dist/InvoiceDetails.entry.ce-jHDyWra2.js +1 -0
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-5yBnSRap.mjs +85 -0
- package/dist/InvoiceDetailsBlock.vue_vue_type_script_setup_true_lang-t6E9_dWJ.js +1 -0
- package/dist/InvoicesList.entry.ce-38iOW5qh.js +1 -0
- package/dist/InvoicesList.entry.ce-BBaHEtAD.mjs +105 -0
- package/dist/PaymentHistory.entry.ce-DDeHMhK_.js +1 -0
- package/dist/PaymentHistory.entry.ce-Dw2NiP4l.mjs +134 -0
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-8UxAr2hU.js +1 -0
- package/dist/PaymentHistoryBlock.vue_vue_type_script_setup_true_lang-CknZKCmY.mjs +90 -0
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-BCdv5DbH.mjs +6568 -0
- package/dist/PaymentIntegrationForm.vue_vue_type_script_setup_true_lang-xJ8kJbRo.js +1 -0
- package/dist/PaymentMethodForm.entry.ce-f4cFExKc.mjs +238 -0
- package/dist/PaymentMethodForm.entry.ce-zxeBXZW6.js +1 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-BFFJw-5h.mjs +62 -0
- package/dist/Skeleton.vue_vue_type_script_setup_true_lang-CQqTurIt.js +1 -0
- package/dist/SubscriptionSchedules.entry.ce-B4T_yQC1.js +1 -0
- package/dist/SubscriptionSchedules.entry.ce-B4vQ7QLk.mjs +153 -0
- package/dist/SubscriptionsList.entry.ce-B5SJCQW0.js +1 -0
- package/dist/SubscriptionsList.entry.ce-cNYuQZZj.mjs +135 -0
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DfB5BqiH.mjs +373 -0
- package/dist/SubscriptionsList.vue_vue_type_script_setup_true_lang-DqZLFDCv.js +1 -0
- package/dist/_Uint8Array-DHE03FZr.mjs +507 -0
- package/dist/_Uint8Array-DxISR7XF.js +1 -0
- package/dist/auto-B_36W1Fc.js +6 -0
- package/dist/auto-BfMZdgp-.mjs +14207 -0
- package/dist/cloneDeep-Hs8Pp07F.js +1 -0
- package/dist/cloneDeep-sm9cY-u2.mjs +212 -0
- package/dist/component-BkmcE85U.mjs +58654 -0
- package/dist/component-Df5eNqYX.js +1 -0
- package/dist/components/BillingInformation/BillingInformation.ce.d.ts +3 -0
- package/dist/components/BillingInformation/BillingInformation.cjs.js +1 -0
- package/dist/components/BillingInformation/BillingInformation.es.js +7 -0
- package/dist/components/BillingInformationForm/BillingInformationForm.ce.d.ts +3 -0
- package/dist/components/BillingInformationForm/BillingInformationForm.cjs.js +1 -0
- package/dist/components/BillingInformationForm/BillingInformationForm.es.js +7 -0
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.ce.d.ts +3 -0
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.cjs.js +1 -0
- package/dist/components/CustomerPaymentMethods/CustomerPaymentMethods.es.js +7 -0
- package/dist/components/Invoice/Invoice.ce.d.ts +3 -0
- package/dist/components/Invoice/Invoice.cjs.js +1 -0
- package/dist/components/Invoice/Invoice.es.js +7 -0
- package/dist/components/InvoiceDetails/InvoiceDetails.ce.d.ts +3 -0
- package/dist/components/InvoiceDetails/InvoiceDetails.cjs.js +1 -0
- package/dist/components/InvoiceDetails/InvoiceDetails.es.js +7 -0
- package/dist/components/InvoicesList/InvoicesList.ce.d.ts +3 -0
- package/dist/components/InvoicesList/InvoicesList.cjs.js +1 -0
- package/dist/components/InvoicesList/InvoicesList.es.js +7 -0
- package/dist/components/PaymentHistory/PaymentHistory.ce.d.ts +3 -0
- package/dist/components/PaymentHistory/PaymentHistory.cjs.js +1 -0
- package/dist/components/PaymentHistory/PaymentHistory.es.js +7 -0
- package/dist/components/PaymentMethodForm/PaymentMethodForm.ce.d.ts +3 -0
- package/dist/components/PaymentMethodForm/PaymentMethodForm.cjs.js +1 -0
- package/dist/components/PaymentMethodForm/PaymentMethodForm.es.js +7 -0
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.ce.d.ts +3 -0
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.cjs.js +1 -0
- package/dist/components/SubscriptionSchedules/SubscriptionSchedules.es.js +7 -0
- package/dist/components/SubscriptionsList/SubscriptionsList.ce.d.ts +3 -0
- package/dist/components/SubscriptionsList/SubscriptionsList.cjs.js +1 -0
- package/dist/components/SubscriptionsList/SubscriptionsList.es.js +7 -0
- package/dist/core/action-request.types.d.ts +58 -0
- package/dist/core/configuration.d.ts +2 -0
- package/dist/core/index.cjs.js +1 -0
- package/dist/core/index.d.ts +10 -0
- package/dist/core/index.es.js +6 -0
- package/dist/core/registry.ce.d.ts +2 -0
- package/dist/core/registry.d.ts +6 -0
- package/dist/core/types.d.ts +107 -0
- package/dist/index-2jo9BSPM.js +1 -0
- package/dist/index-BFZ0dPh9.mjs +179 -0
- package/dist/index-CWSXne1Q.js +1 -0
- package/dist/index-CzL1ZcGi.mjs +85 -0
- package/dist/index-D3v7hAtc.mjs +253 -0
- package/dist/index-DRdBmZ2-.js +1 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.es.js +39 -0
- package/dist/invoices-8M_3ur_U.js +1 -0
- package/dist/invoices-C31Wz1Bu.mjs +84 -0
- package/dist/paymentMethods-CrU4G_2Y.mjs +65 -0
- package/dist/paymentMethods-CzUqDlvc.js +1 -0
- package/dist/payments-C3LPk9k9.js +1 -0
- package/dist/payments-NtWI8KlU.mjs +47 -0
- package/dist/registry-By94DXE2.js +1 -0
- package/dist/registry-shRKDl3K.mjs +127 -0
- package/dist/screens/Checkout/Checkout.ce.d.ts +3 -0
- package/dist/screens/Checkout/Checkout.cjs.js +1 -0
- package/dist/screens/Checkout/Checkout.es.js +7 -0
- package/dist/screens/CustomerOverview/CustomerOverview.ce.d.ts +3 -0
- package/dist/screens/CustomerOverview/CustomerOverview.cjs.js +1 -0
- package/dist/screens/CustomerOverview/CustomerOverview.es.js +7 -0
- package/dist/solvimon-web.css +1 -0
- package/dist/sprite-i5T7eZnk-C55G-dBo.js +1 -0
- package/dist/sprite-i5T7eZnk-i5T7eZnk.mjs +4 -0
- package/dist/subscriptions-3R7aMoky.mjs +74 -0
- package/dist/subscriptions-CqK7t-fF.js +1 -0
- package/dist/useActionDispatchProvider-CBo_Hwu5.mjs +12 -0
- package/dist/useActionDispatchProvider-DsIljrhi.js +1 -0
- package/dist/useCustomer-BRY0tuBH.mjs +45 -0
- package/dist/useCustomer-Dp8sGHI0.js +1 -0
- package/dist/useCustomerPaymentMethodOptions-DYpMDnJR.js +1 -0
- package/dist/useCustomerPaymentMethodOptions-Fe_dLxfv.mjs +168 -0
- package/dist/useIncrementalLoading-D8oKNxX7.js +1 -0
- package/dist/useIncrementalLoading-fHCizCSo.mjs +69 -0
- package/dist/useInvoiceData-DImEH1ca.js +1 -0
- package/dist/useInvoiceData-dyvoDwFF.mjs +51 -0
- package/dist/useInvoicesList-BZQ9Y0qN.js +1 -0
- package/dist/useInvoicesList-rDvRzMqe.mjs +294 -0
- package/dist/useLoadInitialData-BRg7IWqW.js +1 -0
- package/dist/useLoadInitialData-Dm48tlSO.mjs +13 -0
- package/dist/usePaymentMethods-Bq5fWl1Q.mjs +16 -0
- package/dist/usePaymentMethods-Dbimodf0.js +1 -0
- package/dist/useService-Dz13Nxbi.mjs +272 -0
- package/dist/useService-bNNi4GB8.js +1 -0
- package/package.json +174 -0
|
@@ -0,0 +1,373 @@
|
|
|
1
|
+
import { u as useIncrementalLoading } from "./useIncrementalLoading-fHCizCSo.mjs";
|
|
2
|
+
import { c as createSubscriptionsService } from "./subscriptions-3R7aMoky.mjs";
|
|
3
|
+
import { defineComponent, computed, openBlock, createBlock, unref, withCtx, createElementVNode, createVNode, createTextVNode, toDisplayString, createCommentVNode, createElementBlock, createSlots, Fragment, renderList } from "vue";
|
|
4
|
+
import { b as useIntl, d as _sfc_main$1g, _ as _sfc_main$2$1, g as _sfc_main$3, m as _sfc_main$2H } from "./component-BkmcE85U.mjs";
|
|
5
|
+
import { _ as _sfc_main$4 } from "./Skeleton.vue_vue_type_script_setup_true_lang-BFFJw-5h.mjs";
|
|
6
|
+
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-CBo_Hwu5.mjs";
|
|
7
|
+
function useSubscriptionsList({
|
|
8
|
+
customerId,
|
|
9
|
+
batchSize: pageSize = 15
|
|
10
|
+
}) {
|
|
11
|
+
const subscriptionsService = createSubscriptionsService();
|
|
12
|
+
const service = async (page) => subscriptionsService.getActiveSubscriptions({
|
|
13
|
+
customerId,
|
|
14
|
+
pagination: { page, pageSize }
|
|
15
|
+
});
|
|
16
|
+
return useIncrementalLoading({ service });
|
|
17
|
+
}
|
|
18
|
+
const _hoisted_1$1 = { class: "flex flex-col gap-4 md:flex-row" };
|
|
19
|
+
const _hoisted_2 = { class: "grow" };
|
|
20
|
+
const _hoisted_3 = { class: "mt-4 flex items-center gap-6" };
|
|
21
|
+
const _hoisted_4 = {
|
|
22
|
+
key: 1,
|
|
23
|
+
class: "flex gap-1"
|
|
24
|
+
};
|
|
25
|
+
const _hoisted_5 = { class: "flex flex-col items-center gap-2 md:flex-row" };
|
|
26
|
+
const _sfc_main$2 = /* @__PURE__ */ defineComponent({
|
|
27
|
+
__name: "SubscriptionsListItem",
|
|
28
|
+
props: {
|
|
29
|
+
subscription: { type: Object },
|
|
30
|
+
paymentMethod: { type: Object },
|
|
31
|
+
customer: { type: Object },
|
|
32
|
+
showViewSubscriptionDetailsButton: { type: Boolean, default: true },
|
|
33
|
+
showCancelSubscriptionButton: { type: Boolean, default: true },
|
|
34
|
+
showRenewSubscriptionButton: { type: Boolean, default: true }
|
|
35
|
+
},
|
|
36
|
+
emits: ["view-subscription-details", "cancel-subscription", "renew-subscription"],
|
|
37
|
+
setup(__props) {
|
|
38
|
+
const props = __props;
|
|
39
|
+
const { $t } = useIntl();
|
|
40
|
+
const { formatDate } = useIntl();
|
|
41
|
+
const mostRecentPricingPlan = computed(() => {
|
|
42
|
+
var _a;
|
|
43
|
+
const scheduleInfos = props.subscription.pricing_plan_schedule_infos;
|
|
44
|
+
if (scheduleInfos.length === 0) {
|
|
45
|
+
return void 0;
|
|
46
|
+
}
|
|
47
|
+
const latestScheduleInfo = scheduleInfos[scheduleInfos.length - 1];
|
|
48
|
+
return (_a = latestScheduleInfo == null ? void 0 : latestScheduleInfo.pricing_plan_version) == null ? void 0 : _a.pricing_plan;
|
|
49
|
+
});
|
|
50
|
+
const subscriptionName = computed(
|
|
51
|
+
() => {
|
|
52
|
+
var _a;
|
|
53
|
+
return props.subscription.name || ((_a = mostRecentPricingPlan.value) == null ? void 0 : _a.name) || $t({
|
|
54
|
+
defaultMessage: "Subscription",
|
|
55
|
+
description: "The fallback name for when no subscription name can be determined",
|
|
56
|
+
id: "customer_overview.subscriptions_block.fallback_subscription_name"
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
const subscriptionDescription = computed(
|
|
61
|
+
() => {
|
|
62
|
+
var _a;
|
|
63
|
+
return (_a = mostRecentPricingPlan.value) == null ? void 0 : _a.description;
|
|
64
|
+
}
|
|
65
|
+
);
|
|
66
|
+
const isCancellable = computed(() => {
|
|
67
|
+
const inactivePeriods = props.subscription.inactive_periods;
|
|
68
|
+
return !inactivePeriods || inactivePeriods.length === 0;
|
|
69
|
+
});
|
|
70
|
+
const isRenewable = computed(() => {
|
|
71
|
+
const inactivePeriods = props.subscription.inactive_periods;
|
|
72
|
+
return Array.isArray(inactivePeriods) && inactivePeriods.length > 0;
|
|
73
|
+
});
|
|
74
|
+
const isCancelButtonVisible = computed(
|
|
75
|
+
() => isCancellable.value && props.showCancelSubscriptionButton
|
|
76
|
+
);
|
|
77
|
+
const isRenewButtonVisible = computed(
|
|
78
|
+
() => isRenewable.value && props.showRenewSubscriptionButton
|
|
79
|
+
);
|
|
80
|
+
const isDetailButtonVisible = computed(() => props.showViewSubscriptionDetailsButton);
|
|
81
|
+
return (_ctx, _cache) => {
|
|
82
|
+
return openBlock(), createBlock(unref(_sfc_main$1g), null, {
|
|
83
|
+
default: withCtx(() => [
|
|
84
|
+
createElementVNode("div", _hoisted_1$1, [
|
|
85
|
+
createElementVNode("div", _hoisted_2, [
|
|
86
|
+
createVNode(unref(_sfc_main$2$1), {
|
|
87
|
+
tag: "h3",
|
|
88
|
+
variant: "heading-2"
|
|
89
|
+
}, {
|
|
90
|
+
default: withCtx(() => [
|
|
91
|
+
createTextVNode(toDisplayString(subscriptionName.value), 1)
|
|
92
|
+
]),
|
|
93
|
+
_: 1
|
|
94
|
+
}),
|
|
95
|
+
subscriptionDescription.value ? (openBlock(), createBlock(unref(_sfc_main$2$1), {
|
|
96
|
+
key: 0,
|
|
97
|
+
variant: "body-sm",
|
|
98
|
+
tag: "span",
|
|
99
|
+
shade: "lighter"
|
|
100
|
+
}, {
|
|
101
|
+
default: withCtx(() => [
|
|
102
|
+
createTextVNode(toDisplayString(subscriptionDescription.value), 1)
|
|
103
|
+
]),
|
|
104
|
+
_: 1
|
|
105
|
+
})) : createCommentVNode("", true),
|
|
106
|
+
createElementVNode("div", _hoisted_3, [
|
|
107
|
+
__props.paymentMethod ? (openBlock(), createBlock(unref(_sfc_main$3), {
|
|
108
|
+
key: 0,
|
|
109
|
+
variant: "condensed",
|
|
110
|
+
"payment-method": __props.paymentMethod
|
|
111
|
+
}, null, 8, ["payment-method"])) : createCommentVNode("", true),
|
|
112
|
+
__props.subscription.next_invoice ? (openBlock(), createElementBlock("div", _hoisted_4, [
|
|
113
|
+
createVNode(unref(_sfc_main$2$1), {
|
|
114
|
+
tag: "span",
|
|
115
|
+
variant: "body-xs",
|
|
116
|
+
shade: "light",
|
|
117
|
+
weight: "semibold"
|
|
118
|
+
}, {
|
|
119
|
+
default: withCtx(() => [
|
|
120
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
121
|
+
defaultMessage: "Next billing date",
|
|
122
|
+
description: "The label for the next billing date",
|
|
123
|
+
id: "customer.subscriptions_block.next_billing_date"
|
|
124
|
+
})), 1)
|
|
125
|
+
]),
|
|
126
|
+
_: 1
|
|
127
|
+
}),
|
|
128
|
+
createVNode(unref(_sfc_main$2$1), {
|
|
129
|
+
tag: "span",
|
|
130
|
+
variant: "body-xs",
|
|
131
|
+
shade: "light"
|
|
132
|
+
}, {
|
|
133
|
+
default: withCtx(() => [
|
|
134
|
+
createTextVNode(toDisplayString(unref(formatDate)({
|
|
135
|
+
date: __props.subscription.next_invoice.invoice_date,
|
|
136
|
+
format: "date",
|
|
137
|
+
offsetType: "offsetted",
|
|
138
|
+
timezone: __props.customer.timezone
|
|
139
|
+
})), 1)
|
|
140
|
+
]),
|
|
141
|
+
_: 1
|
|
142
|
+
})
|
|
143
|
+
])) : createCommentVNode("", true)
|
|
144
|
+
])
|
|
145
|
+
]),
|
|
146
|
+
createElementVNode("div", _hoisted_5, [
|
|
147
|
+
isDetailButtonVisible.value ? (openBlock(), createBlock(unref(_sfc_main$2H), {
|
|
148
|
+
key: 0,
|
|
149
|
+
color: "primary",
|
|
150
|
+
class: "w-full md:w-auto",
|
|
151
|
+
type: "button",
|
|
152
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("view-subscription-details", { subscriptionId: __props.subscription.id }))
|
|
153
|
+
}, {
|
|
154
|
+
default: withCtx(() => [
|
|
155
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
156
|
+
defaultMessage: "Subscription details",
|
|
157
|
+
description: "The label for the subscription details button in the subscriptions block",
|
|
158
|
+
id: "customer.subscriptions_block.show_details_button_label"
|
|
159
|
+
})), 1)
|
|
160
|
+
]),
|
|
161
|
+
_: 1
|
|
162
|
+
})) : createCommentVNode("", true),
|
|
163
|
+
isCancelButtonVisible.value ? (openBlock(), createBlock(unref(_sfc_main$2H), {
|
|
164
|
+
key: 1,
|
|
165
|
+
variant: "outline",
|
|
166
|
+
color: "gray",
|
|
167
|
+
class: "w-full md:w-auto",
|
|
168
|
+
type: "button",
|
|
169
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("cancel-subscription", { subscriptionId: __props.subscription.id }))
|
|
170
|
+
}, {
|
|
171
|
+
default: withCtx(() => [
|
|
172
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
173
|
+
defaultMessage: "Cancel subscription",
|
|
174
|
+
description: "The label for the cancel subscription button in the subscriptions block",
|
|
175
|
+
id: "customer.subscriptions_block.cancel_button_label"
|
|
176
|
+
})), 1)
|
|
177
|
+
]),
|
|
178
|
+
_: 1
|
|
179
|
+
})) : isRenewButtonVisible.value ? (openBlock(), createBlock(unref(_sfc_main$2H), {
|
|
180
|
+
key: 2,
|
|
181
|
+
variant: "outline",
|
|
182
|
+
color: "gray",
|
|
183
|
+
class: "w-full md:w-auto",
|
|
184
|
+
type: "button",
|
|
185
|
+
onClick: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("renew-subscription", { subscriptionId: __props.subscription.id }))
|
|
186
|
+
}, {
|
|
187
|
+
default: withCtx(() => [
|
|
188
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
189
|
+
defaultMessage: "Renew subscription",
|
|
190
|
+
description: "The label for the renew subscription button in the subscriptions block",
|
|
191
|
+
id: "customer.subscriptions_block.renew_button_label"
|
|
192
|
+
})), 1)
|
|
193
|
+
]),
|
|
194
|
+
_: 1
|
|
195
|
+
})) : createCommentVNode("", true)
|
|
196
|
+
])
|
|
197
|
+
])
|
|
198
|
+
]),
|
|
199
|
+
_: 1
|
|
200
|
+
});
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
const _hoisted_1 = {
|
|
205
|
+
key: 1,
|
|
206
|
+
class: "grid grid-cols-1 gap-4"
|
|
207
|
+
};
|
|
208
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
209
|
+
__name: "SubscriptionsList",
|
|
210
|
+
props: {
|
|
211
|
+
customer: { type: Object },
|
|
212
|
+
subscriptions: { type: Array },
|
|
213
|
+
paymentMethods: { default: () => [], type: Array },
|
|
214
|
+
isLoading: { type: Boolean },
|
|
215
|
+
showViewAllButton: { type: Boolean, default: true },
|
|
216
|
+
showViewDetailsButton: { type: Boolean, default: true },
|
|
217
|
+
showCancelButton: { type: Boolean, default: true },
|
|
218
|
+
showRenewButton: { type: Boolean, default: true }
|
|
219
|
+
},
|
|
220
|
+
emits: ["view-subscription-details", "view-all-subscriptions", "cancel-subscription", "renew-subscription", "load-more"],
|
|
221
|
+
setup(__props) {
|
|
222
|
+
const props = __props;
|
|
223
|
+
const { $t } = useIntl();
|
|
224
|
+
const hasSubscriptions = computed(() => props.subscriptions.length > 0);
|
|
225
|
+
const getPaymentMethod = (paymentMethodId) => {
|
|
226
|
+
if (!paymentMethodId) return void 0;
|
|
227
|
+
return props.paymentMethods.find(({ id }) => id === paymentMethodId);
|
|
228
|
+
};
|
|
229
|
+
const isViewAllButtonVisible = computed(() => props.showViewAllButton);
|
|
230
|
+
return (_ctx, _cache) => {
|
|
231
|
+
return openBlock(), createBlock(unref(_sfc_main$1g), {
|
|
232
|
+
"no-spacing": "",
|
|
233
|
+
"no-border": "",
|
|
234
|
+
title: unref($t)(
|
|
235
|
+
{
|
|
236
|
+
defaultMessage: "{count, plural, one {My subscription} other {My subscriptions}}",
|
|
237
|
+
description: "Title for the subscriptions block on the customer overview page",
|
|
238
|
+
id: "customer_overview.subscriptions_block.title"
|
|
239
|
+
},
|
|
240
|
+
{ count: String(__props.subscriptions.length) }
|
|
241
|
+
)
|
|
242
|
+
}, createSlots({
|
|
243
|
+
default: withCtx(() => [
|
|
244
|
+
!hasSubscriptions.value ? (openBlock(), createBlock(unref(_sfc_main$1g), { key: 0 }, {
|
|
245
|
+
default: withCtx(() => [
|
|
246
|
+
createVNode(unref(_sfc_main$2$1), {
|
|
247
|
+
tag: "h3",
|
|
248
|
+
variant: "heading-3"
|
|
249
|
+
}, {
|
|
250
|
+
default: withCtx(() => [
|
|
251
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
252
|
+
defaultMessage: "No subscriptions",
|
|
253
|
+
description: "Title for the my subscriptions block on the customer overview page",
|
|
254
|
+
id: "customer_overview.subscriptions_block.no_active_subscription_title"
|
|
255
|
+
})), 1)
|
|
256
|
+
]),
|
|
257
|
+
_: 1
|
|
258
|
+
}),
|
|
259
|
+
createVNode(unref(_sfc_main$2$1), {
|
|
260
|
+
variant: "body-xs",
|
|
261
|
+
shade: "lighter"
|
|
262
|
+
}, {
|
|
263
|
+
default: withCtx(() => [
|
|
264
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
265
|
+
defaultMessage: "There’s no active subscription to display.",
|
|
266
|
+
description: "Text that is being displayed when there is no active subscription in the subscriptions block",
|
|
267
|
+
id: "customer_overview.subscriptions_block.no_active_subscription_content"
|
|
268
|
+
})), 1)
|
|
269
|
+
]),
|
|
270
|
+
_: 1
|
|
271
|
+
})
|
|
272
|
+
]),
|
|
273
|
+
_: 1
|
|
274
|
+
})) : (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
275
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.subscriptions, (subscription) => {
|
|
276
|
+
return openBlock(), createBlock(_sfc_main$2, {
|
|
277
|
+
key: subscription.id,
|
|
278
|
+
subscription,
|
|
279
|
+
"payment-method": getPaymentMethod(subscription.payment_method_id),
|
|
280
|
+
customer: __props.customer,
|
|
281
|
+
"show-view-subscription-details-button": __props.showViewDetailsButton,
|
|
282
|
+
"show-cancel-subscription-button": __props.showCancelButton,
|
|
283
|
+
"show-renew-subscription-button": __props.showRenewButton,
|
|
284
|
+
"show-view-all-button": __props.showViewAllButton,
|
|
285
|
+
"show-cancel-button": __props.showCancelButton,
|
|
286
|
+
"show-renew-button": __props.showRenewButton,
|
|
287
|
+
onViewSubscriptionDetails: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("view-subscription-details", $event)),
|
|
288
|
+
onCancelSubscription: _cache[2] || (_cache[2] = ($event) => _ctx.$emit("cancel-subscription", $event)),
|
|
289
|
+
onRenewSubscription: _cache[3] || (_cache[3] = ($event) => _ctx.$emit("renew-subscription", $event))
|
|
290
|
+
}, null, 8, ["subscription", "payment-method", "customer", "show-view-subscription-details-button", "show-cancel-subscription-button", "show-renew-subscription-button", "show-view-all-button", "show-cancel-button", "show-renew-button"]);
|
|
291
|
+
}), 128))
|
|
292
|
+
]))
|
|
293
|
+
]),
|
|
294
|
+
_: 2
|
|
295
|
+
}, [
|
|
296
|
+
isViewAllButtonVisible.value ? {
|
|
297
|
+
name: "right",
|
|
298
|
+
fn: withCtx(() => [
|
|
299
|
+
createVNode(unref(_sfc_main$2H), {
|
|
300
|
+
size: "sm",
|
|
301
|
+
variant: "ghost",
|
|
302
|
+
color: "gray",
|
|
303
|
+
"icon-suffix": "arrow_right_alt",
|
|
304
|
+
type: "button",
|
|
305
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("view-all-subscriptions"))
|
|
306
|
+
}, {
|
|
307
|
+
default: withCtx(() => [
|
|
308
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
309
|
+
defaultMessage: "View all",
|
|
310
|
+
description: "The text for the view all subscriptions button",
|
|
311
|
+
id: "customer_overview.subscriptions_block.view_all_button_label"
|
|
312
|
+
})), 1)
|
|
313
|
+
]),
|
|
314
|
+
_: 1
|
|
315
|
+
})
|
|
316
|
+
]),
|
|
317
|
+
key: "0"
|
|
318
|
+
} : void 0
|
|
319
|
+
]), 1032, ["title"]);
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
});
|
|
323
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
324
|
+
__name: "SubscriptionsList",
|
|
325
|
+
props: {
|
|
326
|
+
customer: { type: null },
|
|
327
|
+
subscriptions: { type: Array },
|
|
328
|
+
paymentMethods: { type: Array },
|
|
329
|
+
isLoading: { type: Boolean },
|
|
330
|
+
configuration: { type: Object }
|
|
331
|
+
},
|
|
332
|
+
emits: ["load-more"],
|
|
333
|
+
setup(__props) {
|
|
334
|
+
const { dispatchAction } = useActionDispatchProvider();
|
|
335
|
+
return (_ctx, _cache) => {
|
|
336
|
+
var _a, _b, _c, _d;
|
|
337
|
+
return __props.isLoading ? (openBlock(), createBlock(_sfc_main$4, {
|
|
338
|
+
key: 0,
|
|
339
|
+
variant: "section",
|
|
340
|
+
class: "min-h-[100px]",
|
|
341
|
+
"data-testid": "subscriptions-list-skeleton"
|
|
342
|
+
})) : __props.customer ? (openBlock(), createBlock(_sfc_main$1, {
|
|
343
|
+
key: 1,
|
|
344
|
+
customer: __props.customer,
|
|
345
|
+
subscriptions: __props.subscriptions,
|
|
346
|
+
"payment-methods": __props.paymentMethods,
|
|
347
|
+
"is-loading": __props.isLoading,
|
|
348
|
+
"show-view-all-button": (_a = __props.configuration) == null ? void 0 : _a.showViewAllButton,
|
|
349
|
+
"show-view-details-button": (_b = __props.configuration) == null ? void 0 : _b.showViewDetailsButton,
|
|
350
|
+
"show-cancel-button": (_c = __props.configuration) == null ? void 0 : _c.showCancelButton,
|
|
351
|
+
"show-renew-button": (_d = __props.configuration) == null ? void 0 : _d.showRenewButton,
|
|
352
|
+
onViewSubscriptionDetails: _cache[0] || (_cache[0] = ($event) => unref(dispatchAction)({
|
|
353
|
+
action: "view-subscription-details",
|
|
354
|
+
data: { subscriptionId: $event.subscriptionId }
|
|
355
|
+
})),
|
|
356
|
+
onViewAllSubscriptions: _cache[1] || (_cache[1] = ($event) => unref(dispatchAction)({ action: "view-all-subscriptions" })),
|
|
357
|
+
onCancelSubscription: _cache[2] || (_cache[2] = ($event) => unref(dispatchAction)({
|
|
358
|
+
action: "cancel-subscription",
|
|
359
|
+
data: { subscriptionId: $event.subscriptionId }
|
|
360
|
+
})),
|
|
361
|
+
onRenewSubscription: _cache[3] || (_cache[3] = ($event) => unref(dispatchAction)({
|
|
362
|
+
action: "renew-subscription",
|
|
363
|
+
data: { subscriptionId: $event.subscriptionId }
|
|
364
|
+
})),
|
|
365
|
+
onLoadMore: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("load-more"))
|
|
366
|
+
}, null, 8, ["customer", "subscriptions", "payment-methods", "is-loading", "show-view-all-button", "show-view-details-button", "show-cancel-button", "show-renew-button"])) : createCommentVNode("", true);
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
});
|
|
370
|
+
export {
|
|
371
|
+
_sfc_main as _,
|
|
372
|
+
useSubscriptionsList as u
|
|
373
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./useIncrementalLoading-D8oKNxX7.js"),t=require("./subscriptions-CqK7t-fF.js"),o=require("vue"),i=require("./component-Df5eNqYX.js"),n=require("./Skeleton.vue_vue_type_script_setup_true_lang-CQqTurIt.js"),s=require("./useActionDispatchProvider-DsIljrhi.js");const r={class:"flex flex-col gap-4 md:flex-row"},c={class:"grow"},a={class:"mt-4 flex items-center gap-6"},u={key:1,class:"flex gap-1"},l={class:"flex flex-col items-center gap-2 md:flex-row"},p=o.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}},emits:["view-subscription-details","cancel-subscription","renew-subscription"],setup(e){const t=e,{$t:n}=i.useIntl(),{formatDate:s}=i.useIntl(),p=o.computed(()=>{var e;const o=t.subscription.pricing_plan_schedule_infos;if(0===o.length)return;const i=o[o.length-1];return null==(e=null==i?void 0:i.pricing_plan_version)?void 0:e.pricing_plan}),d=o.computed(()=>{var e;return t.subscription.name||(null==(e=p.value)?void 0:e.name)||n({defaultMessage:"Subscription",description:"The fallback name for when no subscription name can be determined",id:"customer_overview.subscriptions_block.fallback_subscription_name"})}),b=o.computed(()=>{var e;return null==(e=p.value)?void 0:e.description}),m=o.computed(()=>{const e=t.subscription.inactive_periods;return!e||0===e.length}),w=o.computed(()=>{const e=t.subscription.inactive_periods;return Array.isArray(e)&&e.length>0}),h=o.computed(()=>m.value&&t.showCancelSubscriptionButton),f=o.computed(()=>w.value&&t.showRenewSubscriptionButton),_=o.computed(()=>t.showViewSubscriptionDetailsButton);return(t,p)=>(o.openBlock(),o.createBlock(o.unref(i._sfc_main$1g),null,{default:o.withCtx(()=>[o.createElementVNode("div",r,[o.createElementVNode("div",c,[o.createVNode(o.unref(i._sfc_main$2),{tag:"h3",variant:"heading-2"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(d.value),1)]),_:1}),b.value?(o.openBlock(),o.createBlock(o.unref(i._sfc_main$2),{key:0,variant:"body-sm",tag:"span",shade:"lighter"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(b.value),1)]),_:1})):o.createCommentVNode("",!0),o.createElementVNode("div",a,[e.paymentMethod?(o.openBlock(),o.createBlock(o.unref(i._sfc_main),{key:0,variant:"condensed","payment-method":e.paymentMethod},null,8,["payment-method"])):o.createCommentVNode("",!0),e.subscription.next_invoice?(o.openBlock(),o.createElementBlock("div",u,[o.createVNode(o.unref(i._sfc_main$2),{tag:"span",variant:"body-xs",shade:"light",weight:"semibold"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)({defaultMessage:"Next billing date",description:"The label for the next billing date",id:"customer.subscriptions_block.next_billing_date"})),1)]),_:1}),o.createVNode(o.unref(i._sfc_main$2),{tag:"span",variant:"body-xs",shade:"light"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(s)({date:e.subscription.next_invoice.invoice_date,format:"date",offsetType:"offsetted",timezone:e.customer.timezone})),1)]),_:1})])):o.createCommentVNode("",!0)])]),o.createElementVNode("div",l,[_.value?(o.openBlock(),o.createBlock(o.unref(i._sfc_main$2H),{key:0,color:"primary",class:"w-full md:w-auto",type:"button",onClick:p[0]||(p[0]=o=>t.$emit("view-subscription-details",{subscriptionId:e.subscription.id}))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)({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})):o.createCommentVNode("",!0),h.value?(o.openBlock(),o.createBlock(o.unref(i._sfc_main$2H),{key:1,variant:"outline",color:"gray",class:"w-full md:w-auto",type:"button",onClick:p[1]||(p[1]=o=>t.$emit("cancel-subscription",{subscriptionId:e.subscription.id}))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)({defaultMessage:"Cancel subscription",description:"The label for the cancel subscription button in the subscriptions block",id:"customer.subscriptions_block.cancel_button_label"})),1)]),_:1})):f.value?(o.openBlock(),o.createBlock(o.unref(i._sfc_main$2H),{key:2,variant:"outline",color:"gray",class:"w-full md:w-auto",type:"button",onClick:p[2]||(p[2]=o=>t.$emit("renew-subscription",{subscriptionId:e.subscription.id}))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)({defaultMessage:"Renew subscription",description:"The label for the renew subscription button in the subscriptions block",id:"customer.subscriptions_block.renew_button_label"})),1)]),_:1})):o.createCommentVNode("",!0)])])]),_:1}))}}),d={key:1,class:"grid grid-cols-1 gap-4"},b=o.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}},emits:["view-subscription-details","view-all-subscriptions","cancel-subscription","renew-subscription","load-more"],setup(e){const t=e,{$t:n}=i.useIntl(),s=o.computed(()=>t.subscriptions.length>0),r=e=>{if(e)return t.paymentMethods.find(({id:t})=>t===e)},c=o.computed(()=>t.showViewAllButton);return(t,a)=>(o.openBlock(),o.createBlock(o.unref(i._sfc_main$1g),{"no-spacing":"","no-border":"",title:o.unref(n)({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)})},o.createSlots({default:o.withCtx(()=>[s.value?(o.openBlock(),o.createElementBlock("div",d,[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(e.subscriptions,i=>(o.openBlock(),o.createBlock(p,{key:i.id,subscription:i,"payment-method":r(i.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-view-all-button":e.showViewAllButton,"show-cancel-button":e.showCancelButton,"show-renew-button":e.showRenewButton,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))},null,8,["subscription","payment-method","customer","show-view-subscription-details-button","show-cancel-subscription-button","show-renew-subscription-button","show-view-all-button","show-cancel-button","show-renew-button"]))),128))])):(o.openBlock(),o.createBlock(o.unref(i._sfc_main$1g),{key:0},{default:o.withCtx(()=>[o.createVNode(o.unref(i._sfc_main$2),{tag:"h3",variant:"heading-3"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)({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}),o.createVNode(o.unref(i._sfc_main$2),{variant:"body-xs",shade:"lighter"},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)({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:o.withCtx(()=>[o.createVNode(o.unref(i._sfc_main$2H),{size:"sm",variant:"ghost",color:"gray","icon-suffix":"arrow_right_alt",type:"button",onClick:a[0]||(a[0]=e=>t.$emit("view-all-subscriptions"))},{default:o.withCtx(()=>[o.createTextVNode(o.toDisplayString(o.unref(n)({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=o.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}=s.useActionDispatchProvider();return(i,s)=>{var r,c,a,u;return e.isLoading?(o.openBlock(),o.createBlock(n._sfc_main,{key:0,variant:"section",class:"min-h-[100px]","data-testid":"subscriptions-list-skeleton"})):e.customer?(o.openBlock(),o.createBlock(b,{key:1,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,onViewSubscriptionDetails:s[0]||(s[0]=e=>o.unref(t)({action:"view-subscription-details",data:{subscriptionId:e.subscriptionId}})),onViewAllSubscriptions:s[1]||(s[1]=e=>o.unref(t)({action:"view-all-subscriptions"})),onCancelSubscription:s[2]||(s[2]=e=>o.unref(t)({action:"cancel-subscription",data:{subscriptionId:e.subscriptionId}})),onRenewSubscription:s[3]||(s[3]=e=>o.unref(t)({action:"renew-subscription",data:{subscriptionId:e.subscriptionId}})),onLoadMore:s[4]||(s[4]=e=>i.$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"])):o.createCommentVNode("",!0)}}});exports._sfc_main=m,exports.useSubscriptionsList=function({customerId:o,batchSize:i=15}){const n=t.createSubscriptionsService();return e.useIncrementalLoading({service:async e=>n.getActiveSubscriptions({customerId:o,pagination:{page:e,pageSize:i}})})};
|