@tesouro/embedded-components-react 0.7.28 → 0.7.29

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 (34) hide show
  1. package/dist/index.d.ts +1 -12
  2. package/dist/lib/CounterpartsWidget.d.ts +1 -12
  3. package/dist/lib/CounterpartsWidgetPublic.d.ts +1 -12
  4. package/dist/lib/CustomersWidget.d.ts +0 -2
  5. package/dist/lib/ReceivablesWidget.d.ts +0 -2
  6. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +59 -38
  7. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsPanel.js +137 -0
  8. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +86 -182
  9. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsActions.js +116 -0
  10. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +16 -16
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +51 -108
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useRebaseOnRefresh.js +33 -0
  13. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +40 -39
  14. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +2 -65
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +37 -181
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +193 -502
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +520 -0
  19. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +2 -0
  20. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index.js +3 -3
  21. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/data-access/dist/index5.js +31 -55
  22. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
  23. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/helpers.js +98 -163
  24. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/labels.js +1 -3
  25. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/subEntityForms.js +37 -32
  26. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js +86 -93
  27. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index10.js +2 -0
  28. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js +42 -173
  29. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +3 -12
  30. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js +16 -16
  31. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +42 -42
  32. package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +117 -125
  33. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  34. package/package.json +1 -1
@@ -3,31 +3,24 @@
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 ee, validateCounterpartForm as m, withoutUnchangedContactErrors as h } from "./helpers.js";
7
- import { useCreateCounterpartMutation as g, useUpdateCounterpartMutation as _ } from "../../../data-access/dist/index3.js";
6
+ import { addressFormToCreatePayload as t, addressFormToUpdatePayload as n, addressResponseToFormValues as r, bankAccountToAchFormValues as i, counterpartFormBankAccountToCreatePayload as a, counterpartFormBankAccountToUpdatePayload as o, counterpartFormToCreatePayload as s, counterpartFormToUpdatePayload as ee, counterpartToFormValues as c, emptyCounterpartFormValues as l, getAchInstructions as u, hasCounterpartFormAddressValues as d, hasCounterpartFormBankAccountValues as f, hasCounterpartFormErrors as p, resolveCounterpartBankAccountWrite as m, validateCounterpartForm as h, withoutUnchangedContactErrors as g } from "./helpers.js";
7
+ import { useCreateCounterpartMutation as _, useUpdateCounterpartMutation as te } from "../../../data-access/dist/index3.js";
8
8
  import { useCreateCounterpartBankAccountMutation as v, useUpdateCounterpartBankAccountMutation as y } from "../../../data-access/dist/index5.js";
9
- import { useCreateCounterpartAddressMutation as b, useUpdateCounterpartAddressMutation as x } from "../../../data-access/dist/index7.js";
9
+ import { useCreateCounterpartAddressMutation as ne, useUpdateCounterpartAddressMutation as re } from "../../../data-access/dist/index7.js";
10
10
  import "../../../data-access/dist/index.js";
11
- import { useCallback as S, useLayoutEffect as C, useState as w } from "react";
11
+ import { useCallback as b, useLayoutEffect as ie, useState as x } from "react";
12
12
  //#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/lib/useCounterpartForm.js
13
- function te(e, t) {
13
+ function ae(e, t) {
14
14
  if (!t) return d(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 T(e) {
19
- return {
20
- accountHolderName: e.account_holder_name ?? "",
21
- routingNumber: e.routing_number ?? "",
22
- accountNumber: e.account_number ?? ""
23
- };
24
- }
25
- function ne(e, t) {
18
+ function S(e, t) {
26
19
  if (!t) return f(e);
27
- let n = T(t);
20
+ let n = i(t);
28
21
  return e.bankAccount.accountHolderName.trim() !== n.accountHolderName.trim() || e.bankAccount.routingNumber.trim() !== n.routingNumber.trim() || e.bankAccount.accountNumber.trim() !== n.accountNumber.trim();
29
22
  }
30
- function re(e, t) {
23
+ function C(e, t) {
31
24
  let n = { ...e };
32
25
  if ([
33
26
  "legalName",
@@ -52,146 +45,146 @@ function re(e, t) {
52
45
  }
53
46
  return JSON.stringify(n) === JSON.stringify(e) ? e : n;
54
47
  }
55
- 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 }) {
56
- let L = A === "vendor" && I, R = g(), z = b(), B = v(), V = _(), H = x(), U = y(), [W, G] = w(() => l()), [ie, K] = w({}), [ae, q] = w({
48
+ function w({ view: r, setView: w, selectedId: T, setSelectedId: E, messages: D, counterpartType: O, counterpart: k, primaryAddress: A, bankAccounts: j, isBankAccountsLoading: M, isBankAccountsError: N, includeBankAccount: P = !0 }) {
49
+ let F = O === "vendor" && P, I = _(), L = ne(), R = v(), z = te(), B = re(), V = y(), [H, U] = x(() => l()), [W, G] = x({}), [K, q] = x({
57
50
  address: !1,
58
51
  bankAccount: !1
59
- }), [J, Y] = w(), [X, Z] = w(), oe = R.isPending || z.isPending || B.isPending || U.isPending || V.isPending || H.isPending, se = S(() => {
60
- O(void 0), Z(void 0), Y(void 0), q({
61
- address: A === "vendor",
52
+ }), [J, Y] = x(), [X, Z] = x(), oe = I.isPending || L.isPending || R.isPending || V.isPending || z.isPending || B.isPending, se = b(() => {
53
+ E(void 0), Z(void 0), Y(void 0), q({
54
+ address: O === "vendor",
62
55
  bankAccount: !1
63
- }), G(l("organization", A)), K({}), E("create");
56
+ }), U(l("organization", O)), G({}), w("create");
64
57
  }, [
65
- A,
66
58
  O,
67
- E
68
- ]), ce = S(() => {
69
- if (!j || L && (P || F)) return;
70
- let e = L ? u(N) : void 0, t = c(j, M);
59
+ E,
60
+ w
61
+ ]), ce = b(() => {
62
+ if (!k || F && (M || N)) return;
63
+ let e = F ? u(j) : void 0, t = c(k, A);
71
64
  Z(void 0), Y(e?.id), q({
72
65
  address: d(t),
73
66
  bankAccount: !1
74
- }), G({
67
+ }), U({
75
68
  ...t,
76
- ...e ? { bankAccount: T(e) } : {}
77
- }), K({}), E("edit");
69
+ ...e ? { bankAccount: i(e) } : {}
70
+ }), G({}), w("edit");
78
71
  }, [
79
- N,
80
72
  j,
81
- F,
82
- P,
73
+ k,
74
+ N,
83
75
  M,
84
- E,
85
- L
86
- ]), le = S(() => {
87
- E("none");
88
- }, [E]), ue = S(() => {
76
+ A,
77
+ w,
78
+ F
79
+ ]), le = b(() => {
80
+ w("none");
81
+ }, [w]), ue = b(() => {
89
82
  q((e) => ({
90
83
  ...e,
91
84
  address: !0
92
85
  }));
93
- }, []), [Q, $] = w(!1), de = S(() => $(!0), []);
94
- return C(() => {
95
- let e = r === "edit" ? "edit" : "create", t = m(W, e, k, A, e === "edit" && L && !!J);
86
+ }, []), [Q, $] = x(!1), de = b(() => $(!0), []);
87
+ return ie(() => {
88
+ let e = r === "edit" ? "edit" : "create", t = h(H, e, D, O, e === "edit" && F && !!J);
96
89
  if (Q) {
97
- $(!1), K(t);
90
+ $(!1), G(t);
98
91
  return;
99
92
  }
100
- K((e) => p(e) ? re(e, t) : e);
93
+ G((e) => p(e) ? C(e, t) : e);
101
94
  }, [
102
95
  J,
103
- A,
96
+ O,
104
97
  Q,
105
- k,
106
- W,
98
+ D,
99
+ H,
107
100
  r,
108
- L
101
+ F
109
102
  ]), {
110
- values: W,
111
- errors: ie,
112
- setValues: G,
103
+ values: H,
104
+ errors: W,
105
+ setValues: U,
113
106
  isSubmitting: oe,
114
- sectionsToExpand: ae,
107
+ sectionsToExpand: K,
115
108
  expandAddress: ue,
116
109
  openCreate: se,
117
110
  openEdit: ce,
118
111
  close: le,
119
- submit: S(async () => {
120
- let l = r === "edit" ? "edit" : "create", g = h(m(W, l, k, A, l === "edit" && L && !!J), W, l === "edit" && j ? c(j, M) : void 0);
121
- if (p(g)) return K(g), q((e) => ({
122
- address: e.address || !!g.address,
123
- bankAccount: e.bankAccount || !!g.bankAccount
112
+ submit: b(async () => {
113
+ let i = r === "edit" ? "edit" : "create", l = g(h(H, i, D, O, i === "edit" && F && !!J), H, i === "edit" && k ? c(k, A) : void 0);
114
+ if (p(l)) return G(l), q((e) => ({
115
+ address: e.address || !!l.address,
116
+ bankAccount: e.bankAccount || !!l.bankAccount
124
117
  })), { ok: !1 };
125
- K({}), q({
118
+ G({}), q({
126
119
  address: !1,
127
120
  bankAccount: !1
128
121
  });
129
122
  let _ = X;
130
123
  try {
131
- if (r === "edit" && D) {
132
- Z(void 0), await V.mutateAsync({
133
- path: { counterpart_id: D },
134
- body: s(W, A)
124
+ if (r === "edit" && T) {
125
+ Z(void 0), await z.mutateAsync({
126
+ path: { counterpart_id: T },
127
+ body: ee(H, O)
135
128
  });
136
- let e = M ? te(W, M) ? H.mutateAsync({
129
+ let e = A ? ae(H, A) ? B.mutateAsync({
137
130
  path: {
138
- counterpart_id: D,
139
- address_id: M.id
131
+ counterpart_id: T,
132
+ address_id: A.id
140
133
  },
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 && ne(W, u(N)) ? ee(N, J) : void 0, o = r?.kind === "update" ? U.mutateAsync({
134
+ body: n(H.address)
135
+ }) : void 0 : d(H) ? L.mutateAsync({
136
+ path: { counterpart_id: T },
137
+ body: t(H.address)
138
+ }) : void 0, r = F && S(H, u(j)) ? m(j, J) : void 0, i = r?.kind === "update" ? V.mutateAsync({
146
139
  path: {
147
- counterpart_id: D,
140
+ counterpart_id: T,
148
141
  bank_account_id: r.bankAccountId
149
142
  },
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" && Y(l.value?.id), c.status === "rejected") throw c.reason;
156
- if (l.status === "rejected") throw l.reason;
157
- return E("none"), {
143
+ body: o(H.bankAccount, { includeAchDefaults: r.includeAchDefaults })
144
+ }) : r?.kind === "create" ? R.mutateAsync({
145
+ path: { counterpart_id: T },
146
+ body: a(H.bankAccount, { isDefaultForCurrency: r.isDefaultForCurrency })
147
+ }) : void 0, [s, c] = await Promise.allSettled([e, i]);
148
+ if (r?.kind === "create" && c.status === "fulfilled" && Y(c.value?.id), s.status === "rejected") throw s.reason;
149
+ if (c.status === "rejected") throw c.reason;
150
+ return w("none"), {
158
151
  ok: !0,
159
- counterpartId: D
152
+ counterpartId: T
160
153
  };
161
154
  }
162
- return _ ||= (await R.mutateAsync({ body: o(W, A) }))?.id, _ && L && f(W) && (Z(_), await B.mutateAsync({
155
+ return _ ||= (await I.mutateAsync({ body: s(H, O) }))?.id, _ && F && f(H) && (Z(_), await R.mutateAsync({
163
156
  path: { counterpart_id: _ },
164
- body: i(W.bankAccount)
165
- })), Z(void 0), E("none"), _ && O(_), {
157
+ body: a(H.bankAccount)
158
+ })), Z(void 0), w("none"), _ && E(_), {
166
159
  ok: !0,
167
160
  counterpartId: _
168
161
  };
169
162
  } catch (t) {
170
- return _ && (Z(_), O(_)), K({ form: e(t) ?? k.genericError }), { ok: !1 };
163
+ return _ && (Z(_), E(_)), G({ form: e(t) ?? D.genericError }), { ok: !1 };
171
164
  }
172
165
  }, [
173
166
  r,
174
- W,
175
- D,
167
+ H,
168
+ T,
176
169
  X,
170
+ D,
171
+ O,
177
172
  k,
178
173
  A,
179
174
  j,
180
- M,
181
- N,
182
175
  J,
183
- z,
184
- B,
176
+ L,
185
177
  R,
186
- H,
187
- U,
178
+ I,
179
+ B,
188
180
  V,
181
+ z,
182
+ w,
189
183
  E,
190
- O,
191
- L
184
+ F
192
185
  ]),
193
186
  revealErrors: de
194
187
  };
195
188
  }
196
189
  //#endregion
197
- export { E as useCounterpartForm };
190
+ export { w as useCounterpartForm };
@@ -339,6 +339,7 @@ function A({ mode: a, counterpartMode: c = "customer", values: u, errors: m, sta
339
339
  }),
340
340
  /* @__PURE__ */ x(r, {
341
341
  id: `${F}-legal-name`,
342
+ autoFocus: !0,
342
343
  value: u.legalName,
343
344
  "aria-required": !0,
344
345
  "aria-invalid": !!m?.legalName,
@@ -359,6 +360,7 @@ function A({ mode: a, counterpartMode: c = "customer", values: u, errors: m, sta
359
360
  }),
360
361
  /* @__PURE__ */ x(r, {
361
362
  id: `${F}-first-name`,
363
+ autoFocus: !0,
362
364
  value: u.firstName,
363
365
  "aria-required": !0,
364
366
  "aria-invalid": !!m?.firstName,
@@ -1,179 +1,48 @@
1
- import { Checkbox as e, FieldRequirement as t, Input as n, Label as r, Select as i, SelectContent as a, SelectItem as o, SelectTrigger as s, SelectValue as c } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { BANK_ACCOUNT_FORM_SHEET_LABELS_EN as l } from "./index2.js";
3
- import { FieldError as u } from "./index4.js";
4
- import { FormSheet as d } from "./index9.js";
5
- import { useId as f } from "react";
6
- import { jsx as p, jsxs as m } from "react/jsx-runtime";
1
+ import { Typography as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { BANK_ACCOUNT_FORM_SHEET_LABELS_EN as t } from "./index2.js";
3
+ import { AchFieldGroup as n } from "./index5.js";
4
+ import { FormSheet as r } from "./index9.js";
5
+ import { useId as i } from "react";
6
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
7
7
  //#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index12.js
8
- function h({ open: h, onOpenChange: g, mode: _, values: v, errors: y, currencyOptions: b, inProgress: x, onChange: S, onSubmit: C, onCancel: w, labels: T }) {
9
- let E = {
10
- ...l,
11
- ...T,
8
+ function s({ open: s, onOpenChange: c, mode: l, values: u, errors: d, highlightedFields: f, inProgress: p, submitDisabled: m, onChange: h, onSubmit: g, onCancel: _, labels: v }) {
9
+ let y = {
10
+ ...t,
11
+ ...v,
12
12
  fieldMarkers: {
13
- ...l.fieldMarkers,
14
- ...T?.fieldMarkers
13
+ ...t.fieldMarkers,
14
+ ...v?.fieldMarkers
15
15
  }
16
- }, D = f(), O = _ === "edit" ? E.editTitle : E.createTitle;
17
- return /* @__PURE__ */ m(d, {
18
- open: h,
19
- onOpenChange: g,
20
- title: O,
21
- formError: y?.form,
22
- inProgress: x,
23
- submitLabel: _ === "edit" ? E.saveButton : E.createButton,
24
- cancelLabel: E.cancelButton,
25
- onSubmit: C,
26
- onCancel: w,
27
- children: [
28
- /* @__PURE__ */ m("div", {
29
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
30
- children: [
31
- /* @__PURE__ */ p(r, {
32
- htmlFor: `${D}-name`,
33
- requirement: t.Optional,
34
- labels: E.fieldMarkers,
35
- children: E.nameLabel
36
- }),
37
- /* @__PURE__ */ p(n, {
38
- id: `${D}-name`,
39
- autoFocus: !0,
40
- value: v.name,
41
- "aria-invalid": !!y?.name,
42
- onChange: (e) => S({ name: e.target.value })
43
- }),
44
- /* @__PURE__ */ p(u, { message: y?.name })
45
- ]
46
- }),
47
- /* @__PURE__ */ m("div", {
48
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
49
- children: [/* @__PURE__ */ p(r, {
50
- htmlFor: `${D}-holder`,
51
- children: E.accountHolderNameLabel
52
- }), /* @__PURE__ */ p(n, {
53
- id: `${D}-holder`,
54
- value: v.accountHolderName,
55
- onChange: (e) => S({ accountHolderName: e.target.value })
56
- })]
57
- }),
58
- /* @__PURE__ */ m("div", {
59
- className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
60
- children: [/* @__PURE__ */ m("div", {
61
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
62
- children: [
63
- /* @__PURE__ */ p(r, {
64
- htmlFor: `${D}-account-number`,
65
- children: E.accountNumberLabel
66
- }),
67
- /* @__PURE__ */ p(n, {
68
- id: `${D}-account-number`,
69
- value: v.accountNumber,
70
- "aria-invalid": !!y?.accountNumber,
71
- onChange: (e) => S({ accountNumber: e.target.value })
72
- }),
73
- /* @__PURE__ */ p(u, { message: y?.accountNumber })
74
- ]
75
- }), /* @__PURE__ */ m("div", {
76
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
77
- children: [
78
- /* @__PURE__ */ p(r, {
79
- htmlFor: `${D}-routing`,
80
- children: E.routingNumberLabel
81
- }),
82
- /* @__PURE__ */ p(n, {
83
- id: `${D}-routing`,
84
- value: v.routingNumber,
85
- "aria-invalid": !!y?.routingNumber,
86
- onChange: (e) => S({ routingNumber: e.target.value })
87
- }),
88
- /* @__PURE__ */ p(u, { message: y?.routingNumber })
89
- ]
90
- })]
91
- }),
92
- /* @__PURE__ */ m("div", {
93
- className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
94
- children: [/* @__PURE__ */ m("div", {
95
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
96
- children: [/* @__PURE__ */ p(r, {
97
- htmlFor: `${D}-iban`,
98
- children: E.ibanLabel
99
- }), /* @__PURE__ */ p(n, {
100
- id: `${D}-iban`,
101
- value: v.iban,
102
- onChange: (e) => S({ iban: e.target.value })
103
- })]
104
- }), /* @__PURE__ */ m("div", {
105
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
106
- children: [/* @__PURE__ */ p(r, {
107
- htmlFor: `${D}-bic`,
108
- children: E.bicLabel
109
- }), /* @__PURE__ */ p(n, {
110
- id: `${D}-bic`,
111
- value: v.bic,
112
- onChange: (e) => S({ bic: e.target.value })
113
- })]
114
- })]
115
- }),
116
- /* @__PURE__ */ m("div", {
117
- className: "ttw:grid ttw:grid-cols-2 ttw:gap-4",
118
- children: [/* @__PURE__ */ m("div", {
119
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
120
- children: [/* @__PURE__ */ p(r, {
121
- htmlFor: `${D}-sort-code`,
122
- children: E.sortCodeLabel
123
- }), /* @__PURE__ */ p(n, {
124
- id: `${D}-sort-code`,
125
- value: v.sortCode,
126
- onChange: (e) => S({ sortCode: e.target.value })
127
- })]
128
- }), /* @__PURE__ */ m("div", {
129
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
130
- children: [
131
- /* @__PURE__ */ p(r, {
132
- htmlFor: `${D}-currency`,
133
- children: E.currencyLabel
134
- }),
135
- /* @__PURE__ */ m(i, {
136
- value: v.currency === "" ? void 0 : v.currency,
137
- onValueChange: (e) => S({ currency: e }),
138
- children: [/* @__PURE__ */ p(s, {
139
- id: `${D}-currency`,
140
- className: "ttw:w-full",
141
- "aria-invalid": !!y?.currency,
142
- children: /* @__PURE__ */ p(c, { placeholder: E.currencyPlaceholder })
143
- }), /* @__PURE__ */ p(a, { children: b.map((e) => /* @__PURE__ */ p(o, {
144
- value: e.value,
145
- children: e.label
146
- }, e.value)) })]
147
- }),
148
- /* @__PURE__ */ p(u, { message: y?.currency })
149
- ]
150
- })]
151
- }),
152
- /* @__PURE__ */ m("div", {
153
- className: "ttw:flex ttw:flex-col ttw:gap-1.5",
154
- children: [/* @__PURE__ */ p(r, {
155
- htmlFor: `${D}-country`,
156
- children: E.countryLabel
157
- }), /* @__PURE__ */ p(n, {
158
- id: `${D}-country`,
159
- value: E.countryValue,
160
- disabled: !0,
161
- readOnly: !0
162
- })]
163
- }),
164
- /* @__PURE__ */ m("div", {
165
- className: "ttw:flex ttw:items-center ttw:gap-2",
166
- children: [/* @__PURE__ */ p(e, {
167
- id: `${D}-default`,
168
- checked: v.isDefault,
169
- onCheckedChange: (e) => S({ isDefault: e === !0 })
170
- }), /* @__PURE__ */ p(r, {
171
- htmlFor: `${D}-default`,
172
- children: E.isDefaultLabel
173
- })]
174
- })
175
- ]
16
+ }, b = i();
17
+ return /* @__PURE__ */ o(r, {
18
+ open: s,
19
+ onOpenChange: c,
20
+ title: l === "edit" ? y.editTitle : y.createTitle,
21
+ formError: d?.form,
22
+ inProgress: p,
23
+ submitDisabled: m,
24
+ submitLabel: y.saveButton,
25
+ cancelLabel: y.cancelButton,
26
+ onSubmit: g,
27
+ onCancel: _,
28
+ children: [/* @__PURE__ */ a(n, {
29
+ idPrefix: b,
30
+ values: u,
31
+ errors: d,
32
+ highlighted: f,
33
+ onChange: h,
34
+ labels: {
35
+ accountHolderName: y.accountHolderNameLabel,
36
+ routingNumber: y.routingNumberLabel,
37
+ accountNumber: y.accountNumberLabel,
38
+ fieldMarkers: y.fieldMarkers
39
+ }
40
+ }), /* @__PURE__ */ a(e, {
41
+ variant: "body2",
42
+ color: "muted",
43
+ children: y.helperText
44
+ })]
176
45
  });
177
46
  }
178
47
  //#endregion
179
- export { h as BankAccountFormSheet, h as default };
48
+ export { s as BankAccountFormSheet, s as default };
@@ -75,22 +75,13 @@ var n = {
75
75
  fieldMarkers: e,
76
76
  requiredFieldsLegend: t
77
77
  }, o = {
78
- createTitle: "Add bank account",
79
- editTitle: "Edit bank account",
80
- nameLabel: "Account name",
78
+ createTitle: "Adding ACH bank transfer",
79
+ editTitle: "Editing ACH bank transfer",
81
80
  accountHolderNameLabel: "Account holder name",
82
81
  accountNumberLabel: "Account number",
83
82
  routingNumberLabel: "Routing number",
84
- ibanLabel: "IBAN",
85
- bicLabel: "BIC / SWIFT",
86
- sortCodeLabel: "Sort code",
87
- currencyLabel: "Currency",
88
- currencyPlaceholder: "Select a currency",
89
- countryLabel: "Country",
90
- countryValue: "United States",
91
- isDefaultLabel: "Set as default for this currency",
83
+ helperText: "Ask your vendor for this — it's usually on their invoice, W-9, or a payment instructions email they send you.",
92
84
  cancelButton: "Cancel",
93
- createButton: "Add",
94
85
  saveButton: "Save",
95
86
  fieldMarkers: e
96
87
  }, s = {
@@ -3,13 +3,13 @@ import { ACH_FIELD_GROUP_LABELS_EN as r } from "./index2.js";
3
3
  import { FieldError as i } from "./index4.js";
4
4
  import { jsx as a, jsxs as o } from "react/jsx-runtime";
5
5
  //#region ../../libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index5.js
6
- function s({ idPrefix: s, values: c, errors: l, onChange: u, labels: d }) {
7
- let f = {
6
+ function s({ idPrefix: s, values: c, errors: l, highlighted: u, onChange: d, labels: f }) {
7
+ let p = {
8
8
  ...r,
9
- ...d,
9
+ ...f,
10
10
  fieldMarkers: {
11
11
  ...r.fieldMarkers,
12
- ...d?.fieldMarkers
12
+ ...f?.fieldMarkers
13
13
  }
14
14
  };
15
15
  return /* @__PURE__ */ o("div", {
@@ -20,15 +20,15 @@ function s({ idPrefix: s, values: c, errors: l, onChange: u, labels: d }) {
20
20
  /* @__PURE__ */ a(n, {
21
21
  htmlFor: `${s}-account-holder`,
22
22
  requirement: e.Required,
23
- labels: f.fieldMarkers,
24
- children: f.accountHolderName
23
+ labels: p.fieldMarkers,
24
+ children: p.accountHolderName
25
25
  }),
26
26
  /* @__PURE__ */ a(t, {
27
27
  id: `${s}-account-holder`,
28
28
  value: c.accountHolderName,
29
29
  "aria-required": !0,
30
- "aria-invalid": !!l?.accountHolderName,
31
- onChange: (e) => u({ accountHolderName: e.target.value })
30
+ "aria-invalid": !!(l?.accountHolderName || u?.accountHolderName),
31
+ onChange: (e) => d({ accountHolderName: e.target.value })
32
32
  }),
33
33
  /* @__PURE__ */ a(i, { message: l?.accountHolderName })
34
34
  ]
@@ -40,15 +40,15 @@ function s({ idPrefix: s, values: c, errors: l, onChange: u, labels: d }) {
40
40
  /* @__PURE__ */ a(n, {
41
41
  htmlFor: `${s}-routing-number`,
42
42
  requirement: e.Required,
43
- labels: f.fieldMarkers,
44
- children: f.routingNumber
43
+ labels: p.fieldMarkers,
44
+ children: p.routingNumber
45
45
  }),
46
46
  /* @__PURE__ */ a(t, {
47
47
  id: `${s}-routing-number`,
48
48
  value: c.routingNumber,
49
49
  "aria-required": !0,
50
- "aria-invalid": !!l?.routingNumber,
51
- onChange: (e) => u({ routingNumber: e.target.value })
50
+ "aria-invalid": !!(l?.routingNumber || u?.routingNumber),
51
+ onChange: (e) => d({ routingNumber: e.target.value })
52
52
  }),
53
53
  /* @__PURE__ */ a(i, { message: l?.routingNumber })
54
54
  ]
@@ -58,15 +58,15 @@ function s({ idPrefix: s, values: c, errors: l, onChange: u, labels: d }) {
58
58
  /* @__PURE__ */ a(n, {
59
59
  htmlFor: `${s}-account-number`,
60
60
  requirement: e.Required,
61
- labels: f.fieldMarkers,
62
- children: f.accountNumber
61
+ labels: p.fieldMarkers,
62
+ children: p.accountNumber
63
63
  }),
64
64
  /* @__PURE__ */ a(t, {
65
65
  id: `${s}-account-number`,
66
66
  value: c.accountNumber,
67
67
  "aria-required": !0,
68
- "aria-invalid": !!l?.accountNumber,
69
- onChange: (e) => u({ accountNumber: e.target.value })
68
+ "aria-invalid": !!(l?.accountNumber || u?.accountNumber),
69
+ onChange: (e) => d({ accountNumber: e.target.value })
70
70
  }),
71
71
  /* @__PURE__ */ a(i, { message: l?.accountNumber })
72
72
  ]