@tesouro/embedded-components-react 0.11.226 → 0.11.228
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.js +1 -1
- package/dist/lib/BillPayWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index31.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index34.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index48.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/ui/dist/index49.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index8.js +55 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/data-access/dist/index9.js +36 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index10.js +19 -185
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index11.js +10 -30
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index12.js +186 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index13.js +35 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index14.js +15 -51
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index15.js +76 -294
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index16.js +51 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js +277 -456
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index18.js +29 -326
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index19.js +524 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index20.js +359 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index21.js +4 -37
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index22.js +5 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index23.js +38 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index24.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index7.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index8.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index15.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index16.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index17.js +221 -200
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/ui/dist/index3.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillPayWidget.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/BillsTab.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/lib/BillPayWidget/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index5.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/pay-bill/ui/dist/index6.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +14 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index10.js +10 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index11.js +1 -53
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index12.js +13 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index13.js +52 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index14.js +2 -74
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index15.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index16.js +73 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index17.js +2 -77
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +10 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +77 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index21.js +2 -31
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index22.js +6 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index23.js +31 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index24.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index20.js +0 -6
|
@@ -2,481 +2,302 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import { formatCalendarDate as t } from "../../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
7
|
-
import { formatMoneyExact as n } from "../../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
5
|
+
import { formatMoneyExact as e } from "../../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
8
6
|
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
7
|
import "../../../util/dist/index.js";
|
|
22
|
-
import {
|
|
23
|
-
import { BillSummaryCard as
|
|
24
|
-
import {
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
8
|
+
import { billStatusFilterApiValues as t } from "./index4.js";
|
|
9
|
+
import { BillSummaryCard as n, billSummaryCardFilter as r } from "./index12.js";
|
|
10
|
+
import { BillsDatePreset as i, resolveDatePreset as a } from "./index15.js";
|
|
11
|
+
import { BILLS_FILTER_LABELS_EN as o } from "./index16.js";
|
|
12
|
+
import { BillsFilterField as s } from "../../ui/dist/index12.js";
|
|
27
13
|
import "../../ui/dist/index.js";
|
|
28
|
-
import {
|
|
29
|
-
import {
|
|
30
|
-
import
|
|
31
|
-
import {
|
|
32
|
-
import "
|
|
33
|
-
import { usePayablesQuery as me } from "../../data-access/dist/index4.js";
|
|
34
|
-
import { usePayablesTotalCountQuery as he } from "../../data-access/dist/index5.js";
|
|
35
|
-
import "../../data-access/dist/index.js";
|
|
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";
|
|
14
|
+
import { getCounterpartName as c } from "../../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
15
|
+
import { useCounterpartsQuery as l } from "../../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
16
|
+
import "../../../../shared/counterpart-management/feature/dist/index.js";
|
|
17
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
18
|
+
import { format as h, formatISO as g } from "date-fns";
|
|
38
19
|
// ../../libs/tesouro-embedded-components-react/bill-pay-widget/bills-list/feature/dist/index17.js
|
|
39
|
-
var
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
20
|
+
var _ = {
|
|
21
|
+
SummaryCard: "summary_card",
|
|
22
|
+
Date: "date",
|
|
23
|
+
Status: "status",
|
|
24
|
+
Amount: "amount",
|
|
25
|
+
Vendor: "vendor",
|
|
26
|
+
Attachment: "attachment"
|
|
27
|
+
}, v = [], y = 50, b = 300, x = "MMM d, yyyy", S = 2, C = 864e5, ee = {
|
|
28
|
+
[s.IssueDate]: "issued_at",
|
|
29
|
+
[s.DueDate]: "due_date",
|
|
30
|
+
[s.AddedOn]: "created_at"
|
|
31
|
+
}, te = {
|
|
32
|
+
[i.Today]: "current",
|
|
33
|
+
[i.ThisWeek]: "current",
|
|
34
|
+
[i.ThisMonth]: "current",
|
|
35
|
+
[i.ThisQuarter]: "current",
|
|
36
|
+
[i.ThisYear]: "current",
|
|
37
|
+
[i.Yesterday]: "past",
|
|
38
|
+
[i.LastWeek]: "past",
|
|
39
|
+
[i.LastMonth]: "past",
|
|
40
|
+
[i.Last30Days]: "past",
|
|
41
|
+
[i.Last90Days]: "past",
|
|
42
|
+
[i.LastQuarter]: "past",
|
|
43
|
+
[i.LastYear]: "past"
|
|
45
44
|
};
|
|
46
|
-
function
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
45
|
+
function w(e = null) {
|
|
46
|
+
return {
|
|
47
|
+
summaryCard: e,
|
|
48
|
+
dateField: s.DueDate,
|
|
49
|
+
statuses: [],
|
|
50
|
+
amountMode: "any",
|
|
51
|
+
amountMin: "",
|
|
52
|
+
amountMax: "",
|
|
53
|
+
vendorIds: []
|
|
51
54
|
};
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
}
|
|
56
|
+
function T(e) {
|
|
57
|
+
let t = Number.parseFloat(e);
|
|
58
|
+
return Number.isFinite(t) ? Math.round(t * 100) : void 0;
|
|
59
|
+
}
|
|
60
|
+
function E({ statusOptions: i = v, offersVendorFilter: E = !0, isVendorFilterPaused: D = !1, onFiltersChange: O, initialSummaryCard: ne = null, onSummaryCardChange: k, today: A, labels: j } = {}) {
|
|
61
|
+
let M = f(() => ({
|
|
62
|
+
...o,
|
|
63
|
+
...j,
|
|
64
|
+
presets: {
|
|
65
|
+
...o.presets,
|
|
66
|
+
...j?.presets
|
|
67
|
+
},
|
|
68
|
+
statuses: {
|
|
69
|
+
...o.statuses,
|
|
70
|
+
...j?.statuses
|
|
71
|
+
},
|
|
72
|
+
dateFieldNames: {
|
|
73
|
+
...o.dateFieldNames,
|
|
74
|
+
...j?.dateFieldNames
|
|
67
75
|
}
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
76
|
+
}), [j]), [N, P] = m(() => w(ne)), F = i.length > 0 && !N.summaryCard, I = F ? i : v, L = u((e) => {
|
|
77
|
+
e !== N.summaryCard && k?.(e);
|
|
78
|
+
}, [k, N.summaryCard]), [R, z] = m({}), [B, V] = m(""), [H, U] = m(""), W = u((e) => {
|
|
79
|
+
P((t) => ({
|
|
80
|
+
...t,
|
|
81
|
+
...e
|
|
82
|
+
})), O?.();
|
|
83
|
+
}, [O]);
|
|
84
|
+
d(() => {
|
|
85
|
+
E || P((e) => e.vendorIds.length === 0 ? e : (O?.(), {
|
|
86
|
+
...e,
|
|
87
|
+
vendorIds: []
|
|
88
|
+
}));
|
|
89
|
+
}, [E, O]), d(() => {
|
|
90
|
+
P((e) => {
|
|
91
|
+
let t = e.statuses.filter((e) => I.includes(e));
|
|
92
|
+
return t.length === e.statuses.length ? e : (O?.(), {
|
|
93
|
+
...e,
|
|
94
|
+
statuses: t
|
|
95
|
+
});
|
|
85
96
|
});
|
|
86
|
-
}
|
|
87
|
-
let
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
key: i
|
|
94
|
-
};
|
|
95
|
-
for (let t of e) f.set(t, a);
|
|
96
|
-
}
|
|
97
|
-
return f;
|
|
98
|
-
}
|
|
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);
|
|
104
|
-
}, []);
|
|
105
|
-
v(() => {
|
|
106
|
-
if (j === M) return;
|
|
107
|
-
let e = setTimeout(() => {
|
|
108
|
-
Ke(j), F();
|
|
109
|
-
}, 300);
|
|
97
|
+
}, [I, O]);
|
|
98
|
+
let G = f(() => N.statuses.filter((e) => I.includes(e)), [N.statuses, I]), K = N.summaryCard === n.Overdue ? A : void 0, q = p(K);
|
|
99
|
+
d(() => {
|
|
100
|
+
let e = q.current;
|
|
101
|
+
q.current = K, e && K && e !== K && O?.();
|
|
102
|
+
}, [K, O]), d(() => {
|
|
103
|
+
let e = setTimeout(() => U(B.trim()), b);
|
|
110
104
|
return () => clearTimeout(e);
|
|
105
|
+
}, [B]);
|
|
106
|
+
let J = l({
|
|
107
|
+
enabled: E && !D,
|
|
108
|
+
is_vendor: !0,
|
|
109
|
+
sort: "counterpart_name",
|
|
110
|
+
order: "asc",
|
|
111
|
+
limit: y,
|
|
112
|
+
counterpart_name__icontains: H || void 0
|
|
113
|
+
}), Y = f(() => (J.data?.data ?? []).map((e) => ({
|
|
114
|
+
value: e.id,
|
|
115
|
+
label: c(e)
|
|
116
|
+
})), [J.data?.data]), X = f(() => i.map((e) => ({
|
|
117
|
+
value: e,
|
|
118
|
+
label: M.statuses[e]
|
|
119
|
+
})), [i, M.statuses]), re = f(() => Object.entries(te).map(([e, t]) => ({
|
|
120
|
+
value: e,
|
|
121
|
+
label: M.presets[e],
|
|
122
|
+
group: t === "current" ? M.presetGroupCurrent : M.presetGroupPast
|
|
123
|
+
})), [
|
|
124
|
+
M.presetGroupCurrent,
|
|
125
|
+
M.presetGroupPast,
|
|
126
|
+
M.presets
|
|
127
|
+
]), ie = f(() => {
|
|
128
|
+
let e = {}, n = ee[N.dateField], i = (e) => Date.UTC(e.getFullYear(), e.getMonth(), e.getDate());
|
|
129
|
+
if (N.dateFrom && (e[`${n}__gte`] = n === "created_at" ? new Date(i(N.dateFrom)).toISOString() : g(N.dateFrom, { representation: "date" })), N.dateTo && (n === "created_at" ? e.created_at__lt = new Date(i(N.dateTo) + C).toISOString() : e[`${n}__lte`] = g(N.dateTo, { representation: "date" })), G.length > 0 && (e.status__in = t(G)), N.amountMode !== "any") {
|
|
130
|
+
let t = "total_amount__gte", n = "total_amount__lte", r = T(N.amountMin), i = T(N.amountMax);
|
|
131
|
+
N.amountMode === "exact" ? r !== void 0 && (e[t] = r, e[n] = r) : (r !== void 0 && (e[t] = r), i !== void 0 && (e[n] = i));
|
|
132
|
+
}
|
|
133
|
+
return N.vendorIds.length > 0 && (e.counterpart_id__in = [...N.vendorIds]), N.hasFile !== void 0 && (e.has_file = N.hasFile), N.summaryCard && Object.assign(e, r(N.summaryCard, A).query), e;
|
|
111
134
|
}, [
|
|
112
|
-
|
|
113
|
-
|
|
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,
|
|
135
|
+
N,
|
|
136
|
+
G,
|
|
121
137
|
A
|
|
122
|
-
]),
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
return {
|
|
134
|
-
...L.query,
|
|
135
|
-
...e,
|
|
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
|
|
138
|
+
]), Z = f(() => {
|
|
139
|
+
let t = [], i = (e) => h(e, x), a = (e, t, n) => {
|
|
140
|
+
let r = t(M.valueList(n));
|
|
141
|
+
return n.length <= S ? {
|
|
142
|
+
key: e,
|
|
143
|
+
label: r
|
|
144
|
+
} : {
|
|
145
|
+
key: e,
|
|
146
|
+
label: t(M.valueList([...n.slice(0, S), M.moreValues(n.length - S)])),
|
|
147
|
+
fullLabel: r
|
|
148
|
+
};
|
|
143
149
|
};
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
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,
|
|
157
|
-
pollWhileOcrProcessing: !0
|
|
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);
|
|
169
|
-
if (a.length) try {
|
|
170
|
-
await K.mutateAsync({
|
|
171
|
-
verdict: n,
|
|
172
|
-
targets: a.map((e) => ({
|
|
173
|
-
payableId: t.id,
|
|
174
|
-
duplicateId: e.id,
|
|
175
|
-
matchedPayableId: e.matched_payable_id,
|
|
176
|
-
removeBy: f(t.status)
|
|
177
|
-
}))
|
|
178
|
-
}), e.success(r);
|
|
179
|
-
} catch {
|
|
180
|
-
e.error(C.actionFailedToast);
|
|
150
|
+
if (N.summaryCard) {
|
|
151
|
+
let { statuses: e } = r(N.summaryCard, A);
|
|
152
|
+
t.push(N.summaryCard === n.Overdue ? {
|
|
153
|
+
key: _.SummaryCard,
|
|
154
|
+
label: M.dateChip(M.dateFieldNames[s.DueDate], M.pastDue)
|
|
155
|
+
} : a(_.SummaryCard, M.statusChip, e ? e.map((e) => M.statuses[e]) : [M.scheduledStatus]));
|
|
181
156
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
},
|
|
199
|
-
confirm: {
|
|
200
|
-
action: C.confirmAction,
|
|
201
|
-
title: C.confirmDuplicateTitle,
|
|
202
|
-
description: C.confirmDuplicateDescription,
|
|
203
|
-
confirmButton: C.confirmDuplicateButton,
|
|
204
|
-
backButton: C.cancelConfirmBackButton,
|
|
205
|
-
toast: C.confirmedToast
|
|
157
|
+
if (N.dateFrom || N.dateTo) {
|
|
158
|
+
let e = (N.datePreset ? M.presets[N.datePreset] : void 0) ?? (N.dateFrom && N.dateTo ? M.dateRange(i(N.dateFrom), i(N.dateTo)) : N.dateFrom ? M.dateFrom(i(N.dateFrom)) : M.dateTo(i(N.dateTo)));
|
|
159
|
+
t.push({
|
|
160
|
+
key: _.Date,
|
|
161
|
+
label: M.dateChip(M.dateFieldNames[N.dateField], e)
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
if (G.length > 0 && t.push(a(_.Status, M.statusChip, G.map((e) => M.statuses[e] ?? e))), N.vendorIds.length > 0 && t.push(a(_.Vendor, M.vendorChip, N.vendorIds.map((e) => R[e] ?? e))), N.amountMode !== "any") {
|
|
165
|
+
let n = (t) => {
|
|
166
|
+
let n = Number.parseFloat(t);
|
|
167
|
+
return Number.isFinite(n) ? e(n, { currencyCode: "USD" }) : "";
|
|
168
|
+
}, r = n(N.amountMin), i = n(N.amountMax), a = N.amountMode === "exact" ? r : r && i ? M.amountBetween(r, i) : r ? M.amountAtLeast(r) : i ? M.amountAtMost(i) : "";
|
|
169
|
+
a && t.push({
|
|
170
|
+
key: _.Amount,
|
|
171
|
+
label: M.amountChip(a)
|
|
172
|
+
});
|
|
206
173
|
}
|
|
207
|
-
|
|
208
|
-
|
|
174
|
+
return N.hasFile !== void 0 && t.push({
|
|
175
|
+
key: _.Attachment,
|
|
176
|
+
label: N.hasFile ? M.attachmentChipHas : M.attachmentChipNone
|
|
177
|
+
}), t;
|
|
209
178
|
}, [
|
|
210
|
-
|
|
179
|
+
M,
|
|
211
180
|
N,
|
|
212
|
-
J
|
|
213
|
-
]), st = _(async () => {
|
|
214
|
-
P && (await q(P.payable, a.Keep, C.dismissedToast, P.originalPayableId), Je(void 0));
|
|
215
|
-
}, [
|
|
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
181
|
G,
|
|
226
|
-
|
|
227
|
-
]), mt = y(() => {
|
|
228
|
-
if (Y.size === 0) return G;
|
|
229
|
-
let e = /* @__PURE__ */ new Map();
|
|
230
|
-
return G.forEach((t, n) => {
|
|
231
|
-
let r = Y.get(t.id)?.key;
|
|
232
|
-
r !== void 0 && !e.has(r) && e.set(r, n);
|
|
233
|
-
}), G.map((t, n) => ({
|
|
234
|
-
payable: t,
|
|
235
|
-
index: n,
|
|
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) ?? "" : "");
|
|
245
|
-
return {
|
|
246
|
-
key: e.key,
|
|
247
|
-
label: t === e.title ? e.label : C.groupHeader({
|
|
248
|
-
vendorLabel: t,
|
|
249
|
-
invoiceNumberLabel: e.invoiceNumberLabel
|
|
250
|
-
}),
|
|
251
|
-
title: t,
|
|
252
|
-
meta: e.meta
|
|
253
|
-
};
|
|
254
|
-
}, [X, C]), Z = y(() => Te(mt.map((e) => {
|
|
255
|
-
let r = ce({
|
|
256
|
-
apiStatus: e.status,
|
|
257
|
-
dueDate: e.due_date,
|
|
258
|
-
scheduledPaymentDate: e.scheduled_payment_date
|
|
259
|
-
}), i = (t) => t == null ? "" : n(t / 100, { currencyCode: e.currency ?? "USD" }), a = t(e.scheduled_payment_date), s = p({
|
|
260
|
-
status: e.status,
|
|
261
|
-
dueDate: e.due_date,
|
|
262
|
-
today: D,
|
|
263
|
-
isScheduled: r.status === "scheduled",
|
|
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
|
|
269
|
-
}),
|
|
270
|
-
items: [{
|
|
271
|
-
id: "not-duplicate",
|
|
272
|
-
label: C.notDuplicateAction,
|
|
273
|
-
icon: ve,
|
|
274
|
-
disabled: K.isPending,
|
|
275
|
-
onSelect: () => Je({
|
|
276
|
-
payable: e,
|
|
277
|
-
originalPayableId: te ? void 0 : c.originalPayableId
|
|
278
|
-
})
|
|
279
|
-
}, ...h ? [{
|
|
280
|
-
id: "cancel-duplicate",
|
|
281
|
-
label: J[h].action,
|
|
282
|
-
icon: h === "delete" ? ye : _e,
|
|
283
|
-
disabled: K.isPending,
|
|
284
|
-
onSelect: () => qe({
|
|
285
|
-
payable: e,
|
|
286
|
-
removeBy: h
|
|
287
|
-
})
|
|
288
|
-
}] : []]
|
|
289
|
-
} : void 0;
|
|
290
|
-
return {
|
|
291
|
-
rowKey: e.id,
|
|
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),
|
|
300
|
-
status: r.status,
|
|
301
|
-
statusTone: r.tone,
|
|
302
|
-
...r.status === "scheduled" && a ? { statusHint: {
|
|
303
|
-
label: je.hint(a),
|
|
304
|
-
accessibleLabel: je.accessibleLabel(a)
|
|
305
|
-
} } : {},
|
|
306
|
-
addedOnLabel: t(e.created_at?.slice(0, 10)),
|
|
307
|
-
...c ? { group: gt(c) } : {},
|
|
308
|
-
...ne ? { menu: ne } : {},
|
|
309
|
-
...!I && !c && l ? { duplicateFlag: { label: ke } } : {},
|
|
310
|
-
onOpen: () => Oe(e.id, d(e.status))
|
|
311
|
-
};
|
|
312
|
-
}), C), [
|
|
313
|
-
mt,
|
|
314
|
-
Y,
|
|
315
|
-
C,
|
|
316
|
-
J,
|
|
317
|
-
K.isPending,
|
|
318
|
-
Ae,
|
|
319
|
-
I,
|
|
320
|
-
ke,
|
|
321
|
-
je,
|
|
322
|
-
Me,
|
|
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();
|
|
330
|
-
}, [
|
|
331
|
-
B,
|
|
332
|
-
F,
|
|
333
|
-
z
|
|
334
|
-
]), $ = _((e) => {
|
|
335
|
-
let t = e;
|
|
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);
|
|
345
|
-
}, [
|
|
346
|
-
$,
|
|
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)));
|
|
352
|
-
}, [
|
|
353
|
-
B,
|
|
354
|
-
$,
|
|
355
|
-
T,
|
|
182
|
+
A,
|
|
356
183
|
R
|
|
357
|
-
])
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
184
|
+
]), ae = u((e) => {
|
|
185
|
+
switch (e) {
|
|
186
|
+
case _.SummaryCard:
|
|
187
|
+
L(null), W({ summaryCard: null });
|
|
188
|
+
break;
|
|
189
|
+
case _.Date:
|
|
190
|
+
W({
|
|
191
|
+
datePreset: void 0,
|
|
192
|
+
dateFrom: void 0,
|
|
193
|
+
dateTo: void 0
|
|
194
|
+
});
|
|
195
|
+
break;
|
|
196
|
+
case _.Status:
|
|
197
|
+
W({ statuses: [] });
|
|
198
|
+
break;
|
|
199
|
+
case _.Vendor:
|
|
200
|
+
W({ vendorIds: [] });
|
|
201
|
+
break;
|
|
202
|
+
case _.Amount:
|
|
203
|
+
W({
|
|
204
|
+
amountMode: "any",
|
|
205
|
+
amountMin: "",
|
|
206
|
+
amountMax: ""
|
|
207
|
+
});
|
|
208
|
+
break;
|
|
209
|
+
case _.Attachment: W({ hasFile: void 0 });
|
|
210
|
+
}
|
|
211
|
+
}, [L, W]), Q = u(() => {
|
|
212
|
+
L(null), P(w()), O?.();
|
|
213
|
+
}, [O, L]), $ = u((e) => {
|
|
214
|
+
P((t) => t.summaryCard === e ? t : {
|
|
215
|
+
...t,
|
|
216
|
+
summaryCard: e
|
|
217
|
+
}), O?.();
|
|
218
|
+
}, [O]), oe = u((e) => {
|
|
219
|
+
L(e), $(e);
|
|
220
|
+
}, [$, L]), se = u((e) => {
|
|
221
|
+
z((t) => ({
|
|
222
|
+
...t,
|
|
223
|
+
[e.id]: e.name
|
|
224
|
+
})), L(null), P({
|
|
225
|
+
...w(),
|
|
226
|
+
vendorIds: [e.id]
|
|
227
|
+
}), O?.();
|
|
228
|
+
}, [O, L]), ce = u((e) => {
|
|
229
|
+
z((t) => {
|
|
230
|
+
let n = { ...t };
|
|
231
|
+
for (let t of Y) e.includes(t.value) && (n[t.value] = t.label);
|
|
232
|
+
return n;
|
|
233
|
+
}), W({ vendorIds: e });
|
|
234
|
+
}, [W, Y]);
|
|
381
235
|
return {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
keepsColumnOrder: I,
|
|
404
|
-
isSortable: !I,
|
|
405
|
-
pageInfo: I ? C.pageInfo({
|
|
406
|
-
billCount: Z.length,
|
|
407
|
-
groupCount: new Set(Z.map((e) => e.group?.key ?? e.rowKey)).size
|
|
408
|
-
}) : void 0,
|
|
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,
|
|
419
|
-
cancelConfirmation: {
|
|
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
|
|
426
|
-
},
|
|
427
|
-
keepConfirmation: {
|
|
428
|
-
open: !!P,
|
|
429
|
-
copy: {
|
|
430
|
-
title: C.notDuplicateConfirmTitle,
|
|
431
|
-
description: C.notDuplicateConfirmDescription,
|
|
432
|
-
confirmButton: C.notDuplicateConfirmButton,
|
|
433
|
-
presentation: {
|
|
434
|
-
alignment: "center",
|
|
435
|
-
icon: ve,
|
|
436
|
-
actionWidth: "equal"
|
|
437
|
-
}
|
|
236
|
+
filterBarProps: {
|
|
237
|
+
fields: [...f(() => [
|
|
238
|
+
...E ? [s.Vendor] : [],
|
|
239
|
+
s.IssueDate,
|
|
240
|
+
s.DueDate,
|
|
241
|
+
...F ? [s.Status] : [],
|
|
242
|
+
s.TotalAmount,
|
|
243
|
+
s.AddedOn,
|
|
244
|
+
s.Attachment
|
|
245
|
+
], [F, E])],
|
|
246
|
+
activeFilterCount: Z.length,
|
|
247
|
+
chips: Z,
|
|
248
|
+
onRemoveChip: ae,
|
|
249
|
+
onClearAll: Q,
|
|
250
|
+
dateField: N.dateField,
|
|
251
|
+
onDateFieldChange: (e) => {
|
|
252
|
+
let t = !!(N.dateFrom || N.dateTo);
|
|
253
|
+
P((t) => ({
|
|
254
|
+
...t,
|
|
255
|
+
dateField: e
|
|
256
|
+
})), t && O?.();
|
|
438
257
|
},
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
258
|
+
datePresets: re,
|
|
259
|
+
selectedDatePreset: N.datePreset,
|
|
260
|
+
dateFrom: N.dateFrom,
|
|
261
|
+
dateTo: N.dateTo,
|
|
262
|
+
onDateRangeChange: ({ from: e, to: t }) => W({
|
|
263
|
+
datePreset: void 0,
|
|
264
|
+
dateFrom: e,
|
|
265
|
+
dateTo: t
|
|
266
|
+
}),
|
|
267
|
+
onDatePresetChange: (e) => {
|
|
268
|
+
let t = /* @__PURE__ */ new Date(), n = N.dateField === s.AddedOn ? new Date(t.getUTCFullYear(), t.getUTCMonth(), t.getUTCDate()) : t, { from: r, to: i } = a(e, n);
|
|
269
|
+
W({
|
|
270
|
+
datePreset: e,
|
|
271
|
+
dateFrom: r,
|
|
272
|
+
dateTo: i
|
|
273
|
+
});
|
|
274
|
+
},
|
|
275
|
+
statusOptions: X,
|
|
276
|
+
selectedStatuses: G,
|
|
277
|
+
onStatusChange: (e) => W({ statuses: e }),
|
|
278
|
+
amountMode: N.amountMode,
|
|
279
|
+
onAmountModeChange: (e) => W({ amountMode: e }),
|
|
280
|
+
amountMin: N.amountMin,
|
|
281
|
+
amountMax: N.amountMax,
|
|
282
|
+
onAmountMinChange: (e) => W({ amountMin: e }),
|
|
283
|
+
onAmountMaxChange: (e) => W({ amountMax: e }),
|
|
284
|
+
vendorOptions: Y,
|
|
285
|
+
selectedVendors: N.vendorIds,
|
|
286
|
+
onVendorChange: ce,
|
|
287
|
+
vendorSearchValue: B,
|
|
288
|
+
onVendorSearchChange: V,
|
|
289
|
+
isVendorLoading: J.isLoading || D,
|
|
290
|
+
isVendorError: J.isError,
|
|
291
|
+
hasAttachment: N.hasFile,
|
|
292
|
+
onHasAttachmentChange: (e) => W({ hasFile: e })
|
|
293
|
+
},
|
|
294
|
+
query: ie,
|
|
295
|
+
isFilterActive: Z.length > 0,
|
|
296
|
+
clearAll: Q,
|
|
297
|
+
filterByVendor: se,
|
|
298
|
+
summaryCard: N.summaryCard,
|
|
299
|
+
selectSummaryCard: oe,
|
|
300
|
+
applySummaryCard: $
|
|
444
301
|
};
|
|
445
302
|
}
|
|
446
|
-
|
|
447
|
-
let n = /* @__PURE__ */ new Map();
|
|
448
|
-
for (let t of e) {
|
|
449
|
-
if (!t.group) continue;
|
|
450
|
-
let e = n.get(t.group.key) ?? [];
|
|
451
|
-
e.push(t.status), n.set(t.group.key, e);
|
|
452
|
-
}
|
|
453
|
-
return e.map((e) => {
|
|
454
|
-
if (!e.group) return e;
|
|
455
|
-
let r = m({
|
|
456
|
-
statuses: n.get(e.group.key) ?? [],
|
|
457
|
-
labels: {
|
|
458
|
-
showMore: t.showMore,
|
|
459
|
-
showLess: t.showLess,
|
|
460
|
-
statusSummary: (e) => t.statusSummary(e.map(({ status: e, count: n }) => (t.statusCount[e] ?? t.statusCount.unknown)(n)))
|
|
461
|
-
}
|
|
462
|
-
});
|
|
463
|
-
return r ? {
|
|
464
|
-
...e,
|
|
465
|
-
group: {
|
|
466
|
-
...e.group,
|
|
467
|
-
collapse: r
|
|
468
|
-
}
|
|
469
|
-
} : e;
|
|
470
|
-
});
|
|
471
|
-
}
|
|
472
|
-
function Ee(e, t) {
|
|
473
|
-
let n = [], r = [];
|
|
474
|
-
return e.forEach((i, a) => {
|
|
475
|
-
let o = i.group !== void 0 && i.group.key === e[a - 1]?.group?.key;
|
|
476
|
-
r.length >= t && !o && (n.push(r), r = []), r.push(i);
|
|
477
|
-
}), r.length && n.push(r), n;
|
|
478
|
-
}
|
|
479
|
-
function De(e) {
|
|
480
|
-
return e === ue.Settled ? void 0 : e;
|
|
481
|
-
}
|
|
482
|
-
export { S as BillDuplicateView, we as useBillsTable };
|
|
303
|
+
export { _ as BillsFilterChipKey, E as useBillsFilters };
|