@tesouro/embedded-components-react 0.11.59 → 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 (105) hide show
  1. package/README.md +37 -37
  2. package/dist/index.css +77 -230
  3. package/dist/index.d.ts +69 -23
  4. package/dist/lib/BankAccountsWidget.d.ts +20 -7
  5. package/dist/lib/CardDetailsWidget.d.ts +11 -3
  6. package/dist/lib/CreditCardsWidget.d.ts +19 -6
  7. package/dist/lib/DebitCardsWidget.d.ts +19 -6
  8. package/dist/lib/LinkedAccountsWidget.d.ts +30 -10
  9. package/dist/lib/WidgetSuite.d.ts +69 -23
  10. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index.js +5 -5
  11. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +21 -26
  12. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +18 -16
  13. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index5.js +22 -35
  14. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index6.js +29 -14
  15. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index7.js +20 -24
  16. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index8.js +31 -0
  17. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index.js +2 -2
  18. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index10.js +296 -0
  19. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index12.js +1 -0
  20. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index5.js +5 -10
  21. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js +42 -281
  22. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index.js +5 -3
  23. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index10.js +180 -0
  24. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index2.js +16 -184
  25. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index3.js +9 -93
  26. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index4.js +136 -81
  27. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index5.js +64 -101
  28. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index6.js +54 -81
  29. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index7.js +90 -65
  30. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index8.js +108 -183
  31. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index9.js +76 -0
  32. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/BankAccountsWidget/BankAccountsWidget.js +1 -1
  33. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/labels.js +6 -8
  34. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +137 -120
  35. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/mocks/labels.js +5 -5
  36. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js +47 -60
  37. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankAccountsWidgetUi.js +71 -72
  38. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankingHeader.js +22 -37
  39. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/CreateAccountDialog.js +119 -133
  40. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/labels.js +12 -8
  41. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/CardDetailsWidget.js +112 -110
  42. package/dist/libs/tesouro-embedded-components-react/card-details-widget/feature/dist/lib/cardDetailsView.js +1 -0
  43. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/index.js +0 -2
  44. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardPanel.js +94 -83
  45. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/ActivateCardSuccessView.js +32 -31
  46. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/ActivateCardPanel/labels.js +5 -2
  47. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardCredentialRow.js +41 -23
  48. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardCredentialsFace.js +3 -0
  49. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsHeader.js +30 -25
  50. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardDetailsPanel.js +162 -190
  51. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CardFace.js +2 -2
  52. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CopyButton.js +35 -0
  53. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/CopyableValue.js +18 -0
  54. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/NicknameEditor.js +43 -0
  55. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/cardFaceSurface.js +1 -1
  56. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/labels.js +12 -8
  57. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/feature/dist/index5.js +3 -3
  58. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/feature/dist/index8.js +110 -104
  59. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/CreateCardWidget.js +74 -68
  60. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/PreparingView.js +19 -18
  61. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/SetupView.js +110 -108
  62. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/SuccessView.js +33 -42
  63. package/dist/libs/tesouro-embedded-components-react/cards-widget/create-card/ui/dist/lib/CreateCardWidget/labels.js +10 -7
  64. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/labels.js +1 -0
  65. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/testIds.js +2 -6
  66. package/dist/libs/tesouro-embedded-components-react/cards-widget/feature/dist/lib/useCardsWidget.js +159 -145
  67. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/index.js +0 -1
  68. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsList.js +255 -112
  69. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListDetailsSheet.js +1 -1
  70. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/labels.js +4 -4
  71. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +1 -1
  72. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/labels.js +9 -7
  73. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/rows.js +46 -27
  74. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useAdminEligibleUserIds.js +3 -2
  75. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +248 -224
  76. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/mocks/labels.js +5 -5
  77. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index.js +2 -2
  78. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index10.js +22 -36
  79. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index11.js +23 -70
  80. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index12.js +91 -27
  81. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index13.js +80 -63
  82. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index14.js +145 -125
  83. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index2.js +61 -9
  84. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index3.js +77 -50
  85. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index4.js +180 -65
  86. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index5.js +22 -178
  87. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index6.js +6 -75
  88. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index7.js +48 -11
  89. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index8.js +45 -7
  90. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index9.js +8 -82
  91. package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
  92. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +15 -14
  93. package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AddTile/AddTile.js +17 -0
  94. package/dist/packages/shared-ui-shadcn/dist/index.js +3603 -3518
  95. package/package.json +1 -1
  96. package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index11.js +0 -1
  97. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/AddressLine.js +0 -22
  98. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/DetailCopyRow.js +0 -28
  99. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/NicknameRow.js +0 -64
  100. package/dist/libs/tesouro-embedded-components-react/card-details-widget/ui/dist/lib/CardDetailsPanel/statusBadge.js +0 -11
  101. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardFaceSwatch.js +0 -11
  102. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/CardsListRow.js +0 -103
  103. package/dist/libs/tesouro-embedded-components-react/cards-widget/ui/dist/lib/CardsList/statusBadge.js +0 -11
  104. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index15.js +0 -67
  105. package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index16.js +0 -138
@@ -20,162 +20,179 @@ import { DEFAULT_LABELS as fe } from "../../../ui/dist/lib/labels.js";
20
20
  import "../../../../shared/ui/dist/index.js";
21
21
  import "../../../ui/dist/index.js";
22
22
  import { useAnalyticsTrack as pe } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
23
- import { useWidgetConfig as me, useWidgetError as he, useWidgetLoading as ge } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
23
+ import { useRefetchWidget as me, useWidgetConfig as he, useWidgetError as ge, useWidgetLoading as _e } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
24
24
  import "../../../../shared/feature/dist/index.js";
25
- import { useCreateBankAccountMutation as _e } from "../../../data-access/dist/index3.js";
26
- import { useGrantBankAccountAccessMutation as ve } from "../../../data-access/dist/index4.js";
27
- import { useAllOrganizationUsersQuery as s } from "../../../data-access/dist/index5.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";
28
28
  import "../../../data-access/dist/index.js";
29
- import { filterRolesForOrganization as ye } from "../../../../../shared/util-validation/dist/index6.js";
30
- import { useCallback as be, useEffect as c, useMemo as l, useRef as xe, useState as u } from "react";
31
- import { useControllableState as Se } from "@radix-ui/react-use-controllable-state";
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";
32
32
  // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js
33
- var d = { nickname: "" }, Ce = ne.BankAccountWriteOrg;
34
- function f(e, t) {
33
+ var l = { nickname: "" }, Ee = ne.BankAccountWriteOrg;
34
+ function u(e, t) {
35
35
  return e !== void 0 && t !== void 0 && e !== t;
36
36
  }
37
- function p({ labels: ne, featureLabels: a, isBankingTaglineVisible: o = !0, bankLogoSrc: p, bankLogoAlt: Te, depositAgreementUrl: Ee, selectedAccountId: De, defaultSelectedAccountId: Oe, onSelectedAccountIdChange: ke, "data-testid": Ae } = {}) {
38
- let je = {
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
39
  ...fe,
40
40
  ...ne
41
- }, m = {
41
+ }, d = {
42
42
  ...se,
43
43
  ...a
44
- }, h = pe(), { organizationId: g, widgetToken: _, initResponse: v } = me(), Me = ge(), { organizationStatus: y } = te(), Ne = ee(y), b = !!he(), x = !!(g && _), Pe = x || !!_ && y === r.Rotating, S = l(() => ce(v?.scopes), [v?.scopes]), Fe = Pe && S.canRead && !!v, C = v?.userId ?? void 0, [w, Ie] = u(g);
45
- g !== void 0 && g !== w && Ie(g);
46
- let [T, Le] = u(C);
47
- C !== void 0 && C !== T && Le(C);
48
- let [Re, E] = Se({
49
- prop: De,
50
- defaultProp: Oe ?? null,
51
- onChange: ke,
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,
52
52
  caller: "BankAccountsWidget"
53
- }), D = xe({
54
- organizationId: w,
55
- userId: T
56
- }), ze = f(D.current.organizationId, w) || f(D.current.userId, T);
57
- c(() => {
58
- let e = D.current;
59
- D.current = {
60
- organizationId: w,
61
- userId: T
62
- }, (f(e.organizationId, w) || f(e.userId, T)) && E(null);
53
+ }), T = we({
54
+ organizationId: S,
55
+ userId: C
56
+ }), Ue = u(T.current.organizationId, S) || u(T.current.userId, C);
57
+ Ce(() => {
58
+ let e = T.current;
59
+ T.current = {
60
+ organizationId: S,
61
+ userId: C
62
+ }, (u(e.organizationId, S) || u(e.userId, C)) && w(null);
63
63
  }, [
64
- w,
65
- T,
66
- E
64
+ S,
65
+ C,
66
+ w
67
67
  ]);
68
- let Be = ze ? null : Re, O = Fe && !Be, k = be((e) => {
69
- E(e);
70
- }, [E]), [A, j] = u(!1), [M, N] = u(d), [Ve, P] = u([]), [He, F] = u(!1), [Ue, I] = u(), [L, We] = u({}), [R, z] = u({});
71
- c(() => {
72
- h(i.Mounted);
73
- }, [h]);
74
- let B = re({ enabled: O }), V = _e(), H = ve(), U = A, W = s({ enabled: U }), G = ie({ enabled: U }), K = s({
75
- enabled: U,
76
- permissions: [Ce]
77
- }), q = l(() => new Set((K.data?.data ?? []).filter((e) => e.organizationId === g).map((e) => e.id)), [K.data?.data, g]), J = l(() => {
78
- let e = G.data?.data ?? [], t = g ? ye(e, {
79
- organizationId: g,
80
- organizationTypes: v?.organizationTypes ?? []
68
+ let E = Ue ? null : He, D = ze && !E, O = Se((e) => {
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(() => {
72
+ f(i.Mounted);
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, {
79
+ organizationId: p,
80
+ organizationTypes: h?.organizationTypes ?? []
81
81
  }) : e;
82
- return de(W.data?.data ?? [], ue(t), q);
82
+ return de(H.data?.data ?? [], ue(t), Ze);
83
83
  }, [
84
- q,
85
- G.data?.data,
86
- W.data?.data,
87
- g,
88
- v?.organizationTypes
89
- ]), Ge = W.isLoading || W.isFetchingNextPage || !!W.hasNextPage || G.isResolving || K.isLoading || K.isFetchingNextPage || !!K.hasNextPage, Ke = !Ge && !W.isError && !K.isError, Y = O ? B.data?.data ?? [] : [], X = [.../* @__PURE__ */ new Set([...J.filter((e) => e.locked).map((e) => e.id), ...Ve])], qe = v?.bankName?.trim() ?? "", Je = v?.vspName?.trim() ?? "", Ye = Ee?.trim() || void 0, Z = x && S.canWrite, Q = !B.hasNextPage && !B.isFetchingNextPage, Xe = l(() => Q ? oe(Y) : void 0, [Y, Q]), Ze = Y.length > 1 && S.canRead && Q, $ = be(async (t, n, r) => {
90
- await ae(r) && (e.success(n === "account" ? m.copyAccountNumberToast : m.copyRoutingNumberToast), z((e) => ({
91
- ...e,
92
- [t]: n
84
+ Ze,
85
+ U.data?.data,
86
+ H.data?.data,
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 = () => {
90
+ for (let e of [
91
+ H,
92
+ W,
93
+ U
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) => ({
97
+ ...n,
98
+ [e]: t
93
99
  })), window.setTimeout(() => {
94
- z((e) => ({
95
- ...e,
96
- [t]: void 0
100
+ Xe((t) => ({
101
+ ...t,
102
+ [e]: void 0
97
103
  }));
98
104
  }, 2e3));
99
- }, [m.copyAccountNumberToast, m.copyRoutingNumberToast]), Qe = l(() => Y.map((e) => we(e, m, {
100
- isAccountNumberVisible: L[e.id] ?? !1,
101
- isAccountNumberCopied: R[e.id] === "account",
102
- isRoutingNumberCopied: R[e.id] === "routing",
103
- onToggleAccountNumberVisibility: () => We((t) => ({
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) => ({
104
110
  ...t,
105
111
  [e.id]: !t[e.id]
106
112
  })),
107
- onCopyAccountNumber: () => void $(e.id, "account", e.accountNumber),
108
- onCopyRoutingNumber: () => void $(e.id, "routing", e.routingNumber),
113
+ onCopyAccountNumber: () => void Z(e.id, "account", e.accountNumber),
114
+ onCopyRoutingNumber: () => void Z(e.id, "routing", e.routingNumber),
109
115
  onSelect: () => {
110
- k(e.id), h(i.AccountSelected, { accountId: e.id });
116
+ O(e.id), f(i.AccountSelected, { accountId: e.id });
111
117
  }
112
118
  })), [
113
- Y,
119
+ q,
120
+ Je,
114
121
  L,
115
- R,
116
- m,
117
- $,
118
- k,
119
- h
120
- ]), $e = (r) => {
121
- H.mutate({
122
+ d,
123
+ Z,
124
+ O,
125
+ f
126
+ ]), lt = (r) => {
127
+ B.mutate({
122
128
  path: { id: r },
123
- body: { userIds: X }
129
+ body: { userIds: J }
124
130
  }, { onSuccess: () => {
125
- n(t), e.success(m.createSuccessToast), N(d), P([]), I(void 0), F(!1), j(!1);
131
+ n(t), e.success(d.createSuccessToast), M(l), N([]), I(void 0), P(!1), A(!1);
126
132
  } });
127
- }, et = () => {
128
- Z && Ke && (M.nickname.trim() === "" ? F(!0) : X.length === 0 ? console.warn("No team members selected on submit") : Ue ? $e(Ue) : V.mutate({ body: { nickname: M.nickname.trim() } }, { onSuccess: (e) => {
129
- h(i.AccountCreated, { accountId: e?.id }), e?.id && (I(e.id), $e(e.id));
133
+ }, ut = () => {
134
+ if (!Y) return;
135
+ if (!tt) {
136
+ K || nt();
137
+ return;
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));
130
142
  } }));
131
- }, tt = (e, t) => {
132
- J.find((t) => t.id === e)?.locked || P((n) => t ? [.../* @__PURE__ */ new Set([...n, e])] : n.filter((t) => t !== e));
133
- }, nt = (e) => {
134
- (!e || Z) && (e && (N(d), P([]), I(void 0), F(!1), V.reset(), H.reset()), j(e));
135
- }, rt = V.isPending || H.isPending, it = le(J, {
136
- selectedUserIds: Ve,
137
- disabled: rt || !S.canWrite,
138
- fallbackTooltip: je.teamMemberAccessTooltip,
139
- onUserToggle: tt
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
140
154
  });
141
155
  return {
142
- "data-testid": Ae,
143
- selectedAccountId: Be,
144
- bankDisplayName: qe,
145
- bankLogoSrc: p,
146
- bankLogoAlt: Te,
147
- availableBalanceLabel: Xe,
148
- shouldDisplayAvailableBalance: Ze,
156
+ "data-testid": Pe,
157
+ selectedAccountId: E,
158
+ bankDisplayName: rt,
159
+ bankLogoSrc: De,
160
+ bankLogoAlt: ke,
161
+ availableBalanceLabel: ot,
162
+ shouldDisplayAvailableBalance: st,
149
163
  isBankingTaglineVisible: o,
150
- accountCards: Qe,
151
- shouldDisplayAddAccountCard: S.canWrite,
152
- isLoading: !b && (Ne && !B.data || Me && !v || O && (B.isLoading || B.isFetchingNextPage || B.hasNextPage)),
153
- isError: b || O && B.isError,
154
- isCreateOpen: A,
155
- createForm: M,
164
+ accountCards: ct,
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(),
169
+ isCreateOpen: k,
170
+ createForm: j,
156
171
  legalCopy: {
157
- bankName: qe,
158
- vspName: Je,
159
- agreementUrl: Ye
172
+ bankName: rt,
173
+ vspName: it,
174
+ agreementUrl: at
160
175
  },
161
- accessRows: it,
162
- isTeamMembersLoading: Ge,
163
- isTeamMembersError: W.isError || K.isError,
164
- isCreateSubmitDisabled: !Z || !Ke || M.nickname.trim() === "" || X.length === 0,
165
- isCreateError: V.isError || H.isError,
166
- hasNicknameError: He,
167
- isSubmitting: rt,
168
- isCreateDisabled: !Z,
169
- onCreateOpenChange: nt,
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,
170
186
  onCreateFormChange: (e) => {
171
- F(!1), N(e);
187
+ P(!1), M(e);
172
188
  },
173
- onCreateSubmit: et,
174
- onAddAccountClick: () => nt(!0),
175
- onSelectAccount: k
189
+ onCreateSubmit: ut,
190
+ onTeamMembersRetry: nt,
191
+ onAddAccountClick: () => ft(!0),
192
+ onSelectAccount: O
176
193
  };
177
194
  }
178
- function we(e, t, n) {
195
+ function Oe(e, t, n) {
179
196
  return {
180
197
  id: e.id,
181
198
  name: e.nickname?.trim() || t.accountFallback,
@@ -186,4 +203,4 @@ function we(e, t, n) {
186
203
  ...n
187
204
  };
188
205
  }
189
- export { p as useBankAccountsWidget };
206
+ export { De as useBankAccountsWidget };
@@ -1,15 +1,15 @@
1
1
  // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/mocks/labels.js
2
2
  var e = {
3
3
  blurbs: {
4
- populated: "Three accounts with a total, and an Add account card. Open an account for its transactions, then try Export, the Statements tab (two pages; View opens a PDF), and Edit account nickname. Add account creates a fourth account.",
5
- empty: "The organization has no accounts and the session cannot create one, so the widget says so. With bank_account:write:org it would show only the Add account card.",
4
+ populated: "Three accounts with a total, and Add account in the header. Open an account for its transactions, then try Export, the Statements tab (two pages; View opens a PDF), and Edit account nickname. Add account creates a fourth account.",
5
+ empty: "The organization has no accounts and the session cannot create one, so the widget says so. With bank_account:write:org the empty state would offer Add account.",
6
6
  loading: "The accounts read is held open, so two card-shaped skeletons stay on screen.",
7
- error: "The accounts read fails with a 500. The widget reports it inline with no retry, and the Add account card stays because it depends on scope, not on the read.",
8
- "control-hidden": "The same accounts, read by a session without bank_account:write:org. The Add account card is absent, and an opened account offers no nickname edit."
7
+ error: "The accounts read fails with a 500. The widget says it couldn't load the accounts and offers Try again; Add account stays because it depends on scope, not on the read.",
8
+ "control-hidden": "The same accounts, read by a session without bank_account:write:org. Add account is absent, and an opened account offers no nickname edit."
9
9
  },
10
10
  scenarios: { "team-access-failed": {
11
11
  label: "Team access fails",
12
- blurb: "The accounts load, but the user roster behind the create dialog fails. Press Add account: the Team member access section reports the failure and Create account stays disabled."
12
+ blurb: "The accounts load, but the user roster behind the create dialog fails. Press Add account: the Team member access section reports the failure and Create account does nothing until it loads."
13
13
  } }
14
14
  };
15
15
  export { e as BANK_ACCOUNTS_LABELS };
@@ -2,82 +2,79 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Button as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
5
+ import { Skeleton as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
6
  import { formatOpenAccountAriaLabel as t } from "./labels.js";
7
- import { jsx as n, jsxs as r } from "react/jsx-runtime";
8
- import { CheckCircle2Icon as i, CopyIcon as a, EyeIcon as o, EyeOffIcon as s, PlusIcon as c } from "lucide-react";
7
+ import { IconActionButton as n } from "../../../account-details/ui/dist/index2.js";
8
+ import "../../../account-details/ui/dist/index.js";
9
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
10
+ import { CheckIcon as a, CopyIcon as o, EyeIcon as s, EyeOffIcon as c } from "lucide-react";
9
11
  // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js
10
- var l = "ttw:absolute ttw:inset-0 ttw:z-0 ttw:cursor-pointer ttw:rounded-xl ttw:border-0 ttw:bg-transparent ttw:outline-none focus-visible:ttw:ring-2 focus-visible:ttw:ring-ring focus-visible:ttw:ring-offset-2", u = "ttw:pointer-events-auto ttw:relative ttw:z-10 ttw:size-7 ttw:text-primary";
11
- function d({ labels: c, card: d, testId: f }) {
12
- return /* @__PURE__ */ r("article", {
12
+ var l = "ttw:absolute ttw:inset-0 ttw:z-0 ttw:cursor-pointer ttw:rounded-lg ttw:outline-none ttw:focus-visible:outline-solid ttw:focus-visible:outline-2 ttw:focus-visible:outline-offset-2 ttw:focus-visible:outline-ring", u = "ttw:pointer-events-auto ttw:relative ttw:z-10";
13
+ function d({ labels: e, card: d, testId: f }) {
14
+ let p = d.isAccountNumberCopied ? e.copiedLabel : e.copyAccountNumber, m = d.isRoutingNumberCopied ? e.copiedLabel : e.copyRoutingNumber;
15
+ return /* @__PURE__ */ i("article", {
13
16
  "data-testid": f,
14
- className: "ttw:relative ttw:flex ttw:h-[214px] ttw:w-80 ttw:cursor-pointer ttw:flex-col ttw:gap-3 ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:transition-[border-color,box-shadow] ttw:duration-200 ttw:hover:border-primary ttw:hover:shadow-md",
15
- children: [/* @__PURE__ */ n("button", {
17
+ className: "ttw:relative ttw:flex ttw:w-80 ttw:max-w-full ttw:cursor-pointer ttw:flex-col ttw:gap-3 ttw:rounded-lg ttw:border ttw:border-border ttw:bg-card ttw:p-4 ttw:transition-colors ttw:duration-150 ttw:hover:bg-muted",
18
+ children: [/* @__PURE__ */ r("button", {
16
19
  type: "button",
17
20
  className: l,
18
- "aria-label": t(d.name, c),
21
+ "aria-label": t(d.name, e),
19
22
  onClick: d.onSelect
20
- }), /* @__PURE__ */ r("div", {
23
+ }), /* @__PURE__ */ i("div", {
21
24
  className: "ttw:pointer-events-none ttw:relative ttw:z-10 ttw:flex ttw:min-h-0 ttw:flex-1 ttw:flex-col ttw:gap-3",
22
25
  children: [
23
- /* @__PURE__ */ r("div", { children: [/* @__PURE__ */ n("p", {
24
- className: "ttw:truncate ttw:text-base ttw:font-bold ttw:text-foreground",
25
- children: d.name
26
- }), /* @__PURE__ */ n("p", {
27
- className: "ttw:truncate ttw:text-2xl ttw:font-bold ttw:text-primary",
28
- children: d.balanceLabel
29
- })] }),
30
- /* @__PURE__ */ r("div", {
26
+ /* @__PURE__ */ i("div", {
31
27
  className: "ttw:space-y-1",
32
- children: [/* @__PURE__ */ n("p", {
28
+ children: [/* @__PURE__ */ r("p", {
29
+ className: "ttw:truncate ttw:text-sm ttw:font-semibold ttw:text-foreground",
30
+ children: d.name
31
+ }), /* @__PURE__ */ r("p", {
32
+ className: "ttw:truncate ttw:text-xl ttw:font-semibold ttw:tabular-nums ttw:text-foreground",
33
+ children: d.balanceLabel
34
+ })]
35
+ }),
36
+ /* @__PURE__ */ i("div", {
37
+ className: "ttw:space-y-1",
38
+ children: [/* @__PURE__ */ r("p", {
33
39
  className: "ttw:text-xs ttw:text-muted-foreground",
34
- children: c.accountNumberLabel
35
- }), /* @__PURE__ */ r("div", {
40
+ children: e.accountNumberLabel
41
+ }), /* @__PURE__ */ i("div", {
36
42
  className: "ttw:flex ttw:items-center ttw:gap-1",
37
43
  children: [
38
- /* @__PURE__ */ n("span", {
39
- className: "ttw:text-sm ttw:tracking-widest",
44
+ /* @__PURE__ */ r("span", {
45
+ className: "ttw:text-sm ttw:tabular-nums",
40
46
  children: d.isAccountNumberVisible ? d.accountNumberLabel : d.maskedAccountNumberLabel
41
47
  }),
42
- /* @__PURE__ */ n(e, {
43
- type: "button",
44
- variant: "ghost",
45
- size: "icon",
48
+ /* @__PURE__ */ r(n, {
49
+ label: d.isAccountNumberVisible ? e.hideAccountNumber : e.showAccountNumber,
46
50
  className: u,
47
- "aria-label": c.toggleAccountNumberVisibility,
48
51
  onClick: d.onToggleAccountNumberVisibility,
49
- children: d.isAccountNumberVisible ? /* @__PURE__ */ n(s, { className: "ttw:size-4" }) : /* @__PURE__ */ n(o, { className: "ttw:size-4" })
52
+ children: d.isAccountNumberVisible ? /* @__PURE__ */ r(c, {}) : /* @__PURE__ */ r(s, {})
50
53
  }),
51
- /* @__PURE__ */ n(e, {
52
- type: "button",
53
- variant: "ghost",
54
- size: "icon",
54
+ /* @__PURE__ */ r(n, {
55
+ label: p,
55
56
  className: u,
56
- "aria-label": c.copyAccountNumber,
57
57
  onClick: d.onCopyAccountNumber,
58
- children: d.isAccountNumberCopied ? /* @__PURE__ */ n(i, { className: "ttw:size-4" }) : /* @__PURE__ */ n(a, { className: "ttw:size-4" })
58
+ children: d.isAccountNumberCopied ? /* @__PURE__ */ r(a, {}) : /* @__PURE__ */ r(o, {})
59
59
  })
60
60
  ]
61
61
  })]
62
62
  }),
63
- /* @__PURE__ */ r("div", {
63
+ /* @__PURE__ */ i("div", {
64
64
  className: "ttw:space-y-1",
65
- children: [/* @__PURE__ */ n("p", {
65
+ children: [/* @__PURE__ */ r("p", {
66
66
  className: "ttw:text-xs ttw:text-muted-foreground",
67
- children: c.routingNumberLabel
68
- }), /* @__PURE__ */ r("div", {
67
+ children: e.routingNumberLabel
68
+ }), /* @__PURE__ */ i("div", {
69
69
  className: "ttw:flex ttw:items-center ttw:gap-1",
70
- children: [/* @__PURE__ */ n("span", {
71
- className: "ttw:text-sm",
70
+ children: [/* @__PURE__ */ r("span", {
71
+ className: "ttw:text-sm ttw:tabular-nums",
72
72
  children: d.routingNumberLabel
73
- }), /* @__PURE__ */ n(e, {
74
- type: "button",
75
- variant: "ghost",
76
- size: "icon",
73
+ }), /* @__PURE__ */ r(n, {
74
+ label: m,
77
75
  className: u,
78
- "aria-label": c.copyRoutingNumber,
79
76
  onClick: d.onCopyRoutingNumber,
80
- children: d.isRoutingNumberCopied ? /* @__PURE__ */ n(i, { className: "ttw:size-4" }) : /* @__PURE__ */ n(a, { className: "ttw:size-4" })
77
+ children: d.isRoutingNumberCopied ? /* @__PURE__ */ r(a, {}) : /* @__PURE__ */ r(o, {})
81
78
  })]
82
79
  })]
83
80
  })
@@ -85,17 +82,7 @@ function d({ labels: c, card: d, testId: f }) {
85
82
  })]
86
83
  });
87
84
  }
88
- function f({ labels: t, disabled: i, onClick: a }) {
89
- return /* @__PURE__ */ n("div", {
90
- className: "ttw:flex ttw:h-[214px] ttw:w-80 ttw:items-center ttw:justify-center ttw:rounded-xl ttw:border ttw:border-dashed ttw:border-primary ttw:bg-card ttw:p-4",
91
- children: /* @__PURE__ */ r(e, {
92
- type: "button",
93
- variant: "outline",
94
- className: "ttw:rounded-xl ttw:border-primary ttw:text-primary",
95
- disabled: i,
96
- onClick: a,
97
- children: [/* @__PURE__ */ n(c, { className: "ttw:size-4" }), t.addAccountButton]
98
- })
99
- });
85
+ function f() {
86
+ return /* @__PURE__ */ r(e, { className: "ttw:h-52 ttw:w-80 ttw:max-w-full ttw:rounded-lg" });
100
87
  }
101
- export { d as AccountCard, f as AddAccountCard };
88
+ export { d as AccountCard, f as AccountCardSkeleton };