@tesouro/embedded-components-react 0.11.101 → 0.11.104

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.
Files changed (50) hide show
  1. package/dist/index.css +21 -17
  2. package/dist/index.d.ts +10 -6
  3. package/dist/lib/CardDetailsWidget.d.ts +6 -4
  4. package/dist/lib/CreditCardsWidget.d.ts +6 -4
  5. package/dist/lib/DebitCardsWidget.d.ts +6 -4
  6. package/dist/lib/SettingsWidget.d.ts +2 -1
  7. package/dist/lib/WidgetSuite.d.ts +8 -5
  8. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +199 -168
  9. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/labels.js +1 -0
  10. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +44 -43
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +56 -52
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index3.js +68 -63
  13. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index.js +1 -1
  14. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index3.js +9 -9
  15. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index4.js +2 -2
  16. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index6.js +25 -284
  17. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/feature/dist/index7.js +291 -0
  18. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index.js +3 -3
  19. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index3.js +28 -17
  20. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index5.js +21 -34
  21. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index6.js +71 -78
  22. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index7.js +71 -77
  23. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/approval-policies/ui/dist/index8.js +43 -49
  24. package/dist/libs/tesouro-embedded-components-react/expense-management-widget/feature/dist/index.js +1 -1
  25. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index2.js +8 -1
  26. package/dist/libs/tesouro-embedded-components-react/settings-widget/chart-of-accounts/ui/dist/index3.js +98 -91
  27. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/ExpenseSettingsTabs/ExpenseSettingsTabs.js +24 -21
  28. package/dist/libs/tesouro-embedded-components-react/settings-widget/feature/dist/lib/SettingsWidget/SettingsWidget.js +14 -8
  29. package/dist/libs/tesouro-embedded-components-react/settings-widget/help/ui/shadcn/dist/index3.js +2 -2
  30. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/feature/dist/index10.js +87 -81
  31. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index3.js +63 -44
  32. package/dist/libs/tesouro-embedded-components-react/settings-widget/invoice-settings/ui/dist/index6.js +9 -6
  33. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/feature/dist/index17.js +302 -276
  34. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index.js +10 -10
  35. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index12.js +36 -36
  36. package/dist/libs/tesouro-embedded-components-react/settings-widget/team/ui/dist/index17.js +27 -13
  37. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsSectionContent.js +22 -0
  38. package/dist/libs/tesouro-embedded-components-react/settings-widget/ui/dist/lib/SettingsWidgetUi/SettingsWidgetUi.js +6 -7
  39. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/feature/dist/lib/ApprovalPoliciesSettings.js +39 -37
  40. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index.js +9 -9
  41. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index11.js +39 -35
  42. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index16.js +59 -61
  43. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index4.js +2 -2
  44. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index6.js +2 -2
  45. package/dist/libs/tesouro-embedded-components-react/shared/approval-policy/ui/dist/index7.js +3 -3
  46. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +114 -103
  47. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  48. package/dist/libs/tesouro-embedded-components-react/shared/util/dist/index.js +12 -12
  49. package/dist/packages/shared-ui-shadcn/dist/index.js +18 -15
  50. 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 n } from "../../../ui/dist/index2.js";
5
- import { EMPTY_ADDRESS_FORM_VALUES as r } from "../../../ui/dist/index6.js";
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 i } from "./labels.js";
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 a(e) {
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 o(e, t) {
20
- return e / 10 ** a(t);
20
+ function s(e, t) {
21
+ return e / 10 ** o(t);
21
22
  }
22
- function s(t, n = "USD") {
23
- return e(o(t, n), {
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 c = new Intl.DateTimeFormat(void 0, {
29
+ var l = new Intl.DateTimeFormat(void 0, {
29
30
  year: "numeric",
30
31
  month: "short",
31
32
  day: "numeric"
32
33
  });
33
- function l(e) {
34
+ function u(e) {
34
35
  if (!e) return "";
35
36
  let t = new Date(e);
36
- return Number.isNaN(t.getTime()) ? "" : c.format(t);
37
+ return Number.isNaN(t.getTime()) ? "" : l.format(t);
37
38
  }
38
- function u(e) {
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 d(e) {
44
+ function f(e) {
44
45
  return "organization" in e ? e.organization.email ?? "" : e.individual.email ?? "";
45
46
  }
46
- function f(e) {
47
+ function p(e) {
47
48
  return "organization" in e ? e.organization.phone ?? "" : e.individual.phone ?? "";
48
49
  }
49
- function p(e) {
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 m = "—";
55
- function h({ counterparts: e, addresses: t, billedAmounts: n, dueOrOwedAmounts: r, isBilledAmountLoading: i = !1, isDueOrOwedAmountLoading: a = !1, isBilledAmountError: o = !1, isDueOrOwedAmountError: c = !1 }) {
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, d = r?.get(e.id) ?? 0, f = l - d, p = i || a, h = o || c, g = u(e);
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: _(t?.get(e.id)),
63
- billedAmountLabel: o ? m : n && !i ? s(l) : "",
64
- receivedOrPaidAmountLabel: h ? m : n && r && !p ? s(f) : "",
65
- dueOrOwedAmountLabel: c ? m : r && !a ? s(d) : "",
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 && !h,
68
- isDueOrOwedAmountLoading: a && !c
68
+ isReceivedOrPaidAmountLoading: p && !m,
69
+ isDueOrOwedAmountLoading: a && !s
69
70
  };
70
71
  });
71
72
  }
72
- function g(e) {
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 _(e) {
87
- return !e?.country || !e.city ? "" : `${e.country} • ${e.city}`;
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 v({ counterpart: e, primaryAddress: t }) {
100
+ function y({ counterpart: e, primaryAddress: t }) {
90
101
  return {
91
- name: u(e),
102
+ name: d(e),
92
103
  entityType: e.type,
93
- email: d(e),
94
- phone: f(e),
104
+ email: f(e),
105
+ phone: p(e),
95
106
  taxId: e.tax_id ?? "",
96
- addressLines: g(t),
97
- createdAtLabel: l(e.created_at),
98
- updatedAtLabel: l(e.updated_at)
107
+ addressLines: _(t),
108
+ createdAtLabel: u(e.created_at),
109
+ updatedAtLabel: u(e.updated_at)
99
110
  };
100
111
  }
101
- function y(e) {
112
+ function b(e) {
102
113
  if (e) return `•••• ${e.slice(-4)}`;
103
114
  }
104
- function b(e) {
115
+ function x(e) {
105
116
  return (e ?? []).map((e) => {
106
- let t = y(e.iban || e.account_number || void 0), n = [e.currency, t].filter(Boolean).join(" · ");
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 x(e) {
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 S(e, t = "USD", n) {
120
- let r = n && (e ?? []).find((e) => e.id === n && B(e));
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 C(e) {
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 w(e) {
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 D(e = "organization", t) {
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: { ...r },
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 O(e, t) {
177
- let n = D(e.type);
178
- return n.email = d(e), n.phone = f(e), n.taxId = e.tax_id ?? "", n.remindersEnabled = !!e.reminders_enabled, t && (n.address = w(t)), "organization" in e ? n.legalName = e.organization.legal_name : (n.firstName = e.individual.first_name, n.lastName = e.individual.last_name), n;
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 k(e) {
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 A(e) {
190
- return k(e) ? C(e) : void 0;
200
+ function j(e) {
201
+ return A(e) ? w(e) : void 0;
191
202
  }
192
- function j(e, t) {
193
- let n = t === "customer", r = t === "vendor", i = A(e.address), a = e.taxId.trim() || void 0, o = e.email.trim(), s = e.phone.trim() || void 0, c = {
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 M(e, t) {
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 N(e, t, r) {
255
+ function P(e, t, n) {
245
256
  let i = {
246
- ...n,
247
- ...r
257
+ ...r,
258
+ ...n
248
259
  }, a = e === "individual";
249
260
  return {
250
- label: a ? r?.taxIdSsnLabel ?? r?.taxIdLabel ?? i.taxIdSsnLabel : r?.taxIdEinLabel ?? r?.taxIdLabel ?? i.taxIdEinLabel,
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 I(e) {
266
- return F(e.bankAccount);
276
+ function L(e) {
277
+ return I(e.bankAccount);
267
278
  }
268
- function L(e, t = {}) {
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 R(e, t = {}) {
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 z(e) {
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 B(e) {
299
- return z(e) ? !0 : !(e.country !== "US" || e.currency !== "USD" || e.iban || e.sort_code || e.bic || !e.routing_number && !e.account_number);
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 V(e, t) {
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 ? z(n) : !1
318
+ includeAchDefaults: n ? B(n) : !1
308
319
  };
309
320
  }
310
- let n = e?.find(z);
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 && B(e))
328
+ isDefaultForCurrency: !(e ?? []).some((e) => e.currency === "USD" && e.is_default_for_currency && V(e))
318
329
  };
319
330
  }
320
- function H() {
331
+ function U() {
321
332
  return {
322
333
  accountHolderName: "",
323
334
  routingNumber: "",
324
335
  accountNumber: ""
325
336
  };
326
337
  }
327
- function U(e) {
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 W(e) {
345
+ function G(e) {
335
346
  return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e);
336
347
  }
337
- function G(e, t) {
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 K(e) {
352
+ function q(e) {
342
353
  return Object.values(e).some(Boolean);
343
354
  }
344
- function q(e) {
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 J(e, n = i) {
350
- let r = {}, a = e.accountHolderName.trim(), o = e.routingNumber.trim(), s = e.accountNumber.trim();
351
- return a.length === 0 && (r.accountHolderName = n.accountHolderNameRequired), o.length !== 0 && q(o) || (r.routingNumber = n.routingNumberInvalid), t(s) || (r.accountNumber = n.accountNumberInvalid), r;
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 Y(e) {
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 X(e) {
368
+ function Z(e) {
358
369
  return /^[\d\s-]+$/.test(e) && e.replace(/\D/g, "").length === 9;
359
370
  }
360
- function Z(e, t = i, n = "customer", r = !1) {
361
- let a = {};
362
- e.entityType === "organization" ? e.legalName.trim().length === 0 && (a.legalName = t.legalNameRequired) : (e.firstName.trim().length === 0 && (a.firstName = t.firstNameRequired), e.lastName.trim().length === 0 && (a.lastName = t.lastNameRequired)), e.email.trim().length === 0 ? a.email = t.emailRequired : W(e.email.trim()) || (a.email = t.emailInvalid);
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 && !Y(o) && (a.phone = t.phoneInvalid);
375
+ o && !X(o) && (i.phone = t.phoneInvalid);
365
376
  let s = e.taxId.trim();
366
- if (s && !X(s) && (a.taxId = t.taxIdInvalid), n === "vendor" || k(e.address)) {
367
- let n = G(e.address, t);
368
- K(n) && (a.address = n);
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 || I(e))) {
371
- let n = J(e.bankAccount, t);
372
- K(n) && (a.bankAccount = n);
381
+ if (n === "vendor" && (r || L(e))) {
382
+ let n = Y(e.bankAccount, t);
383
+ q(n) && (i.bankAccount = n);
373
384
  }
374
- return a;
385
+ return i;
375
386
  }
376
- function Q(e, t, n) {
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 $(e) {
392
+ function ee(e) {
382
393
  let { address: t, bankAccount: n, ...r } = e;
383
- return K(r) || (t ? K(t) : !1) || (n ? K(n) : !1);
394
+ return q(r) || (t ? q(t) : !1) || (n ? q(n) : !1);
384
395
  }
385
- function ee(e) {
386
- return K(e);
396
+ function te(e) {
397
+ return q(e);
387
398
  }
388
- function te() {
399
+ function ne() {
389
400
  let e = globalThis.getSelection?.();
390
401
  return !!(e && e.toString().length > 0);
391
402
  }
392
- export { T as addressFormToCreatePayload, E as addressFormToUpdatePayload, w as addressResponseToFormValues, U as bankAccountToAchFormValues, p as buildAnalyticsMap, b as buildBankAccountItems, v as buildCounterpartDetailsView, N as buildCounterpartFormTaxIdField, h as buildCounterpartRows, L as counterpartFormBankAccountToCreatePayload, R as counterpartFormBankAccountToUpdatePayload, j as counterpartFormToCreatePayload, M as counterpartFormToUpdatePayload, O as counterpartToFormValues, H as emptyAchFormValues, D as emptyCounterpartFormValues, l as formatCounterpartDate, s as formatMoney, o as fromMinorUnits, x as getAchInstructions, d as getCounterpartEmail, u as getCounterpartName, S as getPayableAchInstructions, ee as hasAchFormErrors, F as hasAchFormValues, P as hasCounterpartFormAddressValues, I as hasCounterpartFormBankAccountValues, $ as hasCounterpartFormErrors, te as hasSelectedText, B as isAchCompatibleBankAccount, V as resolveCounterpartBankAccountWrite, J as validateAchFormValues, Z as validateCounterpartForm, Q as withoutUnchangedContactErrors };
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 };
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.11.101", n = "5184973b6c1232af99c7a33b06595f3f02897dde", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.11.104", n = "82c762290dc868f3d8af5c75de7ab4c2ca8c569c", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -17,19 +17,19 @@ import { parseCalendarDate as v, parseDateOrTimestamp as y } from "./lib/parseCa
17
17
  import { getRelativeCalendarDay as b } from "./lib/relativeCalendarDay.js";
18
18
  import { parseDecimalAmountToMinorUnits as x } from "./lib/parseDecimalAmountToMinorUnits.js";
19
19
  import { sumAmountOutputsMajorUnits as S } from "./lib/sumAmountOutputsMajorUnits.js";
20
- import { getStateOptions as C, isStateValid as w } from "./lib/usStates.js";
21
- import { createWidgetTokenManager as T } from "./lib/widgetTokenManager.js";
22
- import { TESOURO_NEW_EMBEDDED_BANK_ACCOUNT_CREATED_SUCCESS_EVENT as E, TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as D, emitWidgetDomEvent as O } from "./lib/widgetDomEvents.js";
23
- import { extractApiErrorMessage as k } from "./lib/apiErrors.js";
24
- import { parseApiValidationErrors as A } from "./lib/apiValidationErrors.js";
20
+ import { US_STATE_NAMES_EN as C, getStateOptions as w, isStateValid as T } from "./lib/usStates.js";
21
+ import { createWidgetTokenManager as E } from "./lib/widgetTokenManager.js";
22
+ import { TESOURO_NEW_EMBEDDED_BANK_ACCOUNT_CREATED_SUCCESS_EVENT as D, TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as O, emitWidgetDomEvent as k } from "./lib/widgetDomEvents.js";
23
+ import { extractApiErrorMessage as A } from "./lib/apiErrors.js";
24
+ import { parseApiValidationErrors as j } from "./lib/apiValidationErrors.js";
25
25
  import "./lib/auditHistory/auditHistoryActor.js";
26
- import { buildReceivableAuditHistory as j } from "./lib/auditHistory/buildReceivableAuditHistory.js";
27
- import { buildPayableAuditHistory as M, hasUnattributedAuditRows as N } from "./lib/auditHistory/buildPayableAuditHistory.js";
26
+ import { buildReceivableAuditHistory as M } from "./lib/auditHistory/buildReceivableAuditHistory.js";
27
+ import { buildPayableAuditHistory as N, hasUnattributedAuditRows as P } from "./lib/auditHistory/buildPayableAuditHistory.js";
28
28
  import "./lib/theme/color.js";
29
- import { THEME_TOKEN_NAMES as P } from "./lib/theme/themeTokens.js";
29
+ import { THEME_TOKEN_NAMES as F } from "./lib/theme/themeTokens.js";
30
30
  import "./lib/theme/toneColors.js";
31
- import { createTheme as F, isThemeDevelopmentBuild as I, readThemeTokens as L, reportThemeIssues as R, themeIssues as z, themeToCss as B } from "./lib/theme/createTheme.js";
31
+ import { createTheme as I, isThemeDevelopmentBuild as L, readThemeTokens as R, reportThemeIssues as z, themeIssues as B, themeToCss as V } from "./lib/theme/createTheme.js";
32
32
  import "./lib/theme/index.js";
33
- import { configureCsp as V, installStyleNonce as H } from "./lib/csp.js";
34
- import { resolvePdfWorkerSrc as U } from "./lib/pdfWorkerSrc.js";
35
- export { i as DATE_DISPLAY_LOCALE, a as DATE_DISPLAY_OPTIONS, E as TESOURO_NEW_EMBEDDED_BANK_ACCOUNT_CREATED_SUCCESS_EVENT, D as TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT, P as THEME_TOKEN_NAMES, n as amountOutputToMajorUnits, M as buildPayableAuditHistory, j as buildReceivableAuditHistory, e as coerceAmountValueToMinorUnits, V as configureCsp, t as createCurrencyFormatter, F as createTheme, T as createWidgetTokenManager, u as currencySymbolForCode, O as emitWidgetDomEvent, k as extractApiErrorMessage, l as formatAccountingAmount, o as formatCalendarDate, d as formatMoneyExact, f as formatPhoneDisplay, c as formatRejectionDate, s as formatTimestampDate, p as getInitials, b as getRelativeCalendarDay, C as getStateOptions, N as hasUnattributedAuditRows, H as installStyleNonce, w as isStateValid, I as isThemeDevelopmentBuild, m as isValidAchAccountNumber, h as mergeLabelTree, r as minorExponentForCurrency, g as normalizeAmountOutputCurrencyCode, _ as parseAmountOutputMajorUnits, A as parseApiValidationErrors, v as parseCalendarDate, y as parseDateOrTimestamp, x as parseDecimalAmountToMinorUnits, L as readThemeTokens, R as reportThemeIssues, U as resolvePdfWorkerSrc, S as sumAmountOutputsMajorUnits, z as themeIssues, B as themeToCss };
33
+ import { configureCsp as H, installStyleNonce as U } from "./lib/csp.js";
34
+ import { resolvePdfWorkerSrc as W } from "./lib/pdfWorkerSrc.js";
35
+ export { i as DATE_DISPLAY_LOCALE, a as DATE_DISPLAY_OPTIONS, D as TESOURO_NEW_EMBEDDED_BANK_ACCOUNT_CREATED_SUCCESS_EVENT, O as TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT, F as THEME_TOKEN_NAMES, C as US_STATE_NAMES_EN, n as amountOutputToMajorUnits, N as buildPayableAuditHistory, M as buildReceivableAuditHistory, e as coerceAmountValueToMinorUnits, H as configureCsp, t as createCurrencyFormatter, I as createTheme, E as createWidgetTokenManager, u as currencySymbolForCode, k as emitWidgetDomEvent, A as extractApiErrorMessage, l as formatAccountingAmount, o as formatCalendarDate, d as formatMoneyExact, f as formatPhoneDisplay, c as formatRejectionDate, s as formatTimestampDate, p as getInitials, b as getRelativeCalendarDay, w as getStateOptions, P as hasUnattributedAuditRows, U as installStyleNonce, T as isStateValid, L as isThemeDevelopmentBuild, m as isValidAchAccountNumber, h as mergeLabelTree, r as minorExponentForCurrency, g as normalizeAmountOutputCurrencyCode, _ as parseAmountOutputMajorUnits, j as parseApiValidationErrors, v as parseCalendarDate, y as parseDateOrTimestamp, x as parseDecimalAmountToMinorUnits, R as readThemeTokens, z as reportThemeIssues, W as resolvePdfWorkerSrc, S as sumAmountOutputsMajorUnits, B as themeIssues, V as themeToCss };
@@ -9054,21 +9054,24 @@ var Cy = {
9054
9054
  close: "Close"
9055
9055
  };
9056
9056
  function wy({ items: e, className: t, ...n }) {
9057
- return /* @__PURE__ */ _("dl", {
9058
- "data-slot": "description-list",
9059
- className: Y("ttw:@container/description-list ttw:flex ttw:w-full ttw:flex-col ttw:divide-y ttw:divide-border ttw:@2xs/description-list:grid ttw:@2xs/description-list:grid-cols-[fit-content(50%)_minmax(0,1fr)] ttw:@2xs/description-list:gap-x-4", t),
9060
- ...n,
9061
- children: e.map((e, t) => /* @__PURE__ */ v("div", {
9062
- "data-slot": "description-list-item",
9063
- className: "ttw:flex ttw:flex-col ttw:gap-0.5 ttw:py-2.5 ttw:@2xs/description-list:col-span-2 ttw:@2xs/description-list:grid ttw:@2xs/description-list:grid-cols-subgrid ttw:@2xs/description-list:items-start",
9064
- children: [/* @__PURE__ */ _("dt", {
9065
- className: "ttw:text-sm ttw:text-muted-foreground",
9066
- children: e.label
9067
- }), /* @__PURE__ */ _("dd", {
9068
- className: "ttw:min-w-0 ttw:flex-1 ttw:text-sm ttw:font-medium ttw:break-words ttw:text-foreground",
9069
- children: e.value
9070
- })]
9071
- }, `${t}-${e.label}`))
9057
+ return /* @__PURE__ */ _("div", {
9058
+ className: "ttw:@container/description-list ttw:min-w-0 ttw:w-full",
9059
+ children: /* @__PURE__ */ _("dl", {
9060
+ "data-slot": "description-list",
9061
+ className: Y("ttw:flex ttw:w-full ttw:flex-col ttw:divide-y ttw:divide-border ttw:@2xs/description-list:grid ttw:@2xs/description-list:grid-cols-[fit-content(50%)_minmax(0,1fr)] ttw:@2xs/description-list:gap-x-4", t),
9062
+ ...n,
9063
+ children: e.map((e, t) => /* @__PURE__ */ v("div", {
9064
+ "data-slot": "description-list-item",
9065
+ className: "ttw:flex ttw:flex-col ttw:gap-0.5 ttw:py-2.5 ttw:@2xs/description-list:col-span-2 ttw:@2xs/description-list:grid ttw:@2xs/description-list:grid-cols-subgrid ttw:@2xs/description-list:items-start ttw:@2xs/description-list:gap-x-4",
9066
+ children: [/* @__PURE__ */ _("dt", {
9067
+ className: "ttw:text-sm ttw:text-muted-foreground",
9068
+ children: e.label
9069
+ }), /* @__PURE__ */ _("dd", {
9070
+ className: "ttw:min-w-0 ttw:flex-1 ttw:text-sm ttw:font-medium ttw:break-words ttw:text-foreground",
9071
+ children: e.value
9072
+ })]
9073
+ }, `${t}-${e.label}`))
9074
+ })
9072
9075
  });
9073
9076
  }
9074
9077
  function Ty({ open: e, onOpenChange: t, title: n, description: r, submitError: i, icon: a, details: o, children: s, onConfirm: c, destructive: l = !1, confirmDisabled: u = !1, loading: d = !1, showCloseButton: f = !0, labels: p, testIds: m }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.11.101",
3
+ "version": "0.11.104",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [