@tesouro/embedded-components-react 0.5.67 → 0.5.69
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/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index49.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index53.js +185 -188
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js +30 -20
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index61.js +356 -351
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index83.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/bank-disclosures/feature/dist/lib/BankDisclosuresWidget/BankDisclosuresWidget.js +1 -2
- package/dist/libs/tesouro-embedded-components-react/shared/bank-disclosures/ui/dist/index2.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/shared/bank-disclosures/ui/dist/index3.js +19 -22
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +71 -37
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -30,7 +30,9 @@ var v = {
|
|
|
30
30
|
unreadableTax: "Enter a valid tax amount.",
|
|
31
31
|
unreadableTotal: "Enter a valid total amount.",
|
|
32
32
|
totalNotGreaterThanZero: "Total amount must be greater than $0.",
|
|
33
|
-
poNumberTooLong: "PO number must be 255 characters or fewer."
|
|
33
|
+
poNumberTooLong: "PO number must be 255 characters or fewer.",
|
|
34
|
+
implausibleDate: "Enter a date within the last 10 years and next year.",
|
|
35
|
+
dueBeforeInvoiceDate: "Due date must be on or after the invoice date."
|
|
34
36
|
}, y = {
|
|
35
37
|
paymentInstructionsValue: (e) => `Account ending in ${e}`,
|
|
36
38
|
noMethod: "No payment method on file",
|
|
@@ -157,7 +159,7 @@ var w = {
|
|
|
157
159
|
createTitle: "New vendor",
|
|
158
160
|
editTitle: "Edit vendor",
|
|
159
161
|
switchVendorFieldLabel: "Switch to a different vendor",
|
|
160
|
-
nameLabel: "
|
|
162
|
+
nameLabel: "Business name",
|
|
161
163
|
addAddress: "Add address (optional)",
|
|
162
164
|
cancel: "Cancel",
|
|
163
165
|
save: "Save",
|
|
@@ -36,196 +36,193 @@ function me(e) {
|
|
|
36
36
|
accountNumber: e.account_number ?? ""
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
function
|
|
39
|
+
function he(e, t) {
|
|
40
40
|
return e.accountHolderName.trim() === t.accountHolderName.trim() && e.routingNumber.trim() === t.routingNumber.trim() && e.accountNumber.trim() === t.accountNumber.trim();
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function ge(e, t) {
|
|
43
43
|
return e?.find((e) => e.id === t && d(e)) ?? c(e);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
46
|
-
let
|
|
45
|
+
function v({ payableId: c, counterpartId: d, payableCounterpartId: v, payableCounterpartBankAccountId: _e, isVendorKnown: ve = !0, onCounterpartChange: ye, requiredError: be, extractedVendor: y, readOnly: b = !1, canEditVendor: xe = !0, canEditPaymentInstructions: Se = !0, canAddPaymentInstructions: Ce = !0, confirmDiscard: x = (e) => e(), labels: we }) {
|
|
46
|
+
let S = {
|
|
47
47
|
...ce,
|
|
48
|
-
...
|
|
49
|
-
}, { initResponse:
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
|
|
53
|
-
}, []),
|
|
54
|
-
|
|
55
|
-
}, [
|
|
48
|
+
...we
|
|
49
|
+
}, { initResponse: Te } = r(), Ee = t(Te?.scopes, [n.CounterpartReadOrg]), [C, De] = g(""), [w, Oe] = g(""), ke = h(w), [T, Ae] = g(), [je, Me] = g("none"), [Ne, Pe] = g(), [Fe, E] = g(!1), [D, O] = g(!1), [k, A] = g(_), Ie = h(k);
|
|
50
|
+
Ie.current = k;
|
|
51
|
+
let j = h(_), [Le, M] = g(), [N, Re] = g(), P = h(void 0), ze = h(d), [Be, Ve] = g(!1), [He, Ue] = g(!1), F = h(void 0), We = D && !he(k, j.current), I = f(() => {
|
|
52
|
+
O(!1), A(_), j.current = _, M(void 0);
|
|
53
|
+
}, []), L = f((e) => {
|
|
54
|
+
Ve(!0), ye(e);
|
|
55
|
+
}, [ye]), Ge = s(c, { enabled: !b && !!c && !d && !v }).data?.suggested_counterpart?.id, Ke = y?.name;
|
|
56
56
|
p(() => {
|
|
57
|
-
|
|
58
|
-
}, [c]), p(() => {
|
|
59
|
-
!x && !Ve && !d && !y && Ge && z(Ge);
|
|
57
|
+
!b && !Be && !d && !v && Ge && L(Ge);
|
|
60
58
|
}, [
|
|
61
59
|
d,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
60
|
+
v,
|
|
61
|
+
b,
|
|
62
|
+
Be,
|
|
65
63
|
Ge,
|
|
66
|
-
|
|
64
|
+
L
|
|
67
65
|
]), p(() => {
|
|
68
|
-
|
|
69
|
-
}, [d,
|
|
66
|
+
ze.current !== d && (ze.current = d, I(), Re(void 0));
|
|
67
|
+
}, [d, I]), p(() => {
|
|
70
68
|
let e = setTimeout(() => {
|
|
71
|
-
|
|
69
|
+
Oe(C.trim());
|
|
72
70
|
}, pe);
|
|
73
71
|
return () => clearTimeout(e);
|
|
74
|
-
}, [
|
|
75
|
-
let
|
|
72
|
+
}, [C]);
|
|
73
|
+
let R = i({
|
|
76
74
|
sort: "counterpart_name",
|
|
77
75
|
order: "asc",
|
|
78
76
|
limit: fe,
|
|
79
|
-
counterpart_name__icontains:
|
|
77
|
+
counterpart_name__icontains: w || void 0,
|
|
80
78
|
is_vendor: !0,
|
|
81
|
-
enabled: !
|
|
79
|
+
enabled: !b && (T === "edit" || !T && !d) && ve && Ee
|
|
82
80
|
});
|
|
83
81
|
p(() => {
|
|
84
|
-
|
|
85
|
-
}, [
|
|
86
|
-
let qe =
|
|
82
|
+
R.isPlaceholderData || (ke.current = w);
|
|
83
|
+
}, [w, R.isPlaceholderData]);
|
|
84
|
+
let qe = R.isPlaceholderData && ke.current !== w, z = oe({
|
|
87
85
|
selectedId: d,
|
|
88
|
-
enabled:
|
|
89
|
-
}), Je = a(), Ye = o(),
|
|
90
|
-
view:
|
|
91
|
-
setView:
|
|
92
|
-
selectedId:
|
|
93
|
-
setSelectedId:
|
|
86
|
+
enabled: Ee
|
|
87
|
+
}), Je = a(), Ye = o(), B = se({
|
|
88
|
+
view: je,
|
|
89
|
+
setView: Me,
|
|
90
|
+
selectedId: Ne,
|
|
91
|
+
setSelectedId: Pe,
|
|
94
92
|
messages: ee,
|
|
95
93
|
counterpartType: "vendor",
|
|
96
|
-
counterpart:
|
|
97
|
-
primaryAddress:
|
|
94
|
+
counterpart: z.counterpart,
|
|
95
|
+
primaryAddress: z.primaryAddress,
|
|
98
96
|
includeBankAccount: !1
|
|
99
|
-
}), { openCreate: Xe, openEdit: Ze, close: Qe, setValues:
|
|
100
|
-
let e =
|
|
97
|
+
}), { openCreate: Xe, openEdit: Ze, close: Qe, setValues: V, submit: $e } = B, H = m(() => {
|
|
98
|
+
let e = z.counterpart;
|
|
101
99
|
if (!e) return;
|
|
102
|
-
if (
|
|
100
|
+
if (z.isBankAccountsLoading) return {
|
|
103
101
|
name: u(e),
|
|
104
102
|
email: l(e),
|
|
105
|
-
methodLabel:
|
|
103
|
+
methodLabel: S.paymentMethodLoading,
|
|
106
104
|
hasPaymentInstructions: !1
|
|
107
105
|
};
|
|
108
|
-
if (
|
|
106
|
+
if (z.isBankAccountsError) return {
|
|
109
107
|
name: u(e),
|
|
110
108
|
email: l(e),
|
|
111
|
-
methodLabel:
|
|
109
|
+
methodLabel: S.paymentMethodUnavailable,
|
|
112
110
|
hasPaymentInstructions: !1
|
|
113
111
|
};
|
|
114
|
-
let t = re(
|
|
112
|
+
let t = re(z.bankAccounts);
|
|
115
113
|
return {
|
|
116
114
|
name: u(e),
|
|
117
115
|
email: l(e),
|
|
118
|
-
methodLabel: t ?
|
|
116
|
+
methodLabel: t ? S.paymentInstructionsValue(t.account_number?.slice(-4) ?? "") : S.noMethod,
|
|
119
117
|
hasPaymentInstructions: !!t
|
|
120
118
|
};
|
|
121
119
|
}, [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
120
|
+
z.bankAccounts,
|
|
121
|
+
z.counterpart,
|
|
122
|
+
z.isBankAccountsError,
|
|
123
|
+
z.isBankAccountsLoading,
|
|
124
|
+
S
|
|
127
125
|
]), et = m(() => {
|
|
128
126
|
let e = Ke?.trim();
|
|
129
|
-
if (!(!e || d ||
|
|
127
|
+
if (!(!e || d || T)) return {
|
|
130
128
|
name: e,
|
|
131
|
-
email:
|
|
132
|
-
description:
|
|
129
|
+
email: y?.email ?? "",
|
|
130
|
+
description: S.pendingVendorDescription,
|
|
133
131
|
methodLabel: "",
|
|
134
132
|
hasPaymentInstructions: !1
|
|
135
133
|
};
|
|
136
134
|
}, [
|
|
137
135
|
d,
|
|
138
|
-
|
|
136
|
+
y?.email,
|
|
139
137
|
Ke,
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
if (D(!1), F.current = void 0, e === "edit") Ne(d), Ze();
|
|
138
|
+
T,
|
|
139
|
+
S.pendingVendorDescription
|
|
140
|
+
]), U = d === v ? _e : void 0, W = m(() => ge(z.bankAccounts, U), [z.bankAccounts, U]), tt = m(() => re(z.bankAccounts)?.id, [z.bankAccounts]), G = !z.counterpart || z.isLoading || z.isFetching || z.isError || z.isAddressesLoading || z.isAddressesFetching || z.isAddressesError || z.isBankAccountsLoading || z.isBankAccountsFetching || z.isBankAccountsError, K = f(() => {
|
|
141
|
+
Qe(), Ae(void 0), E(!1), P.current = void 0;
|
|
142
|
+
}, [Qe]), q = m(() => le(y), [y]), nt = f((e) => {
|
|
143
|
+
if (E(!1), P.current = void 0, e === "edit") Pe(d), Ze();
|
|
147
144
|
else {
|
|
148
145
|
Xe();
|
|
149
|
-
let e =
|
|
150
|
-
|
|
146
|
+
let e = C.trim();
|
|
147
|
+
V((t) => ({
|
|
151
148
|
...t,
|
|
152
149
|
entityType: "organization",
|
|
153
|
-
legalName: e ||
|
|
154
|
-
email:
|
|
155
|
-
phone:
|
|
156
|
-
address:
|
|
150
|
+
legalName: e || q?.legalName || t.legalName,
|
|
151
|
+
email: q?.email || t.email,
|
|
152
|
+
phone: q?.phone || t.phone,
|
|
153
|
+
address: q?.address ?? t.address
|
|
157
154
|
}));
|
|
158
155
|
}
|
|
159
|
-
|
|
156
|
+
Ae(e);
|
|
160
157
|
}, [
|
|
161
158
|
d,
|
|
162
159
|
Xe,
|
|
163
160
|
Ze,
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
]),
|
|
168
|
-
let e =
|
|
169
|
-
|
|
170
|
-
}, [
|
|
171
|
-
|
|
161
|
+
C,
|
|
162
|
+
V,
|
|
163
|
+
q
|
|
164
|
+
]), J = f(() => {
|
|
165
|
+
let e = W ? me(W) : _;
|
|
166
|
+
j.current = e, A(e), M(void 0), O(!0);
|
|
167
|
+
}, [W]), rt = f(() => {
|
|
168
|
+
We ? x(I) : I();
|
|
172
169
|
}, [
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
]),
|
|
177
|
-
|
|
178
|
-
}, [
|
|
170
|
+
I,
|
|
171
|
+
x,
|
|
172
|
+
We
|
|
173
|
+
]), Y = f(() => {
|
|
174
|
+
K(), I();
|
|
175
|
+
}, [I, K]), X = Fe || We, Z = f((e) => {
|
|
179
176
|
let t = () => {
|
|
180
|
-
|
|
177
|
+
Y(), e();
|
|
181
178
|
};
|
|
182
|
-
|
|
179
|
+
X ? x(t) : t();
|
|
183
180
|
}, [
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
]),
|
|
188
|
-
|
|
181
|
+
x,
|
|
182
|
+
Y,
|
|
183
|
+
X
|
|
184
|
+
]), it = f(() => {
|
|
185
|
+
X ? x(Y) : Y();
|
|
189
186
|
}, [
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
]),
|
|
194
|
-
let n = d, r = !1, i =
|
|
195
|
-
if (!
|
|
187
|
+
x,
|
|
188
|
+
Y,
|
|
189
|
+
X
|
|
190
|
+
]), at = f(async (t) => {
|
|
191
|
+
let n = d, r = !1, i = Ie.current;
|
|
192
|
+
if (!he(i, j.current)) {
|
|
196
193
|
let e = ae(i);
|
|
197
|
-
if (Object.keys(e).length > 0) return
|
|
194
|
+
if (Object.keys(e).length > 0) return M(e), O(!0), { ok: !1 };
|
|
198
195
|
}
|
|
199
|
-
if (
|
|
200
|
-
if (
|
|
201
|
-
if (
|
|
196
|
+
if (T === "edit" && G) return { ok: !1 };
|
|
197
|
+
if (T) {
|
|
198
|
+
if (T === "create" && P.current) n = P.current;
|
|
202
199
|
else {
|
|
203
200
|
let e = await $e();
|
|
204
201
|
if (!e.ok) return { ok: !1 };
|
|
205
|
-
|
|
202
|
+
T === "create" ? (n = e.counterpartId, P.current = n) : n = e.counterpartId ?? n;
|
|
206
203
|
}
|
|
207
|
-
|
|
204
|
+
T === "create" && (r = !0);
|
|
208
205
|
}
|
|
209
206
|
if (!n) return { ok: !0 };
|
|
210
|
-
let a =
|
|
211
|
-
if (
|
|
212
|
-
let e =
|
|
213
|
-
return e ? (t && (
|
|
207
|
+
let a = z.isBankAccountsLoading || z.isBankAccountsFetching || z.isBankAccountsError;
|
|
208
|
+
if (he(i, j.current)) {
|
|
209
|
+
let e = N ?? U;
|
|
210
|
+
return e ? (t && (O(!1), T && K()), r && L(n), {
|
|
214
211
|
ok: !0,
|
|
215
212
|
counterpartId: n,
|
|
216
213
|
counterpartBankAccountId: e
|
|
217
|
-
}) : r ? (t &&
|
|
214
|
+
}) : r ? (t && K(), L(n), {
|
|
218
215
|
ok: !0,
|
|
219
216
|
counterpartId: n
|
|
220
|
-
}) : a ? { ok: !1 } : (t && (
|
|
217
|
+
}) : a ? { ok: !1 } : (t && (O(!1), T && K()), {
|
|
221
218
|
ok: !0,
|
|
222
219
|
counterpartId: n,
|
|
223
220
|
counterpartBankAccountId: tt
|
|
224
221
|
});
|
|
225
222
|
}
|
|
226
223
|
if (a) return { ok: !1 };
|
|
227
|
-
|
|
228
|
-
let o = ie(
|
|
224
|
+
M(void 0);
|
|
225
|
+
let o = ie(z.bankAccounts, N ?? W?.id), s;
|
|
229
226
|
try {
|
|
230
227
|
o.kind === "update" ? (await Ye.mutateAsync({
|
|
231
228
|
path: {
|
|
@@ -238,58 +235,58 @@ function y({ payableId: c, counterpartId: d, payableCounterpartId: y, payableCou
|
|
|
238
235
|
body: te(i, { isDefaultForCurrency: o.isDefaultForCurrency })
|
|
239
236
|
}))?.id;
|
|
240
237
|
} catch {
|
|
241
|
-
return e.error(
|
|
238
|
+
return e.error(S.bankAccountSaveFailed), {
|
|
242
239
|
ok: !1,
|
|
243
240
|
counterpartId: n
|
|
244
241
|
};
|
|
245
242
|
}
|
|
246
|
-
return
|
|
243
|
+
return j.current = i, Re(s), t && (O(!1), T && K()), r && L(n), {
|
|
247
244
|
ok: !0,
|
|
248
245
|
counterpartId: n,
|
|
249
246
|
counterpartBankAccountId: s
|
|
250
247
|
};
|
|
251
248
|
}, [
|
|
252
|
-
|
|
249
|
+
K,
|
|
253
250
|
d,
|
|
254
251
|
Je,
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
q,
|
|
252
|
+
z.bankAccounts,
|
|
253
|
+
z.isBankAccountsError,
|
|
254
|
+
z.isBankAccountsFetching,
|
|
255
|
+
z.isBankAccountsLoading,
|
|
256
|
+
T,
|
|
261
257
|
G,
|
|
258
|
+
U,
|
|
262
259
|
tt,
|
|
263
|
-
|
|
264
|
-
|
|
260
|
+
L,
|
|
261
|
+
W,
|
|
265
262
|
$e,
|
|
266
263
|
Ye,
|
|
267
|
-
|
|
268
|
-
]),
|
|
269
|
-
if (
|
|
264
|
+
N
|
|
265
|
+
]), ot = f((e) => {
|
|
266
|
+
if (F.current) return F.current;
|
|
270
267
|
let t = e?.closeOnSuccess ?? !0, n = (async () => {
|
|
271
|
-
|
|
268
|
+
Ue(!0);
|
|
272
269
|
try {
|
|
273
|
-
return await
|
|
270
|
+
return await at(t);
|
|
274
271
|
} finally {
|
|
275
|
-
|
|
272
|
+
F.current = void 0, Ue(!1);
|
|
276
273
|
}
|
|
277
274
|
})();
|
|
278
|
-
return
|
|
279
|
-
}, [
|
|
280
|
-
|
|
281
|
-
}, [
|
|
275
|
+
return F.current = n, n;
|
|
276
|
+
}, [at]), st = f(() => {
|
|
277
|
+
O(!1), T && K();
|
|
278
|
+
}, [T, K]), ct = m(() => (R.data?.data ?? []).map((e) => ({
|
|
282
279
|
name: u(e),
|
|
283
280
|
email: l(e),
|
|
284
281
|
onSelect: () => {
|
|
285
|
-
|
|
282
|
+
Z(() => L(e.id));
|
|
286
283
|
}
|
|
287
284
|
})), [
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
]),
|
|
292
|
-
|
|
285
|
+
R.data,
|
|
286
|
+
Z,
|
|
287
|
+
L
|
|
288
|
+
]), lt = f((e) => {
|
|
289
|
+
E(!0), V((t) => e.entityType === "individual" && t.entityType !== "individual" ? {
|
|
293
290
|
...t,
|
|
294
291
|
...e,
|
|
295
292
|
firstName: t.firstName || t.legalName,
|
|
@@ -302,87 +299,87 @@ function y({ payableId: c, counterpartId: d, payableCounterpartId: y, payableCou
|
|
|
302
299
|
...t,
|
|
303
300
|
...e
|
|
304
301
|
});
|
|
305
|
-
}, [
|
|
306
|
-
|
|
302
|
+
}, [V]), ut = f((e) => {
|
|
303
|
+
E(!0), V((t) => ({
|
|
307
304
|
...t,
|
|
308
305
|
address: {
|
|
309
306
|
...t.address,
|
|
310
307
|
...e
|
|
311
308
|
}
|
|
312
309
|
}));
|
|
313
|
-
}, [
|
|
314
|
-
query:
|
|
315
|
-
onQueryChange:
|
|
316
|
-
isLoading: !
|
|
310
|
+
}, [V]), dt = {
|
|
311
|
+
query: C,
|
|
312
|
+
onQueryChange: De,
|
|
313
|
+
isLoading: !ve || !Te || !!d && z.isLoading || R.isLoading || R.isFetching && qe,
|
|
317
314
|
onAddVendor: () => {
|
|
318
|
-
|
|
315
|
+
Z(() => nt("create"));
|
|
319
316
|
},
|
|
320
|
-
results:
|
|
321
|
-
},
|
|
322
|
-
isOpen:
|
|
323
|
-
values:
|
|
324
|
-
errors:
|
|
325
|
-
onOpen:
|
|
326
|
-
onCancel:
|
|
317
|
+
results: ct
|
|
318
|
+
}, Q = Ce && (T === "create" || !G) ? {
|
|
319
|
+
isOpen: D,
|
|
320
|
+
values: k,
|
|
321
|
+
errors: Le,
|
|
322
|
+
onOpen: J,
|
|
323
|
+
onCancel: rt,
|
|
327
324
|
onChange: (e) => {
|
|
328
|
-
|
|
325
|
+
A((t) => ({
|
|
329
326
|
...t,
|
|
330
327
|
...e
|
|
331
|
-
})),
|
|
328
|
+
})), M(void 0);
|
|
332
329
|
}
|
|
333
|
-
} : void 0,
|
|
334
|
-
...
|
|
335
|
-
onOpen:
|
|
336
|
-
canEditExisting:
|
|
337
|
-
} : void 0,
|
|
338
|
-
prepareVendorForSave:
|
|
339
|
-
isVendorSavePending:
|
|
340
|
-
hasUnsavedVendorChanges:
|
|
330
|
+
} : void 0, ft = T !== "create" && Q ? {
|
|
331
|
+
...Q,
|
|
332
|
+
onOpen: T === "edit" ? () => Z(J) : Q.onOpen,
|
|
333
|
+
canEditExisting: Se
|
|
334
|
+
} : void 0, pt = B.isSubmitting || Je.isPending || Ye.isPending, $ = {
|
|
335
|
+
prepareVendorForSave: ot,
|
|
336
|
+
isVendorSavePending: He || pt,
|
|
337
|
+
hasUnsavedVendorChanges: X,
|
|
341
338
|
isPendingVendor: !!et,
|
|
342
|
-
isEditingPayTo: !!
|
|
343
|
-
activePayToOperation:
|
|
344
|
-
discardPayToEdits:
|
|
345
|
-
finalizePayToSave:
|
|
346
|
-
openPaymentInstructions:
|
|
347
|
-
paymentInstructions:
|
|
339
|
+
isEditingPayTo: !!T || D,
|
|
340
|
+
activePayToOperation: T ? "vendor" : D ? H?.hasPaymentInstructions ? "existingInstructions" : "missingInstructions" : void 0,
|
|
341
|
+
discardPayToEdits: Y,
|
|
342
|
+
finalizePayToSave: st,
|
|
343
|
+
openPaymentInstructions: J,
|
|
344
|
+
paymentInstructions: ft
|
|
348
345
|
};
|
|
349
|
-
return
|
|
346
|
+
return T ? {
|
|
350
347
|
mode: "creating",
|
|
351
|
-
summary:
|
|
348
|
+
summary: H,
|
|
352
349
|
newVendorForm: /* @__PURE__ */ de(ue, {
|
|
353
|
-
mode:
|
|
354
|
-
values:
|
|
355
|
-
errors:
|
|
356
|
-
onChange:
|
|
357
|
-
onAddressChange:
|
|
358
|
-
sectionsToExpand:
|
|
359
|
-
onAddressExpand:
|
|
360
|
-
onCancel:
|
|
361
|
-
onSave:
|
|
362
|
-
isSaving:
|
|
363
|
-
search:
|
|
350
|
+
mode: T,
|
|
351
|
+
values: B.values,
|
|
352
|
+
errors: B.errors,
|
|
353
|
+
onChange: lt,
|
|
354
|
+
onAddressChange: ut,
|
|
355
|
+
sectionsToExpand: B.sectionsToExpand,
|
|
356
|
+
onAddressExpand: B.expandAddress,
|
|
357
|
+
onCancel: it,
|
|
358
|
+
onSave: ot,
|
|
359
|
+
isSaving: pt,
|
|
360
|
+
search: T === "edit" && !b ? dt : void 0
|
|
364
361
|
}),
|
|
365
362
|
...$
|
|
366
|
-
} :
|
|
363
|
+
} : H ? {
|
|
367
364
|
mode: "resolved",
|
|
368
|
-
summary:
|
|
369
|
-
onEdit:
|
|
365
|
+
summary: H,
|
|
366
|
+
onEdit: xe && !G ? () => Z(() => nt("edit")) : void 0,
|
|
370
367
|
...$
|
|
371
368
|
} : et ? {
|
|
372
369
|
mode: "resolved",
|
|
373
370
|
summary: et,
|
|
374
|
-
onEdit:
|
|
375
|
-
|
|
371
|
+
onEdit: xe ? () => Z(() => {
|
|
372
|
+
Ve(!0), nt("create");
|
|
376
373
|
}) : void 0,
|
|
377
374
|
showPaymentInstructions: !1,
|
|
378
|
-
error:
|
|
375
|
+
error: be,
|
|
379
376
|
...$
|
|
380
377
|
} : {
|
|
381
378
|
mode: "selecting",
|
|
382
|
-
error:
|
|
383
|
-
search:
|
|
379
|
+
error: R.isError ? S.searchFailed : z.isError ? S.vendorDetailsFailed : be,
|
|
380
|
+
search: dt,
|
|
384
381
|
...$
|
|
385
382
|
};
|
|
386
383
|
}
|
|
387
384
|
//#endregion
|
|
388
|
-
export {
|
|
385
|
+
export { v as useVendorSectionProps };
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
import { BILL_CREATE_MESSAGE_LABELS_EN as e } from "./index49.js";
|
|
2
2
|
import { isPersistableLineItem as t, parseMoneyToMinorUnits as n, parseQuantity as r } from "./index55.js";
|
|
3
3
|
//#region ../../libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index56.js
|
|
4
|
-
var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/, a = 255;
|
|
5
|
-
function
|
|
4
|
+
var i = /^(?:\d{1,3}(?:,\d{3})+(?:\.\d+)?|\d+(?:\.\d+)?|\.\d+)$/, a = 255, o = 10, s = 1;
|
|
5
|
+
function c(e) {
|
|
6
|
+
let t = new Date(e);
|
|
7
|
+
if (Number.isNaN(t.getTime())) return !1;
|
|
8
|
+
let n = /* @__PURE__ */ new Date(), r = Date.UTC(n.getUTCFullYear(), n.getUTCMonth(), n.getUTCDate()), i = new Date(r);
|
|
9
|
+
i.setUTCFullYear(i.getUTCFullYear() - o);
|
|
10
|
+
let a = new Date(r);
|
|
11
|
+
return a.setUTCFullYear(a.getUTCFullYear() + s), t < i || t > a;
|
|
12
|
+
}
|
|
13
|
+
function l(t, n = e) {
|
|
6
14
|
let r = {};
|
|
7
15
|
return t.poNumber.length > a && (r.poNumber = n.poNumberTooLong), Object.keys(r).length ? r : void 0;
|
|
8
16
|
}
|
|
9
|
-
function
|
|
17
|
+
function u(e) {
|
|
10
18
|
let t = e.trim();
|
|
11
19
|
return !t || n(t) !== null ? !0 : i.test(t) ? Number(t.replaceAll(",", "")) === 0 : !1;
|
|
12
20
|
}
|
|
13
|
-
function
|
|
21
|
+
function d(t, i = e) {
|
|
14
22
|
let a = {};
|
|
15
23
|
for (let e of t) {
|
|
16
24
|
let t = n(e.price), o = n(e.amount), s = {};
|
|
@@ -18,44 +26,46 @@ function c(t, i = e) {
|
|
|
18
26
|
}
|
|
19
27
|
return Object.keys(a).length ? a : void 0;
|
|
20
28
|
}
|
|
21
|
-
function
|
|
22
|
-
let c = {};
|
|
23
|
-
a || (c.vendor = s.requiredField), i.invoiceNumber.trim() || (c.invoiceNumber = s.requiredField), i.invoiceDate.trim() || (c.invoiceDate = s.requiredField), i.dueDate.trim() || (c.dueDate = s.requiredField);
|
|
29
|
+
function f(i, a, o, s = e) {
|
|
24
30
|
let l = {};
|
|
31
|
+
a || (l.vendor = s.requiredField), i.invoiceNumber.trim() || (l.invoiceNumber = s.requiredField);
|
|
32
|
+
let u = i.invoiceDate.trim(), d = i.dueDate.trim();
|
|
33
|
+
u ? c(u) && (l.invoiceDate = s.implausibleDate) : l.invoiceDate = s.requiredField, d ? c(d) ? l.dueDate = s.implausibleDate : u && d < u && (l.dueDate = s.dueBeforeInvoiceDate) : l.dueDate = s.requiredField;
|
|
34
|
+
let f = {};
|
|
25
35
|
return o.forEach((e, i) => {
|
|
26
36
|
if (i > 0 && !t(e)) return;
|
|
27
37
|
let a = {};
|
|
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 && (
|
|
38
|
+
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 && (f[e.id] = a);
|
|
29
39
|
}), {
|
|
30
|
-
formErrors: Object.keys(
|
|
31
|
-
lineItemErrors: Object.keys(
|
|
40
|
+
formErrors: Object.keys(l).length ? l : void 0,
|
|
41
|
+
lineItemErrors: Object.keys(f).length ? f : void 0
|
|
32
42
|
};
|
|
33
43
|
}
|
|
34
|
-
function
|
|
44
|
+
function p(e) {
|
|
35
45
|
let t = e.trim();
|
|
36
46
|
if (!t) return !0;
|
|
37
47
|
let n = t.startsWith("-") ? t.slice(1) : t;
|
|
38
48
|
return i.test(n) ? Number(t.replaceAll(",", "")) <= 0 : !1;
|
|
39
49
|
}
|
|
40
|
-
function
|
|
41
|
-
if (n(e) === null) return
|
|
50
|
+
function m(e, t) {
|
|
51
|
+
if (n(e) === null) return p(e) ? t.totalNotGreaterThanZero : t.unreadableTotal;
|
|
42
52
|
}
|
|
43
|
-
function
|
|
44
|
-
let r =
|
|
53
|
+
function h(t, n = e) {
|
|
54
|
+
let r = m(t, n);
|
|
45
55
|
return r ? { total: r } : void 0;
|
|
46
56
|
}
|
|
47
|
-
function
|
|
57
|
+
function g(t, r = e) {
|
|
48
58
|
if (t === void 0) return;
|
|
49
59
|
let i = n(t);
|
|
50
60
|
if (i !== null) return i > 0 ? void 0 : { total: r.totalNotGreaterThanZero };
|
|
51
61
|
}
|
|
52
|
-
function
|
|
62
|
+
function _(t, n, r, i = e) {
|
|
53
63
|
let a = {};
|
|
54
|
-
if (
|
|
55
|
-
let e =
|
|
64
|
+
if (u(t) || (a.discount = i.unreadableDiscount), u(n) || (a.tax = i.unreadableTax), r !== void 0) {
|
|
65
|
+
let e = m(r, i);
|
|
56
66
|
e && (a.total = e);
|
|
57
67
|
}
|
|
58
68
|
return Object.keys(a).length ? a : void 0;
|
|
59
69
|
}
|
|
60
70
|
//#endregion
|
|
61
|
-
export {
|
|
71
|
+
export { u as isReadableMoneyOrZero, f as validateBillCompleteness, h as validateBillTotalIsPayable, _ as validateBillTotals, l as validateBillValues, d as validateLineItems, g as validateStoredAmountDue };
|