@tesouro/embedded-components-react 0.11.167 → 0.11.168

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 (20) hide show
  1. package/dist/index.d.ts +3 -0
  2. package/dist/lib/BankAccountsWidget.d.ts +1 -0
  3. package/dist/lib/CreditCardsWidget.d.ts +1 -0
  4. package/dist/lib/DebitCardsWidget.d.ts +1 -0
  5. package/dist/lib/LinkedAccountsWidget.d.ts +1 -0
  6. package/dist/lib/WidgetSuite.d.ts +3 -0
  7. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/BankAccountsWidget/BankAccountsWidget.js +1 -0
  8. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +122 -121
  9. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankAccountsWidgetUi.js +63 -59
  10. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/labels.js +1 -0
  11. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/testIds.js +2 -0
  12. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/useCardsWidget.js +161 -160
  13. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +126 -122
  14. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/labels.js +1 -0
  15. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +192 -191
  16. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index13.js +2 -1
  17. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index14.js +100 -96
  18. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index6.js +1 -0
  19. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  20. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -2537,6 +2537,7 @@ interface Labels$4 {
2537
2537
  routingNumberLabel: string;
2538
2538
  addAccountButton: string;
2539
2539
  emptyAccountsLabel: string;
2540
+ accessRestrictedTitle: string;
2540
2541
  createDialogTitle: string;
2541
2542
  createDialogSubtitle: string;
2542
2543
  createNicknameLabel: string;
@@ -2752,6 +2753,7 @@ interface CardsListLabels {
2752
2753
  loadingLabel: string;
2753
2754
  emptyTitle: string;
2754
2755
  emptyDescription: string;
2756
+ accessRestrictedTitle: string;
2755
2757
  errorTitle: string;
2756
2758
  errorDescription: string;
2757
2759
  retryButton: string;
@@ -5193,6 +5195,7 @@ interface Labels$1 {
5193
5195
  verifyErrorTitle: string;
5194
5196
  emptyTitle: string;
5195
5197
  emptyDescription: string;
5198
+ accessRestrictedTitle: string;
5196
5199
  }
5197
5200
 
5198
5201
  interface FeatureLabels$2 {
@@ -10,6 +10,7 @@ interface Labels$1 {
10
10
  routingNumberLabel: string;
11
11
  addAccountButton: string;
12
12
  emptyAccountsLabel: string;
13
+ accessRestrictedTitle: string;
13
14
  createDialogTitle: string;
14
15
  createDialogSubtitle: string;
15
16
  createNicknameLabel: string;
@@ -87,6 +87,7 @@ interface CardsListLabels {
87
87
  loadingLabel: string;
88
88
  emptyTitle: string;
89
89
  emptyDescription: string;
90
+ accessRestrictedTitle: string;
90
91
  errorTitle: string;
91
92
  errorDescription: string;
92
93
  retryButton: string;
@@ -87,6 +87,7 @@ interface CardsListLabels {
87
87
  loadingLabel: string;
88
88
  emptyTitle: string;
89
89
  emptyDescription: string;
90
+ accessRestrictedTitle: string;
90
91
  errorTitle: string;
91
92
  errorDescription: string;
92
93
  retryButton: string;
@@ -85,6 +85,7 @@ interface Labels {
85
85
  verifyErrorTitle: string;
86
86
  emptyTitle: string;
87
87
  emptyDescription: string;
88
+ accessRestrictedTitle: string;
88
89
  }
89
90
 
90
91
  type AuthToken = string | undefined;
@@ -1652,6 +1652,7 @@ interface Labels$4 {
1652
1652
  routingNumberLabel: string;
1653
1653
  addAccountButton: string;
1654
1654
  emptyAccountsLabel: string;
1655
+ accessRestrictedTitle: string;
1655
1656
  createDialogTitle: string;
1656
1657
  createDialogSubtitle: string;
1657
1658
  createNicknameLabel: string;
@@ -1866,6 +1867,7 @@ interface CardsListLabels {
1866
1867
  loadingLabel: string;
1867
1868
  emptyTitle: string;
1868
1869
  emptyDescription: string;
1870
+ accessRestrictedTitle: string;
1869
1871
  errorTitle: string;
1870
1872
  errorDescription: string;
1871
1873
  retryButton: string;
@@ -4089,6 +4091,7 @@ interface Labels$1 {
4089
4091
  verifyErrorTitle: string;
4090
4092
  emptyTitle: string;
4091
4093
  emptyDescription: string;
4094
+ accessRestrictedTitle: string;
4092
4095
  }
4093
4096
 
4094
4097
  interface FeatureLabels$2 {
@@ -42,6 +42,7 @@ function l({ labels: e, accountDetailsLabels: r, featureLabels: l, isBankingTagl
42
42
  return /* @__PURE__ */ c(o, { children: [/* @__PURE__ */ s(t, {}), /* @__PURE__ */ s(n, {
43
43
  labels: e,
44
44
  accountCardTestId: "bank-accounts-widget-account-card",
45
+ accessRestrictedTestId: "bank-accounts-widget-access-restricted",
45
46
  ...C
46
47
  })] });
47
48
  }
@@ -5,56 +5,56 @@
5
5
  import { toast as e } from "../../../../../../node_modules/sonner/dist/index.js";
6
6
  import { TESOURO_NEW_EMBEDDED_BANK_ACCOUNT_CREATED_SUCCESS_EVENT as t, emitWidgetDomEvent as n } from "../../../../shared/util/dist/lib/widgetDomEvents.js";
7
7
  import "../../../../shared/util/dist/index.js";
8
- import { OrganizationStatus as r, isOrganizationOnItsWay as ee } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
9
- import { useEmbedApi as te } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
10
- import { Scope as ne } from "../../../../shared/data-access/dist/lib/scopes.js";
8
+ import { OrganizationStatus as ee, isOrganizationOnItsWay as te } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
9
+ import { useEmbedApi as ne } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
10
+ import { Scope as r } from "../../../../shared/data-access/dist/lib/scopes.js";
11
11
  import { useAllBankAccountsQuery as re } from "../../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
12
12
  import { useAllOrganizationRolesQuery as ie } from "../../../../shared/data-access/dist/lib/role/useAllOrganizationRolesQuery.js";
13
13
  import "../../../../shared/data-access/dist/index.js";
14
14
  import { BankAccountsWidgetAnalyticsEvent as i } from "./BankAccountsWidget/analytics/events.js";
15
- import { accountNumberLast4 as a, copyTextToClipboard as ae, formatAmountLabel as o, formatTotalAvailableBalanceLabel as oe } from "./formatters.js";
16
- import { DEFAULT_FEATURE_LABELS as se } from "./labels.js";
17
- import { getBankAccountsPermissions as ce } from "./permissions.js";
18
- import { toAccessRows as le, toOrganizationRoleOptions as ue, toTeamMembers as de } from "./teamMembers.js";
19
- import { DEFAULT_LABELS as fe } from "../../../ui/dist/lib/labels.js";
15
+ import { accountNumberLast4 as ae, copyTextToClipboard as oe, formatAmountLabel as a, formatTotalAvailableBalanceLabel as se } from "./formatters.js";
16
+ import { DEFAULT_FEATURE_LABELS as ce } from "./labels.js";
17
+ import { getBankAccountsPermissions as le } from "./permissions.js";
18
+ import { toAccessRows as ue, toOrganizationRoleOptions as de, toTeamMembers as fe } from "./teamMembers.js";
19
+ import { DEFAULT_LABELS as pe } from "../../../ui/dist/lib/labels.js";
20
20
  import "../../../../shared/ui/dist/index.js";
21
21
  import "../../../ui/dist/index.js";
22
- import { useAnalyticsTrack as pe } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
23
- import { useRefetchWidget as me, useWidgetConfig as he, useWidgetError as ge, useWidgetLoading as _e } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
22
+ import { useAnalyticsTrack as me } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
23
+ import { useRefetchWidget as he, useWidgetConfig as ge, useWidgetError as _e, useWidgetInitStaleForToken as ve, useWidgetLoading as ye } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
24
24
  import "../../../../shared/feature/dist/index.js";
25
- import { useCreateBankAccountMutation as ve } from "../../../data-access/dist/index3.js";
26
- import { useGrantBankAccountAccessMutation as ye } from "../../../data-access/dist/index4.js";
27
- import { useAllOrganizationUsersQuery as be } from "../../../data-access/dist/index5.js";
25
+ import { useCreateBankAccountMutation as be } from "../../../data-access/dist/index3.js";
26
+ import { useGrantBankAccountAccessMutation as xe } from "../../../data-access/dist/index4.js";
27
+ import { useAllOrganizationUsersQuery as Se } from "../../../data-access/dist/index5.js";
28
28
  import "../../../data-access/dist/index.js";
29
- import { filterRolesForOrganization as xe } from "../../../../../shared/util-validation/dist/index6.js";
30
- import { useCallback as Se, useEffect as Ce, useMemo as s, useRef as we, useState as c } from "react";
31
- import { useControllableState as Te } from "@radix-ui/react-use-controllable-state";
29
+ import { filterRolesForOrganization as Ce } from "../../../../../shared/util-validation/dist/index6.js";
30
+ import { useCallback as we, useEffect as o, useMemo as s, useRef as Te, useState as c } from "react";
31
+ import { useControllableState as Ee } from "@radix-ui/react-use-controllable-state";
32
32
  // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js
33
- var l = { nickname: "" }, Ee = ne.BankAccountWriteOrg;
33
+ var l = { nickname: "" }, De = r.BankAccountWriteOrg;
34
34
  function u(e, t) {
35
35
  return e !== void 0 && t !== void 0 && e !== t;
36
36
  }
37
- function De({ labels: ne, featureLabels: a, isBankingTaglineVisible: o = !0, bankLogoSrc: De, bankLogoAlt: ke, depositAgreementUrl: Ae, selectedAccountId: je, defaultSelectedAccountId: Me, onSelectedAccountIdChange: Ne, "data-testid": Pe } = {}) {
38
- let Fe = {
39
- ...fe,
40
- ...ne
37
+ function Oe({ labels: r, featureLabels: ae, isBankingTaglineVisible: a = !0, bankLogoSrc: Oe, bankLogoAlt: Ae, depositAgreementUrl: je, selectedAccountId: Me, defaultSelectedAccountId: Ne, onSelectedAccountIdChange: Pe, "data-testid": Fe } = {}) {
38
+ let Ie = {
39
+ ...pe,
40
+ ...r
41
41
  }, d = {
42
- ...se,
43
- ...a
44
- }, f = pe(), { organizationId: p, widgetToken: m, initResponse: h } = he(), Ie = _e(), { organizationStatus: g } = te(), _ = ee(g), v = !!ge(), Le = me(), y = !!(p && m), Re = y || !!m && g === r.Rotating, b = s(() => ce(h?.scopes), [h?.scopes]), ze = Re && b.canRead && !!h, x = h?.userId ?? void 0, [S, Be] = c(p);
45
- p !== void 0 && p !== S && Be(p);
46
- let [C, Ve] = c(x);
47
- x !== void 0 && x !== C && Ve(x);
48
- let [He, w] = Te({
49
- prop: je,
50
- defaultProp: Me ?? null,
51
- onChange: Ne,
42
+ ...ce,
43
+ ...ae
44
+ }, f = me(), { organizationId: p, widgetToken: Le, initResponse: m } = ge(), Re = ye(), h = ve(), { organizationStatus: g } = ne(), _ = te(g), v = !!_e(), ze = he(), y = !!(p && Le), Be = y || !!Le && g === ee.Rotating, b = s(() => le(m?.scopes), [m?.scopes]), Ve = Be && b.canRead && !!m, x = m?.userId ?? void 0, [S, He] = c(p);
45
+ p !== void 0 && p !== S && He(p);
46
+ let [C, Ue] = c(x);
47
+ x !== void 0 && x !== C && Ue(x);
48
+ let [We, w] = Ee({
49
+ prop: Me,
50
+ defaultProp: Ne ?? null,
51
+ onChange: Pe,
52
52
  caller: "BankAccountsWidget"
53
- }), T = we({
53
+ }), T = Te({
54
54
  organizationId: S,
55
55
  userId: C
56
- }), Ue = u(T.current.organizationId, S) || u(T.current.userId, C);
57
- Ce(() => {
56
+ }), Ge = u(T.current.organizationId, S) || u(T.current.userId, C);
57
+ o(() => {
58
58
  let e = T.current;
59
59
  T.current = {
60
60
  organizationId: S,
@@ -65,142 +65,143 @@ function De({ labels: ne, featureLabels: a, isBankingTaglineVisible: o = !0, ban
65
65
  C,
66
66
  w
67
67
  ]);
68
- let E = Ue ? null : He, D = ze && !E, O = Se((e) => {
68
+ let Ke = h && !b.canRead, E = !v && !h && !!m && !b.canRead, qe = Ge || E ? null : We, D = Ve && !qe, O = we((e) => {
69
69
  w(e);
70
- }, [w]), [k, A] = c(!1), [j, M] = c(l), [We, N] = c([]), [Ge, P] = c(!1), [Ke, F] = c(!1), [qe, I] = c(), [Je, Ye] = c({}), [L, Xe] = c({});
71
- Ce(() => {
70
+ }, [w]), [k, A] = c(!1), [j, M] = c(l), [N, P] = c([]), [Je, F] = c(!1), [Ye, I] = c(!1), [Xe, L] = c(), [Ze, Qe] = c({}), [R, $e] = c({});
71
+ o(() => {
72
72
  f(i.Mounted);
73
73
  }, [f]);
74
- let R = re({ enabled: D }), z = ve(), B = ye(), V = k, H = be({ enabled: V }), U = ie({ enabled: V }), W = be({
75
- enabled: V,
76
- permissions: [Ee]
77
- }), Ze = s(() => new Set((W.data?.data ?? []).filter((e) => e.organizationId === p).map((e) => e.id)), [W.data?.data, p]), G = s(() => {
78
- let e = U.data?.data ?? [], t = p ? xe(e, {
74
+ let z = re({ enabled: D }), B = be(), V = xe(), H = k && !E, U = Se({ enabled: H }), W = ie({ enabled: H }), G = Se({
75
+ enabled: H,
76
+ permissions: [De]
77
+ }), et = s(() => new Set((G.data?.data ?? []).filter((e) => e.organizationId === p).map((e) => e.id)), [G.data?.data, p]), K = s(() => {
78
+ let e = W.data?.data ?? [], t = p ? Ce(e, {
79
79
  organizationId: p,
80
- organizationTypes: h?.organizationTypes ?? []
80
+ organizationTypes: m?.organizationTypes ?? []
81
81
  }) : e;
82
- return de(H.data?.data ?? [], ue(t), Ze);
82
+ return fe(U.data?.data ?? [], de(t), et);
83
83
  }, [
84
- Ze,
84
+ et,
85
+ W.data?.data,
85
86
  U.data?.data,
86
- H.data?.data,
87
87
  p,
88
- h?.organizationTypes
89
- ]), Qe = H.isError && H.isFetching, $e = W.isError && W.isFetching, K = H.isLoading || H.isFetchingNextPage || !!H.hasNextPage || Qe || U.isResolving || W.isLoading || W.isFetchingNextPage || !!W.hasNextPage || $e, et = H.isError && !Qe || W.isError && !$e, tt = !K && !et, nt = () => {
88
+ m?.organizationTypes
89
+ ]), tt = U.isError && U.isFetching, nt = G.isError && G.isFetching, q = U.isLoading || U.isFetchingNextPage || !!U.hasNextPage || tt || W.isResolving || G.isLoading || G.isFetchingNextPage || !!G.hasNextPage || nt, rt = U.isError && !tt || G.isError && !nt, it = !q && !rt, at = () => {
90
90
  for (let e of [
91
- H,
92
- W,
93
- U
91
+ U,
92
+ G,
93
+ W
94
94
  ]) e.isError && e.refetch();
95
- }, q = D ? R.data?.data ?? [] : [], J = [.../* @__PURE__ */ new Set([...G.filter((e) => e.locked).map((e) => e.id), ...We])], rt = h?.bankName?.trim() ?? "", it = h?.vspName?.trim() ?? "", at = Ae?.trim() || void 0, Y = y && b.canWrite, X = !R.hasNextPage && !R.isFetchingNextPage, ot = s(() => X ? oe(q) : void 0, [q, X]), st = q.length > 1 && b.canRead && X, Z = Se(async (e, t, n) => {
96
- await ae(n) && (Xe((n) => ({
95
+ }, J = D ? z.data?.data ?? [] : [], ot = [.../* @__PURE__ */ new Set([...K.filter((e) => e.locked).map((e) => e.id), ...N])], Y = m?.bankName?.trim() ?? "", st = m?.vspName?.trim() ?? "", ct = je?.trim() || void 0, X = y && b.canWrite && !E, Z = !z.hasNextPage && !z.isFetchingNextPage, lt = s(() => Z ? se(J) : void 0, [J, Z]), ut = J.length > 1 && b.canRead && Z, Q = we(async (e, t, n) => {
96
+ await oe(n) && ($e((n) => ({
97
97
  ...n,
98
98
  [e]: t
99
99
  })), window.setTimeout(() => {
100
- Xe((t) => ({
100
+ $e((t) => ({
101
101
  ...t,
102
102
  [e]: void 0
103
103
  }));
104
104
  }, 2e3));
105
- }, []), ct = s(() => q.map((e) => Oe(e, d, {
106
- isAccountNumberVisible: Je[e.id] ?? !1,
107
- isAccountNumberCopied: L[e.id] === "account",
108
- isRoutingNumberCopied: L[e.id] === "routing",
109
- onToggleAccountNumberVisibility: () => Ye((t) => ({
105
+ }, []), dt = s(() => J.map((e) => ke(e, d, {
106
+ isAccountNumberVisible: Ze[e.id] ?? !1,
107
+ isAccountNumberCopied: R[e.id] === "account",
108
+ isRoutingNumberCopied: R[e.id] === "routing",
109
+ onToggleAccountNumberVisibility: () => Qe((t) => ({
110
110
  ...t,
111
111
  [e.id]: !t[e.id]
112
112
  })),
113
- onCopyAccountNumber: () => void Z(e.id, "account", e.accountNumber),
114
- onCopyRoutingNumber: () => void Z(e.id, "routing", e.routingNumber),
113
+ onCopyAccountNumber: () => void Q(e.id, "account", e.accountNumber),
114
+ onCopyRoutingNumber: () => void Q(e.id, "routing", e.routingNumber),
115
115
  onSelect: () => {
116
116
  O(e.id), f(i.AccountSelected, { accountId: e.id });
117
117
  }
118
118
  })), [
119
- q,
120
- Je,
121
- L,
119
+ J,
120
+ Ze,
121
+ R,
122
122
  d,
123
- Z,
123
+ Q,
124
124
  O,
125
125
  f
126
- ]), lt = (r) => {
127
- B.mutate({
128
- path: { id: r },
129
- body: { userIds: J }
126
+ ]), ft = (ee) => {
127
+ V.mutate({
128
+ path: { id: ee },
129
+ body: { userIds: ot }
130
130
  }, { onSuccess: () => {
131
- n(t), e.success(d.createSuccessToast), M(l), N([]), I(void 0), P(!1), A(!1);
131
+ n(t), e.success(d.createSuccessToast), M(l), P([]), L(void 0), F(!1), A(!1);
132
132
  } });
133
- }, ut = () => {
134
- if (!Y) return;
135
- if (!tt) {
136
- K || nt();
133
+ }, pt = () => {
134
+ if (!X) return;
135
+ if (!it) {
136
+ q || at();
137
137
  return;
138
138
  }
139
- let e = j.nickname.trim() === "", t = J.length === 0;
140
- P(e), F(t), !(e || t) && (qe ? lt(qe) : z.mutate({ body: { nickname: j.nickname.trim() } }, { onSuccess: (e) => {
141
- f(i.AccountCreated, { accountId: e?.id }), e?.id && (I(e.id), lt(e.id));
139
+ let e = j.nickname.trim() === "", t = ot.length === 0;
140
+ F(e), I(t), !(e || t) && (Xe ? ft(Xe) : B.mutate({ body: { nickname: j.nickname.trim() } }, { onSuccess: (e) => {
141
+ f(i.AccountCreated, { accountId: e?.id }), e?.id && (L(e.id), ft(e.id));
142
142
  } }));
143
- }, dt = (e, t) => {
144
- G.find((t) => t.id === e)?.locked || (F(!1), N((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e)));
145
- }, ft = (e) => {
146
- (!e || Y) && (e && (M(l), N([]), I(void 0), P(!1), F(!1), z.reset(), B.reset()), A(e));
147
- }, Q = z.isPending || B.isPending, pt = !y && _, $ = !y && !_, [mt, ht] = c($);
148
- $ !== mt && (ht($), $ && A(!1));
149
- let gt = le(G, {
150
- selectedUserIds: We,
151
- disabled: Q || !b.canWrite,
152
- fallbackTooltip: Fe.teamMemberAccessTooltip,
153
- onUserToggle: dt
143
+ }, mt = (e, t) => {
144
+ K.find((t) => t.id === e)?.locked || (I(!1), P((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e)));
145
+ }, ht = (e) => {
146
+ (!e || X) && (e && (M(l), P([]), L(void 0), F(!1), I(!1), B.reset(), V.reset()), A(e));
147
+ }, gt = B.isPending || V.isPending, _t = !y && _, $ = !y && !_ || E, [vt, yt] = c($);
148
+ $ !== vt && (yt($), $ && A(!1));
149
+ let bt = ue(K, {
150
+ selectedUserIds: N,
151
+ disabled: gt || !b.canWrite,
152
+ fallbackTooltip: Ie.teamMemberAccessTooltip,
153
+ onUserToggle: mt
154
154
  });
155
155
  return {
156
- "data-testid": Pe,
157
- selectedAccountId: E,
158
- bankDisplayName: rt,
159
- bankLogoSrc: De,
160
- bankLogoAlt: ke,
161
- availableBalanceLabel: ot,
162
- shouldDisplayAvailableBalance: st,
163
- isBankingTaglineVisible: o,
164
- accountCards: ct,
156
+ "data-testid": Fe,
157
+ selectedAccountId: qe,
158
+ bankDisplayName: Y,
159
+ bankLogoSrc: Oe,
160
+ bankLogoAlt: Ae,
161
+ availableBalanceLabel: lt,
162
+ shouldDisplayAvailableBalance: ut,
163
+ isBankingTaglineVisible: a,
164
+ accountCards: dt,
165
165
  shouldDisplayAddAccountCard: b.canWrite,
166
- isLoading: !v && (_ && !R.data || Ie && !h || D && (R.isLoading || R.isFetchingNextPage || R.hasNextPage)),
167
- isError: v || D && R.isError,
168
- onRetry: v ? Le : () => void R.refetch(),
166
+ isLoading: !v && (Ke || _ && !z.data || Re && !m || D && (z.isLoading || z.isFetchingNextPage || z.hasNextPage)),
167
+ isError: v || D && z.isError,
168
+ isAccessRestricted: E,
169
+ onRetry: v ? ze : () => void z.refetch(),
169
170
  isCreateOpen: k,
170
171
  createForm: j,
171
172
  legalCopy: {
172
- bankName: rt,
173
- vspName: it,
174
- agreementUrl: at
173
+ bankName: Y,
174
+ vspName: st,
175
+ agreementUrl: ct
175
176
  },
176
- accessRows: gt,
177
- isTeamMembersLoading: K,
178
- isTeamMembersError: et,
179
- isCreateError: z.isError || B.isError,
180
- hasNicknameError: Ge,
181
- hasTeamAccessError: Ke,
182
- isSubmitting: Q,
183
- isAuthPending: pt,
184
- isCreateDisabled: !Y,
185
- onCreateOpenChange: ft,
177
+ accessRows: bt,
178
+ isTeamMembersLoading: q,
179
+ isTeamMembersError: rt,
180
+ isCreateError: B.isError || V.isError,
181
+ hasNicknameError: Je,
182
+ hasTeamAccessError: Ye,
183
+ isSubmitting: gt,
184
+ isAuthPending: _t,
185
+ isCreateDisabled: !X,
186
+ onCreateOpenChange: ht,
186
187
  onCreateFormChange: (e) => {
187
- P(!1), M(e);
188
+ F(!1), M(e);
188
189
  },
189
- onCreateSubmit: ut,
190
- onTeamMembersRetry: nt,
191
- onAddAccountClick: () => ft(!0),
190
+ onCreateSubmit: pt,
191
+ onTeamMembersRetry: at,
192
+ onAddAccountClick: () => ht(!0),
192
193
  onSelectAccount: O
193
194
  };
194
195
  }
195
- function Oe(e, t, n) {
196
+ function ke(e, t, n) {
196
197
  return {
197
198
  id: e.id,
198
199
  name: e.nickname?.trim() || t.accountFallback,
199
- balanceLabel: o(e.balance),
200
+ balanceLabel: a(e.balance),
200
201
  accountNumberLabel: e.accountNumber,
201
- accountNumberLast4: a(e.accountNumber),
202
+ accountNumberLast4: ae(e.accountNumber),
202
203
  routingNumberLabel: e.routingNumber,
203
204
  ...n
204
205
  };
205
206
  }
206
- export { De as useBankAccountsWidget };
207
+ export { Oe as useBankAccountsWidget };
@@ -7,78 +7,82 @@ import { DEFAULT_LABELS as t } from "./labels.js";
7
7
  import { AddTile as n } from "../../../../shared/ui/dist/lib/AddTile/AddTile.js";
8
8
  import { EmptyState as r } from "../../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
9
9
  import { ErrorState as i } from "../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
10
- import { LoadingRegion as a } from "../../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
10
+ import { NoAccessState as a } from "../../../../shared/ui/dist/lib/StatePanel/NoAccessState.js";
11
+ import { LoadingRegion as o } from "../../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
11
12
  import "../../../../shared/ui/dist/index.js";
12
- import { AccountCard as o, AccountCardSkeleton as s } from "./AccountCard.js";
13
- import { BankingHeader as c } from "./BankingHeader.js";
14
- import { CreateAccountDialog as l } from "./CreateAccountDialog.js";
15
- import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
16
- import { LandmarkIcon as p } from "lucide-react";
13
+ import { AccountCard as s, AccountCardSkeleton as c } from "./AccountCard.js";
14
+ import { BankingHeader as l } from "./BankingHeader.js";
15
+ import { CreateAccountDialog as u } from "./CreateAccountDialog.js";
16
+ import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
17
+ import { LandmarkIcon as m } from "lucide-react";
17
18
  // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankAccountsWidgetUi.js
18
- function m({ labels: m, "data-testid": h, bankDisplayName: g, bankLogoSrc: _, bankLogoAlt: v, availableBalanceLabel: y, shouldDisplayAvailableBalance: b, isBankingTaglineVisible: x, accountCards: S, accountCardTestId: C, shouldDisplayAddAccountCard: w, isLoading: T, isError: E, onRetry: D, isCreateOpen: O, createForm: k, legalCopy: A, accessRows: j, isTeamMembersLoading: M, isTeamMembersError: N, isCreateError: P, hasNicknameError: F, hasTeamAccessError: I, isSubmitting: L, isAuthPending: R = !1, isCreateDisabled: z, onCreateOpenChange: B, onCreateFormChange: V, onCreateSubmit: H, onTeamMembersRetry: U, onAddAccountClick: W }) {
19
- let G = {
19
+ function h({ labels: h, "data-testid": g, bankDisplayName: _, bankLogoSrc: v, bankLogoAlt: y, availableBalanceLabel: b, shouldDisplayAvailableBalance: x, isBankingTaglineVisible: S, accountCards: C, accountCardTestId: w, shouldDisplayAddAccountCard: T, isLoading: E, isError: D, isAccessRestricted: O = !1, accessRestrictedTestId: k, onRetry: A, isCreateOpen: j, createForm: M, legalCopy: N, accessRows: P, isTeamMembersLoading: F, isTeamMembersError: I, isCreateError: L, hasNicknameError: R, hasTeamAccessError: z, isSubmitting: B, isAuthPending: V = !1, isCreateDisabled: H, onCreateOpenChange: U, onCreateFormChange: W, onCreateSubmit: G, onTeamMembersRetry: K, onAddAccountClick: q }) {
20
+ let J = {
20
21
  ...t,
21
- ...m
22
- }, K = !T && !E && S.length === 0, q = w ? /* @__PURE__ */ d(n, {
23
- label: G.addAccountButton,
24
- disabled: z,
25
- onClick: W,
22
+ ...h
23
+ }, Y = !E && !D && C.length === 0, X = T ? /* @__PURE__ */ f(n, {
24
+ label: J.addAccountButton,
25
+ disabled: H,
26
+ onClick: q,
26
27
  className: "ttw:w-80 ttw:max-w-full ttw:min-h-52"
27
28
  }) : null;
28
- return /* @__PURE__ */ f("section", {
29
+ return /* @__PURE__ */ p("section", {
29
30
  className: "ttw:flex ttw:w-full ttw:flex-col ttw:gap-6",
30
- "data-testid": h,
31
+ "data-testid": g,
31
32
  children: [
32
- /* @__PURE__ */ d(l, {
33
- labels: G,
34
- open: O,
35
- form: k,
36
- legalCopy: A,
37
- accessRows: j,
38
- isTeamMembersLoading: M,
39
- isTeamMembersError: N,
40
- isSubmitting: L,
41
- isAuthPending: R,
42
- isError: P,
43
- hasNicknameError: F,
44
- hasTeamAccessError: I,
45
- onOpenChange: B,
46
- onFormChange: V,
47
- onSubmit: H,
48
- onTeamMembersRetry: U
33
+ /* @__PURE__ */ f(u, {
34
+ labels: J,
35
+ open: j,
36
+ form: M,
37
+ legalCopy: N,
38
+ accessRows: P,
39
+ isTeamMembersLoading: F,
40
+ isTeamMembersError: I,
41
+ isSubmitting: B,
42
+ isAuthPending: V,
43
+ isError: L,
44
+ hasNicknameError: R,
45
+ hasTeamAccessError: z,
46
+ onOpenChange: U,
47
+ onFormChange: W,
48
+ onSubmit: G,
49
+ onTeamMembersRetry: K
49
50
  }),
50
- /* @__PURE__ */ d(c, {
51
- labels: G,
52
- bankDisplayName: g,
53
- bankLogoSrc: _,
54
- bankLogoAlt: v,
55
- availableBalanceLabel: y,
56
- shouldDisplayAvailableBalance: b,
57
- isBankingTaglineVisible: x
51
+ /* @__PURE__ */ f(l, {
52
+ labels: J,
53
+ bankDisplayName: _,
54
+ bankLogoSrc: v,
55
+ bankLogoAlt: y,
56
+ availableBalanceLabel: b,
57
+ shouldDisplayAvailableBalance: x,
58
+ isBankingTaglineVisible: S
58
59
  }),
59
- E ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(i, {
60
- title: G.errorTitle,
61
- retryLabel: G.retryButton,
62
- onRetry: D
63
- }), q ? /* @__PURE__ */ d("div", {
60
+ O ? /* @__PURE__ */ f(a, {
61
+ title: J.accessRestrictedTitle,
62
+ testId: k
63
+ }) : D ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(i, {
64
+ title: J.errorTitle,
65
+ retryLabel: J.retryButton,
66
+ onRetry: A
67
+ }), X ? /* @__PURE__ */ f("div", {
64
68
  className: "ttw:flex ttw:flex-wrap ttw:gap-4",
65
- children: q
66
- }) : null] }) : K ? /* @__PURE__ */ d(r, {
67
- icon: /* @__PURE__ */ d(p, {}),
68
- title: G.emptyAccountsLabel,
69
- actionLabel: w ? G.addAccountButton : void 0,
70
- onAction: w && !z ? W : void 0
71
- }) : /* @__PURE__ */ d(a, {
72
- isLoading: T,
73
- loadingLabel: G.loadingLabel,
69
+ children: X
70
+ }) : null] }) : Y ? /* @__PURE__ */ f(r, {
71
+ icon: /* @__PURE__ */ f(m, {}),
72
+ title: J.emptyAccountsLabel,
73
+ actionLabel: T ? J.addAccountButton : void 0,
74
+ onAction: T && !H ? q : void 0
75
+ }) : /* @__PURE__ */ f(o, {
76
+ isLoading: E,
77
+ loadingLabel: J.loadingLabel,
74
78
  className: "ttw:flex ttw:flex-wrap ttw:gap-4",
75
- children: T ? /* @__PURE__ */ f(u, { children: [/* @__PURE__ */ d(s, {}), /* @__PURE__ */ d(s, {})] }) : /* @__PURE__ */ f(e, { children: [S.map((e) => /* @__PURE__ */ d(o, {
76
- labels: G,
79
+ children: E ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(c, {}), /* @__PURE__ */ f(c, {})] }) : /* @__PURE__ */ p(e, { children: [C.map((e) => /* @__PURE__ */ f(s, {
80
+ labels: J,
77
81
  card: e,
78
- testId: C
79
- }, e.id)), q] })
82
+ testId: w
83
+ }, e.id)), X] })
80
84
  })
81
85
  ]
82
86
  });
83
87
  }
84
- export { m as BankAccountsWidgetUi };
88
+ export { h as BankAccountsWidgetUi };
@@ -7,6 +7,7 @@ var e = {
7
7
  routingNumberLabel: "Routing number",
8
8
  addAccountButton: "Add account",
9
9
  emptyAccountsLabel: "No accounts yet",
10
+ accessRestrictedTitle: "You don't have access to bank accounts",
10
11
  createDialogTitle: "Create an account",
11
12
  createDialogSubtitle: "The account gets its own account number.",
12
13
  createNicknameLabel: "Account nickname",
@@ -4,11 +4,13 @@ var e = {
4
4
  row: "cards-list-row",
5
5
  empty: "cards-list-empty",
6
6
  error: "cards-list-error",
7
+ accessRestricted: "cards-list-access-restricted",
7
8
  detailsSheet: "cards-list-details-sheet"
8
9
  }, t = {
9
10
  root: e.list,
10
11
  empty: e.empty,
11
12
  error: e.error,
13
+ accessRestricted: e.accessRestricted,
12
14
  row: e.row
13
15
  }, n = { root: e.detailsSheet };
14
16
  export { n as cardsListDetailsSheetTestIds, t as cardsListTestIds, e as cardsWidgetTestIds };