@tesouro/embedded-components-react 0.10.2 → 0.10.5

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.
package/dist/index.d.ts CHANGED
@@ -2415,6 +2415,9 @@ interface Labels$3 {
2415
2415
  statementsTab: string;
2416
2416
  detailsTab: string;
2417
2417
  noTransactionsLabel: string;
2418
+ transactionsErrorTitle: string;
2419
+ transactionsErrorRetry: string;
2420
+ transactionsLoadingLabel: string;
2418
2421
  transactionDateColumn: string;
2419
2422
  transactionDescriptionColumn: string;
2420
2423
  transactionAmountColumn: string;
@@ -643,6 +643,9 @@ interface Labels {
643
643
  statementsTab: string;
644
644
  detailsTab: string;
645
645
  noTransactionsLabel: string;
646
+ transactionsErrorTitle: string;
647
+ transactionsErrorRetry: string;
648
+ transactionsLoadingLabel: string;
646
649
  transactionDateColumn: string;
647
650
  transactionDescriptionColumn: string;
648
651
  transactionAmountColumn: string;
@@ -1439,6 +1439,9 @@ interface Labels$3 {
1439
1439
  statementsTab: string;
1440
1440
  detailsTab: string;
1441
1441
  noTransactionsLabel: string;
1442
+ transactionsErrorTitle: string;
1443
+ transactionsErrorRetry: string;
1444
+ transactionsLoadingLabel: string;
1442
1445
  transactionDateColumn: string;
1443
1446
  transactionDescriptionColumn: string;
1444
1447
  transactionAmountColumn: string;
@@ -12,12 +12,12 @@ import { useEmbedApi as a } from "../../../../../shared/data-access/dist/lib/Emb
12
12
  import { Scope as o } from "../../../../../shared/data-access/dist/lib/scopes.js";
13
13
  import { useAllBankAccountsQuery as s } from "../../../../../shared/data-access/dist/lib/bank-account/useAllBankAccountsQuery.js";
14
14
  import "../../../../../shared/data-access/dist/index.js";
15
- import { useRefetchWidget as c, useWidgetConfig as l, useWidgetError as u, useWidgetLoading as d } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
15
+ import { useRefetchWidget as c, useWidgetConfig as l, useWidgetError as u, useWidgetInitStaleForToken as d, useWidgetLoading as f } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
16
16
  import "../../../../../shared/feature/dist/index.js";
17
- import { createContext as f, useCallback as p, useContext as m, useMemo as h } from "react";
18
- import { jsx as g } from "react/jsx-runtime";
17
+ import { createContext as p, useCallback as m, useContext as h, useMemo as g } from "react";
18
+ import { jsx as _ } from "react/jsx-runtime";
19
19
  // ../../libs/tesouro-embedded-components-react/balances-widget/feature/dist/lib/BalancesWidget/BalancesWidgetContext.js
20
- var _ = f({
20
+ var v = p({
21
21
  accountRows: [],
22
22
  isLoading: !1,
23
23
  isError: !1,
@@ -26,15 +26,17 @@ var _ = f({
26
26
  shouldTotalBalanceDisplay: !1,
27
27
  shouldShowViewAllAccounts: !1,
28
28
  isRowClickable: !1,
29
+ isVisible: !1,
29
30
  onViewAllAccountsClicked: () => {}
30
- }), v = () => m(_), y = ({ children: f, maxAccounts: m, onBalanceRowClick: v, onViewAllAccountsClick: y }) => {
31
- let { data: b, isLoading: x, isError: S, refetch: C, hasNextPage: w, isFetchingNextPage: T } = s(), { initResponse: E } = l(), D = d(), O = i(a().organizationStatus), k = u(), A = c(), j = D && !E || O && !b || x, M = !!k || S, N = p(() => {
32
- A(), k || C();
31
+ }), y = () => h(v), b = ({ children: p, maxAccounts: h, onBalanceRowClick: y, onViewAllAccountsClick: b }) => {
32
+ let { initResponse: x } = l(), S = d(), C = !S && (x?.scopes?.includes(o.BankAccountReadOrg) ?? !1), { data: w, isLoading: T, isError: E, refetch: D, hasNextPage: O, isFetchingNextPage: k } = s({ enabled: C }), A = f(), j = i(a().organizationStatus), M = u(), N = c(), P = A && !x || j && !w || T, F = !!M || E, I = m(() => {
33
+ N(), !M && C && D();
33
34
  }, [
34
- A,
35
35
  C,
36
- k
37
- ]), P = b?.data ?? [], F = h(() => P.map((t) => {
36
+ N,
37
+ D,
38
+ M
39
+ ]), L = w?.data ?? [], R = g(() => L.map((t) => {
38
40
  let r = t.accountNumber.slice(-4), i = n(t.balance);
39
41
  return {
40
42
  accountId: t.id,
@@ -47,37 +49,38 @@ var _ = f({
47
49
  })
48
50
  }
49
51
  };
50
- }), [P]), I = h(() => {
51
- let n = t(P[0]?.balance?.currencyCode), i = r(P.map((e) => e.balance), n);
52
+ }), [L]), z = g(() => {
53
+ let n = t(L[0]?.balance?.currencyCode), i = r(L.map((e) => e.balance), n);
52
54
  return e(i, {
53
55
  currencyCode: n,
54
56
  includeSpaceAfterCurrencySymbol: !1
55
57
  });
56
- }, [P]), L = h(() => P.length > 1 && (E?.scopes?.includes(o.BankAccountReadOrg) ?? !1) && !w && !T, [
57
- P.length,
58
- E?.scopes,
59
- w,
60
- T
61
- ]), R = h(() => P.length > m && !!y, [
62
- P.length,
63
- m,
64
- y
65
- ]), z = p(() => {
66
- y?.();
67
- }, [y]), B = h(() => !!v, [v]);
68
- return /* @__PURE__ */ g(_.Provider, {
58
+ }, [L]), B = g(() => L.length > 1 && (x?.scopes?.includes(o.BankAccountReadOrg) ?? !1) && !O && !k, [
59
+ L.length,
60
+ x?.scopes,
61
+ O,
62
+ k
63
+ ]), V = g(() => L.length > h && !!b, [
64
+ L.length,
65
+ h,
66
+ b
67
+ ]), H = m(() => {
68
+ b?.();
69
+ }, [b]), U = g(() => !!y, [y]);
70
+ return /* @__PURE__ */ _(v.Provider, {
69
71
  value: {
70
- accountRows: F,
71
- isLoading: j,
72
- isError: M,
73
- refetch: N,
74
- totalBalance: I,
75
- shouldTotalBalanceDisplay: L,
76
- shouldShowViewAllAccounts: R,
77
- isRowClickable: B,
78
- onViewAllAccountsClicked: z
72
+ accountRows: R,
73
+ isLoading: P,
74
+ isError: F,
75
+ refetch: I,
76
+ totalBalance: z,
77
+ shouldTotalBalanceDisplay: B,
78
+ shouldShowViewAllAccounts: V,
79
+ isRowClickable: U,
80
+ isVisible: !x || S || C || !!M,
81
+ onViewAllAccountsClicked: H
79
82
  },
80
- children: f
83
+ children: p
81
84
  });
82
85
  };
83
- export { y as BalancesWidgetContextProvider, v as useBalancesWidgetContext };
86
+ export { b as BalancesWidgetContextProvider, y as useBalancesWidgetContext };
@@ -20,16 +20,16 @@ function p({ maxAccounts: t, labels: r, onBalanceRowClick: i }) {
20
20
  l(() => {
21
21
  f(n.Mounted);
22
22
  }, [f]);
23
- let { accountRows: p, isLoading: m, isError: h, refetch: g, totalBalance: _, shouldTotalBalanceDisplay: v, shouldShowViewAllAccounts: y, isRowClickable: b, onViewAllAccountsClicked: x } = a(), S = u(() => p.slice(0, t), [p, t]), C = u(() => p.map((e) => e.view), [p]);
24
- return /* @__PURE__ */ d(s, {
25
- accountRows: C,
23
+ let { accountRows: p, isLoading: m, isError: h, refetch: g, totalBalance: _, shouldTotalBalanceDisplay: v, shouldShowViewAllAccounts: y, isRowClickable: b, isVisible: x, onViewAllAccountsClicked: S } = a(), C = u(() => p.slice(0, t), [p, t]), w = u(() => p.map((e) => e.view), [p]);
24
+ return x ? /* @__PURE__ */ d(s, {
25
+ accountRows: w,
26
26
  isLoading: m,
27
27
  isError: h,
28
28
  onRetry: h ? () => void g() : void 0,
29
29
  totalBalance: _,
30
30
  shouldTotalBalanceDisplay: v,
31
31
  shouldShowViewAllAccounts: y,
32
- onViewAllAccountsClicked: x,
32
+ onViewAllAccountsClicked: S,
33
33
  labels: r,
34
34
  testIds: {
35
35
  skeleton: o.skeleton,
@@ -38,13 +38,13 @@ function p({ maxAccounts: t, labels: r, onBalanceRowClick: i }) {
38
38
  totalBalanceInfo: o.totalBalanceInfo,
39
39
  totalAvailableLabel: o.totalAvailableLabel
40
40
  },
41
- children: S.map((e) => /* @__PURE__ */ d(c, {
41
+ children: C.map((e) => /* @__PURE__ */ d(c, {
42
42
  accountId: e.accountId,
43
43
  row: e.view,
44
44
  onBalanceRowClick: i,
45
45
  isRowClickable: b
46
46
  }, e.accountId))
47
- });
47
+ }) : null;
48
48
  }
49
49
  var m = ({ maxAccounts: e = f, labels: t, onBalanceRowClick: n, onViewAllAccountsClick: r }) => {
50
50
  let a = Math.max(0, e);
@@ -121,27 +121,33 @@ function m({ accountId: m, onBack: Ae, labels: je, featureLabels: Me, isBankingT
121
121
  h.viewStatementButtonAriaLabel,
122
122
  B,
123
123
  gt
124
- ]), X = W.data?.nextPaginationToken ?? void 0, Z = W.data?.prevPaginationToken ?? void 0, vt = C && T === "statements" && !!W.data && !W.isError, yt = C && T === "statements" && W.isLoading, bt = C && T === "statements" && W.isError && !r(W.error), xt = d(() => {
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(() => {
125
131
  W.refetch();
126
- }, [W.refetch]), St = d((e) => {
132
+ }, [W.refetch]), Tt = d((e) => {
127
133
  Ze(e), z(void 0);
128
- }, []), Ct = d(() => {
134
+ }, []), Et = d(() => {
129
135
  z(Z);
130
- }, [Z]), wt = d(() => {
136
+ }, [Z]), Dt = d(() => {
131
137
  z(X);
132
- }, [X]), Tt = w || !o(M, P), Et = f(() => {
138
+ }, [X]), Ot = w || !o(M, P), kt = f(() => {
133
139
  let e = [{ after: c() }];
134
140
  return P && e.push({ after: s(P) }), e;
135
- }, [P]), Dt = f(() => {
141
+ }, [P]), At = f(() => {
136
142
  let e = [{ after: c() }];
137
143
  return M && e.push({ before: s(M) }), e;
138
- }, [M]), Ot = d((e) => {
144
+ }, [M]), jt = d((e) => {
139
145
  if (e) {
140
146
  let { startDate: e, endDate: t } = ie();
141
147
  N(e), F(t);
142
148
  }
143
149
  j(e);
144
- }, []), kt = d(async () => {
150
+ }, []), Mt = d(async () => {
145
151
  if (!b || !x.canRead || !M || !P || !o(M, P)) return;
146
152
  j(!1);
147
153
  let t = e.loading(g.exportLoadingToast);
@@ -199,26 +205,29 @@ function m({ accountId: m, onBack: Ae, labels: je, featureLabels: Me, isBankingT
199
205
  isBankingTaglineVisible: Ne,
200
206
  activeTab: T,
201
207
  transactionRows: mt,
208
+ isTransactionsError: yt,
209
+ isTransactionsLoading: vt,
210
+ onTransactionsRetry: bt,
202
211
  statementRows: _t,
203
- isStatementsLoading: yt,
204
- isStatementsError: bt,
205
- onStatementsRetry: xt,
206
- isStatementsPaginationVisible: vt,
212
+ isStatementsLoading: St,
213
+ isStatementsError: Ct,
214
+ onStatementsRetry: wt,
215
+ isStatementsPaginationVisible: xt,
207
216
  statementsPageSize: I,
208
217
  statementsPageSizeOptions: Ee,
209
218
  isStatementsPreviousPageDisabled: !Z,
210
219
  isStatementsNextPageDisabled: !X,
211
- onStatementsPageSizeChange: St,
212
- onStatementsPreviousPageClick: Ct,
213
- onStatementsNextPageClick: wt,
220
+ onStatementsPageSizeChange: Tt,
221
+ onStatementsPreviousPageClick: Et,
222
+ onStatementsNextPageClick: Dt,
214
223
  showExport: ht,
215
224
  isExportOpen: Xe,
216
225
  exportStartDate: M,
217
226
  exportEndDate: P,
218
227
  isExportDownloading: ot,
219
- isExportDownloadDisabled: Tt,
220
- disabledExportStartDates: Et,
221
- disabledExportEndDates: Dt,
228
+ isExportDownloadDisabled: Ot,
229
+ disabledExportStartDates: kt,
230
+ disabledExportEndDates: At,
222
231
  accountNumberLabel: q?.accountNumber ?? "",
223
232
  maskedAccountNumberLabel: ue(q?.accountNumber ?? ""),
224
233
  accountNumberTestId: "bank-accounts-widget-detail-account-number",
@@ -233,8 +242,8 @@ function m({ accountId: m, onBack: Ae, labels: je, featureLabels: Me, isBankingT
233
242
  isAccountNumberCopied: Ke,
234
243
  isRoutingNumberCopied: qe,
235
244
  isDomesticWireExpanded: Je,
236
- isLoading: !y && (Ve && !q || Be && !v || C && (H.isLoading || T === "transactions" && U.isLoading)),
237
- isError: y || C && (H.isError || T === "transactions" && U.isError),
245
+ isLoading: !y && (Ve && !q || Be && !v || C && H.isLoading),
246
+ isError: y || C && H.isError,
238
247
  isEditOpen: Ue,
239
248
  isEditDisabled: !x.canWrite,
240
249
  isEditError: G,
@@ -270,11 +279,11 @@ function m({ accountId: m, onBack: Ae, labels: je, featureLabels: Me, isBankingT
270
279
  });
271
280
  },
272
281
  onEditNicknameClick: () => $(!0),
273
- onExportOpenChange: Ot,
282
+ onExportOpenChange: jt,
274
283
  onExportStartDateChange: N,
275
284
  onExportEndDateChange: F,
276
285
  onExportDownload: () => {
277
- kt();
286
+ Mt();
278
287
  }
279
288
  });
280
289
  }
@@ -2,73 +2,86 @@
2
2
  "use client";
3
3
  "use client";
4
4
  "use client";
5
- import { Button as e, Table as t, TableBody as n, TableCell as r, TableHead as i, TableHeader as a, TableRow as o } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import { jsx as s, jsxs as c } from "react/jsx-runtime";
7
- import { DownloadIcon as l } from "lucide-react";
5
+ import { Button as e, Skeleton as t, Table as n, TableBody as r, TableCell as i, TableHead as a, TableHeader as o, TableRow as s } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import { ErrorState as c } from "../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
7
+ import "../../../../shared/ui/dist/index.js";
8
+ import { jsx as l, jsxs as u } from "react/jsx-runtime";
9
+ import { DownloadIcon as d } from "lucide-react";
8
10
  // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index6.js
9
- function u({ labels: u, rows: d, showExport: f = !1, onExportClick: p }) {
10
- return d.length === 0 ? /* @__PURE__ */ s("div", {
11
+ function f({ labels: f, rows: p, showExport: m = !1, onExportClick: h, isError: g = !1, onRetry: _, isLoading: v = !1 }) {
12
+ return g ? /* @__PURE__ */ l("div", {
13
+ className: "ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card",
14
+ children: /* @__PURE__ */ l(c, {
15
+ title: f.transactionsErrorTitle,
16
+ retryLabel: _ ? f.transactionsErrorRetry : void 0,
17
+ onRetry: _
18
+ })
19
+ }) : v ? /* @__PURE__ */ l("div", {
20
+ className: "ttw:space-y-3 ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-6",
21
+ "aria-label": f.transactionsLoadingLabel,
22
+ children: Array.from({ length: 3 }).map((e, n) => /* @__PURE__ */ l(t, { className: "ttw:h-5 ttw:w-full" }, n))
23
+ }) : p.length === 0 ? /* @__PURE__ */ l("div", {
11
24
  className: "ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card ttw:p-6",
12
- children: /* @__PURE__ */ s("p", {
25
+ children: /* @__PURE__ */ l("p", {
13
26
  className: "ttw:text-muted-foreground",
14
- children: u.noTransactionsLabel
27
+ children: f.noTransactionsLabel
15
28
  })
16
- }) : /* @__PURE__ */ s("div", {
29
+ }) : /* @__PURE__ */ l("div", {
17
30
  className: "ttw:overflow-hidden ttw:rounded-xl ttw:border ttw:border-border ttw:bg-card",
18
- children: /* @__PURE__ */ c(t, { children: [/* @__PURE__ */ c(a, {
19
- className: f ? "ttw:[&_tr:first-child]:border-b-0" : void 0,
20
- children: [f ? /* @__PURE__ */ s(o, {
31
+ children: /* @__PURE__ */ u(n, { children: [/* @__PURE__ */ u(o, {
32
+ className: m ? "ttw:[&_tr:first-child]:border-b-0" : void 0,
33
+ children: [m ? /* @__PURE__ */ l(s, {
21
34
  className: "ttw:border-b-0 ttw:bg-card ttw:hover:bg-card",
22
- children: /* @__PURE__ */ s(i, {
35
+ children: /* @__PURE__ */ l(a, {
23
36
  colSpan: 4,
24
37
  className: "ttw:h-auto ttw:px-4 ttw:py-3 ttw:text-right",
25
- children: /* @__PURE__ */ c(e, {
38
+ children: /* @__PURE__ */ u(e, {
26
39
  type: "button",
27
40
  variant: "outline",
28
41
  size: "sm",
29
- onClick: p,
30
- children: [/* @__PURE__ */ s(l, { className: "ttw:size-4" }), u.exportButton]
42
+ onClick: h,
43
+ children: [/* @__PURE__ */ l(d, { className: "ttw:size-4" }), f.exportButton]
31
44
  })
32
45
  })
33
- }) : null, /* @__PURE__ */ c(o, {
46
+ }) : null, /* @__PURE__ */ u(s, {
34
47
  className: "ttw:border-border ttw:bg-card ttw:hover:bg-card",
35
48
  children: [
36
- /* @__PURE__ */ s(i, {
49
+ /* @__PURE__ */ l(a, {
37
50
  className: "ttw:h-auto ttw:w-[15%] ttw:px-4 ttw:py-3 ttw:font-semibold",
38
- children: u.transactionDateColumn
51
+ children: f.transactionDateColumn
39
52
  }),
40
- /* @__PURE__ */ s(i, {
53
+ /* @__PURE__ */ l(a, {
41
54
  className: "ttw:h-auto ttw:w-[60%] ttw:px-4 ttw:py-3 ttw:font-semibold",
42
- children: u.transactionDescriptionColumn
55
+ children: f.transactionDescriptionColumn
43
56
  }),
44
- /* @__PURE__ */ s(i, {
57
+ /* @__PURE__ */ l(a, {
45
58
  className: "ttw:h-auto ttw:w-[12%] ttw:px-4 ttw:py-3 ttw:text-right ttw:font-semibold",
46
- children: u.transactionAmountColumn
59
+ children: f.transactionAmountColumn
47
60
  }),
48
- /* @__PURE__ */ s(i, {
61
+ /* @__PURE__ */ l(a, {
49
62
  className: "ttw:h-auto ttw:w-[13%] ttw:px-4 ttw:py-3 ttw:text-right ttw:font-semibold",
50
- children: u.transactionBalanceColumn
63
+ children: f.transactionBalanceColumn
51
64
  })
52
65
  ]
53
66
  })]
54
- }), /* @__PURE__ */ s(n, {
67
+ }), /* @__PURE__ */ l(r, {
55
68
  className: "ttw:bg-card",
56
- children: d.map((e) => /* @__PURE__ */ c(o, {
69
+ children: p.map((e) => /* @__PURE__ */ u(s, {
57
70
  className: "ttw:bg-card ttw:hover:bg-transparent",
58
71
  children: [
59
- /* @__PURE__ */ s(r, {
72
+ /* @__PURE__ */ l(i, {
60
73
  className: "ttw:px-4 ttw:py-3 ttw:align-top",
61
74
  children: e.dateLabel
62
75
  }),
63
- /* @__PURE__ */ s(r, {
76
+ /* @__PURE__ */ l(i, {
64
77
  className: "ttw:px-4 ttw:py-3 ttw:align-top ttw:font-medium",
65
78
  children: e.descriptionLabel
66
79
  }),
67
- /* @__PURE__ */ s(r, {
80
+ /* @__PURE__ */ l(i, {
68
81
  className: `ttw:px-4 ttw:py-3 ttw:text-right ttw:align-top ttw:whitespace-nowrap ${e.amountVariant === "positive" ? "ttw:text-green-700" : "ttw:text-foreground"}`,
69
82
  children: e.amountLabel
70
83
  }),
71
- /* @__PURE__ */ s(r, {
84
+ /* @__PURE__ */ l(i, {
72
85
  className: "ttw:px-4 ttw:py-3 ttw:text-right ttw:align-top ttw:whitespace-nowrap",
73
86
  children: e.balanceLabel
74
87
  })
@@ -77,4 +90,4 @@ function u({ labels: u, rows: d, showExport: f = !1, onExportClick: p }) {
77
90
  })] })
78
91
  });
79
92
  }
80
- export { u as TransactionsTable };
93
+ export { f as TransactionsTable };
@@ -8,6 +8,9 @@ var e = {
8
8
  statementsTab: "Statements",
9
9
  detailsTab: "Details",
10
10
  noTransactionsLabel: "No transactions found",
11
+ transactionsErrorTitle: "Unable to load transactions.",
12
+ transactionsErrorRetry: "Retry",
13
+ transactionsLoadingLabel: "Loading transactions",
11
14
  transactionDateColumn: "Date",
12
15
  transactionDescriptionColumn: "Description",
13
16
  transactionAmountColumn: "Amount",
@@ -14,15 +14,15 @@ import { TransactionsTable as se } from "./index6.js";
14
14
  import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
15
15
  import { ChevronLeftIcon as m, HelpCircleIcon as h } from "lucide-react";
16
16
  // ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index8.js
17
- function g({ labels: g, title: _, bankDisplayName: v, bankLogoSrc: y, bankLogoAlt: b, balanceLabel: x, balanceTestId: S, isBankingTaglineVisible: C, activeTab: w, transactionRows: T, statementRows: E, isStatementsLoading: D, isStatementsError: O, onStatementsRetry: k, isStatementsPaginationVisible: A, statementsPageSize: j, statementsPageSizeOptions: M, statementsRangeLabel: N = "", isStatementsPreviousPageDisabled: P, isStatementsNextPageDisabled: F, onStatementsPageSizeChange: I, onStatementsPreviousPageClick: L, onStatementsNextPageClick: R, showExport: z, isExportOpen: B, exportStartDate: V, exportEndDate: H, isExportDownloading: U, isExportDownloadDisabled: W, disabledExportStartDates: G, disabledExportEndDates: K, accountNumberLabel: ce, maskedAccountNumberLabel: le, accountNumberTestId: ue, routingNumberLabel: de, bankAddressLabel: fe, wireAccountNumberLabel: pe, domesticWireIntroLabel: me, domesticWireNoteLabel: he, thingsToKnowBodyLabel: ge, supportTeamHref: _e, isAccountNumberVisible: q, isAccountNumberCopied: ve, isRoutingNumberCopied: ye, isDomesticWireExpanded: be, isLoading: J, isError: Y, isEditOpen: xe, isEditDisabled: Se, isEditError: Ce, isSubmitting: we, isEditSaveDisabled: Te, editForm: Ee, canEdit: De, onBack: Oe, onTabChange: ke, onToggleAccountNumberVisibility: Ae, onCopyAccountNumber: X, onCopyRoutingNumber: Z, onCopyBankName: je, onCopyBankAddress: Me, onDomesticWireExpandedChange: Ne, onEditOpenChange: Pe, onEditFormChange: Fe, onEditSubmit: Ie, onEditNicknameClick: Le, onExportOpenChange: Q, onExportStartDateChange: Re, onExportEndDateChange: ze, onExportDownload: Be }) {
17
+ function g({ labels: g, title: _, bankDisplayName: v, bankLogoSrc: y, bankLogoAlt: b, balanceLabel: x, balanceTestId: S, isBankingTaglineVisible: C, activeTab: w, transactionRows: T, isTransactionsError: E, isTransactionsLoading: D, onTransactionsRetry: O, statementRows: k, isStatementsLoading: A, isStatementsError: j, onStatementsRetry: M, isStatementsPaginationVisible: N, statementsPageSize: P, statementsPageSizeOptions: F, statementsRangeLabel: I = "", isStatementsPreviousPageDisabled: L, isStatementsNextPageDisabled: R, onStatementsPageSizeChange: z, onStatementsPreviousPageClick: B, onStatementsNextPageClick: V, showExport: H, isExportOpen: U, exportStartDate: W, exportEndDate: G, isExportDownloading: K, isExportDownloadDisabled: ce, disabledExportStartDates: le, disabledExportEndDates: ue, accountNumberLabel: de, maskedAccountNumberLabel: fe, accountNumberTestId: pe, routingNumberLabel: me, bankAddressLabel: he, wireAccountNumberLabel: ge, domesticWireIntroLabel: _e, domesticWireNoteLabel: ve, thingsToKnowBodyLabel: ye, supportTeamHref: be, isAccountNumberVisible: q, isAccountNumberCopied: xe, isRoutingNumberCopied: Se, isDomesticWireExpanded: Ce, isLoading: J, isError: Y, isEditOpen: we, isEditDisabled: Te, isEditError: Ee, isSubmitting: De, isEditSaveDisabled: Oe, editForm: ke, canEdit: Ae, onBack: je, onTabChange: Me, onToggleAccountNumberVisibility: Ne, onCopyAccountNumber: X, onCopyRoutingNumber: Z, onCopyBankName: Pe, onCopyBankAddress: Fe, onDomesticWireExpandedChange: Ie, onEditOpenChange: Le, onEditFormChange: Re, onEditSubmit: ze, onEditNicknameClick: Be, onExportOpenChange: Q, onExportStartDateChange: Ve, onExportEndDateChange: He, onExportDownload: Ue }) {
18
18
  let $ = {
19
19
  ...te,
20
20
  ...g
21
- }, Ve = /* @__PURE__ */ p(e, {
21
+ }, We = /* @__PURE__ */ p(e, {
22
22
  type: "button",
23
23
  variant: "ghost",
24
24
  className: "ttw:h-auto ttw:justify-start ttw:gap-1 ttw:px-0 ttw:py-1 ttw:has-[>svg]:px-0 ttw:text-sm ttw:font-medium ttw:leading-5 ttw:text-primary ttw:hover:bg-transparent",
25
- onClick: Oe,
25
+ onClick: je,
26
26
  children: [/* @__PURE__ */ f(m, { className: "ttw:size-4" }), $.backToAccounts]
27
27
  });
28
28
  return /* @__PURE__ */ p("section", {
@@ -30,34 +30,34 @@ function g({ labels: g, title: _, bankDisplayName: v, bankLogoSrc: y, bankLogoAl
30
30
  children: [
31
31
  !J && !Y ? /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f(ie, {
32
32
  labels: $,
33
- open: xe,
34
- form: Ee,
35
- isSubmitting: we,
36
- isSaveDisabled: Te,
37
- isError: Ce,
38
- onOpenChange: Pe,
39
- onFormChange: Fe,
40
- onSubmit: Ie
33
+ open: we,
34
+ form: ke,
35
+ isSubmitting: De,
36
+ isSaveDisabled: Oe,
37
+ isError: Ee,
38
+ onOpenChange: Le,
39
+ onFormChange: Re,
40
+ onSubmit: ze
41
41
  }), /* @__PURE__ */ f(ae, {
42
42
  labels: $,
43
- open: B,
44
- startDate: V,
45
- endDate: H,
46
- isDownloading: U,
47
- isDownloadDisabled: W,
48
- disabledStartDates: G,
49
- disabledEndDates: K,
43
+ open: U,
44
+ startDate: W,
45
+ endDate: G,
46
+ isDownloading: K,
47
+ isDownloadDisabled: ce,
48
+ disabledStartDates: le,
49
+ disabledEndDates: ue,
50
50
  onOpenChange: Q,
51
- onStartDateChange: Re,
52
- onEndDateChange: ze,
53
- onDownload: Be
51
+ onStartDateChange: Ve,
52
+ onEndDateChange: He,
53
+ onDownload: Ue
54
54
  })] }) : null,
55
55
  /* @__PURE__ */ p("div", {
56
56
  className: "ttw:flex ttw:items-start ttw:justify-between ttw:gap-4",
57
- children: [Ve, !J && !Y ? /* @__PURE__ */ f(re, {
57
+ children: [We, !J && !Y ? /* @__PURE__ */ f(re, {
58
58
  labels: $,
59
- canEdit: De,
60
- onEditNickname: Le
59
+ canEdit: Ae,
60
+ onEditNickname: Be
61
61
  }) : null]
62
62
  }),
63
63
  J ? /* @__PURE__ */ p("div", {
@@ -110,7 +110,7 @@ function g({ labels: g, title: _, bankDisplayName: v, bankLogoSrc: y, bankLogoAl
110
110
  })]
111
111
  }), /* @__PURE__ */ p(ee, {
112
112
  value: w,
113
- onValueChange: (e) => ke(e),
113
+ onValueChange: (e) => Me(e),
114
114
  className: "ttw:gap-4",
115
115
  children: [
116
116
  /* @__PURE__ */ p(r, { children: [
@@ -132,55 +132,58 @@ function g({ labels: g, title: _, bankDisplayName: v, bankLogoSrc: y, bankLogoAl
132
132
  children: /* @__PURE__ */ f(se, {
133
133
  labels: $,
134
134
  rows: T,
135
- showExport: z,
136
- onExportClick: () => Q(!0)
135
+ showExport: H,
136
+ onExportClick: () => Q(!0),
137
+ isError: E,
138
+ isLoading: D,
139
+ onRetry: O
137
140
  })
138
141
  }),
139
142
  /* @__PURE__ */ f(n, {
140
143
  value: "statements",
141
144
  children: /* @__PURE__ */ f(oe, {
142
145
  labels: $,
143
- rows: E,
144
- isLoading: D,
145
- isError: O,
146
- onRetry: k,
147
- isPaginationVisible: A,
148
- pageSize: j,
149
- pageSizeOptions: M,
150
- rangeLabel: N,
151
- isPreviousPageDisabled: P,
152
- isNextPageDisabled: F,
153
- onPageSizeChange: I,
154
- onPreviousPageClick: L,
155
- onNextPageClick: R
146
+ rows: k,
147
+ isLoading: A,
148
+ isError: j,
149
+ onRetry: M,
150
+ isPaginationVisible: N,
151
+ pageSize: P,
152
+ pageSizeOptions: F,
153
+ rangeLabel: I,
154
+ isPreviousPageDisabled: L,
155
+ isNextPageDisabled: R,
156
+ onPageSizeChange: z,
157
+ onPreviousPageClick: B,
158
+ onNextPageClick: V
156
159
  })
157
160
  }),
158
161
  /* @__PURE__ */ f(n, {
159
162
  value: "details",
160
163
  children: /* @__PURE__ */ f(ne, {
161
164
  labels: $,
162
- routingNumberLabel: de,
163
- accountNumberDisplayLabel: q ? ce : le,
164
- accountNumberTestId: ue,
165
- wireAccountNumberLabel: pe,
165
+ routingNumberLabel: me,
166
+ accountNumberDisplayLabel: q ? de : fe,
167
+ accountNumberTestId: pe,
168
+ wireAccountNumberLabel: ge,
166
169
  bankNameLabel: v,
167
- bankAddressLabel: fe,
168
- domesticWireIntroLabel: me,
169
- domesticWireNoteLabel: he,
170
- thingsToKnowBodyLabel: ge,
171
- supportTeamHref: _e,
170
+ bankAddressLabel: he,
171
+ domesticWireIntroLabel: _e,
172
+ domesticWireNoteLabel: ve,
173
+ thingsToKnowBodyLabel: ye,
174
+ supportTeamHref: be,
172
175
  isAccountNumberVisible: q,
173
- isAccountNumberCopied: ve,
174
- isRoutingNumberCopied: ye,
175
- isDomesticWireExpanded: be,
176
- onDomesticWireExpandedChange: Ne,
177
- onToggleAccountNumberVisibility: Ae,
176
+ isAccountNumberCopied: xe,
177
+ isRoutingNumberCopied: Se,
178
+ isDomesticWireExpanded: Ce,
179
+ onDomesticWireExpandedChange: Ie,
180
+ onToggleAccountNumberVisibility: Ne,
178
181
  onCopyAccountNumber: X,
179
182
  onCopyRoutingNumber: Z,
180
183
  onCopyWireAccountNumber: X,
181
184
  onCopyWireRoutingNumber: Z,
182
- onCopyBankName: je,
183
- onCopyBankAddress: Me
185
+ onCopyBankName: Pe,
186
+ onCopyBankAddress: Fe
184
187
  })
185
188
  })
186
189
  ]
@@ -6,58 +6,97 @@ import { useEmbedApi as e } from "../../../../../shared/data-access/dist/lib/Emb
6
6
  import { useGetUserDataQuery as t } from "../../../../../shared/data-access/dist/lib/useGetUserDataQuery.js";
7
7
  import { useUpsertUserDataMutation as n } from "../../../../../shared/data-access/dist/lib/useUpsertUserDataMutation.js";
8
8
  import "../../../../../shared/data-access/dist/index.js";
9
- import { getDismissedInsightsUserDataKey as r } from "./dismissedInsightsUserDataKey.js";
10
- import { useCallback as i, useEffect as a, useMemo as o, useRef as s, useState as c } from "react";
9
+ import { useWidgetConfig as r, useWidgetInitStaleForToken as i } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
10
+ import "../../../../../shared/feature/dist/index.js";
11
+ import { getDismissedInsightsUserDataKey as a } from "./dismissedInsightsUserDataKey.js";
12
+ import { useCallback as o, useEffect as s, useMemo as c, useRef as l, useState as u } from "react";
11
13
  // ../../libs/tesouro-embedded-components-react/insights-widget/feature/dist/lib/InsightsWidget/useDismissedInsightIds.js
12
- function l(e) {
14
+ function d(e) {
13
15
  return Array.isArray(e) ? e.filter((e) => typeof e == "string") : [];
14
16
  }
15
- function u(e, t) {
17
+ function f(e, t) {
16
18
  if (e.length !== t.length) return !1;
17
19
  for (let n = 0; n < e.length; n++) if (e[n] !== t[n]) return !1;
18
20
  return !0;
19
21
  }
20
- function d() {
21
- let { organizationId: d } = e(), f = r(d), { data: p, dataUpdatedAt: m, isLoading: h, isError: g, refetch: _ } = t({
22
- key: f,
23
- defaultWhenNotFound: []
24
- }), { mutateAsync: v } = n(), y = o(() => f ? p?.value === void 0 ? g ? [] : null : l(p.value) : null, [
25
- p,
26
- m,
27
- g,
28
- f
29
- ]), [b, x] = c([]), S = s([]), C = s(f);
30
- C.current = f;
31
- let w = s(f);
32
- a(() => {
33
- f ? (w.current !== f && (w.current = f, x([]), S.current = []), !(h || y === null) && (x((e) => u(e, y) ? e : y), S.current = y)) : (x((e) => e.length === 0 ? e : []), S.current = [], w.current = f);
22
+ function p(e, t) {
23
+ let n = t.filter((t) => !e.includes(t));
24
+ return n.length === 0 ? e : [...e, ...n];
25
+ }
26
+ function m() {
27
+ let { organizationId: m } = e(), { initResponse: h } = r(), g = i(), _ = a(m), v = !!(!g && _ && h?.userId), y = l(null);
28
+ g || (y.current = h?.userId ?? null);
29
+ let b = y.current, x = _ ? `${_}:${b ?? "session"}` : "", { data: S, dataUpdatedAt: C, isLoading: w, isError: T, isPlaceholderData: E, refetch: D } = t({
30
+ key: _,
31
+ defaultWhenNotFound: [],
32
+ enabled: v
33
+ }), { mutateAsync: O } = n(), k = c(() => !v || E ? null : S?.value === void 0 ? T ? [] : null : d(S.value), [
34
+ v,
35
+ S,
36
+ C,
37
+ T,
38
+ E
39
+ ]), [A, j] = u([]), [M, N] = u(""), P = l([]), F = l([]), I = l(x);
40
+ I.current = x;
41
+ let L = l({
42
+ key: _,
43
+ userId: b
44
+ });
45
+ s(() => {
46
+ let e = L.current;
47
+ if (L.current = {
48
+ key: _,
49
+ userId: b
50
+ }, !_ || e.key !== _) j((e) => e.length === 0 ? e : []), N(""), P.current = [], F.current = [];
51
+ else if (e.userId !== b && e.userId !== null) {
52
+ let e = F.current;
53
+ j((t) => f(t, e) ? t : e), N(""), P.current = [];
54
+ }
55
+ if (!v || w || k === null) return;
56
+ let t = F.current, n = p(k, t);
57
+ if (j((e) => f(e, n) ? e : n), N(x), P.current = k, t.length === 0 || (F.current = [], n === k)) return;
58
+ let r = x;
59
+ O({
60
+ path: { key: _ },
61
+ body: { value: n }
62
+ }).then(() => {
63
+ r === I.current && (P.current = n);
64
+ }).catch((e) => {
65
+ r === I.current && (j(P.current), console.error("Error persisting dismissed insight id", e));
66
+ });
34
67
  }, [
35
- f,
36
- h,
37
- y
68
+ v,
69
+ x,
70
+ _,
71
+ w,
72
+ O,
73
+ k,
74
+ b
38
75
  ]);
39
- let T = g, E = i((e) => {
40
- if (!f) return;
41
- let t = b, n = t.includes(e) ? t : [...t, e], r = f;
42
- x(n), v({
76
+ let R = v && T, z = o((e) => {
77
+ if (!_ || !x) return;
78
+ let t = A, n = t.includes(e) ? t : [...t, e], r = _, i = x;
79
+ j(n), v ? O({
43
80
  path: { key: r },
44
81
  body: { value: n }
45
82
  }).then(() => {
46
- r === C.current && (S.current = n);
83
+ i === I.current && (P.current = n);
47
84
  }).catch((e) => {
48
- r === C.current && (x(S.current), console.error("Error persisting dismissed insight id", e));
49
- });
85
+ i === I.current && (j(P.current), console.error("Error persisting dismissed insight id", e));
86
+ }) : F.current.includes(e) || (F.current = [...F.current, e]);
50
87
  }, [
51
- b,
52
- f,
53
- v
54
- ]);
88
+ v,
89
+ A,
90
+ _,
91
+ x,
92
+ O
93
+ ]), B = o(() => v ? D() : Promise.resolve(void 0), [v, D]);
55
94
  return {
56
- dismissedIds: b,
57
- isLoading: f ? h : !1,
58
- isError: T,
59
- refetch: _,
60
- dismissInsight: E
95
+ dismissedIds: A,
96
+ isLoading: v ? w || !!(E && M !== x) : !1,
97
+ isError: R,
98
+ refetch: B,
99
+ dismissInsight: z
61
100
  };
62
101
  }
63
- export { d as useDismissedInsightIds };
102
+ export { m as useDismissedInsightIds };
@@ -1,5 +1,5 @@
1
1
  // ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.10.2", n = "b8b36be3b9c28307bf603b0c0ffa1f64496d0199", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.10.5", n = "6ec45370f19a1205a1afb45e36a8966cac2b7f09", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.10.2",
3
+ "version": "0.10.5",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "sideEffects": [