@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,168 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createBlock, unref, createSlots, withCtx, createElementBlock, Fragment, renderList, createVNode, createTextVNode, toDisplayString, createCommentVNode } from "vue";
|
|
2
|
+
import { b as useIntl, d as _sfc_main$1g, g as _sfc_main$2, _ as _sfc_main$2$1, m as _sfc_main$2H } from "./component-BkmcE85U.mjs";
|
|
3
|
+
import { _ as _sfc_main$3 } from "./Skeleton.vue_vue_type_script_setup_true_lang-BFFJw-5h.mjs";
|
|
4
|
+
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-CBo_Hwu5.mjs";
|
|
5
|
+
import { c as createPaymentMethodsService } from "./paymentMethods-CrU4G_2Y.mjs";
|
|
6
|
+
import { u as useService } from "./useService-Dz13Nxbi.mjs";
|
|
7
|
+
const _hoisted_1 = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "flex flex-col gap-2"
|
|
10
|
+
};
|
|
11
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
12
|
+
__name: "CustomerPaymentMethodsBlock",
|
|
13
|
+
props: {
|
|
14
|
+
paymentMethods: { type: Array },
|
|
15
|
+
limit: { default: 2, type: Number },
|
|
16
|
+
isLoading: { type: Boolean },
|
|
17
|
+
showViewAllButton: { type: Boolean },
|
|
18
|
+
showAddButton: { type: Boolean }
|
|
19
|
+
},
|
|
20
|
+
emits: ["view-all-payment-methods", "add-payment-method"],
|
|
21
|
+
setup(__props) {
|
|
22
|
+
const props = __props;
|
|
23
|
+
const { $t } = useIntl();
|
|
24
|
+
const hasPaymentMethods = computed(() => props.paymentMethods.length > 0);
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createBlock(unref(_sfc_main$1g), {
|
|
27
|
+
"no-spacing": "",
|
|
28
|
+
"no-border": "",
|
|
29
|
+
title: unref($t)(
|
|
30
|
+
{
|
|
31
|
+
defaultMessage: "{count, plural, one {Payment method} other {Payment methods}}",
|
|
32
|
+
description: "Title for the payment methods block on the customer overview page",
|
|
33
|
+
id: "customer_overview.payment_methods.title"
|
|
34
|
+
},
|
|
35
|
+
{ count: String(__props.paymentMethods.length) }
|
|
36
|
+
)
|
|
37
|
+
}, createSlots({
|
|
38
|
+
default: withCtx(() => [
|
|
39
|
+
hasPaymentMethods.value ? (openBlock(), createElementBlock("div", _hoisted_1, [
|
|
40
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.paymentMethods, (paymentMethod) => {
|
|
41
|
+
return openBlock(), createBlock(unref(_sfc_main$1g), {
|
|
42
|
+
key: paymentMethod.id
|
|
43
|
+
}, {
|
|
44
|
+
default: withCtx(() => [
|
|
45
|
+
createVNode(unref(_sfc_main$2), { "payment-method": paymentMethod }, null, 8, ["payment-method"])
|
|
46
|
+
]),
|
|
47
|
+
_: 2
|
|
48
|
+
}, 1024);
|
|
49
|
+
}), 128))
|
|
50
|
+
])) : (openBlock(), createBlock(unref(_sfc_main$1g), { key: 1 }, {
|
|
51
|
+
default: withCtx(() => [
|
|
52
|
+
createVNode(unref(_sfc_main$2$1), {
|
|
53
|
+
variant: "body-sm",
|
|
54
|
+
shade: "lighter",
|
|
55
|
+
"no-spacing": ""
|
|
56
|
+
}, {
|
|
57
|
+
default: withCtx(() => [
|
|
58
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
59
|
+
defaultMessage: "Add a payment method for recurring invoice payments.",
|
|
60
|
+
description: "Helper text for adding a payment method when no payment methods are configured",
|
|
61
|
+
id: "customer_overview.payment_methods_block.add_payment_method_helper_text"
|
|
62
|
+
})), 1)
|
|
63
|
+
]),
|
|
64
|
+
_: 1
|
|
65
|
+
}),
|
|
66
|
+
__props.showAddButton ? (openBlock(), createBlock(unref(_sfc_main$2H), {
|
|
67
|
+
key: 0,
|
|
68
|
+
class: "mt-4 w-full",
|
|
69
|
+
variant: "outline",
|
|
70
|
+
color: "gray",
|
|
71
|
+
"icon-prefix": "add",
|
|
72
|
+
type: "button",
|
|
73
|
+
onClick: _cache[1] || (_cache[1] = ($event) => _ctx.$emit("add-payment-method"))
|
|
74
|
+
}, {
|
|
75
|
+
default: withCtx(() => [
|
|
76
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
77
|
+
defaultMessage: "Add payment method",
|
|
78
|
+
description: "Text for the add payment method button that is shown when no payment methods have been configured",
|
|
79
|
+
id: "customer_overview.payment_methods_block.add_payment_method_button_label"
|
|
80
|
+
})), 1)
|
|
81
|
+
]),
|
|
82
|
+
_: 1
|
|
83
|
+
})) : createCommentVNode("", true)
|
|
84
|
+
]),
|
|
85
|
+
_: 1
|
|
86
|
+
}))
|
|
87
|
+
]),
|
|
88
|
+
_: 2
|
|
89
|
+
}, [
|
|
90
|
+
__props.showViewAllButton ? {
|
|
91
|
+
name: "right",
|
|
92
|
+
fn: withCtx(() => [
|
|
93
|
+
createVNode(unref(_sfc_main$2H), {
|
|
94
|
+
size: "sm",
|
|
95
|
+
variant: "ghost",
|
|
96
|
+
color: "gray",
|
|
97
|
+
"icon-suffix": "arrow_right_alt",
|
|
98
|
+
type: "button",
|
|
99
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("view-all-payment-methods"))
|
|
100
|
+
}, {
|
|
101
|
+
default: withCtx(() => [
|
|
102
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
103
|
+
defaultMessage: "View all",
|
|
104
|
+
id: "customer_overview.payment_methods_block.view_all_payment_methods_link_label",
|
|
105
|
+
description: "The link text that links to the overview page of the customer invoices"
|
|
106
|
+
})), 1)
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
})
|
|
110
|
+
]),
|
|
111
|
+
key: "0"
|
|
112
|
+
} : void 0
|
|
113
|
+
]), 1032, ["title"]);
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
});
|
|
117
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
118
|
+
__name: "CustomerPaymentMethods",
|
|
119
|
+
props: {
|
|
120
|
+
isLoading: { type: Boolean },
|
|
121
|
+
paymentMethods: { type: Array },
|
|
122
|
+
paymentMethodsOptions: { type: Array },
|
|
123
|
+
maxPaymentMethods: { type: Number },
|
|
124
|
+
configuration: { default: () => ({
|
|
125
|
+
showViewAllButton: true,
|
|
126
|
+
showAddButton: true
|
|
127
|
+
}), type: Object }
|
|
128
|
+
},
|
|
129
|
+
setup(__props) {
|
|
130
|
+
const { dispatchAction } = useActionDispatchProvider();
|
|
131
|
+
return (_ctx, _cache) => {
|
|
132
|
+
var _a, _b;
|
|
133
|
+
return __props.isLoading ? (openBlock(), createBlock(_sfc_main$3, {
|
|
134
|
+
key: 0,
|
|
135
|
+
variant: "section",
|
|
136
|
+
class: "h-72",
|
|
137
|
+
"data-testid": "customer-payment-methods-skeleton"
|
|
138
|
+
})) : (openBlock(), createBlock(_sfc_main$1, {
|
|
139
|
+
key: 1,
|
|
140
|
+
"is-loading": __props.isLoading,
|
|
141
|
+
"payment-methods": __props.paymentMethods,
|
|
142
|
+
"payment-methods-options": __props.paymentMethodsOptions,
|
|
143
|
+
"show-view-all-button": (_a = __props.configuration) == null ? void 0 : _a.showViewAllButton,
|
|
144
|
+
"show-add-button": (_b = __props.configuration) == null ? void 0 : _b.showAddButton,
|
|
145
|
+
onViewAllPaymentMethods: _cache[0] || (_cache[0] = ($event) => unref(dispatchAction)({ action: "view-all-payment-methods" })),
|
|
146
|
+
onAddPaymentMethod: _cache[1] || (_cache[1] = ($event) => unref(dispatchAction)({ action: "add-payment-method" }))
|
|
147
|
+
}, null, 8, ["is-loading", "payment-methods", "payment-methods-options", "show-view-all-button", "show-add-button"]));
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
function useCustomerPaymentMethodOptions({
|
|
152
|
+
customerId,
|
|
153
|
+
amount
|
|
154
|
+
}) {
|
|
155
|
+
const { getPaymentMethodOptions } = createPaymentMethodsService();
|
|
156
|
+
const { data, execute, error, apiStatus, isPending } = useService({
|
|
157
|
+
initialValue: [],
|
|
158
|
+
service: async () => {
|
|
159
|
+
const response = await getPaymentMethodOptions({ customerId, amount });
|
|
160
|
+
return response.flatMap((entry) => entry.options ?? []);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
return { error, apiStatus, items: data, fetch: execute, isPending };
|
|
164
|
+
}
|
|
165
|
+
export {
|
|
166
|
+
_sfc_main as _,
|
|
167
|
+
useCustomerPaymentMethodOptions as u
|
|
168
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./_Uint8Array-DxISR7XF.js"),a=require("./component-Df5eNqYX.js"),t=require("vue"),i=require("./cloneDeep-Hs8Pp07F.js");exports.useIncrementalLoading=function({initialData:n=[],service:u}){const s=t.ref(n),l=t.ref(e.ApiStatus.Initial),o=t.ref(null),r=t.ref(1),c=t.ref(!1),v=t.computed(()=>l.value===e.ApiStatus.Loading),p=async t=>{var i;if(!v.value)try{o.value=null,l.value=e.ApiStatus.Loading;const n=await u(t);if(!a.isApiSuccessCollectionResponse(n))return void(l.value=e.ApiStatus.Done);const v=n;c.value=!!(null==(i=v.links)?void 0:i.next),s.value=[...s.value,...v.data],l.value=e.ApiStatus.Done,r.value=t}catch(n){o.value=n,l.value=e.ApiStatus.Failed}};return{items:t.computed(()=>i.cloneDeep(s.value)),error:o,fetchInitial:async()=>await p(1),fetchMore:async()=>await p(r.value+1),fetchAll:async()=>{o.value=null,l.value=e.ApiStatus.Loading;const t=await a.getPaginatedFullList(async t=>{const i=await u(t);if(!a.isApiSuccessCollectionResponse(i))throw l.value=e.ApiStatus.Failed,new Error("message"in i?i.message:"Request failed");return i});s.value=t.data,l.value=e.ApiStatus.Done},isPending:v,hasNextBatch:c}};
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { A as ApiStatus } from "./_Uint8Array-DHE03FZr.mjs";
|
|
2
|
+
import { i as getPaginatedFullList, j as isApiSuccessCollectionResponse } from "./component-BkmcE85U.mjs";
|
|
3
|
+
import { ref, computed } from "vue";
|
|
4
|
+
import { c as cloneDeep } from "./cloneDeep-sm9cY-u2.mjs";
|
|
5
|
+
function useIncrementalLoading({
|
|
6
|
+
initialData = [],
|
|
7
|
+
service
|
|
8
|
+
}) {
|
|
9
|
+
const items = ref(initialData);
|
|
10
|
+
const status = ref(ApiStatus.Initial);
|
|
11
|
+
const error = ref(null);
|
|
12
|
+
const page = ref(1);
|
|
13
|
+
const hasNextBatch = ref(false);
|
|
14
|
+
const isPending = computed(() => status.value === ApiStatus.Loading);
|
|
15
|
+
const loadPage = async (pageNumber) => {
|
|
16
|
+
var _a;
|
|
17
|
+
if (isPending.value) return;
|
|
18
|
+
try {
|
|
19
|
+
error.value = null;
|
|
20
|
+
status.value = ApiStatus.Loading;
|
|
21
|
+
const response = await service(pageNumber);
|
|
22
|
+
if (!isApiSuccessCollectionResponse(response)) {
|
|
23
|
+
status.value = ApiStatus.Done;
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const successResponse = response;
|
|
27
|
+
hasNextBatch.value = !!((_a = successResponse.links) == null ? void 0 : _a.next);
|
|
28
|
+
items.value = [...items.value, ...successResponse.data];
|
|
29
|
+
status.value = ApiStatus.Done;
|
|
30
|
+
page.value = pageNumber;
|
|
31
|
+
} catch (err) {
|
|
32
|
+
error.value = err;
|
|
33
|
+
status.value = ApiStatus.Failed;
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const fetchAll = async () => {
|
|
37
|
+
error.value = null;
|
|
38
|
+
status.value = ApiStatus.Loading;
|
|
39
|
+
const response = await getPaginatedFullList(async (pageNum) => {
|
|
40
|
+
const response2 = await service(pageNum);
|
|
41
|
+
if (!isApiSuccessCollectionResponse(response2)) {
|
|
42
|
+
status.value = ApiStatus.Failed;
|
|
43
|
+
throw new Error("message" in response2 ? response2.message : "Request failed");
|
|
44
|
+
}
|
|
45
|
+
return response2;
|
|
46
|
+
});
|
|
47
|
+
items.value = response.data;
|
|
48
|
+
status.value = ApiStatus.Done;
|
|
49
|
+
};
|
|
50
|
+
const fetchMore = async () => {
|
|
51
|
+
return await loadPage(page.value + 1);
|
|
52
|
+
};
|
|
53
|
+
const nonMutableItems = computed(() => cloneDeep(items.value));
|
|
54
|
+
const fetchInitial = async () => {
|
|
55
|
+
return await loadPage(1);
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
items: nonMutableItems,
|
|
59
|
+
error,
|
|
60
|
+
fetchInitial,
|
|
61
|
+
fetchMore,
|
|
62
|
+
fetchAll,
|
|
63
|
+
isPending,
|
|
64
|
+
hasNextBatch
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
export {
|
|
68
|
+
useIncrementalLoading as u
|
|
69
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./invoices-8M_3ur_U.js"),t=require("./payments-C3LPk9k9.js"),n=require("vue"),a=require("./index-2jo9BSPM.js");exports.useInvoiceData=function(r){const{getInvoice:c}=e.createInvoicesService(),{getPayments:i}=t.createPaymentsService();return(({getData:e,onError:t,watchValue:r,debounce:c=200})=>{const i=n.ref(),s=n.ref(!0),o=async()=>{try{i.value=await e(r)}catch(n){null==t||t(n)}finally{s.value=!1}};return n.onMounted(async()=>{o(),r&&a.watchDebounced(r,()=>{o()},{debounce:c})}),{data:i,isPending:s}})({getData:async()=>{const[e,t]=await Promise.all([c(r),i(r)]);return{invoice:e,paymentAttempts:t}}})};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { c as createInvoicesService } from "./invoices-C31Wz1Bu.mjs";
|
|
2
|
+
import { c as createPaymentsService } from "./payments-NtWI8KlU.mjs";
|
|
3
|
+
import { ref, onMounted } from "vue";
|
|
4
|
+
import { w as watchDebounced } from "./index-BFZ0dPh9.mjs";
|
|
5
|
+
const useData = ({
|
|
6
|
+
getData,
|
|
7
|
+
onError,
|
|
8
|
+
watchValue,
|
|
9
|
+
debounce = 200
|
|
10
|
+
}) => {
|
|
11
|
+
const data = ref();
|
|
12
|
+
const isPending = ref(true);
|
|
13
|
+
const handleGetData = async () => {
|
|
14
|
+
try {
|
|
15
|
+
data.value = await getData(watchValue);
|
|
16
|
+
} catch (error) {
|
|
17
|
+
onError == null ? void 0 : onError(error);
|
|
18
|
+
} finally {
|
|
19
|
+
isPending.value = false;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
onMounted(async () => {
|
|
23
|
+
void handleGetData();
|
|
24
|
+
if (watchValue) {
|
|
25
|
+
watchDebounced(
|
|
26
|
+
watchValue,
|
|
27
|
+
() => {
|
|
28
|
+
void handleGetData();
|
|
29
|
+
},
|
|
30
|
+
{ debounce }
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
return { data, isPending };
|
|
35
|
+
};
|
|
36
|
+
function useInvoiceData(invoiceId) {
|
|
37
|
+
const { getInvoice } = createInvoicesService();
|
|
38
|
+
const { getPayments } = createPaymentsService();
|
|
39
|
+
return useData({
|
|
40
|
+
getData: async () => {
|
|
41
|
+
const [invoice, paymentAttempts] = await Promise.all([
|
|
42
|
+
getInvoice(invoiceId),
|
|
43
|
+
getPayments(invoiceId)
|
|
44
|
+
]);
|
|
45
|
+
return { invoice, paymentAttempts };
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
export {
|
|
50
|
+
useInvoiceData as u
|
|
51
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("vue"),t=require("./component-Df5eNqYX.js"),i=require("./useActionDispatchProvider-DsIljrhi.js"),o=require("./useIncrementalLoading-D8oKNxX7.js"),n=require("./invoices-8M_3ur_U.js"),a={class:"grid-cols-1 gap-4"},c=["onClick"],r={class:"flex flex-col"},s={class:"mt-2 flex items-center justify-center"},l=e.defineComponent({__name:"InvoiceTable",props:{invoices:{type:Array},isLoading:{type:Boolean},hasMoreItems:{type:Boolean},configuration:{type:Object}},emits:["view-invoice","pay-invoice","load-more"],setup(i){const o=i,{formatDate:n,$t:l}=t.useIntl(),d=e.computed(()=>o.configuration.showPayButton),u=e.computed(()=>o.configuration.showViewButton),f=e.computed(()=>o.hasMoreItems);return(o,m)=>(e.openBlock(),e.createElementBlock("div",a,[e.createVNode(e.unref(t._sfc_main$1y),{striped:"","no-border":"",rounded:"",hoverable:"","stripe-class":"group-odd:bg-gray-50/50"},{default:e.withCtx(()=>[e.createVNode(e.unref(t.TableHead),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t.TableHeadRow),null,{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1r),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Invoice",description:"The title of the invoice number header column of the invoice table",id:"invoice_table.header.invoice_number"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$1r),{class:"hidden md:table-cell"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Date",description:"The title of the invoice date header column of the invoice table",id:"invoice_table.header.date"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$1r),null,{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Amount",description:"The title of the invoice amount header column of the invoice table",id:"invoice_table.header.amount"})),1)]),_:1}),e.createVNode(e.unref(t._sfc_main$1r),{class:"text-right"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Status",description:"The title of the invoice status header column of the invoice table",id:"invoice_table.header.status"})),1)]),_:1})]),_:1})]),_:1}),e.createVNode(e.unref(t.TableBody),null,{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.invoices,i=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1q),{key:i.id},e.createSlots({default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$1p),{"has-padding":"",class:"h-14"},{default:e.withCtx(()=>[e.createElementVNode("div",r,[e.createVNode(e.unref(t._sfc_main$2),{tag:"span",variant:"body-sm",class:"md:hidden"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({date:i.invoice_date,format:"date",offsetType:"offsetted",timezone:i.customer.timezone})),1)]),_:2},1024),e.createVNode(e.unref(t._sfc_main$2),{tag:"span",variant:"body-xs",shade:"lighter"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(i.invoice_number),1)]),_:2},1024)])]),_:2},1024),e.createVNode(e.unref(t._sfc_main$1p),{class:"hidden h-14 md:table-cell"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(n)({date:i.invoice_date,format:"date",offsetType:"offsetted",timezone:i.customer.timezone})),1)]),_:2},1024),e.createVNode(e.unref(t._sfc_main$1p),{class:"h-14"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$2),{tag:"span",weight:"semibold"},{default:e.withCtx(()=>[e.createVNode(e.unref(t._sfc_main$2L),{value:i.invoice_amount_including_tax},null,8,["value"])]),_:2},1024)]),_:2},1024),e.createVNode(e.unref(t._sfc_main$1p),{class:"h-14 text-right"},{default:e.withCtx(()=>[i.paid?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$3),{key:0,color:"green"},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Paid",description:"The label of the chip for paid invoices",id:"invoice_table.chip.paid"})),1)]),_:1})):d.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2H),{key:1,variant:"outline",color:"gray",size:"sm",type:"button",onClick:e.withModifiers(e=>o.$emit("pay-invoice",{invoiceId:i.id}),["stop"])},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Pay",description:"The label for the pay invoice button",id:"customer.invoice_table.pay_invoice_button.label"})),1)]),_:1},8,["onClick"])):e.createCommentVNode("",!0)]),_:2},1024)]),_:2},[u.value?{name:"link",fn:e.withCtx(()=>[e.createElementVNode("button",{type:"button",class:"absolute inset-0 h-full w-full",onClick:e=>o.$emit("view-invoice",{invoiceId:i.id})},null,8,c)]),key:"0"}:void 0]),1024))),128))]),_:1})]),_:1}),e.createElementVNode("div",s,[f.value?(e.openBlock(),e.createBlock(e.unref(t._sfc_main$2H),{key:0,variant:"outline",color:"gray",size:"sm",class:"w-full",loading:i.isLoading,onClick:m[0]||(m[0]=e=>o.$emit("load-more"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(l)({defaultMessage:"Load more",description:"The label for the load more button",id:"invoice_table.button.load_more"})),1)]),_:1},8,["loading"])):e.createCommentVNode("",!0)])]))}}),d=e.defineComponent({__name:"InvoicesList",props:{invoices:{type:Array},isLoading:{type:Boolean},hasMoreItems:{type:Boolean},configuration:{default:()=>({showPayButton:!0,showViewButton:!0,pagination:{batchSize:15,enabled:!0}}),type:Object}},emits:["load-more"],setup(o){const{$t:n}=t.useIntl(),{dispatchAction:a}=i.useActionDispatchProvider();return(i,c)=>(e.openBlock(),e.createBlock(e.unref(t._sfc_main$1g),{"no-border":"",spacing:"none","content-background":"none",title:e.unref(n)({defaultMessage:"Invoices",description:"Invoices list title",id:"invoices_list.title"})},{default:e.withCtx(()=>[e.createVNode(l,{configuration:o.configuration,"has-more-items":o.hasMoreItems,invoices:o.invoices,"is-loading":o.isLoading,onLoadMore:c[0]||(c[0]=e=>i.$emit("load-more")),onViewInvoice:c[1]||(c[1]=t=>e.unref(a)({action:"view-invoice",data:{invoiceId:t.invoiceId}})),onPayInvoice:c[2]||(c[2]=t=>e.unref(a)({action:"pay-invoice",data:{invoiceId:t.invoiceId}}))},null,8,["configuration","has-more-items","invoices","is-loading"])]),_:1},8,["title"]))}});exports._sfc_main=d,exports.useInvoicesList=function({customerId:e,batchSize:t=15}){const i=n.createInvoicesService();return o.useIncrementalLoading({service:async o=>i.getInvoices({customerId:e,pagination:{page:o,pageSize:t}})})};
|
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
import { defineComponent, computed, openBlock, createElementBlock, createVNode, unref, withCtx, createTextVNode, toDisplayString, Fragment, renderList, createBlock, createSlots, createElementVNode, withModifiers, createCommentVNode } from "vue";
|
|
2
|
+
import { b as useIntl, q as _sfc_main$1y, T as TableHead, r as TableHeadRow, t as _sfc_main$1r, v as TableBody, x as _sfc_main$1q, y as _sfc_main$1p, _ as _sfc_main$2, z as _sfc_main$2L, e as _sfc_main$3, m as _sfc_main$2H, d as _sfc_main$1g } from "./component-BkmcE85U.mjs";
|
|
3
|
+
import { u as useActionDispatchProvider } from "./useActionDispatchProvider-CBo_Hwu5.mjs";
|
|
4
|
+
import { u as useIncrementalLoading } from "./useIncrementalLoading-fHCizCSo.mjs";
|
|
5
|
+
import { c as createInvoicesService } from "./invoices-C31Wz1Bu.mjs";
|
|
6
|
+
const _hoisted_1 = { class: "grid-cols-1 gap-4" };
|
|
7
|
+
const _hoisted_2 = ["onClick"];
|
|
8
|
+
const _hoisted_3 = { class: "flex flex-col" };
|
|
9
|
+
const _hoisted_4 = { class: "mt-2 flex items-center justify-center" };
|
|
10
|
+
const _sfc_main$1 = /* @__PURE__ */ defineComponent({
|
|
11
|
+
__name: "InvoiceTable",
|
|
12
|
+
props: {
|
|
13
|
+
invoices: { type: Array },
|
|
14
|
+
isLoading: { type: Boolean },
|
|
15
|
+
hasMoreItems: { type: Boolean },
|
|
16
|
+
configuration: { type: Object }
|
|
17
|
+
},
|
|
18
|
+
emits: ["view-invoice", "pay-invoice", "load-more"],
|
|
19
|
+
setup(__props) {
|
|
20
|
+
const props = __props;
|
|
21
|
+
const { formatDate, $t } = useIntl();
|
|
22
|
+
const showPayButton = computed(() => props.configuration.showPayButton);
|
|
23
|
+
const showViewButton = computed(() => props.configuration.showViewButton);
|
|
24
|
+
const showLoadMoreButton = computed(() => props.hasMoreItems);
|
|
25
|
+
return (_ctx, _cache) => {
|
|
26
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
27
|
+
createVNode(unref(_sfc_main$1y), {
|
|
28
|
+
striped: "",
|
|
29
|
+
"no-border": "",
|
|
30
|
+
rounded: "",
|
|
31
|
+
hoverable: "",
|
|
32
|
+
"stripe-class": "group-odd:bg-gray-50/50"
|
|
33
|
+
}, {
|
|
34
|
+
default: withCtx(() => [
|
|
35
|
+
createVNode(unref(TableHead), null, {
|
|
36
|
+
default: withCtx(() => [
|
|
37
|
+
createVNode(unref(TableHeadRow), null, {
|
|
38
|
+
default: withCtx(() => [
|
|
39
|
+
createVNode(unref(_sfc_main$1r), null, {
|
|
40
|
+
default: withCtx(() => [
|
|
41
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
42
|
+
defaultMessage: "Invoice",
|
|
43
|
+
description: "The title of the invoice number header column of the invoice table",
|
|
44
|
+
id: "invoice_table.header.invoice_number"
|
|
45
|
+
})), 1)
|
|
46
|
+
]),
|
|
47
|
+
_: 1
|
|
48
|
+
}),
|
|
49
|
+
createVNode(unref(_sfc_main$1r), { class: "hidden md:table-cell" }, {
|
|
50
|
+
default: withCtx(() => [
|
|
51
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
52
|
+
defaultMessage: "Date",
|
|
53
|
+
description: "The title of the invoice date header column of the invoice table",
|
|
54
|
+
id: "invoice_table.header.date"
|
|
55
|
+
})), 1)
|
|
56
|
+
]),
|
|
57
|
+
_: 1
|
|
58
|
+
}),
|
|
59
|
+
createVNode(unref(_sfc_main$1r), null, {
|
|
60
|
+
default: withCtx(() => [
|
|
61
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
62
|
+
defaultMessage: "Amount",
|
|
63
|
+
description: "The title of the invoice amount header column of the invoice table",
|
|
64
|
+
id: "invoice_table.header.amount"
|
|
65
|
+
})), 1)
|
|
66
|
+
]),
|
|
67
|
+
_: 1
|
|
68
|
+
}),
|
|
69
|
+
createVNode(unref(_sfc_main$1r), { class: "text-right" }, {
|
|
70
|
+
default: withCtx(() => [
|
|
71
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
72
|
+
defaultMessage: "Status",
|
|
73
|
+
description: "The title of the invoice status header column of the invoice table",
|
|
74
|
+
id: "invoice_table.header.status"
|
|
75
|
+
})), 1)
|
|
76
|
+
]),
|
|
77
|
+
_: 1
|
|
78
|
+
})
|
|
79
|
+
]),
|
|
80
|
+
_: 1
|
|
81
|
+
})
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
}),
|
|
85
|
+
createVNode(unref(TableBody), null, {
|
|
86
|
+
default: withCtx(() => [
|
|
87
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(__props.invoices, (invoice) => {
|
|
88
|
+
return openBlock(), createBlock(unref(_sfc_main$1q), {
|
|
89
|
+
key: invoice.id
|
|
90
|
+
}, createSlots({
|
|
91
|
+
default: withCtx(() => [
|
|
92
|
+
createVNode(unref(_sfc_main$1p), {
|
|
93
|
+
"has-padding": "",
|
|
94
|
+
class: "h-14"
|
|
95
|
+
}, {
|
|
96
|
+
default: withCtx(() => [
|
|
97
|
+
createElementVNode("div", _hoisted_3, [
|
|
98
|
+
createVNode(unref(_sfc_main$2), {
|
|
99
|
+
tag: "span",
|
|
100
|
+
variant: "body-sm",
|
|
101
|
+
class: "md:hidden"
|
|
102
|
+
}, {
|
|
103
|
+
default: withCtx(() => [
|
|
104
|
+
createTextVNode(toDisplayString(unref(formatDate)({
|
|
105
|
+
date: invoice.invoice_date,
|
|
106
|
+
format: "date",
|
|
107
|
+
offsetType: "offsetted",
|
|
108
|
+
timezone: invoice.customer.timezone
|
|
109
|
+
})), 1)
|
|
110
|
+
]),
|
|
111
|
+
_: 2
|
|
112
|
+
}, 1024),
|
|
113
|
+
createVNode(unref(_sfc_main$2), {
|
|
114
|
+
tag: "span",
|
|
115
|
+
variant: "body-xs",
|
|
116
|
+
shade: "lighter"
|
|
117
|
+
}, {
|
|
118
|
+
default: withCtx(() => [
|
|
119
|
+
createTextVNode(toDisplayString(invoice.invoice_number), 1)
|
|
120
|
+
]),
|
|
121
|
+
_: 2
|
|
122
|
+
}, 1024)
|
|
123
|
+
])
|
|
124
|
+
]),
|
|
125
|
+
_: 2
|
|
126
|
+
}, 1024),
|
|
127
|
+
createVNode(unref(_sfc_main$1p), { class: "hidden h-14 md:table-cell" }, {
|
|
128
|
+
default: withCtx(() => [
|
|
129
|
+
createTextVNode(toDisplayString(unref(formatDate)({
|
|
130
|
+
date: invoice.invoice_date,
|
|
131
|
+
format: "date",
|
|
132
|
+
offsetType: "offsetted",
|
|
133
|
+
timezone: invoice.customer.timezone
|
|
134
|
+
})), 1)
|
|
135
|
+
]),
|
|
136
|
+
_: 2
|
|
137
|
+
}, 1024),
|
|
138
|
+
createVNode(unref(_sfc_main$1p), { class: "h-14" }, {
|
|
139
|
+
default: withCtx(() => [
|
|
140
|
+
createVNode(unref(_sfc_main$2), {
|
|
141
|
+
tag: "span",
|
|
142
|
+
weight: "semibold"
|
|
143
|
+
}, {
|
|
144
|
+
default: withCtx(() => [
|
|
145
|
+
createVNode(unref(_sfc_main$2L), {
|
|
146
|
+
value: invoice.invoice_amount_including_tax
|
|
147
|
+
}, null, 8, ["value"])
|
|
148
|
+
]),
|
|
149
|
+
_: 2
|
|
150
|
+
}, 1024)
|
|
151
|
+
]),
|
|
152
|
+
_: 2
|
|
153
|
+
}, 1024),
|
|
154
|
+
createVNode(unref(_sfc_main$1p), { class: "h-14 text-right" }, {
|
|
155
|
+
default: withCtx(() => [
|
|
156
|
+
invoice.paid ? (openBlock(), createBlock(unref(_sfc_main$3), {
|
|
157
|
+
key: 0,
|
|
158
|
+
color: "green"
|
|
159
|
+
}, {
|
|
160
|
+
default: withCtx(() => [
|
|
161
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
162
|
+
defaultMessage: "Paid",
|
|
163
|
+
description: "The label of the chip for paid invoices",
|
|
164
|
+
id: "invoice_table.chip.paid"
|
|
165
|
+
})), 1)
|
|
166
|
+
]),
|
|
167
|
+
_: 1
|
|
168
|
+
})) : showPayButton.value ? (openBlock(), createBlock(unref(_sfc_main$2H), {
|
|
169
|
+
key: 1,
|
|
170
|
+
variant: "outline",
|
|
171
|
+
color: "gray",
|
|
172
|
+
size: "sm",
|
|
173
|
+
type: "button",
|
|
174
|
+
onClick: withModifiers(($event) => _ctx.$emit("pay-invoice", { invoiceId: invoice.id }), ["stop"])
|
|
175
|
+
}, {
|
|
176
|
+
default: withCtx(() => [
|
|
177
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
178
|
+
defaultMessage: "Pay",
|
|
179
|
+
description: "The label for the pay invoice button",
|
|
180
|
+
id: "customer.invoice_table.pay_invoice_button.label"
|
|
181
|
+
})), 1)
|
|
182
|
+
]),
|
|
183
|
+
_: 1
|
|
184
|
+
}, 8, ["onClick"])) : createCommentVNode("", true)
|
|
185
|
+
]),
|
|
186
|
+
_: 2
|
|
187
|
+
}, 1024)
|
|
188
|
+
]),
|
|
189
|
+
_: 2
|
|
190
|
+
}, [
|
|
191
|
+
showViewButton.value ? {
|
|
192
|
+
name: "link",
|
|
193
|
+
fn: withCtx(() => [
|
|
194
|
+
createElementVNode("button", {
|
|
195
|
+
type: "button",
|
|
196
|
+
class: "absolute inset-0 h-full w-full",
|
|
197
|
+
onClick: ($event) => _ctx.$emit("view-invoice", { invoiceId: invoice.id })
|
|
198
|
+
}, null, 8, _hoisted_2)
|
|
199
|
+
]),
|
|
200
|
+
key: "0"
|
|
201
|
+
} : void 0
|
|
202
|
+
]), 1024);
|
|
203
|
+
}), 128))
|
|
204
|
+
]),
|
|
205
|
+
_: 1
|
|
206
|
+
})
|
|
207
|
+
]),
|
|
208
|
+
_: 1
|
|
209
|
+
}),
|
|
210
|
+
createElementVNode("div", _hoisted_4, [
|
|
211
|
+
showLoadMoreButton.value ? (openBlock(), createBlock(unref(_sfc_main$2H), {
|
|
212
|
+
key: 0,
|
|
213
|
+
variant: "outline",
|
|
214
|
+
color: "gray",
|
|
215
|
+
size: "sm",
|
|
216
|
+
class: "w-full",
|
|
217
|
+
loading: __props.isLoading,
|
|
218
|
+
onClick: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("load-more"))
|
|
219
|
+
}, {
|
|
220
|
+
default: withCtx(() => [
|
|
221
|
+
createTextVNode(toDisplayString(unref($t)({
|
|
222
|
+
defaultMessage: "Load more",
|
|
223
|
+
description: "The label for the load more button",
|
|
224
|
+
id: "invoice_table.button.load_more"
|
|
225
|
+
})), 1)
|
|
226
|
+
]),
|
|
227
|
+
_: 1
|
|
228
|
+
}, 8, ["loading"])) : createCommentVNode("", true)
|
|
229
|
+
])
|
|
230
|
+
]);
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
const _sfc_main = /* @__PURE__ */ defineComponent({
|
|
235
|
+
__name: "InvoicesList",
|
|
236
|
+
props: {
|
|
237
|
+
invoices: { type: Array },
|
|
238
|
+
isLoading: { type: Boolean },
|
|
239
|
+
hasMoreItems: { type: Boolean },
|
|
240
|
+
configuration: { default: () => ({
|
|
241
|
+
showPayButton: true,
|
|
242
|
+
showViewButton: true,
|
|
243
|
+
pagination: {
|
|
244
|
+
batchSize: 15,
|
|
245
|
+
enabled: true
|
|
246
|
+
}
|
|
247
|
+
}), type: Object }
|
|
248
|
+
},
|
|
249
|
+
emits: ["load-more"],
|
|
250
|
+
setup(__props) {
|
|
251
|
+
const { $t } = useIntl();
|
|
252
|
+
const { dispatchAction } = useActionDispatchProvider();
|
|
253
|
+
return (_ctx, _cache) => {
|
|
254
|
+
return openBlock(), createBlock(unref(_sfc_main$1g), {
|
|
255
|
+
"no-border": "",
|
|
256
|
+
spacing: "none",
|
|
257
|
+
"content-background": "none",
|
|
258
|
+
title: unref($t)({
|
|
259
|
+
defaultMessage: "Invoices",
|
|
260
|
+
description: "Invoices list title",
|
|
261
|
+
id: "invoices_list.title"
|
|
262
|
+
})
|
|
263
|
+
}, {
|
|
264
|
+
default: withCtx(() => [
|
|
265
|
+
createVNode(_sfc_main$1, {
|
|
266
|
+
configuration: __props.configuration,
|
|
267
|
+
"has-more-items": __props.hasMoreItems,
|
|
268
|
+
invoices: __props.invoices,
|
|
269
|
+
"is-loading": __props.isLoading,
|
|
270
|
+
onLoadMore: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("load-more")),
|
|
271
|
+
onViewInvoice: _cache[1] || (_cache[1] = ($event) => unref(dispatchAction)({ action: "view-invoice", data: { invoiceId: $event.invoiceId } })),
|
|
272
|
+
onPayInvoice: _cache[2] || (_cache[2] = ($event) => unref(dispatchAction)({ action: "pay-invoice", data: { invoiceId: $event.invoiceId } }))
|
|
273
|
+
}, null, 8, ["configuration", "has-more-items", "invoices", "is-loading"])
|
|
274
|
+
]),
|
|
275
|
+
_: 1
|
|
276
|
+
}, 8, ["title"]);
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
});
|
|
280
|
+
function useInvoicesList({
|
|
281
|
+
customerId,
|
|
282
|
+
batchSize: pageSize = 15
|
|
283
|
+
}) {
|
|
284
|
+
const invoicesService = createInvoicesService();
|
|
285
|
+
const service = async (page) => invoicesService.getInvoices({
|
|
286
|
+
customerId,
|
|
287
|
+
pagination: { page, pageSize }
|
|
288
|
+
});
|
|
289
|
+
return useIncrementalLoading({ service });
|
|
290
|
+
}
|
|
291
|
+
export {
|
|
292
|
+
_sfc_main as _,
|
|
293
|
+
useInvoicesList as u
|
|
294
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("vue");exports.useLoadInitialData=function(...n){const a=e.ref(!0);return e.onMounted(async()=>{await Promise.all(n).then(()=>{a.value=!1})}),{isLoading:a}};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ref, onMounted } from "vue";
|
|
2
|
+
function useLoadInitialData(...services) {
|
|
3
|
+
const isLoading = ref(true);
|
|
4
|
+
onMounted(async () => {
|
|
5
|
+
await Promise.all(services).then(() => {
|
|
6
|
+
isLoading.value = false;
|
|
7
|
+
});
|
|
8
|
+
});
|
|
9
|
+
return { isLoading };
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
useLoadInitialData as u
|
|
13
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { u as useIncrementalLoading } from "./useIncrementalLoading-fHCizCSo.mjs";
|
|
2
|
+
import { c as createPaymentMethodsService } from "./paymentMethods-CrU4G_2Y.mjs";
|
|
3
|
+
function usePaymentMethods({
|
|
4
|
+
customerId,
|
|
5
|
+
pageSize = 15
|
|
6
|
+
}) {
|
|
7
|
+
const { getPaymentMethods } = createPaymentMethodsService();
|
|
8
|
+
const service = async (page) => getPaymentMethods({
|
|
9
|
+
customerId,
|
|
10
|
+
pagination: { page, pageSize }
|
|
11
|
+
});
|
|
12
|
+
return useIncrementalLoading({ service });
|
|
13
|
+
}
|
|
14
|
+
export {
|
|
15
|
+
usePaymentMethods as u
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=require("./useIncrementalLoading-D8oKNxX7.js"),t=require("./paymentMethods-CzUqDlvc.js");exports.usePaymentMethods=function({customerId:n,pageSize:s=15}){const{getPaymentMethods:a}=t.createPaymentMethodsService();return e.useIncrementalLoading({service:async e=>a({customerId:n,pagination:{page:e,pageSize:s}})})};
|