@tesouro/embedded-components-react 0.5.169 → 0.5.170

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 (129) hide show
  1. package/dist/index.css +39 -17
  2. package/dist/index.js +1 -1
  3. package/dist/lib/BillPayWidget.js +1 -1
  4. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -11
  5. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +95 -80
  6. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +37 -11
  7. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -15
  8. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +56 -67
  9. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +4 -43
  10. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +6 -115
  11. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +202 -63
  12. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -4
  13. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +84 -4
  15. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -84
  16. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
  17. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
  18. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
  19. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +36 -30
  20. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +167 -35
  21. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +40 -164
  22. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -49
  23. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
  24. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
  25. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
  26. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
  27. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
  28. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
  29. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
  30. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +150 -18
  31. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +9 -152
  32. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +25 -9
  33. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +19 -21
  34. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +32 -14
  35. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +14 -39
  36. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +8 -16
  37. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +4 -8
  38. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +98 -4
  39. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +68 -83
  40. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -83
  41. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +143 -3
  42. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +44 -143
  43. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +114 -45
  44. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +189 -111
  45. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +13 -0
  46. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +72 -186
  47. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +31 -76
  48. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +89 -32
  49. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +406 -83
  50. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -411
  51. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +84 -12
  52. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +67 -72
  53. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +222 -73
  54. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +37 -223
  55. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +245 -37
  56. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -23
  57. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +23 -252
  58. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +626 -21
  59. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -586
  60. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +45 -4
  61. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +256 -41
  62. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -263
  63. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +4 -3
  64. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +44 -2
  65. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -46
  66. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +8 -1
  67. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +22 -57
  68. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -6
  69. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +130 -11
  70. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -132
  71. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +6 -3
  72. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +129 -3
  73. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -124
  74. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +7 -8
  75. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +82 -8
  76. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +19 -48
  77. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +20 -21
  78. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +14 -6
  79. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +28 -19
  80. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +82 -27
  81. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +47 -83
  82. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +260 -47
  83. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +24 -251
  84. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +382 -25
  85. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +294 -144
  86. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +4 -223
  87. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +7 -4
  88. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index89.js +112 -5
  89. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +37 -5
  90. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +1 -114
  91. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index91.js +26 -0
  92. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +18 -21
  93. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +126 -10
  94. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +1 -105
  95. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +33 -2
  96. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +7 -28
  97. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +126 -73
  98. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +1 -1
  99. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +11 -30
  100. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +106 -8
  101. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +2 -181
  102. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +10 -2
  103. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index110.js +50 -12
  104. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +2 -108
  105. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +6 -0
  106. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +8 -4
  107. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +8 -1
  108. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +154 -23
  109. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +1 -0
  110. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +343 -250
  111. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +5 -123
  112. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +28 -26
  113. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -94
  114. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +7 -2
  115. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +32 -5
  116. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -30
  117. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +12 -2
  118. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +104 -5
  119. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -34
  120. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +31 -2
  121. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  122. package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
  123. package/dist/packages/shared-ui-shadcn/dist/index.js +2458 -2284
  124. package/package.json +2 -1
  125. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index92.js +0 -27
  126. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +0 -2
  127. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +0 -10
  128. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index114.js +0 -52
  129. package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index115.js +0 -2
@@ -2,34 +2,391 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { useCounterpartsByIdsQuery as e } from "../../../shared/counterpart-management/data-access/dist/index3.js";
6
- import { resolveVendorName as t } from "./index8.js";
7
- import { getCounterpartName as n } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
8
- import "../../../shared/counterpart-management/feature/dist/index.js";
9
- import { useMemo as r } from "react";
5
+ import { toast as e } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { useEmbedApi as t } from "../../../shared/data-access/dist/lib/EmbedApiContext.js";
7
+ import "../../../shared/ui/dist/index.js";
8
+ import { formatCalendarDate as n } from "../../../shared/util/dist/lib/formatCalendarDate.js";
9
+ import { formatMoneyExact as r } from "../../../shared/util/dist/lib/formatMoneyExact.js";
10
+ import { payableRemoval as i } from "./index6.js";
11
+ import { DuplicateVerdict as a, hasSuspectedPayableDuplicate as o, suspectedPayableDuplicates as s, useApplyDuplicateVerdictsMutation as c } from "../../data-access/dist/index7.js";
12
+ import { useFirstPayablesPagesQuery as l, usePayablesQuery as u, usePayablesTotalCountQuery as d } from "../../data-access/dist/index17.js";
13
+ import "../../data-access/dist/index.js";
14
+ import { duplicateRemovalPrompt as f } from "./index8.js";
15
+ import { derivePayableStatus as ee } from "./index10.js";
16
+ import { compareByArrival as p, duplicateVerdictMatches as m, resolveDuplicateOriginalId as h } from "./index9.js";
17
+ import { isEditablePayableStatus as te } from "./index11.js";
18
+ import { resolveVendorName as ne } from "./index12.js";
19
+ import { BillColumn as g } from "../../ui/dist/index83.js";
20
+ import "../../ui/dist/index.js";
21
+ import { formatScheduledDateLabel as re } from "./index36.js";
22
+ import { useLocalCalendarDay as ie } from "./index37.js";
23
+ import { BillQueue as _, DEFAULT_BILL_QUEUE as ae, billQueueColumns as oe, billQueueHasScheduledPayment as se, billQueueOffersAddPanel as ce, billQueueStatuses as le, billSortColumnId as ue, billSortField as de } from "./index74.js";
24
+ import { useBillsFilters as fe } from "./index83.js";
25
+ import { BillVendorLookup as pe, useBillVendorNames as me } from "./index84.js";
26
+ import { useCallback as v, useEffect as y, useMemo as b, useState as x } from "react";
27
+ import { BanIcon as he, FileCheckIcon as ge, Trash2Icon as _e } from "lucide-react";
10
28
  //#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js
11
- var i = {
12
- Resolving: "resolving",
13
- Unavailable: "unavailable",
14
- Settled: "settled"
15
- }, a = /* @__PURE__ */ new Map();
16
- function o({ payables: i, enabled: o, canReadVendors: c = !0, isPaused: l = !1 } = {}) {
17
- let u = r(() => (i ?? []).filter((e) => !t(e)).map((e) => e.counterpart_id).filter((e) => !!e), [i]), d = e({
18
- counterpartIds: u,
19
- enabled: o !== !1 && c && !l
20
- }), f = !c && !l;
29
+ var ve = 10, S = 100, ye = 3, be = [{
30
+ id: "addedOnLabel",
31
+ desc: !0
32
+ }], C = {
33
+ AllBills: "allBills",
34
+ PossibleDuplicates: "possibleDuplicates"
35
+ };
36
+ function xe(e, t) {
37
+ let n = new Map(e.map((e) => [e.id, e])), r = /* @__PURE__ */ new Map(), i = (e) => {
38
+ r.has(e) || r.set(e, /* @__PURE__ */ new Set());
39
+ }, a = (e, t) => {
40
+ i(e), i(t), r.get(e)?.add(t), r.get(t)?.add(e);
41
+ };
42
+ for (let t of e) {
43
+ let e = s(t);
44
+ if (e.length !== 0) {
45
+ i(t.id);
46
+ for (let n of e) a(t.id, n.matched_payable_id);
47
+ }
48
+ }
49
+ let o = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
50
+ for (let e of r.keys()) {
51
+ if (c.has(e)) continue;
52
+ let i = [], a = [e];
53
+ for (c.add(e); a.length > 0;) {
54
+ let e = a.pop();
55
+ n.has(e) && i.push(e);
56
+ for (let t of r.get(e) ?? []) c.has(t) || (c.add(t), a.push(t));
57
+ }
58
+ if (i.length === 0) continue;
59
+ let s = i.map((e) => n.get(e)).filter((e) => !!e).sort(p), l = h(s), [u] = s, d = {
60
+ key: `duplicate-group:${[...i].sort().join(":")}`,
61
+ headerLabel: t.groupHeader({
62
+ vendorLabel: ne(u),
63
+ invoiceNumberLabel: u?.document_id ?? ""
64
+ }),
65
+ memberCount: i.length,
66
+ originalPayableId: l
67
+ };
68
+ for (let e of i) o.set(e, d);
69
+ }
70
+ return o;
71
+ }
72
+ function w({ enabled: s = !0, canReadVendors: p = !0, isVendorFilterPaused: h = !1, filterLabels: pe, onOpenBill: w, duplicateRowNote: we, attachmentLabel: Te, duplicateGroupLabels: T, canManageDuplicates: Ee = !1, duplicateView: E = C.AllBills, scheduledRelativeDayLabels: De }) {
73
+ let Oe = ie(), [D, ke] = x(ae), [Ae, je] = x(be), [O, Me] = x(ve), [Ne, k] = x(), [Pe, A] = x(0), [j, M] = x(""), [N, Fe] = x(""), [P, F] = x(), [I, L] = x(), R = v(() => {
74
+ k(void 0), A(0);
75
+ }, []);
76
+ y(() => {
77
+ if (j === N) return;
78
+ let e = setTimeout(() => {
79
+ Fe(j), R();
80
+ }, 300);
81
+ return () => clearTimeout(e);
82
+ }, [
83
+ j,
84
+ N,
85
+ R
86
+ ]), y(() => {
87
+ R();
88
+ }, [E, R]);
89
+ let z = fe({
90
+ offersStatusFilter: D === _.All,
91
+ offersVendorFilter: p,
92
+ isVendorFilterPaused: h,
93
+ labels: pe,
94
+ onFiltersChange: R
95
+ }), { clearAll: Ie, filterByVendor: Le } = z, Re = Ae[0], B = de(Re?.id), ze = B ? Re?.desc ? "desc" : "asc" : void 0, V = E === C.PossibleDuplicates, H = V ? _.All : D, U = b(() => ({
96
+ ...z.query,
97
+ limit: V ? S : O,
98
+ pagination_token: V ? void 0 : Ne,
99
+ status__in: V ? void 0 : le(H) ?? z.query.status__in,
100
+ has_scheduled_payment: V ? void 0 : se(H),
101
+ duplicate_match_status: V ? "suspected" : void 0,
102
+ counterpart_name__icontains: N || void 0,
103
+ sort: B,
104
+ order: ze
105
+ }), [
106
+ z.query,
107
+ O,
108
+ Ne,
109
+ V,
110
+ H,
111
+ N,
112
+ B,
113
+ ze
114
+ ]), { organizationId: Be } = t(), W = JSON.stringify([Be, U]), G = u({
115
+ ...U,
116
+ enabled: s && !V,
117
+ pollWhileOcrProcessing: !0
118
+ }), K = l({
119
+ ...U,
120
+ enabled: s && V,
121
+ maxPages: ye
122
+ }), q = V ? {
123
+ ...K,
124
+ data: { data: K.payables },
125
+ isLoading: K.isResolving,
126
+ isFetching: K.isFetching || K.isResolving
127
+ } : G, J = (q.data?.data ?? []).filter((e) => e.ocr_status !== "processing"), Y = c(), X = v(async (t, n, r, a) => {
128
+ let o = m(t, n, a);
129
+ if (o.length) try {
130
+ await Y.mutateAsync({
131
+ verdict: n,
132
+ targets: o.map((e) => ({
133
+ payableId: t.id,
134
+ duplicateId: e.id,
135
+ matchedPayableId: e.matched_payable_id,
136
+ removeBy: i(t.status)
137
+ }))
138
+ }), e.success(r);
139
+ } catch {
140
+ e.error(T.actionFailedToast);
141
+ }
142
+ }, [Y, T.actionFailedToast]), Z = b(() => ({
143
+ delete: {
144
+ action: T.deleteAction,
145
+ title: T.deleteConfirmTitle,
146
+ description: T.deleteConfirmDescription,
147
+ confirmButton: T.deleteConfirmButton,
148
+ backButton: T.cancelConfirmBackButton,
149
+ toast: T.deletedToast
150
+ },
151
+ cancel: {
152
+ action: T.cancelAction,
153
+ title: T.cancelConfirmTitle,
154
+ description: T.cancelConfirmDescription,
155
+ confirmButton: T.cancelConfirmButton,
156
+ backButton: T.cancelConfirmBackButton,
157
+ toast: T.cancelledToast
158
+ },
159
+ confirm: {
160
+ action: T.confirmAction,
161
+ title: T.confirmDuplicateTitle,
162
+ description: T.confirmDuplicateDescription,
163
+ confirmButton: T.confirmDuplicateButton,
164
+ backButton: T.cancelConfirmBackButton,
165
+ toast: T.confirmedToast
166
+ }
167
+ }), [T]), Ve = P?.removeBy ?? "cancel", He = v(async () => {
168
+ P && (await X(P.payable, a.Remove, Z[P.removeBy].toast), F(void 0));
169
+ }, [
170
+ X,
171
+ P,
172
+ Z
173
+ ]), Ue = v(async () => {
174
+ I && (await X(I.payable, a.Keep, T.dismissedToast, I.originalPayableId), L(void 0));
175
+ }, [
176
+ X,
177
+ T.dismissedToast,
178
+ I
179
+ ]), [We, Ge] = x(W);
180
+ y(() => {
181
+ q.isFetching || Ge(W);
182
+ }, [q.isFetching, W]);
183
+ let Ke = q.data?.data.length, qe = Ke === 0, Je = d({ enabled: s && qe }), Ye = !qe || (Je.data?.count ?? 1) > 0, Q = b(() => E === C.PossibleDuplicates ? xe(J, T) : /* @__PURE__ */ new Map(), [
184
+ E,
185
+ J,
186
+ T
187
+ ]), Xe = b(() => {
188
+ if (Q.size === 0) return J;
189
+ let e = /* @__PURE__ */ new Map();
190
+ return J.forEach((t, n) => {
191
+ let r = Q.get(t.id)?.key;
192
+ r !== void 0 && !e.has(r) && e.set(r, n);
193
+ }), J.map((t, n) => ({
194
+ payable: t,
195
+ order: e.get(Q.get(t.id)?.key ?? "") ?? n
196
+ })).sort((e, t) => e.order - t.order).map(({ payable: e }) => e);
197
+ }, [J, Q]), { vendorNames: Ze, lookup: Qe } = me({
198
+ payables: q.data?.data,
199
+ enabled: s,
200
+ canReadVendors: p,
201
+ isPaused: h
202
+ }), $e = b(() => Xe.map((e) => {
203
+ let t = ee({
204
+ apiStatus: e.status,
205
+ dueDate: e.due_date,
206
+ scheduledPaymentDate: e.scheduled_payment_date
207
+ }), a = e.amount_due ?? e.total_amount, s = e.status === "partially_paid" || e.status === "paid", c = (t) => t == null ? "" : r(t / 100, { currencyCode: e.currency ?? "USD" }), l = re(e.scheduled_payment_date, De, Oe), u = Q.get(e.id), d = o(e), f = ne(e) || (e.counterpart_id ? Ze.get(e.counterpart_id) ?? "" : ""), p = e.document_id ?? "", m = i(e.status), h = u?.originalPayableId !== void 0 && u.originalPayableId === e.id, g = V && d && Ee && u ? {
208
+ triggerLabel: T.menuTrigger({
209
+ vendorLabel: f,
210
+ invoiceNumberLabel: p
211
+ }),
212
+ items: [{
213
+ id: "not-duplicate",
214
+ label: T.notDuplicateAction,
215
+ icon: ge,
216
+ disabled: Y.isPending,
217
+ onSelect: () => L({
218
+ payable: e,
219
+ originalPayableId: h ? void 0 : u.originalPayableId
220
+ })
221
+ }, ...m ? [{
222
+ id: "cancel-duplicate",
223
+ label: Z[m].action,
224
+ icon: m === "delete" ? _e : he,
225
+ disabled: Y.isPending,
226
+ onSelect: () => F({
227
+ payable: e,
228
+ removeBy: m
229
+ })
230
+ }] : []]
231
+ } : void 0;
232
+ return {
233
+ rowKey: e.id,
234
+ vendorLabel: f,
235
+ vendorLookup: f || !e.counterpart_id ? void 0 : Ce(Qe),
236
+ invoiceNumberLabel: p,
237
+ issueDateLabel: n(e.issued_at),
238
+ dueDateLabel: n(e.due_date),
239
+ dueDateTone: t.isOverdue ? "danger" : "default",
240
+ scheduledDateLabel: l.label,
241
+ scheduledDateExact: l.absoluteLabel,
242
+ scheduledDateIsGap: H === _.Scheduled,
243
+ paidDateLabel: n(e.paid_at?.slice(0, 10)),
244
+ amountDueLabel: c(a),
245
+ amountPaidLabel: s ? c(e.amount_paid) : "",
246
+ amountPaidIsGap: H === _.Paid,
247
+ amountScheduledLabel: c(e.amount_to_pay ?? a),
248
+ totalAmountLabel: c(e.total_amount),
249
+ attachment: e.file_id ? { label: Te } : void 0,
250
+ status: t.status,
251
+ statusTone: t.tone,
252
+ addedOnLabel: n(e.created_at?.slice(0, 10)),
253
+ ...u ? {
254
+ group: {
255
+ key: u.key,
256
+ headerLabel: u.headerLabel,
257
+ memberCount: u.memberCount
258
+ },
259
+ groupedRowLabel: f,
260
+ groupedRowLabelTone: void 0,
261
+ groupedRowBadge: h ? T.originalBill : void 0
262
+ } : {},
263
+ ...g ? { menu: g } : {},
264
+ ...!V && !u && d ? {
265
+ rowTone: "warning",
266
+ rowNote: we
267
+ } : {},
268
+ onOpen: () => w(e.id, te(e.status))
269
+ };
270
+ }), [
271
+ Xe,
272
+ Q,
273
+ T,
274
+ Z,
275
+ Y.isPending,
276
+ Ee,
277
+ V,
278
+ we,
279
+ Te,
280
+ De,
281
+ Oe,
282
+ w,
283
+ H,
284
+ Ze,
285
+ Qe
286
+ ]), et = b(() => V ? Se($e, S) : [], [$e, V]), $ = Math.min(Pe, Math.max(0, et.length - 1)), tt = V ? et[$] ?? [] : $e, nt = v((e) => {
287
+ let t = e;
288
+ ke(t), je((e) => {
289
+ let n = e[0]?.id;
290
+ return n ? oe(t).some((e) => ue(e) === n) ? e : be : e;
291
+ }), R();
292
+ }, [R]), rt = v((e) => {
293
+ nt(_.All), M(""), Le(e);
294
+ }, [Le, nt]), it = v(() => {
295
+ M(""), Fe(""), Ie(), R();
296
+ }, [Ie, R]), at = v((e) => {
297
+ je((t) => typeof e == "function" ? e(t) : e), R();
298
+ }, [R]), ot = v((e) => {
299
+ Me(e), R();
300
+ }, [R]), st = v(() => {
301
+ if (V) {
302
+ A($ + 1);
303
+ return;
304
+ }
305
+ k(G.data?.next_pagination_token ?? void 0);
306
+ }, [
307
+ $,
308
+ V,
309
+ G.data?.next_pagination_token
310
+ ]), ct = v(() => {
311
+ if (V) {
312
+ A(Math.max(0, $ - 1));
313
+ return;
314
+ }
315
+ k(G.data?.prev_pagination_token ?? void 0);
316
+ }, [
317
+ $,
318
+ V,
319
+ G.data?.prev_pagination_token
320
+ ]), lt = v(() => {
321
+ q.refetch();
322
+ }, [q.refetch]);
21
323
  return {
22
- vendorNames: r(() => f ? a : new Map((d.data?.data ?? []).map((e) => [e.id, n(e)]).filter((e) => !!e[1])), [d.data?.data, f]),
23
- lookup: s({
24
- hasUnresolvedIds: u.length > 0,
25
- isScopeWithdrawn: f,
26
- isFetching: d.isFetching,
27
- isError: d.isError
28
- })
324
+ rows: tt,
325
+ isLoading: q.isLoading || W !== We || qe && Je.isLoading || (Ke ?? 0) > 0 && tt.length === 0,
326
+ isError: q.isError,
327
+ onRetry: lt,
328
+ selectedFilterTabId: D,
329
+ onFilterTabChange: nt,
330
+ showVendorBills: rt,
331
+ clearQueryConstraints: it,
332
+ searchValue: j,
333
+ onSearchChange: M,
334
+ hasAnyBills: Ye,
335
+ isSearchActive: N.length > 0 || z.isFilterActive || V,
336
+ filterBarProps: z.filterBarProps,
337
+ visibleColumns: V ? [
338
+ g.Vendor,
339
+ g.AmountDue,
340
+ g.DueDate,
341
+ g.AddedOn,
342
+ g.Status
343
+ ] : oe(D),
344
+ showAddPanelWhenEmpty: !V && ce(D),
345
+ sorting: Ae,
346
+ onSortingChange: at,
347
+ pageSize: V ? S : O,
348
+ pageSizeOptions: V ? [S] : void 0,
349
+ onPageSizeChange: ot,
350
+ hasNextPage: V ? $ < et.length - 1 : !!G.data?.next_pagination_token,
351
+ hasPrevPage: V ? $ > 0 : !!G.data?.prev_pagination_token,
352
+ onNextPage: st,
353
+ onPrevPage: ct,
354
+ cancelConfirmation: {
355
+ open: !!P,
356
+ copy: f(Z[Ve], Ve),
357
+ onConfirm: () => void He(),
358
+ onCancel: () => F(void 0),
359
+ isPending: Y.isPending,
360
+ cancelButtonLabel: Z[Ve].backButton
361
+ },
362
+ keepConfirmation: {
363
+ open: !!I,
364
+ copy: {
365
+ title: T.notDuplicateConfirmTitle,
366
+ description: T.notDuplicateConfirmDescription,
367
+ confirmButton: T.notDuplicateConfirmButton,
368
+ presentation: {
369
+ alignment: "center",
370
+ icon: ge,
371
+ actionWidth: "equal"
372
+ }
373
+ },
374
+ onConfirm: () => void Ue(),
375
+ onCancel: () => L(void 0),
376
+ isPending: Y.isPending,
377
+ cancelButtonLabel: T.notDuplicateConfirmBackButton
378
+ }
29
379
  };
30
380
  }
31
- function s({ hasUnresolvedIds: e, isScopeWithdrawn: t, isFetching: n, isError: r }) {
32
- return e ? t ? i.Unavailable : n ? i.Resolving : r ? i.Unavailable : i.Settled : i.Settled;
381
+ function Se(e, t) {
382
+ let n = [], r = [];
383
+ return e.forEach((i, a) => {
384
+ let o = i.group !== void 0 && i.group.key === e[a - 1]?.group?.key;
385
+ r.length >= t && !o && (n.push(r), r = []), r.push(i);
386
+ }), r.length && n.push(r), n;
387
+ }
388
+ function Ce(e) {
389
+ return e === pe.Settled ? void 0 : e;
33
390
  }
34
391
  //#endregion
35
- export { i as BillVendorLookup, o as useBillVendorNames };
392
+ export { C as BillDuplicateView, w as useBillsTable };