@tesouro/embedded-components-react 0.5.0 → 0.5.2
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/feature/dist/index.js +10 -9
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index40.js +14 -88
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index41.js +8 -96
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index42.js +91 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index43.js +96 -48
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index44.js +3 -137
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +49 -35
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index46.js +129 -180
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +32 -74
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +186 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +70 -226
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +22 -219
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +221 -109
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +220 -13
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +119 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +13 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +43 -198
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +29 -32
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +186 -222
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +37 -19
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +229 -420
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +21 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +429 -34
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -224
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +38 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +222 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +44 -6
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +6 -110
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +12 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +109 -124
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +124 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +8 -45
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +45 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +20 -83
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +28 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +76 -243
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +48 -113
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +239 -196
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +115 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +207 -5
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +3 -114
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +106 -16
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +25 -0
- 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/package.json +1 -1
|
@@ -2,432 +2,241 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import "
|
|
10
|
-
import { formatCalendarDate as ne } from "../../../shared/util/dist/lib/formatCalendarDate.js";
|
|
11
|
-
import { useWidgetConfig as re } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
12
|
-
import "../../../shared/feature/dist/index.js";
|
|
13
|
-
import { usePayableApprovalRequestsQuery as ie } from "../../data-access/dist/index8.js";
|
|
14
|
-
import { usePayableHistoryQuery as ae } from "../../data-access/dist/index9.js";
|
|
15
|
-
import { useAllPayableLineItemsQuery as oe } from "../../data-access/dist/index10.js";
|
|
16
|
-
import { usePayableQuery as se } from "../../data-access/dist/index17.js";
|
|
17
|
-
import "../../data-access/dist/index.js";
|
|
18
|
-
import { hasUnpaidBalance as ce } from "./index8.js";
|
|
19
|
-
import { resolveVendor as le } from "./index9.js";
|
|
20
|
-
import { BillCreateScreen as ue } from "../../ui/dist/index50.js";
|
|
21
|
-
import { BillDecisionDialog as n } from "../../ui/dist/index56.js";
|
|
22
|
-
import { BillDuplicateNotice as de } from "../../ui/dist/index66.js";
|
|
23
|
-
import { BillRejectedBanner as fe } from "../../ui/dist/index69.js";
|
|
24
|
-
import { ExtractionNotice as pe } from "../../ui/dist/index87.js";
|
|
25
|
-
import { MarkAsPaidDialog as me } from "../../ui/dist/index96.js";
|
|
26
|
-
import { UnsavedBillDialog as he } from "../../ui/dist/index106.js";
|
|
27
|
-
import "../../ui/dist/index.js";
|
|
28
|
-
import { usePayableDuplicateReview as ge } from "./index14.js";
|
|
29
|
-
import "./index15.js";
|
|
30
|
-
import { canOverrideApprovalPolicy as _e, canReadCounterpartBankAccounts as ve } from "./index20.js";
|
|
31
|
-
import { resolveAmountDueMinorUnits as ye } from "./index21.js";
|
|
32
|
-
import { usePayableAchInstructions as be } from "../../../shared/counterpart-management/feature/dist/lib/usePayableAchInstructions.js";
|
|
33
|
-
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
34
|
-
import { PayBillFlow as xe } from "./index27.js";
|
|
35
|
-
import "./index28.js";
|
|
36
|
-
import { useMarkAsPaidFlow as Se } from "./index18.js";
|
|
37
|
-
import "./index19.js";
|
|
38
|
-
import { BILL_CREATE_MESSAGE_LABELS_EN as Ce, mergeBillCreateScreenCopy as we } from "./index46.js";
|
|
39
|
-
import { useBillCreateController as Te } from "./index55.js";
|
|
40
|
-
import { useBillForm as Ee } from "./index57.js";
|
|
41
|
-
import { buildPaymentHistory as De } from "./index3.js";
|
|
42
|
-
import { currentApprovalRound as Oe } from "./index4.js";
|
|
43
|
-
import { useIsApprovalPolicyAssignmentSettled as ke } from "./index5.js";
|
|
44
|
-
import { usePayableApprovalRoundStart as Ae } from "./index32.js";
|
|
45
|
-
import { useApprovalPolicyCardView as je } from "./index33.js";
|
|
46
|
-
import { resolveBillRejectionNotice as Me } from "./index34.js";
|
|
47
|
-
import { useCurrentApprovalRequestId as Ne } from "./index35.js";
|
|
48
|
-
import { usePayableDetailActions as Pe } from "./index36.js";
|
|
49
|
-
import { useScheduledPayment as Fe } from "./index37.js";
|
|
50
|
-
import { isEditablePayableStatus as Ie } from "./index38.js";
|
|
51
|
-
import { useDraftDelete as Le } from "./index39.js";
|
|
52
|
-
import { buildBillDetailView as Re } from "./index41.js";
|
|
53
|
-
import { resolveEditorDismissal as ze } from "./index42.js";
|
|
54
|
-
import { buildBillHistory as Be } from "./index43.js";
|
|
55
|
-
import { SourceDocumentContainer as Ve } from "./index47.js";
|
|
56
|
-
import { useVendorSectionProps as He } from "./index50.js";
|
|
57
|
-
import { usePaymentInstructionsForm as Ue } from "./index51.js";
|
|
58
|
-
import { billCreateTestIds as r } from "./index58.js";
|
|
59
|
-
import { useCallback as i, useEffect as We, useMemo as a, useRef as Ge, useState as o } from "react";
|
|
60
|
-
import { Fragment as Ke, jsx as s, jsxs as qe } from "react/jsx-runtime";
|
|
61
|
-
import { Trash2Icon as Je } from "lucide-react";
|
|
5
|
+
import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index48.js";
|
|
6
|
+
import { calculateTotal as t, displayLineAmount as n, parseMoneyToMinorUnits as r, parseQuantity as i } from "./index55.js";
|
|
7
|
+
import { validateBillTotals as a } from "./index56.js";
|
|
8
|
+
import { emptyLineItem as o, mapPayableToBillForm as s } from "./index58.js";
|
|
9
|
+
import { useCallback as c, useEffect as l, useMemo as u, useRef as ee, useState as d } from "react";
|
|
62
10
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
let
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
}),
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
J.data,
|
|
183
|
-
d.history
|
|
184
|
-
]), Ot = Ae({
|
|
185
|
-
payableId: g,
|
|
186
|
-
enabled: Tt
|
|
187
|
-
}), kt = ie(g, { enabled: Tt }), At = a(() => Oe(kt.data?.data, Ot.roundStartedAt), [kt.data, Ot.roundStartedAt]), Y = a(() => Me({
|
|
188
|
-
payableStatus: S?.status,
|
|
189
|
-
approvalRequests: At,
|
|
190
|
-
users: J.data?.data ?? [],
|
|
191
|
-
payableUpdatedAt: S?.updated_at,
|
|
192
|
-
labels: d.detail
|
|
193
|
-
}), [
|
|
194
|
-
S?.status,
|
|
195
|
-
S?.updated_at,
|
|
196
|
-
At,
|
|
197
|
-
J.data,
|
|
198
|
-
d.detail
|
|
199
|
-
]), jt = a(() => De({
|
|
200
|
-
records: N.paymentRecords,
|
|
201
|
-
events: q.data?.data ?? [],
|
|
202
|
-
currencyCode: S?.currency,
|
|
203
|
-
labels: d.detail
|
|
204
|
-
}), [
|
|
205
|
-
N.paymentRecords,
|
|
206
|
-
q.data,
|
|
207
|
-
S?.currency,
|
|
208
|
-
d.detail
|
|
209
|
-
]), Mt = a(() => u && S ? Re({
|
|
210
|
-
payable: S,
|
|
211
|
-
lineItems: v.lineItems,
|
|
212
|
-
glCodeOptions: G,
|
|
213
|
-
glCodeRosterAvailable: St,
|
|
214
|
-
history: Dt,
|
|
215
|
-
paymentHistory: jt,
|
|
216
|
-
approvalPolicy: z.view,
|
|
217
|
-
labels: d.detail,
|
|
218
|
-
hasScheduledPayment: N.hasScheduledPayment,
|
|
219
|
-
rejection: Y,
|
|
220
|
-
payableAchInstructions: F.achInstructions,
|
|
221
|
-
payableAchInstructionsReadable: P && !F.isError
|
|
222
|
-
}) : void 0, [
|
|
223
|
-
N.hasScheduledPayment,
|
|
224
|
-
z.view,
|
|
225
|
-
P,
|
|
226
|
-
d.detail,
|
|
11
|
+
var f = /^[0-9.,-]+$/;
|
|
12
|
+
function p(e) {
|
|
13
|
+
let t = e.trim().replace(/^\$\s*/, "");
|
|
14
|
+
return t ? f.test(t) ? t : null : "";
|
|
15
|
+
}
|
|
16
|
+
var m = [
|
|
17
|
+
"quantity",
|
|
18
|
+
"price",
|
|
19
|
+
"amount"
|
|
20
|
+
];
|
|
21
|
+
function h(e) {
|
|
22
|
+
let t = e.trim(), n = /[.,]$/.test(t) ? t.slice(0, -1) : t;
|
|
23
|
+
return t && !n ? null : n;
|
|
24
|
+
}
|
|
25
|
+
function g(e, t, n) {
|
|
26
|
+
if (t === void 0) return;
|
|
27
|
+
let r = h(t);
|
|
28
|
+
if (r !== null) return a(e === "discount" ? r : "", e === "tax" ? r : "", e === "total" ? r : void 0, n)?.[e];
|
|
29
|
+
}
|
|
30
|
+
function _(e, t) {
|
|
31
|
+
let n = {}, a = {
|
|
32
|
+
price: null,
|
|
33
|
+
amount: null
|
|
34
|
+
};
|
|
35
|
+
for (let i of ["price", "amount"]) {
|
|
36
|
+
let o = h(e[i]);
|
|
37
|
+
o !== null && (a[i] = r(o), o && a[i] === null && (n[i] = t.unreadableMoney));
|
|
38
|
+
}
|
|
39
|
+
let o = h(e.quantity);
|
|
40
|
+
if (o !== null) {
|
|
41
|
+
let e = a.price !== null || a.amount !== null;
|
|
42
|
+
i(o) === null && (o || e) && (n.quantity = t.unusableQuantity);
|
|
43
|
+
}
|
|
44
|
+
return n;
|
|
45
|
+
}
|
|
46
|
+
function v(e, t, i) {
|
|
47
|
+
return r(t) === null ? i : n(e, t);
|
|
48
|
+
}
|
|
49
|
+
function y({ payable: n, lineItems: r, labels: i = e } = {}) {
|
|
50
|
+
let a = u(() => s({
|
|
51
|
+
payable: n ?? {},
|
|
52
|
+
lineItems: r ?? []
|
|
53
|
+
}), [n, r]), [f, h] = d(a.values), [y, b] = d(a.lineItems), [x, S] = d(a.discount), [C, w] = d(a.tax), [T, E] = d(a.total || void 0), [te, D] = d(), O = ee(void 0), k = c((e) => {
|
|
54
|
+
D((t) => {
|
|
55
|
+
let n = typeof e == "function" ? e(t) : e;
|
|
56
|
+
return n?.form !== O.current && (O.current = void 0), n;
|
|
57
|
+
});
|
|
58
|
+
}, []), A = c((e) => {
|
|
59
|
+
O.current = e, D((t) => ({
|
|
60
|
+
...t,
|
|
61
|
+
form: e
|
|
62
|
+
}));
|
|
63
|
+
}, []), j = c(() => {
|
|
64
|
+
D((e) => {
|
|
65
|
+
if (!e?.form || e.form !== O.current) return e;
|
|
66
|
+
O.current = void 0;
|
|
67
|
+
let { form: t, ...n } = e;
|
|
68
|
+
return Object.keys(n).length ? n : void 0;
|
|
69
|
+
});
|
|
70
|
+
}, []), [M, N] = d(), [P, F] = d(), [I, L] = d(!1), [R, z] = d(!1), [B, V] = d(!1);
|
|
71
|
+
l(() => {
|
|
72
|
+
I || h(a.values);
|
|
73
|
+
}, [a]), l(() => {
|
|
74
|
+
R || b(a.lineItems);
|
|
75
|
+
}, [a]), l(() => {
|
|
76
|
+
B || (S(a.discount), w(a.tax), E(a.total || void 0));
|
|
77
|
+
}, [a]);
|
|
78
|
+
let H = c((e) => {
|
|
79
|
+
h((t) => ({
|
|
80
|
+
...t,
|
|
81
|
+
...e
|
|
82
|
+
})), L(!0), D((t) => {
|
|
83
|
+
if (!t) return t;
|
|
84
|
+
let n = { ...t };
|
|
85
|
+
for (let t of Object.keys(e)) delete n[t];
|
|
86
|
+
return Object.keys(n).length ? n : void 0;
|
|
87
|
+
}), j();
|
|
88
|
+
}, [j]), U = c((e, t) => {
|
|
89
|
+
N((n) => {
|
|
90
|
+
if (!n?.[e] && !t) return n;
|
|
91
|
+
let r = {
|
|
92
|
+
...n,
|
|
93
|
+
[e]: t
|
|
94
|
+
};
|
|
95
|
+
return t || delete r[e], Object.keys(r).length ? r : void 0;
|
|
96
|
+
});
|
|
97
|
+
}, []), W = c((e, t) => {
|
|
98
|
+
U(e, g(e, t, i));
|
|
99
|
+
}, [i, U]), G = c(() => {
|
|
100
|
+
E(void 0), W("total", void 0), j();
|
|
101
|
+
}, [W, j]), K = c((e, t = []) => {
|
|
102
|
+
let n = _(e, i);
|
|
103
|
+
F((r) => {
|
|
104
|
+
let i = r?.[e.id], a = { ...i };
|
|
105
|
+
for (let e of [
|
|
106
|
+
"price",
|
|
107
|
+
"amount",
|
|
108
|
+
"quantity"
|
|
109
|
+
]) n[e] ? a[e] = n[e] : delete a[e];
|
|
110
|
+
t.includes("description") && delete a.description;
|
|
111
|
+
let o = Object.keys(a).length > 0;
|
|
112
|
+
if (!i && !o) return r;
|
|
113
|
+
let s = { ...r };
|
|
114
|
+
return o ? s[e.id] = a : delete s[e.id], Object.keys(s).length ? s : void 0;
|
|
115
|
+
});
|
|
116
|
+
}, [i]), q = c((e, t, n) => {
|
|
117
|
+
F((r) => ({
|
|
118
|
+
...r,
|
|
119
|
+
[e]: {
|
|
120
|
+
...r?.[e],
|
|
121
|
+
[t]: n
|
|
122
|
+
}
|
|
123
|
+
}));
|
|
124
|
+
}, []), J = c((e, t, n = []) => {
|
|
125
|
+
let r = y.find((t) => t.id === e);
|
|
126
|
+
if (!r) return;
|
|
127
|
+
let i = t(r);
|
|
128
|
+
b(y.map((t) => t.id === e ? i : t)), K(i, n), z(!0), G();
|
|
129
|
+
}, [
|
|
227
130
|
G,
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
let e = E.isDirty || O.hasUnsavedVendorChanges || !!k.stagedFile || k.isFileDeletionPending;
|
|
239
|
-
switch (ze({
|
|
240
|
-
isUnsavedPromptOpen: m,
|
|
241
|
-
isLocked: T,
|
|
242
|
-
isDirty: e
|
|
243
|
-
})) {
|
|
244
|
-
case "dismiss-prompt":
|
|
245
|
-
h(!1);
|
|
131
|
+
y,
|
|
132
|
+
K
|
|
133
|
+
]), Y = c((e, t) => {
|
|
134
|
+
let n = { ...t };
|
|
135
|
+
for (let r of m) {
|
|
136
|
+
let a = t[r];
|
|
137
|
+
if (a === void 0) continue;
|
|
138
|
+
let o = p(a);
|
|
139
|
+
if (o === null) {
|
|
140
|
+
q(e, r, i.numbersOnly);
|
|
246
141
|
return;
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
return;
|
|
250
|
-
default: l(!1);
|
|
142
|
+
}
|
|
143
|
+
n[r] = o;
|
|
251
144
|
}
|
|
145
|
+
J(e, (e) => {
|
|
146
|
+
let t = {
|
|
147
|
+
...e,
|
|
148
|
+
...n
|
|
149
|
+
};
|
|
150
|
+
return "amount" in n ? t : {
|
|
151
|
+
...t,
|
|
152
|
+
amount: v(t.quantity, t.price, t.amount)
|
|
153
|
+
};
|
|
154
|
+
}, Object.keys(n));
|
|
252
155
|
}, [
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
156
|
+
J,
|
|
157
|
+
i,
|
|
158
|
+
q
|
|
159
|
+
]), X = c((e, t) => {
|
|
160
|
+
J(e, (e) => {
|
|
161
|
+
let n = Number.parseFloat(e.quantity), r = String(Math.max(1, (Number.isFinite(n) ? n : 1) + t));
|
|
162
|
+
return {
|
|
163
|
+
...e,
|
|
164
|
+
quantity: r,
|
|
165
|
+
amount: v(r, e.price, e.amount)
|
|
166
|
+
};
|
|
167
|
+
});
|
|
168
|
+
}, [J]), Z = c((e) => {
|
|
169
|
+
F((t) => {
|
|
170
|
+
if (!t?.[e]) return t;
|
|
171
|
+
let n = { ...t };
|
|
172
|
+
return delete n[e], Object.keys(n).length ? n : void 0;
|
|
173
|
+
});
|
|
174
|
+
}, []), Q = c((e) => {
|
|
175
|
+
Z(e), b((t) => t.length <= 1 ? t : t.filter((t) => t.id !== e)), z(!0), G();
|
|
176
|
+
}, [Z, G]), ne = c(() => {
|
|
177
|
+
b((e) => [...e, o()]), z(!0), G();
|
|
178
|
+
}, [G]), $ = c((e, t, n) => {
|
|
179
|
+
let r = p(t);
|
|
180
|
+
if (r === null) {
|
|
181
|
+
U(e, i.numbersOnly);
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
n(r), V(!0), G(), W(e, r);
|
|
266
185
|
}, [
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
186
|
+
G,
|
|
187
|
+
i,
|
|
188
|
+
W,
|
|
189
|
+
U
|
|
190
|
+
]), re = c((e) => $("discount", e, S), [$]), ie = c((e) => $("tax", e, w), [$]), ae = c((e) => {
|
|
191
|
+
let t = p(e);
|
|
192
|
+
if (t === null) {
|
|
193
|
+
U("total", i.numbersOnly);
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
E(t), V(!0), W("total", t), j();
|
|
276
197
|
}, [
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
]),
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
onTotalChange: E.onTotalChange,
|
|
320
|
-
onAddLineItem: E.onAddLineItem,
|
|
321
|
-
errors: E.lineItemErrors,
|
|
322
|
-
totalsErrors: E.totalsErrors,
|
|
323
|
-
testId: r.lineItems
|
|
324
|
-
},
|
|
325
|
-
documentPanel: /* @__PURE__ */ s(Ve, {
|
|
326
|
-
payableId: g,
|
|
327
|
-
readOnly: T,
|
|
328
|
-
isDocumentPending: !!g && !S?.file && (_.isLoading || S?.ocr_status === "processing"),
|
|
329
|
-
file: S?.file ? {
|
|
330
|
-
id: S.file.id,
|
|
331
|
-
name: S.file.name,
|
|
332
|
-
url: S.file.url,
|
|
333
|
-
mimetype: S.file.mimetype
|
|
334
|
-
} : void 0,
|
|
335
|
-
staging: {
|
|
336
|
-
stagedFile: k.stagedFile,
|
|
337
|
-
onFileStaged: k.stageFile,
|
|
338
|
-
onClearStagedFile: k.clearStagedFile,
|
|
339
|
-
isSaving: A
|
|
340
|
-
},
|
|
341
|
-
deletion: {
|
|
342
|
-
isPending: k.isFileDeletionPending,
|
|
343
|
-
onRequest: k.requestFileDeletion,
|
|
344
|
-
onDetachNow: k.detachFileNow,
|
|
345
|
-
isDeleting: k.isDeletingFile,
|
|
346
|
-
hasFailed: k.hasFileDeletionFailed
|
|
347
|
-
}
|
|
348
|
-
}),
|
|
349
|
-
menuItems: bt,
|
|
350
|
-
readOnly: T,
|
|
351
|
-
detail: u ? {
|
|
352
|
-
view: Mt,
|
|
353
|
-
actions: B,
|
|
354
|
-
scheduledSummary: N.hasScheduledPayment && N.scheduledDateLabel ? d.scheduledSummary(N.scheduledDateLabel) : void 0,
|
|
355
|
-
showApprovalOverrideNotice: _t && !!S?.approval_policy_id,
|
|
356
|
-
onEditPaymentInstructions: D && ht ? I.open : void 0,
|
|
357
|
-
paymentInstructionsForm: D && (ht || L && S?.status === "rejected") ? {
|
|
358
|
-
isOpen: I.isOpen,
|
|
359
|
-
values: I.values,
|
|
360
|
-
errors: I.errors,
|
|
361
|
-
isSaving: I.isSaving,
|
|
362
|
-
onOpen: I.open,
|
|
363
|
-
onCancel: I.close,
|
|
364
|
-
onChange: I.onChange,
|
|
365
|
-
onSave: I.save
|
|
366
|
-
} : void 0,
|
|
367
|
-
hideMissingPaymentInstructions: S?.status === "paid" || S?.status === "canceled",
|
|
368
|
-
isLoading: U,
|
|
369
|
-
isError: W,
|
|
370
|
-
paymentHistoryError: N.isError || q.isError,
|
|
371
|
-
paymentHistoryLoading: N.isResolving || q.isLoading
|
|
372
|
-
} : void 0,
|
|
373
|
-
isLineItemsLoading: v.isResolving,
|
|
374
|
-
isSaving: H,
|
|
375
|
-
isSavingDraft: k.isSavingDraft,
|
|
376
|
-
isSubmitting: k.isFinalizing,
|
|
377
|
-
onCancel: Z,
|
|
378
|
-
onCollapse: u ? Ze : void 0,
|
|
379
|
-
onSaveDraft: k.saveDraft,
|
|
380
|
-
onFinalize: k.finalize,
|
|
381
|
-
scrollToErrorToken: k.scrollToErrorToken,
|
|
382
|
-
showSubmit: !T && C,
|
|
383
|
-
testId: r.dialog
|
|
384
|
-
}),
|
|
385
|
-
/* @__PURE__ */ s(he, {
|
|
386
|
-
open: m,
|
|
387
|
-
onSaveDraft: Lt,
|
|
388
|
-
onDiscard: It,
|
|
389
|
-
onCancel: () => h(!1),
|
|
390
|
-
isSaving: k.isSavingDraft,
|
|
391
|
-
isSaveDraftDisabled: Q,
|
|
392
|
-
labels: d.unsavedChanges,
|
|
393
|
-
testId: r.unsavedDialog,
|
|
394
|
-
saveDraftTestId: r.unsavedSaveDraft,
|
|
395
|
-
discardTestId: r.unsavedDiscard,
|
|
396
|
-
closeTestId: r.unsavedClose
|
|
397
|
-
}),
|
|
398
|
-
/* @__PURE__ */ s(n, {
|
|
399
|
-
...vt,
|
|
400
|
-
labels: { cancelButton: d.actions.decisionDialog.cancelButton },
|
|
401
|
-
testId: r.decisionDialog,
|
|
402
|
-
confirmTestId: r.decisionConfirm,
|
|
403
|
-
reasonTestId: r.decisionReason
|
|
404
|
-
}),
|
|
405
|
-
/* @__PURE__ */ s(n, {
|
|
406
|
-
...V.dialog,
|
|
407
|
-
labels: { cancelButton: d.actions.decisionDialog.cancelButton },
|
|
408
|
-
testId: r.deleteDraftDialog,
|
|
409
|
-
confirmTestId: r.deleteDraftConfirm
|
|
410
|
-
}),
|
|
411
|
-
/* @__PURE__ */ s(n, {
|
|
412
|
-
open: $.removeConfirmation.open,
|
|
413
|
-
copy: $.removeConfirmation.copy,
|
|
414
|
-
onConfirm: $.removeConfirmation.onConfirm,
|
|
415
|
-
onCancel: $.removeConfirmation.onCancel,
|
|
416
|
-
isPending: $.removeConfirmation.isPending,
|
|
417
|
-
confirmIcon: /* @__PURE__ */ s(Je, {}),
|
|
418
|
-
labels: { cancelButton: $.removeConfirmation.cancelButtonLabel },
|
|
419
|
-
testId: r.duplicateRemoveDialog,
|
|
420
|
-
confirmTestId: r.duplicateRemoveConfirm
|
|
421
|
-
}),
|
|
422
|
-
/* @__PURE__ */ s(me, { ...R.dialogProps }),
|
|
423
|
-
u && S ? /* @__PURE__ */ s(xe, {
|
|
424
|
-
ref: ft,
|
|
425
|
-
payable: S,
|
|
426
|
-
onMissingAchInstructions: L ? I.open : void 0,
|
|
427
|
-
poweredByBankName: Qe,
|
|
428
|
-
labels: d.payBill
|
|
429
|
-
}) : null
|
|
430
|
-
] });
|
|
198
|
+
j,
|
|
199
|
+
i,
|
|
200
|
+
W,
|
|
201
|
+
U
|
|
202
|
+
]), oe = u(() => y.map((e) => ({
|
|
203
|
+
...e,
|
|
204
|
+
onChange: (t) => Y(e.id, t),
|
|
205
|
+
onQuantityStep: (t) => X(e.id, t),
|
|
206
|
+
onRemove: () => Q(e.id)
|
|
207
|
+
})), [
|
|
208
|
+
y,
|
|
209
|
+
Y,
|
|
210
|
+
Q,
|
|
211
|
+
X
|
|
212
|
+
]), se = u(() => t(y, C, x), [
|
|
213
|
+
y,
|
|
214
|
+
C,
|
|
215
|
+
x
|
|
216
|
+
]);
|
|
217
|
+
return {
|
|
218
|
+
values: f,
|
|
219
|
+
errors: te,
|
|
220
|
+
setErrors: k,
|
|
221
|
+
setSaveFailureMessage: A,
|
|
222
|
+
lineItemErrors: P,
|
|
223
|
+
setLineItemErrors: F,
|
|
224
|
+
totalsErrors: M,
|
|
225
|
+
setTotalsErrors: N,
|
|
226
|
+
onChange: H,
|
|
227
|
+
lineItems: y,
|
|
228
|
+
lineItemRows: oe,
|
|
229
|
+
discount: x,
|
|
230
|
+
onDiscountChange: re,
|
|
231
|
+
tax: C,
|
|
232
|
+
onTaxChange: ie,
|
|
233
|
+
total: T ?? se,
|
|
234
|
+
totalOverride: T,
|
|
235
|
+
onTotalChange: ae,
|
|
236
|
+
onAddLineItem: ne,
|
|
237
|
+
isTotalsDirty: B,
|
|
238
|
+
isDirty: I || R || B
|
|
239
|
+
};
|
|
431
240
|
}
|
|
432
241
|
//#endregion
|
|
433
|
-
export {
|
|
242
|
+
export { y as useBillForm };
|