@tesouro/embedded-components-react 0.5.46 → 0.5.47
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 +8 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index34.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index45.js +7 -49
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index47.js +46 -36
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index48.js +34 -184
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +163 -75
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index50.js +75 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index51.js +22 -93
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index52.js +88 -317
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +322 -12
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js +12 -64
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js +57 -50
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +52 -214
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index57.js +215 -35
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index58.js +35 -234
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index59.js +240 -21
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index60.js +21 -532
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +536 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index62.js +4 -42
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index63.js +38 -230
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index64.js +234 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index65.js +3 -4
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index66.js +2 -44
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index67.js +46 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index68.js +1 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index69.js +6 -11
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index70.js +11 -127
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index71.js +129 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index72.js +3 -127
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index73.js +124 -8
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index74.js +8 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index75.js +8 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index76.js +44 -18
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index77.js +20 -28
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index78.js +27 -82
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index79.js +83 -47
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index80.js +47 -250
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index81.js +241 -122
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index82.js +125 -211
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +219 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index84.js +4 -7
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index85.js +5 -98
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index86.js +100 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index87.js +0 -26
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index88.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index.js +28 -28
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/index.js +4 -4
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/user/useOrganizationUserNames.js +13 -1
- package/dist/libs/tesouro-embedded-components-react/shared/util/dist/lib/auditHistory/buildPayableAuditHistory.js +137 -0
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/index8.js +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,326 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { hasAnyScope as e } from "../../../shared/data-access/dist/lib/hasAnyScope.js";
|
|
6
|
+
import { Scope as t } from "../../../shared/data-access/dist/lib/scopes.js";
|
|
7
|
+
import "../../../shared/data-access/dist/index.js";
|
|
8
|
+
import { useWidgetConfig as n } from "../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
9
|
+
import "../../../shared/feature/dist/index.js";
|
|
10
|
+
import { useCounterpartsQuery as r } from "../../../shared/counterpart-management/data-access/dist/index3.js";
|
|
11
|
+
import { useCreateCounterpartBankAccountMutation as i, useUpdateCounterpartBankAccountMutation as a } from "../../../shared/counterpart-management/data-access/dist/index5.js";
|
|
12
|
+
import { usePayableSuggestionsQuery as ee } from "../../data-access/dist/index18.js";
|
|
13
|
+
import "../../data-access/dist/index.js";
|
|
14
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as te } from "../../../shared/counterpart-management/feature/dist/lib/labels.js";
|
|
15
|
+
import { counterpartFormBankAccountToCreatePayload as ne, counterpartFormBankAccountToUpdatePayload as re, getAchInstructions as o, getCounterpartEmail as s, getCounterpartName as c, getPayableAchInstructions as ie, isAchCompatibleBankAccount as l, resolveCounterpartBankAccountWrite as ae, validateAchFormValues as oe } from "../../../shared/counterpart-management/feature/dist/lib/helpers.js";
|
|
16
|
+
import { useCounterpartDetails as se } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js";
|
|
17
|
+
import { useCounterpartForm as ce } from "../../../shared/counterpart-management/feature/dist/lib/useCounterpartForm.js";
|
|
18
|
+
import "../../../shared/counterpart-management/feature/dist/index.js";
|
|
19
|
+
import { VENDOR_SECTION_PROPS_LABELS_EN as le } from "./index49.js";
|
|
20
|
+
import { buildVendorPrefill as ue } from "./index51.js";
|
|
21
|
+
import { VendorInlineForm as de } from "./index52.js";
|
|
22
|
+
import { useCallback as u, useEffect as d, useMemo as f, useRef as p, useState as m } from "react";
|
|
23
|
+
import { jsx as fe } from "react/jsx-runtime";
|
|
1
24
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
var pe = 10, me = 300, h = {
|
|
26
|
+
accountHolderName: "",
|
|
27
|
+
routingNumber: "",
|
|
28
|
+
accountNumber: ""
|
|
29
|
+
};
|
|
30
|
+
function he(e) {
|
|
31
|
+
return {
|
|
32
|
+
accountHolderName: e.account_holder_name ?? "",
|
|
33
|
+
routingNumber: e.routing_number ?? "",
|
|
34
|
+
accountNumber: e.account_number ?? ""
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function g(e, t) {
|
|
38
|
+
return e.accountHolderName.trim() === t.accountHolderName.trim() && e.routingNumber.trim() === t.routingNumber.trim() && e.accountNumber.trim() === t.accountNumber.trim();
|
|
39
|
+
}
|
|
40
|
+
function ge(e, t) {
|
|
41
|
+
return e?.find((e) => e.id === t && l(e)) ?? o(e);
|
|
42
|
+
}
|
|
43
|
+
function _({ payableId: o, counterpartId: l, payableCounterpartId: _, payableCounterpartBankAccountId: _e, isVendorKnown: ve = !0, onCounterpartChange: ye, requiredError: be, extractedVendor: xe, readOnly: v = !1, canEditVendor: Se = !0, canEditPaymentInstructions: Ce = !0, canAddPaymentInstructions: we = !0, confirmDiscard: y = (e) => e(), labels: Te }) {
|
|
44
|
+
let b = {
|
|
45
|
+
...le,
|
|
46
|
+
...Te
|
|
47
|
+
}, { initResponse: Ee } = n(), De = e(Ee?.scopes, [t.CounterpartReadOrg]), [x, Oe] = m(""), [ke, Ae] = m(""), [S, C] = m(), [je, Me] = m("none"), [Ne, Pe] = m(), [Fe, w] = m(!1), [T, E] = m(!1), [D, O] = m(h), Ie = p(D);
|
|
48
|
+
Ie.current = D;
|
|
49
|
+
let k = p(h), [Le, A] = m(), [j, M] = m(), Re = p(l), [ze, Be] = m(!1), N = T && !g(D, k.current), P = u(() => {
|
|
50
|
+
E(!1), O(h), k.current = h, A(void 0);
|
|
51
|
+
}, []), F = u((e) => {
|
|
52
|
+
Be(!0), ye(e);
|
|
53
|
+
}, [ye]), I = ee(o, { enabled: !v && !!o && !l && !_ }).data?.suggested_counterpart?.id;
|
|
54
|
+
d(() => {
|
|
55
|
+
!v && !ze && !l && !_ && I && F(I);
|
|
56
|
+
}, [
|
|
57
|
+
l,
|
|
58
|
+
_,
|
|
59
|
+
v,
|
|
60
|
+
ze,
|
|
61
|
+
I,
|
|
62
|
+
F
|
|
63
|
+
]), d(() => {
|
|
64
|
+
Re.current !== l && (Re.current = l, P(), M(void 0));
|
|
65
|
+
}, [l, P]), d(() => {
|
|
66
|
+
let e = setTimeout(() => {
|
|
67
|
+
Ae(x.trim());
|
|
68
|
+
}, me);
|
|
69
|
+
return () => clearTimeout(e);
|
|
70
|
+
}, [x]);
|
|
71
|
+
let L = r({
|
|
72
|
+
sort: "counterpart_name",
|
|
73
|
+
order: "asc",
|
|
74
|
+
limit: pe,
|
|
75
|
+
counterpart_name__icontains: ke || void 0,
|
|
76
|
+
is_vendor: !0,
|
|
77
|
+
enabled: !v && (S === "edit" || !S && !l) && ve && De
|
|
78
|
+
}), R = se({
|
|
79
|
+
selectedId: l,
|
|
80
|
+
enabled: De
|
|
81
|
+
}), Ve = i(), He = a(), z = ce({
|
|
82
|
+
view: je,
|
|
83
|
+
setView: Me,
|
|
84
|
+
selectedId: Ne,
|
|
85
|
+
setSelectedId: Pe,
|
|
86
|
+
messages: te,
|
|
87
|
+
counterpartType: "vendor",
|
|
88
|
+
counterpart: R.counterpart,
|
|
89
|
+
primaryAddress: R.primaryAddress,
|
|
90
|
+
includeBankAccount: !1
|
|
91
|
+
}), { openCreate: Ue, openEdit: We, close: Ge, setValues: B, submit: Ke } = z, V = f(() => {
|
|
92
|
+
let e = R.counterpart;
|
|
93
|
+
if (!e) return;
|
|
94
|
+
if (R.isBankAccountsLoading) return {
|
|
95
|
+
name: c(e),
|
|
96
|
+
email: s(e),
|
|
97
|
+
methodLabel: b.paymentMethodLoading,
|
|
98
|
+
hasPaymentInstructions: !1
|
|
99
|
+
};
|
|
100
|
+
if (R.isBankAccountsError) return {
|
|
101
|
+
name: c(e),
|
|
102
|
+
email: s(e),
|
|
103
|
+
methodLabel: b.paymentMethodUnavailable,
|
|
104
|
+
hasPaymentInstructions: !1
|
|
105
|
+
};
|
|
106
|
+
let t = ie(R.bankAccounts);
|
|
107
|
+
return {
|
|
108
|
+
name: c(e),
|
|
109
|
+
email: s(e),
|
|
110
|
+
methodLabel: t ? b.paymentInstructionsValue(t.account_number?.slice(-4) ?? "") : b.noMethod,
|
|
111
|
+
hasPaymentInstructions: !!t
|
|
112
|
+
};
|
|
113
|
+
}, [
|
|
114
|
+
R.bankAccounts,
|
|
115
|
+
R.counterpart,
|
|
116
|
+
R.isBankAccountsError,
|
|
117
|
+
R.isBankAccountsLoading,
|
|
118
|
+
b
|
|
119
|
+
]), H = l === _ ? _e : void 0, U = f(() => ge(R.bankAccounts, H), [R.bankAccounts, H]), qe = f(() => ie(R.bankAccounts)?.id, [R.bankAccounts]), W = !R.counterpart || R.isLoading || R.isFetching || R.isError || R.isAddressesLoading || R.isAddressesFetching || R.isAddressesError || R.isBankAccountsLoading || R.isBankAccountsFetching || R.isBankAccountsError, G = u(() => {
|
|
120
|
+
Ge(), C(void 0), w(!1);
|
|
121
|
+
}, [Ge]), K = f(() => ue(xe), [xe]), q = u((e) => {
|
|
122
|
+
if (w(!1), e === "edit") Pe(l), We();
|
|
123
|
+
else {
|
|
124
|
+
Ue();
|
|
125
|
+
let e = x.trim();
|
|
126
|
+
B((t) => ({
|
|
127
|
+
...t,
|
|
128
|
+
entityType: "organization",
|
|
129
|
+
legalName: e || K?.legalName || t.legalName,
|
|
130
|
+
email: K?.email || t.email,
|
|
131
|
+
phone: K?.phone || t.phone,
|
|
132
|
+
address: K?.address ?? t.address
|
|
133
|
+
}));
|
|
134
|
+
}
|
|
135
|
+
C(e);
|
|
136
|
+
}, [
|
|
137
|
+
l,
|
|
138
|
+
Ue,
|
|
139
|
+
We,
|
|
140
|
+
x,
|
|
141
|
+
B,
|
|
142
|
+
K
|
|
143
|
+
]), Je = u(() => {
|
|
144
|
+
let e = U ? he(U) : h;
|
|
145
|
+
k.current = e, O(e), A(void 0), E(!0);
|
|
146
|
+
}, [U]), Ye = u(() => {
|
|
147
|
+
N ? y(P) : P();
|
|
148
|
+
}, [
|
|
149
|
+
P,
|
|
150
|
+
y,
|
|
151
|
+
N
|
|
152
|
+
]), J = u(() => {
|
|
153
|
+
G(), P();
|
|
154
|
+
}, [P, G]), Y = Fe || N, X = u((e) => {
|
|
155
|
+
let t = () => {
|
|
156
|
+
J(), e();
|
|
157
|
+
};
|
|
158
|
+
Y ? y(t) : t();
|
|
159
|
+
}, [
|
|
160
|
+
y,
|
|
161
|
+
J,
|
|
162
|
+
Y
|
|
163
|
+
]), Xe = u(() => {
|
|
164
|
+
Y ? y(J) : J();
|
|
165
|
+
}, [
|
|
166
|
+
y,
|
|
167
|
+
J,
|
|
168
|
+
Y
|
|
169
|
+
]), Ze = u(async () => {
|
|
170
|
+
let e = l, t = !1, n = Ie.current;
|
|
171
|
+
if (!g(n, k.current)) {
|
|
172
|
+
let e = oe(n);
|
|
173
|
+
if (Object.keys(e).length > 0) return A(e), E(!0), { ok: !1 };
|
|
174
|
+
}
|
|
175
|
+
if (S === "edit" && W) return { ok: !1 };
|
|
176
|
+
if (S) {
|
|
177
|
+
let n = await Ke();
|
|
178
|
+
if (!n.ok) return { ok: !1 };
|
|
179
|
+
S === "create" ? (e = n.counterpartId, t = !0, G(), M(void 0), F(e)) : (G(), e = n.counterpartId ?? e);
|
|
180
|
+
}
|
|
181
|
+
if (!e) return { ok: !0 };
|
|
182
|
+
let r = R.isBankAccountsLoading || R.isBankAccountsFetching || R.isBankAccountsError;
|
|
183
|
+
if (g(n, k.current)) {
|
|
184
|
+
if (t) return {
|
|
185
|
+
ok: !0,
|
|
186
|
+
counterpartId: e
|
|
187
|
+
};
|
|
188
|
+
let n = j ?? H;
|
|
189
|
+
return n ? (E(!1), {
|
|
190
|
+
ok: !0,
|
|
191
|
+
counterpartId: e,
|
|
192
|
+
counterpartBankAccountId: n
|
|
193
|
+
}) : r ? { ok: !1 } : (E(!1), {
|
|
194
|
+
ok: !0,
|
|
195
|
+
counterpartId: e,
|
|
196
|
+
counterpartBankAccountId: qe
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
if (r) return { ok: !1 };
|
|
200
|
+
A(void 0);
|
|
201
|
+
let i = ae(R.bankAccounts, j ?? U?.id), a;
|
|
202
|
+
return i.kind === "update" ? (await He.mutateAsync({
|
|
203
|
+
path: {
|
|
204
|
+
counterpart_id: e,
|
|
205
|
+
bank_account_id: i.bankAccountId
|
|
206
|
+
},
|
|
207
|
+
body: re(n, { includeAchDefaults: i.includeAchDefaults })
|
|
208
|
+
}), a = i.bankAccountId) : a = (await Ve.mutateAsync({
|
|
209
|
+
path: { counterpart_id: e },
|
|
210
|
+
body: ne(n, { isDefaultForCurrency: i.isDefaultForCurrency })
|
|
211
|
+
}))?.id, k.current = n, M(a), E(!1), {
|
|
212
|
+
ok: !0,
|
|
213
|
+
counterpartId: e,
|
|
214
|
+
counterpartBankAccountId: a
|
|
215
|
+
};
|
|
216
|
+
}, [
|
|
217
|
+
P,
|
|
218
|
+
G,
|
|
219
|
+
l,
|
|
220
|
+
Ve,
|
|
221
|
+
R.bankAccounts,
|
|
222
|
+
R.isBankAccountsError,
|
|
223
|
+
R.isBankAccountsFetching,
|
|
224
|
+
R.isBankAccountsLoading,
|
|
225
|
+
S,
|
|
226
|
+
W,
|
|
227
|
+
H,
|
|
228
|
+
qe,
|
|
229
|
+
F,
|
|
230
|
+
U,
|
|
231
|
+
Ke,
|
|
232
|
+
He,
|
|
233
|
+
j
|
|
234
|
+
]), Qe = f(() => (L.data?.data ?? []).map((e) => ({
|
|
235
|
+
name: c(e),
|
|
236
|
+
email: s(e),
|
|
237
|
+
onSelect: () => {
|
|
238
|
+
X(() => F(e.id));
|
|
239
|
+
}
|
|
240
|
+
})), [
|
|
241
|
+
L.data,
|
|
242
|
+
X,
|
|
243
|
+
F
|
|
244
|
+
]), $e = u((e) => {
|
|
245
|
+
w(!0), B((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
|
|
246
|
+
...t,
|
|
247
|
+
...e,
|
|
248
|
+
firstName: t.firstName || t.legalName,
|
|
249
|
+
legalName: t.legalName
|
|
250
|
+
} : e.entityType === "organization" && t.entityType !== "organization" ? {
|
|
251
|
+
...t,
|
|
252
|
+
...e,
|
|
253
|
+
legalName: t.legalName || [t.firstName, t.lastName].filter(Boolean).join(" ")
|
|
254
|
+
} : {
|
|
255
|
+
...t,
|
|
256
|
+
...e
|
|
257
|
+
});
|
|
258
|
+
}, [B]), et = u((e) => {
|
|
259
|
+
w(!0), B((t) => ({
|
|
260
|
+
...t,
|
|
261
|
+
address: {
|
|
262
|
+
...t.address,
|
|
263
|
+
...e
|
|
10
264
|
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
265
|
+
}));
|
|
266
|
+
}, [B]), Z = {
|
|
267
|
+
query: x,
|
|
268
|
+
onQueryChange: Oe,
|
|
269
|
+
isLoading: !ve || !Ee || !!l && R.isLoading || L.isFetching,
|
|
270
|
+
onAddVendor: () => {
|
|
271
|
+
X(() => q("create"));
|
|
272
|
+
},
|
|
273
|
+
results: Qe
|
|
274
|
+
}, Q = we && (S === "create" || !W) ? {
|
|
275
|
+
isOpen: T,
|
|
276
|
+
values: D,
|
|
277
|
+
errors: Le,
|
|
278
|
+
onOpen: Je,
|
|
279
|
+
onCancel: Ye,
|
|
280
|
+
onChange: (e) => {
|
|
281
|
+
O((t) => ({
|
|
282
|
+
...t,
|
|
283
|
+
...e
|
|
284
|
+
})), A(void 0);
|
|
285
|
+
}
|
|
286
|
+
} : void 0, $ = {
|
|
287
|
+
prepareVendorForSave: Ze,
|
|
288
|
+
hasUnsavedVendorChanges: Y,
|
|
289
|
+
isEditingPayTo: !!S || T,
|
|
290
|
+
activePayToOperation: S ? "vendor" : T ? V?.hasPaymentInstructions ? "existingInstructions" : "missingInstructions" : void 0,
|
|
291
|
+
discardPayToEdits: J,
|
|
292
|
+
openPaymentInstructions: Je
|
|
293
|
+
};
|
|
294
|
+
return S ? {
|
|
295
|
+
mode: "creating",
|
|
296
|
+
newVendorForm: /* @__PURE__ */ fe(de, {
|
|
297
|
+
mode: S,
|
|
298
|
+
values: z.values,
|
|
299
|
+
errors: z.errors,
|
|
300
|
+
onChange: $e,
|
|
301
|
+
onAddressChange: et,
|
|
302
|
+
sectionsToExpand: z.sectionsToExpand,
|
|
303
|
+
onAddressExpand: z.expandAddress,
|
|
304
|
+
onCancel: Xe,
|
|
305
|
+
paymentInstructions: Q,
|
|
306
|
+
search: S === "edit" && !v ? Z : void 0
|
|
307
|
+
}),
|
|
308
|
+
...$
|
|
309
|
+
} : V ? {
|
|
310
|
+
mode: "resolved",
|
|
311
|
+
summary: V,
|
|
312
|
+
onEdit: Se && !W ? () => q("edit") : void 0,
|
|
313
|
+
paymentInstructions: Q ? {
|
|
314
|
+
...Q,
|
|
315
|
+
canEditExisting: Ce
|
|
316
|
+
} : void 0,
|
|
317
|
+
...$
|
|
318
|
+
} : {
|
|
319
|
+
mode: "selecting",
|
|
320
|
+
error: L.isError ? b.searchFailed : R.isError ? b.vendorDetailsFailed : be,
|
|
321
|
+
search: Z,
|
|
322
|
+
...$
|
|
323
|
+
};
|
|
14
324
|
}
|
|
15
325
|
//#endregion
|
|
16
|
-
export {
|
|
326
|
+
export { _ as useVendorSectionProps };
|
|
@@ -1,68 +1,16 @@
|
|
|
1
|
-
import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
|
|
2
|
-
import "../../data-access/dist/index.js";
|
|
3
1
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index54.js
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
16
|
-
}
|
|
17
|
-
function a(e) {
|
|
18
|
-
return n(e) ?? 0;
|
|
19
|
-
}
|
|
20
|
-
function o(e) {
|
|
21
|
-
let t = Number.parseFloat(e);
|
|
22
|
-
return Number.isFinite(t) ? t : 0;
|
|
23
|
-
}
|
|
24
|
-
function s(e) {
|
|
25
|
-
return (e / 100).toFixed(2);
|
|
26
|
-
}
|
|
27
|
-
function c({ values: e, initialLineItems: r, counterpartId: i, clearCounterpart: a, counterpartBankAccountId: o, editedTotals: s, currentTotals: c, lineItems: d, document: f }) {
|
|
28
|
-
let p = { currency: t };
|
|
29
|
-
if (i ? p.counterpart_id = i : a && (p.counterpart_id = null), i ? p.counterpart_bank_account_id = o ?? null : a && (p.counterpart_bank_account_id = null), e.invoiceNumber && (p.document_id = e.invoiceNumber), e.invoiceDate && (p.issued_at = e.invoiceDate), e.dueDate && (p.due_date = e.dueDate), f && (p.base64_encoded_file = f.base64EncodedFile, p.file_name = f.fileName), s && (p.discount = n(s.discount) ?? 0, p.tax_amount = n(s.tax) ?? 0, s.total !== void 0 && (p.total_amount = (n(s.total) ?? 0) + (n(s.discount) ?? 0))), c && d) {
|
|
30
|
-
let e = u(d).reduce((e, t) => e + t.subtotal, 0), t = n(c.tax) ?? 0, r = n(c.discount) ?? 0, i = c.total === void 0 ? e + t : (n(c.total) ?? 0) + r;
|
|
31
|
-
p.subtotal = e, p.tax_amount = t, p.total_amount = i;
|
|
32
|
-
} else if (r && !("total_amount" in p)) {
|
|
33
|
-
let e = l(r, s?.tax);
|
|
34
|
-
e !== void 0 && (p.total_amount = e);
|
|
35
|
-
}
|
|
36
|
-
return p;
|
|
37
|
-
}
|
|
38
|
-
function l(e, t) {
|
|
39
|
-
let r = !1, a = e.reduce((e, t) => {
|
|
40
|
-
if (!i(t)) return e;
|
|
41
|
-
let a = n(t.amount);
|
|
42
|
-
return a === null ? e : (r = !0, e + a);
|
|
43
|
-
}, 0);
|
|
44
|
-
if (r) return a + (t ? n(t) ?? 0 : 0);
|
|
45
|
-
}
|
|
46
|
-
function u(e) {
|
|
47
|
-
return e.filter(i).map((e) => {
|
|
48
|
-
let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a), s = t ?? o;
|
|
49
|
-
return {
|
|
50
|
-
name: e.description,
|
|
51
|
-
quantity: i,
|
|
52
|
-
unit_price: a,
|
|
53
|
-
tax: 0,
|
|
54
|
-
subtotal: s,
|
|
55
|
-
tax_amount: 0,
|
|
56
|
-
total: s,
|
|
57
|
-
...e.glCode ? { ledger_account_id: e.glCode } : {}
|
|
58
|
-
};
|
|
2
|
+
function e(e) {
|
|
3
|
+
return new Promise((t, n) => {
|
|
4
|
+
let r = new FileReader();
|
|
5
|
+
r.onerror = () => n(r.error ?? /* @__PURE__ */ Error("Failed to read file")), r.onload = () => {
|
|
6
|
+
let e = r.result;
|
|
7
|
+
if (typeof e != "string") {
|
|
8
|
+
n(/* @__PURE__ */ Error("Failed to read file as a data URL"));
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
t(e.slice(e.indexOf(",") + 1));
|
|
12
|
+
}, r.readAsDataURL(e);
|
|
59
13
|
});
|
|
60
14
|
}
|
|
61
|
-
function d(e, t) {
|
|
62
|
-
return s(Math.round(o(e) * a(t)));
|
|
63
|
-
}
|
|
64
|
-
function f(e, t, n) {
|
|
65
|
-
return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
|
|
66
|
-
}
|
|
67
15
|
//#endregion
|
|
68
|
-
export {
|
|
16
|
+
export { e as encodeFileToBase64 };
|
|
@@ -1,61 +1,68 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { parseDecimalAmountToMinorUnits as e } from "../../../shared/util/dist/lib/parseDecimalAmountToMinorUnits.js";
|
|
2
|
+
import "../../data-access/dist/index.js";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index55.js
|
|
4
|
-
var
|
|
5
|
-
function
|
|
6
|
-
|
|
7
|
-
return t.poNumber.length > a && (r.poNumber = n.poNumberTooLong), Object.keys(r).length ? r : void 0;
|
|
4
|
+
var t = "USD";
|
|
5
|
+
function n(n) {
|
|
6
|
+
return e(n, t);
|
|
8
7
|
}
|
|
9
|
-
function
|
|
8
|
+
function r(e) {
|
|
10
9
|
let t = e.trim();
|
|
11
|
-
|
|
10
|
+
if (!t) return null;
|
|
11
|
+
let n = Number(t);
|
|
12
|
+
return Number.isFinite(n) && n > 0 ? n : null;
|
|
13
|
+
}
|
|
14
|
+
function i(e) {
|
|
15
|
+
return !!(e.description.trim() || e.glCode.trim() || n(e.price) !== null || n(e.amount) !== null);
|
|
16
|
+
}
|
|
17
|
+
function a(e) {
|
|
18
|
+
return n(e) ?? 0;
|
|
19
|
+
}
|
|
20
|
+
function o(e) {
|
|
21
|
+
let t = Number.parseFloat(e);
|
|
22
|
+
return Number.isFinite(t) ? t : 0;
|
|
23
|
+
}
|
|
24
|
+
function s(e) {
|
|
25
|
+
return (e / 100).toFixed(2);
|
|
12
26
|
}
|
|
13
|
-
function c(
|
|
14
|
-
let
|
|
15
|
-
|
|
16
|
-
let t = n(
|
|
17
|
-
|
|
27
|
+
function c({ values: e, initialLineItems: r, counterpartId: i, clearCounterpart: a, counterpartBankAccountId: o, editedTotals: s, currentTotals: c, lineItems: d, document: f }) {
|
|
28
|
+
let p = { currency: t };
|
|
29
|
+
if (i ? p.counterpart_id = i : a && (p.counterpart_id = null), i ? p.counterpart_bank_account_id = o ?? null : a && (p.counterpart_bank_account_id = null), e.invoiceNumber && (p.document_id = e.invoiceNumber), e.invoiceDate && (p.issued_at = e.invoiceDate), e.dueDate && (p.due_date = e.dueDate), f && (p.base64_encoded_file = f.base64EncodedFile, p.file_name = f.fileName), s && (p.discount = n(s.discount) ?? 0, p.tax_amount = n(s.tax) ?? 0, s.total !== void 0 && (p.total_amount = (n(s.total) ?? 0) + (n(s.discount) ?? 0))), c && d) {
|
|
30
|
+
let e = u(d).reduce((e, t) => e + t.subtotal, 0), t = n(c.tax) ?? 0, r = n(c.discount) ?? 0, i = c.total === void 0 ? e + t : (n(c.total) ?? 0) + r;
|
|
31
|
+
p.subtotal = e, p.tax_amount = t, p.total_amount = i;
|
|
32
|
+
} else if (r && !("total_amount" in p)) {
|
|
33
|
+
let e = l(r, s?.tax);
|
|
34
|
+
e !== void 0 && (p.total_amount = e);
|
|
18
35
|
}
|
|
19
|
-
return
|
|
20
|
-
}
|
|
21
|
-
function l(
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
e.description.trim() || (a.description = s.requiredField), r(e.quantity) === null && (a.quantity = s.requiredField), n(e.price) === null && n(e.amount) === null && (a.price = s.requiredField, a.amount = s.requiredField), Object.keys(a).length && (l[e.id] = a);
|
|
29
|
-
}), {
|
|
30
|
-
formErrors: Object.keys(c).length ? c : void 0,
|
|
31
|
-
lineItemErrors: Object.keys(l).length ? l : void 0
|
|
32
|
-
};
|
|
36
|
+
return p;
|
|
37
|
+
}
|
|
38
|
+
function l(e, t) {
|
|
39
|
+
let r = !1, a = e.reduce((e, t) => {
|
|
40
|
+
if (!i(t)) return e;
|
|
41
|
+
let a = n(t.amount);
|
|
42
|
+
return a === null ? e : (r = !0, e + a);
|
|
43
|
+
}, 0);
|
|
44
|
+
if (r) return a + (t ? n(t) ?? 0 : 0);
|
|
33
45
|
}
|
|
34
46
|
function u(e) {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
return e.filter(i).map((e) => {
|
|
48
|
+
let t = n(e.amount), i = r(e.quantity) ?? 1, a = n(e.price) ?? (t === null ? 0 : Math.round(t / i)), o = Math.round(i * a), s = t ?? o;
|
|
49
|
+
return {
|
|
50
|
+
name: e.description,
|
|
51
|
+
quantity: i,
|
|
52
|
+
unit_price: a,
|
|
53
|
+
tax: 0,
|
|
54
|
+
subtotal: s,
|
|
55
|
+
tax_amount: 0,
|
|
56
|
+
total: s,
|
|
57
|
+
...e.glCode ? { ledger_account_id: e.glCode } : {}
|
|
58
|
+
};
|
|
59
|
+
});
|
|
39
60
|
}
|
|
40
61
|
function d(e, t) {
|
|
41
|
-
|
|
42
|
-
}
|
|
43
|
-
function f(t, n
|
|
44
|
-
|
|
45
|
-
return r ? { total: r } : void 0;
|
|
46
|
-
}
|
|
47
|
-
function p(t, r = e) {
|
|
48
|
-
if (t === void 0) return;
|
|
49
|
-
let i = n(t);
|
|
50
|
-
if (i !== null) return i > 0 ? void 0 : { total: r.totalNotGreaterThanZero };
|
|
51
|
-
}
|
|
52
|
-
function m(t, n, r, i = e) {
|
|
53
|
-
let a = {};
|
|
54
|
-
if (s(t) || (a.discount = i.unreadableDiscount), s(n) || (a.tax = i.unreadableTax), r !== void 0) {
|
|
55
|
-
let e = d(r, i);
|
|
56
|
-
e && (a.total = e);
|
|
57
|
-
}
|
|
58
|
-
return Object.keys(a).length ? a : void 0;
|
|
62
|
+
return s(Math.round(o(e) * a(t)));
|
|
63
|
+
}
|
|
64
|
+
function f(e, t, n) {
|
|
65
|
+
return s(e.reduce((e, t) => e + a(t.amount), 0) + a(t) - a(n));
|
|
59
66
|
}
|
|
60
67
|
//#endregion
|
|
61
|
-
export {
|
|
68
|
+
export { f as calculateTotal, d as displayLineAmount, i as isPersistableLineItem, c as mapBillFormToPayload, u as mapLineItemsToPayload, n as parseMoneyToMinorUnits, r as parseQuantity };
|