@tesouro/embedded-components-react 0.11.60 → 0.11.61

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 (65) hide show
  1. package/README.md +21 -21
  2. package/dist/index.css +37 -160
  3. package/dist/index.d.ts +50 -17
  4. package/dist/lib/BankAccountsWidget.d.ts +20 -7
  5. package/dist/lib/LinkedAccountsWidget.d.ts +30 -10
  6. package/dist/lib/WidgetSuite.d.ts +50 -17
  7. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index.js +5 -5
  8. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +21 -26
  9. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +18 -16
  10. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index5.js +22 -35
  11. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index6.js +29 -14
  12. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index7.js +20 -24
  13. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index8.js +31 -0
  14. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index.js +2 -2
  15. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index10.js +296 -0
  16. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index12.js +1 -0
  17. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index5.js +5 -10
  18. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js +42 -281
  19. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index.js +5 -3
  20. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index10.js +180 -0
  21. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index2.js +16 -184
  22. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index3.js +9 -93
  23. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index4.js +136 -81
  24. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index5.js +64 -101
  25. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index6.js +54 -81
  26. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index7.js +90 -65
  27. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index8.js +108 -183
  28. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index9.js +76 -0
  29. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/BankAccountsWidget/BankAccountsWidget.js +1 -1
  30. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/labels.js +6 -8
  31. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +137 -120
  32. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/mocks/labels.js +5 -5
  33. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js +47 -60
  34. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankAccountsWidgetUi.js +71 -72
  35. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankingHeader.js +22 -37
  36. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/CreateAccountDialog.js +119 -133
  37. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/labels.js +12 -8
  38. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +1 -1
  39. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/labels.js +9 -7
  40. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/rows.js +46 -27
  41. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useAdminEligibleUserIds.js +3 -2
  42. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +248 -224
  43. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/mocks/labels.js +5 -5
  44. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index.js +2 -2
  45. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index10.js +22 -36
  46. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index11.js +23 -70
  47. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index12.js +91 -27
  48. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index13.js +80 -63
  49. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index14.js +145 -125
  50. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index2.js +61 -9
  51. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index3.js +77 -50
  52. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index4.js +180 -65
  53. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index5.js +22 -178
  54. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index6.js +6 -75
  55. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index7.js +48 -11
  56. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index8.js +45 -7
  57. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index9.js +8 -82
  58. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  59. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +15 -14
  60. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AddTile/AddTile.js +17 -0
  61. package/dist/packages/shared-ui-shadcn/dist/index.js +3603 -3518
  62. package/package.json +1 -1
  63. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index11.js +0 -1
  64. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index15.js +0 -67
  65. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index16.js +0 -138
@@ -4,224 +4,241 @@
4
4
  "use client";
5
5
  import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import { TESOURO_NEW_EXTERNAL_BANK_ACCOUNT_LINKED_SUCCESS_EVENT as t, emitWidgetDomEvent as n } from "../../../../shared/util/dist/lib/widgetDomEvents.js";
7
- import { extractApiErrorMessage as ee } from "../../../../shared/util/dist/lib/apiErrors.js";
7
+ import { extractApiErrorMessage as r } from "../../../../shared/util/dist/lib/apiErrors.js";
8
8
  import "../../../../shared/util/dist/index.js";
9
- import { OrganizationStatus as te, isOrganizationOnItsWay as ne } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
10
- import { useEmbedApi as re } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
11
- import { Scope as r } from "../../../../shared/data-access/dist/lib/scopes.js";
9
+ import { OrganizationStatus as ee, isOrganizationOnItsWay as te } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
10
+ import { useEmbedApi as ne } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
11
+ import { Scope as re } from "../../../../shared/data-access/dist/lib/scopes.js";
12
12
  import { useOrganizationQuery as ie } from "../../../../shared/data-access/dist/lib/organization/useOrganizationQuery.js";
13
13
  import { useAllOrganizationRolesQuery as ae } from "../../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
14
14
  import { useAllOrganizationUsersQuery as oe } from "../../../../shared/data-access/dist/lib/user/useAllOrganizationUsersQuery.js";
15
15
  import "../../../../shared/data-access/dist/index.js";
16
16
  import "../../../../shared/ui/dist/index.js";
17
17
  import { useAnalyticsTrack as se } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
18
- import { useWidgetConfig as ce, useWidgetError as le, useWidgetLoading as ue } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
18
+ import { useRefetchWidget as ce, useWidgetConfig as le, useWidgetError as ue, useWidgetLoading as de } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
19
19
  import "../../../../shared/feature/dist/index.js";
20
- import { filterRolesForOrganization as de } from "../../../../../shared/util-validation/dist/index6.js";
21
- import { filterUsersForOrganization as fe } from "../../../../../shared/util-validation/dist/index7.js";
22
- import { DEFAULT_FEATURE_LABELS as pe } from "./labels.js";
20
+ import { filterRolesForOrganization as fe } from "../../../../../shared/util-validation/dist/index6.js";
21
+ import { filterUsersForOrganization as pe } from "../../../../../shared/util-validation/dist/index7.js";
22
+ import { DEFAULT_FEATURE_LABELS as me } from "./labels.js";
23
23
  import { LinkedAccountsWidgetAnalyticsEvent as i } from "./analytics/events.js";
24
- import { EMPTY_CONNECT_FORM as me, EMPTY_EDIT_FORM as he, EMPTY_VERIFY_FORM as ge, isConnectStep1Valid as _e, isRoutingNumberValid as ve, isVerifyAmountInRange as ye, isVerifyFormValid as be, parseVerifyAmountToMinorUnits as xe, sanitizeRoutingNumberInput as Se, toEditForm as Ce, toUpdateBody as we } from "./forms.js";
25
- import { getLinkedAccountsPermissions as Te } from "./permissions.js";
26
- import { toAccountRows as Ee } from "./rows.js";
27
- import { fromApiAccountHolderType as De, toApiAccountHolderType as Oe, toSummaryTypeLabel as ke, toTextParts as a } from "./summary.js";
28
- import { useConnectExternalBankAccountMutation as Ae } from "../../../data-access/dist/index3.js";
29
- import { useExternalBankAccountsQuery as je } from "../../../data-access/dist/index4.js";
30
- import { useGrantExternalBankAccountAccessMutation as Me } from "../../../data-access/dist/index5.js";
31
- import { useLinkExternalBankAccountMutation as Ne } from "../../../data-access/dist/index6.js";
32
- import { useUnlinkExternalBankAccountMutation as Pe } from "../../../data-access/dist/index9.js";
33
- import { useUpdateExternalBankAccountMutation as Fe } from "../../../data-access/dist/index10.js";
34
- import { useValidateExternalBankAccountMutation as Ie } from "../../../data-access/dist/index11.js";
24
+ import { EMPTY_CONNECT_FORM as he, EMPTY_EDIT_FORM as ge, EMPTY_VERIFY_FORM as _e, isConnectStep1Valid as ve, isRoutingNumberValid as ye, isVerifyAmountInRange as be, isVerifyFormValid as xe, parseVerifyAmountToMinorUnits as Se, sanitizeRoutingNumberInput as Ce, toEditForm as we, toUpdateBody as Te } from "./forms.js";
25
+ import { getLinkedAccountsPermissions as Ee } from "./permissions.js";
26
+ import { toAccountRows as De } from "./rows.js";
27
+ import { fromApiAccountHolderType as Oe, toApiAccountHolderType as ke, toSummaryTypeLabel as Ae, toTextParts as a } from "./summary.js";
28
+ import { useConnectExternalBankAccountMutation as je } from "../../../data-access/dist/index3.js";
29
+ import { useExternalBankAccountsQuery as Me } from "../../../data-access/dist/index4.js";
30
+ import { useGrantExternalBankAccountAccessMutation as Ne } from "../../../data-access/dist/index5.js";
31
+ import { useLinkExternalBankAccountMutation as Pe } from "../../../data-access/dist/index6.js";
32
+ import { useUnlinkExternalBankAccountMutation as Fe } from "../../../data-access/dist/index9.js";
33
+ import { useUpdateExternalBankAccountMutation as Ie } from "../../../data-access/dist/index10.js";
34
+ import { useValidateExternalBankAccountMutation as Le } from "../../../data-access/dist/index11.js";
35
35
  import "../../../data-access/dist/index.js";
36
- import { useAdminEligibleUserIds as Le } from "./useAdminEligibleUserIds.js";
37
- import { toAccessRows as Re, toOrganizationRoleOptions as ze, toTeamMembers as Be } from "./teamMembers.js";
38
- import { DEFAULT_LABELS as Ve } from "../../../ui/dist/index15.js";
36
+ import { useAdminEligibleUserIds as Re } from "./useAdminEligibleUserIds.js";
37
+ import { toAccessRows as ze, toOrganizationRoleOptions as Be, toTeamMembers as Ve } from "./teamMembers.js";
38
+ import { DEFAULT_LABELS as He } from "../../../ui/dist/index13.js";
39
39
  import "../../../ui/dist/index.js";
40
- import { useCallback as He, useEffect as o, useMemo as s, useState as c } from "react";
41
- import { useControllableState as Ue } from "@radix-ui/react-use-controllable-state";
40
+ import { useCallback as Ue, useEffect as o, useMemo as s, useState as c } from "react";
41
+ import { useControllableState as We } from "@radix-ui/react-use-controllable-state";
42
42
  // ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js
43
- function We(e) {
43
+ function Ge(e) {
44
44
  let t = e;
45
45
  return typeof e == "object" && !!e && "verificationStatus" in e && t.verificationStatus === "VERIFIED";
46
46
  }
47
47
  var l = "tesouro.linkedAccounts.locallySentMicroDepositAccountIds.v1";
48
- function Ge() {
48
+ function Ke() {
49
49
  if (typeof window > "u") return /* @__PURE__ */ new Set();
50
50
  try {
51
51
  let e = window.sessionStorage.getItem(l), t = e ? JSON.parse(e) : [];
52
- return new Set(Array.isArray(t) ? t.filter(u) : []);
52
+ return new Set(Array.isArray(t) ? t.filter(qe) : []);
53
53
  } catch {
54
54
  return /* @__PURE__ */ new Set();
55
55
  }
56
56
  }
57
- function u(e) {
57
+ function qe(e) {
58
58
  return typeof e == "string";
59
59
  }
60
- function d(e) {
60
+ function Je(e) {
61
61
  if (typeof window < "u") try {
62
62
  window.sessionStorage.setItem(l, JSON.stringify([...e]));
63
63
  } catch {}
64
64
  }
65
- function f(e, t) {
65
+ function Ye(e, t) {
66
66
  let n = new Set(e).add(t);
67
- return d(n), n;
67
+ return Je(n), n;
68
68
  }
69
- var Ke = r.ExternalBankAccountWriteOrg;
70
- function p({ labels: r, featureLabels: l, isLinkAccountOpen: u, onLinkAccountOpenChange: d }) {
71
- let p = {
72
- ...Ve,
73
- ...r
74
- }, m = {
75
- ...pe,
69
+ var Xe = re.ExternalBankAccountWriteOrg;
70
+ function u({ labels: re, featureLabels: l, isLinkAccountOpen: qe, onLinkAccountOpenChange: Je }) {
71
+ let u = {
72
+ ...He,
73
+ ...re
74
+ }, d = {
75
+ ...me,
76
76
  ...l
77
- }, h = se(), { organizationId: g, widgetToken: _, initResponse: v } = ce(), qe = ue(), { organizationStatus: y } = re(), Je = ne(y), Ye = !!le(), b = !!(g && _), Xe = b || !!_ && y === te.Rotating, x = s(() => Te(v?.scopes), [v?.scopes]), S = Xe && x.canRead && !!v, [C, Ze] = c(), [Qe, $e] = Ue({
78
- prop: u,
77
+ }, f = se(), { organizationId: p, widgetToken: Ze, initResponse: m } = le(), Qe = de(), { organizationStatus: $e } = ne(), h = te($e), g = !!ue(), et = ce(), _ = !!(p && Ze), tt = _ || !!Ze && $e === ee.Rotating, v = s(() => Ee(m?.scopes), [m?.scopes]), y = tt && v.canRead && !!m, [b, nt] = c(), [rt, it] = We({
78
+ prop: qe,
79
79
  defaultProp: !1,
80
- onChange: d,
80
+ onChange: Je,
81
81
  caller: "LinkedAccountsWidget"
82
- }), et = b && x.canWrite, w = Qe && et, [T, E] = c(1), [D, tt] = c([]), [O, nt] = c(), [rt, k] = c(), [A, it] = c(Ge), [at, j] = c(!1), [ot, st] = c(!1), [ct, M] = c(!1), [lt, N] = c(!1), [P, F] = c(), [I, ut] = c(me), [dt, ft] = c(!1), [pt, mt] = c(he), [L, ht] = c(ge);
82
+ }), at = _ && v.canWrite, x = rt && at, [S, C] = c(1), [w, ot] = c([]), [T, st] = c(), [ct, E] = c(), [D, lt] = c(Ke), [ut, O] = c(!1), [dt, k] = c(!1), [ft, pt] = c(!1), [mt, A] = c(!1), [ht, gt] = c(!1), [j, M] = c(), [N, P] = c(), [F, _t] = c(he), [vt, yt] = c(!1), [bt, xt] = c(ge), [I, St] = c(_e);
83
83
  o(() => {
84
- h(i.Mounted);
85
- }, [h]);
86
- let R = je({
84
+ f(i.Mounted);
85
+ }, [f]);
86
+ let L = Me({
87
87
  limit: 100,
88
- enabled: S
89
- }), z = Ae(), B = Me(), V = Fe(), H = Pe(), U = Ne(), W = Ie(), G = w && T >= 2, K = oe({ enabled: G }), q = ae({ enabled: G }), gt = ie({ enabled: w && x.canReadOrganization }).data?.legalName ?? "", J = s(() => dt ? I : {
90
- ...I,
91
- nameOnAccount: gt
88
+ enabled: y
89
+ }), R = je(), z = Ne(), B = Ie(), V = Fe(), H = Pe(), U = Le(), W = x && S >= 2, G = oe({ enabled: W }), K = ae({ enabled: W }), Ct = ie({ enabled: x && v.canReadOrganization }).data?.legalName ?? "", q = s(() => vt ? F : {
90
+ ...F,
91
+ nameOnAccount: Ct
92
92
  }, [
93
- dt,
94
- I,
95
- gt
96
- ]), { userIds: _t, isResolving: vt, isError: yt } = Le({
97
- enabled: G,
98
- permissionKey: Ke,
99
- organizationId: g
100
- }), Y = s(() => {
101
- let e = q.data?.data ?? [], t = g ? de(e, {
102
- organizationId: g,
103
- organizationTypes: v?.organizationTypes ?? []
104
- }) : e, n = fe(K.data?.data ?? [], g);
105
- return Be(n, ze(t), _t);
93
+ vt,
94
+ F,
95
+ Ct
96
+ ]), { userIds: wt, isResolving: Tt, isError: Et, refetch: Dt } = Re({
97
+ enabled: W,
98
+ permissionKey: Xe,
99
+ organizationId: p
100
+ }), J = s(() => {
101
+ let e = K.data?.data ?? [], t = p ? fe(e, {
102
+ organizationId: p,
103
+ organizationTypes: m?.organizationTypes ?? []
104
+ }) : e, n = pe(G.data?.data ?? [], p);
105
+ return Ve(n, Be(t), wt);
106
106
  }, [
107
- _t,
108
- q.data?.data,
107
+ wt,
109
108
  K.data?.data,
110
- g,
111
- v?.organizationTypes
112
- ]), bt = K.isLoading || K.isFetchingNextPage || !!K.hasNextPage || q.isResolving || vt, xt = !bt && !K.isError && !yt, X = S ? R.data?.data ?? [] : [], Z = s(() => X.map((e) => e.verificationStatus === "UNVERIFIED" && A.has(e.id) ? {
109
+ G.data?.data,
110
+ p,
111
+ m?.organizationTypes
112
+ ]), Ot = G.isError && G.isFetching, Y = G.isLoading || G.isFetchingNextPage || !!G.hasNextPage || Ot || K.isResolving || Tt, kt = G.isError && !Ot || Et, At = !Y && !kt, jt = () => {
113
+ G.isError && G.refetch(), Et && Dt(), K.isError && K.refetch();
114
+ }, X = y ? L.data?.data ?? [] : [], Z = s(() => X.map((e) => e.verificationStatus === "UNVERIFIED" && D.has(e.id) ? {
113
115
  ...e,
114
116
  verificationStatus: "VERIFICATION_SENT"
115
- } : e), [X, A]), St = [.../* @__PURE__ */ new Set([...Y.filter((e) => e.locked).map((e) => e.id), ...D])], Ct = He((e) => {
116
- z.reset(), B.reset(), U.reset(), e.nameOnAccount !== J.nameOnAccount && ft(!0), ut({
117
+ } : e), [X, D]), Mt = [.../* @__PURE__ */ new Set([...J.filter((e) => e.locked).map((e) => e.id), ...w])], Nt = Ue((e) => {
118
+ R.reset(), z.reset(), H.reset(), e.nameOnAccount !== q.nameOnAccount && yt(!0), _t({
117
119
  ...e,
118
- routingNumber: Se(e.routingNumber)
120
+ routingNumber: Ce(e.routingNumber)
119
121
  });
120
122
  }, [
121
- J.nameOnAccount,
123
+ q.nameOnAccount,
124
+ R,
122
125
  z,
123
- B,
124
- U
125
- ]), wt = () => {
126
- E(3), n(t);
127
- }, Tt = (e) => {
128
- x.canMicroDeposit ? (k("connect"), U.mutate({ path: { id: e } }, { onSuccess: () => {
129
- k(void 0), it((t) => f(t, e)), h(i.AccountLinked, { accountId: e }), wt();
130
- } })) : wt();
131
- }, Et = (e) => {
132
- B.mutate({
126
+ H
127
+ ]), Pt = () => {
128
+ C(3), n(t);
129
+ }, Ft = (e) => {
130
+ v.canMicroDeposit ? (E("connect"), H.mutate({ path: { id: e } }, { onSuccess: () => {
131
+ E(void 0), lt((t) => Ye(t, e)), f(i.AccountLinked, { accountId: e }), Pt();
132
+ } })) : Pt();
133
+ }, It = (e) => {
134
+ z.mutate({
133
135
  path: { id: e },
134
- body: { userIds: St }
135
- }, { onSuccess: () => Tt(e) });
136
- }, Dt = () => {
137
- if (b && x.canWrite) {
138
- if (T === 1) {
139
- if (!_e(J)) return;
140
- E(2);
141
- } else T === 2 && xt && (O ? Et(O.id) : z.mutate({ body: {
142
- nickname: J.nickname.trim(),
143
- accountNumber: J.accountNumber.trim(),
144
- routingNumber: J.routingNumber.trim(),
145
- nameOnAccount: J.nameOnAccount.trim(),
146
- type: J.type,
147
- accountHolderType: Oe(J.accountHolderType)
136
+ body: { userIds: Mt }
137
+ }, { onSuccess: () => Ft(e) });
138
+ }, Lt = () => {
139
+ if (_ && v.canWrite) {
140
+ if (S === 1) {
141
+ if (!ve(q)) {
142
+ gt(!0);
143
+ return;
144
+ }
145
+ C(2);
146
+ } else S === 2 && (At ? T ? It(T.id) : R.mutate({ body: {
147
+ nickname: q.nickname.trim(),
148
+ accountNumber: q.accountNumber.trim(),
149
+ routingNumber: q.routingNumber.trim(),
150
+ nameOnAccount: q.nameOnAccount.trim(),
151
+ type: q.type,
152
+ accountHolderType: ke(q.accountHolderType)
148
153
  } }, { onSuccess: (e) => {
149
- h(i.AccountConnected, { accountId: e?.id }), nt(e), e?.id && Et(e.id);
150
- } }));
154
+ f(i.AccountConnected, { accountId: e?.id }), st(e), e?.id && It(e.id);
155
+ } }) : Y || jt());
151
156
  }
152
- }, Ot = () => {
153
- T === 2 && E(1);
154
- }, kt = (e, t) => {
155
- Y.find((t) => t.id === e)?.locked || tt((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
156
- }, [At, jt] = c(w);
157
- w !== At && (jt(w), w && (E(1), ut(me), ft(!1), tt([]), nt(void 0), k(void 0)));
158
- let { reset: Mt } = z, { reset: Nt } = B, { reset: Q } = U;
157
+ }, Rt = () => {
158
+ S === 2 && C(1);
159
+ }, zt = (e, t) => {
160
+ J.find((t) => t.id === e)?.locked || ot((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
161
+ }, [Bt, Vt] = c(x);
162
+ x !== Bt && (Vt(x), x && (C(1), gt(!1), _t(he), yt(!1), ot([]), st(void 0), E(void 0)));
163
+ let { reset: Ht } = R, { reset: Ut } = z, { reset: Wt } = H;
159
164
  o(() => {
160
- w && (Mt(), Nt(), Q());
165
+ x && (Ht(), Ut(), Wt());
161
166
  }, [
162
- w,
163
- Mt,
164
- Nt,
165
- Q
167
+ x,
168
+ Ht,
169
+ Ut,
170
+ Wt
166
171
  ]);
167
- let Pt = (e) => {
168
- (!e || et) && $e(e);
169
- }, Ft = (e) => {
170
- if (!b || !x.canWrite) return;
172
+ let Gt = (e) => {
173
+ (!e || at) && it(e);
174
+ }, Kt = (e) => {
175
+ if (!_ || !v.canWrite) return;
171
176
  let t = X.find((t) => t.id === e);
172
- Ze(e), mt(Ce(t)), j(!0);
173
- }, It = (e) => {
174
- e && !b || e && !x.canWrite || j(e);
175
- }, Lt = () => {
176
- if (!b || !x.canWrite || !C) return;
177
- let t = X.find((e) => e.id === C), n = we(pt, t);
178
- Object.keys(n).length !== 0 && V.mutate({
179
- path: { id: C },
177
+ nt(e), xt(we(t)), O(!0);
178
+ }, qt = (e) => {
179
+ e && !_ || e && !v.canWrite || O(e);
180
+ }, Jt = () => {
181
+ if (!_ || !v.canWrite || !b) return;
182
+ let t = X.find((e) => e.id === b), n = Te(bt, t);
183
+ Object.keys(n).length !== 0 && B.mutate({
184
+ path: { id: b },
180
185
  body: n
181
186
  }, { onSuccess: () => {
182
- h(i.AccountUpdated, { accountId: C }), e.success(m.editSuccessToast), j(!1);
187
+ f(i.AccountUpdated, { accountId: b }), e.success(d.editSuccessToast), O(!1);
183
188
  } });
184
- }, Rt = (e) => {
185
- b && x.canWrite && (Ze(e), ht(ge), N(!1), M(!1), st(!0));
186
- }, zt = (e) => {
187
- e && !b || e && !x.canWrite || (e || (N(!1), M(!1)), st(e));
188
- }, Bt = (e) => {
189
- W.reset(), N(!1), ht(e);
190
- }, Vt = () => {
191
- if (!b || !x.canWrite || !C || !be(L)) return;
192
- let e = xe(L.firstAmount), t = xe(L.secondAmount);
193
- e !== null && t !== null && (N(!1), W.mutate({
194
- path: { id: C },
189
+ }, Yt = (e) => {
190
+ _ && v.canWrite && (nt(e), St(_e), A(!1), pt(!1), U.reset(), k(!0));
191
+ }, Xt = (e) => {
192
+ e && !_ || e && !v.canWrite || k(e);
193
+ }, Zt = (e) => {
194
+ U.reset(), A(!1), St(e);
195
+ }, Qt = () => {
196
+ if (!_ || !v.canWrite || !b) return;
197
+ if (!xe(I)) {
198
+ pt(!0);
199
+ return;
200
+ }
201
+ let t = Se(I.firstAmount), r = Se(I.secondAmount);
202
+ t !== null && r !== null && (A(!1), U.mutate({
203
+ path: { id: b },
195
204
  body: {
196
- firstAmount: e,
197
- secondAmount: t
205
+ firstAmount: t,
206
+ secondAmount: r
198
207
  }
199
- }, { onSuccess: (e) => {
200
- We(e) ? (h(i.AccountVerified, { accountId: C }), n("tesouro-new-external-bank-account-linked-success"), M(!0)) : N(!0);
208
+ }, { onSuccess: (t) => {
209
+ Ge(t) ? (f(i.AccountVerified, { accountId: b }), n("tesouro-new-external-bank-account-linked-success"), e.success(d.verifySuccessToast), k(!1)) : A(!0);
201
210
  } }));
202
- }, Ht = (e) => {
203
- b && x.canMicroDeposit && (k("row"), U.mutate({ path: { id: e } }, { onSuccess: () => {
204
- k(void 0), it((t) => f(t, e)), h(i.AccountLinked, { accountId: e });
205
- } }));
206
- }, Ut = (e) => {
207
- b && x.canWrite && F(e);
208
- }, Wt = (e) => {
209
- e || F(void 0);
210
- }, Gt = () => {
211
- if (!b || !x.canWrite || !P) return;
212
- let t = P;
213
- H.mutate({ path: { id: t } }, { onSuccess: () => {
214
- h(i.AccountUnlinked, { accountId: t }), e.success(m.unlinkSuccessToast), F(void 0);
211
+ }, $t = (e) => {
212
+ _ && v.canMicroDeposit && (H.reset(), P(e));
213
+ }, en = (e) => {
214
+ e || P(void 0);
215
+ }, tn = () => {
216
+ if (!_ || !v.canMicroDeposit || !N) return;
217
+ let t = N;
218
+ E("row"), H.mutate({ path: { id: t } }, { onSuccess: () => {
219
+ E(void 0), lt((e) => Ye(e, t)), f(i.AccountLinked, { accountId: t }), e.success(d.sendDepositsSuccessToast), P(void 0);
220
+ } });
221
+ }, nn = (e) => {
222
+ _ && v.canWrite && (V.reset(), M(e));
223
+ }, rn = (e) => {
224
+ e || M(void 0);
225
+ }, an = () => {
226
+ if (!_ || !v.canWrite || !j) return;
227
+ let t = j;
228
+ V.mutate({ path: { id: t } }, { onSuccess: () => {
229
+ f(i.AccountUnlinked, { accountId: t }), e.success(d.unlinkSuccessToast), M(void 0);
215
230
  } });
216
- }, Kt = z.isPending || B.isPending || V.isPending || W.isPending || H.isPending || U.isPending, qt = x.canWrite, Jt = !b || Kt, $ = U.isError && rt === "connect", Yt = Re(Y, {
217
- selectedUserIds: D,
218
- disabled: Jt || !qt,
219
- fallbackTooltip: p.teamMemberAccessTooltip,
220
- onUserToggle: kt
221
- }), Xt = Y.filter((e) => e.locked).length + D.length, Zt = O ? ((e) => {
231
+ }, on = R.isPending || z.isPending || B.isPending || U.isPending || V.isPending || H.isPending, sn = v.canWrite, cn = !_ || on, ln = !_ && h, Q = !_ && !h, [un, dn] = c(Q);
232
+ Q !== un && (dn(Q), Q && (O(!1), k(!1), M(void 0), P(void 0)));
233
+ let $ = H.isError && ct === "connect", fn = ze(J, {
234
+ selectedUserIds: w,
235
+ disabled: cn || !sn,
236
+ fallbackTooltip: u.teamMemberAccessTooltip,
237
+ onUserToggle: zt
238
+ }), pn = J.filter((e) => e.locked).length + w.length, mn = T ? ((e) => {
222
239
  let t = e.accountNumber.slice(-4), n = {
223
240
  type: {
224
- text: ke(e.accountHolderType ? De(e.accountHolderType) : J.accountHolderType, e.type ?? J.type, m),
241
+ text: Ae(e.accountHolderType ? Oe(e.accountHolderType) : q.accountHolderType, e.type ?? q.type, d),
225
242
  emphasized: !1
226
243
  },
227
244
  last4: {
@@ -229,88 +246,95 @@ function p({ labels: r, featureLabels: l, isLinkAccountOpen: u, onLinkAccountOpe
229
246
  emphasized: !0
230
247
  }
231
248
  };
232
- return A.has(e.id) ? {
249
+ return D.has(e.id) ? {
233
250
  variant: "deposits-sent",
234
- description: a(m.summaryDescription, n),
251
+ description: a(d.summaryDescription, n),
235
252
  nextSteps: [{
236
253
  key: "check-bank",
237
- title: m.summaryCheckBankTitle.replaceAll("{last4}", t),
238
- description: a(m.summaryCheckBankDescription, n)
254
+ title: d.summaryCheckBankTitle.replaceAll("{last4}", t),
255
+ description: a(d.summaryCheckBankDescription, n)
239
256
  }, {
240
257
  key: "verify",
241
- title: m.summaryVerifyTitle,
242
- description: a(m.summaryVerifyDescription, n)
258
+ title: d.summaryVerifyTitle,
259
+ description: a(d.summaryVerifyDescription, n)
243
260
  }]
244
261
  } : {
245
262
  variant: "account-added",
246
- description: a(m.summaryAccountAddedDescription, n),
263
+ description: a(d.summaryAccountAddedDescription, n),
247
264
  nextSteps: []
248
265
  };
249
- })(O) : void 0, Qt = Ee(Z, m, x, {
250
- labels: p,
251
- onEditSelect: Ft,
252
- onVerifySelect: Rt,
253
- onLinkSelect: Ht,
254
- onUnlinkSelect: Ut
255
- }), $t = s(() => {
256
- if (!z.isError && !B.isError && !$) return;
257
- let e = z.error ?? B.error ?? ($ ? U.error : void 0);
258
- return ee(e) ?? p.actionErrorTitle;
266
+ })(T) : void 0, hn = De(Z, d, v, {
267
+ labels: u,
268
+ onEditSelect: Kt,
269
+ onVerifySelect: Yt,
270
+ onSendDepositsSelect: $t,
271
+ onUnlinkSelect: nn
272
+ }), gn = s(() => {
273
+ if (!R.isError && !z.isError && !$) return;
274
+ let e = R.error ?? z.error ?? ($ ? H.error : void 0);
275
+ return r(e) ?? u.connectErrorTitle;
259
276
  }, [
277
+ R.error,
278
+ R.isError,
260
279
  z.error,
261
280
  z.isError,
262
- B.error,
263
- B.isError,
264
281
  $,
265
- U.error,
266
- p.actionErrorTitle
282
+ H.error,
283
+ u.connectErrorTitle
267
284
  ]);
268
285
  return {
269
- rows: Qt,
270
- isLoading: !Ye && (Je && !R.data || qe && !v || S && R.isLoading),
271
- isError: Ye || S && R.isError,
272
- isConnectOpen: w,
273
- isEditOpen: at,
274
- isVerifyOpen: ot,
275
- isVerifySuccess: ct,
276
- verifyAccountName: Z.find((e) => e.id === C)?.nickname,
277
- verifyAccountNumber: Z.find((e) => e.id === C)?.accountNumber,
278
- isUnlinkOpen: !!P,
279
- unlinkAccountNumber: Z.find((e) => e.id === P)?.accountNumber,
280
- connectStep: T,
281
- accessRows: Yt,
282
- accessGrantedCount: Xt,
283
- connectSummary: Zt,
284
- isTeamMembersLoading: bt,
285
- isTeamMembersError: K.isError || yt,
286
- isConnectNextDisabled: T === 1 ? !_e(J) : T === 2 && !xt,
287
- isConnectRoutingNumberInvalid: J.routingNumber.trim() !== "" && !ve(J.routingNumber),
288
- connectErrorMessage: $t,
289
- isVerifyFirstAmountInvalid: L.firstAmount.trim() !== "" && !ye(L.firstAmount),
290
- isVerifySecondAmountInvalid: L.secondAmount.trim() !== "" && !ye(L.secondAmount),
291
- isVerifySubmitDisabled: !be(L),
292
- isActionDisabled: Jt,
293
- canConnect: qt,
294
- isSubmitting: Kt,
295
- isActionError: U.isError || H.isError || z.isError || B.isError || V.isError || W.isError || lt,
296
- isConnectError: z.isError || B.isError || $,
297
- isEditError: V.isError,
298
- isVerifyError: W.isError || lt,
299
- connectForm: J,
300
- editForm: pt,
301
- verifyForm: L,
302
- onConnectOpenChange: Pt,
303
- onEditOpenChange: It,
304
- onVerifyOpenChange: zt,
305
- onUnlinkOpenChange: Wt,
306
- onConnectFormChange: Ct,
307
- onEditFormChange: mt,
308
- onVerifyFormChange: Bt,
309
- onConnectNext: Dt,
310
- onConnectBack: Ot,
311
- onEditSubmit: Lt,
312
- onVerifySubmit: Vt,
313
- onUnlinkConfirm: Gt
286
+ rows: hn,
287
+ isLoading: !g && (h && !L.data || Qe && !m || y && L.isLoading),
288
+ isError: g || y && L.isError,
289
+ onRetry: g ? et : () => void L.refetch(),
290
+ isConnectOpen: x,
291
+ isEditOpen: ut,
292
+ isVerifyOpen: dt,
293
+ verifyAccountName: Z.find((e) => e.id === b)?.nickname,
294
+ verifyAccountNumber: Z.find((e) => e.id === b)?.accountNumber,
295
+ isUnlinkOpen: !!j,
296
+ unlinkAccountNumber: Z.find((e) => e.id === j)?.accountNumber,
297
+ isSendDepositsOpen: !!N,
298
+ sendDepositsAccountNumber: Z.find((e) => e.id === N)?.accountNumber,
299
+ connectStep: S,
300
+ accessRows: fn,
301
+ accessGrantedCount: pn,
302
+ connectSummary: mn,
303
+ isTeamMembersLoading: Y,
304
+ isTeamMembersError: kt,
305
+ onTeamMembersRetry: jt,
306
+ isConnectRequiredErrorVisible: ht,
307
+ isConnectRoutingNumberInvalid: q.routingNumber.trim() !== "" && !ye(q.routingNumber),
308
+ connectErrorMessage: gn,
309
+ isVerifyFirstAmountInvalid: I.firstAmount.trim() !== "" && !be(I.firstAmount),
310
+ isVerifySecondAmountInvalid: I.secondAmount.trim() !== "" && !be(I.secondAmount),
311
+ isVerifyRequiredErrorVisible: ft,
312
+ isActionDisabled: cn,
313
+ isAuthPending: ln,
314
+ canConnect: sn,
315
+ isSubmitting: on,
316
+ isConnectError: R.isError || z.isError || $,
317
+ isEditError: B.isError,
318
+ isUnlinkError: V.isError,
319
+ isSendDepositsError: H.isError && ct === "row",
320
+ isVerifyError: U.isError || mt,
321
+ connectForm: q,
322
+ editForm: bt,
323
+ verifyForm: I,
324
+ onConnectOpenChange: Gt,
325
+ onEditOpenChange: qt,
326
+ onVerifyOpenChange: Xt,
327
+ onUnlinkOpenChange: rn,
328
+ onSendDepositsOpenChange: en,
329
+ onConnectFormChange: Nt,
330
+ onEditFormChange: xt,
331
+ onVerifyFormChange: Zt,
332
+ onConnectNext: Lt,
333
+ onConnectBack: Rt,
334
+ onEditSubmit: Jt,
335
+ onVerifySubmit: Qt,
336
+ onUnlinkConfirm: an,
337
+ onSendDepositsConfirm: tn
314
338
  };
315
339
  }
316
- export { l as LOCALLY_SENT_MICRO_DEPOSIT_ACCOUNT_IDS_STORAGE_KEY, p as useLinkedAccountsWidget };
340
+ export { l as LOCALLY_SENT_MICRO_DEPOSIT_ACCOUNT_IDS_STORAGE_KEY, u as useLinkedAccountsWidget };
@@ -1,15 +1,15 @@
1
1
  // ../../libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/mocks/labels.js
2
2
  var e = {
3
3
  blurbs: {
4
- populated: "Five external accounts: verified, unverified, deposits sent, failed, and inactive. Press Link to send micro-deposits, Click here to verify and enter any two amounts from $0.01 to $0.99, or use Edit and Unlink. Add external account runs the whole wizard; use routing number 123456780.",
5
- empty: "The organization has linked no external accounts. Add external account is still offered.",
4
+ populated: "Five external accounts: verified, unverified, deposits sent, failed, and inactive. Verify on the unverified account sends micro-deposits; Verify on the one with deposits sent takes any two amounts from $0.01 to $0.99. The failed account asks you to check its numbers. The ⋯ menu has Edit and Unlink. Link account runs the whole flow; use routing number 123456780.",
5
+ empty: "The organization has linked no external accounts. The empty state offers Link account.",
6
6
  loading: "The accounts read is held open, so the list skeleton stays on screen.",
7
- error: "The accounts read fails with a 500. The widget says so in a line of text and offers no retry.",
8
- "control-hidden": "The same accounts, read by a session without external_bank_account:write:org. There is no Add external account, Edit, Unlink or Click here to verify. Link stays, because it has its own scope."
7
+ error: "The accounts read fails with a 500. The widget says it couldn't load linked accounts and offers Try again.",
8
+ "control-hidden": "The same accounts, read by a session without external_bank_account:write:org. There is no Link account or ⋯ menu, and only the unverified account offers Verify, to send deposits, because that has its own scope."
9
9
  },
10
10
  scenarios: { "no-micro-deposits": {
11
11
  label: "No micro-deposit scope",
12
- blurb: "The session can write but lacks external_bank_account:micro_deposit:org. No row offers Link, and Add external account finishes without sending deposits, so the new account stays unverified."
12
+ blurb: "The session can write but lacks external_bank_account:micro_deposit:org. The unverified account offers no Verify, since that would send deposits, while the one with deposits sent still does. Link account finishes without sending deposits, so the new account stays unverified."
13
13
  } }
14
14
  };
15
15
  export { e as LINKED_ACCOUNTS_LABELS };
@@ -1,3 +1,3 @@
1
- import { DEFAULT_LABELS as e } from "./index15.js";
2
- import { LinkedAccountsWidgetUi as t } from "./index16.js";
1
+ import { DEFAULT_LABELS as e } from "./index13.js";
2
+ import { LinkedAccountsWidgetUi as t } from "./index14.js";
3
3
  export { e as DEFAULT_LABELS, t as LinkedAccountsWidgetUi };