@tesouro/embedded-components-react 0.11.226 → 0.11.230

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