@tesouro/embedded-components-react 0.11.180 → 0.11.181
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/index.css +22 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js +14 -17
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js +82 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.js +47 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index13.js +261 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index14.js +23 -251
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index15.js +450 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +286 -442
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +4 -300
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index18.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index19.js +37 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index20.js +1 -38
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index5.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index7.js +88 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index8.js +17 -89
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index9.js +18 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index10.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index18.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index20.js +263 -262
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/mocks/labels.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +7 -5
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AttentionStrip/AttentionStrip.js +29 -0
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AttentionStrip/AttentionViewBar.js +33 -0
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index21.js +0 -1
|
@@ -2,34 +2,459 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { toast as e } from "../../../../../../node_modules/sonner/dist/index.js";
|
|
6
|
+
import { formatCalendarDate as t } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
7
|
+
import { formatMoneyExact as n } from "../../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
8
|
+
import "../../../../shared/util/dist/index.js";
|
|
9
|
+
import { useEmbedApi as r } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
10
|
+
import "../../../../shared/ui/dist/index.js";
|
|
11
|
+
import { useLocalCalendarDay as i } from "../../../../shared/feature/dist/lib/calendar/useLocalCalendarDay.js";
|
|
12
|
+
import "../../../../shared/feature/dist/index.js";
|
|
13
|
+
import { DuplicateVerdict as a } from "../../../util/dist/lib/duplicateVerdict.js";
|
|
14
|
+
import { formatScheduledDateLabel as o } from "../../../util/dist/lib/formatScheduledDateLabel.js";
|
|
15
|
+
import { hasSuspectedPayableDuplicate as s, suspectedPayableDuplicates as c } from "../../../util/dist/lib/payableDuplicates.js";
|
|
16
|
+
import { compareByArrival as l, duplicateVerdictMatches as u, resolveDuplicateOriginalId as d } from "../../../util/dist/lib/groupDuplicates.js";
|
|
17
|
+
import { isEditablePayableStatus as f } from "../../../util/dist/lib/isEditablePayableStatus.js";
|
|
18
|
+
import { payableRemoval as p } from "../../../util/dist/lib/payableRemoval.js";
|
|
19
|
+
import { resolveBillDueDate as m } from "../../../util/dist/lib/resolveBillDueDate.js";
|
|
20
|
+
import { resolveVendorName as ee } from "../../../util/dist/lib/resolveVendor.js";
|
|
21
|
+
import { buildGroupCollapse as h } from "../../../util/dist/lib/groupCollapse.js";
|
|
6
22
|
import "../../../util/dist/index.js";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "
|
|
10
|
-
import {
|
|
23
|
+
import { derivePayableStatus as te } from "../../../../shared/document-status/util/dist/lib/derivePayableStatus.js";
|
|
24
|
+
import { useApplyDuplicateVerdictsMutation as g } from "../../../data-access/dist/lib/useApplyDuplicateVerdictsMutation.js";
|
|
25
|
+
import "../../../data-access/dist/index.js";
|
|
26
|
+
import { BillColumn as _ } from "../../ui/dist/index19.js";
|
|
27
|
+
import "../../ui/dist/index.js";
|
|
28
|
+
import { BillQueue as v, DEFAULT_BILL_QUEUE as y, billQueueColumns as b, billQueueFilters as x, billQueueOffersAddPanel as ne, billSortColumnId as re, billSortField as ie } from "./index5.js";
|
|
29
|
+
import { duplicateRemovalPrompt as ae } from "./index10.js";
|
|
30
|
+
import { useBillsFilters as oe } from "./index13.js";
|
|
31
|
+
import { BillVendorLookup as se, useBillVendorNames as ce } from "./index14.js";
|
|
32
|
+
import { useFirstPayablesPagesQuery as le } from "../../data-access/dist/index2.js";
|
|
33
|
+
import { usePayablesQuery as ue } from "../../data-access/dist/index4.js";
|
|
34
|
+
import { usePayablesTotalCountQuery as de } from "../../data-access/dist/index5.js";
|
|
35
|
+
import "../../data-access/dist/index.js";
|
|
36
|
+
import { useCallback as S, useEffect as fe, useMemo as C, useState as w } from "react";
|
|
37
|
+
import { BanIcon as pe, FileCheckIcon as me, Trash2Icon as he } from "lucide-react";
|
|
11
38
|
// ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index15.js
|
|
12
|
-
var
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
39
|
+
var ge = 10, T = 100, _e = 3, ve = [{
|
|
40
|
+
id: "addedOnLabel",
|
|
41
|
+
desc: !0
|
|
42
|
+
}], E = {
|
|
43
|
+
AllBills: "allBills",
|
|
44
|
+
PossibleDuplicates: "possibleDuplicates"
|
|
45
|
+
};
|
|
46
|
+
function ye(e, t) {
|
|
47
|
+
let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = (e) => {
|
|
48
|
+
r.has(e) || r.set(e, /* @__PURE__ */ new Set());
|
|
49
|
+
}, a = (e, t) => {
|
|
50
|
+
i(e), i(t), r.get(e)?.add(t), r.get(t)?.add(e);
|
|
51
|
+
};
|
|
52
|
+
for (let t of e) {
|
|
53
|
+
let e = c(t);
|
|
54
|
+
if (e.length !== 0) {
|
|
55
|
+
i(t.id);
|
|
56
|
+
for (let n of e) a(t.id, n.matched_payable_id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
let o = [], s = /* @__PURE__ */ new Set();
|
|
60
|
+
for (let e of r.keys()) {
|
|
61
|
+
if (s.has(e)) continue;
|
|
62
|
+
let i = [], a = [e];
|
|
63
|
+
for (s.add(e); a.length > 0;) {
|
|
64
|
+
let e = a.pop();
|
|
65
|
+
n.has(e) && i.push(e);
|
|
66
|
+
for (let t of r.get(e) ?? []) s.has(t) || (s.add(t), a.push(t));
|
|
67
|
+
}
|
|
68
|
+
if (i.length === 0) continue;
|
|
69
|
+
let c = i.map((e) => n.get(e)).filter((e) => !!e).sort(l), u = d(c), [f] = c, p = ee(f), m = f?.document_id ?? "", h = u ?? f?.id ?? e, te = `duplicate-group:${p || m ? `${p}|${m}` : h}`;
|
|
70
|
+
o.push({
|
|
71
|
+
componentIds: i,
|
|
72
|
+
baseKey: te,
|
|
73
|
+
anchorId: h,
|
|
74
|
+
group: {
|
|
75
|
+
label: t.groupHeader({
|
|
76
|
+
vendorLabel: p,
|
|
77
|
+
invoiceNumberLabel: m
|
|
78
|
+
}),
|
|
79
|
+
title: p,
|
|
80
|
+
meta: m ? t.groupInvoice(m) : void 0,
|
|
81
|
+
invoiceNumberLabel: m,
|
|
82
|
+
vendorCounterpartId: f?.counterpart_id ?? void 0,
|
|
83
|
+
originalPayableId: u
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
let u = /* @__PURE__ */ new Map();
|
|
88
|
+
for (let { baseKey: e } of o) u.set(e, (u.get(e) ?? 0) + 1);
|
|
89
|
+
let f = /* @__PURE__ */ new Map();
|
|
90
|
+
for (let { componentIds: e, baseKey: t, anchorId: n, group: r } of o) {
|
|
91
|
+
let i = (u.get(t) ?? 0) > 1 ? `${t}:${n}` : t, a = {
|
|
92
|
+
...r,
|
|
93
|
+
key: i
|
|
94
|
+
};
|
|
95
|
+
for (let t of e) f.set(t, a);
|
|
96
|
+
}
|
|
97
|
+
return f;
|
|
98
|
+
}
|
|
99
|
+
function be({ enabled: c = !0, canPay: d, canReadVendors: h = !0, isVendorFilterPaused: se = !1, filterLabels: be, onOpenBill: we, duplicateRowNote: Te, attachmentLabel: Ee, duplicateGroupLabels: D, canManageDuplicates: De = !1, duplicateView: O = E.AllBills, scheduledRelativeDayLabels: Oe, dueDateLabels: ke }) {
|
|
100
|
+
let k = i(), [A, Ae] = w(y), [je, Me] = w(ve), [j, Ne] = w(ge), [Pe, M] = w(), [Fe, Ie] = w(d);
|
|
101
|
+
d !== void 0 && Fe !== d && (Ie(d), M(void 0));
|
|
102
|
+
let Le = d ?? Fe, [Re, ze] = w(0), [N, Be] = w(""), [P, Ve] = w(""), [F, He] = w(), [I, Ue] = w(), L = S(() => {
|
|
103
|
+
M(void 0), ze(0);
|
|
104
|
+
}, []);
|
|
105
|
+
fe(() => {
|
|
106
|
+
if (N === P) return;
|
|
107
|
+
let e = setTimeout(() => {
|
|
108
|
+
Ve(N), L();
|
|
109
|
+
}, 300);
|
|
110
|
+
return () => clearTimeout(e);
|
|
111
|
+
}, [
|
|
112
|
+
N,
|
|
113
|
+
P,
|
|
114
|
+
L
|
|
115
|
+
]), fe(() => {
|
|
116
|
+
L();
|
|
117
|
+
}, [O, L]);
|
|
118
|
+
let R = O === E.PossibleDuplicates, z = oe({
|
|
119
|
+
offersStatusFilter: A === v.All && !R,
|
|
120
|
+
offersVendorFilter: h,
|
|
121
|
+
isVendorFilterPaused: se,
|
|
122
|
+
labels: be,
|
|
123
|
+
onFiltersChange: L
|
|
124
|
+
}), { clearAll: We, filterByVendor: Ge } = z, Ke = je[0], qe = ie(Ke?.id), Je = qe ? Ke?.desc ? "desc" : "asc" : void 0, B = R ? v.All : A, Ye = C(() => {
|
|
125
|
+
let e = x(B, Le ?? !1);
|
|
126
|
+
return {
|
|
127
|
+
...z.query,
|
|
128
|
+
...e,
|
|
129
|
+
limit: R ? T : j,
|
|
130
|
+
pagination_token: R ? void 0 : Pe,
|
|
131
|
+
status__in: R ? void 0 : e.status__in ?? z.query.status__in,
|
|
132
|
+
duplicate_match_status: R ? "suspected" : void 0,
|
|
133
|
+
counterpart_name__icontains: P || void 0,
|
|
134
|
+
sort: qe,
|
|
135
|
+
order: Je
|
|
136
|
+
};
|
|
137
|
+
}, [
|
|
138
|
+
z.query,
|
|
139
|
+
j,
|
|
140
|
+
Pe,
|
|
141
|
+
R,
|
|
142
|
+
B,
|
|
143
|
+
Le,
|
|
144
|
+
P,
|
|
145
|
+
qe,
|
|
146
|
+
Je
|
|
147
|
+
]), { organizationId: Xe } = r(), V = JSON.stringify([Xe, Ye]), H = ue({
|
|
148
|
+
...Ye,
|
|
149
|
+
enabled: c && d !== void 0 && !R,
|
|
150
|
+
pollWhileOcrProcessing: !0
|
|
151
|
+
}), U = le({
|
|
152
|
+
...Ye,
|
|
153
|
+
enabled: c && R,
|
|
154
|
+
maxPages: _e
|
|
155
|
+
}), W = R ? {
|
|
156
|
+
...U,
|
|
157
|
+
data: { data: U.payables },
|
|
158
|
+
isLoading: U.isResolving,
|
|
159
|
+
isFetching: U.isFetching || U.isResolving
|
|
160
|
+
} : H, G = (W.data?.data ?? []).filter((e) => e.ocr_status !== "processing"), K = g(), q = S(async (t, n, r, i) => {
|
|
161
|
+
let a = u(t, n, i);
|
|
162
|
+
if (a.length) try {
|
|
163
|
+
await K.mutateAsync({
|
|
164
|
+
verdict: n,
|
|
165
|
+
targets: a.map((e) => ({
|
|
166
|
+
payableId: t.id,
|
|
167
|
+
duplicateId: e.id,
|
|
168
|
+
matchedPayableId: e.matched_payable_id,
|
|
169
|
+
removeBy: p(t.status)
|
|
170
|
+
}))
|
|
171
|
+
}), e.success(r);
|
|
172
|
+
} catch {
|
|
173
|
+
e.error(D.actionFailedToast);
|
|
174
|
+
}
|
|
175
|
+
}, [K, D.actionFailedToast]), J = C(() => ({
|
|
176
|
+
delete: {
|
|
177
|
+
action: D.deleteAction,
|
|
178
|
+
title: D.deleteConfirmTitle,
|
|
179
|
+
description: D.deleteConfirmDescription,
|
|
180
|
+
confirmButton: D.deleteConfirmButton,
|
|
181
|
+
backButton: D.cancelConfirmBackButton,
|
|
182
|
+
toast: D.deletedToast
|
|
183
|
+
},
|
|
184
|
+
cancel: {
|
|
185
|
+
action: D.cancelAction,
|
|
186
|
+
title: D.cancelConfirmTitle,
|
|
187
|
+
description: D.cancelConfirmDescription,
|
|
188
|
+
confirmButton: D.cancelConfirmButton,
|
|
189
|
+
backButton: D.cancelConfirmBackButton,
|
|
190
|
+
toast: D.cancelledToast
|
|
191
|
+
},
|
|
192
|
+
confirm: {
|
|
193
|
+
action: D.confirmAction,
|
|
194
|
+
title: D.confirmDuplicateTitle,
|
|
195
|
+
description: D.confirmDuplicateDescription,
|
|
196
|
+
confirmButton: D.confirmDuplicateButton,
|
|
197
|
+
backButton: D.cancelConfirmBackButton,
|
|
198
|
+
toast: D.confirmedToast
|
|
199
|
+
}
|
|
200
|
+
}), [D]), Ze = F?.removeBy ?? "cancel", Qe = S(async () => {
|
|
201
|
+
F && (await q(F.payable, a.Remove, J[F.removeBy].toast), He(void 0));
|
|
202
|
+
}, [
|
|
203
|
+
q,
|
|
204
|
+
F,
|
|
205
|
+
J
|
|
206
|
+
]), $e = S(async () => {
|
|
207
|
+
I && (await q(I.payable, a.Keep, D.dismissedToast, I.originalPayableId), Ue(void 0));
|
|
208
|
+
}, [
|
|
209
|
+
q,
|
|
210
|
+
D.dismissedToast,
|
|
211
|
+
I
|
|
212
|
+
]), [et, tt] = w(V);
|
|
213
|
+
fe(() => {
|
|
214
|
+
W.isFetching || tt(V);
|
|
215
|
+
}, [W.isFetching, V]);
|
|
216
|
+
let nt = W.data?.data.length, rt = nt === 0, it = de({ enabled: c && rt }), at = !rt || (it.data?.count ?? 1) > 0, Y = C(() => O === E.PossibleDuplicates ? ye(G, D) : /* @__PURE__ */ new Map(), [
|
|
217
|
+
O,
|
|
218
|
+
G,
|
|
219
|
+
D
|
|
220
|
+
]), ot = C(() => {
|
|
221
|
+
if (Y.size === 0) return G;
|
|
222
|
+
let e = /* @__PURE__ */ new Map();
|
|
223
|
+
return G.forEach((t, n) => {
|
|
224
|
+
let r = Y.get(t.id)?.key;
|
|
225
|
+
r !== void 0 && !e.has(r) && e.set(r, n);
|
|
226
|
+
}), G.map((t, n) => ({
|
|
227
|
+
payable: t,
|
|
228
|
+
index: n,
|
|
229
|
+
order: e.get(Y.get(t.id)?.key ?? "") ?? n
|
|
230
|
+
})).sort((e, t) => e.order - t.order || l(e.payable, t.payable) || e.index - t.index).map(({ payable: e }) => e);
|
|
231
|
+
}, [G, Y]), { vendorNames: X, lookup: st } = ce({
|
|
232
|
+
payables: W.data?.data,
|
|
233
|
+
enabled: c,
|
|
234
|
+
canReadVendors: h,
|
|
235
|
+
isPaused: se
|
|
236
|
+
}), ct = S((e) => {
|
|
237
|
+
let t = e.title || (e.vendorCounterpartId ? X.get(e.vendorCounterpartId) ?? "" : "");
|
|
238
|
+
return {
|
|
239
|
+
key: e.key,
|
|
240
|
+
label: t === e.title ? e.label : D.groupHeader({
|
|
241
|
+
vendorLabel: t,
|
|
242
|
+
invoiceNumberLabel: e.invoiceNumberLabel
|
|
243
|
+
}),
|
|
244
|
+
title: t,
|
|
245
|
+
meta: e.meta
|
|
246
|
+
};
|
|
247
|
+
}, [X, D]), Z = C(() => xe(ot.map((e) => {
|
|
248
|
+
let r = te({
|
|
249
|
+
apiStatus: e.status,
|
|
250
|
+
dueDate: e.due_date,
|
|
251
|
+
scheduledPaymentDate: e.scheduled_payment_date
|
|
252
|
+
}), i = e.amount_due ?? e.total_amount, a = e.status === "partially_paid" || e.status === "paid", c = (t) => t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" }), l = o(e.scheduled_payment_date, Oe, k), u = m({
|
|
253
|
+
status: e.status,
|
|
254
|
+
dueDate: e.due_date,
|
|
255
|
+
today: k,
|
|
256
|
+
isScheduled: r.status === "scheduled",
|
|
257
|
+
labels: ke
|
|
258
|
+
}), d = Y.get(e.id), h = s(e), g = ee(e) || (e.counterpart_id ? X.get(e.counterpart_id) ?? "" : ""), _ = e.document_id ?? "", y = p(e.status), b = d?.originalPayableId !== void 0 && d.originalPayableId === e.id, x = R && h && De && d ? {
|
|
259
|
+
triggerLabel: D.menuTrigger({
|
|
260
|
+
vendorLabel: g,
|
|
261
|
+
invoiceNumberLabel: _
|
|
262
|
+
}),
|
|
263
|
+
items: [{
|
|
264
|
+
id: "not-duplicate",
|
|
265
|
+
label: D.notDuplicateAction,
|
|
266
|
+
icon: me,
|
|
267
|
+
disabled: K.isPending,
|
|
268
|
+
onSelect: () => Ue({
|
|
269
|
+
payable: e,
|
|
270
|
+
originalPayableId: b ? void 0 : d.originalPayableId
|
|
271
|
+
})
|
|
272
|
+
}, ...y ? [{
|
|
273
|
+
id: "cancel-duplicate",
|
|
274
|
+
label: J[y].action,
|
|
275
|
+
icon: y === "delete" ? he : pe,
|
|
276
|
+
disabled: K.isPending,
|
|
277
|
+
onSelect: () => He({
|
|
278
|
+
payable: e,
|
|
279
|
+
removeBy: y
|
|
280
|
+
})
|
|
281
|
+
}] : []]
|
|
282
|
+
} : void 0;
|
|
283
|
+
return {
|
|
284
|
+
rowKey: e.id,
|
|
285
|
+
vendorLabel: g,
|
|
286
|
+
vendorLookup: g || !e.counterpart_id ? void 0 : Ce(st),
|
|
287
|
+
invoiceNumberLabel: _,
|
|
288
|
+
issueDateLabel: t(e.issued_at),
|
|
289
|
+
dueDateLabel: u.label,
|
|
290
|
+
dueDateOverdueLabel: u.overdueLabel,
|
|
291
|
+
dueDateAccessibleLabel: u.accessibleLabel,
|
|
292
|
+
scheduledDateLabel: l.label,
|
|
293
|
+
scheduledDateExact: l.absoluteLabel,
|
|
294
|
+
scheduledDateIsGap: B === v.Scheduled,
|
|
295
|
+
paidDateLabel: t(e.paid_at?.slice(0, 10)),
|
|
296
|
+
amountDueLabel: c(i),
|
|
297
|
+
amountPaidLabel: a ? c(e.amount_paid) : "",
|
|
298
|
+
amountPaidIsGap: B === v.Paid,
|
|
299
|
+
amountScheduledLabel: c(e.amount_to_pay ?? i),
|
|
300
|
+
totalAmountLabel: c(e.total_amount),
|
|
301
|
+
attachment: e.file_id ? { label: Ee } : void 0,
|
|
302
|
+
status: r.status,
|
|
303
|
+
statusTone: r.tone,
|
|
304
|
+
addedOnLabel: t(e.created_at?.slice(0, 10)),
|
|
305
|
+
...d ? { group: ct(d) } : {},
|
|
306
|
+
...x ? { menu: x } : {},
|
|
307
|
+
...!R && !d && h ? {
|
|
308
|
+
marker: "duplicate",
|
|
309
|
+
rowNote: Te
|
|
310
|
+
} : {},
|
|
311
|
+
onOpen: () => we(e.id, f(e.status))
|
|
312
|
+
};
|
|
313
|
+
}), D), [
|
|
314
|
+
ot,
|
|
315
|
+
Y,
|
|
316
|
+
D,
|
|
317
|
+
J,
|
|
318
|
+
K.isPending,
|
|
319
|
+
De,
|
|
320
|
+
R,
|
|
321
|
+
Te,
|
|
322
|
+
Ee,
|
|
323
|
+
Oe,
|
|
324
|
+
ke,
|
|
325
|
+
k,
|
|
326
|
+
we,
|
|
327
|
+
B,
|
|
328
|
+
X,
|
|
329
|
+
st,
|
|
330
|
+
ct
|
|
331
|
+
]), lt = C(() => R ? Se(Z, T) : [], [Z, R]), Q = Math.min(Re, Math.max(0, lt.length - 1)), ut = R ? lt[Q] ?? [] : Z, $ = S((e) => {
|
|
332
|
+
let t = e;
|
|
333
|
+
Ae(t), Me((e) => {
|
|
334
|
+
let n = e[0]?.id;
|
|
335
|
+
return n ? b(t).some((e) => re(e) === n) ? e : ve : e;
|
|
336
|
+
}), L();
|
|
337
|
+
}, [L]), dt = S((e) => {
|
|
338
|
+
$(v.All), Be(""), Ge(e);
|
|
339
|
+
}, [Ge, $]), ft = S(() => {
|
|
340
|
+
Be(""), Ve(""), We(), L();
|
|
341
|
+
}, [We, L]), pt = S((e) => {
|
|
342
|
+
Me((t) => typeof e == "function" ? e(t) : e), L();
|
|
343
|
+
}, [L]), mt = S((e) => {
|
|
344
|
+
Ne(e), L();
|
|
345
|
+
}, [L]), ht = S(() => {
|
|
346
|
+
R ? ze(Q + 1) : M(H.data?.next_pagination_token ?? void 0);
|
|
347
|
+
}, [
|
|
348
|
+
Q,
|
|
349
|
+
R,
|
|
350
|
+
H.data?.next_pagination_token
|
|
351
|
+
]), gt = S(() => {
|
|
352
|
+
R ? ze(Math.max(0, Q - 1)) : M(H.data?.prev_pagination_token ?? void 0);
|
|
353
|
+
}, [
|
|
354
|
+
Q,
|
|
355
|
+
R,
|
|
356
|
+
H.data?.prev_pagination_token
|
|
357
|
+
]), _t = S(() => {
|
|
358
|
+
W.refetch();
|
|
359
|
+
}, [W.refetch]);
|
|
22
360
|
return {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
361
|
+
rows: ut,
|
|
362
|
+
isLoading: W.isLoading || !R && Le === void 0 || V !== et || rt && it.isLoading || (nt ?? 0) > 0 && ut.length === 0,
|
|
363
|
+
isError: W.isError,
|
|
364
|
+
onRetry: _t,
|
|
365
|
+
selectedFilterTabId: A,
|
|
366
|
+
onFilterTabChange: $,
|
|
367
|
+
showVendorBills: dt,
|
|
368
|
+
clearQueryConstraints: ft,
|
|
369
|
+
searchValue: N,
|
|
370
|
+
onSearchChange: Be,
|
|
371
|
+
hasAnyBills: at,
|
|
372
|
+
isSearchActive: P.length > 0 || z.isFilterActive,
|
|
373
|
+
filterBarProps: z.filterBarProps,
|
|
374
|
+
visibleColumns: R ? [
|
|
375
|
+
_.AddedOn,
|
|
376
|
+
_.DueDate,
|
|
377
|
+
_.AmountDue,
|
|
378
|
+
_.Status
|
|
379
|
+
] : b(A),
|
|
380
|
+
keepsColumnOrder: R,
|
|
381
|
+
isSortable: !R,
|
|
382
|
+
pageInfo: R ? D.pageInfo({
|
|
383
|
+
billCount: Z.length,
|
|
384
|
+
invoiceCount: new Set(Z.map((e) => e.group?.key ?? e.rowKey)).size
|
|
385
|
+
}) : void 0,
|
|
386
|
+
showAddPanelWhenEmpty: !R && ne(A),
|
|
387
|
+
sorting: je,
|
|
388
|
+
onSortingChange: pt,
|
|
389
|
+
pageSize: R ? T : j,
|
|
390
|
+
pageSizeOptions: R ? [T] : void 0,
|
|
391
|
+
onPageSizeChange: mt,
|
|
392
|
+
hasNextPage: R ? Q < lt.length - 1 : !!H.data?.next_pagination_token,
|
|
393
|
+
hasPrevPage: R ? Q > 0 : !!H.data?.prev_pagination_token,
|
|
394
|
+
onNextPage: ht,
|
|
395
|
+
onPrevPage: gt,
|
|
396
|
+
cancelConfirmation: {
|
|
397
|
+
open: !!F,
|
|
398
|
+
copy: ae(J[Ze], Ze),
|
|
399
|
+
onConfirm: () => void Qe(),
|
|
400
|
+
onCancel: () => He(void 0),
|
|
401
|
+
isPending: K.isPending,
|
|
402
|
+
cancelButtonLabel: J[Ze].backButton
|
|
403
|
+
},
|
|
404
|
+
keepConfirmation: {
|
|
405
|
+
open: !!I,
|
|
406
|
+
copy: {
|
|
407
|
+
title: D.notDuplicateConfirmTitle,
|
|
408
|
+
description: D.notDuplicateConfirmDescription,
|
|
409
|
+
confirmButton: D.notDuplicateConfirmButton,
|
|
410
|
+
presentation: {
|
|
411
|
+
alignment: "center",
|
|
412
|
+
icon: me,
|
|
413
|
+
actionWidth: "equal"
|
|
414
|
+
}
|
|
415
|
+
},
|
|
416
|
+
onConfirm: () => void $e(),
|
|
417
|
+
onCancel: () => Ue(void 0),
|
|
418
|
+
isPending: K.isPending,
|
|
419
|
+
cancelButtonLabel: D.notDuplicateConfirmBackButton
|
|
420
|
+
}
|
|
30
421
|
};
|
|
31
422
|
}
|
|
32
|
-
function
|
|
33
|
-
|
|
423
|
+
function xe(e, t) {
|
|
424
|
+
let n = /* @__PURE__ */ new Map();
|
|
425
|
+
for (let t of e) {
|
|
426
|
+
if (!t.group) continue;
|
|
427
|
+
let e = n.get(t.group.key) ?? [];
|
|
428
|
+
e.push(t.status), n.set(t.group.key, e);
|
|
429
|
+
}
|
|
430
|
+
return e.map((e) => {
|
|
431
|
+
if (!e.group) return e;
|
|
432
|
+
let r = h({
|
|
433
|
+
statuses: n.get(e.group.key) ?? [],
|
|
434
|
+
statusLabels: t.statusLabels,
|
|
435
|
+
labels: {
|
|
436
|
+
showMore: t.showMore,
|
|
437
|
+
showLess: t.showLess,
|
|
438
|
+
statusSummary: t.statusSummary
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
return r ? {
|
|
442
|
+
...e,
|
|
443
|
+
group: {
|
|
444
|
+
...e.group,
|
|
445
|
+
collapse: r
|
|
446
|
+
}
|
|
447
|
+
} : e;
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
function Se(e, t) {
|
|
451
|
+
let n = [], r = [];
|
|
452
|
+
return e.forEach((i, a) => {
|
|
453
|
+
let o = i.group !== void 0 && i.group.key === e[a - 1]?.group?.key;
|
|
454
|
+
r.length >= t && !o && (n.push(r), r = []), r.push(i);
|
|
455
|
+
}), r.length && n.push(r), n;
|
|
456
|
+
}
|
|
457
|
+
function Ce(e) {
|
|
458
|
+
return e === se.Settled ? void 0 : e;
|
|
34
459
|
}
|
|
35
|
-
export {
|
|
460
|
+
export { E as BillDuplicateView, be as useBillsTable };
|