@tesouro/embedded-components-react 0.7.21 → 0.7.24
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/fixtures/index.d.ts +5 -1
- package/dist/index.d.ts +9 -1
- package/dist/lib/CounterpartsWidget.d.ts +9 -1
- package/dist/lib/CounterpartsWidgetPublic.d.ts +9 -1
- package/dist/lib/CustomersWidget.d.ts +9 -1
- package/dist/lib/ReceivablesWidget.d.ts +9 -1
- package/dist/libs/tesouro-embedded-components-react/bill-pay-widget/bill-detail/feature/dist/index32.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +50 -51
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +4 -2
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +72 -128
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +183 -38
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +503 -193
- package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +57 -55
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +14 -14
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +114 -102
- 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 +534 -7
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index11.js +7 -179
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +179 -6
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index13.js +3 -1
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index14.js +4 -28
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index15.js +28 -4
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index16.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +10 -2
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index7.js +140 -55
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index8.js +53 -47
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +51 -539
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/reference-data/useLedgerAccountsQuery.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +584 -549
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +0 -520
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { formatMoneyExact as e } from "../../../../util/dist/lib/formatMoneyExact.js";
|
|
2
2
|
import { getInitials as t } from "../../../../util/dist/lib/getInitials.js";
|
|
3
3
|
import { isValidAchAccountNumber as n } from "../../../../util/dist/lib/isValidAchAccountNumber.js";
|
|
4
|
-
import {
|
|
4
|
+
import { COUNTERPART_FORM_SHEET_LABELS_EN as r } from "../../../ui/dist/index2.js";
|
|
5
|
+
import { EMPTY_ADDRESS_FORM_VALUES as i } from "../../../ui/dist/index6.js";
|
|
5
6
|
import "../../../ui/dist/index.js";
|
|
6
|
-
import { COUNTERPART_MESSAGE_LABELS_EN as
|
|
7
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as a } from "./labels.js";
|
|
7
8
|
//#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js
|
|
8
|
-
var
|
|
9
|
+
var o = [
|
|
9
10
|
"USD",
|
|
10
11
|
"EUR",
|
|
11
12
|
"GBP",
|
|
@@ -19,13 +20,13 @@ var a = [
|
|
|
19
20
|
"MXN",
|
|
20
21
|
"SGD"
|
|
21
22
|
];
|
|
22
|
-
function
|
|
23
|
-
return Array.from(/* @__PURE__ */ new Set([...
|
|
23
|
+
function s(e) {
|
|
24
|
+
return Array.from(/* @__PURE__ */ new Set([...o, ...e ? [e] : []])).sort().map((e) => ({
|
|
24
25
|
value: e,
|
|
25
26
|
label: e
|
|
26
27
|
}));
|
|
27
28
|
}
|
|
28
|
-
function
|
|
29
|
+
function c(e) {
|
|
29
30
|
try {
|
|
30
31
|
return new Intl.NumberFormat("en-US", {
|
|
31
32
|
style: "currency",
|
|
@@ -35,58 +36,58 @@ function s(e) {
|
|
|
35
36
|
return 2;
|
|
36
37
|
}
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
-
return e / 10 **
|
|
39
|
+
function l(e, t) {
|
|
40
|
+
return e / 10 ** c(t);
|
|
40
41
|
}
|
|
41
|
-
function
|
|
42
|
-
return e(
|
|
42
|
+
function u(t, n = "USD") {
|
|
43
|
+
return e(l(t, n), { currencyCode: n });
|
|
43
44
|
}
|
|
44
|
-
var
|
|
45
|
+
var d = new Intl.DateTimeFormat(void 0, {
|
|
45
46
|
year: "numeric",
|
|
46
47
|
month: "short",
|
|
47
48
|
day: "numeric"
|
|
48
49
|
});
|
|
49
|
-
function
|
|
50
|
+
function f(e) {
|
|
50
51
|
if (!e) return "";
|
|
51
52
|
let t = new Date(e);
|
|
52
|
-
return Number.isNaN(t.getTime()) ? "" :
|
|
53
|
+
return Number.isNaN(t.getTime()) ? "" : d.format(t);
|
|
53
54
|
}
|
|
54
|
-
function
|
|
55
|
+
function p(e) {
|
|
55
56
|
if ("organization" in e) return e.organization.legal_name;
|
|
56
57
|
let { first_name: t, last_name: n } = e.individual;
|
|
57
58
|
return [t, n].filter(Boolean).join(" ").trim();
|
|
58
59
|
}
|
|
59
|
-
function
|
|
60
|
+
function m(e) {
|
|
60
61
|
return "organization" in e ? e.organization.email ?? "" : e.individual.email ?? "";
|
|
61
62
|
}
|
|
62
|
-
function
|
|
63
|
+
function h(e) {
|
|
63
64
|
return "organization" in e ? e.organization.phone ?? "" : e.individual.phone ?? "";
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function g(e) {
|
|
66
67
|
let t = /* @__PURE__ */ new Map();
|
|
67
68
|
for (let n of e ?? []) n.dimension_value && t.set(n.dimension_value, Math.round(n.metric_value));
|
|
68
69
|
return t;
|
|
69
70
|
}
|
|
70
|
-
var
|
|
71
|
-
function
|
|
71
|
+
var _ = "-";
|
|
72
|
+
function v({ counterparts: e, addresses: n, billedAmounts: r, dueOrOwedAmounts: i, isBilledAmountLoading: a = !1, isDueOrOwedAmountLoading: o = !1, isBilledAmountError: s = !1, isDueOrOwedAmountError: c = !1 }) {
|
|
72
73
|
return e.map((e) => {
|
|
73
|
-
let
|
|
74
|
+
let l = r?.get(e.id) ?? 0, d = i?.get(e.id) ?? 0, f = l - d, m = a || o, h = s || c, g = p(e);
|
|
74
75
|
return {
|
|
75
76
|
id: e.id,
|
|
76
|
-
name:
|
|
77
|
-
initials: t(
|
|
77
|
+
name: g,
|
|
78
|
+
initials: t(g),
|
|
78
79
|
entityType: e.type,
|
|
79
|
-
locationLabel:
|
|
80
|
-
billedAmountLabel: s ?
|
|
81
|
-
receivedOrPaidAmountLabel: h ?
|
|
82
|
-
dueOrOwedAmountLabel: c ?
|
|
80
|
+
locationLabel: b(n?.get(e.id)),
|
|
81
|
+
billedAmountLabel: s ? _ : r && !a ? u(l) : "",
|
|
82
|
+
receivedOrPaidAmountLabel: h ? _ : r && i && !m ? u(f) : "",
|
|
83
|
+
dueOrOwedAmountLabel: c ? _ : i && !o ? u(d) : "",
|
|
83
84
|
isBilledAmountLoading: a && !s,
|
|
84
85
|
isReceivedOrPaidAmountLoading: m && !h,
|
|
85
86
|
isDueOrOwedAmountLoading: o && !c
|
|
86
87
|
};
|
|
87
88
|
});
|
|
88
89
|
}
|
|
89
|
-
function
|
|
90
|
+
function y(e) {
|
|
90
91
|
if (!e) return [];
|
|
91
92
|
let t = [
|
|
92
93
|
e.city,
|
|
@@ -100,27 +101,27 @@ function v(e) {
|
|
|
100
101
|
e.country
|
|
101
102
|
].filter((e) => !!(e && e.trim()));
|
|
102
103
|
}
|
|
103
|
-
function
|
|
104
|
+
function b(e) {
|
|
104
105
|
return e ? [e.country, e.city].filter(Boolean).join(" • ") : "";
|
|
105
106
|
}
|
|
106
|
-
function
|
|
107
|
+
function x({ counterpart: e, primaryAddress: t }) {
|
|
107
108
|
return {
|
|
108
|
-
name:
|
|
109
|
+
name: p(e),
|
|
109
110
|
entityType: e.type,
|
|
110
|
-
email:
|
|
111
|
-
phone:
|
|
111
|
+
email: m(e),
|
|
112
|
+
phone: h(e),
|
|
112
113
|
taxId: e.tax_id ?? "",
|
|
113
|
-
addressLines:
|
|
114
|
-
createdAtLabel:
|
|
115
|
-
updatedAtLabel:
|
|
114
|
+
addressLines: y(t),
|
|
115
|
+
createdAtLabel: f(e.created_at),
|
|
116
|
+
updatedAtLabel: f(e.updated_at)
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
|
-
function
|
|
119
|
+
function S(e) {
|
|
119
120
|
if (e) return `•••• ${e.slice(-4)}`;
|
|
120
121
|
}
|
|
121
|
-
function
|
|
122
|
+
function C(e) {
|
|
122
123
|
return (e ?? []).map((e) => {
|
|
123
|
-
let t =
|
|
124
|
+
let t = S(e.iban || e.account_number || void 0), n = [e.currency, t].filter(Boolean).join(" · ");
|
|
124
125
|
return {
|
|
125
126
|
id: e.id,
|
|
126
127
|
primary: e.name || e.account_holder_name || e.currency,
|
|
@@ -129,17 +130,17 @@ function S(e) {
|
|
|
129
130
|
};
|
|
130
131
|
});
|
|
131
132
|
}
|
|
132
|
-
function
|
|
133
|
+
function w(e) {
|
|
133
134
|
let t = (e ?? []).filter((e) => e.currency === "USD" && (!!e.routing_number || !!e.account_number));
|
|
134
135
|
return t.find((e) => e.is_default_for_currency) ?? t[0];
|
|
135
136
|
}
|
|
136
|
-
function
|
|
137
|
-
let r = n && (e ?? []).find((e) => e.id === n &&
|
|
137
|
+
function T(e, t = "USD", n) {
|
|
138
|
+
let r = n && (e ?? []).find((e) => e.id === n && U(e));
|
|
138
139
|
if (r) return r;
|
|
139
140
|
let i = (e ?? []).filter((e) => e.currency === t && !!e.account_holder_name && !!e.routing_number && !!e.account_number);
|
|
140
141
|
return i.find((e) => e.is_default_for_currency) ?? i[0];
|
|
141
142
|
}
|
|
142
|
-
function
|
|
143
|
+
function E(e, t = {}) {
|
|
143
144
|
let n = e.line2.trim();
|
|
144
145
|
return {
|
|
145
146
|
line1: e.line1.trim(),
|
|
@@ -150,7 +151,7 @@ function T(e, t = {}) {
|
|
|
150
151
|
country: "US"
|
|
151
152
|
};
|
|
152
153
|
}
|
|
153
|
-
function
|
|
154
|
+
function D(e) {
|
|
154
155
|
return {
|
|
155
156
|
line1: e.line1 ?? "",
|
|
156
157
|
line2: e.line2 ?? "",
|
|
@@ -159,10 +160,10 @@ function E(e) {
|
|
|
159
160
|
postalCode: e.postal_code ?? ""
|
|
160
161
|
};
|
|
161
162
|
}
|
|
162
|
-
function D(e) {
|
|
163
|
-
return T(e);
|
|
164
|
-
}
|
|
165
163
|
function O(e) {
|
|
164
|
+
return E(e);
|
|
165
|
+
}
|
|
166
|
+
function k(e) {
|
|
166
167
|
return {
|
|
167
168
|
line1: e.line1.trim(),
|
|
168
169
|
line2: e.line2.trim(),
|
|
@@ -172,7 +173,7 @@ function O(e) {
|
|
|
172
173
|
country: "US"
|
|
173
174
|
};
|
|
174
175
|
}
|
|
175
|
-
function
|
|
176
|
+
function A(e = "organization", t) {
|
|
176
177
|
return {
|
|
177
178
|
entityType: e,
|
|
178
179
|
legalName: "",
|
|
@@ -183,7 +184,7 @@ function k(e = "organization", t) {
|
|
|
183
184
|
phone: "",
|
|
184
185
|
taxId: "",
|
|
185
186
|
remindersEnabled: t === "customer",
|
|
186
|
-
address: { ...
|
|
187
|
+
address: { ...i },
|
|
187
188
|
bankAccount: {
|
|
188
189
|
accountHolderName: "",
|
|
189
190
|
routingNumber: "",
|
|
@@ -191,11 +192,11 @@ function k(e = "organization", t) {
|
|
|
191
192
|
}
|
|
192
193
|
};
|
|
193
194
|
}
|
|
194
|
-
function
|
|
195
|
-
let n =
|
|
196
|
-
return n.email =
|
|
195
|
+
function j(e, t) {
|
|
196
|
+
let n = A(e.type);
|
|
197
|
+
return n.email = m(e), n.phone = h(e), n.taxId = e.tax_id ?? "", n.remindersEnabled = !!e.reminders_enabled, t && (n.address = D(t)), "organization" in e ? n.legalName = e.organization.legal_name : (n.firstName = e.individual.first_name, n.lastName = e.individual.last_name), n;
|
|
197
198
|
}
|
|
198
|
-
function
|
|
199
|
+
function M(e) {
|
|
199
200
|
return [
|
|
200
201
|
e.line1,
|
|
201
202
|
e.line2,
|
|
@@ -204,11 +205,11 @@ function j(e) {
|
|
|
204
205
|
e.postalCode
|
|
205
206
|
].some((e) => e.trim().length > 0);
|
|
206
207
|
}
|
|
207
|
-
function
|
|
208
|
-
return
|
|
208
|
+
function N(e) {
|
|
209
|
+
return M(e) ? E(e) : void 0;
|
|
209
210
|
}
|
|
210
|
-
function
|
|
211
|
-
let n = t === "customer", r = t === "vendor", i =
|
|
211
|
+
function P(e, t) {
|
|
212
|
+
let n = t === "customer", r = t === "vendor", i = N(e.address), a = e.taxId.trim() || void 0, o = e.email.trim(), s = e.phone.trim() || void 0, c = {
|
|
212
213
|
is_customer: n,
|
|
213
214
|
is_vendor: r,
|
|
214
215
|
language: "en",
|
|
@@ -237,7 +238,7 @@ function N(e, t) {
|
|
|
237
238
|
}
|
|
238
239
|
};
|
|
239
240
|
}
|
|
240
|
-
function
|
|
241
|
+
function F(e, t) {
|
|
241
242
|
let n = e.taxId.trim(), r = e.email.trim(), i = e.phone.trim(), a = {
|
|
242
243
|
language: "en",
|
|
243
244
|
reminders_enabled: t === "customer" ? e.remindersEnabled : void 0,
|
|
@@ -261,20 +262,31 @@ function P(e, t) {
|
|
|
261
262
|
}
|
|
262
263
|
};
|
|
263
264
|
}
|
|
264
|
-
function
|
|
265
|
-
|
|
265
|
+
function I(e, t, n) {
|
|
266
|
+
let i = {
|
|
267
|
+
...r,
|
|
268
|
+
...n
|
|
269
|
+
}, a = e === "individual";
|
|
270
|
+
return {
|
|
271
|
+
label: a ? n?.taxIdSsnLabel ?? n?.taxIdLabel ?? i.taxIdSsnLabel : n?.taxIdEinLabel ?? n?.taxIdLabel ?? i.taxIdEinLabel,
|
|
272
|
+
placeholder: a ? i.taxIdSsnPlaceholder : i.taxIdEinPlaceholder,
|
|
273
|
+
description: t === "vendor" ? i.vendorTaxIdHelp : i.customerTaxIdHelp
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
function L(e) {
|
|
277
|
+
return M(e.address);
|
|
266
278
|
}
|
|
267
|
-
function
|
|
279
|
+
function R(e) {
|
|
268
280
|
return [
|
|
269
281
|
e.accountHolderName,
|
|
270
282
|
e.routingNumber,
|
|
271
283
|
e.accountNumber
|
|
272
284
|
].some((e) => e.trim().length > 0);
|
|
273
285
|
}
|
|
274
|
-
function
|
|
275
|
-
return
|
|
286
|
+
function z(e) {
|
|
287
|
+
return R(e.bankAccount);
|
|
276
288
|
}
|
|
277
|
-
function
|
|
289
|
+
function B(e, t = {}) {
|
|
278
290
|
return {
|
|
279
291
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
280
292
|
account_number: e.accountNumber.trim() || void 0,
|
|
@@ -284,7 +296,7 @@ function R(e, t = {}) {
|
|
|
284
296
|
is_default_for_currency: t.isDefaultForCurrency ?? !0
|
|
285
297
|
};
|
|
286
298
|
}
|
|
287
|
-
function
|
|
299
|
+
function V(e, t = {}) {
|
|
288
300
|
return {
|
|
289
301
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
290
302
|
account_number: e.accountNumber.trim() || void 0,
|
|
@@ -295,7 +307,7 @@ function z(e, t = {}) {
|
|
|
295
307
|
} : {}
|
|
296
308
|
};
|
|
297
309
|
}
|
|
298
|
-
function
|
|
310
|
+
function H(e) {
|
|
299
311
|
return [
|
|
300
312
|
e.account_number,
|
|
301
313
|
e.iban,
|
|
@@ -304,19 +316,19 @@ function B(e) {
|
|
|
304
316
|
e.bic
|
|
305
317
|
].every((e) => !e);
|
|
306
318
|
}
|
|
307
|
-
function
|
|
308
|
-
return !!(
|
|
319
|
+
function U(e) {
|
|
320
|
+
return !!(H(e) || e.currency === "USD" && (e.routing_number || e.account_number));
|
|
309
321
|
}
|
|
310
|
-
function
|
|
322
|
+
function W(e, t) {
|
|
311
323
|
if (t) {
|
|
312
324
|
let n = e?.find((e) => e.id === t);
|
|
313
325
|
return {
|
|
314
326
|
kind: "update",
|
|
315
327
|
bankAccountId: t,
|
|
316
|
-
includeAchDefaults: n ?
|
|
328
|
+
includeAchDefaults: n ? H(n) : !1
|
|
317
329
|
};
|
|
318
330
|
}
|
|
319
|
-
let n = e?.find(
|
|
331
|
+
let n = e?.find(H);
|
|
320
332
|
return n ? {
|
|
321
333
|
kind: "update",
|
|
322
334
|
bankAccountId: n.id,
|
|
@@ -326,7 +338,7 @@ function H(e, t) {
|
|
|
326
338
|
isDefaultForCurrency: !(e ?? []).some((e) => e.currency === "USD" && e.is_default_for_currency)
|
|
327
339
|
};
|
|
328
340
|
}
|
|
329
|
-
function
|
|
341
|
+
function G() {
|
|
330
342
|
return {
|
|
331
343
|
name: "",
|
|
332
344
|
accountHolderName: "",
|
|
@@ -339,7 +351,7 @@ function U() {
|
|
|
339
351
|
isDefault: !1
|
|
340
352
|
};
|
|
341
353
|
}
|
|
342
|
-
function
|
|
354
|
+
function ee(e) {
|
|
343
355
|
return {
|
|
344
356
|
name: e.name ?? "",
|
|
345
357
|
accountHolderName: e.account_holder_name ?? "",
|
|
@@ -352,7 +364,7 @@ function W(e) {
|
|
|
352
364
|
isDefault: e.is_default_for_currency ?? !1
|
|
353
365
|
};
|
|
354
366
|
}
|
|
355
|
-
function
|
|
367
|
+
function K(e) {
|
|
356
368
|
return {
|
|
357
369
|
name: e.name.trim() || void 0,
|
|
358
370
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
@@ -366,7 +378,7 @@ function G(e) {
|
|
|
366
378
|
is_default_for_currency: e.isDefault
|
|
367
379
|
};
|
|
368
380
|
}
|
|
369
|
-
function
|
|
381
|
+
function q(e) {
|
|
370
382
|
return {
|
|
371
383
|
name: e.name.trim(),
|
|
372
384
|
account_holder_name: e.accountHolderName.trim(),
|
|
@@ -379,70 +391,70 @@ function K(e) {
|
|
|
379
391
|
country: "US"
|
|
380
392
|
};
|
|
381
393
|
}
|
|
382
|
-
function
|
|
394
|
+
function J(e) {
|
|
383
395
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
384
396
|
}
|
|
385
|
-
function
|
|
397
|
+
function Y(e, t) {
|
|
386
398
|
let n = {};
|
|
387
399
|
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;
|
|
388
400
|
}
|
|
389
|
-
function
|
|
401
|
+
function X(e) {
|
|
390
402
|
return Object.values(e).some(Boolean);
|
|
391
403
|
}
|
|
392
|
-
function
|
|
404
|
+
function Z(e) {
|
|
393
405
|
if (!/^\d{9}$/.test(e)) return !1;
|
|
394
406
|
let t = [...e].map(Number);
|
|
395
407
|
return (3 * (t[0] + t[3] + t[6]) + 7 * (t[1] + t[4] + t[7]) + (t[2] + t[5] + t[8])) % 10 == 0;
|
|
396
408
|
}
|
|
397
|
-
function
|
|
398
|
-
let r = {},
|
|
399
|
-
return
|
|
409
|
+
function Q(e, t = a) {
|
|
410
|
+
let r = {}, i = e.accountHolderName.trim(), o = e.routingNumber.trim(), s = e.accountNumber.trim();
|
|
411
|
+
return i.length === 0 && (r.accountHolderName = t.accountHolderNameRequired), (o.length === 0 || !Z(o)) && (r.routingNumber = t.routingNumberInvalid), n(s) || (r.accountNumber = t.accountNumberInvalid), r;
|
|
400
412
|
}
|
|
401
|
-
function
|
|
413
|
+
function $(e) {
|
|
402
414
|
let t = (/^(\+?[\d\s().-]+?)\s*(?:(?:x|ext\.?)\s*\d+)?$/i.exec(e)?.[1])?.replace(/\D/g, "").length ?? 0;
|
|
403
415
|
return t >= 7 && t <= 15;
|
|
404
416
|
}
|
|
405
|
-
function
|
|
417
|
+
function te(e) {
|
|
406
418
|
return /^[\d\s-]+$/.test(e) && e.replace(/\D/g, "").length === 9;
|
|
407
419
|
}
|
|
408
|
-
function
|
|
420
|
+
function ne(e, t, n = a, r = "customer", i = !1) {
|
|
409
421
|
let o = {};
|
|
410
|
-
e.entityType === "organization" ? e.legalName.trim().length === 0 && (o.legalName = n.legalNameRequired) : (e.firstName.trim().length === 0 && (o.firstName = n.firstNameRequired), e.lastName.trim().length === 0 && (o.lastName = n.lastNameRequired)), e.email.trim().length === 0 ? o.email = n.emailRequired :
|
|
422
|
+
e.entityType === "organization" ? e.legalName.trim().length === 0 && (o.legalName = n.legalNameRequired) : (e.firstName.trim().length === 0 && (o.firstName = n.firstNameRequired), e.lastName.trim().length === 0 && (o.lastName = n.lastNameRequired)), e.email.trim().length === 0 ? o.email = n.emailRequired : J(e.email.trim()) || (o.email = n.emailInvalid);
|
|
411
423
|
let s = e.phone.trim();
|
|
412
|
-
s &&
|
|
424
|
+
s && !$(s) && (o.phone = n.phoneInvalid);
|
|
413
425
|
let c = e.taxId.trim();
|
|
414
|
-
if (c &&
|
|
415
|
-
let t =
|
|
416
|
-
|
|
426
|
+
if (c && !te(c) && (o.taxId = n.taxIdInvalid), t === "create" && r === "vendor" || M(e.address)) {
|
|
427
|
+
let t = Y(e.address, n);
|
|
428
|
+
X(t) && (o.address = t);
|
|
417
429
|
}
|
|
418
|
-
if (r === "vendor" && (
|
|
419
|
-
let t =
|
|
420
|
-
|
|
430
|
+
if (r === "vendor" && (i || z(e))) {
|
|
431
|
+
let t = Q(e.bankAccount, n);
|
|
432
|
+
X(t) && (o.bankAccount = t);
|
|
421
433
|
}
|
|
422
434
|
return o;
|
|
423
435
|
}
|
|
424
|
-
function
|
|
436
|
+
function re(e, t, n) {
|
|
425
437
|
if (!n) return e;
|
|
426
438
|
let r = { ...e };
|
|
427
439
|
return t.phone.trim() === n.phone.trim() && delete r.phone, t.taxId.trim() === n.taxId.trim() && delete r.taxId, r;
|
|
428
440
|
}
|
|
429
|
-
function
|
|
441
|
+
function ie(e) {
|
|
430
442
|
let { address: t, bankAccount: n, ...r } = e;
|
|
431
|
-
return
|
|
443
|
+
return X(r) || (t ? X(t) : !1) || (n ? X(n) : !1);
|
|
432
444
|
}
|
|
433
|
-
function
|
|
445
|
+
function ae(e, t = a) {
|
|
434
446
|
let n = {};
|
|
435
447
|
return e.accountNumber.trim().length === 0 && e.iban.trim().length === 0 && (n.accountNumber = t.bankAccountIdentifierRequired), e.currency.trim().length === 0 && (n.currency = t.bankAccountCurrencyRequired), n;
|
|
436
448
|
}
|
|
437
|
-
function
|
|
438
|
-
return
|
|
449
|
+
function oe(e) {
|
|
450
|
+
return X(e);
|
|
439
451
|
}
|
|
440
|
-
function
|
|
441
|
-
return
|
|
452
|
+
function se(e, t = a) {
|
|
453
|
+
return Y(e, t);
|
|
442
454
|
}
|
|
443
|
-
function
|
|
455
|
+
function ce() {
|
|
444
456
|
let e = globalThis.getSelection?.();
|
|
445
457
|
return !!(e && e.toString().length > 0);
|
|
446
458
|
}
|
|
447
459
|
//#endregion
|
|
448
|
-
export {
|
|
460
|
+
export { O as addressFormToCreatePayload, k as addressFormToUpdatePayload, D as addressResponseToFormValues, K as bankAccountFormToCreatePayload, q as bankAccountFormToUpdatePayload, ee as bankAccountToFormValues, g as buildAnalyticsMap, C as buildBankAccountItems, x as buildCounterpartDetailsView, I as buildCounterpartFormTaxIdField, v as buildCounterpartRows, B as counterpartFormBankAccountToCreatePayload, V as counterpartFormBankAccountToUpdatePayload, P as counterpartFormToCreatePayload, F as counterpartFormToUpdatePayload, j as counterpartToFormValues, G as emptyBankAccountFormValues, A as emptyCounterpartFormValues, f as formatCounterpartDate, u as formatMoney, l as fromMinorUnits, w as getAchInstructions, m as getCounterpartEmail, p as getCounterpartName, s as getCurrencyOptions, T as getPayableAchInstructions, R as hasAchFormValues, oe as hasBankAccountFormErrors, L as hasCounterpartFormAddressValues, z as hasCounterpartFormBankAccountValues, ie as hasCounterpartFormErrors, ce as hasSelectedText, U as isAchCompatibleBankAccount, W as resolveCounterpartBankAccountWrite, Q as validateAchFormValues, se as validateAddressForm, ae as validateBankAccountForm, ne as validateCounterpartForm, re as withoutUnchangedContactErrors };
|
package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { ACH_FIELD_GROUP_LABELS_EN as e } from "./index2.js";
|
|
1
|
+
import { ACH_FIELD_GROUP_LABELS_EN as e, COUNTERPART_FORM_SHEET_LABELS_EN as t } from "./index2.js";
|
|
2
2
|
import "./index3.js";
|
|
3
|
-
import { AchFieldGroup as
|
|
4
|
-
import { EMPTY_ADDRESS_FORM_VALUES as
|
|
5
|
-
import "./index7.js";
|
|
6
|
-
import
|
|
7
|
-
import "./index10.js";
|
|
8
|
-
import
|
|
9
|
-
import "./index12.js";
|
|
3
|
+
import { AchFieldGroup as n } from "./index5.js";
|
|
4
|
+
import { EMPTY_ADDRESS_FORM_VALUES as r } from "./index6.js";
|
|
5
|
+
import { CounterpartAddressFields as i } from "./index7.js";
|
|
6
|
+
import "./index8.js";
|
|
7
|
+
import { CounterpartFormFields as a, CounterpartFormSheet as o, countErrors as s, useFocusFirstInvalidField as c } from "./index10.js";
|
|
8
|
+
import "./index11.js";
|
|
9
|
+
import { BankAccountFormSheet as l } from "./index12.js";
|
|
10
10
|
import "./index13.js";
|
|
11
|
-
import
|
|
12
|
-
import "./index15.js";
|
|
13
|
-
|
|
11
|
+
import "./index14.js";
|
|
12
|
+
import { ConfirmDeleteDialog as u } from "./index15.js";
|
|
13
|
+
import "./index16.js";
|
|
14
|
+
export { e as ACH_FIELD_GROUP_LABELS_EN, n as AchFieldGroup, l as BankAccountFormSheet, t as COUNTERPART_FORM_SHEET_LABELS_EN, u as ConfirmDeleteDialog, i as CounterpartAddressFields, a as CounterpartFormFields, o as CounterpartFormSheet, r as EMPTY_ADDRESS_FORM_VALUES, s as countErrors, c as useFocusFirstInvalidField };
|