@tesouro/embedded-components-react 0.11.100 → 0.11.102
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/experimental/QuickViewWidget.d.ts +62 -2
- package/dist/experimental/index.d.ts +62 -2
- package/dist/index.css +21 -17
- package/dist/index.d.ts +10 -6
- package/dist/lib/CardDetailsWidget.d.ts +6 -4
- package/dist/lib/CreditCardsWidget.d.ts +6 -4
- package/dist/lib/DebitCardsWidget.d.ts +6 -4
- package/dist/lib/SettingsWidget.d.ts +2 -1
- package/dist/lib/WidgetSuite.d.ts +8 -5
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +199 -168
- package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/labels.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +44 -43
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index3.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js +25 -284
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index7.js +291 -0
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js +28 -17
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js +21 -34
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js +71 -78
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js +71 -77
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js +43 -49
- package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index2.js +8 -1
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/accounts/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/bills/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/data-access/dist/index.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/data-access/dist/index2.js +98 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/index.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/lib/CardsQuickViewWidget/CardsQuickViewWidgetFeature.js +80 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/lib/CardsQuickViewWidget/labels.js +27 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/lib/CardsQuickViewWidget/summarizeCardSpend.js +17 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/lib/CardsQuickViewWidget/testIds.js +7 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/lib/CardsQuickViewWidget/useCardSpendSummary.js +29 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/feature/dist/lib/analytics/events.js +4 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/ui/dist/index.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/ui/dist/index2.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/cards/ui/dist/index3.js +31 -0
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/QuickViewWidget.js +57 -44
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/feature/dist/lib/QuickViewWidget/labels.js +6 -3
- package/dist/libs/tesouro-embedded-components-react/quick-view-widget/invoices/ui/dist/index2.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js +98 -91
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/ExpenseSettingsTabs/ExpenseSettingsTabs.js +24 -21
- package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +14 -8
- package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +87 -81
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +63 -44
- package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +9 -6
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +302 -276
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index.js +10 -10
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index12.js +36 -36
- package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index17.js +27 -13
- package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsSectionContent.js +22 -0
- package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +6 -7
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +39 -37
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index.js +9 -9
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +39 -35
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +59 -61
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index4.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index6.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +3 -3
- package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +114 -103
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +43 -43
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/debit-card/useAllDebitCardsQuery.js +22 -18
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +97 -97
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +166 -154
- 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/util/dist/index.js +12 -12
- package/dist/packages/shared-ui-shadcn/dist/index.js +18 -15
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { formatMoneyExact as e } from "../../../../util/dist/lib/formatMoneyExact.js";
|
|
2
2
|
import { isValidAchAccountNumber as t } from "../../../../util/dist/lib/isValidAchAccountNumber.js";
|
|
3
|
+
import { US_STATE_NAMES_EN as n } from "../../../../util/dist/lib/usStates.js";
|
|
3
4
|
import "../../../../util/dist/index.js";
|
|
4
|
-
import { COUNTERPART_FORM_SHEET_LABELS_EN as
|
|
5
|
-
import { EMPTY_ADDRESS_FORM_VALUES as
|
|
5
|
+
import { COUNTERPART_FORM_SHEET_LABELS_EN as r } from "../../../ui/dist/index2.js";
|
|
6
|
+
import { EMPTY_ADDRESS_FORM_VALUES as i } from "../../../ui/dist/index6.js";
|
|
6
7
|
import "../../../ui/dist/index.js";
|
|
7
|
-
import { COUNTERPART_MESSAGE_LABELS_EN as
|
|
8
|
+
import { COUNTERPART_MESSAGE_LABELS_EN as a } from "./labels.js";
|
|
8
9
|
// ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js
|
|
9
|
-
function
|
|
10
|
+
function o(e) {
|
|
10
11
|
try {
|
|
11
12
|
return new Intl.NumberFormat("en-US", {
|
|
12
13
|
style: "currency",
|
|
@@ -16,60 +17,60 @@ function a(e) {
|
|
|
16
17
|
return 2;
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
|
-
function
|
|
20
|
-
return e / 10 **
|
|
20
|
+
function s(e, t) {
|
|
21
|
+
return e / 10 ** o(t);
|
|
21
22
|
}
|
|
22
|
-
function
|
|
23
|
-
return e(
|
|
23
|
+
function c(t, n = "USD") {
|
|
24
|
+
return e(s(t, n), {
|
|
24
25
|
currencyCode: n,
|
|
25
26
|
includeSpaceAfterCurrencySymbol: !1
|
|
26
27
|
});
|
|
27
28
|
}
|
|
28
|
-
var
|
|
29
|
+
var l = new Intl.DateTimeFormat(void 0, {
|
|
29
30
|
year: "numeric",
|
|
30
31
|
month: "short",
|
|
31
32
|
day: "numeric"
|
|
32
33
|
});
|
|
33
|
-
function
|
|
34
|
+
function u(e) {
|
|
34
35
|
if (!e) return "";
|
|
35
36
|
let t = new Date(e);
|
|
36
|
-
return Number.isNaN(t.getTime()) ? "" :
|
|
37
|
+
return Number.isNaN(t.getTime()) ? "" : l.format(t);
|
|
37
38
|
}
|
|
38
|
-
function
|
|
39
|
+
function d(e) {
|
|
39
40
|
if ("organization" in e) return e.organization.legal_name;
|
|
40
41
|
let { first_name: t, last_name: n } = e.individual;
|
|
41
42
|
return [t, n].filter(Boolean).join(" ").trim();
|
|
42
43
|
}
|
|
43
|
-
function
|
|
44
|
+
function f(e) {
|
|
44
45
|
return "organization" in e ? e.organization.email ?? "" : e.individual.email ?? "";
|
|
45
46
|
}
|
|
46
|
-
function
|
|
47
|
+
function p(e) {
|
|
47
48
|
return "organization" in e ? e.organization.phone ?? "" : e.individual.phone ?? "";
|
|
48
49
|
}
|
|
49
|
-
function
|
|
50
|
+
function m(e) {
|
|
50
51
|
let t = /* @__PURE__ */ new Map();
|
|
51
52
|
for (let n of e ?? []) n.dimension_value && t.set(n.dimension_value, Math.round(n.metric_value));
|
|
52
53
|
return t;
|
|
53
54
|
}
|
|
54
|
-
var
|
|
55
|
-
function
|
|
55
|
+
var h = "—";
|
|
56
|
+
function g({ counterparts: e, addresses: t, billedAmounts: n, dueOrOwedAmounts: r, isBilledAmountLoading: i = !1, isDueOrOwedAmountLoading: a = !1, isBilledAmountError: o = !1, isDueOrOwedAmountError: s = !1 }) {
|
|
56
57
|
return e.map((e) => {
|
|
57
|
-
let l = n?.get(e.id) ?? 0,
|
|
58
|
+
let l = n?.get(e.id) ?? 0, u = r?.get(e.id) ?? 0, f = l - u, p = i || a, m = o || s, g = d(e);
|
|
58
59
|
return {
|
|
59
60
|
id: e.id,
|
|
60
61
|
name: g,
|
|
61
62
|
entityType: e.type,
|
|
62
|
-
locationLabel:
|
|
63
|
-
billedAmountLabel: o ?
|
|
64
|
-
receivedOrPaidAmountLabel:
|
|
65
|
-
dueOrOwedAmountLabel:
|
|
63
|
+
locationLabel: v(t?.get(e.id)),
|
|
64
|
+
billedAmountLabel: o ? h : n && !i ? c(l) : "",
|
|
65
|
+
receivedOrPaidAmountLabel: m ? h : n && r && !p ? c(f) : "",
|
|
66
|
+
dueOrOwedAmountLabel: s ? h : r && !a ? c(u) : "",
|
|
66
67
|
isBilledAmountLoading: i && !o,
|
|
67
|
-
isReceivedOrPaidAmountLoading: p && !
|
|
68
|
-
isDueOrOwedAmountLoading: a && !
|
|
68
|
+
isReceivedOrPaidAmountLoading: p && !m,
|
|
69
|
+
isDueOrOwedAmountLoading: a && !s
|
|
69
70
|
};
|
|
70
71
|
});
|
|
71
72
|
}
|
|
72
|
-
function
|
|
73
|
+
function _(e) {
|
|
73
74
|
if (!e) return [];
|
|
74
75
|
let t = [
|
|
75
76
|
e.city,
|
|
@@ -83,27 +84,37 @@ function g(e) {
|
|
|
83
84
|
e.country
|
|
84
85
|
].filter((e) => !!(e && e.trim()));
|
|
85
86
|
}
|
|
86
|
-
function
|
|
87
|
-
|
|
87
|
+
function v(e) {
|
|
88
|
+
if (!e) return "";
|
|
89
|
+
let t = e.city?.trim(), r = e.country?.trim().toUpperCase();
|
|
90
|
+
if (r === "US") {
|
|
91
|
+
let r = e.state?.trim();
|
|
92
|
+
return [t, Object.entries(n).find(([e, t]) => e === r?.toUpperCase() || t.toLowerCase() === r?.toLowerCase())?.[0] || r].filter(Boolean).join(", ");
|
|
93
|
+
}
|
|
94
|
+
let i = r;
|
|
95
|
+
if (r) try {
|
|
96
|
+
i = new Intl.DisplayNames("en-US", { type: "region" }).of(r) ?? r;
|
|
97
|
+
} catch {}
|
|
98
|
+
return [t, i].filter(Boolean).join(", ");
|
|
88
99
|
}
|
|
89
|
-
function
|
|
100
|
+
function y({ counterpart: e, primaryAddress: t }) {
|
|
90
101
|
return {
|
|
91
|
-
name:
|
|
102
|
+
name: d(e),
|
|
92
103
|
entityType: e.type,
|
|
93
|
-
email:
|
|
94
|
-
phone:
|
|
104
|
+
email: f(e),
|
|
105
|
+
phone: p(e),
|
|
95
106
|
taxId: e.tax_id ?? "",
|
|
96
|
-
addressLines:
|
|
97
|
-
createdAtLabel:
|
|
98
|
-
updatedAtLabel:
|
|
107
|
+
addressLines: _(t),
|
|
108
|
+
createdAtLabel: u(e.created_at),
|
|
109
|
+
updatedAtLabel: u(e.updated_at)
|
|
99
110
|
};
|
|
100
111
|
}
|
|
101
|
-
function
|
|
112
|
+
function b(e) {
|
|
102
113
|
if (e) return `•••• ${e.slice(-4)}`;
|
|
103
114
|
}
|
|
104
|
-
function
|
|
115
|
+
function x(e) {
|
|
105
116
|
return (e ?? []).map((e) => {
|
|
106
|
-
let t =
|
|
117
|
+
let t = b(e.iban || e.account_number || void 0), n = [e.currency, t].filter(Boolean).join(" · ");
|
|
107
118
|
return {
|
|
108
119
|
id: e.id,
|
|
109
120
|
primary: e.name || e.account_holder_name || e.currency,
|
|
@@ -112,17 +123,17 @@ function b(e) {
|
|
|
112
123
|
};
|
|
113
124
|
});
|
|
114
125
|
}
|
|
115
|
-
function
|
|
126
|
+
function S(e) {
|
|
116
127
|
let t = (e ?? []).filter((e) => e.currency === "USD" && (!!e.routing_number || !!e.account_number));
|
|
117
128
|
return t.find((e) => e.is_default_for_currency) ?? t[0];
|
|
118
129
|
}
|
|
119
|
-
function
|
|
120
|
-
let r = n && (e ?? []).find((e) => e.id === n &&
|
|
130
|
+
function C(e, t = "USD", n) {
|
|
131
|
+
let r = n && (e ?? []).find((e) => e.id === n && V(e));
|
|
121
132
|
if (r) return r;
|
|
122
133
|
let i = (e ?? []).filter((e) => e.currency === t && !!e.account_holder_name && !!e.routing_number && !!e.account_number);
|
|
123
134
|
return i.find((e) => e.is_default_for_currency) ?? i[0];
|
|
124
135
|
}
|
|
125
|
-
function
|
|
136
|
+
function w(e) {
|
|
126
137
|
return {
|
|
127
138
|
line1: e.line1.trim(),
|
|
128
139
|
line2: e.line2.trim() || void 0,
|
|
@@ -132,7 +143,7 @@ function C(e) {
|
|
|
132
143
|
country: "US"
|
|
133
144
|
};
|
|
134
145
|
}
|
|
135
|
-
function
|
|
146
|
+
function T(e) {
|
|
136
147
|
return {
|
|
137
148
|
line1: e.line1 ?? "",
|
|
138
149
|
line2: e.line2 ?? "",
|
|
@@ -141,10 +152,10 @@ function w(e) {
|
|
|
141
152
|
postalCode: e.postal_code ?? ""
|
|
142
153
|
};
|
|
143
154
|
}
|
|
144
|
-
function T(e) {
|
|
145
|
-
return C(e);
|
|
146
|
-
}
|
|
147
155
|
function E(e) {
|
|
156
|
+
return w(e);
|
|
157
|
+
}
|
|
158
|
+
function D(e) {
|
|
148
159
|
return {
|
|
149
160
|
line1: e.line1.trim(),
|
|
150
161
|
line2: e.line2.trim(),
|
|
@@ -154,7 +165,7 @@ function E(e) {
|
|
|
154
165
|
country: "US"
|
|
155
166
|
};
|
|
156
167
|
}
|
|
157
|
-
function
|
|
168
|
+
function O(e = "organization", t) {
|
|
158
169
|
return {
|
|
159
170
|
entityType: e,
|
|
160
171
|
legalName: "",
|
|
@@ -165,7 +176,7 @@ function D(e = "organization", t) {
|
|
|
165
176
|
phone: "",
|
|
166
177
|
taxId: "",
|
|
167
178
|
remindersEnabled: t === "customer",
|
|
168
|
-
address: { ...
|
|
179
|
+
address: { ...i },
|
|
169
180
|
bankAccount: {
|
|
170
181
|
accountHolderName: "",
|
|
171
182
|
routingNumber: "",
|
|
@@ -173,11 +184,11 @@ function D(e = "organization", t) {
|
|
|
173
184
|
}
|
|
174
185
|
};
|
|
175
186
|
}
|
|
176
|
-
function
|
|
177
|
-
let n =
|
|
178
|
-
return n.email =
|
|
187
|
+
function k(e, t) {
|
|
188
|
+
let n = O(e.type);
|
|
189
|
+
return n.email = f(e), n.phone = p(e), n.taxId = e.tax_id ?? "", n.remindersEnabled = !!e.reminders_enabled, t && (n.address = T(t)), "organization" in e ? n.legalName = e.organization.legal_name : (n.firstName = e.individual.first_name, n.lastName = e.individual.last_name), n;
|
|
179
190
|
}
|
|
180
|
-
function
|
|
191
|
+
function A(e) {
|
|
181
192
|
return [
|
|
182
193
|
e.line1,
|
|
183
194
|
e.line2,
|
|
@@ -186,11 +197,11 @@ function k(e) {
|
|
|
186
197
|
e.postalCode
|
|
187
198
|
].some((e) => e.trim().length > 0);
|
|
188
199
|
}
|
|
189
|
-
function
|
|
190
|
-
return
|
|
200
|
+
function j(e) {
|
|
201
|
+
return A(e) ? w(e) : void 0;
|
|
191
202
|
}
|
|
192
|
-
function
|
|
193
|
-
let n = t === "customer", r = t === "vendor", i =
|
|
203
|
+
function M(e, t) {
|
|
204
|
+
let n = t === "customer", r = t === "vendor", i = j(e.address), a = e.taxId.trim() || void 0, o = e.email.trim(), s = e.phone.trim() || void 0, c = {
|
|
194
205
|
is_customer: n,
|
|
195
206
|
is_vendor: r,
|
|
196
207
|
language: "en",
|
|
@@ -219,7 +230,7 @@ function j(e, t) {
|
|
|
219
230
|
}
|
|
220
231
|
};
|
|
221
232
|
}
|
|
222
|
-
function
|
|
233
|
+
function N(e, t) {
|
|
223
234
|
let n = e.taxId.trim(), r = e.email.trim(), i = e.phone.trim(), a = {
|
|
224
235
|
reminders_enabled: t === "customer" ? e.remindersEnabled : void 0,
|
|
225
236
|
tax_id: n
|
|
@@ -241,31 +252,31 @@ function M(e, t) {
|
|
|
241
252
|
}
|
|
242
253
|
};
|
|
243
254
|
}
|
|
244
|
-
function
|
|
255
|
+
function P(e, t, n) {
|
|
245
256
|
let i = {
|
|
246
|
-
...
|
|
247
|
-
...
|
|
257
|
+
...r,
|
|
258
|
+
...n
|
|
248
259
|
}, a = e === "individual";
|
|
249
260
|
return {
|
|
250
|
-
label: a ?
|
|
261
|
+
label: a ? n?.taxIdSsnLabel ?? n?.taxIdLabel ?? i.taxIdSsnLabel : n?.taxIdEinLabel ?? n?.taxIdLabel ?? i.taxIdEinLabel,
|
|
251
262
|
placeholder: a ? i.taxIdSsnPlaceholder : i.taxIdEinPlaceholder,
|
|
252
263
|
description: t === "vendor" ? i.vendorTaxIdHelp : i.customerTaxIdHelp
|
|
253
264
|
};
|
|
254
265
|
}
|
|
255
|
-
function P(e) {
|
|
256
|
-
return k(e.address);
|
|
257
|
-
}
|
|
258
266
|
function F(e) {
|
|
267
|
+
return A(e.address);
|
|
268
|
+
}
|
|
269
|
+
function I(e) {
|
|
259
270
|
return [
|
|
260
271
|
e.accountHolderName,
|
|
261
272
|
e.routingNumber,
|
|
262
273
|
e.accountNumber
|
|
263
274
|
].some((e) => e.trim().length > 0);
|
|
264
275
|
}
|
|
265
|
-
function
|
|
266
|
-
return
|
|
276
|
+
function L(e) {
|
|
277
|
+
return I(e.bankAccount);
|
|
267
278
|
}
|
|
268
|
-
function
|
|
279
|
+
function R(e, t = {}) {
|
|
269
280
|
return {
|
|
270
281
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
271
282
|
account_number: e.accountNumber.trim() || void 0,
|
|
@@ -275,7 +286,7 @@ function L(e, t = {}) {
|
|
|
275
286
|
is_default_for_currency: t.isDefaultForCurrency ?? !0
|
|
276
287
|
};
|
|
277
288
|
}
|
|
278
|
-
function
|
|
289
|
+
function z(e, t = {}) {
|
|
279
290
|
return {
|
|
280
291
|
account_holder_name: e.accountHolderName.trim() || void 0,
|
|
281
292
|
account_number: e.accountNumber.trim() || void 0,
|
|
@@ -286,7 +297,7 @@ function R(e, t = {}) {
|
|
|
286
297
|
} : {}
|
|
287
298
|
};
|
|
288
299
|
}
|
|
289
|
-
function
|
|
300
|
+
function B(e) {
|
|
290
301
|
return [
|
|
291
302
|
e.account_number,
|
|
292
303
|
e.iban,
|
|
@@ -295,98 +306,98 @@ function z(e) {
|
|
|
295
306
|
e.bic
|
|
296
307
|
].every((e) => !e);
|
|
297
308
|
}
|
|
298
|
-
function
|
|
299
|
-
return
|
|
309
|
+
function V(e) {
|
|
310
|
+
return B(e) ? !0 : !(e.country !== "US" || e.currency !== "USD" || e.iban || e.sort_code || e.bic || !e.routing_number && !e.account_number);
|
|
300
311
|
}
|
|
301
|
-
function
|
|
312
|
+
function H(e, t) {
|
|
302
313
|
if (t) {
|
|
303
314
|
let n = e?.find((e) => e.id === t);
|
|
304
315
|
return {
|
|
305
316
|
kind: "update",
|
|
306
317
|
bankAccountId: t,
|
|
307
|
-
includeAchDefaults: n ?
|
|
318
|
+
includeAchDefaults: n ? B(n) : !1
|
|
308
319
|
};
|
|
309
320
|
}
|
|
310
|
-
let n = e?.find(
|
|
321
|
+
let n = e?.find(B);
|
|
311
322
|
return n ? {
|
|
312
323
|
kind: "update",
|
|
313
324
|
bankAccountId: n.id,
|
|
314
325
|
includeAchDefaults: !0
|
|
315
326
|
} : {
|
|
316
327
|
kind: "create",
|
|
317
|
-
isDefaultForCurrency: !(e ?? []).some((e) => e.currency === "USD" && e.is_default_for_currency &&
|
|
328
|
+
isDefaultForCurrency: !(e ?? []).some((e) => e.currency === "USD" && e.is_default_for_currency && V(e))
|
|
318
329
|
};
|
|
319
330
|
}
|
|
320
|
-
function
|
|
331
|
+
function U() {
|
|
321
332
|
return {
|
|
322
333
|
accountHolderName: "",
|
|
323
334
|
routingNumber: "",
|
|
324
335
|
accountNumber: ""
|
|
325
336
|
};
|
|
326
337
|
}
|
|
327
|
-
function
|
|
338
|
+
function W(e) {
|
|
328
339
|
return {
|
|
329
340
|
accountHolderName: e.account_holder_name ?? "",
|
|
330
341
|
routingNumber: e.routing_number ?? "",
|
|
331
342
|
accountNumber: e.account_number ?? ""
|
|
332
343
|
};
|
|
333
344
|
}
|
|
334
|
-
function
|
|
345
|
+
function G(e) {
|
|
335
346
|
return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
|
|
336
347
|
}
|
|
337
|
-
function
|
|
348
|
+
function K(e, t) {
|
|
338
349
|
let n = {};
|
|
339
350
|
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;
|
|
340
351
|
}
|
|
341
|
-
function
|
|
352
|
+
function q(e) {
|
|
342
353
|
return Object.values(e).some(Boolean);
|
|
343
354
|
}
|
|
344
|
-
function
|
|
355
|
+
function J(e) {
|
|
345
356
|
if (!/^\d{9}$/.test(e)) return !1;
|
|
346
357
|
let t = [...e].map(Number);
|
|
347
358
|
return (3 * (t[0] + t[3] + t[6]) + 7 * (t[1] + t[4] + t[7]) + (t[2] + t[5] + t[8])) % 10 == 0;
|
|
348
359
|
}
|
|
349
|
-
function
|
|
350
|
-
let r = {},
|
|
351
|
-
return
|
|
360
|
+
function Y(e, n = a) {
|
|
361
|
+
let r = {}, i = e.accountHolderName.trim(), o = e.routingNumber.trim(), s = e.accountNumber.trim();
|
|
362
|
+
return i.length === 0 && (r.accountHolderName = n.accountHolderNameRequired), o.length !== 0 && J(o) || (r.routingNumber = n.routingNumberInvalid), t(s) || (r.accountNumber = n.accountNumberInvalid), r;
|
|
352
363
|
}
|
|
353
|
-
function
|
|
364
|
+
function X(e) {
|
|
354
365
|
let t = (/^(\+?[\d\s().-]+?)\s*(?:(?:x|ext\.?)\s*\d+)?$/i.exec(e)?.[1])?.replace(/\D/g, "").length ?? 0;
|
|
355
366
|
return t >= 7 && t <= 15;
|
|
356
367
|
}
|
|
357
|
-
function
|
|
368
|
+
function Z(e) {
|
|
358
369
|
return /^[\d\s-]+$/.test(e) && e.replace(/\D/g, "").length === 9;
|
|
359
370
|
}
|
|
360
|
-
function
|
|
361
|
-
let
|
|
362
|
-
e.entityType === "organization" ? e.legalName.trim().length === 0 && (
|
|
371
|
+
function Q(e, t = a, n = "customer", r = !1) {
|
|
372
|
+
let i = {};
|
|
373
|
+
e.entityType === "organization" ? e.legalName.trim().length === 0 && (i.legalName = t.legalNameRequired) : (e.firstName.trim().length === 0 && (i.firstName = t.firstNameRequired), e.lastName.trim().length === 0 && (i.lastName = t.lastNameRequired)), e.email.trim().length === 0 ? i.email = t.emailRequired : G(e.email.trim()) || (i.email = t.emailInvalid);
|
|
363
374
|
let o = e.phone.trim();
|
|
364
|
-
o && !
|
|
375
|
+
o && !X(o) && (i.phone = t.phoneInvalid);
|
|
365
376
|
let s = e.taxId.trim();
|
|
366
|
-
if (s && !
|
|
367
|
-
let n =
|
|
368
|
-
|
|
377
|
+
if (s && !Z(s) && (i.taxId = t.taxIdInvalid), n === "vendor" || A(e.address)) {
|
|
378
|
+
let n = K(e.address, t);
|
|
379
|
+
q(n) && (i.address = n);
|
|
369
380
|
}
|
|
370
|
-
if (n === "vendor" && (r ||
|
|
371
|
-
let n =
|
|
372
|
-
|
|
381
|
+
if (n === "vendor" && (r || L(e))) {
|
|
382
|
+
let n = Y(e.bankAccount, t);
|
|
383
|
+
q(n) && (i.bankAccount = n);
|
|
373
384
|
}
|
|
374
|
-
return
|
|
385
|
+
return i;
|
|
375
386
|
}
|
|
376
|
-
function
|
|
387
|
+
function $(e, t, n) {
|
|
377
388
|
if (!n) return e;
|
|
378
389
|
let r = { ...e };
|
|
379
390
|
return t.phone.trim() === n.phone.trim() && delete r.phone, t.taxId.trim() === n.taxId.trim() && delete r.taxId, r;
|
|
380
391
|
}
|
|
381
|
-
function
|
|
392
|
+
function ee(e) {
|
|
382
393
|
let { address: t, bankAccount: n, ...r } = e;
|
|
383
|
-
return
|
|
394
|
+
return q(r) || (t ? q(t) : !1) || (n ? q(n) : !1);
|
|
384
395
|
}
|
|
385
|
-
function
|
|
386
|
-
return
|
|
396
|
+
function te(e) {
|
|
397
|
+
return q(e);
|
|
387
398
|
}
|
|
388
|
-
function
|
|
399
|
+
function ne() {
|
|
389
400
|
let e = globalThis.getSelection?.();
|
|
390
401
|
return !!(e && e.toString().length > 0);
|
|
391
402
|
}
|
|
392
|
-
export {
|
|
403
|
+
export { E as addressFormToCreatePayload, D as addressFormToUpdatePayload, T as addressResponseToFormValues, W as bankAccountToAchFormValues, m as buildAnalyticsMap, x as buildBankAccountItems, y as buildCounterpartDetailsView, P as buildCounterpartFormTaxIdField, g as buildCounterpartRows, R as counterpartFormBankAccountToCreatePayload, z as counterpartFormBankAccountToUpdatePayload, M as counterpartFormToCreatePayload, N as counterpartFormToUpdatePayload, k as counterpartToFormValues, U as emptyAchFormValues, O as emptyCounterpartFormValues, u as formatCounterpartDate, c as formatMoney, s as fromMinorUnits, S as getAchInstructions, f as getCounterpartEmail, d as getCounterpartName, C as getPayableAchInstructions, te as hasAchFormErrors, I as hasAchFormValues, F as hasCounterpartFormAddressValues, L as hasCounterpartFormBankAccountValues, ee as hasCounterpartFormErrors, ne as hasSelectedText, V as isAchCompatibleBankAccount, H as resolveCounterpartBankAccountWrite, Y as validateAchFormValues, Q as validateCounterpartForm, $ as withoutUnchangedContactErrors };
|