@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
@@ -2,289 +2,50 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { isOrganizationOnItsWay as t } from "../../../../shared/data-access/dist/lib/organizationStatus.js";
7
- import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
8
- import { isApiUnprocessableError as r } from "../../../../shared/data-access/dist/lib/isApiUnprocessableError.js";
9
- import "../../../../shared/data-access/dist/index.js";
10
- import "../../../../shared/ui/dist/index.js";
11
- import { useAnalyticsTrack as ee } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
12
- import { useWidgetConfig as te, useWidgetError as ne, useWidgetLoading as re } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
13
- import "../../../../shared/feature/dist/index.js";
14
- import { AccountDetailsWidgetAnalyticsEvent as i } from "./index2.js";
15
- import { formatDateParam as a, getDefaultExportDateRange as ie, isExportRangeValid as o, startOfLocalDay as s, triggerCsvDownload as ae, yesterdayLocal as c } from "./index3.js";
16
- import { copyTextToClipboard as oe, formatAmountLabel as l, formatSignedTransactionAmountLabel as se, formatStatementPeriodLabel as ce, formatTransactionDateLabel as le, maskAccountNumber as ue } from "./index4.js";
17
- import { DEFAULT_FEATURE_LABELS as de } from "./index5.js";
18
- import { getBankAccountsPermissions as fe } from "./index6.js";
19
- import { getStatementsStartDate as pe } from "./index7.js";
20
- import { interpolateLabel as u } from "./index8.js";
21
- import { useBankAccountDetailsQuery as me } from "../../data-access/dist/index2.js";
22
- import { useBankAccountStatementsQuery as he } from "../../data-access/dist/index3.js";
23
- import { useBankAccountTransactionsQuery as ge } from "../../data-access/dist/index4.js";
24
- import { useDownloadBankAccountTransactionsMutation as _e } from "../../data-access/dist/index5.js";
25
- import { useRetrieveBankAccountStatementMutation as ve } from "../../data-access/dist/index6.js";
26
- import { useUpdateBankAccountMutation as ye } from "../../data-access/dist/index7.js";
27
- import "../../data-access/dist/index.js";
28
- import { DEFAULT_LABELS as be } from "../../ui/dist/index7.js";
29
- import { AccountDetailsWidgetUi as xe } from "../../ui/dist/index8.js";
30
- import "../../ui/dist/index.js";
31
- import { useCallback as d, useEffect as Se, useMemo as f, useState as p } from "react";
32
- import { jsx as Ce } from "react/jsx-runtime";
5
+ import { useCallback as e, useState as t } from "react";
33
6
  // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js
34
- var we = 3e3, Te = 5e3, Ee = [
35
- 10,
36
- 25,
37
- 50
38
- ], De = 10, Oe = 6e5, ke = { nickname: "" };
39
- function m({ accountId: m, onBack: Ae, labels: je, featureLabels: Me, isBankingTaglineVisible: Ne = !0, bankLogoSrc: Pe, bankLogoAlt: Fe, bankAddress: Ie, supportTeamUrl: Le }) {
40
- let h = {
41
- ...be,
42
- ...je
43
- }, g = {
44
- ...de,
45
- ...Me
46
- }, _ = ee(), { organizationId: Re, widgetToken: ze, initResponse: v } = te(), Be = re(), Ve = t(n().organizationStatus), y = !!ne(), b = !!(Re && ze), x = f(() => fe(v?.scopes), [v?.scopes]), S = x.canRead && !!v, C = b && S, w = S && !b, [T, He] = p("transactions"), [Ue, E] = p(!1), [D, O] = p(ke), [We, Ge] = p(!1), [Ke, k] = p(!1), [qe, A] = p(!1), [Je, Ye] = p(!1), [Xe, j] = p(!1), [M, N] = p(), [P, F] = p(), [I, Ze] = p(De), [L, R] = p(() => ({
47
- accountId: m,
48
- token: void 0
49
- }));
50
- L.accountId !== m && R({
51
- accountId: m,
52
- token: void 0
53
- });
54
- let Qe = L.accountId === m ? L.token : void 0, z = d((e) => {
55
- R((t) => ({
7
+ function n({ resetKey: n, defaultPageSize: r }) {
8
+ let i = () => ({
9
+ resetKey: n,
10
+ pageSize: r,
11
+ token: void 0,
12
+ offset: 0,
13
+ history: []
14
+ }), [a, o] = t(i), s = a.resetKey === n ? a : i();
15
+ a.resetKey !== n && o(s);
16
+ let c = e((e, t) => {
17
+ o((n) => ({
18
+ ...n,
19
+ token: e,
20
+ offset: n.offset + t,
21
+ history: [...n.history, n.offset]
22
+ }));
23
+ }, []), l = e((e) => {
24
+ o((t) => ({
25
+ ...t,
26
+ token: e,
27
+ offset: t.history[t.history.length - 1] ?? 0,
28
+ history: t.history.slice(0, -1)
29
+ }));
30
+ }, []), u = e((e) => {
31
+ o((t) => ({
56
32
  ...t,
57
- token: e
33
+ pageSize: e,
34
+ token: void 0,
35
+ offset: 0,
36
+ history: []
58
37
  }));
59
- }, []), [B, V] = p(() => /* @__PURE__ */ new Set());
60
- Se(() => {
61
- _(i.Mounted);
62
- }, [_]);
63
- let H = me({
64
- id: m,
65
- enabled: C
66
- }), U = ge({
67
- id: m,
68
- enabled: C && T === "transactions",
69
- limit: 25,
70
- sortBy: "DATE",
71
- sortOrder: "DESC"
72
- }), [$e] = p(pe), W = he({
73
- id: m,
74
- startDate: $e,
75
- enabled: C && T === "statements",
76
- limit: I,
77
- pagination_token: Qe,
78
- category: "STATEMENTS"
79
- }), et = ye(), tt = _e(), nt = ve(), { mutate: rt, isPending: it, isError: G, reset: K } = et, { mutateAsync: at, isPending: ot } = tt, { mutateAsync: st } = nt, q = S ? H.data : void 0, J = v?.bankName?.trim() ?? "", ct = Ie?.trim() || void 0, Y = { bankName: J }, lt = f(() => u(h.domesticWireIntro, Y), [h.domesticWireIntro, J]), ut = f(() => u(h.domesticWireNote, Y), [h.domesticWireNote, J]), dt = f(() => u(h.thingsToKnowBody, Y), [h.thingsToKnowBody, J]), ft = q?.nickname?.trim() || g.accountFallback, pt = l(q?.balance), mt = f(() => (U.data?.data ?? []).map((e, t) => ({
80
- key: `${e.date}-${t}`,
81
- descriptionLabel: e.description,
82
- dateLabel: le(e.date),
83
- amountLabel: se(e.amount, e.direction),
84
- amountVariant: e.direction === "CREDIT" ? "positive" : "default",
85
- balanceLabel: l(e.runningBalance)
86
- })), [U.data?.data]), ht = x.canRead && mt.length > 0, gt = d((t) => {
87
- if (!b || !x.canRead) return;
88
- let n = window.open("", "_blank");
89
- n ? (n.opener = null, V((e) => new Set(e).add(t)), st({
90
- id: m,
91
- statementId: t
92
- }).then((e) => {
93
- let t = URL.createObjectURL(e);
94
- n.location.href = t, window.setTimeout(() => URL.revokeObjectURL(t), Oe);
95
- }).catch(() => {
96
- n.close(), e.error(g.viewStatementErrorToast);
97
- }).finally(() => {
98
- V((e) => {
99
- if (!e.has(t)) return e;
100
- let n = new Set(e);
101
- return n.delete(t), n;
102
- });
103
- })) : e.error(g.viewStatementErrorToast);
104
- }, [
105
- m,
106
- g.viewStatementErrorToast,
107
- b,
108
- x.canRead,
109
- st
110
- ]), _t = f(() => (W.data?.data ?? []).map((e) => {
111
- let t = ce(e.statementDate);
112
- return {
113
- key: e.statementId,
114
- label: t,
115
- viewButtonAriaLabel: u(h.viewStatementButtonAriaLabel, { date: t }),
116
- isViewDisabled: B.has(e.statementId),
117
- onView: () => gt(e.statementId)
118
- };
119
- }), [
120
- W.data?.data,
121
- h.viewStatementButtonAriaLabel,
122
- B,
123
- gt
124
- ]), X = W.data?.nextPaginationToken ?? void 0, Z = W.data?.prevPaginationToken ?? void 0, vt = C && T === "transactions" && U.isLoading, yt = C && T === "transactions" && U.isError, bt = d(() => {
125
- C && T === "transactions" && U.refetch();
126
- }, [
127
- T,
128
- C,
129
- U.refetch
130
- ]), xt = C && T === "statements" && !!W.data && !W.isError, St = C && T === "statements" && W.isLoading, Ct = C && T === "statements" && W.isError && !r(W.error), wt = d(() => {
131
- W.refetch();
132
- }, [W.refetch]), Tt = d((e) => {
133
- Ze(e), z(void 0);
134
- }, []), Et = d(() => {
135
- z(Z);
136
- }, [Z]), Dt = d(() => {
137
- z(X);
138
- }, [X]), Ot = w || !o(M, P), kt = f(() => {
139
- let e = [{ after: c() }];
140
- return P && e.push({ after: s(P) }), e;
141
- }, [P]), At = f(() => {
142
- let e = [{ after: c() }];
143
- return M && e.push({ before: s(M) }), e;
144
- }, [M]), jt = d((e) => {
145
- if (e) {
146
- let { startDate: e, endDate: t } = ie();
147
- N(e), F(t);
148
- }
149
- j(e);
150
- }, []), Mt = d(async () => {
151
- if (!b || !x.canRead || !M || !P || !o(M, P)) return;
152
- j(!1);
153
- let t = e.loading(g.exportLoadingToast);
154
- try {
155
- let n = await at({
156
- id: m,
157
- startDate: a(M),
158
- endDate: a(P)
159
- });
160
- ae(n.csv, n.filename), e.success(g.exportSuccessToast, {
161
- id: t,
162
- duration: we
163
- });
164
- } catch {
165
- e.error(g.exportErrorToast, {
166
- id: t,
167
- duration: Te
168
- });
169
- }
170
- }, [
171
- m,
172
- at,
173
- P,
174
- M,
175
- g.exportErrorToast,
176
- g.exportLoadingToast,
177
- g.exportSuccessToast,
178
- b,
179
- x.canRead
180
- ]), Q = d(async (t, n) => {
181
- if (!await oe(t)) return;
182
- let r = {
183
- account: g.copyAccountNumberToast,
184
- routing: g.copyRoutingNumberToast,
185
- bankName: g.copyBankNameToast,
186
- bankAddress: g.copyBankAddressToast
187
- };
188
- e.success(r[n]), n === "account" ? (k(!0), window.setTimeout(() => k(!1), 2e3)) : n === "routing" && (A(!0), window.setTimeout(() => A(!1), 2e3));
189
- }, [
190
- g.copyAccountNumberToast,
191
- g.copyBankAddressToast,
192
- g.copyBankNameToast,
193
- g.copyRoutingNumberToast
194
- ]), $ = (e) => {
195
- e && (O({ nickname: q?.nickname?.trim() ?? "" }), K()), E(e);
38
+ }, []);
39
+ return {
40
+ token: s.token,
41
+ pageSize: s.pageSize,
42
+ offset: s.offset,
43
+ goToNext: c,
44
+ goToPrevious: l,
45
+ setPageSize: u
196
46
  };
197
- return /* @__PURE__ */ Ce(xe, {
198
- labels: h,
199
- title: ft,
200
- bankDisplayName: J,
201
- bankLogoSrc: Pe,
202
- bankLogoAlt: Fe,
203
- balanceLabel: pt,
204
- balanceTestId: "bank-accounts-widget-detail-balance",
205
- isBankingTaglineVisible: Ne,
206
- activeTab: T,
207
- transactionRows: mt,
208
- isTransactionsError: yt,
209
- isTransactionsLoading: vt,
210
- onTransactionsRetry: bt,
211
- statementRows: _t,
212
- isStatementsLoading: St,
213
- isStatementsError: Ct,
214
- onStatementsRetry: wt,
215
- isStatementsPaginationVisible: xt,
216
- statementsPageSize: I,
217
- statementsPageSizeOptions: Ee,
218
- isStatementsPreviousPageDisabled: !Z,
219
- isStatementsNextPageDisabled: !X,
220
- onStatementsPageSizeChange: Tt,
221
- onStatementsPreviousPageClick: Et,
222
- onStatementsNextPageClick: Dt,
223
- showExport: ht,
224
- isExportOpen: Xe,
225
- exportStartDate: M,
226
- exportEndDate: P,
227
- isExportDownloading: ot,
228
- isExportDownloadDisabled: Ot,
229
- disabledExportStartDates: kt,
230
- disabledExportEndDates: At,
231
- accountNumberLabel: q?.accountNumber ?? "",
232
- maskedAccountNumberLabel: ue(q?.accountNumber ?? ""),
233
- accountNumberTestId: "bank-accounts-widget-detail-account-number",
234
- wireAccountNumberLabel: q?.accountNumber ?? "",
235
- routingNumberLabel: q?.routingNumber ?? "",
236
- bankAddressLabel: ct,
237
- domesticWireIntroLabel: lt,
238
- domesticWireNoteLabel: ut,
239
- thingsToKnowBodyLabel: dt,
240
- supportTeamHref: Le,
241
- isAccountNumberVisible: We,
242
- isAccountNumberCopied: Ke,
243
- isRoutingNumberCopied: qe,
244
- isDomesticWireExpanded: Je,
245
- isLoading: !y && (Ve && !q || Be && !v || C && H.isLoading),
246
- isError: y || C && H.isError,
247
- isEditOpen: Ue,
248
- isEditDisabled: !x.canWrite,
249
- isEditError: G,
250
- isSubmitting: it,
251
- isEditSaveDisabled: w,
252
- editForm: D,
253
- canEdit: x.canWrite,
254
- onBack: Ae,
255
- onTabChange: He,
256
- onToggleAccountNumberVisibility: () => Ge((e) => !e),
257
- onCopyAccountNumber: () => void Q(q?.accountNumber ?? "", "account"),
258
- onCopyRoutingNumber: () => void Q(q?.routingNumber ?? "", "routing"),
259
- onCopyBankName: () => void Q(J, "bankName"),
260
- onCopyBankAddress: () => void Q(ct ?? "", "bankAddress"),
261
- onDomesticWireExpandedChange: Ye,
262
- onEditOpenChange: $,
263
- onEditFormChange: (e) => {
264
- G && K(), O(e);
265
- },
266
- onEditSubmit: () => {
267
- if (!b || !x.canWrite) return;
268
- let t = D.nickname.trim();
269
- t && rt({
270
- path: { id: m },
271
- body: { nickname: t }
272
- }, {
273
- onSuccess: () => {
274
- _(i.AccountUpdated, { accountId: m }), e.success(g.editSuccessToast), E(!1);
275
- },
276
- onError: () => {
277
- e.error(g.editErrorToast);
278
- }
279
- });
280
- },
281
- onEditNicknameClick: () => $(!0),
282
- onExportOpenChange: jt,
283
- onExportStartDateChange: N,
284
- onExportEndDateChange: F,
285
- onExportDownload: () => {
286
- Mt();
287
- }
288
- });
289
47
  }
290
- export { m as AccountDetailsWidget };
48
+ function r(e, t, n) {
49
+ if (n !== 0) return e.replace("{start}", String(t + 1)).replace("{end}", String(t + n));
50
+ }
51
+ export { r as formatPageRange, n as useCursorPagination };
@@ -1,3 +1,5 @@
1
- import { DEFAULT_LABELS as e } from "./index7.js";
2
- import { AccountDetailsWidgetUi as t } from "./index8.js";
3
- export { t as AccountDetailsWidgetUi, e as DEFAULT_LABELS };
1
+ import { IconActionButton as e } from "./index2.js";
2
+ import "./index3.js";
3
+ import { DEFAULT_LABELS as t } from "./index9.js";
4
+ import { AccountDetailsWidgetUi as n } from "./index10.js";
5
+ export { n as AccountDetailsWidgetUi, t as DEFAULT_LABELS, e as IconActionButton };
@@ -0,0 +1,180 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { Button as e, DisplayAmount as ee, Heading as t, Skeleton as n, Tabs as r, TabsContent as i, TabsList as a, TabsTrigger as o, Tooltip as s, TooltipContent as c, TooltipProvider as l, TooltipTrigger as te } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { DEFAULT_LABELS as ne } from "./index9.js";
7
+ import { AccountDetailsPanel as re } from "./index4.js";
8
+ import { AccountActionsMenu as ie, EditAccountDialog as ae } from "./index5.js";
9
+ import { ExportTransactionsDialog as oe } from "./index6.js";
10
+ import { ErrorState as se } from "../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
11
+ import { LoadingRegion as u } from "../../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
12
+ import "../../../../shared/ui/dist/index.js";
13
+ import { StatementsPanel as d } from "./index7.js";
14
+ import { TransactionsTable as f } from "./index8.js";
15
+ import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
16
+ import { ChevronLeftIcon as g, InfoIcon as _ } from "lucide-react";
17
+ // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index10.js
18
+ function v({ labels: v, title: y, bankDisplayName: b, bankLogoSrc: x, bankLogoAlt: S, balanceLabel: C, balanceTestId: w, isBankingTaglineVisible: T, activeTab: E, transactionRows: D, isTransactionsError: O, isTransactionsLoading: k, onTransactionsRetry: A, transactionsPagination: j, statementRows: M, isStatementsLoading: N, isStatementsError: P, onStatementsRetry: F, statementsPagination: I, showExport: L, isExportOpen: R, exportStartDate: z, exportEndDate: B, isExportDownloading: V, hasExportRangeError: H, disabledExportStartDates: U, disabledExportEndDates: W, accountNumberLabel: G, maskedAccountNumberLabel: K, accountNumberTestId: ce, routingNumberLabel: le, bankAddressLabel: ue, wireAccountNumberLabel: de, domesticWireIntroLabel: fe, domesticWireNoteLabel: pe, thingsToKnowBodyLabel: me, supportTeamHref: he, isAccountNumberVisible: q, copiedField: ge, isDomesticWireExpanded: _e, isLoading: J, isError: Y, onRetry: ve, isEditOpen: ye, isEditError: be, hasEditNicknameError: xe, isSubmitting: Se, isAuthPending: X = !1, editForm: Ce, canEdit: we, onBack: Te, onTabChange: Ee, onToggleAccountNumberVisibility: De, onCopy: Oe, onDomesticWireExpandedChange: ke, onEditOpenChange: Z, onEditFormChange: Ae, onEditSubmit: je, onEditNicknameClick: Me, onExportOpenChange: Q, onExportStartDateChange: Ne, onExportEndDateChange: Pe, onExportDownload: Fe }) {
19
+ let $ = {
20
+ ...ne,
21
+ ...v
22
+ };
23
+ return /* @__PURE__ */ h("section", {
24
+ className: "ttw:flex ttw:w-full ttw:flex-col ttw:gap-4",
25
+ children: [
26
+ !J && !Y ? /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ m(ae, {
27
+ labels: $,
28
+ open: ye,
29
+ form: Ce,
30
+ isSubmitting: Se,
31
+ isAuthPending: X,
32
+ isError: be,
33
+ hasNicknameError: xe,
34
+ onOpenChange: Z,
35
+ onFormChange: Ae,
36
+ onSubmit: je
37
+ }), /* @__PURE__ */ m(oe, {
38
+ labels: $,
39
+ open: R,
40
+ startDate: z,
41
+ endDate: B,
42
+ isDownloading: V,
43
+ isAuthPending: X,
44
+ hasRangeError: H,
45
+ disabledStartDates: U,
46
+ disabledEndDates: W,
47
+ onOpenChange: Q,
48
+ onStartDateChange: Ne,
49
+ onEndDateChange: Pe,
50
+ onDownload: Fe
51
+ })] }) : null,
52
+ /* @__PURE__ */ h("div", {
53
+ className: "ttw:flex ttw:items-center ttw:justify-between ttw:gap-4",
54
+ children: [/* @__PURE__ */ h(e, {
55
+ type: "button",
56
+ variant: "ghost",
57
+ size: "sm",
58
+ className: "ttw:-ml-2",
59
+ onClick: Te,
60
+ children: [/* @__PURE__ */ m(g, {}), $.backToAccounts]
61
+ }), !J && !Y ? /* @__PURE__ */ m(ie, {
62
+ labels: $,
63
+ canEdit: we,
64
+ onEditNickname: Me
65
+ }) : null]
66
+ }),
67
+ Y ? /* @__PURE__ */ m(se, {
68
+ title: $.errorTitle,
69
+ retryLabel: $.retryButton,
70
+ onRetry: ve
71
+ }) : J ? /* @__PURE__ */ h(u, {
72
+ isLoading: !0,
73
+ loadingLabel: $.loadingLabel,
74
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
75
+ children: [/* @__PURE__ */ m(n, { className: "ttw:h-10 ttw:w-64" }), /* @__PURE__ */ m(n, { className: "ttw:h-64 ttw:w-full ttw:rounded-lg" })]
76
+ }) : /* @__PURE__ */ h(p, { children: [/* @__PURE__ */ h("div", {
77
+ className: "ttw:flex ttw:flex-col ttw:gap-4",
78
+ children: [/* @__PURE__ */ h("div", {
79
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
80
+ children: [/* @__PURE__ */ m(t, {
81
+ variant: "page",
82
+ level: 2,
83
+ children: y
84
+ }), T && b ? /* @__PURE__ */ h("div", {
85
+ className: "ttw:flex ttw:flex-wrap ttw:items-center ttw:gap-1 ttw:text-sm ttw:text-muted-foreground",
86
+ children: [/* @__PURE__ */ m("span", { children: $.bankingTaglinePrefix }), x ? /* @__PURE__ */ m("img", {
87
+ src: x,
88
+ alt: S ?? b,
89
+ className: "ttw:block ttw:h-auto ttw:max-w-[120px]"
90
+ }) : /* @__PURE__ */ m("span", { children: b })]
91
+ }) : null]
92
+ }), /* @__PURE__ */ h("div", {
93
+ className: "ttw:flex ttw:flex-col ttw:gap-1",
94
+ children: [/* @__PURE__ */ h("div", {
95
+ className: "ttw:flex ttw:items-center ttw:gap-1 ttw:text-sm ttw:text-muted-foreground",
96
+ children: [/* @__PURE__ */ m("span", { children: $.availableBalanceLabel }), /* @__PURE__ */ m(l, { children: /* @__PURE__ */ h(s, { children: [/* @__PURE__ */ m(te, {
97
+ type: "button",
98
+ className: "ttw:inline-flex ttw:cursor-pointer",
99
+ "aria-label": $.availableBalanceTooltip,
100
+ children: /* @__PURE__ */ m(_, { className: "ttw:size-4" })
101
+ }), /* @__PURE__ */ m(c, {
102
+ className: "ttw:max-w-xs",
103
+ children: $.availableBalanceTooltip
104
+ })] }) })]
105
+ }), /* @__PURE__ */ m(ee, {
106
+ "data-testid": w,
107
+ children: C
108
+ })]
109
+ })]
110
+ }), /* @__PURE__ */ h(r, {
111
+ value: E,
112
+ onValueChange: (e) => Ee(e),
113
+ className: "ttw:gap-4",
114
+ children: [
115
+ /* @__PURE__ */ h(a, { children: [
116
+ /* @__PURE__ */ m(o, {
117
+ value: "transactions",
118
+ children: $.transactionsTab
119
+ }),
120
+ /* @__PURE__ */ m(o, {
121
+ value: "statements",
122
+ children: $.statementsTab
123
+ }),
124
+ /* @__PURE__ */ m(o, {
125
+ value: "details",
126
+ children: $.detailsTab
127
+ })
128
+ ] }),
129
+ /* @__PURE__ */ m(i, {
130
+ value: "transactions",
131
+ children: /* @__PURE__ */ m(f, {
132
+ labels: $,
133
+ rows: D,
134
+ isLoading: k,
135
+ showExport: L,
136
+ onExportClick: () => Q(!0),
137
+ pagination: j,
138
+ isError: O,
139
+ onRetry: A
140
+ })
141
+ }),
142
+ /* @__PURE__ */ m(i, {
143
+ value: "statements",
144
+ children: /* @__PURE__ */ m(d, {
145
+ labels: $,
146
+ rows: M,
147
+ isLoading: N,
148
+ isError: P,
149
+ onRetry: F,
150
+ pagination: I
151
+ })
152
+ }),
153
+ /* @__PURE__ */ m(i, {
154
+ value: "details",
155
+ children: /* @__PURE__ */ m(re, {
156
+ labels: $,
157
+ routingNumberLabel: le,
158
+ accountNumberDisplayLabel: q ? G : K,
159
+ accountNumberTestId: ce,
160
+ wireAccountNumberLabel: de,
161
+ bankNameLabel: b,
162
+ bankAddressLabel: ue,
163
+ domesticWireIntroLabel: fe,
164
+ domesticWireNoteLabel: pe,
165
+ thingsToKnowBodyLabel: me,
166
+ supportTeamHref: he,
167
+ isAccountNumberVisible: q,
168
+ copiedField: ge,
169
+ isDomesticWireExpanded: _e,
170
+ onDomesticWireExpandedChange: ke,
171
+ onToggleAccountNumberVisibility: De,
172
+ onCopy: Oe
173
+ })
174
+ })
175
+ ]
176
+ })] })
177
+ ]
178
+ });
179
+ }
180
+ export { v as AccountDetailsWidgetUi };