@tesouro/embedded-components-react 0.11.60 → 0.11.62
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/README.md +21 -21
- package/dist/index.css +37 -160
- package/dist/index.d.ts +50 -17
- package/dist/lib/BankAccountsWidget.d.ts +20 -7
- package/dist/lib/LinkedAccountsWidget.d.ts +30 -10
- package/dist/lib/WidgetSuite.d.ts +50 -17
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index3.js +21 -26
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js +18 -16
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index5.js +22 -35
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index6.js +29 -14
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index7.js +20 -24
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index8.js +31 -0
- 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/index10.js +296 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index12.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index5.js +5 -10
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index9.js +42 -281
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index.js +5 -3
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index10.js +180 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index2.js +16 -184
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index3.js +9 -93
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index4.js +136 -81
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index5.js +64 -101
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index6.js +54 -81
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index7.js +90 -65
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index8.js +108 -183
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/ui/dist/index9.js +76 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/BankAccountsWidget/BankAccountsWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/labels.js +6 -8
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/lib/useBankAccountsWidget.js +137 -120
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/mocks/labels.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/AccountCard.js +47 -60
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankAccountsWidgetUi.js +71 -72
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/BankingHeader.js +22 -37
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/CreateAccountDialog.js +119 -133
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/ui/dist/lib/labels.js +12 -8
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/LinkedAccountsWidget.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/labels.js +9 -7
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/rows.js +46 -27
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useAdminEligibleUserIds.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/lib/useLinkedAccountsWidget.js +248 -224
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/feature/dist/mocks/labels.js +5 -5
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index.js +2 -2
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index10.js +22 -36
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index11.js +23 -70
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index12.js +91 -27
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index13.js +80 -63
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index14.js +145 -125
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index2.js +61 -9
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index3.js +77 -50
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index4.js +180 -65
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index5.js +22 -178
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index6.js +6 -75
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index7.js +48 -11
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index8.js +45 -7
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index9.js +8 -82
- package/dist/libs/tesouro-embedded-components-react/shared/feature/dist/lib/analytics/build-info.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/index.js +15 -14
- package/dist/libs/tesouro-embedded-components-react/shared/ui/dist/lib/AddTile/AddTile.js +17 -0
- package/dist/packages/shared-ui-shadcn/dist/index.js +3603 -3518
- package/package.json +1 -1
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index11.js +0 -1
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index15.js +0 -67
- package/dist/libs/tesouro-embedded-components-react/linked-accounts-widget/ui/dist/index16.js +0 -138
|
@@ -2,26 +2,28 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { getBankAccountStatementsOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
6
6
|
import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
|
|
7
7
|
import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
8
|
import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
9
9
|
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { useKeepPagesOfOneAccount as i } from "./index3.js";
|
|
11
|
+
import { useQuery as a } from "@tanstack/react-query";
|
|
11
12
|
// ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index4.js
|
|
12
|
-
function
|
|
13
|
-
let { client:
|
|
14
|
-
client:
|
|
15
|
-
headers: r(
|
|
16
|
-
path: { id:
|
|
17
|
-
query:
|
|
18
|
-
})
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
enabled: !!(
|
|
13
|
+
function o({ id: o, enabled: s, ...c }) {
|
|
14
|
+
let { client: l, organizationId: u, widgetToken: d, authEpoch: f, organizationStatus: p } = n(), m = e({
|
|
15
|
+
client: l,
|
|
16
|
+
headers: r(u),
|
|
17
|
+
path: { id: o ?? "" },
|
|
18
|
+
query: c
|
|
19
|
+
}), h = t(m, {
|
|
20
|
+
authEpoch: f,
|
|
21
|
+
organizationStatus: p
|
|
22
|
+
}), g = i(m.queryKey, h.placeholderData);
|
|
23
|
+
return a({
|
|
24
|
+
...h,
|
|
25
|
+
enabled: !!(o && u && d) && (s === !0 || s === void 0),
|
|
26
|
+
placeholderData: g
|
|
25
27
|
});
|
|
26
28
|
}
|
|
27
|
-
export {
|
|
29
|
+
export { o as useBankAccountStatementsQuery };
|
|
@@ -2,41 +2,28 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
5
|
+
import { getBankAccountTransactionsOptions as e } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
6
|
+
import { withAuthEpoch as t } from "../../../../shared/data-access/dist/lib/withAuthEpoch.js";
|
|
7
|
+
import { useEmbedApi as n } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
|
+
import { organizationHeaders as r } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
8
9
|
import "../../../../shared/data-access/dist/index.js";
|
|
9
|
-
import {
|
|
10
|
+
import { useKeepPagesOfOneAccount as i } from "./index3.js";
|
|
11
|
+
import { useQuery as a } from "@tanstack/react-query";
|
|
10
12
|
// ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index5.js
|
|
11
|
-
function
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
13
|
+
function o({ id: o, enabled: s, ...c }) {
|
|
14
|
+
let { client: l, organizationId: u, widgetToken: d, authEpoch: f, organizationStatus: p } = n(), m = e({
|
|
15
|
+
client: l,
|
|
16
|
+
headers: r(u),
|
|
17
|
+
path: { id: o ?? "" },
|
|
18
|
+
query: c
|
|
19
|
+
}), h = t(m, {
|
|
20
|
+
authEpoch: f,
|
|
21
|
+
organizationStatus: p
|
|
22
|
+
}), g = i(m.queryKey, h.placeholderData);
|
|
23
|
+
return a({
|
|
24
|
+
...h,
|
|
25
|
+
enabled: !!(o && u && d) && (s === !0 || s === void 0),
|
|
26
|
+
placeholderData: g
|
|
27
|
+
});
|
|
21
28
|
}
|
|
22
|
-
|
|
23
|
-
let { client: a, organizationId: o } = t();
|
|
24
|
-
return r({ mutationFn: async ({ id: t, startDate: r, endDate: s }) => {
|
|
25
|
-
let { data: c, response: l } = await e({
|
|
26
|
-
client: a,
|
|
27
|
-
headers: n(o),
|
|
28
|
-
path: { id: t },
|
|
29
|
-
query: {
|
|
30
|
-
startDate: r,
|
|
31
|
-
endDate: s
|
|
32
|
-
},
|
|
33
|
-
parseAs: "text",
|
|
34
|
-
throwOnError: !0
|
|
35
|
-
});
|
|
36
|
-
return {
|
|
37
|
-
csv: typeof c == "string" ? c : String(c ?? ""),
|
|
38
|
-
filename: i(l.headers.get("Content-Disposition")) ?? `transactions-${r}-to-${s}.csv`
|
|
39
|
-
};
|
|
40
|
-
} });
|
|
41
|
-
}
|
|
42
|
-
export { a as useDownloadBankAccountTransactionsMutation };
|
|
29
|
+
export { o as useBankAccountTransactionsQuery };
|
|
@@ -2,26 +2,41 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
5
|
+
import { downloadBankAccountTransactions as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
6
6
|
import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
7
|
import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
8
8
|
import "../../../../shared/data-access/dist/index.js";
|
|
9
9
|
import { useMutation as r } from "@tanstack/react-query";
|
|
10
10
|
// ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index6.js
|
|
11
|
-
function i() {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
function i(e) {
|
|
12
|
+
if (!e) return;
|
|
13
|
+
let t = /filename\*=UTF-8''([^;]+)/i.exec(e);
|
|
14
|
+
if (t?.[1]) try {
|
|
15
|
+
return decodeURIComponent(t[1].trim());
|
|
16
|
+
} catch {
|
|
17
|
+
return t[1].trim();
|
|
18
|
+
}
|
|
19
|
+
let n = /filename[^;=\n]*=((['"]).*?\2|[^;\n]*)/.exec(e);
|
|
20
|
+
if (n?.[1]) return n[1].replace(/['"]/g, "").trim() || void 0;
|
|
21
|
+
}
|
|
22
|
+
function a() {
|
|
23
|
+
let { client: a, organizationId: o } = t();
|
|
24
|
+
return r({ mutationFn: async ({ id: t, startDate: r, endDate: s }) => {
|
|
25
|
+
let { data: c, response: l } = await e({
|
|
26
|
+
client: a,
|
|
27
|
+
headers: n(o),
|
|
28
|
+
path: { id: t },
|
|
29
|
+
query: {
|
|
30
|
+
startDate: r,
|
|
31
|
+
endDate: s
|
|
20
32
|
},
|
|
21
|
-
parseAs: "
|
|
33
|
+
parseAs: "text",
|
|
22
34
|
throwOnError: !0
|
|
23
|
-
})
|
|
24
|
-
return
|
|
35
|
+
});
|
|
36
|
+
return {
|
|
37
|
+
csv: typeof c == "string" ? c : String(c ?? ""),
|
|
38
|
+
filename: i(l.headers.get("Content-Disposition")) ?? `transactions-${r}-to-${s}.csv`
|
|
39
|
+
};
|
|
25
40
|
} });
|
|
26
41
|
}
|
|
27
|
-
export {
|
|
42
|
+
export { a as useDownloadBankAccountTransactionsMutation };
|
|
@@ -2,30 +2,26 @@
|
|
|
2
2
|
"use client";
|
|
3
3
|
"use client";
|
|
4
4
|
"use client";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { organizationHeaders as a } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
5
|
+
import { getBankAccountStatement as e } from "../../../../shared/data-access/dist/lib/rest/sdk.gen.js";
|
|
6
|
+
import { useEmbedApi as t } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
|
+
import { organizationHeaders as n } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
9
8
|
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
-
import { useMutation as
|
|
9
|
+
import { useMutation as r } from "@tanstack/react-query";
|
|
11
10
|
// ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index7.js
|
|
12
|
-
function
|
|
13
|
-
let { client:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
}))]), await u.onSuccess?.(n, i, ...a);
|
|
28
|
-
}
|
|
29
|
-
});
|
|
11
|
+
function i() {
|
|
12
|
+
let { client: i, organizationId: a } = t();
|
|
13
|
+
return r({ mutationFn: async ({ id: t, statementId: r }) => {
|
|
14
|
+
let { data: o } = await e({
|
|
15
|
+
client: i,
|
|
16
|
+
headers: n(a),
|
|
17
|
+
path: {
|
|
18
|
+
id: t,
|
|
19
|
+
statementId: r
|
|
20
|
+
},
|
|
21
|
+
parseAs: "blob",
|
|
22
|
+
throwOnError: !0
|
|
23
|
+
}), s = o instanceof Blob ? o : new Blob([o]);
|
|
24
|
+
return s.type === "application/pdf" ? s : new Blob([s], { type: "application/pdf" });
|
|
25
|
+
} });
|
|
30
26
|
}
|
|
31
|
-
export {
|
|
27
|
+
export { i as useRetrieveBankAccountStatementMutation };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { getBankAccountQueryKey as e, getBankAccountsQueryKey as t, updateBankAccountMutation as n } from "../../../../shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js";
|
|
6
|
+
import { invalidateAllClients as r } from "../../../../shared/data-access/dist/lib/clientRegistry.js";
|
|
7
|
+
import { useEmbedApi as i } from "../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
8
|
+
import { organizationHeaders as a } from "../../../../shared/data-access/dist/lib/organizationHeaders.js";
|
|
9
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
10
|
+
import { useMutation as o } from "@tanstack/react-query";
|
|
11
|
+
// ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/data-access/dist/index8.js
|
|
12
|
+
function s() {
|
|
13
|
+
let { client: s, organizationId: c } = i(), l = a(c), u = n({
|
|
14
|
+
client: s,
|
|
15
|
+
headers: l
|
|
16
|
+
});
|
|
17
|
+
return o({
|
|
18
|
+
...u,
|
|
19
|
+
onSuccess: async (n, i, ...a) => {
|
|
20
|
+
await Promise.all([r(t({
|
|
21
|
+
client: s,
|
|
22
|
+
headers: l
|
|
23
|
+
})), r(e({
|
|
24
|
+
client: s,
|
|
25
|
+
headers: l,
|
|
26
|
+
path: i.path
|
|
27
|
+
}))]), await u.onSuccess?.(n, i, ...a);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
export { s as useUpdateBankAccountMutation };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { AccountDetailsWidget } from "./
|
|
2
|
-
import "./
|
|
1
|
+
export { AccountDetailsWidget } from "./index10.js";
|
|
2
|
+
import "./index12.js";
|
|
@@ -0,0 +1,296 @@
|
|
|
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 { 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 { DEFAULT_LABELS as i } from "../../ui/dist/index9.js";
|
|
11
|
+
import "../../../../shared/ui/dist/index.js";
|
|
12
|
+
import { AccountDetailsWidgetUi as a } from "../../ui/dist/index10.js";
|
|
13
|
+
import "../../ui/dist/index.js";
|
|
14
|
+
import { useAnalyticsTrack as ee } from "../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
15
|
+
import { useRefetchWidget as te, useWidgetConfig as ne, useWidgetError as re, useWidgetLoading as ie } from "../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
16
|
+
import "../../../../shared/feature/dist/index.js";
|
|
17
|
+
import { AccountDetailsWidgetAnalyticsEvent as o } from "./index2.js";
|
|
18
|
+
import { formatDateParam as ae, getDefaultExportDateRange as oe, isExportRangeValid as se, startOfLocalDay as s, triggerCsvDownload as ce, yesterdayLocal as c } from "./index3.js";
|
|
19
|
+
import { copyTextToClipboard as le, formatAmountLabel as l, formatSignedTransactionAmountLabel as ue, formatStatementPeriodLabel as de, formatTransactionDateLabel as fe, maskAccountNumber as pe } from "./index4.js";
|
|
20
|
+
import { DEFAULT_FEATURE_LABELS as me } from "./index5.js";
|
|
21
|
+
import { getBankAccountsPermissions as he } from "./index6.js";
|
|
22
|
+
import { getStatementsStartDate as ge } from "./index7.js";
|
|
23
|
+
import { interpolateLabel as u } from "./index8.js";
|
|
24
|
+
import { formatPageRange as d, useCursorPagination as _e } from "./index9.js";
|
|
25
|
+
import { useBankAccountDetailsQuery as ve } from "../../data-access/dist/index2.js";
|
|
26
|
+
import { useBankAccountStatementsQuery as ye } from "../../data-access/dist/index4.js";
|
|
27
|
+
import { useBankAccountTransactionsQuery as be } from "../../data-access/dist/index5.js";
|
|
28
|
+
import { useDownloadBankAccountTransactionsMutation as xe } from "../../data-access/dist/index6.js";
|
|
29
|
+
import { useRetrieveBankAccountStatementMutation as Se } from "../../data-access/dist/index7.js";
|
|
30
|
+
import { useUpdateBankAccountMutation as Ce } from "../../data-access/dist/index8.js";
|
|
31
|
+
import "../../data-access/dist/index.js";
|
|
32
|
+
import { useCallback as f, useEffect as we, useMemo as p, useState as m } from "react";
|
|
33
|
+
import { jsx as Te } from "react/jsx-runtime";
|
|
34
|
+
// ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index10.js
|
|
35
|
+
var h = [
|
|
36
|
+
10,
|
|
37
|
+
25,
|
|
38
|
+
50
|
|
39
|
+
], Ee = 10, De = 25, Oe = 6e5;
|
|
40
|
+
function g(e) {
|
|
41
|
+
return !e.isFetching && !e.isPlaceholderData;
|
|
42
|
+
}
|
|
43
|
+
function _(e, { rangeTemplate: t, rowCount: n, nextToken: r, prevToken: i, isSettled: a }) {
|
|
44
|
+
return {
|
|
45
|
+
pageSize: e.pageSize,
|
|
46
|
+
pageSizeOptions: h,
|
|
47
|
+
rangeLabel: a ? d(t, e.offset, n) : void 0,
|
|
48
|
+
isPreviousDisabled: !a || !i,
|
|
49
|
+
isNextDisabled: !a || !r,
|
|
50
|
+
onPageSizeChange: (t) => {
|
|
51
|
+
a && e.setPageSize(t);
|
|
52
|
+
},
|
|
53
|
+
onPreviousPageClick: () => {
|
|
54
|
+
a && e.goToPrevious(i);
|
|
55
|
+
},
|
|
56
|
+
onNextPageClick: () => {
|
|
57
|
+
a && e.goToNext(r, n);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
var ke = { nickname: "" };
|
|
62
|
+
function v({ accountId: d, onBack: h, labels: v, featureLabels: Ae, isBankingTaglineVisible: je = !0, bankLogoSrc: Me, bankLogoAlt: Ne, bankAddress: Pe, supportTeamUrl: Fe }) {
|
|
63
|
+
let y = {
|
|
64
|
+
...i,
|
|
65
|
+
...v
|
|
66
|
+
}, b = {
|
|
67
|
+
...me,
|
|
68
|
+
...Ae
|
|
69
|
+
}, x = ee(), { organizationId: Ie, widgetToken: Le, initResponse: S } = ne(), Re = ie(), C = t(n().organizationStatus), w = !!re(), ze = te(), T = !!(Ie && Le), E = p(() => he(S?.scopes), [S?.scopes]), D = E.canRead && !!S, O = T && D, [k, Be] = m("transactions"), [Ve, A] = m(!1), [He, Ue] = m(ke), [We, Ge] = m(!1), [Ke, qe] = m(), [Je, Ye] = m(!1), [Xe, j] = m(!1), [M, N] = m(), [P, F] = m(), [Ze, I] = m(!1), [Qe, L] = m(!1), R = _e({
|
|
70
|
+
resetKey: d,
|
|
71
|
+
defaultPageSize: Ee
|
|
72
|
+
}), z = _e({
|
|
73
|
+
resetKey: d,
|
|
74
|
+
defaultPageSize: De
|
|
75
|
+
}), [B, V] = m(() => /* @__PURE__ */ new Set());
|
|
76
|
+
we(() => {
|
|
77
|
+
x(o.Mounted);
|
|
78
|
+
}, [x]);
|
|
79
|
+
let H = ve({
|
|
80
|
+
id: d,
|
|
81
|
+
enabled: O
|
|
82
|
+
}), U = be({
|
|
83
|
+
id: d,
|
|
84
|
+
enabled: O && k === "transactions",
|
|
85
|
+
limit: z.pageSize,
|
|
86
|
+
pagination_token: z.token,
|
|
87
|
+
sortBy: "DATE",
|
|
88
|
+
sortOrder: "DESC"
|
|
89
|
+
}), [$e] = m(ge), W = ye({
|
|
90
|
+
id: d,
|
|
91
|
+
startDate: $e,
|
|
92
|
+
enabled: O && k === "statements",
|
|
93
|
+
limit: R.pageSize,
|
|
94
|
+
pagination_token: R.token,
|
|
95
|
+
category: "STATEMENTS"
|
|
96
|
+
}), et = Ce(), tt = xe(), nt = Se(), { mutate: rt, isPending: it, isError: G, reset: K } = et, { mutateAsync: q, isPending: at } = tt, { mutateAsync: J } = nt, Y = D ? H.data : void 0, X = S?.bankName?.trim() ?? "", ot = Pe?.trim() || void 0, Z = { bankName: X }, st = p(() => u(y.domesticWireIntro, Z), [y.domesticWireIntro, X]), ct = p(() => u(y.domesticWireNote, Z), [y.domesticWireNote, X]), lt = p(() => u(y.thingsToKnowBody, Z), [y.thingsToKnowBody, X]), ut = Y?.nickname?.trim() || b.accountFallback, dt = l(Y?.balance), Q = p(() => (U.data?.data ?? []).map((e, t) => ({
|
|
97
|
+
key: `${e.date}-${t}`,
|
|
98
|
+
descriptionLabel: e.description,
|
|
99
|
+
dateLabel: fe(e.date),
|
|
100
|
+
amountLabel: ue(e.amount, e.direction),
|
|
101
|
+
balanceLabel: l(e.runningBalance)
|
|
102
|
+
})), [U.data?.data]), ft = E.canRead && Q.length > 0, pt = f((t) => {
|
|
103
|
+
if (!T || !E.canRead) return;
|
|
104
|
+
let n = window.open("", "_blank");
|
|
105
|
+
n ? (n.opener = null, V((e) => new Set(e).add(t)), J({
|
|
106
|
+
id: d,
|
|
107
|
+
statementId: t
|
|
108
|
+
}).then((e) => {
|
|
109
|
+
let t = URL.createObjectURL(e);
|
|
110
|
+
n.location.href = t, window.setTimeout(() => URL.revokeObjectURL(t), Oe);
|
|
111
|
+
}).catch(() => {
|
|
112
|
+
n.close(), e.error(b.viewStatementErrorToast);
|
|
113
|
+
}).finally(() => {
|
|
114
|
+
V((e) => {
|
|
115
|
+
if (!e.has(t)) return e;
|
|
116
|
+
let n = new Set(e);
|
|
117
|
+
return n.delete(t), n;
|
|
118
|
+
});
|
|
119
|
+
})) : e.error(b.viewStatementErrorToast);
|
|
120
|
+
}, [
|
|
121
|
+
d,
|
|
122
|
+
b.viewStatementErrorToast,
|
|
123
|
+
T,
|
|
124
|
+
E.canRead,
|
|
125
|
+
J
|
|
126
|
+
]), mt = p(() => (W.data?.data ?? []).map((e) => {
|
|
127
|
+
let t = de(e.statementDate);
|
|
128
|
+
return {
|
|
129
|
+
key: e.statementId,
|
|
130
|
+
label: t,
|
|
131
|
+
viewButtonAriaLabel: u(y.viewStatementButtonAriaLabel, { date: t }),
|
|
132
|
+
isViewDisabled: B.has(e.statementId),
|
|
133
|
+
onView: () => pt(e.statementId)
|
|
134
|
+
};
|
|
135
|
+
}), [
|
|
136
|
+
W.data?.data,
|
|
137
|
+
y.viewStatementButtonAriaLabel,
|
|
138
|
+
B,
|
|
139
|
+
pt
|
|
140
|
+
]), ht = W.data?.nextPaginationToken ?? void 0, gt = W.data?.prevPaginationToken ?? void 0, _t = O && k === "transactions" && U.isLoading, vt = O && k === "transactions" && U.isError, yt = f(() => {
|
|
141
|
+
O && k === "transactions" && U.refetch();
|
|
142
|
+
}, [
|
|
143
|
+
k,
|
|
144
|
+
O,
|
|
145
|
+
U.refetch
|
|
146
|
+
]), bt = O && k === "statements" && !!W.data && !W.isError, xt = O && k === "statements" && W.isLoading, St = O && k === "statements" && W.isError && !r(W.error), Ct = f(() => {
|
|
147
|
+
W.refetch();
|
|
148
|
+
}, [W.refetch]), wt = bt ? _(R, {
|
|
149
|
+
rangeTemplate: y.paginationRangeLabel,
|
|
150
|
+
rowCount: mt.length,
|
|
151
|
+
nextToken: ht,
|
|
152
|
+
prevToken: gt,
|
|
153
|
+
isSettled: g(W)
|
|
154
|
+
}) : void 0, Tt = U.data?.nextPaginationToken ?? void 0, Et = U.data?.prevPaginationToken ?? void 0, Dt = O && U.data ? _(z, {
|
|
155
|
+
rangeTemplate: y.paginationRangeLabel,
|
|
156
|
+
rowCount: Q.length,
|
|
157
|
+
nextToken: Tt,
|
|
158
|
+
prevToken: Et,
|
|
159
|
+
isSettled: g(U)
|
|
160
|
+
}) : void 0, Ot = p(() => {
|
|
161
|
+
let e = [{ after: c() }];
|
|
162
|
+
return P && e.push({ after: s(P) }), e;
|
|
163
|
+
}, [P]), kt = p(() => {
|
|
164
|
+
let e = [{ after: c() }];
|
|
165
|
+
return M && e.push({ before: s(M) }), e;
|
|
166
|
+
}, [M]), At = f((e) => {
|
|
167
|
+
if (e) {
|
|
168
|
+
let { startDate: e, endDate: t } = oe();
|
|
169
|
+
N(e), F(t);
|
|
170
|
+
}
|
|
171
|
+
I(!1), j(e);
|
|
172
|
+
}, []), jt = f(async () => {
|
|
173
|
+
if (!T || !E.canRead) return;
|
|
174
|
+
if (!M || !P || !se(M, P)) {
|
|
175
|
+
I(!0);
|
|
176
|
+
return;
|
|
177
|
+
}
|
|
178
|
+
j(!1);
|
|
179
|
+
let t = e.loading(b.exportLoadingToast);
|
|
180
|
+
try {
|
|
181
|
+
let n = await q({
|
|
182
|
+
id: d,
|
|
183
|
+
startDate: ae(M),
|
|
184
|
+
endDate: ae(P)
|
|
185
|
+
});
|
|
186
|
+
ce(n.csv, n.filename), e.success(b.exportSuccessToast, { id: t });
|
|
187
|
+
} catch {
|
|
188
|
+
e.error(b.exportErrorToast, { id: t });
|
|
189
|
+
}
|
|
190
|
+
}, [
|
|
191
|
+
d,
|
|
192
|
+
q,
|
|
193
|
+
P,
|
|
194
|
+
M,
|
|
195
|
+
b.exportErrorToast,
|
|
196
|
+
b.exportLoadingToast,
|
|
197
|
+
b.exportSuccessToast,
|
|
198
|
+
T,
|
|
199
|
+
E.canRead
|
|
200
|
+
]), Mt = f(async (e, t) => {
|
|
201
|
+
await le(t) && (qe(e), window.setTimeout(() => qe((t) => t === e ? void 0 : t), 2e3));
|
|
202
|
+
}, []), Nt = (e) => {
|
|
203
|
+
e && (Ue({ nickname: Y?.nickname?.trim() ?? "" }), L(!1), K()), A(e);
|
|
204
|
+
}, Pt = (e) => {
|
|
205
|
+
G && K(), L(!1), Ue(e);
|
|
206
|
+
}, Ft = () => {
|
|
207
|
+
if (!T || !E.canWrite) return;
|
|
208
|
+
let t = He.nickname.trim();
|
|
209
|
+
t ? rt({
|
|
210
|
+
path: { id: d },
|
|
211
|
+
body: { nickname: t }
|
|
212
|
+
}, { onSuccess: () => {
|
|
213
|
+
x(o.AccountUpdated, { accountId: d }), e.success(b.editSuccessToast), A(!1);
|
|
214
|
+
} }) : L(!0);
|
|
215
|
+
}, It = !T && C, $ = !T && !C, [Lt, Rt] = m($);
|
|
216
|
+
return $ !== Lt && (Rt($), $ && (A(!1), j(!1))), /* @__PURE__ */ Te(a, {
|
|
217
|
+
labels: y,
|
|
218
|
+
title: ut,
|
|
219
|
+
bankDisplayName: X,
|
|
220
|
+
bankLogoSrc: Me,
|
|
221
|
+
bankLogoAlt: Ne,
|
|
222
|
+
balanceLabel: dt,
|
|
223
|
+
balanceTestId: "bank-accounts-widget-detail-balance",
|
|
224
|
+
isBankingTaglineVisible: je,
|
|
225
|
+
activeTab: k,
|
|
226
|
+
transactionRows: Q,
|
|
227
|
+
isTransactionsError: vt,
|
|
228
|
+
isTransactionsLoading: _t,
|
|
229
|
+
onTransactionsRetry: yt,
|
|
230
|
+
transactionsPagination: Dt,
|
|
231
|
+
statementRows: mt,
|
|
232
|
+
isStatementsLoading: xt,
|
|
233
|
+
isStatementsError: St,
|
|
234
|
+
onStatementsRetry: Ct,
|
|
235
|
+
statementsPagination: wt,
|
|
236
|
+
showExport: ft,
|
|
237
|
+
isExportOpen: Xe,
|
|
238
|
+
exportStartDate: M,
|
|
239
|
+
exportEndDate: P,
|
|
240
|
+
isExportDownloading: at,
|
|
241
|
+
hasExportRangeError: Ze,
|
|
242
|
+
disabledExportStartDates: Ot,
|
|
243
|
+
disabledExportEndDates: kt,
|
|
244
|
+
accountNumberLabel: Y?.accountNumber ?? "",
|
|
245
|
+
maskedAccountNumberLabel: pe(Y?.accountNumber ?? ""),
|
|
246
|
+
accountNumberTestId: "bank-accounts-widget-detail-account-number",
|
|
247
|
+
wireAccountNumberLabel: Y?.accountNumber ?? "",
|
|
248
|
+
routingNumberLabel: Y?.routingNumber ?? "",
|
|
249
|
+
bankAddressLabel: ot,
|
|
250
|
+
domesticWireIntroLabel: st,
|
|
251
|
+
domesticWireNoteLabel: ct,
|
|
252
|
+
thingsToKnowBodyLabel: lt,
|
|
253
|
+
supportTeamHref: Fe,
|
|
254
|
+
isAccountNumberVisible: We,
|
|
255
|
+
copiedField: Ke,
|
|
256
|
+
isDomesticWireExpanded: Je,
|
|
257
|
+
isLoading: !w && (C && !Y || Re && !S || O && H.isLoading),
|
|
258
|
+
isError: w || O && H.isError,
|
|
259
|
+
isEditOpen: Ve,
|
|
260
|
+
onRetry: () => {
|
|
261
|
+
w ? ze() : (H.refetch(), k === "transactions" && U.refetch());
|
|
262
|
+
},
|
|
263
|
+
isEditError: G,
|
|
264
|
+
hasEditNicknameError: Qe,
|
|
265
|
+
isSubmitting: it,
|
|
266
|
+
isAuthPending: It,
|
|
267
|
+
editForm: He,
|
|
268
|
+
canEdit: E.canWrite,
|
|
269
|
+
onBack: h,
|
|
270
|
+
onTabChange: Be,
|
|
271
|
+
onToggleAccountNumberVisibility: () => Ge((e) => !e),
|
|
272
|
+
onCopy: (e) => {
|
|
273
|
+
let t = {
|
|
274
|
+
accountNumber: Y?.accountNumber ?? "",
|
|
275
|
+
routingNumber: Y?.routingNumber ?? "",
|
|
276
|
+
wireAccountNumber: Y?.accountNumber ?? "",
|
|
277
|
+
wireRoutingNumber: Y?.routingNumber ?? "",
|
|
278
|
+
bankName: X,
|
|
279
|
+
bankAddress: ot ?? ""
|
|
280
|
+
};
|
|
281
|
+
Mt(e, t[e]);
|
|
282
|
+
},
|
|
283
|
+
onDomesticWireExpandedChange: Ye,
|
|
284
|
+
onEditOpenChange: Nt,
|
|
285
|
+
onEditFormChange: Pt,
|
|
286
|
+
onEditSubmit: Ft,
|
|
287
|
+
onEditNicknameClick: () => Nt(!0),
|
|
288
|
+
onExportOpenChange: At,
|
|
289
|
+
onExportStartDateChange: N,
|
|
290
|
+
onExportEndDateChange: F,
|
|
291
|
+
onExportDownload: () => {
|
|
292
|
+
jt();
|
|
293
|
+
}
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
export { v as AccountDetailsWidget };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import "./index10.js";
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
// ../../libs/tesouro-embedded-components-react/bank-accounts-widget/account-details/feature/dist/index5.js
|
|
2
2
|
var e = {
|
|
3
3
|
accountFallback: "Account",
|
|
4
|
-
editSuccessToast: "Account updated
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
copyBankAddressToast: "Bank address copied to clipboard",
|
|
10
|
-
exportLoadingToast: "Exporting CSV...",
|
|
11
|
-
exportSuccessToast: "Transactions have been exported",
|
|
12
|
-
exportErrorToast: "Unable to export transactions",
|
|
13
|
-
viewStatementErrorToast: "Unable to open statement"
|
|
4
|
+
editSuccessToast: "Account updated",
|
|
5
|
+
exportLoadingToast: "Exporting transactions…",
|
|
6
|
+
exportSuccessToast: "Transactions exported",
|
|
7
|
+
exportErrorToast: "Couldn't export transactions",
|
|
8
|
+
viewStatementErrorToast: "Couldn't open statement"
|
|
14
9
|
};
|
|
15
10
|
export { e as DEFAULT_FEATURE_LABELS };
|