@tesouro/embedded-components-react 0.7.16 → 0.7.18

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 (46) hide show
  1. package/README.md +14 -14
  2. package/dist/index.css +9 -12
  3. package/dist/index.d.ts +70 -19
  4. package/dist/lib/CounterpartsWidget.d.ts +49 -6
  5. package/dist/lib/CounterpartsWidgetPublic.d.ts +49 -6
  6. package/dist/lib/CustomersWidget.d.ts +49 -6
  7. package/dist/lib/LinkedAccountsWidget.d.ts +20 -12
  8. package/dist/lib/WidgetSuite.d.ts +20 -12
  9. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/data-access/dist/index3.js +2 -1
  10. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartDetailsContainer.js +18 -13
  11. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/CounterpartsWidget.js +146 -137
  12. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartDetailsSheetView.js +56 -55
  13. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/useCounterpartsWidget.js +108 -77
  14. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/feature/dist/lib/CounterpartsWidget/viewModels.js +181 -25
  15. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index.js +1 -1
  16. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index2.js +50 -7
  17. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index4.js +127 -596
  18. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index5.js +66 -0
  19. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index6.js +210 -0
  20. package/dist/libs/tesouro-embedded-components-react/counterparts-widget/ui/dist/index7.js +520 -0
  21. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/ReceivablesWidget.js +2 -1
  22. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useInvoicesFilter.js +10 -7
  23. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivableActionsModal.js +1 -1
  24. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesTable.js +1 -0
  25. package/dist/libs/tesouro-embedded-components-react/invoicing-widget/feature/dist/lib/ReceivablesWidget/useReceivablesWidget.js +141 -125
  26. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/forms.js +2 -1
  27. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/labels.js +11 -1
  28. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/summary.js +22 -0
  29. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +182 -162
  30. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/mocks/linkedAccounts.js +1 -0
  31. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index10.js +36 -86
  32. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index11.js +1 -1
  33. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index12.js +17 -23
  34. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index14.js +6 -6
  35. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index15.js +14 -17
  36. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index16.js +3 -6
  37. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index5.js +168 -35
  38. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index6.js +70 -83
  39. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index7.js +11 -112
  40. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index8.js +6 -12
  41. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index9.js +82 -7
  42. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/feature/dist/index.js +11 -11
  43. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index.js +7 -7
  44. package/dist/libs/tesouro-embedded-components-react/shared/counterpart-management/ui/dist/index2.js +1 -8
  45. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  46. package/package.json +1 -1
@@ -3,12 +3,11 @@
3
3
  "use client";
4
4
  "use client";
5
5
  import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { getInitials as t } from "../../../../shared/util/dist/lib/getInitials.js";
7
- import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as n, emitWidgetDomEvent as r } from "../../../../shared/util/dist/lib/widgetDomEvents.js";
6
+ import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as t, emitWidgetDomEvent as n } from "../../../../shared/util/dist/lib/widgetDomEvents.js";
8
7
  import { extractApiErrorMessage as ee } from "../../../../shared/util/dist/lib/apiErrors.js";
9
8
  import { OrganizationStatus as te, isOrganizationOnItsWay as ne } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
10
9
  import { useEmbedApi as re } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
11
- import { Scope as i } from "../../../../shared/data-access/dist/lib/scopes.js";
10
+ import { Scope as r } from "../../../../shared/data-access/dist/lib/scopes.js";
12
11
  import { useAllOrganizationRolesQuery as ie } from "../../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
13
12
  import { useAllOrganizationUsersQuery as ae } from "../../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
14
13
  import "../../../../shared/data-access/dist/index.js";
@@ -19,30 +18,31 @@ import "../../../../shared/feature/dist/index.js";
19
18
  import { filterRolesForOrganization as ue } from "../../../../../shared/util-validation/dist/index6.js";
20
19
  import { filterUsersForOrganization as de } from "../../../../../shared/util-validation/dist/index7.js";
21
20
  import { DEFAULT_FEATURE_LABELS as fe } from "./labels.js";
22
- import { LinkedAccountsWidgetAnalyticsEvent as a } from "./analytics/events.js";
23
- import { EMPTY_CONNECT_FORM as o, EMPTY_EDIT_FORM as pe, EMPTY_VERIFY_FORM as me, isConnectStep1Valid as he, isRoutingNumberValid as ge, isVerifyAmountInRange as _e, isVerifyFormValid as ve, parseVerifyAmountToMinorUnits as ye, sanitizeRoutingNumberInput as be, toEditForm as xe, toUpdateBody as Se } from "./forms.js";
21
+ import { LinkedAccountsWidgetAnalyticsEvent as i } from "./analytics/events.js";
22
+ import { EMPTY_CONNECT_FORM as pe, EMPTY_EDIT_FORM as me, EMPTY_VERIFY_FORM as he, isConnectStep1Valid as ge, isRoutingNumberValid as _e, isVerifyAmountInRange as ve, isVerifyFormValid as ye, parseVerifyAmountToMinorUnits as a, sanitizeRoutingNumberInput as be, toEditForm as xe, toUpdateBody as Se } from "./forms.js";
24
23
  import { getLinkedAccountsPermissions as Ce } from "./permissions.js";
25
24
  import { toAccountRows as we } from "./rows.js";
26
- import { useConnectExternalBankAccountMutation as Te } from "../../../data-access/dist/index3.js";
27
- import { useExternalBankAccountsQuery as Ee } from "../../../data-access/dist/index4.js";
28
- import { useGrantExternalBankAccountAccessMutation as De } from "../../../data-access/dist/index5.js";
29
- import { useLinkExternalBankAccountMutation as Oe } from "../../../data-access/dist/index6.js";
30
- import { useUnlinkExternalBankAccountMutation as ke } from "../../../data-access/dist/index9.js";
31
- import { useUpdateExternalBankAccountMutation as Ae } from "../../../data-access/dist/index10.js";
32
- import { useValidateExternalBankAccountMutation as je } from "../../../data-access/dist/index11.js";
25
+ import { fromApiAccountHolderType as Te, toApiAccountHolderType as Ee, toSummaryTypeLabel as De, toTextParts as o } from "./summary.js";
26
+ import { useConnectExternalBankAccountMutation as Oe } from "../../../data-access/dist/index3.js";
27
+ import { useExternalBankAccountsQuery as ke } from "../../../data-access/dist/index4.js";
28
+ import { useGrantExternalBankAccountAccessMutation as Ae } from "../../../data-access/dist/index5.js";
29
+ import { useLinkExternalBankAccountMutation as je } from "../../../data-access/dist/index6.js";
30
+ import { useUnlinkExternalBankAccountMutation as Me } from "../../../data-access/dist/index9.js";
31
+ import { useUpdateExternalBankAccountMutation as Ne } from "../../../data-access/dist/index10.js";
32
+ import { useValidateExternalBankAccountMutation as Pe } from "../../../data-access/dist/index11.js";
33
33
  import "../../../data-access/dist/index.js";
34
- import { useAdminEligibleUserIds as Me } from "./useAdminEligibleUserIds.js";
35
- import { toAccessRows as Ne, toOrganizationRoleOptions as Pe, toTeamMembers as Fe } from "./teamMembers.js";
36
- import { DEFAULT_LABELS as Ie } from "../../../ui/dist/index15.js";
34
+ import { useAdminEligibleUserIds as Fe } from "./useAdminEligibleUserIds.js";
35
+ import { toAccessRows as Ie, toOrganizationRoleOptions as Le, toTeamMembers as Re } from "./teamMembers.js";
36
+ import { DEFAULT_LABELS as ze } from "../../../ui/dist/index15.js";
37
37
  import "../../../ui/dist/index.js";
38
- import { useCallback as Le, useEffect as Re, useMemo as s, useState as c } from "react";
38
+ import { useCallback as Be, useEffect as Ve, useMemo as s, useState as c } from "react";
39
39
  //#region ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js
40
- function ze(e) {
40
+ function He(e) {
41
41
  let t = e;
42
42
  return typeof e == "object" && !!e && "verificationStatus" in e && t.verificationStatus === "VERIFIED";
43
43
  }
44
44
  var l = "tesouro.linkedAccounts.locallySentMicroDepositAccountIds.v1";
45
- function Be() {
45
+ function Ue() {
46
46
  if (typeof window > "u") return /* @__PURE__ */ new Set();
47
47
  try {
48
48
  let e = window.sessionStorage.getItem(l), t = e ? JSON.parse(e) : [];
@@ -63,42 +63,42 @@ function f(e, t) {
63
63
  let n = new Set(e).add(t);
64
64
  return d(n), n;
65
65
  }
66
- var Ve = i.ExternalBankAccountWriteOrg;
67
- function p({ labels: i, featureLabels: l }) {
66
+ var We = r.ExternalBankAccountWriteOrg;
67
+ function p({ labels: r, featureLabels: l }) {
68
68
  let u = {
69
- ...Ie,
70
- ...i
69
+ ...ze,
70
+ ...r
71
71
  }, d = {
72
72
  ...fe,
73
73
  ...l
74
- }, p = oe(), { organizationId: m, widgetToken: h, initResponse: g } = se(), He = le(), { organizationStatus: _ } = re(), Ue = ne(_), v = !!ce(), y = !!(m && h), We = y || !!h && _ === te.Rotating, b = s(() => Ce(g?.scopes), [g?.scopes]), x = We && b.canRead && !!g, [S, C] = c(), [w, Ge] = c(!1), [T, E] = c(1), [D, O] = c([]), [k, A] = c(), [Ke, j] = c(), [qe, Je] = c(Be), [Ye, M] = c(!1), [Xe, Ze] = c(!1), [Qe, N] = c(!1), [$e, P] = c(!1), [F, I] = c(), [L, et] = c(o), [tt, nt] = c(pe), [R, rt] = c(me);
75
- Re(() => {
76
- p(a.Mounted);
74
+ }, p = oe(), { organizationId: m, widgetToken: Ge, initResponse: h } = se(), Ke = le(), { organizationStatus: qe } = re(), Je = ne(qe), Ye = !!ce(), g = !!(m && Ge), Xe = g || !!Ge && qe === te.Rotating, _ = s(() => Ce(h?.scopes), [h?.scopes]), v = Xe && _.canRead && !!h, [y, b] = c(), [x, Ze] = c(!1), [S, C] = c(1), [w, Qe] = c([]), [T, $e] = c(), [et, E] = c(), [D, tt] = c(Ue), [nt, O] = c(!1), [rt, it] = c(!1), [at, k] = c(!1), [ot, A] = c(!1), [j, M] = c(), [N, P] = c(pe), [F, I] = c(me), [L, R] = c(he);
75
+ Ve(() => {
76
+ p(i.Mounted);
77
77
  }, [p]);
78
- let z = Ee({
78
+ let z = ke({
79
79
  limit: 100,
80
- enabled: x
81
- }), B = Te(), V = De(), H = Ae(), U = ke(), W = Oe(), G = je(), K = w && T >= 2, q = ae({ enabled: K }), J = ie({ enabled: K }), { userIds: it, isResolving: at, isError: ot } = Me({
80
+ enabled: v
81
+ }), B = Oe(), V = Ae(), H = Ne(), U = Me(), W = je(), G = Pe(), K = x && S >= 2, q = ae({ enabled: K }), J = ie({ enabled: K }), { userIds: st, isResolving: ct, isError: lt } = Fe({
82
82
  enabled: K,
83
- permissionKey: Ve,
83
+ permissionKey: We,
84
84
  organizationId: m
85
85
  }), Y = s(() => {
86
86
  let e = J.data?.data ?? [], t = m ? ue(e, {
87
87
  organizationId: m,
88
- organizationTypes: g?.organizationTypes ?? []
88
+ organizationTypes: h?.organizationTypes ?? []
89
89
  }) : e, n = de(q.data?.data ?? [], m);
90
- return Fe(n, Pe(t), it);
90
+ return Re(n, Le(t), st);
91
91
  }, [
92
- it,
92
+ st,
93
93
  J.data?.data,
94
94
  q.data?.data,
95
95
  m,
96
- g?.organizationTypes
97
- ]), st = q.isLoading || q.isFetchingNextPage || !!q.hasNextPage || J.isResolving || at, ct = !st && !q.isError && !ot, X = x ? z.data?.data ?? [] : [], Z = s(() => X.map((e) => e.verificationStatus === "UNVERIFIED" && qe.has(e.id) ? {
96
+ h?.organizationTypes
97
+ ]), ut = q.isLoading || q.isFetchingNextPage || !!q.hasNextPage || J.isResolving || ct, dt = !ut && !q.isError && !lt, X = v ? z.data?.data ?? [] : [], Z = s(() => X.map((e) => e.verificationStatus === "UNVERIFIED" && D.has(e.id) ? {
98
98
  ...e,
99
99
  verificationStatus: "VERIFICATION_SENT"
100
- } : e), [X, qe]), lt = [.../* @__PURE__ */ new Set([...Y.filter((e) => e.locked).map((e) => e.id), ...D])], ut = Le((e) => {
101
- B.reset(), V.reset(), W.reset(), et({
100
+ } : e), [X, D]), ft = [.../* @__PURE__ */ new Set([...Y.filter((e) => e.locked).map((e) => e.id), ...w])], pt = Be((e) => {
101
+ B.reset(), V.reset(), W.reset(), P({
102
102
  ...e,
103
103
  routingNumber: be(e.routingNumber)
104
104
  });
@@ -106,122 +106,142 @@ function p({ labels: i, featureLabels: l }) {
106
106
  B,
107
107
  V,
108
108
  W
109
- ]), dt = () => {
110
- E(3), r(n);
111
- }, ft = (e) => {
112
- if (!b.canMicroDeposit) {
113
- dt();
109
+ ]), mt = () => {
110
+ C(3), n(t);
111
+ }, ht = (e) => {
112
+ if (!_.canMicroDeposit) {
113
+ mt();
114
114
  return;
115
115
  }
116
- j("connect"), W.mutate({ path: { id: e } }, { onSuccess: () => {
117
- j(void 0), Je((t) => f(t, e)), p(a.AccountLinked, { accountId: e }), dt();
116
+ E("connect"), W.mutate({ path: { id: e } }, { onSuccess: () => {
117
+ E(void 0), tt((t) => f(t, e)), p(i.AccountLinked, { accountId: e }), mt();
118
118
  } });
119
- }, pt = (e) => {
119
+ }, Q = (e) => {
120
120
  V.mutate({
121
121
  path: { id: e },
122
- body: { userIds: lt }
123
- }, { onSuccess: () => ft(e) });
124
- }, mt = () => {
125
- if (y && b.canWrite) {
126
- if (T === 1) {
127
- if (!he(L)) return;
128
- E(2);
122
+ body: { userIds: ft }
123
+ }, { onSuccess: () => ht(e) });
124
+ }, gt = () => {
125
+ if (g && _.canWrite) {
126
+ if (S === 1) {
127
+ if (!ge(N)) return;
128
+ C(2);
129
129
  return;
130
130
  }
131
- if (T === 2 && ct) {
132
- if (k) {
133
- pt(k.id);
131
+ if (S === 2 && dt) {
132
+ if (T) {
133
+ Q(T.id);
134
134
  return;
135
135
  }
136
136
  B.mutate({ body: {
137
- nickname: L.nickname.trim(),
138
- accountNumber: L.accountNumber.trim(),
139
- routingNumber: L.routingNumber.trim(),
140
- nameOnAccount: L.nickname.trim(),
141
- type: L.type
137
+ nickname: N.nickname.trim(),
138
+ accountNumber: N.accountNumber.trim(),
139
+ routingNumber: N.routingNumber.trim(),
140
+ nameOnAccount: N.nickname.trim(),
141
+ type: N.type,
142
+ accountHolderType: Ee(N.accountHolderType)
142
143
  } }, { onSuccess: (e) => {
143
- p(a.AccountConnected, { accountId: e?.id }), A(e), e?.id && pt(e.id);
144
+ p(i.AccountConnected, { accountId: e?.id }), $e(e), e?.id && Q(e.id);
144
145
  } });
145
146
  }
146
147
  }
147
- }, ht = () => {
148
- T === 2 && E(1);
149
- }, gt = (e, t) => {
150
- Y.find((t) => t.id === e)?.locked || O((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
151
- }, _t = (e) => {
152
- (!e || y) && (!e || b.canWrite) && (e && (E(1), et(o), O([]), A(void 0), j(void 0), B.reset(), V.reset(), W.reset()), Ge(e));
153
- }, vt = (e) => {
154
- if (!y || !b.canWrite) return;
155
- let t = X.find((t) => t.id === e);
156
- C(e), nt(xe(t)), M(!0);
148
+ }, _t = () => {
149
+ S === 2 && C(1);
150
+ }, vt = (e, t) => {
151
+ Y.find((t) => t.id === e)?.locked || Qe((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
157
152
  }, yt = (e) => {
158
- (!e || y) && (!e || b.canWrite) && M(e);
159
- }, bt = () => {
160
- if (!y || !b.canWrite || !S) return;
161
- let t = X.find((e) => e.id === S), n = Se(tt, t);
153
+ (!e || g) && (!e || _.canWrite) && (e && (C(1), P(pe), Qe([]), $e(void 0), E(void 0), B.reset(), V.reset(), W.reset()), Ze(e));
154
+ }, bt = (e) => {
155
+ if (!g || !_.canWrite) return;
156
+ let t = X.find((t) => t.id === e);
157
+ b(e), I(xe(t)), O(!0);
158
+ }, xt = (e) => {
159
+ (!e || g) && (!e || _.canWrite) && O(e);
160
+ }, St = () => {
161
+ if (!g || !_.canWrite || !y) return;
162
+ let t = X.find((e) => e.id === y), n = Se(F, t);
162
163
  Object.keys(n).length !== 0 && H.mutate({
163
- path: { id: S },
164
+ path: { id: y },
164
165
  body: n
165
166
  }, { onSuccess: () => {
166
- p(a.AccountUpdated, { accountId: S }), e.success(d.editSuccessToast), M(!1);
167
+ p(i.AccountUpdated, { accountId: y }), e.success(d.editSuccessToast), O(!1);
167
168
  } });
168
- }, xt = (e) => {
169
- y && b.canWrite && (C(e), rt(me), P(!1), N(!1), Ze(!0));
170
- }, St = (e) => {
171
- (!e || y) && (!e || b.canWrite) && (e || (P(!1), N(!1)), Ze(e));
172
169
  }, Ct = (e) => {
173
- G.reset(), P(!1), rt(e);
174
- }, wt = () => {
175
- if (!y || !b.canWrite || !S || !ve(R)) return;
176
- let e = ye(R.firstAmount), t = ye(R.secondAmount);
177
- e !== null && t !== null && (P(!1), G.mutate({
178
- path: { id: S },
170
+ g && _.canWrite && (b(e), R(he), A(!1), k(!1), it(!0));
171
+ }, wt = (e) => {
172
+ (!e || g) && (!e || _.canWrite) && (e || (A(!1), k(!1)), it(e));
173
+ }, Tt = (e) => {
174
+ G.reset(), A(!1), R(e);
175
+ }, Et = () => {
176
+ if (!g || !_.canWrite || !y || !ye(L)) return;
177
+ let e = a(L.firstAmount), t = a(L.secondAmount);
178
+ e !== null && t !== null && (A(!1), G.mutate({
179
+ path: { id: y },
179
180
  body: {
180
181
  firstAmount: e,
181
182
  secondAmount: t
182
183
  }
183
184
  }, { onSuccess: (e) => {
184
- if (!ze(e)) {
185
- P(!0);
185
+ if (!He(e)) {
186
+ A(!0);
186
187
  return;
187
188
  }
188
- p(a.AccountVerified, { accountId: S }), r("tesouro-new-external-bank-account-linked-success"), N(!0);
189
+ p(i.AccountVerified, { accountId: y }), n("tesouro-new-external-bank-account-linked-success"), k(!0);
189
190
  } }));
190
- }, Tt = (e) => {
191
- y && b.canMicroDeposit && (j("row"), W.mutate({ path: { id: e } }, { onSuccess: () => {
192
- j(void 0), Je((t) => f(t, e)), p(a.AccountLinked, { accountId: e });
193
- } }));
194
- }, Et = (e) => {
195
- y && b.canWrite && I(e);
196
191
  }, Dt = (e) => {
197
- e || I(void 0);
198
- }, Ot = () => {
199
- if (!y || !b.canWrite || !F) return;
200
- let t = F;
192
+ g && _.canMicroDeposit && (E("row"), W.mutate({ path: { id: e } }, { onSuccess: () => {
193
+ E(void 0), tt((t) => f(t, e)), p(i.AccountLinked, { accountId: e });
194
+ } }));
195
+ }, Ot = (e) => {
196
+ g && _.canWrite && M(e);
197
+ }, kt = (e) => {
198
+ e || M(void 0);
199
+ }, At = () => {
200
+ if (!g || !_.canWrite || !j) return;
201
+ let t = j;
201
202
  U.mutate({ path: { id: t } }, { onSuccess: () => {
202
- p(a.AccountUnlinked, { accountId: t }), e.success(d.unlinkSuccessToast), I(void 0);
203
+ p(i.AccountUnlinked, { accountId: t }), e.success(d.unlinkSuccessToast), M(void 0);
203
204
  } });
204
- }, kt = B.isPending || V.isPending || H.isPending || G.isPending || U.isPending || W.isPending, At = b.canWrite, Q = !y || kt, $ = W.isError && Ke === "connect", jt = Ne(Y, {
205
- selectedUserIds: D,
206
- disabled: Q || !At,
205
+ }, jt = B.isPending || V.isPending || H.isPending || G.isPending || U.isPending || W.isPending, Mt = _.canWrite, Nt = !g || jt, $ = W.isError && et === "connect", Pt = Ie(Y, {
206
+ selectedUserIds: w,
207
+ disabled: Nt || !Mt,
207
208
  fallbackTooltip: u.teamMemberAccessTooltip,
208
- onUserToggle: gt
209
- }), Mt = Y.filter((e) => e.locked).length + D.length, Nt = Y.filter((e) => e.locked || D.includes(e.id)), Pt = k ? {
210
- nickname: k.nickname || L.nickname.trim(),
211
- maskedAccountNumber: k.accountNumber,
212
- users: Nt.map((e) => ({
213
- key: e.id,
214
- initials: t(e.name),
215
- name: e.name,
216
- role: e.role
217
- }))
218
- } : void 0, Ft = we(Z, d, b, {
209
+ onUserToggle: vt
210
+ }), Ft = Y.filter((e) => e.locked).length + w.length, It = T ? ((e) => {
211
+ let t = e.accountNumber.slice(-4), n = {
212
+ type: {
213
+ text: De(e.accountHolderType ? Te(e.accountHolderType) : N.accountHolderType, e.type ?? N.type, d),
214
+ emphasized: !1
215
+ },
216
+ last4: {
217
+ text: t,
218
+ emphasized: !0
219
+ }
220
+ };
221
+ return D.has(e.id) ? {
222
+ variant: "deposits-sent",
223
+ description: o(d.summaryDescription, n),
224
+ nextSteps: [{
225
+ key: "check-bank",
226
+ title: d.summaryCheckBankTitle.replaceAll("{last4}", t),
227
+ description: o(d.summaryCheckBankDescription, n)
228
+ }, {
229
+ key: "verify",
230
+ title: d.summaryVerifyTitle,
231
+ description: o(d.summaryVerifyDescription, n)
232
+ }]
233
+ } : {
234
+ variant: "account-added",
235
+ description: o(d.summaryAccountAddedDescription, n),
236
+ nextSteps: []
237
+ };
238
+ })(T) : void 0, Lt = we(Z, d, _, {
219
239
  labels: u,
220
- onEditSelect: vt,
221
- onVerifySelect: xt,
222
- onLinkSelect: Tt,
223
- onUnlinkSelect: Et
224
- }), It = s(() => {
240
+ onEditSelect: bt,
241
+ onVerifySelect: Ct,
242
+ onLinkSelect: Dt,
243
+ onUnlinkSelect: Ot
244
+ }), Rt = s(() => {
225
245
  if (!B.isError && !V.isError && !$) return;
226
246
  let e = B.error ?? V.error ?? ($ ? W.error : void 0);
227
247
  return ee(e) ?? u.actionErrorTitle;
@@ -235,51 +255,51 @@ function p({ labels: i, featureLabels: l }) {
235
255
  u.actionErrorTitle
236
256
  ]);
237
257
  return {
238
- rows: Ft,
239
- isLoading: !v && (Ue && !z.data || He && !g || x && z.isLoading),
240
- isError: v || x && z.isError,
241
- isConnectOpen: w,
242
- isEditOpen: Ye,
243
- isVerifyOpen: Xe,
244
- isVerifySuccess: Qe,
245
- verifyAccountName: Z.find((e) => e.id === S)?.nickname,
246
- verifyAccountNumber: Z.find((e) => e.id === S)?.accountNumber,
247
- isUnlinkOpen: !!F,
248
- unlinkAccountNumber: Z.find((e) => e.id === F)?.accountNumber,
249
- connectStep: T,
250
- accessRows: jt,
251
- accessGrantedCount: Mt,
252
- connectSummary: Pt,
253
- isTeamMembersLoading: st,
254
- isTeamMembersError: q.isError || ot,
255
- isConnectNextDisabled: T === 1 ? !he(L) : T === 2 && !ct,
256
- isConnectRoutingNumberInvalid: L.routingNumber.trim() !== "" && !ge(L.routingNumber),
257
- connectErrorMessage: It,
258
- isVerifyFirstAmountInvalid: R.firstAmount.trim() !== "" && !_e(R.firstAmount),
259
- isVerifySecondAmountInvalid: R.secondAmount.trim() !== "" && !_e(R.secondAmount),
260
- isVerifySubmitDisabled: !ve(R),
261
- isActionDisabled: Q,
262
- canConnect: At,
263
- isSubmitting: kt,
264
- isActionError: W.isError || U.isError || B.isError || V.isError || H.isError || G.isError || $e,
258
+ rows: Lt,
259
+ isLoading: !Ye && (Je && !z.data || Ke && !h || v && z.isLoading),
260
+ isError: Ye || v && z.isError,
261
+ isConnectOpen: x,
262
+ isEditOpen: nt,
263
+ isVerifyOpen: rt,
264
+ isVerifySuccess: at,
265
+ verifyAccountName: Z.find((e) => e.id === y)?.nickname,
266
+ verifyAccountNumber: Z.find((e) => e.id === y)?.accountNumber,
267
+ isUnlinkOpen: !!j,
268
+ unlinkAccountNumber: Z.find((e) => e.id === j)?.accountNumber,
269
+ connectStep: S,
270
+ accessRows: Pt,
271
+ accessGrantedCount: Ft,
272
+ connectSummary: It,
273
+ isTeamMembersLoading: ut,
274
+ isTeamMembersError: q.isError || lt,
275
+ isConnectNextDisabled: S === 1 ? !ge(N) : S === 2 && !dt,
276
+ isConnectRoutingNumberInvalid: N.routingNumber.trim() !== "" && !_e(N.routingNumber),
277
+ connectErrorMessage: Rt,
278
+ isVerifyFirstAmountInvalid: L.firstAmount.trim() !== "" && !ve(L.firstAmount),
279
+ isVerifySecondAmountInvalid: L.secondAmount.trim() !== "" && !ve(L.secondAmount),
280
+ isVerifySubmitDisabled: !ye(L),
281
+ isActionDisabled: Nt,
282
+ canConnect: Mt,
283
+ isSubmitting: jt,
284
+ isActionError: W.isError || U.isError || B.isError || V.isError || H.isError || G.isError || ot,
265
285
  isConnectError: B.isError || V.isError || $,
266
286
  isEditError: H.isError,
267
- isVerifyError: G.isError || $e,
268
- connectForm: L,
269
- editForm: tt,
270
- verifyForm: R,
271
- onConnectOpenChange: _t,
272
- onEditOpenChange: yt,
273
- onVerifyOpenChange: St,
274
- onUnlinkOpenChange: Dt,
275
- onConnectFormChange: ut,
276
- onEditFormChange: nt,
277
- onVerifyFormChange: Ct,
278
- onConnectNext: mt,
279
- onConnectBack: ht,
280
- onEditSubmit: bt,
281
- onVerifySubmit: wt,
282
- onUnlinkConfirm: Ot
287
+ isVerifyError: G.isError || ot,
288
+ connectForm: N,
289
+ editForm: F,
290
+ verifyForm: L,
291
+ onConnectOpenChange: yt,
292
+ onEditOpenChange: xt,
293
+ onVerifyOpenChange: wt,
294
+ onUnlinkOpenChange: kt,
295
+ onConnectFormChange: pt,
296
+ onEditFormChange: I,
297
+ onVerifyFormChange: Tt,
298
+ onConnectNext: gt,
299
+ onConnectBack: _t,
300
+ onEditSubmit: St,
301
+ onVerifySubmit: Et,
302
+ onUnlinkConfirm: At
283
303
  };
284
304
  }
285
305
  //#endregion
@@ -82,6 +82,7 @@ var y = [e.ExternalBankAccountReadOrg], b = [...y, e.ExternalBankAccountWriteOrg
82
82
  accountNumber: C(a(i.accountNumber, "0000")),
83
83
  routingNumber: a(i.routingNumber, "123456780"),
84
84
  type: i.type === "SAVINGS" ? "SAVINGS" : "CHECKING",
85
+ accountHolderType: i.accountHolderType === "BUSINESS" ? "BUSINESS" : "INDIVIDUAL",
85
86
  verificationStatus: "UNVERIFIED"
86
87
  };
87
88
  return n.push(o), f(o, 201);
@@ -1,90 +1,40 @@
1
- import { Button as e, Dialog as t, DialogContent as n, DialogFooter as r, DialogHeader as i, DialogTitle as a } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
- import { InlineErrorAlert as o } from "../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
3
- import "../../../shared/ui/dist/index.js";
4
- import { linkedAccountsWidgetUiTestIds as s } from "./index9.js";
5
- import { ConnectStepAccess as c } from "./index4.js";
6
- import { ConnectStepDetails as l } from "./index6.js";
7
- import { ConnectStepSummary as u } from "./index7.js";
8
- import { DialogFeaturedIcon as d } from "./index8.js";
9
- import { jsx as f, jsxs as p } from "react/jsx-runtime";
10
- import { ArrowLeftIcon as m, ArrowRightIcon as h, LinkIcon as g } from "lucide-react";
1
+ import { Input as e, Label as t } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
+ import { jsx as n, jsxs as r } from "react/jsx-runtime";
11
3
  //#region ../../libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index10.js
12
- var _ = 2;
13
- function v({ open: v, labels: y, connectStep: b, connectForm: x, accessRows: S, accessGrantedCount: C, connectSummary: w, isTeamMembersLoading: T, isTeamMembersError: E, isSubmitting: D, isActionDisabled: O, canConnect: k, isConnectError: A, isConnectNextDisabled: j, isConnectRoutingNumberInvalid: M, connectErrorMessage: N, onOpenChange: P, onConnectFormChange: F, onConnectNext: I, onConnectBack: L }) {
14
- let R = O || !k, z = b === 3, B = y.stepIndicator.replace("{current}", String(b)).replace("{total}", String(_));
15
- return /* @__PURE__ */ f(t, {
16
- open: v,
17
- onOpenChange: P,
18
- children: /* @__PURE__ */ p(n, {
19
- showCloseButton: !0,
20
- "data-testid": s.connectAccountDialog,
21
- className: "ttw:flex ttw:max-h-[min(90vh,48rem)] ttw:flex-col ttw:gap-0 ttw:rounded-xl ttw:p-0",
22
- children: [
23
- /* @__PURE__ */ p(i, {
24
- className: "ttw:flex ttw:flex-col ttw:items-start ttw:gap-3 ttw:px-6 ttw:pb-4 ttw:pt-6 ttw:text-left",
25
- children: [/* @__PURE__ */ f(d, { children: /* @__PURE__ */ f(g, { className: "ttw:size-5" }) }), /* @__PURE__ */ f(a, {
26
- className: "ttw:text-xl",
27
- children: y.connectTitle
28
- })]
29
- }),
30
- /* @__PURE__ */ p("div", {
31
- className: "ttw:min-h-0 ttw:flex-1 ttw:space-y-4 ttw:overflow-y-auto ttw:border-y ttw:border-border ttw:p-6",
32
- children: [
33
- b === 1 && /* @__PURE__ */ f(l, {
34
- labels: y,
35
- connectForm: x,
36
- disabled: R,
37
- routingNumberError: M,
38
- onConnectFormChange: F
39
- }),
40
- b === 2 && /* @__PURE__ */ f(c, {
41
- labels: y,
42
- rows: S,
43
- grantedCount: C,
44
- isLoading: T,
45
- isError: E
46
- }),
47
- z && w && /* @__PURE__ */ f(u, {
48
- labels: y,
49
- summary: w
50
- }),
51
- A && !z && /* @__PURE__ */ f(o, { children: N ?? y.actionErrorTitle })
52
- ]
53
- }),
54
- /* @__PURE__ */ f(r, {
55
- className: "ttw:px-6 ttw:pb-6 ttw:pt-4",
56
- children: z ? /* @__PURE__ */ p(e, {
57
- type: "button",
58
- variant: "outline",
59
- className: "ttw:w-full",
60
- onClick: () => P(!1),
61
- children: [/* @__PURE__ */ f(m, {}), y.backToTransfersButton]
62
- }) : /* @__PURE__ */ p("div", {
63
- className: "ttw:flex ttw:w-full ttw:items-center ttw:justify-between ttw:gap-3",
64
- children: [/* @__PURE__ */ f("span", {
65
- className: "ttw:text-sm ttw:font-medium ttw:text-muted-foreground",
66
- children: B
67
- }), /* @__PURE__ */ p("div", {
68
- className: "ttw:flex ttw:gap-2",
69
- children: [/* @__PURE__ */ f(e, {
70
- type: "button",
71
- variant: "outline",
72
- disabled: D,
73
- onClick: b === 1 ? () => P(!1) : L,
74
- children: b === 1 ? y.cancelButton : y.backButton
75
- }), /* @__PURE__ */ p(e, {
76
- type: "button",
77
- loading: D,
78
- disabled: R || j,
79
- onClick: I,
80
- children: [y.nextButton, /* @__PURE__ */ f(h, {})]
81
- })]
82
- })]
83
- })
84
- })
85
- ]
86
- })
4
+ function i({ id: i, label: a, value: o, disabled: s = !1, readOnly: c = !1, required: l = !1, error: u = !1, errorMessage: d, maxLength: f, inputMode: p, onChange: m }) {
5
+ let h = d ? `${i}-error` : void 0;
6
+ return /* @__PURE__ */ r("div", {
7
+ className: "ttw:space-y-1",
8
+ children: [/* @__PURE__ */ r("div", {
9
+ className: "ttw:relative",
10
+ children: [/* @__PURE__ */ n(e, {
11
+ id: i,
12
+ placeholder: " ",
13
+ disabled: s,
14
+ readOnly: c,
15
+ required: l,
16
+ "aria-invalid": u || void 0,
17
+ "aria-describedby": u ? h : void 0,
18
+ value: o,
19
+ maxLength: f,
20
+ inputMode: p,
21
+ onChange: (e) => m?.(e.target.value),
22
+ className: "ttw:peer ttw:h-auto ttw:min-h-12 ttw:rounded-xl ttw:px-3 ttw:pt-5 ttw:pb-1 ttw:text-base ttw:leading-6 ttw:placeholder:text-transparent"
23
+ }), /* @__PURE__ */ r(t, {
24
+ htmlFor: i,
25
+ className: `ttw:pointer-events-none ttw:absolute ttw:top-1.5 ttw:left-3 ttw:gap-0.5 ttw:font-normal ttw:text-xs ttw:transition-all ttw:peer-placeholder-shown:top-1/2 ttw:peer-placeholder-shown:-translate-y-1/2 ttw:peer-placeholder-shown:text-base ttw:peer-focus:top-1.5 ttw:peer-focus:translate-y-0 ttw:peer-focus:text-xs ${u ? "ttw:text-destructive" : "ttw:text-muted-foreground"}`,
26
+ children: [a, l && /* @__PURE__ */ n("span", {
27
+ className: "ttw:text-destructive",
28
+ "aria-hidden": "true",
29
+ children: "*"
30
+ })]
31
+ })]
32
+ }), u && d && /* @__PURE__ */ n("p", {
33
+ id: h,
34
+ className: "ttw:text-xs ttw:text-destructive",
35
+ children: d
36
+ })]
87
37
  });
88
38
  }
89
39
  //#endregion
90
- export { v as ConnectAccountDialog };
40
+ export { i as TextInput };
@@ -1,7 +1,7 @@
1
1
  import { Button as e, Dialog as t, DialogContent as n, DialogFooter as r, DialogHeader as i, DialogTitle as a } from "../../../../../packages/shared-ui-shadcn/dist/index.js";
2
2
  import { InlineErrorAlert as o } from "../../../shared/ui/dist/lib/InlineErrorAlert/InlineErrorAlert.js";
3
3
  import "../../../shared/ui/dist/index.js";
4
- import { TextInput as s } from "./index5.js";
4
+ import { TextInput as s } from "./index10.js";
5
5
  import { jsx as c, jsxs as l } from "react/jsx-runtime";
6
6
  //#region ../../libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index11.js
7
7
  function u({ open: u, labels: d, editForm: f, isSubmitting: p, isActionDisabled: m, isEditError: h, onOpenChange: g, onEditFormChange: _, onEditSubmit: v }) {