@tesouro/embedded-components-react 0.7.15 → 0.7.17

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 (28) hide show
  1. package/dist/index.css +6 -12
  2. package/dist/index.d.ts +31 -14
  3. package/dist/lib/AcceptDisclosuresWidget.d.ts +7 -0
  4. package/dist/lib/BankAccountOnboardingWidget.d.ts +4 -2
  5. package/dist/lib/LinkedAccountsWidget.d.ts +20 -12
  6. package/dist/lib/WidgetSuite.d.ts +24 -14
  7. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/feature/dist/lib/AcceptDisclosuresWidget/AcceptDisclosuresWidget.js +97 -97
  8. package/dist/libs/tesouro-embedded-components-react/accept-disclosures-widget/ui/dist/lib/AcceptDisclosuresWidget/labels.js +1 -0
  9. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/BankAccountOnboardingWidget.js +441 -433
  10. package/dist/libs/tesouro-embedded-components-react/bank-account-onboarding-widget/feature/dist/lib/BankAccountOnboardingWidget/labels.js +1 -0
  11. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/forms.js +2 -1
  12. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/labels.js +11 -1
  13. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/summary.js +22 -0
  14. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +182 -162
  15. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/mocks/linkedAccounts.js +1 -0
  16. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index10.js +36 -86
  17. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index11.js +1 -1
  18. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index12.js +17 -23
  19. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index14.js +6 -6
  20. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index15.js +14 -17
  21. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index16.js +3 -6
  22. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index5.js +168 -35
  23. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index6.js +70 -83
  24. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index7.js +11 -112
  25. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index8.js +6 -12
  26. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index9.js +82 -7
  27. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  28. package/package.json +1 -1
@@ -70,6 +70,7 @@ var n = {
70
70
  modalTitle: "Bank account onboarding",
71
71
  submitFailedError: "Unable to submit application. Please try again.",
72
72
  genericRetryError: "Please try again.",
73
+ deleteFailedError: "Unable to delete application. Please try again.",
73
74
  saveDraftNothingValidError: "Fix the highlighted fields before saving, or discard your changes.",
74
75
  fallbackBankName: "Member Bank",
75
76
  shellFdicDisclaimer: "Products and services are offered by {bankName}, N.A., Member FDIC.",
@@ -1,5 +1,6 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/forms.js
2
2
  var e = {
3
+ accountHolderType: "",
3
4
  nickname: "",
4
5
  accountNumber: "",
5
6
  routingNumber: "",
@@ -20,7 +21,7 @@ function n(e) {
20
21
  return r % 10 == 0;
21
22
  }
22
23
  function r(e) {
23
- return e.type !== "" && e.nickname.trim() !== "" && e.accountNumber.trim() !== "" && n(e.routingNumber);
24
+ return e.accountHolderType !== "" && e.type !== "" && e.nickname.trim() !== "" && e.accountNumber.trim() !== "" && n(e.routingNumber);
24
25
  }
25
26
  var i = {
26
27
  nickname: "",
@@ -4,7 +4,17 @@ var e = {
4
4
  accountLabel: "Account #:",
5
5
  pendingStatus: "in process.",
6
6
  editSuccessToast: "Bank account nickname updated successfully",
7
- unlinkSuccessToast: "External account unlinked successfully"
7
+ unlinkSuccessToast: "External account unlinked successfully",
8
+ personalCheckingType: "personal checking",
9
+ personalSavingsType: "personal savings",
10
+ businessCheckingType: "business checking",
11
+ businessSavingsType: "business savings",
12
+ summaryDescription: "We sent two small deposits to your {type} account ending in {last4}.",
13
+ summaryAccountAddedDescription: "Your {type} account ending in {last4} was added. Someone with permission to send verification deposits can start verification from Transfers.",
14
+ summaryCheckBankTitle: "Check your bank account ending in {last4}",
15
+ summaryCheckBankDescription: "Look for two small deposits on your statement.",
16
+ summaryVerifyTitle: "Verify the amounts",
17
+ summaryVerifyDescription: "Return to Transfers and enter both amounts to start making transfers."
8
18
  };
9
19
  //#endregion
10
20
  export { e as DEFAULT_FEATURE_LABELS };
@@ -0,0 +1,22 @@
1
+ //#region ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/summary.js
2
+ function e(e) {
3
+ return e === "business" ? "BUSINESS" : "INDIVIDUAL";
4
+ }
5
+ function t(e) {
6
+ return e === "BUSINESS" ? "business" : "personal";
7
+ }
8
+ function n(e, t, n) {
9
+ let r = t === "SAVINGS";
10
+ return e === "business" ? r ? n.businessSavingsType : n.businessCheckingType : r ? n.personalSavingsType : n.personalCheckingType;
11
+ }
12
+ function r(e, t) {
13
+ return e.split(/\{(\w+)\}/).map((e, n) => n % 2 == 0 ? {
14
+ text: e,
15
+ emphasized: !1
16
+ } : t[e] ?? {
17
+ text: `{${e}}`,
18
+ emphasized: !1
19
+ }).filter((e) => e.text !== "");
20
+ }
21
+ //#endregion
22
+ export { t as fromApiAccountHolderType, e as toApiAccountHolderType, n as toSummaryTypeLabel, r as toTextParts };
@@ -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);