@tesouro/embedded-components-react 0.5.292 → 0.5.294

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 (48) hide show
  1. package/README.md +1 -1
  2. package/dist/index.d.ts +26 -1
  3. package/dist/lib/CounterpartsWidget.d.ts +2 -0
  4. package/dist/lib/CounterpartsWidgetPublic.d.ts +2 -0
  5. package/dist/lib/CustomersWidget.d.ts +2 -0
  6. package/dist/lib/ReceivablesWidget.d.ts +26 -1
  7. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index.js +4 -4
  8. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index11.js +3 -2
  9. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index14.js +5 -88
  10. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index15.js +70 -173
  11. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index16.js +210 -17
  12. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/data-access/dist/index17.js +29 -0
  13. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +6 -7
  14. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/details.js +142 -141
  15. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/helpers.js +84 -54
  16. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/labels.js +21 -3
  17. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/paymentTerms.js +27 -27
  18. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/recurrence.js +2 -1
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/reminders.js +1 -1
  20. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/totals.js +13 -10
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActions.js +84 -80
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -1
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableDetails.js +32 -30
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableForm.js +417 -414
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableIssuePreflight.js +1 -1
  26. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableReminders.js +1 -1
  27. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableStatusCards.js +1 -1
  28. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +83 -66
  29. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +133 -129
  30. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useSendReceivableWithPaymentLink.js +26 -22
  31. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useUtcDayStart.js +16 -0
  32. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index13.js +0 -1
  33. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index15.js +20 -22
  34. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index23.js +2 -2
  35. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index40.js +1 -1
  36. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index44.js +91 -85
  37. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index45.js +1 -0
  38. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index51.js +119 -88
  39. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index53.js +19 -16
  40. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/ui/dist/index57.js +130 -96
  41. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +24 -8
  42. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +2 -0
  43. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +101 -98
  44. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index9.js +34 -20
  45. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  46. package/dist/libs/tesouro-embedded-components-react/shared/product-catalog/ui/dist/index6.js +4 -3
  47. package/dist/packages/shared-ui-shadcn/dist/index.js +15 -10
  48. package/package.json +1 -1
@@ -398,9 +398,20 @@ function Z(e, t = i) {
398
398
  let r = {}, a = e.accountHolderName.trim(), o = e.routingNumber.trim(), s = e.accountNumber.trim();
399
399
  return a.length === 0 && (r.accountHolderName = t.accountHolderNameRequired), (o.length === 0 || !X(o)) && (r.routingNumber = t.routingNumberInvalid), n(s) || (r.accountNumber = t.accountNumberInvalid), r;
400
400
  }
401
- function Q(e, t, n = i, r = "customer", a = !1) {
401
+ function Q(e) {
402
+ let t = (/^(\+?[\d\s().-]+?)\s*(?:(?:x|ext\.?)\s*\d+)?$/i.exec(e)?.[1])?.replace(/\D/g, "").length ?? 0;
403
+ return t >= 7 && t <= 15;
404
+ }
405
+ function $(e) {
406
+ return /^[\d\s-]+$/.test(e) && e.replace(/\D/g, "").length === 9;
407
+ }
408
+ function ee(e, t, n = i, r = "customer", a = !1) {
402
409
  let o = {};
403
- if (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 : q(e.email.trim()) || (o.email = n.emailInvalid), t === "create" && r === "vendor" || j(e.address)) {
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 : q(e.email.trim()) || (o.email = n.emailInvalid);
411
+ let s = e.phone.trim();
412
+ s && !Q(s) && (o.phone = n.phoneInvalid);
413
+ let c = e.taxId.trim();
414
+ if (c && !$(c) && (o.taxId = n.taxIdInvalid), t === "create" && r === "vendor" || j(e.address)) {
404
415
  let t = J(e.address, n);
405
416
  Y(t) && (o.address = t);
406
417
  }
@@ -410,23 +421,28 @@ function Q(e, t, n = i, r = "customer", a = !1) {
410
421
  }
411
422
  return o;
412
423
  }
413
- function $(e) {
424
+ function te(e, t, n) {
425
+ if (!n) return e;
426
+ let r = { ...e };
427
+ return t.phone.trim() === n.phone.trim() && delete r.phone, t.taxId.trim() === n.taxId.trim() && delete r.taxId, r;
428
+ }
429
+ function ne(e) {
414
430
  let { address: t, bankAccount: n, ...r } = e;
415
431
  return Y(r) || (t ? Y(t) : !1) || (n ? Y(n) : !1);
416
432
  }
417
- function ee(e, t = i) {
433
+ function re(e, t = i) {
418
434
  let n = {};
419
435
  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;
420
436
  }
421
- function te(e) {
437
+ function ie(e) {
422
438
  return Y(e);
423
439
  }
424
- function ne(e, t = i) {
440
+ function ae(e, t = i) {
425
441
  return J(e, t);
426
442
  }
427
- function re() {
443
+ function oe() {
428
444
  let e = globalThis.getSelection?.();
429
445
  return !!(e && e.toString().length > 0);
430
446
  }
431
447
  //#endregion
432
- export { D as addressFormToCreatePayload, O as addressFormToUpdatePayload, E as addressResponseToFormValues, G as bankAccountFormToCreatePayload, K as bankAccountFormToUpdatePayload, W as bankAccountToFormValues, h as buildAnalyticsMap, S as buildBankAccountItems, b as buildCounterpartDetailsView, _ as buildCounterpartRows, R as counterpartFormBankAccountToCreatePayload, z as counterpartFormBankAccountToUpdatePayload, N as counterpartFormToCreatePayload, P as counterpartFormToUpdatePayload, A as counterpartToFormValues, U as emptyBankAccountFormValues, k as emptyCounterpartFormValues, d as formatCounterpartDate, l as formatMoney, c as fromMinorUnits, C as getAchInstructions, p as getCounterpartEmail, f as getCounterpartName, o as getCurrencyOptions, w as getPayableAchInstructions, I as hasAchFormValues, te as hasBankAccountFormErrors, F as hasCounterpartFormAddressValues, L as hasCounterpartFormBankAccountValues, $ as hasCounterpartFormErrors, re as hasSelectedText, V as isAchCompatibleBankAccount, H as resolveCounterpartBankAccountWrite, Z as validateAchFormValues, ne as validateAddressForm, ee as validateBankAccountForm, Q as validateCounterpartForm };
448
+ export { D as addressFormToCreatePayload, O as addressFormToUpdatePayload, E as addressResponseToFormValues, G as bankAccountFormToCreatePayload, K as bankAccountFormToUpdatePayload, W as bankAccountToFormValues, h as buildAnalyticsMap, S as buildBankAccountItems, b as buildCounterpartDetailsView, _ as buildCounterpartRows, R as counterpartFormBankAccountToCreatePayload, z as counterpartFormBankAccountToUpdatePayload, N as counterpartFormToCreatePayload, P as counterpartFormToUpdatePayload, A as counterpartToFormValues, U as emptyBankAccountFormValues, k as emptyCounterpartFormValues, d as formatCounterpartDate, l as formatMoney, c as fromMinorUnits, C as getAchInstructions, p as getCounterpartEmail, f as getCounterpartName, o as getCurrencyOptions, w as getPayableAchInstructions, I as hasAchFormValues, ie as hasBankAccountFormErrors, F as hasCounterpartFormAddressValues, L as hasCounterpartFormBankAccountValues, ne as hasCounterpartFormErrors, oe as hasSelectedText, V as isAchCompatibleBankAccount, H as resolveCounterpartBankAccountWrite, Z as validateAchFormValues, ae as validateAddressForm, re as validateBankAccountForm, ee as validateCounterpartForm, te as withoutUnchangedContactErrors };
@@ -5,6 +5,8 @@ var e = {
5
5
  lastNameRequired: "Last name is required",
6
6
  emailRequired: "Email is required",
7
7
  emailInvalid: "Enter a valid email address",
8
+ phoneInvalid: "Enter a valid phone number",
9
+ taxIdInvalid: "Enter a valid 9-digit tax ID",
8
10
  addressLine1Required: "Address line 1 is required",
9
11
  cityRequired: "City is required",
10
12
  stateRequired: "State is required",
@@ -3,37 +3,39 @@
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, 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 ee } from "../../../data-access/dist/index3.js";
8
- import { useCreateCounterpartBankAccountMutation as te, useUpdateCounterpartBankAccountMutation as _ } from "../../../data-access/dist/index5.js";
9
- import { useCreateCounterpartAddressMutation as v, useUpdateCounterpartAddressMutation as y } from "../../../data-access/dist/index7.js";
6
+ import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, counterpartFormBankAccountToCreatePayload as i, counterpartFormBankAccountToUpdatePayload as ee, counterpartFormToCreatePayload as a, counterpartFormToUpdatePayload as o, counterpartToFormValues as s, emptyCounterpartFormValues as c, getAchInstructions as l, hasCounterpartFormAddressValues as u, hasCounterpartFormBankAccountValues as d, hasCounterpartFormErrors as f, resolveCounterpartBankAccountWrite as p, validateCounterpartForm as m, withoutUnchangedContactErrors as te } from "./helpers.js";
7
+ import { useCreateCounterpartMutation as h, useUpdateCounterpartMutation as g } from "../../../data-access/dist/index3.js";
8
+ import { useCreateCounterpartBankAccountMutation as _, useUpdateCounterpartBankAccountMutation as v } from "../../../data-access/dist/index5.js";
9
+ import { useCreateCounterpartAddressMutation as y, useUpdateCounterpartAddressMutation as b } from "../../../data-access/dist/index7.js";
10
10
  import "../../../data-access/dist/index.js";
11
- import { useCallback as b, useState as x } from "react";
11
+ import { useCallback as x, useState as S } from "react";
12
12
  //#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js
13
- function S(e, t) {
14
- if (!t) return d(e);
13
+ function C(e, t) {
14
+ if (!t) return u(e);
15
15
  let n = r(t);
16
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();
17
17
  }
18
- function C(e) {
18
+ function w(e) {
19
19
  return {
20
20
  accountHolderName: e.account_holder_name ?? "",
21
21
  routingNumber: e.routing_number ?? "",
22
22
  accountNumber: e.account_number ?? ""
23
23
  };
24
24
  }
25
- function w(e, t) {
26
- if (!t) return f(e);
27
- let n = C(t);
25
+ function T(e, t) {
26
+ if (!t) return d(e);
27
+ let n = w(t);
28
28
  return e.bankAccount.accountHolderName.trim() !== n.accountHolderName.trim() || e.bankAccount.routingNumber.trim() !== n.routingNumber.trim() || e.bankAccount.accountNumber.trim() !== n.accountNumber.trim();
29
29
  }
30
- function T(e, t) {
30
+ function E(e, t) {
31
31
  let n = { ...e };
32
32
  if ([
33
33
  "legalName",
34
34
  "firstName",
35
35
  "lastName",
36
- "email"
36
+ "email",
37
+ "phone",
38
+ "taxId"
37
39
  ].forEach((e) => {
38
40
  n[e] && !t[e] && delete n[e];
39
41
  }), e.address) {
@@ -50,147 +52,148 @@ function T(e, t) {
50
52
  }
51
53
  return JSON.stringify(n) === JSON.stringify(e) ? e : n;
52
54
  }
53
- function E({ view: r, setView: E, selectedId: D, setSelectedId: O, messages: k, counterpartType: A, counterpart: j, primaryAddress: M, bankAccounts: N, isBankAccountsLoading: P, isBankAccountsError: F, includeBankAccount: I = !0 }) {
54
- let L = A === "vendor" && I, R = g(), z = v(), B = te(), V = ee(), H = y(), U = _(), [W, G] = x(() => l()), [K, q] = x({}), [J, Y] = x({
55
+ function D({ view: r, setView: D, selectedId: O, setSelectedId: k, messages: A, counterpartType: j, counterpart: M, primaryAddress: N, bankAccounts: P, isBankAccountsLoading: F, isBankAccountsError: I, includeBankAccount: L = !0 }) {
56
+ let R = j === "vendor" && L, z = h(), B = y(), V = _(), H = g(), U = b(), W = v(), [G, K] = S(() => c()), [q, J] = S({}), [ne, Y] = S({
55
57
  address: !1,
56
58
  bankAccount: !1
57
- }), [X, Z] = x(), [Q, $] = x(), ne = R.isPending || z.isPending || B.isPending || U.isPending || V.isPending || H.isPending, re = b(() => {
58
- O(void 0), $(void 0), Z(void 0), Y({
59
- address: A === "vendor",
59
+ }), [X, Z] = S(), [Q, $] = S(), re = z.isPending || B.isPending || V.isPending || W.isPending || H.isPending || U.isPending, ie = x(() => {
60
+ k(void 0), $(void 0), Z(void 0), Y({
61
+ address: j === "vendor",
60
62
  bankAccount: !1
61
- }), G(l("organization", A)), q({}), E("create");
63
+ }), K(c("organization", j)), J({}), D("create");
62
64
  }, [
63
- A,
64
- O,
65
- E
66
- ]), ie = b(() => {
67
- if (!j || L && (P || F)) return;
68
- let e = L ? u(N) : void 0, t = c(j, M);
65
+ j,
66
+ k,
67
+ D
68
+ ]), ae = x(() => {
69
+ if (!M || R && (F || I)) return;
70
+ let e = R ? l(P) : void 0, t = s(M, N);
69
71
  $(void 0), Z(e?.id), Y({
70
- address: d(t),
72
+ address: u(t),
71
73
  bankAccount: !1
72
- }), G({
74
+ }), K({
73
75
  ...t,
74
- ...e ? { bankAccount: C(e) } : {}
75
- }), q({}), E("edit");
76
+ ...e ? { bankAccount: w(e) } : {}
77
+ }), J({}), D("edit");
76
78
  }, [
77
- N,
78
- j,
79
- F,
80
79
  P,
81
80
  M,
82
- E,
83
- L
84
- ]), ae = b(() => {
85
- E("none");
86
- }, [E]), oe = b(() => {
81
+ I,
82
+ F,
83
+ N,
84
+ D,
85
+ R
86
+ ]), oe = x(() => {
87
+ D("none");
88
+ }, [D]), se = x(() => {
87
89
  Y((e) => ({
88
90
  ...e,
89
91
  address: !0
90
92
  }));
91
- }, []), se = b((e) => {
92
- G((t) => {
93
+ }, []), ce = x((e) => {
94
+ K((t) => {
93
95
  let n = typeof e == "function" ? e(t) : e;
94
- return q((e) => p(e) ? T(e, h(n, r === "edit" ? "edit" : "create", k, A, r === "edit" && L && !!X)) : e), n;
96
+ return J((e) => f(e) ? E(e, m(n, r === "edit" ? "edit" : "create", A, j, r === "edit" && R && !!X)) : e), n;
95
97
  });
96
98
  }, [
97
99
  X,
100
+ j,
98
101
  A,
99
- k,
100
102
  r,
101
- L
102
- ]), ce = b(() => {
103
- G((e) => (q(h(e, r === "edit" ? "edit" : "create", k, A)), e));
103
+ R
104
+ ]), le = x(() => {
105
+ K((e) => (J(m(e, r === "edit" ? "edit" : "create", A, j)), e));
104
106
  }, [
107
+ j,
105
108
  A,
106
- k,
107
109
  r
108
110
  ]);
109
111
  return {
110
- values: W,
111
- errors: K,
112
- setValues: se,
113
- isSubmitting: ne,
114
- sectionsToExpand: J,
115
- expandAddress: oe,
116
- openCreate: re,
117
- openEdit: ie,
118
- close: ae,
119
- submit: b(async () => {
120
- let c = r === "edit" ? "edit" : "create", l = h(W, c, k, A, c === "edit" && L && !!X);
121
- if (p(l)) return q(l), Y((e) => ({
122
- address: e.address || !!l.address,
123
- bankAccount: e.bankAccount || !!l.bankAccount
112
+ values: G,
113
+ errors: q,
114
+ setValues: ce,
115
+ isSubmitting: re,
116
+ sectionsToExpand: ne,
117
+ expandAddress: se,
118
+ openCreate: ie,
119
+ openEdit: ae,
120
+ close: oe,
121
+ submit: x(async () => {
122
+ let c = r === "edit" ? "edit" : "create", h = te(m(G, c, A, j, c === "edit" && R && !!X), G, c === "edit" && M ? s(M, N) : void 0);
123
+ if (f(h)) return J(h), Y((e) => ({
124
+ address: e.address || !!h.address,
125
+ bankAccount: e.bankAccount || !!h.bankAccount
124
126
  })), { ok: !1 };
125
- q({}), Y({
127
+ J({}), Y({
126
128
  address: !1,
127
129
  bankAccount: !1
128
130
  });
129
131
  let g = Q;
130
132
  try {
131
- if (r === "edit" && D) {
132
- $(void 0), await V.mutateAsync({
133
- path: { counterpart_id: D },
134
- body: s(W, A)
133
+ if (r === "edit" && O) {
134
+ $(void 0), await H.mutateAsync({
135
+ path: { counterpart_id: O },
136
+ body: o(G, j)
135
137
  });
136
- let e = M ? S(W, M) ? H.mutateAsync({
138
+ let e = N ? C(G, N) ? U.mutateAsync({
137
139
  path: {
138
- counterpart_id: D,
139
- address_id: M.id
140
+ counterpart_id: O,
141
+ address_id: N.id
140
142
  },
141
- body: n(W.address)
142
- }) : void 0 : d(W) ? z.mutateAsync({
143
- path: { counterpart_id: D },
144
- body: t(W.address)
145
- }) : void 0, r = L && w(W, u(N)) ? m(N, X) : void 0, o = r?.kind === "update" ? U.mutateAsync({
143
+ body: n(G.address)
144
+ }) : void 0 : u(G) ? B.mutateAsync({
145
+ path: { counterpart_id: O },
146
+ body: t(G.address)
147
+ }) : void 0, r = R && T(G, l(P)) ? p(P, X) : void 0, a = r?.kind === "update" ? W.mutateAsync({
146
148
  path: {
147
- counterpart_id: D,
149
+ counterpart_id: O,
148
150
  bank_account_id: r.bankAccountId
149
151
  },
150
- body: a(W.bankAccount, { includeAchDefaults: r.includeAchDefaults })
151
- }) : r?.kind === "create" ? B.mutateAsync({
152
- path: { counterpart_id: D },
153
- body: i(W.bankAccount, { isDefaultForCurrency: r.isDefaultForCurrency })
154
- }) : void 0, [c, l] = await Promise.allSettled([e, o]);
155
- if (r?.kind === "create" && l.status === "fulfilled" && Z(l.value?.id), c.status === "rejected") throw c.reason;
156
- if (l.status === "rejected") throw l.reason;
157
- return E("none"), {
152
+ body: ee(G.bankAccount, { includeAchDefaults: r.includeAchDefaults })
153
+ }) : r?.kind === "create" ? V.mutateAsync({
154
+ path: { counterpart_id: O },
155
+ body: i(G.bankAccount, { isDefaultForCurrency: r.isDefaultForCurrency })
156
+ }) : void 0, [s, c] = await Promise.allSettled([e, a]);
157
+ if (r?.kind === "create" && c.status === "fulfilled" && Z(c.value?.id), s.status === "rejected") throw s.reason;
158
+ if (c.status === "rejected") throw c.reason;
159
+ return D("none"), {
158
160
  ok: !0,
159
- counterpartId: D
161
+ counterpartId: O
160
162
  };
161
163
  }
162
- return g ||= (await R.mutateAsync({ body: o(W, A) }))?.id, g && L && f(W) && ($(g), await B.mutateAsync({
164
+ return g ||= (await z.mutateAsync({ body: a(G, j) }))?.id, g && R && d(G) && ($(g), await V.mutateAsync({
163
165
  path: { counterpart_id: g },
164
- body: i(W.bankAccount)
165
- })), $(void 0), E("none"), g && O(g), {
166
+ body: i(G.bankAccount)
167
+ })), $(void 0), D("none"), g && k(g), {
166
168
  ok: !0,
167
169
  counterpartId: g
168
170
  };
169
171
  } catch (t) {
170
- return g && ($(g), O(g)), q({ form: e(t) ?? k.genericError }), { ok: !1 };
172
+ return g && ($(g), k(g)), J({ form: e(t) ?? A.genericError }), { ok: !1 };
171
173
  }
172
174
  }, [
173
175
  r,
174
- W,
175
- D,
176
+ G,
177
+ O,
176
178
  Q,
177
- k,
178
179
  A,
180
+ j,
179
181
  M,
180
182
  N,
183
+ P,
181
184
  X,
182
- z,
183
185
  B,
184
- R,
185
- H,
186
- U,
187
186
  V,
188
- E,
189
- O,
190
- L
187
+ z,
188
+ U,
189
+ W,
190
+ H,
191
+ D,
192
+ k,
193
+ R
191
194
  ]),
192
- revealErrors: ce
195
+ revealErrors: le
193
196
  };
194
197
  }
195
198
  //#endregion
196
- export { E as useCounterpartForm };
199
+ export { D as useCounterpartForm };
@@ -204,16 +204,21 @@ function D({ open: c, onOpenChange: l, mode: h, counterpartMode: _ = "customer",
204
204
  ]
205
205
  }), /* @__PURE__ */ b("div", {
206
206
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
207
- children: [/* @__PURE__ */ y(i, {
208
- htmlFor: `${H}-phone`,
209
- requirement: n.Optional,
210
- labels: B.fieldMarkers,
211
- children: B.phoneLabel
212
- }), /* @__PURE__ */ y(r, {
213
- id: `${H}-phone`,
214
- value: w.phone,
215
- onChange: (e) => j({ phone: e.target.value })
216
- })]
207
+ children: [
208
+ /* @__PURE__ */ y(i, {
209
+ htmlFor: `${H}-phone`,
210
+ requirement: n.Optional,
211
+ labels: B.fieldMarkers,
212
+ children: B.phoneLabel
213
+ }),
214
+ /* @__PURE__ */ y(r, {
215
+ id: `${H}-phone`,
216
+ value: w.phone,
217
+ "aria-invalid": !!D?.phone,
218
+ onChange: (e) => j({ phone: e.target.value })
219
+ }),
220
+ /* @__PURE__ */ y(u, { message: D?.phone })
221
+ ]
217
222
  })]
218
223
  }),
219
224
  V.taxId && /* @__PURE__ */ b("div", {
@@ -228,8 +233,10 @@ function D({ open: c, onOpenChange: l, mode: h, counterpartMode: _ = "customer",
228
233
  /* @__PURE__ */ y(r, {
229
234
  id: `${H}-tax-id`,
230
235
  value: w.taxId,
236
+ "aria-invalid": !!D?.taxId,
231
237
  onChange: (e) => j({ taxId: e.target.value })
232
238
  }),
239
+ /* @__PURE__ */ y(u, { message: D?.taxId }),
233
240
  /* @__PURE__ */ y(s, {
234
241
  variant: "caption",
235
242
  className: "ttw:text-muted-foreground",
@@ -431,16 +438,21 @@ function O({ mode: a, counterpartMode: c = "customer", values: l, errors: m, sta
431
438
  ]
432
439
  }), /* @__PURE__ */ b("div", {
433
440
  className: "ttw:flex ttw:flex-col ttw:gap-1.5",
434
- children: [/* @__PURE__ */ y(i, {
435
- htmlFor: `${P}-phone`,
436
- requirement: n.Optional,
437
- labels: M.fieldMarkers,
438
- children: M.phoneLabel
439
- }), /* @__PURE__ */ y(r, {
440
- id: `${P}-phone`,
441
- value: l.phone,
442
- onChange: (e) => _({ phone: e.target.value })
443
- })]
441
+ children: [
442
+ /* @__PURE__ */ y(i, {
443
+ htmlFor: `${P}-phone`,
444
+ requirement: n.Optional,
445
+ labels: M.fieldMarkers,
446
+ children: M.phoneLabel
447
+ }),
448
+ /* @__PURE__ */ y(r, {
449
+ id: `${P}-phone`,
450
+ value: l.phone,
451
+ "aria-invalid": !!m?.phone,
452
+ onChange: (e) => _({ phone: e.target.value })
453
+ }),
454
+ /* @__PURE__ */ y(u, { message: m?.phone })
455
+ ]
444
456
  })]
445
457
  }),
446
458
  N.taxId && /* @__PURE__ */ b("div", {
@@ -455,8 +467,10 @@ function O({ mode: a, counterpartMode: c = "customer", values: l, errors: m, sta
455
467
  /* @__PURE__ */ y(r, {
456
468
  id: `${P}-tax-id`,
457
469
  value: l.taxId,
470
+ "aria-invalid": !!m?.taxId,
458
471
  onChange: (e) => _({ taxId: e.target.value })
459
472
  }),
473
+ /* @__PURE__ */ y(u, { message: m?.taxId }),
460
474
  /* @__PURE__ */ y(s, {
461
475
  variant: "caption",
462
476
  className: "ttw:text-muted-foreground",
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.292", n = "bfe13c51959d8d755cb3a9de98a1be761ced7220", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.294", n = "f6d82ddbcfdfe0dcf1e2b99ca0c84db60c3da088", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -62,8 +62,9 @@ function d({ inputValue: d, onInputValueChange: f, options: p, value: m, onOptio
62
62
  maxLength: x,
63
63
  disabled: _,
64
64
  placeholder: C.placeholder,
65
- className: e("ttw:h-full ttw:min-w-0 ttw:flex-1 ttw:bg-transparent ttw:pr-2 ttw:text-base ttw:outline-none ttw:placeholder:text-muted-foreground ttw:disabled:cursor-not-allowed ttw:md:text-sm", g ? "ttw:pl-2" : "ttw:pl-3"),
65
+ className: e("ttw:h-full ttw:min-w-0 ttw:flex-1 ttw:text-ellipsis ttw:bg-transparent ttw:pr-2 ttw:text-base ttw:outline-none ttw:placeholder:text-muted-foreground ttw:disabled:cursor-not-allowed ttw:md:text-sm", g ? "ttw:pl-2" : "ttw:pl-3"),
66
66
  value: d,
67
+ title: d || void 0,
67
68
  onFocus: () => E(!0),
68
69
  onClick: () => E(!0),
69
70
  onBlur: A,
@@ -87,8 +88,8 @@ function d({ inputValue: d, onInputValueChange: f, options: p, value: m, onOptio
87
88
  ]
88
89
  }), T && !_ ? /* @__PURE__ */ o("div", {
89
90
  role: "presentation",
90
- className: "ttw:absolute ttw:left-0 ttw:top-full ttw:z-50 ttw:mt-1.5 ttw:w-full ttw:min-w-138 ttw:overflow-hidden ttw:rounded-md ttw:bg-popover ttw:text-popover-foreground ttw:shadow-md ttw:ring-1 ttw:ring-foreground/10",
91
- onMouseDown: (e) => e.preventDefault(),
91
+ className: e("ttw:absolute ttw:left-0 ttw:top-full ttw:z-50 ttw:mt-1.5 ttw:w-full ttw:min-w-138 ttw:overflow-hidden ttw:rounded-md ttw:bg-popover ttw:text-popover-foreground ttw:shadow-md ttw:ring-1 ttw:ring-foreground/10", !p.length && "ttw:pointer-events-none"),
92
+ onMouseDown: p.length ? (e) => e.preventDefault() : void 0,
92
93
  children: /* @__PURE__ */ s("ul", {
93
94
  id: w,
94
95
  role: "listbox",
@@ -9380,6 +9380,7 @@ function Gy({ columns: t, data: n, sorting: r, onSortingChange: i, pageSize: a,
9380
9380
  },
9381
9381
  children: [/* @__PURE__ */ _(ky, {
9382
9382
  size: "sm",
9383
+ "aria-label": N.rowsPerPage,
9383
9384
  children: /* @__PURE__ */ _(Oy, {})
9384
9385
  }), /* @__PURE__ */ _(Ay, { children: O.map((e) => /* @__PURE__ */ _(My, {
9385
9386
  value: String(e),
@@ -16621,10 +16622,10 @@ function Nj(e) {
16621
16622
  function Pj(e) {
16622
16623
  return e == null ? [] : Array.isArray(e) ? e : [e];
16623
16624
  }
16624
- function Fj({ value: t, onChange: n, placeholder: r = "Pick a date", disabled: i, minDate: a, maxDate: o, defaultMonth: s, disabledDates: c, className: l, id: u, "aria-invalid": d, "aria-describedby": f, onBlur: p, container: m }) {
16625
- let [h, g] = e.useState(!1), y = (e) => {
16626
- g(e), e || p?.();
16627
- }, b = e.useMemo(() => {
16625
+ function Fj({ value: t, onChange: n, placeholder: r = "Pick a date", disabled: i, minDate: a, maxDate: o, defaultMonth: s, disabledDates: c, className: l, id: u, "aria-invalid": d, "aria-describedby": f, onBlur: p, container: m, iconPosition: h = "start" }) {
16626
+ let [g, y] = e.useState(!1), b = (e) => {
16627
+ y(e), e || p?.();
16628
+ }, x = e.useMemo(() => {
16628
16629
  let e = [
16629
16630
  ...a ? [{ before: a }] : [],
16630
16631
  ...o ? [{ after: o }] : [],
@@ -16637,8 +16638,8 @@ function Fj({ value: t, onChange: n, placeholder: r = "Pick a date", disabled: i
16637
16638
  c
16638
16639
  ]);
16639
16640
  return /* @__PURE__ */ v(ZC, {
16640
- open: h,
16641
- onOpenChange: y,
16641
+ open: g,
16642
+ onOpenChange: b,
16642
16643
  children: [/* @__PURE__ */ _(QC, {
16643
16644
  asChild: !0,
16644
16645
  children: /* @__PURE__ */ v(Tv, {
@@ -16649,10 +16650,14 @@ function Fj({ value: t, onChange: n, placeholder: r = "Pick a date", disabled: i
16649
16650
  "aria-invalid": d,
16650
16651
  "aria-describedby": f,
16651
16652
  onBlur: () => {
16652
- h || p?.();
16653
+ g || p?.();
16653
16654
  },
16654
16655
  className: J("ttw:w-full ttw:justify-start ttw:text-left ttw:font-normal", !t && "ttw:text-muted-foreground", l),
16655
- children: [/* @__PURE__ */ _(I, { className: "ttw:mr-2 ttw:size-4" }), t ? Nj(t) : r]
16656
+ children: [
16657
+ h === "start" && /* @__PURE__ */ _(I, { className: "ttw:mr-2 ttw:size-4" }),
16658
+ t ? Nj(t) : r,
16659
+ h === "end" && /* @__PURE__ */ _(I, { className: "ttw:ml-auto ttw:size-4" })
16660
+ ]
16656
16661
  })
16657
16662
  }), /* @__PURE__ */ _($C, {
16658
16663
  className: "ttw:w-auto ttw:p-0",
@@ -16662,10 +16667,10 @@ function Fj({ value: t, onChange: n, placeholder: r = "Pick a date", disabled: i
16662
16667
  mode: "single",
16663
16668
  selected: t,
16664
16669
  onSelect: (e) => {
16665
- n(e), y(!1);
16670
+ n(e), b(!1);
16666
16671
  },
16667
16672
  captionLayout: "dropdown",
16668
- disabled: b,
16673
+ disabled: x,
16669
16674
  startMonth: a,
16670
16675
  endMonth: o,
16671
16676
  defaultMonth: t ?? s ?? o ?? a
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.292",
3
+ "version": "0.5.294",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [