@tesouro/embedded-components-react 0.11.216 → 0.11.219

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