@tesouro/embedded-components-react 0.2.298 → 0.2.299
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.css +6 -0
- package/dist/index.d.ts +107 -87
- package/dist/lib/CounterpartsWidget.d.ts +24 -4
- package/dist/lib/ReceivablesWidget.d.ts +20 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index12.js +31 -27
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index2.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index4.js +122 -149
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index5.js +163 -72
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index6.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/feature/dist/index8.js +52 -46
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index18.js +8 -2
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index19.js +98 -67
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index25.js +6 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/ui/dist/index28.js +7 -3
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index7.js +4 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/index8.js +12 -7
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/index12.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +17 -16
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/CounterpartSelector.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +103 -50
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartDetails.js +2 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +126 -76
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +12 -11
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +6 -173
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +173 -5
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +5 -57
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +51 -22
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index14.js +24 -72
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +76 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +13 -7
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +53 -110
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index6.js +115 -51
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +53 -47
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +44 -504
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +480 -6
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { formatMoneyExact as e } from "../../../../util/dist/lib/formatMoneyExact.js";
|
|
2
|
-
import {
|
|
3
|
-
import { EMPTY_ADDRESS_FORM_VALUES as n } from "../../../ui/dist/index5.js";
|
|
2
|
+
import { EMPTY_ADDRESS_FORM_VALUES as t } from "../../../ui/dist/index6.js";
|
|
4
3
|
import "../../../ui/dist/index.js";
|
|
4
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as n } from "./labels.js";
|
|
5
5
|
//#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js
|
|
6
6
|
var r = [
|
|
7
7
|
"USD",
|
|
@@ -125,7 +125,15 @@ function y(e) {
|
|
|
125
125
|
};
|
|
126
126
|
});
|
|
127
127
|
}
|
|
128
|
-
function b(e
|
|
128
|
+
function b(e) {
|
|
129
|
+
let t = (e ?? []).filter((e) => e.currency === "USD" && (!!e.routing_number || !!e.account_number));
|
|
130
|
+
return t.find((e) => e.is_default_for_currency) ?? t[0];
|
|
131
|
+
}
|
|
132
|
+
function x(e) {
|
|
133
|
+
let t = (e ?? []).filter((e) => e.currency === "USD" && !!e.account_holder_name && !!e.routing_number && !!e.account_number);
|
|
134
|
+
return t.find((e) => e.is_default_for_currency) ?? t[0];
|
|
135
|
+
}
|
|
136
|
+
function S(e, t = {}) {
|
|
129
137
|
let n = e.line2.trim();
|
|
130
138
|
return {
|
|
131
139
|
line1: e.line1.trim(),
|
|
@@ -136,7 +144,7 @@ function b(e, t = {}) {
|
|
|
136
144
|
country: "US"
|
|
137
145
|
};
|
|
138
146
|
}
|
|
139
|
-
function
|
|
147
|
+
function C(e) {
|
|
140
148
|
return {
|
|
141
149
|
line1: e.line1 ?? "",
|
|
142
150
|
line2: e.line2 ?? "",
|
|
@@ -145,10 +153,10 @@ function x(e) {
|
|
|
145
153
|
postalCode: e.postal_code ?? ""
|
|
146
154
|
};
|
|
147
155
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
156
|
+
function w(e) {
|
|
157
|
+
return S(e);
|
|
150
158
|
}
|
|
151
|
-
function
|
|
159
|
+
function T(e) {
|
|
152
160
|
return {
|
|
153
161
|
line1: e.line1.trim(),
|
|
154
162
|
line2: e.line2.trim(),
|
|
@@ -158,7 +166,7 @@ function C(e) {
|
|
|
158
166
|
country: "US"
|
|
159
167
|
};
|
|
160
168
|
}
|
|
161
|
-
function
|
|
169
|
+
function E(e = "organization", n) {
|
|
162
170
|
return {
|
|
163
171
|
entityType: e,
|
|
164
172
|
legalName: "",
|
|
@@ -168,8 +176,8 @@ function w(e = "organization", t) {
|
|
|
168
176
|
email: "",
|
|
169
177
|
phone: "",
|
|
170
178
|
taxId: "",
|
|
171
|
-
remindersEnabled:
|
|
172
|
-
address: { ...
|
|
179
|
+
remindersEnabled: n === "customer",
|
|
180
|
+
address: { ...t },
|
|
173
181
|
bankAccount: {
|
|
174
182
|
accountHolderName: "",
|
|
175
183
|
routingNumber: "",
|
|
@@ -177,11 +185,11 @@ function w(e = "organization", t) {
|
|
|
177
185
|
}
|
|
178
186
|
};
|
|
179
187
|
}
|
|
180
|
-
function
|
|
181
|
-
let n =
|
|
182
|
-
return n.email = d(e), n.phone = f(e), n.taxId = e.tax_id ?? "", n.remindersEnabled = !!e.reminders_enabled, t && (n.address =
|
|
188
|
+
function D(e, t) {
|
|
189
|
+
let n = E(e.type);
|
|
190
|
+
return n.email = d(e), n.phone = f(e), n.taxId = e.tax_id ?? "", n.remindersEnabled = !!e.reminders_enabled, t && (n.address = C(t)), "organization" in e ? n.legalName = e.organization.legal_name : (n.firstName = e.individual.first_name, n.lastName = e.individual.last_name), n;
|
|
183
191
|
}
|
|
184
|
-
function
|
|
192
|
+
function O(e) {
|
|
185
193
|
return [
|
|
186
194
|
e.line1,
|
|
187
195
|
e.line2,
|
|
@@ -190,11 +198,11 @@ function E(e) {
|
|
|
190
198
|
e.postalCode
|
|
191
199
|
].some((e) => e.trim().length > 0);
|
|
192
200
|
}
|
|
193
|
-
function
|
|
194
|
-
return
|
|
201
|
+
function k(e) {
|
|
202
|
+
return O(e) ? S(e) : void 0;
|
|
195
203
|
}
|
|
196
|
-
function
|
|
197
|
-
let n = t === "customer", r = t === "vendor", i =
|
|
204
|
+
function A(e, t) {
|
|
205
|
+
let n = t === "customer", r = t === "vendor", i = k(e.address), a = e.taxId.trim() || void 0, o = e.email.trim(), s = e.phone.trim() || void 0, c = {
|
|
198
206
|
is_customer: n,
|
|
199
207
|
is_vendor: r,
|
|
200
208
|
language: "en",
|
|
@@ -223,7 +231,7 @@ function O(e, t) {
|
|
|
223
231
|
}
|
|
224
232
|
};
|
|
225
233
|
}
|
|
226
|
-
function
|
|
234
|
+
function j(e, t) {
|
|
227
235
|
let n = e.taxId.trim(), r = e.email.trim(), i = e.phone.trim(), a = {
|
|
228
236
|
language: "en",
|
|
229
237
|
reminders_enabled: t === "customer" ? e.remindersEnabled : void 0,
|
|
@@ -247,17 +255,20 @@ function k(e, t) {
|
|
|
247
255
|
}
|
|
248
256
|
};
|
|
249
257
|
}
|
|
250
|
-
function
|
|
251
|
-
return
|
|
258
|
+
function M(e) {
|
|
259
|
+
return O(e.address);
|
|
252
260
|
}
|
|
253
|
-
function
|
|
261
|
+
function N(e) {
|
|
254
262
|
return [
|
|
255
|
-
e.
|
|
256
|
-
e.
|
|
257
|
-
e.
|
|
263
|
+
e.accountHolderName,
|
|
264
|
+
e.routingNumber,
|
|
265
|
+
e.accountNumber
|
|
258
266
|
].some((e) => e.trim().length > 0);
|
|
259
267
|
}
|
|
260
|
-
function
|
|
268
|
+
function P(e) {
|
|
269
|
+
return N(e.bankAccount);
|
|
270
|
+
}
|
|
271
|
+
function F(e) {
|
|
261
272
|
return {
|
|
262
273
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
263
274
|
account_number: e.accountNumber.trim() || void 0,
|
|
@@ -267,7 +278,40 @@ function M(e) {
|
|
|
267
278
|
is_default_for_currency: !0
|
|
268
279
|
};
|
|
269
280
|
}
|
|
270
|
-
function
|
|
281
|
+
function I(e, t = {}) {
|
|
282
|
+
return {
|
|
283
|
+
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
284
|
+
account_number: e.accountNumber.trim() || void 0,
|
|
285
|
+
routing_number: e.routingNumber.trim() || void 0,
|
|
286
|
+
...t.includeAchDefaults ? {
|
|
287
|
+
country: "US",
|
|
288
|
+
currency: "USD"
|
|
289
|
+
} : {}
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function L(e) {
|
|
293
|
+
return [
|
|
294
|
+
e.account_number,
|
|
295
|
+
e.iban,
|
|
296
|
+
e.routing_number,
|
|
297
|
+
e.sort_code,
|
|
298
|
+
e.bic
|
|
299
|
+
].every((e) => !e);
|
|
300
|
+
}
|
|
301
|
+
function R(e, t) {
|
|
302
|
+
if (t) return {
|
|
303
|
+
kind: "update",
|
|
304
|
+
bankAccountId: t,
|
|
305
|
+
includeAchDefaults: !1
|
|
306
|
+
};
|
|
307
|
+
let n = e?.find(L);
|
|
308
|
+
return n ? {
|
|
309
|
+
kind: "update",
|
|
310
|
+
bankAccountId: n.id,
|
|
311
|
+
includeAchDefaults: !0
|
|
312
|
+
} : { kind: "create" };
|
|
313
|
+
}
|
|
314
|
+
function z() {
|
|
271
315
|
return {
|
|
272
316
|
name: "",
|
|
273
317
|
accountHolderName: "",
|
|
@@ -280,7 +324,7 @@ function N() {
|
|
|
280
324
|
isDefault: !1
|
|
281
325
|
};
|
|
282
326
|
}
|
|
283
|
-
function
|
|
327
|
+
function B(e) {
|
|
284
328
|
return {
|
|
285
329
|
name: e.name ?? "",
|
|
286
330
|
accountHolderName: e.account_holder_name ?? "",
|
|
@@ -293,7 +337,7 @@ function P(e) {
|
|
|
293
337
|
isDefault: e.is_default_for_currency ?? !1
|
|
294
338
|
};
|
|
295
339
|
}
|
|
296
|
-
function
|
|
340
|
+
function V(e) {
|
|
297
341
|
return {
|
|
298
342
|
name: e.name.trim() || void 0,
|
|
299
343
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
@@ -307,7 +351,7 @@ function F(e) {
|
|
|
307
351
|
is_default_for_currency: e.isDefault
|
|
308
352
|
};
|
|
309
353
|
}
|
|
310
|
-
function
|
|
354
|
+
function H(e) {
|
|
311
355
|
return {
|
|
312
356
|
name: e.name.trim(),
|
|
313
357
|
account_holder_name: e.accountHolderName.trim(),
|
|
@@ -320,45 +364,54 @@ function I(e) {
|
|
|
320
364
|
country: "US"
|
|
321
365
|
};
|
|
322
366
|
}
|
|
323
|
-
function
|
|
367
|
+
function U(e) {
|
|
324
368
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
325
369
|
}
|
|
326
|
-
function
|
|
370
|
+
function W(e, t) {
|
|
327
371
|
let n = {};
|
|
328
372
|
return e.line1.trim().length === 0 && (n.line1 = t.addressLine1Required), e.city.trim().length === 0 && (n.city = t.cityRequired), e.state.trim().length === 0 && (n.state = t.stateRequired), e.postalCode.trim().length === 0 && (n.postalCode = t.postalCodeRequired), n;
|
|
329
373
|
}
|
|
330
|
-
function
|
|
374
|
+
function G(e) {
|
|
331
375
|
return Object.values(e).some(Boolean);
|
|
332
376
|
}
|
|
333
|
-
function
|
|
377
|
+
function K(e) {
|
|
378
|
+
if (!/^\d{9}$/.test(e)) return !1;
|
|
379
|
+
let t = [...e].map(Number);
|
|
380
|
+
return (3 * (t[0] + t[3] + t[6]) + 7 * (t[1] + t[4] + t[7]) + (t[2] + t[5] + t[8])) % 10 == 0;
|
|
381
|
+
}
|
|
382
|
+
function q(e, t = n) {
|
|
383
|
+
let r = {}, i = e.accountHolderName.trim(), a = e.routingNumber.trim(), o = e.accountNumber.trim();
|
|
384
|
+
return i.length === 0 && (r.accountHolderName = t.accountHolderNameRequired), (a.length === 0 || !K(a)) && (r.routingNumber = t.routingNumberInvalid), (o.length === 0 || !/^\d{9,12}$/.test(o)) && (r.accountNumber = t.accountNumberInvalid), r;
|
|
385
|
+
}
|
|
386
|
+
function J(e, t, r = n, i = "customer", a = !1) {
|
|
334
387
|
let o = {};
|
|
335
|
-
if (e.entityType === "organization" ? e.legalName.trim().length === 0 && (o.legalName = r.legalNameRequired) : (e.firstName.trim().length === 0 && (o.firstName = r.firstNameRequired), e.lastName.trim().length === 0 && (o.lastName = r.lastNameRequired)), e.email.trim().length === 0 ? o.email = r.emailRequired :
|
|
336
|
-
let t =
|
|
337
|
-
|
|
388
|
+
if (e.entityType === "organization" ? e.legalName.trim().length === 0 && (o.legalName = r.legalNameRequired) : (e.firstName.trim().length === 0 && (o.firstName = r.firstNameRequired), e.lastName.trim().length === 0 && (o.lastName = r.lastNameRequired)), e.email.trim().length === 0 ? o.email = r.emailRequired : U(e.email.trim()) || (o.email = r.emailInvalid), t === "create" && i === "vendor" || O(e.address)) {
|
|
389
|
+
let t = W(e.address, r);
|
|
390
|
+
G(t) && (o.address = t);
|
|
338
391
|
}
|
|
339
|
-
if (i === "vendor" &&
|
|
340
|
-
let t =
|
|
341
|
-
|
|
392
|
+
if (i === "vendor" && (a || P(e))) {
|
|
393
|
+
let t = q(e.bankAccount, r);
|
|
394
|
+
G(t) && (o.bankAccount = t);
|
|
342
395
|
}
|
|
343
396
|
return o;
|
|
344
397
|
}
|
|
345
|
-
function
|
|
398
|
+
function Y(e) {
|
|
346
399
|
let { address: t, bankAccount: n, ...r } = e;
|
|
347
|
-
return
|
|
400
|
+
return G(r) || (t ? G(t) : !1) || (n ? G(n) : !1);
|
|
348
401
|
}
|
|
349
|
-
function
|
|
402
|
+
function X(e, t = n) {
|
|
350
403
|
let r = {};
|
|
351
|
-
return e.name.trim().length === 0 && (r.name =
|
|
404
|
+
return e.name.trim().length === 0 && (r.name = t.bankAccountNameRequired), e.accountNumber.trim().length === 0 && e.iban.trim().length === 0 && (r.accountNumber = t.bankAccountIdentifierRequired), e.currency.trim().length === 0 && (r.currency = t.bankAccountCurrencyRequired), r;
|
|
352
405
|
}
|
|
353
|
-
function
|
|
354
|
-
return
|
|
406
|
+
function Z(e) {
|
|
407
|
+
return G(e);
|
|
355
408
|
}
|
|
356
|
-
function
|
|
357
|
-
return
|
|
409
|
+
function Q(e, t = n) {
|
|
410
|
+
return W(e, t);
|
|
358
411
|
}
|
|
359
|
-
function
|
|
412
|
+
function $() {
|
|
360
413
|
let e = globalThis.getSelection?.();
|
|
361
414
|
return !!(e && e.toString().length > 0);
|
|
362
415
|
}
|
|
363
416
|
//#endregion
|
|
364
|
-
export {
|
|
417
|
+
export { w as addressFormToCreatePayload, T as addressFormToUpdatePayload, C as addressResponseToFormValues, V as bankAccountFormToCreatePayload, H as bankAccountFormToUpdatePayload, B as bankAccountToFormValues, p as buildAnalyticsMap, y as buildBankAccountItems, _ as buildCounterpartDetailsView, m as buildCounterpartRows, F as counterpartFormBankAccountToCreatePayload, I as counterpartFormBankAccountToUpdatePayload, A as counterpartFormToCreatePayload, j as counterpartFormToUpdatePayload, D as counterpartToFormValues, z as emptyBankAccountFormValues, E as emptyCounterpartFormValues, l as formatCounterpartDate, s as formatMoney, o as fromMinorUnits, b as getAchInstructions, d as getCounterpartEmail, u as getCounterpartName, i as getCurrencyOptions, x as getPayableAchInstructions, N as hasAchFormValues, Z as hasBankAccountFormErrors, M as hasCounterpartFormAddressValues, P as hasCounterpartFormBankAccountValues, Y as hasCounterpartFormErrors, $ as hasSelectedText, R as resolveCounterpartBankAccountWrite, q as validateAchFormValues, Q as validateAddressForm, X as validateBankAccountForm, J as validateCounterpartForm };
|
|
@@ -12,7 +12,8 @@ var e = {
|
|
|
12
12
|
bankAccountNameRequired: "Account name is required",
|
|
13
13
|
bankAccountIdentifierRequired: "Enter an account number or IBAN for this bank account",
|
|
14
14
|
bankAccountCurrencyRequired: "Currency is required",
|
|
15
|
-
|
|
15
|
+
accountHolderNameRequired: "Account holder name is required",
|
|
16
|
+
routingNumberInvalid: "Enter a valid 9-digit ABA routing number",
|
|
16
17
|
accountNumberInvalid: "Account number must be between 9 and 12 digits",
|
|
17
18
|
vatIdValueRequired: "VAT ID is required",
|
|
18
19
|
genericError: "Something went wrong. Please try again.",
|
|
@@ -26,7 +26,9 @@ function o({ selectedId: o, enabled: s = !0 }) {
|
|
|
26
26
|
counterpart: u,
|
|
27
27
|
isOrganization: d,
|
|
28
28
|
isLoading: l.isLoading,
|
|
29
|
+
isBankAccountsLoading: m.isLoading,
|
|
29
30
|
isError: l.isError,
|
|
31
|
+
isBankAccountsError: m.isError,
|
|
30
32
|
primaryAddress: g,
|
|
31
33
|
detailsView: _,
|
|
32
34
|
bankAccounts: m.data?.data,
|
|
@@ -3,98 +3,148 @@
|
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
5
|
import { extractApiErrorMessage as e } from "../../../../util/dist/lib/apiErrors.js";
|
|
6
|
-
import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, counterpartFormBankAccountToCreatePayload as i,
|
|
7
|
-
import { useCreateCounterpartMutation as
|
|
8
|
-
import { useCreateCounterpartBankAccountMutation as
|
|
9
|
-
import { useCreateCounterpartAddressMutation as
|
|
6
|
+
import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, counterpartFormBankAccountToCreatePayload as i, counterpartFormBankAccountToUpdatePayload as a, counterpartFormToCreatePayload as o, counterpartFormToUpdatePayload as s, counterpartToFormValues as c, emptyCounterpartFormValues as l, getAchInstructions as u, hasCounterpartFormAddressValues as d, hasCounterpartFormBankAccountValues as f, hasCounterpartFormErrors as p, resolveCounterpartBankAccountWrite as m, validateCounterpartForm as h } from "./helpers.js";
|
|
7
|
+
import { useCreateCounterpartMutation as g, useUpdateCounterpartMutation as _ } from "../../../data-access/dist/index3.js";
|
|
8
|
+
import { useCreateCounterpartBankAccountMutation as v, useUpdateCounterpartBankAccountMutation as y } from "../../../data-access/dist/index5.js";
|
|
9
|
+
import { useCreateCounterpartAddressMutation as b, useUpdateCounterpartAddressMutation as x } from "../../../data-access/dist/index7.js";
|
|
10
10
|
import "../../../data-access/dist/index.js";
|
|
11
|
-
import { useCallback as
|
|
11
|
+
import { useCallback as S, useState as C } from "react";
|
|
12
12
|
//#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js
|
|
13
|
-
function
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
function x(e) {
|
|
17
|
-
let { address: t } = e;
|
|
18
|
-
return t.line1.trim().length > 0 && t.city.trim().length > 0 && t.state.trim().length > 0 && t.postalCode.trim().length > 0;
|
|
19
|
-
}
|
|
20
|
-
function S(e, t) {
|
|
21
|
-
if (!t) return l(e);
|
|
13
|
+
function w(e, t) {
|
|
14
|
+
if (!t) return d(e);
|
|
22
15
|
let n = r(t);
|
|
23
16
|
return e.address.line1.trim() !== n.line1.trim() || e.address.line2.trim() !== n.line2.trim() || e.address.city.trim() !== n.city.trim() || e.address.state.trim() !== n.state.trim() || e.address.postalCode.trim() !== n.postalCode.trim();
|
|
24
17
|
}
|
|
25
|
-
function
|
|
26
|
-
let j = p(), M = g(), N = h(), P = m(), F = _(), [I, L] = y(() => c()), [R, z] = y({}), [B, V] = y(), H = j.isPending || M.isPending || N.isPending || P.isPending || F.isPending, U = D === "vendor" && A !== !1;
|
|
18
|
+
function T(e) {
|
|
27
19
|
return {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
20
|
+
accountHolderName: e.account_holder_name ?? "",
|
|
21
|
+
routingNumber: e.routing_number ?? "",
|
|
22
|
+
accountNumber: e.account_number ?? ""
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function E(e, t) {
|
|
26
|
+
if (!t) return f(e);
|
|
27
|
+
let n = T(t);
|
|
28
|
+
return e.bankAccount.accountHolderName.trim() !== n.accountHolderName.trim() || e.bankAccount.routingNumber.trim() !== n.routingNumber.trim() || e.bankAccount.accountNumber.trim() !== n.accountNumber.trim();
|
|
29
|
+
}
|
|
30
|
+
function D({ view: r, setView: D, selectedId: O, setSelectedId: k, messages: A, counterpartType: j, counterpart: M, primaryAddress: N, bankAccounts: P, isBankAccountsLoading: F, isBankAccountsError: I }) {
|
|
31
|
+
let L = g(), R = b(), z = v(), B = _(), V = x(), H = y(), [U, W] = C(() => l()), [G, K] = C({}), [q, J] = C({
|
|
32
|
+
address: !1,
|
|
33
|
+
bankAccount: !1
|
|
34
|
+
}), [Y, X] = C(), [Z, Q] = C(), $ = L.isPending || R.isPending || z.isPending || H.isPending || B.isPending || V.isPending, ee = S(() => {
|
|
35
|
+
k(void 0), Q(void 0), X(void 0), J({
|
|
36
|
+
address: j === "vendor",
|
|
37
|
+
bankAccount: !1
|
|
38
|
+
}), W(l("organization", j)), K({}), D("create");
|
|
39
|
+
}, [
|
|
40
|
+
j,
|
|
41
|
+
k,
|
|
42
|
+
D
|
|
43
|
+
]), te = S(() => {
|
|
44
|
+
if (!M || j === "vendor" && (F || I)) return;
|
|
45
|
+
let e = u(P), t = c(M, N);
|
|
46
|
+
Q(void 0), X(e?.id), J({
|
|
47
|
+
address: d(t),
|
|
48
|
+
bankAccount: !1
|
|
49
|
+
}), W({
|
|
50
|
+
...t,
|
|
51
|
+
...e ? { bankAccount: T(e) } : {}
|
|
52
|
+
}), K({}), D("edit");
|
|
53
|
+
}, [
|
|
54
|
+
P,
|
|
55
|
+
M,
|
|
56
|
+
j,
|
|
57
|
+
I,
|
|
58
|
+
F,
|
|
59
|
+
N,
|
|
60
|
+
D
|
|
61
|
+
]), ne = S(() => {
|
|
62
|
+
D("none");
|
|
63
|
+
}, [D]);
|
|
64
|
+
return {
|
|
65
|
+
values: U,
|
|
66
|
+
errors: G,
|
|
67
|
+
setValues: W,
|
|
68
|
+
isSubmitting: $,
|
|
69
|
+
sectionsToExpand: q,
|
|
70
|
+
expandAddress: S(() => {
|
|
71
|
+
J((e) => ({
|
|
72
|
+
...e,
|
|
73
|
+
address: !0
|
|
74
|
+
}));
|
|
75
|
+
}, []),
|
|
76
|
+
openCreate: ee,
|
|
77
|
+
openEdit: te,
|
|
78
|
+
close: ne,
|
|
79
|
+
submit: S(async () => {
|
|
80
|
+
let c = r === "edit" ? "edit" : "create", l = h(U, c, A, j, c === "edit" && j === "vendor" && !!Y);
|
|
81
|
+
if (p(l)) {
|
|
82
|
+
K(l), J((e) => ({
|
|
83
|
+
address: e.address || !!l.address,
|
|
84
|
+
bankAccount: e.bankAccount || !!l.bankAccount
|
|
85
|
+
}));
|
|
54
86
|
return;
|
|
55
87
|
}
|
|
56
|
-
|
|
57
|
-
|
|
88
|
+
K({}), J({
|
|
89
|
+
address: !1,
|
|
90
|
+
bankAccount: !1
|
|
91
|
+
});
|
|
92
|
+
let g = Z;
|
|
58
93
|
try {
|
|
59
|
-
r === "edit" &&
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
94
|
+
if (r === "edit" && O) {
|
|
95
|
+
Q(void 0), await B.mutateAsync({
|
|
96
|
+
path: { counterpart_id: O },
|
|
97
|
+
body: s(U, j)
|
|
98
|
+
});
|
|
99
|
+
let e = N ? w(U, N) ? V.mutateAsync({
|
|
100
|
+
path: {
|
|
101
|
+
counterpart_id: O,
|
|
102
|
+
address_id: N.id
|
|
103
|
+
},
|
|
104
|
+
body: n(U.address)
|
|
105
|
+
}) : void 0 : d(U) ? R.mutateAsync({
|
|
106
|
+
path: { counterpart_id: O },
|
|
107
|
+
body: t(U.address)
|
|
108
|
+
}) : void 0, r = j === "vendor" && E(U, u(P)) ? m(P, Y) : void 0, o = r?.kind === "update" ? H.mutateAsync({
|
|
109
|
+
path: {
|
|
110
|
+
counterpart_id: O,
|
|
111
|
+
bank_account_id: r.bankAccountId
|
|
112
|
+
},
|
|
113
|
+
body: a(U.bankAccount, { includeAchDefaults: r.includeAchDefaults })
|
|
114
|
+
}) : r?.kind === "create" ? z.mutateAsync({
|
|
115
|
+
path: { counterpart_id: O },
|
|
116
|
+
body: i(U.bankAccount)
|
|
117
|
+
}) : void 0, [c, l] = await Promise.allSettled([e, o]);
|
|
118
|
+
if (r?.kind === "create" && l.status === "fulfilled" && X(l.value?.id), c.status === "rejected") throw c.reason;
|
|
119
|
+
if (l.status === "rejected") throw l.reason;
|
|
120
|
+
D("none");
|
|
121
|
+
} else g ||= (await L.mutateAsync({ body: o(U, j) }))?.id, g && j === "vendor" && f(U) && (Q(g), await z.mutateAsync({
|
|
122
|
+
path: { counterpart_id: g },
|
|
123
|
+
body: i(U.bankAccount)
|
|
124
|
+
})), Q(void 0), D("none"), g && k(g);
|
|
78
125
|
} catch (t) {
|
|
79
|
-
|
|
126
|
+
g && (Q(g), k(g)), K({ form: e(t) ?? A.genericError });
|
|
80
127
|
}
|
|
81
128
|
}, [
|
|
82
129
|
r,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
D,
|
|
88
|
-
k,
|
|
89
|
-
M,
|
|
90
|
-
N,
|
|
130
|
+
U,
|
|
131
|
+
O,
|
|
132
|
+
Z,
|
|
133
|
+
A,
|
|
91
134
|
j,
|
|
92
|
-
|
|
135
|
+
N,
|
|
93
136
|
P,
|
|
94
|
-
|
|
95
|
-
|
|
137
|
+
Y,
|
|
138
|
+
R,
|
|
139
|
+
z,
|
|
140
|
+
L,
|
|
141
|
+
V,
|
|
142
|
+
H,
|
|
143
|
+
B,
|
|
144
|
+
D,
|
|
145
|
+
k
|
|
96
146
|
])
|
|
97
147
|
};
|
|
98
148
|
}
|
|
99
149
|
//#endregion
|
|
100
|
-
export {
|
|
150
|
+
export { D as useCounterpartForm };
|
package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ACH_FIELD_GROUP_LABELS_EN as e, COUNTERPART_FORM_SHEET_LABELS_EN as t, COUNTERPART_TYPE_BADGE_LABELS_EN as n } from "./index2.js";
|
|
2
2
|
import "./index3.js";
|
|
3
|
-
import {
|
|
4
|
-
import "./index6.js";
|
|
5
|
-
import
|
|
6
|
-
import "./index9.js";
|
|
7
|
-
import
|
|
8
|
-
import "./index11.js";
|
|
9
|
-
import
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
3
|
+
import { AchFieldGroup as r } from "./index5.js";
|
|
4
|
+
import { EMPTY_ADDRESS_FORM_VALUES as i } from "./index6.js";
|
|
5
|
+
import "./index7.js";
|
|
6
|
+
import { CounterpartFormFields as a, CounterpartFormSheet as o, useFocusFirstInvalidField as s } from "./index9.js";
|
|
7
|
+
import "./index10.js";
|
|
8
|
+
import { BankAccountFormSheet as c } from "./index11.js";
|
|
9
|
+
import "./index12.js";
|
|
10
|
+
import { AddressFormSheet as l } from "./index13.js";
|
|
11
|
+
import { ConfirmDeleteDialog as u } from "./index14.js";
|
|
12
|
+
import { CounterpartSelector as d } from "./index15.js";
|
|
13
|
+
export { e as ACH_FIELD_GROUP_LABELS_EN, r as AchFieldGroup, l as AddressFormSheet, c as BankAccountFormSheet, t as COUNTERPART_FORM_SHEET_LABELS_EN, n as COUNTERPART_TYPE_BADGE_LABELS_EN, u as ConfirmDeleteDialog, a as CounterpartFormFields, o as CounterpartFormSheet, d as CounterpartSelector, i as EMPTY_ADDRESS_FORM_VALUES, s as useFocusFirstInvalidField };
|