@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.
- package/dist/index.css +39 -17
- package/dist/index.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index.js +11 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index17.js +95 -80
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/data-access/dist/index7.js +37 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +13 -15
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index10.js +56 -67
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index11.js +4 -43
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +6 -115
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index13.js +202 -63
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index14.js +2 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index15.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index19.js +84 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index20.js +3 -84
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index21.js +5 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index22.js +4 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index23.js +32 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index24.js +36 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index25.js +167 -35
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index26.js +40 -164
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index27.js +1 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index28.js +50 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index29.js +11 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index30.js +8 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index31.js +14 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index32.js +59 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index33.js +8 -64
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +24 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index35.js +150 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index36.js +9 -152
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index37.js +25 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index38.js +19 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index39.js +32 -14
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +14 -39
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +8 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +4 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +98 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +68 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +3 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +143 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +44 -143
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +114 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +189 -111
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +13 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +72 -186
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +31 -76
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +89 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +406 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -411
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +84 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +67 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +222 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +37 -223
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +245 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +5 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +23 -252
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +626 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -586
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +45 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +256 -41
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -263
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +4 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +44 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index7.js +22 -57
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +130 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -132
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +129 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -124
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +7 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +82 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +19 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +20 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +14 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +28 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +82 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +47 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +260 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +24 -251
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +382 -25
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +294 -144
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +4 -223
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +7 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index89.js +112 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index9.js +37 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index90.js +1 -114
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index91.js +26 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +18 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index100.js +126 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index101.js +1 -105
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index102.js +33 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index103.js +7 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index104.js +126 -73
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index105.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index106.js +11 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index107.js +106 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index108.js +2 -181
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index109.js +10 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index110.js +50 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index111.js +2 -108
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index38.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index46.js +8 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index73.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index74.js +154 -23
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index83.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index84.js +343 -250
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index90.js +5 -123
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index91.js +28 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index92.js +2 -94
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index93.js +7 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index94.js +32 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index95.js +2 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index96.js +12 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index97.js +104 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index98.js +2 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index99.js +31 -2
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
- package/dist/packages/shared-ui-shadcn/dist/index.js +2458 -2284
- package/package.json +2 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index92.js +0 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index112.js +0 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index113.js +0 -10
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index114.js +0 -52
- 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 {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import "../../../shared/
|
|
9
|
-
import {
|
|
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
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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
|
|
32
|
-
|
|
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 {
|
|
392
|
+
export { C as BillDuplicateView, w as useBillsTable };
|