@tesouro/embedded-components-react 0.5.191 → 0.5.193

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.css CHANGED
@@ -6526,6 +6526,9 @@
6526
6526
  .ttw\:\[\&\[data-state\=open\]\>svg\]\:rotate-180[data-state=open] > svg {
6527
6527
  rotate: 180deg;
6528
6528
  }
6529
+ .dark .ttw\:\[\.dark_\&\]\:bg-background {
6530
+ background-color: var(--ttw-background);
6531
+ }
6529
6532
  @media (resolution>192dpi) {
6530
6533
  .ttw\:\[\@media\(resolution\>192dpi\)\]\:min-h-\[1828px\] {
6531
6534
  min-height: 1828px;
@@ -1,3 +1,3 @@
1
- import { AccountDetailsWidget as e } from "./index8.js";
2
- import "./index10.js";
1
+ import { AccountDetailsWidget as e } from "./index9.js";
2
+ import "./index11.js";
3
3
  export { e as AccountDetailsWidget };
@@ -1,6 +1,8 @@
1
+ import { formatDateParam as e, startOfLocalDay as t } from "./index3.js";
1
2
  //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index7.js
2
- function e(e, t) {
3
- return Object.entries(t).reduce((e, [t, n]) => e.replaceAll(`{${t}}`, n), e);
3
+ function n(n = /* @__PURE__ */ new Date()) {
4
+ let r = t(n);
5
+ return r.setFullYear(r.getFullYear() - 7), e(r);
4
6
  }
5
7
  //#endregion
6
- export { e as interpolateLabel };
8
+ export { n as getStatementsStartDate };
@@ -1,284 +1,6 @@
1
- "use client";
2
- "use client";
3
- "use client";
4
- "use client";
5
- import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
- import "../../../../shared/ui/dist/index.js";
7
- import { useAnalyticsTrack as t } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
8
- import { useWidgetConfig as n, useWidgetError as r, useWidgetLoading as ee } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
- import "../../../../shared/feature/dist/index.js";
10
- import { AccountDetailsWidgetAnalyticsEvent as i } from "./index2.js";
11
- import { formatDateParam as te, getDefaultExportDateRange as ne, isExportRangeValid as a, startOfLocalDay as o, triggerCsvDownload as re, yesterdayLocal as s } from "./index3.js";
12
- import { copyTextToClipboard as ie, formatAmountLabel as c, formatSignedTransactionAmountLabel as ae, formatStatementPeriodLabel as oe, formatTransactionDateLabel as se, maskAccountNumber as ce } from "./index4.js";
13
- import { DEFAULT_FEATURE_LABELS as le } from "./index5.js";
14
- import { getBankAccountsPermissions as ue } from "./index6.js";
15
- import { interpolateLabel as l } from "./index7.js";
16
- import { useBankAccountDetailsQuery as de } from "../../data-access/dist/index2.js";
17
- import { useBankAccountStatementsQuery as fe } from "../../data-access/dist/index3.js";
18
- import { useBankAccountTransactionsQuery as pe } from "../../data-access/dist/index4.js";
19
- import { useDownloadBankAccountTransactionsMutation as me } from "../../data-access/dist/index5.js";
20
- import { useRetrieveBankAccountStatementMutation as he } from "../../data-access/dist/index6.js";
21
- import { useUpdateBankAccountMutation as ge } from "../../data-access/dist/index7.js";
22
- import "../../data-access/dist/index.js";
23
- import { DEFAULT_LABELS as _e } from "../../ui/dist/index7.js";
24
- import { AccountDetailsWidgetUi as ve } from "../../ui/dist/index8.js";
25
- import "../../ui/dist/index.js";
26
- import { useCallback as u, useEffect as ye, useMemo as d, useState as f } from "react";
27
- import { jsx as be } from "react/jsx-runtime";
28
1
  //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index8.js
29
- var xe = 3e3, Se = 5e3, Ce = [
30
- 10,
31
- 25,
32
- 50
33
- ], we = 10, Te = 6e5, Ee = { nickname: "" };
34
- function p({ accountId: p, onBack: De, labels: Oe, featureLabels: ke, isBankingTaglineVisible: Ae = !0, bankLogoSrc: je, bankLogoAlt: Me, bankAddress: Ne, supportTeamUrl: Pe }) {
35
- let m = {
36
- ..._e,
37
- ...Oe
38
- }, h = {
39
- ...le,
40
- ...ke
41
- }, g = t(), { organizationId: Fe, widgetToken: Ie, initResponse: _ } = n(), Le = ee(), v = !!r(), y = !!(Fe && Ie), b = d(() => ue(_?.scopes), [_?.scopes]), x = b.canRead && !!_, S = y && x, C = x && !y, [w, Re] = f("transactions"), [ze, T] = f(!1), [E, D] = f(Ee), [Be, Ve] = f(!1), [He, Ue] = f(!1), [We, Ge] = f(!1), [Ke, qe] = f(!1), [Je, Ye] = f(!1), [O, k] = f(), [A, j] = f(), [M, Xe] = f(we), [N, P] = f(() => ({
42
- accountId: p,
43
- token: void 0
44
- }));
45
- N.accountId !== p && P({
46
- accountId: p,
47
- token: void 0
48
- });
49
- let Ze = N.accountId === p ? N.token : void 0, F = u((e) => {
50
- P((t) => ({
51
- ...t,
52
- token: e
53
- }));
54
- }, []), [I, L] = f(() => /* @__PURE__ */ new Set());
55
- ye(() => {
56
- g(i.Mounted);
57
- }, [g]);
58
- let R = de({
59
- id: p,
60
- enabled: S
61
- }), z = pe({
62
- id: p,
63
- enabled: S && w === "transactions",
64
- limit: 25,
65
- sortBy: "DATE",
66
- sortOrder: "DESC"
67
- }), B = fe({
68
- id: p,
69
- enabled: S && w === "statements",
70
- limit: M,
71
- pagination_token: Ze,
72
- category: "STATEMENTS"
73
- }), Qe = ge(), $e = me(), et = he(), { mutate: tt, isPending: nt, isError: V, reset: H } = Qe, { mutateAsync: U, isPending: rt } = $e, { mutateAsync: W } = et, G = x ? R.data : void 0, K = _?.bankName?.trim() ?? "", q = Ne?.trim() || void 0, J = { bankName: K }, it = d(() => l(m.domesticWireIntro, J), [m.domesticWireIntro, K]), at = d(() => l(m.domesticWireNote, J), [m.domesticWireNote, K]), ot = d(() => l(m.thingsToKnowBody, J), [m.thingsToKnowBody, K]), st = G?.nickname?.trim() || h.accountFallback, ct = c(G?.balance), Y = d(() => (z.data?.data ?? []).map((e, t) => ({
74
- key: `${e.date}-${t}`,
75
- descriptionLabel: e.description,
76
- dateLabel: se(e.date),
77
- amountLabel: ae(e.amount, e.direction),
78
- amountVariant: e.direction === "CREDIT" ? "positive" : "default",
79
- balanceLabel: c(e.runningBalance)
80
- })), [z.data?.data]), lt = b.canRead && Y.length > 0, X = u((t) => {
81
- if (!y || !b.canRead) return;
82
- let n = window.open("", "_blank");
83
- if (!n) {
84
- e.error(h.viewStatementErrorToast);
85
- return;
86
- }
87
- n.opener = null, L((e) => new Set(e).add(t)), W({
88
- id: p,
89
- statementId: t
90
- }).then((e) => {
91
- let t = URL.createObjectURL(e);
92
- n.location.href = t, window.setTimeout(() => URL.revokeObjectURL(t), Te);
93
- }).catch(() => {
94
- n.close(), e.error(h.viewStatementErrorToast);
95
- }).finally(() => {
96
- L((e) => {
97
- if (!e.has(t)) return e;
98
- let n = new Set(e);
99
- return n.delete(t), n;
100
- });
101
- });
102
- }, [
103
- p,
104
- h.viewStatementErrorToast,
105
- y,
106
- b.canRead,
107
- W
108
- ]), ut = d(() => (B.data?.data ?? []).map((e) => {
109
- let t = oe(e.statementDate);
110
- return {
111
- key: e.statementId,
112
- label: t,
113
- viewButtonAriaLabel: l(m.viewStatementButtonAriaLabel, { date: t }),
114
- isViewDisabled: I.has(e.statementId),
115
- onView: () => X(e.statementId)
116
- };
117
- }), [
118
- B.data?.data,
119
- m.viewStatementButtonAriaLabel,
120
- I,
121
- X
122
- ]), Z = B.data?.nextPaginationToken ?? void 0, Q = B.data?.prevPaginationToken ?? void 0, dt = S && w === "statements" && !!B.data && !B.isError, ft = S && w === "statements" && B.isLoading, pt = S && w === "statements" && B.isError, mt = u(() => {
123
- B.refetch();
124
- }, [B.refetch]), ht = u((e) => {
125
- Xe(e), F(void 0);
126
- }, []), gt = u(() => {
127
- F(Q);
128
- }, [Q]), _t = u(() => {
129
- F(Z);
130
- }, [Z]), vt = C || !a(O, A), yt = d(() => {
131
- let e = [{ after: s() }];
132
- return A && e.push({ after: o(A) }), e;
133
- }, [A]), bt = d(() => {
134
- let e = [{ after: s() }];
135
- return O && e.push({ before: o(O) }), e;
136
- }, [O]), xt = u((e) => {
137
- if (e) {
138
- let { startDate: e, endDate: t } = ne();
139
- k(e), j(t);
140
- }
141
- Ye(e);
142
- }, []), St = u(async () => {
143
- if (!y || !b.canRead || !O || !A || !a(O, A)) return;
144
- Ye(!1);
145
- let t = e.loading(h.exportLoadingToast);
146
- try {
147
- let n = await U({
148
- id: p,
149
- startDate: te(O),
150
- endDate: te(A)
151
- });
152
- re(n.csv, n.filename), e.success(h.exportSuccessToast, {
153
- id: t,
154
- duration: xe
155
- });
156
- } catch {
157
- e.error(h.exportErrorToast, {
158
- id: t,
159
- duration: Se
160
- });
161
- }
162
- }, [
163
- p,
164
- U,
165
- A,
166
- O,
167
- h.exportErrorToast,
168
- h.exportLoadingToast,
169
- h.exportSuccessToast,
170
- y,
171
- b.canRead
172
- ]), $ = u(async (t, n) => {
173
- if (!await ie(t)) return;
174
- let r = {
175
- account: h.copyAccountNumberToast,
176
- routing: h.copyRoutingNumberToast,
177
- bankName: h.copyBankNameToast,
178
- bankAddress: h.copyBankAddressToast
179
- };
180
- if (e.success(r[n]), n === "account") {
181
- Ue(!0), window.setTimeout(() => Ue(!1), 2e3);
182
- return;
183
- }
184
- n === "routing" && (Ge(!0), window.setTimeout(() => Ge(!1), 2e3));
185
- }, [
186
- h.copyAccountNumberToast,
187
- h.copyBankAddressToast,
188
- h.copyBankNameToast,
189
- h.copyRoutingNumberToast
190
- ]), Ct = (e) => {
191
- e && (D({ nickname: G?.nickname?.trim() ?? "" }), H()), T(e);
192
- };
193
- return /* @__PURE__ */ be(ve, {
194
- labels: m,
195
- title: st,
196
- bankDisplayName: K,
197
- bankLogoSrc: je,
198
- bankLogoAlt: Me,
199
- balanceLabel: ct,
200
- balanceTestId: "bank-accounts-widget-detail-balance",
201
- isBankingTaglineVisible: Ae,
202
- activeTab: w,
203
- transactionRows: Y,
204
- statementRows: ut,
205
- isStatementsLoading: ft,
206
- isStatementsError: pt,
207
- onStatementsRetry: mt,
208
- isStatementsPaginationVisible: dt,
209
- statementsPageSize: M,
210
- statementsPageSizeOptions: Ce,
211
- isStatementsPreviousPageDisabled: !Q,
212
- isStatementsNextPageDisabled: !Z,
213
- onStatementsPageSizeChange: ht,
214
- onStatementsPreviousPageClick: gt,
215
- onStatementsNextPageClick: _t,
216
- showExport: lt,
217
- isExportOpen: Je,
218
- exportStartDate: O,
219
- exportEndDate: A,
220
- isExportDownloading: rt,
221
- isExportDownloadDisabled: vt,
222
- disabledExportStartDates: yt,
223
- disabledExportEndDates: bt,
224
- accountNumberLabel: G?.accountNumber ?? "",
225
- maskedAccountNumberLabel: ce(G?.accountNumber ?? ""),
226
- accountNumberTestId: "bank-accounts-widget-detail-account-number",
227
- wireAccountNumberLabel: G?.accountNumber ?? "",
228
- routingNumberLabel: G?.routingNumber ?? "",
229
- bankAddressLabel: q,
230
- domesticWireIntroLabel: it,
231
- domesticWireNoteLabel: at,
232
- thingsToKnowBodyLabel: ot,
233
- supportTeamHref: Pe,
234
- isAccountNumberVisible: Be,
235
- isAccountNumberCopied: He,
236
- isRoutingNumberCopied: We,
237
- isDomesticWireExpanded: Ke,
238
- isLoading: !v && (!y && !G || Le && !_ || S && (R.isLoading || w === "transactions" && z.isLoading)),
239
- isError: v || S && (R.isError || w === "transactions" && z.isError),
240
- isEditOpen: ze,
241
- isEditDisabled: !b.canWrite,
242
- isEditError: V,
243
- isSubmitting: nt,
244
- isEditSaveDisabled: C,
245
- editForm: E,
246
- canEdit: b.canWrite,
247
- onBack: De,
248
- onTabChange: Re,
249
- onToggleAccountNumberVisibility: () => Ve((e) => !e),
250
- onCopyAccountNumber: () => void $(G?.accountNumber ?? "", "account"),
251
- onCopyRoutingNumber: () => void $(G?.routingNumber ?? "", "routing"),
252
- onCopyBankName: () => void $(K, "bankName"),
253
- onCopyBankAddress: () => void $(q ?? "", "bankAddress"),
254
- onDomesticWireExpandedChange: qe,
255
- onEditOpenChange: Ct,
256
- onEditFormChange: (e) => {
257
- V && H(), D(e);
258
- },
259
- onEditSubmit: () => {
260
- if (!y || !b.canWrite) return;
261
- let t = E.nickname.trim();
262
- t && tt({
263
- path: { id: p },
264
- body: { nickname: t }
265
- }, {
266
- onSuccess: () => {
267
- g(i.AccountUpdated, { accountId: p }), e.success(h.editSuccessToast), T(!1);
268
- },
269
- onError: () => {
270
- e.error(h.editErrorToast);
271
- }
272
- });
273
- },
274
- onEditNicknameClick: () => Ct(!0),
275
- onExportOpenChange: xt,
276
- onExportStartDateChange: k,
277
- onExportEndDateChange: j,
278
- onExportDownload: () => {
279
- St();
280
- }
281
- });
2
+ function e(e, t) {
3
+ return Object.entries(t).reduce((e, [t, n]) => e.replaceAll(`{${t}}`, n), e);
282
4
  }
283
5
  //#endregion
284
- export { p as AccountDetailsWidget };
6
+ export { e as interpolateLabel };
@@ -0,0 +1,286 @@
1
+ "use client";
2
+ "use client";
3
+ "use client";
4
+ "use client";
5
+ import { toast as e } from "../../../../../../packages/shared-ui-shadcn/dist/index.js";
6
+ import "../../../../shared/ui/dist/index.js";
7
+ import { useAnalyticsTrack as t } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
8
+ import { useWidgetConfig as n, useWidgetError as r, useWidgetLoading as ee } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
9
+ import "../../../../shared/feature/dist/index.js";
10
+ import { AccountDetailsWidgetAnalyticsEvent as te } from "./index2.js";
11
+ import { formatDateParam as i, getDefaultExportDateRange as ne, isExportRangeValid as a, startOfLocalDay as o, triggerCsvDownload as re, yesterdayLocal as s } from "./index3.js";
12
+ import { copyTextToClipboard as ie, formatAmountLabel as c, formatSignedTransactionAmountLabel as ae, formatStatementPeriodLabel as oe, formatTransactionDateLabel as se, maskAccountNumber as ce } from "./index4.js";
13
+ import { DEFAULT_FEATURE_LABELS as le } from "./index5.js";
14
+ import { getBankAccountsPermissions as ue } from "./index6.js";
15
+ import { getStatementsStartDate as de } from "./index7.js";
16
+ import { interpolateLabel as l } from "./index8.js";
17
+ import { useBankAccountDetailsQuery as fe } from "../../data-access/dist/index2.js";
18
+ import { useBankAccountStatementsQuery as pe } from "../../data-access/dist/index3.js";
19
+ import { useBankAccountTransactionsQuery as me } from "../../data-access/dist/index4.js";
20
+ import { useDownloadBankAccountTransactionsMutation as he } from "../../data-access/dist/index5.js";
21
+ import { useRetrieveBankAccountStatementMutation as ge } from "../../data-access/dist/index6.js";
22
+ import { useUpdateBankAccountMutation as _e } from "../../data-access/dist/index7.js";
23
+ import "../../data-access/dist/index.js";
24
+ import { DEFAULT_LABELS as ve } from "../../ui/dist/index7.js";
25
+ import { AccountDetailsWidgetUi as ye } from "../../ui/dist/index8.js";
26
+ import "../../ui/dist/index.js";
27
+ import { useCallback as u, useEffect as be, useMemo as d, useState as f } from "react";
28
+ import { jsx as xe } from "react/jsx-runtime";
29
+ //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js
30
+ var Se = 3e3, Ce = 5e3, we = [
31
+ 10,
32
+ 25,
33
+ 50
34
+ ], Te = 10, Ee = 6e5, De = { nickname: "" };
35
+ function p({ accountId: p, onBack: Oe, labels: ke, featureLabels: Ae, isBankingTaglineVisible: je = !0, bankLogoSrc: Me, bankLogoAlt: Ne, bankAddress: Pe, supportTeamUrl: Fe }) {
36
+ let m = {
37
+ ...ve,
38
+ ...ke
39
+ }, h = {
40
+ ...le,
41
+ ...Ae
42
+ }, g = t(), { organizationId: Ie, widgetToken: Le, initResponse: _ } = n(), Re = ee(), v = !!r(), y = !!(Ie && Le), b = d(() => ue(_?.scopes), [_?.scopes]), x = b.canRead && !!_, S = y && x, C = x && !y, [w, ze] = f("transactions"), [Be, T] = f(!1), [E, D] = f(De), [Ve, He] = f(!1), [Ue, O] = f(!1), [We, k] = f(!1), [Ge, Ke] = f(!1), [qe, A] = f(!1), [j, M] = f(), [N, P] = f(), [F, Je] = f(Te), [I, L] = f(() => ({
43
+ accountId: p,
44
+ token: void 0
45
+ }));
46
+ I.accountId !== p && L({
47
+ accountId: p,
48
+ token: void 0
49
+ });
50
+ let Ye = I.accountId === p ? I.token : void 0, R = u((e) => {
51
+ L((t) => ({
52
+ ...t,
53
+ token: e
54
+ }));
55
+ }, []), [z, B] = f(() => /* @__PURE__ */ new Set());
56
+ be(() => {
57
+ g(te.Mounted);
58
+ }, [g]);
59
+ let V = fe({
60
+ id: p,
61
+ enabled: S
62
+ }), H = me({
63
+ id: p,
64
+ enabled: S && w === "transactions",
65
+ limit: 25,
66
+ sortBy: "DATE",
67
+ sortOrder: "DESC"
68
+ }), [Xe] = f(de), U = pe({
69
+ id: p,
70
+ startDate: Xe,
71
+ enabled: S && w === "statements",
72
+ limit: F,
73
+ pagination_token: Ye,
74
+ category: "STATEMENTS"
75
+ }), Ze = _e(), Qe = he(), $e = ge(), { mutate: et, isPending: tt, isError: W, reset: G } = Ze, { mutateAsync: K, isPending: nt } = Qe, { mutateAsync: q } = $e, J = x ? V.data : void 0, Y = _?.bankName?.trim() ?? "", rt = Pe?.trim() || void 0, X = { bankName: Y }, it = d(() => l(m.domesticWireIntro, X), [m.domesticWireIntro, Y]), at = d(() => l(m.domesticWireNote, X), [m.domesticWireNote, Y]), ot = d(() => l(m.thingsToKnowBody, X), [m.thingsToKnowBody, Y]), st = J?.nickname?.trim() || h.accountFallback, ct = c(J?.balance), lt = d(() => (H.data?.data ?? []).map((e, t) => ({
76
+ key: `${e.date}-${t}`,
77
+ descriptionLabel: e.description,
78
+ dateLabel: se(e.date),
79
+ amountLabel: ae(e.amount, e.direction),
80
+ amountVariant: e.direction === "CREDIT" ? "positive" : "default",
81
+ balanceLabel: c(e.runningBalance)
82
+ })), [H.data?.data]), ut = b.canRead && lt.length > 0, dt = u((t) => {
83
+ if (!y || !b.canRead) return;
84
+ let n = window.open("", "_blank");
85
+ if (!n) {
86
+ e.error(h.viewStatementErrorToast);
87
+ return;
88
+ }
89
+ n.opener = null, B((e) => new Set(e).add(t)), q({
90
+ id: p,
91
+ statementId: t
92
+ }).then((e) => {
93
+ let t = URL.createObjectURL(e);
94
+ n.location.href = t, window.setTimeout(() => URL.revokeObjectURL(t), Ee);
95
+ }).catch(() => {
96
+ n.close(), e.error(h.viewStatementErrorToast);
97
+ }).finally(() => {
98
+ B((e) => {
99
+ if (!e.has(t)) return e;
100
+ let n = new Set(e);
101
+ return n.delete(t), n;
102
+ });
103
+ });
104
+ }, [
105
+ p,
106
+ h.viewStatementErrorToast,
107
+ y,
108
+ b.canRead,
109
+ q
110
+ ]), ft = d(() => (U.data?.data ?? []).map((e) => {
111
+ let t = oe(e.statementDate);
112
+ return {
113
+ key: e.statementId,
114
+ label: t,
115
+ viewButtonAriaLabel: l(m.viewStatementButtonAriaLabel, { date: t }),
116
+ isViewDisabled: z.has(e.statementId),
117
+ onView: () => dt(e.statementId)
118
+ };
119
+ }), [
120
+ U.data?.data,
121
+ m.viewStatementButtonAriaLabel,
122
+ z,
123
+ dt
124
+ ]), Z = U.data?.nextPaginationToken ?? void 0, Q = U.data?.prevPaginationToken ?? void 0, pt = S && w === "statements" && !!U.data && !U.isError, mt = S && w === "statements" && U.isLoading, ht = S && w === "statements" && U.isError, gt = u(() => {
125
+ U.refetch();
126
+ }, [U.refetch]), _t = u((e) => {
127
+ Je(e), R(void 0);
128
+ }, []), vt = u(() => {
129
+ R(Q);
130
+ }, [Q]), yt = u(() => {
131
+ R(Z);
132
+ }, [Z]), bt = C || !a(j, N), xt = d(() => {
133
+ let e = [{ after: s() }];
134
+ return N && e.push({ after: o(N) }), e;
135
+ }, [N]), St = d(() => {
136
+ let e = [{ after: s() }];
137
+ return j && e.push({ before: o(j) }), e;
138
+ }, [j]), Ct = u((e) => {
139
+ if (e) {
140
+ let { startDate: e, endDate: t } = ne();
141
+ M(e), P(t);
142
+ }
143
+ A(e);
144
+ }, []), wt = u(async () => {
145
+ if (!y || !b.canRead || !j || !N || !a(j, N)) return;
146
+ A(!1);
147
+ let t = e.loading(h.exportLoadingToast);
148
+ try {
149
+ let n = await K({
150
+ id: p,
151
+ startDate: i(j),
152
+ endDate: i(N)
153
+ });
154
+ re(n.csv, n.filename), e.success(h.exportSuccessToast, {
155
+ id: t,
156
+ duration: Se
157
+ });
158
+ } catch {
159
+ e.error(h.exportErrorToast, {
160
+ id: t,
161
+ duration: Ce
162
+ });
163
+ }
164
+ }, [
165
+ p,
166
+ K,
167
+ N,
168
+ j,
169
+ h.exportErrorToast,
170
+ h.exportLoadingToast,
171
+ h.exportSuccessToast,
172
+ y,
173
+ b.canRead
174
+ ]), $ = u(async (t, n) => {
175
+ if (!await ie(t)) return;
176
+ let r = {
177
+ account: h.copyAccountNumberToast,
178
+ routing: h.copyRoutingNumberToast,
179
+ bankName: h.copyBankNameToast,
180
+ bankAddress: h.copyBankAddressToast
181
+ };
182
+ if (e.success(r[n]), n === "account") {
183
+ O(!0), window.setTimeout(() => O(!1), 2e3);
184
+ return;
185
+ }
186
+ n === "routing" && (k(!0), window.setTimeout(() => k(!1), 2e3));
187
+ }, [
188
+ h.copyAccountNumberToast,
189
+ h.copyBankAddressToast,
190
+ h.copyBankNameToast,
191
+ h.copyRoutingNumberToast
192
+ ]), Tt = (e) => {
193
+ e && (D({ nickname: J?.nickname?.trim() ?? "" }), G()), T(e);
194
+ };
195
+ return /* @__PURE__ */ xe(ye, {
196
+ labels: m,
197
+ title: st,
198
+ bankDisplayName: Y,
199
+ bankLogoSrc: Me,
200
+ bankLogoAlt: Ne,
201
+ balanceLabel: ct,
202
+ balanceTestId: "bank-accounts-widget-detail-balance",
203
+ isBankingTaglineVisible: je,
204
+ activeTab: w,
205
+ transactionRows: lt,
206
+ statementRows: ft,
207
+ isStatementsLoading: mt,
208
+ isStatementsError: ht,
209
+ onStatementsRetry: gt,
210
+ isStatementsPaginationVisible: pt,
211
+ statementsPageSize: F,
212
+ statementsPageSizeOptions: we,
213
+ isStatementsPreviousPageDisabled: !Q,
214
+ isStatementsNextPageDisabled: !Z,
215
+ onStatementsPageSizeChange: _t,
216
+ onStatementsPreviousPageClick: vt,
217
+ onStatementsNextPageClick: yt,
218
+ showExport: ut,
219
+ isExportOpen: qe,
220
+ exportStartDate: j,
221
+ exportEndDate: N,
222
+ isExportDownloading: nt,
223
+ isExportDownloadDisabled: bt,
224
+ disabledExportStartDates: xt,
225
+ disabledExportEndDates: St,
226
+ accountNumberLabel: J?.accountNumber ?? "",
227
+ maskedAccountNumberLabel: ce(J?.accountNumber ?? ""),
228
+ accountNumberTestId: "bank-accounts-widget-detail-account-number",
229
+ wireAccountNumberLabel: J?.accountNumber ?? "",
230
+ routingNumberLabel: J?.routingNumber ?? "",
231
+ bankAddressLabel: rt,
232
+ domesticWireIntroLabel: it,
233
+ domesticWireNoteLabel: at,
234
+ thingsToKnowBodyLabel: ot,
235
+ supportTeamHref: Fe,
236
+ isAccountNumberVisible: Ve,
237
+ isAccountNumberCopied: Ue,
238
+ isRoutingNumberCopied: We,
239
+ isDomesticWireExpanded: Ge,
240
+ isLoading: !v && (!y && !J || Re && !_ || S && (V.isLoading || w === "transactions" && H.isLoading)),
241
+ isError: v || S && (V.isError || w === "transactions" && H.isError),
242
+ isEditOpen: Be,
243
+ isEditDisabled: !b.canWrite,
244
+ isEditError: W,
245
+ isSubmitting: tt,
246
+ isEditSaveDisabled: C,
247
+ editForm: E,
248
+ canEdit: b.canWrite,
249
+ onBack: Oe,
250
+ onTabChange: ze,
251
+ onToggleAccountNumberVisibility: () => He((e) => !e),
252
+ onCopyAccountNumber: () => void $(J?.accountNumber ?? "", "account"),
253
+ onCopyRoutingNumber: () => void $(J?.routingNumber ?? "", "routing"),
254
+ onCopyBankName: () => void $(Y, "bankName"),
255
+ onCopyBankAddress: () => void $(rt ?? "", "bankAddress"),
256
+ onDomesticWireExpandedChange: Ke,
257
+ onEditOpenChange: Tt,
258
+ onEditFormChange: (e) => {
259
+ W && G(), D(e);
260
+ },
261
+ onEditSubmit: () => {
262
+ if (!y || !b.canWrite) return;
263
+ let t = E.nickname.trim();
264
+ t && et({
265
+ path: { id: p },
266
+ body: { nickname: t }
267
+ }, {
268
+ onSuccess: () => {
269
+ g(te.AccountUpdated, { accountId: p }), e.success(h.editSuccessToast), T(!1);
270
+ },
271
+ onError: () => {
272
+ e.error(h.editErrorToast);
273
+ }
274
+ });
275
+ },
276
+ onEditNicknameClick: () => Tt(!0),
277
+ onExportOpenChange: Ct,
278
+ onExportStartDateChange: M,
279
+ onExportEndDateChange: P,
280
+ onExportDownload: () => {
281
+ wt();
282
+ }
283
+ });
284
+ }
285
+ //#endregion
286
+ export { p as AccountDetailsWidget };
@@ -10,7 +10,7 @@ import "../../ui/dist/index.js";
10
10
  import { WidgetProvider as r } from "../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
11
11
  import "../../../shared/feature/dist/index.js";
12
12
  import { useBankAccountsWidget as i } from "./index7.js";
13
- import { AccountDetailsWidget as a } from "../../account-details/feature/dist/index8.js";
13
+ import { AccountDetailsWidget as a } from "../../account-details/feature/dist/index9.js";
14
14
  import "../../account-details/feature/dist/index.js";
15
15
  import { Fragment as o, jsx as s, jsxs as c } from "react/jsx-runtime";
16
16
  //#region ../../libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js
@@ -1,5 +1,5 @@
1
1
  //#region ../../libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js
2
- var e = "@tesouro/embedded-components-react", t = "0.5.191", n = "27d8e432f21009e0016c93854d73658efc2fa56d", r = Object.freeze({
2
+ var e = "@tesouro/embedded-components-react", t = "0.5.193", n = "47ce46520d4f871634768b2f95e0d77fc9b32ab3", r = Object.freeze({
3
3
  library_name: e,
4
4
  library_version: t,
5
5
  library_sha: n
@@ -13,35 +13,32 @@ import "../../../../../monite-sdk/dist/index.js";
13
13
  import { useEffect as s, useLayoutEffect as c, useMemo as l, useState as u } from "react";
14
14
  import { jsx as d } from "react/jsx-runtime";
15
15
  //#region ../../libs/tesouro-embedded-components-react/shared/monite-wrapper/feature/dist/lib/MoniteWrapper.js
16
- var f = 0, p = "tesouro-embedded-light", m = {
17
- color: "var(--ttw-foreground)",
18
- background: "var(--ttw-background)"
19
- }, h = "position: relative; z-index: calc(var(--tesouro-embedded-overlay-z-index, 2147483000) - 1); color: var(--ttw-foreground);", g = typeof document > "u" ? s : c;
20
- function _() {
16
+ var f = 0, p = "tesouro-embedded-light", m = `${p} ttw:[.dark_&]:bg-background`, h = { color: "var(--ttw-foreground)" }, g = "position: relative; z-index: calc(var(--tesouro-embedded-overlay-z-index, 2147483000) - 1); color: var(--ttw-foreground);", _ = typeof document > "u" ? s : c;
17
+ function v() {
21
18
  let [e] = u(() => {
22
19
  if (typeof document > "u") return;
23
20
  let e = document.createElement("div");
24
- return e.className = `tesouro-embedded ${p}`, e.setAttribute("style", h), e;
21
+ return e.className = `tesouro-embedded ${p}`, e.setAttribute("style", g), e;
25
22
  });
26
- return g(() => {
23
+ return _(() => {
27
24
  if (e) return document.body.appendChild(e), () => e.remove();
28
25
  }, [e]), e;
29
26
  }
30
- function v(e) {
27
+ function y(e) {
31
28
  return e instanceof Error ? e : Error(String(e));
32
29
  }
33
- function y({ finopsThemeColors: s, children: c }) {
34
- let h = _(), { baseUrl: g, organizationId: y, initResponse: b, widgetToken: x } = n(), { client: S } = e(), C = t(), w = C !== null, T = C?.state, E = C?.refresh, D = C?.getState, O = w && T?.status === "ready" ? T.widgetToken : x ?? null, k = w && T?.status === "ready" ? T.exp : void 0, A = i(), [j, M] = u(() => ({
35
- organizationId: y,
30
+ function b({ finopsThemeColors: s, children: c }) {
31
+ let p = v(), { baseUrl: g, organizationId: _, initResponse: b, widgetToken: x } = n(), { client: S } = e(), C = t(), w = C !== null, T = C?.state, E = C?.refresh, D = C?.getState, O = w && T?.status === "ready" ? T.widgetToken : x ?? null, k = w && T?.status === "ready" ? T.exp : void 0, A = i(), [j, M] = u(() => ({
32
+ organizationId: _,
36
33
  widgetToken: O,
37
34
  widgetTokenExp: k
38
35
  }));
39
- !A && (j.organizationId !== y || j.widgetToken !== O || j.widgetTokenExp !== k) && M({
40
- organizationId: y,
36
+ !A && (j.organizationId !== _ || j.widgetToken !== O || j.widgetTokenExp !== k) && M({
37
+ organizationId: _,
41
38
  widgetToken: O,
42
39
  widgetTokenExp: k
43
40
  });
44
- let N = A ? j.organizationId : y, P = A ? j.widgetToken : O, F = A ? j.widgetTokenExp : k, I = r();
41
+ let N = A ? j.organizationId : _, P = A ? j.widgetToken : O, F = A ? j.widgetTokenExp : k, I = r();
45
42
  if (I) throw I;
46
43
  if (T?.status === "error") throw T.error instanceof Error ? T.error : Error(String(T.error));
47
44
  let L = b?.userId ?? null, R = w ? T?.status === "ready" : !!x, z = l(() => {
@@ -84,14 +81,14 @@ function y({ finopsThemeColors: s, children: c }) {
84
81
  if (!E || !D) throw Error("MoniteWrapper.fetchToken: token refresh provider is unavailable");
85
82
  let e = !1, t = () => {
86
83
  let e = D();
87
- if (e.status === "error") throw v(e.error);
84
+ if (e.status === "error") throw y(e.error);
88
85
  return e;
89
86
  }, n = (e) => {
90
87
  if (e.status !== "ready") throw Error("MoniteWrapper.fetchToken: widget token is not ready after refresh()");
91
88
  return e;
92
89
  }, r = D();
93
- if (r.status === "error") throw v(r.error);
94
- if (r.status !== "ready" && (await E(), e = !0, r = t()), r = n(r), r.exp === void 0 && !e && (await E(), r = n(t())), r.exp === void 0 && r.lastError !== void 0) throw v(r.lastError);
90
+ if (r.status === "error") throw y(r.error);
91
+ if (r.status !== "ready" && (await E(), e = !0, r = t()), r = n(r), r.exp === void 0 && !e && (await E(), r = n(t())), r.exp === void 0 && r.lastError !== void 0) throw y(r.lastError);
95
92
  let i = Date.now() / 1e3, a = r.exp === void 0 ? f : Math.max(0, r.exp - i);
96
93
  return {
97
94
  access_token: r.widgetToken,
@@ -116,8 +113,8 @@ function y({ finopsThemeColors: s, children: c }) {
116
113
  return s.primary && (e.primary = s.primary), s.primaryForeground && (e.primaryForeground = s.primaryForeground), Object.keys(e).length > 0 ? { colors: e } : void 0;
117
114
  }, [s]);
118
115
  return !R || !B || !b || !g || !N ? null : /* @__PURE__ */ d(a, {
119
- elements: h ? {
120
- root: h,
116
+ elements: p ? {
117
+ root: p,
121
118
  styles: void 0
122
119
  } : void 0,
123
120
  children: /* @__PURE__ */ d(o, {
@@ -133,12 +130,12 @@ function y({ finopsThemeColors: s, children: c }) {
133
130
  financing: { enableFinanceWidgetButton: !1 }
134
131
  },
135
132
  children: /* @__PURE__ */ d("div", {
136
- className: p,
137
- style: m,
133
+ className: m,
134
+ style: h,
138
135
  children: c
139
136
  })
140
137
  }, L ?? "no-user")
141
138
  });
142
139
  }
143
140
  //#endregion
144
- export { y as MoniteWrapper };
141
+ export { b as MoniteWrapper };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tesouro/embedded-components-react",
3
- "version": "0.5.191",
3
+ "version": "0.5.193",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "packageDepSync": {