@tesouro/embedded-components-react 0.5.192 → 0.5.194
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/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index11.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index7.js +5 -3
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index8.js +3 -281
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js +286 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/zod.gen.js +876 -832
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index10.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { AccountDetailsWidget as e } from "./
|
|
2
|
-
import "./
|
|
1
|
+
import { AccountDetailsWidget as e } from "./index9.js";
|
|
2
|
+
import "./index11.js";
|
|
3
3
|
export { e as AccountDetailsWidget };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index9.js";
|
|
@@ -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
|
|
3
|
-
|
|
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 {
|
|
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
|
-
|
|
30
|
-
|
|
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 {
|
|
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 };
|
package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/index8.js
CHANGED
|
@@ -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/
|
|
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
|