@tesouro/embedded-components-react 0.11.198 → 0.11.200
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 +13 -0
- package/dist/index.css +14 -0
- package/dist/index.d.ts +55 -2
- package/dist/index.js +33 -31
- package/dist/lib/RecentActivityWidget.d.ts +651 -0
- package/dist/lib/RecentActivityWidget.js +4 -0
- package/dist/lib/WidgetSuite.d.ts +45 -0
- package/dist/libs/tesouro-embedded-components-react/bank-accounts-widget/feature/dist/mocks/bankAccounts.js +1 -1
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/data-access/dist/index.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/data-access/dist/index2.js +31 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/index.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/RecentActivityWidget/RecentActivityWidgetFeature.js +71 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/RecentActivityWidget/labels.js +8 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/RecentActivityWidget/testIds.js +9 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/analytics/events.js +6 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/recentActivityView/buildRecentActivityRows.js +65 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/mocks/labels.js +14 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/mocks/recentActivity.js +52 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/scenarios.js +1 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/ui/dist/index.js +3 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/ui/dist/lib/RecentActivityCard/RecentActivityCard.js +129 -0
- package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/ui/dist/lib/RecentActivityCard/labels.js +15 -0
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/index.js +42 -42
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/@tanstack/react-query.gen.js +229 -218
- package/dist/libs/tesouro-embedded-components-react/shared/data-access/dist/lib/rest/sdk.gen.js +192 -180
- 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 +16 -16
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/WidgetSuiteProvider.js +35 -30
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/AccountsSection.js +3 -2
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/lib/WidgetSuite/sections/DashboardSection.js +26 -16
- package/dist/libs/tesouro-embedded-components-react/widget-suite/feature/dist/mocks/widgetSuite.js +29 -26
- package/dist/scenarios/index.d.ts +3 -1
- package/dist/scenarios/index.js +6 -4
- package/package.json +1 -1
|
@@ -2948,6 +2948,49 @@ type InsightsWidgetPassthroughProps = Pick<InsightsWidgetWithContextProps, 'labe
|
|
|
2948
2948
|
interface InsightsWidgetProps extends WidgetProviderProps, InsightsWidgetPassthroughProps {
|
|
2949
2949
|
}
|
|
2950
2950
|
|
|
2951
|
+
interface RecentActivityCardLabels {
|
|
2952
|
+
title: string;
|
|
2953
|
+
/** Accessible name of the list of rows. */
|
|
2954
|
+
list: string;
|
|
2955
|
+
loading: string;
|
|
2956
|
+
/** The masked number's screen-reader text; `{last4}` is filled in. */
|
|
2957
|
+
accountEndingIn: string;
|
|
2958
|
+
emptyTitle: string;
|
|
2959
|
+
emptyDescription: string;
|
|
2960
|
+
errorTitle: string;
|
|
2961
|
+
errorDescription: string;
|
|
2962
|
+
retry: string;
|
|
2963
|
+
}
|
|
2964
|
+
|
|
2965
|
+
interface RecentActivityRowLabels {
|
|
2966
|
+
/** Row's accessible name, e.g. "Home Depot, Operating ending 4821, Oct 28, 2026, −$318.40". */
|
|
2967
|
+
rowAriaLabel: (parts: {
|
|
2968
|
+
description: string;
|
|
2969
|
+
nickname: string;
|
|
2970
|
+
last4: string;
|
|
2971
|
+
date: string;
|
|
2972
|
+
amount: string;
|
|
2973
|
+
}) => string;
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
interface RecentActivityWidgetLabels extends RecentActivityCardLabels, RecentActivityRowLabels {
|
|
2977
|
+
}
|
|
2978
|
+
|
|
2979
|
+
interface RecentActivityWidgetWithContextProps {
|
|
2980
|
+
/** Merged with RECENT_ACTIVITY_WIDGET_LABELS_EN — only override what you need. */
|
|
2981
|
+
labels?: Partial<RecentActivityWidgetLabels>;
|
|
2982
|
+
/**
|
|
2983
|
+
* Called with the bank account a clicked transaction posted to. The host
|
|
2984
|
+
* routes it, usually to that account's detail page and its full history.
|
|
2985
|
+
* Without it, rows are not clickable.
|
|
2986
|
+
*/
|
|
2987
|
+
onTransactionClick?: (bankAccountId: string) => void;
|
|
2988
|
+
className?: string;
|
|
2989
|
+
style?: CSSProperties;
|
|
2990
|
+
}
|
|
2991
|
+
interface RecentActivityWidgetProps extends WidgetProviderProps, RecentActivityWidgetWithContextProps {
|
|
2992
|
+
}
|
|
2993
|
+
|
|
2951
2994
|
interface AddressFieldGroupLabels {
|
|
2952
2995
|
line1: string;
|
|
2953
2996
|
line2: string;
|
|
@@ -4696,6 +4739,7 @@ type WidgetLabelProps<T> = Omit<Pick<T, Extract<keyof T, 'labels' | `${string}La
|
|
|
4696
4739
|
type WidgetSuiteBalanceHistoryLabels = WidgetLabelProps<BalanceHistoryWidgetProps>;
|
|
4697
4740
|
type WidgetSuiteBalancesLabels = WidgetLabelProps<BalancesWidgetProps>;
|
|
4698
4741
|
type WidgetSuiteInsightsLabels = WidgetLabelProps<InsightsWidgetProps>;
|
|
4742
|
+
type WidgetSuiteRecentActivityLabels = WidgetLabelProps<RecentActivityWidgetProps>;
|
|
4699
4743
|
type WidgetSuiteComplianceBannerLabels = WidgetLabelProps<BankingComplianceBannerWidgetProps>;
|
|
4700
4744
|
type WidgetSuiteAccountsLabels = WidgetLabelProps<BankAccountsWidgetProps>;
|
|
4701
4745
|
type WidgetSuiteOnboardingLabels = WidgetLabelProps<BankAccountOnboardingWidgetProps>;
|
|
@@ -4715,6 +4759,7 @@ interface WidgetSuiteDashboardLabels {
|
|
|
4715
4759
|
*/
|
|
4716
4760
|
balances?: WidgetSuiteBalancesLabels;
|
|
4717
4761
|
insights?: WidgetSuiteInsightsLabels;
|
|
4762
|
+
recentActivity?: WidgetSuiteRecentActivityLabels;
|
|
4718
4763
|
/**
|
|
4719
4764
|
* The banking compliance banner beneath the Dashboard heading: the bank
|
|
4720
4765
|
* attribution, and FDIC signage when the bank is FDIC-insured.
|
|
@@ -100,7 +100,7 @@ var C = [e.BankAccountReadOrg], w = [e.BankAccountReadOrg, e.BankAccountWriteOrg
|
|
|
100
100
|
return t.push(a), p(a, 201);
|
|
101
101
|
}),
|
|
102
102
|
d("POST", `${V}/:id/access`, () => m()),
|
|
103
|
-
(e) => e.path === `${V}/transfers` ? void 0 : o(e),
|
|
103
|
+
(e) => e.path === `${V}/transfers` || e.path === `${V}/transactions` ? void 0 : o(e),
|
|
104
104
|
d("PATCH", `${V}/:id`, async (e, { id: n }) => {
|
|
105
105
|
let r = t.findIndex((e) => e.id === n), i = t[r];
|
|
106
106
|
if (!i) return a();
|
package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/data-access/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useRecentActivityQuery } from "./index2.js";
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { getOrganizationTransactionsOptions 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";
|
|
9
|
+
import "../../../shared/data-access/dist/index.js";
|
|
10
|
+
import { useQuery as i } from "@tanstack/react-query";
|
|
11
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/data-access/dist/index2.js
|
|
12
|
+
function a({ limit: a = 5, enabled: o } = {}) {
|
|
13
|
+
let { client: s, organizationId: c, widgetToken: l, authEpoch: u, organizationStatus: d } = n(), f = e({
|
|
14
|
+
query: { limit: a },
|
|
15
|
+
client: s,
|
|
16
|
+
headers: r(c)
|
|
17
|
+
}), { data: p, isLoading: m, isError: h, refetch: g } = i({
|
|
18
|
+
...t(f, {
|
|
19
|
+
authEpoch: u,
|
|
20
|
+
organizationStatus: d
|
|
21
|
+
}),
|
|
22
|
+
enabled: !!(c && l) && o !== !1
|
|
23
|
+
});
|
|
24
|
+
return {
|
|
25
|
+
transactions: p?.data,
|
|
26
|
+
isLoading: m,
|
|
27
|
+
isError: h,
|
|
28
|
+
refetch: g
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export { a as useRecentActivityQuery };
|
package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/index.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { RECENT_ACTIVITY_WIDGET_LABELS_EN as e } from "./lib/RecentActivityWidget/labels.js";
|
|
2
|
+
import { RecentActivityWidget as t } from "./lib/RecentActivityWidget/RecentActivityWidgetFeature.js";
|
|
3
|
+
export { e as RECENT_ACTIVITY_WIDGET_LABELS_EN, t as RecentActivityWidget };
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
"use client";
|
|
4
|
+
"use client";
|
|
5
|
+
import { OrganizationStatus as e, isOrganizationOnItsWay as t } from "../../../../../shared/data-access/dist/lib/organizationStatus.js";
|
|
6
|
+
import { useEmbedApi as n } from "../../../../../shared/data-access/dist/lib/EmbedApiContext.js";
|
|
7
|
+
import { Scope as r } from "../../../../../shared/data-access/dist/lib/scopes.js";
|
|
8
|
+
import "../../../../../shared/data-access/dist/index.js";
|
|
9
|
+
import { useAnalyticsTrack as i } from "../../../../../shared/feature/dist/lib/analytics/hooks.js";
|
|
10
|
+
import { WidgetProvider as a } from "../../../../../shared/feature/dist/lib/WidgetProvider/WidgetProvider.js";
|
|
11
|
+
import { useRefetchWidget as o, useWidgetConfig as s, useWidgetError as c, useWidgetInitStaleForToken as l, useWidgetLoading as u } from "../../../../../shared/feature/dist/lib/WidgetProvider/hooks.js";
|
|
12
|
+
import "../../../../../shared/feature/dist/index.js";
|
|
13
|
+
import { RecentActivityCard as d } from "../../../../ui/dist/lib/RecentActivityCard/RecentActivityCard.js";
|
|
14
|
+
import "../../../../ui/dist/index.js";
|
|
15
|
+
import { RECENT_ACTIVITY_WIDGET_LABELS_EN as f } from "./labels.js";
|
|
16
|
+
import { RecentActivityWidgetAnalyticsEvent as p, WIDGET_NAME as m } from "../analytics/events.js";
|
|
17
|
+
import { buildRecentActivityRows as h, localIsoDate as g } from "../recentActivityView/buildRecentActivityRows.js";
|
|
18
|
+
import { recentActivityWidgetTestIds as _ } from "./testIds.js";
|
|
19
|
+
import { useRecentActivityQuery as v } from "../../../../data-access/dist/index2.js";
|
|
20
|
+
import "../../../../data-access/dist/index.js";
|
|
21
|
+
import { useCallback as y, useEffect as b, useMemo as x } from "react";
|
|
22
|
+
import { jsx as S } from "react/jsx-runtime";
|
|
23
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/RecentActivityWidget/RecentActivityWidgetFeature.js
|
|
24
|
+
function C({ labels: a, onTransactionClick: m, className: C, style: w }) {
|
|
25
|
+
let T = x(() => ({
|
|
26
|
+
...f,
|
|
27
|
+
...a
|
|
28
|
+
}), [a]), E = i();
|
|
29
|
+
b(() => {
|
|
30
|
+
E(p.Mounted);
|
|
31
|
+
}, [E]);
|
|
32
|
+
let { initResponse: D } = s(), O = u(), k = c(), A = o(), { organizationId: j, organizationStatus: M } = n(), N = D?.scopes?.includes(r.BankAccountReadOrg) ?? !1, P = l(), F = N && !P, I = v({ enabled: F }), { transactions: L } = I, R = O && !D || t(M) && !L || P && !L || I.isLoading, z = (!!k || I.isError) && !L, B = I.refetch, V = y(() => {
|
|
33
|
+
A(), F && j && B();
|
|
34
|
+
}, [
|
|
35
|
+
A,
|
|
36
|
+
B,
|
|
37
|
+
F,
|
|
38
|
+
j
|
|
39
|
+
]), H = x(() => h(L ?? [], T, g(/* @__PURE__ */ new Date())), [L, T]), U = y((e) => {
|
|
40
|
+
let t = L?.[Number(e)]?.bankAccount.id;
|
|
41
|
+
t && m && (E(p.TransactionClicked), m(t));
|
|
42
|
+
}, [
|
|
43
|
+
L,
|
|
44
|
+
m,
|
|
45
|
+
E
|
|
46
|
+
]);
|
|
47
|
+
return D && !N || M === e.None ? null : /* @__PURE__ */ S(d, {
|
|
48
|
+
rows: H,
|
|
49
|
+
onRowClick: m && F ? U : void 0,
|
|
50
|
+
isLoading: R,
|
|
51
|
+
isError: z,
|
|
52
|
+
onRetry: z ? V : void 0,
|
|
53
|
+
labels: T,
|
|
54
|
+
testIds: _,
|
|
55
|
+
className: C,
|
|
56
|
+
style: w
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function w({ labels: e, onTransactionClick: t, className: n, style: r, ...i }) {
|
|
60
|
+
return /* @__PURE__ */ S(a, {
|
|
61
|
+
...i,
|
|
62
|
+
widgetName: m,
|
|
63
|
+
children: /* @__PURE__ */ S(C, {
|
|
64
|
+
labels: e,
|
|
65
|
+
onTransactionClick: t,
|
|
66
|
+
className: n,
|
|
67
|
+
style: r
|
|
68
|
+
})
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export { w as RecentActivityWidget, C as RecentActivityWidgetWithContext };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RECENT_ACTIVITY_CARD_LABELS_EN as e } from "../../../../ui/dist/lib/RecentActivityCard/labels.js";
|
|
2
|
+
import "../../../../ui/dist/index.js";
|
|
3
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/RecentActivityWidget/labels.js
|
|
4
|
+
var t = {
|
|
5
|
+
...e,
|
|
6
|
+
rowAriaLabel: ({ description: e, nickname: t, last4: n, date: r, amount: i }) => `${e}, ${t} ending ${n}, ${r}, ${i}`
|
|
7
|
+
};
|
|
8
|
+
export { t as RECENT_ACTIVITY_WIDGET_LABELS_EN };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/RecentActivityWidget/testIds.js
|
|
2
|
+
var e = {
|
|
3
|
+
root: "recent-activity-widget",
|
|
4
|
+
row: "recent-activity-widget-row",
|
|
5
|
+
skeleton: "recent-activity-widget-skeleton",
|
|
6
|
+
empty: "recent-activity-widget-empty",
|
|
7
|
+
error: "recent-activity-widget-error"
|
|
8
|
+
};
|
|
9
|
+
export { e as recentActivityWidgetTestIds };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/analytics/events.js
|
|
2
|
+
var e = "recent_activity_widget", t = {
|
|
3
|
+
Mounted: `${e}.mounted`,
|
|
4
|
+
TransactionClicked: `${e}.transaction_clicked`
|
|
5
|
+
};
|
|
6
|
+
export { t as RecentActivityWidgetAnalyticsEvent, e as WIDGET_NAME };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { amountOutputToMajorUnits as e, minorExponentForCurrency as t } from "../../../../../shared/util/dist/lib/amountOutputToMajorUnits.js";
|
|
2
|
+
import { formatMoneyExact as n } from "../../../../../shared/util/dist/lib/formatMoneyExact.js";
|
|
3
|
+
import "../../../../../shared/util/dist/index.js";
|
|
4
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/lib/recentActivityView/buildRecentActivityRows.js
|
|
5
|
+
var r = "−";
|
|
6
|
+
function i(e) {
|
|
7
|
+
let [t, n, r] = e.split("-").map(Number);
|
|
8
|
+
if (!t || !n || !r) return {
|
|
9
|
+
month: "",
|
|
10
|
+
day: "",
|
|
11
|
+
year: "",
|
|
12
|
+
spoken: e
|
|
13
|
+
};
|
|
14
|
+
let i = new Date(Date.UTC(t, n - 1, r)).toLocaleDateString("en-US", {
|
|
15
|
+
month: "short",
|
|
16
|
+
timeZone: "UTC"
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
month: i.toUpperCase(),
|
|
20
|
+
day: String(r),
|
|
21
|
+
year: String(t),
|
|
22
|
+
spoken: `${i} ${r}, ${t}`
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
function a(e) {
|
|
26
|
+
let t = (e) => String(e).padStart(2, "0");
|
|
27
|
+
return `${e.getFullYear()}-${t(e.getMonth() + 1)}-${t(e.getDate())}`;
|
|
28
|
+
}
|
|
29
|
+
function o(e, t) {
|
|
30
|
+
let n = Number(t.slice(0, 4));
|
|
31
|
+
return n ? e < `${String(n - 1).padStart(4, "0")}${t.slice(4)}` : !1;
|
|
32
|
+
}
|
|
33
|
+
function s(i) {
|
|
34
|
+
let a = i.amount.currencyCode || "USD", o = t(a), s = n(Math.abs(e(i.amount)), {
|
|
35
|
+
currencyCode: a,
|
|
36
|
+
includeSpaceAfterCurrencySymbol: !1,
|
|
37
|
+
minimumFractionDigits: o,
|
|
38
|
+
maximumFractionDigits: o
|
|
39
|
+
});
|
|
40
|
+
return `${i.direction === "CREDIT" ? "+" : r}${s}`;
|
|
41
|
+
}
|
|
42
|
+
function c(e, t, n) {
|
|
43
|
+
return e.map((r, a) => {
|
|
44
|
+
let c = i(r.date), l = a === 0 ? n : e[a - 1].date, u = s(r), { nickname: d, accountNumberLast4: f } = r.bankAccount;
|
|
45
|
+
return {
|
|
46
|
+
id: String(a),
|
|
47
|
+
month: c.month,
|
|
48
|
+
day: c.day,
|
|
49
|
+
...o(r.date, l) ? { year: c.year } : {},
|
|
50
|
+
date: c.spoken,
|
|
51
|
+
title: r.description,
|
|
52
|
+
accountName: d,
|
|
53
|
+
accountLast4: f,
|
|
54
|
+
amount: u,
|
|
55
|
+
ariaLabel: t.rowAriaLabel({
|
|
56
|
+
description: r.description,
|
|
57
|
+
nickname: d,
|
|
58
|
+
last4: f,
|
|
59
|
+
date: c.spoken,
|
|
60
|
+
amount: u
|
|
61
|
+
})
|
|
62
|
+
};
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
export { c as buildRecentActivityRows, a as localIsoDate, s as signedAmount };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/mocks/labels.js
|
|
2
|
+
var e = {
|
|
3
|
+
blurbs: {
|
|
4
|
+
populated: "The five newest transactions across the organization’s accounts, debits and credits mixed. A row opens its account through the host’s onTransactionClick.",
|
|
5
|
+
empty: "The organization has no transactions yet.",
|
|
6
|
+
loading: "The transactions read is held open, so the skeleton stays on screen.",
|
|
7
|
+
error: "The transactions read fails with a 500, so the card shows its own error. Retry re-issues it, and it fails again."
|
|
8
|
+
},
|
|
9
|
+
scenarios: { "unsupported-core": {
|
|
10
|
+
label: "Unsupported core",
|
|
11
|
+
blurb: "The bank’s core cannot list organization-wide transactions and the read answers 422. The card shows the same error as any failed read."
|
|
12
|
+
} }
|
|
13
|
+
};
|
|
14
|
+
export { e as RECENT_ACTIVITY_LABELS };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Scope as e } from "../../../../shared/data-access/dist/lib/scopes.js";
|
|
2
|
+
import "../../../../shared/data-access/dist/index.js";
|
|
3
|
+
import { A_BANK_ACCOUNT as t } from "../../../../shared/data-access-mocks/dist/lib/fixtures.js";
|
|
4
|
+
import { PROXY as n, answer as r, crossCuttingScenarios as i, initRoute as a, page as o, problem as s } from "../../../../shared/data-access-mocks/dist/mocks/scenarios/scenario.js";
|
|
5
|
+
import { RECENT_ACTIVITY_LABELS as c } from "./labels.js";
|
|
6
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/mocks/recentActivity.js
|
|
7
|
+
var l = `${n}/bank-accounts/transactions`, u = (e) => e === l, d = [e.BankAccountReadOrg], f = {
|
|
8
|
+
id: t.id,
|
|
9
|
+
nickname: t.nickname ?? "Operating",
|
|
10
|
+
accountNumberLast4: t.accountNumber.slice(-4)
|
|
11
|
+
}, p = {
|
|
12
|
+
id: "00000000-0000-4000-8000-000000000206",
|
|
13
|
+
nickname: "Payroll",
|
|
14
|
+
accountNumberLast4: "4006"
|
|
15
|
+
}, m = (e, t, n, r, i) => ({
|
|
16
|
+
amount: {
|
|
17
|
+
value: i,
|
|
18
|
+
currencyCode: "USD"
|
|
19
|
+
},
|
|
20
|
+
bankAccount: n,
|
|
21
|
+
date: e,
|
|
22
|
+
description: t,
|
|
23
|
+
direction: r,
|
|
24
|
+
runningBalance: {
|
|
25
|
+
value: 0,
|
|
26
|
+
currencyCode: "USD"
|
|
27
|
+
}
|
|
28
|
+
}), h = [
|
|
29
|
+
m("2026-10-28", "Home Depot", f, "DEBIT", 31840),
|
|
30
|
+
m("2026-10-27", "Customer payment — Rivera", f, "CREDIT", 24e4),
|
|
31
|
+
m("2026-10-26", "Gusto payroll", p, "DEBIT", 1842066),
|
|
32
|
+
m("2026-10-25", "Transfer from Operating", p, "CREDIT", 5e5),
|
|
33
|
+
m("2026-10-24", "Shell Oil 57442", f, "DEBIT", 8655)
|
|
34
|
+
], g = [...i({
|
|
35
|
+
scopes: d,
|
|
36
|
+
read: {
|
|
37
|
+
matches: u,
|
|
38
|
+
body: o(h),
|
|
39
|
+
emptyBody: o([])
|
|
40
|
+
},
|
|
41
|
+
blurbs: c.blurbs
|
|
42
|
+
}, [
|
|
43
|
+
"populated",
|
|
44
|
+
"empty",
|
|
45
|
+
"loading",
|
|
46
|
+
"error"
|
|
47
|
+
]), {
|
|
48
|
+
key: "unsupported-core",
|
|
49
|
+
...c.scenarios["unsupported-core"],
|
|
50
|
+
routes: [a(d), r(u, () => s(422, "Unprocessable Entity", "Listing organization transactions is not supported by this core."))]
|
|
51
|
+
}];
|
|
52
|
+
export { h as RECENT_TRANSACTIONS, l as TRANSACTIONS_PATH, g as recentActivityScenarios };
|
package/dist/libs/tesouro-embedded-components-react/recent-activity-widget/feature/dist/scenarios.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { recentActivityScenarios } from "./mocks/recentActivity.js";
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { Separator as e, Skeleton as t, cn as n } from "../../../../../../../packages/shared-ui-shadcn/dist/index.js";
|
|
2
|
+
import { WidgetFrame as r } from "../../../../../shared/ui/dist/lib/WidgetFrame/WidgetFrame.js";
|
|
3
|
+
import { EmptyState as i } from "../../../../../shared/ui/dist/lib/EmptyState/EmptyState.js";
|
|
4
|
+
import { ErrorState as a } from "../../../../../shared/ui/dist/lib/ErrorState/ErrorState.js";
|
|
5
|
+
import { LoadingRegion as o } from "../../../../../shared/ui/dist/lib/LoadingRegion/LoadingRegion.js";
|
|
6
|
+
import { MaskedAccountNumber as s } from "../../../../../shared/ui/dist/lib/MaskedAccountNumber/MaskedAccountNumber.js";
|
|
7
|
+
import "../../../../../shared/ui/dist/index.js";
|
|
8
|
+
import { RECENT_ACTIVITY_CARD_LABELS_EN as c } from "./labels.js";
|
|
9
|
+
import { Fragment as l } from "react";
|
|
10
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
+
import { ReceiptText as p } from "lucide-react";
|
|
12
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/ui/dist/lib/RecentActivityCard/RecentActivityCard.js
|
|
13
|
+
var m = 5;
|
|
14
|
+
function h({ row: e, endingIn: t }) {
|
|
15
|
+
return /* @__PURE__ */ f(u, { children: [
|
|
16
|
+
/* @__PURE__ */ d("span", {
|
|
17
|
+
className: "ttw:sr-only",
|
|
18
|
+
children: e.date
|
|
19
|
+
}),
|
|
20
|
+
/* @__PURE__ */ f("span", {
|
|
21
|
+
"aria-hidden": !0,
|
|
22
|
+
className: "ttw:flex ttw:w-10 ttw:shrink-0 ttw:flex-col ttw:items-center ttw:leading-tight",
|
|
23
|
+
children: [
|
|
24
|
+
/* @__PURE__ */ d("span", {
|
|
25
|
+
className: "ttw:text-xs ttw:font-medium ttw:text-muted-foreground",
|
|
26
|
+
children: e.month
|
|
27
|
+
}),
|
|
28
|
+
/* @__PURE__ */ d("span", {
|
|
29
|
+
className: "ttw:text-base ttw:font-semibold ttw:text-foreground",
|
|
30
|
+
children: e.day
|
|
31
|
+
}),
|
|
32
|
+
e.year && /* @__PURE__ */ d("span", {
|
|
33
|
+
className: "ttw:text-xs ttw:text-muted-foreground",
|
|
34
|
+
children: e.year
|
|
35
|
+
})
|
|
36
|
+
]
|
|
37
|
+
}),
|
|
38
|
+
/* @__PURE__ */ f("span", {
|
|
39
|
+
className: "ttw:flex ttw:min-w-0 ttw:flex-1 ttw:flex-col",
|
|
40
|
+
children: [/* @__PURE__ */ d("span", {
|
|
41
|
+
className: "ttw:text-sm ttw:font-semibold ttw:text-foreground ttw:wrap-break-word",
|
|
42
|
+
children: e.title
|
|
43
|
+
}), /* @__PURE__ */ f("span", {
|
|
44
|
+
className: "ttw:flex ttw:min-w-0 ttw:gap-1 ttw:text-sm ttw:text-muted-foreground",
|
|
45
|
+
children: [/* @__PURE__ */ d("span", {
|
|
46
|
+
className: "ttw:truncate",
|
|
47
|
+
children: e.accountName
|
|
48
|
+
}), /* @__PURE__ */ d("span", {
|
|
49
|
+
className: "ttw:shrink-0",
|
|
50
|
+
children: /* @__PURE__ */ d(s, {
|
|
51
|
+
last4: e.accountLast4,
|
|
52
|
+
labels: { endingIn: t }
|
|
53
|
+
})
|
|
54
|
+
})]
|
|
55
|
+
})]
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ d("span", {
|
|
58
|
+
className: "ttw:min-w-0 ttw:text-right ttw:text-sm ttw:font-medium ttw:text-foreground ttw:tabular-nums ttw:wrap-anywhere",
|
|
59
|
+
children: e.amount
|
|
60
|
+
})
|
|
61
|
+
] });
|
|
62
|
+
}
|
|
63
|
+
var g = "ttw:flex ttw:w-full ttw:items-center ttw:gap-4 ttw:rounded-md ttw:px-2 ttw:py-3 ttw:text-left";
|
|
64
|
+
function _({ rows: s, onRowClick: u, isLoading: _ = !1, isError: v = !1, onRetry: y, labels: b, testIds: x, className: S, style: C }) {
|
|
65
|
+
let w = {
|
|
66
|
+
...c,
|
|
67
|
+
...b
|
|
68
|
+
};
|
|
69
|
+
return /* @__PURE__ */ d(r, {
|
|
70
|
+
title: w.title,
|
|
71
|
+
className: S,
|
|
72
|
+
style: C,
|
|
73
|
+
bodyClassName: "ttw:px-2 ttw:pt-0 ttw:pb-2",
|
|
74
|
+
"data-testid": x?.root,
|
|
75
|
+
children: v ? /* @__PURE__ */ d(a, {
|
|
76
|
+
title: w.errorTitle,
|
|
77
|
+
description: w.errorDescription,
|
|
78
|
+
retryLabel: w.retry,
|
|
79
|
+
onRetry: y,
|
|
80
|
+
testId: x?.error
|
|
81
|
+
}) : /* @__PURE__ */ d(o, {
|
|
82
|
+
isLoading: _,
|
|
83
|
+
loadingLabel: w.loading,
|
|
84
|
+
children: _ ? /* @__PURE__ */ d("div", {
|
|
85
|
+
className: "ttw:flex ttw:flex-col",
|
|
86
|
+
children: Array.from({ length: m }, (n, r) => /* @__PURE__ */ f(l, { children: [r > 0 && /* @__PURE__ */ d(e, {}), /* @__PURE__ */ f("div", {
|
|
87
|
+
className: g,
|
|
88
|
+
"data-testid": x?.skeleton,
|
|
89
|
+
children: [
|
|
90
|
+
/* @__PURE__ */ d(t, { className: "ttw:h-9 ttw:w-10 ttw:shrink-0" }),
|
|
91
|
+
/* @__PURE__ */ f("div", {
|
|
92
|
+
className: "ttw:flex ttw:flex-1 ttw:flex-col ttw:gap-2",
|
|
93
|
+
children: [/* @__PURE__ */ d(t, { className: "ttw:h-4 ttw:w-1/2" }), /* @__PURE__ */ d(t, { className: "ttw:h-3.5 ttw:w-1/3" })]
|
|
94
|
+
}),
|
|
95
|
+
/* @__PURE__ */ d(t, { className: "ttw:h-4 ttw:w-20 ttw:shrink-0" })
|
|
96
|
+
]
|
|
97
|
+
})] }, r))
|
|
98
|
+
}) : s.length === 0 ? /* @__PURE__ */ d(i, {
|
|
99
|
+
icon: /* @__PURE__ */ d(p, {}),
|
|
100
|
+
title: w.emptyTitle,
|
|
101
|
+
description: w.emptyDescription,
|
|
102
|
+
testId: x?.empty
|
|
103
|
+
}) : /* @__PURE__ */ d("ul", {
|
|
104
|
+
"aria-label": w.list,
|
|
105
|
+
className: "ttw:flex ttw:flex-col",
|
|
106
|
+
children: s.map((t, r) => /* @__PURE__ */ f("li", {
|
|
107
|
+
"data-testid": x?.row,
|
|
108
|
+
children: [r > 0 && /* @__PURE__ */ d(e, {}), u ? /* @__PURE__ */ d("button", {
|
|
109
|
+
type: "button",
|
|
110
|
+
"aria-label": t.ariaLabel,
|
|
111
|
+
onClick: () => u(t.id),
|
|
112
|
+
className: n(g, "ttw:cursor-pointer ttw:outline-none ttw:hover:bg-muted ttw:focus-visible:outline-2 ttw:focus-visible:outline-offset-2 ttw:focus-visible:outline-ring ttw:focus-visible:outline-solid"),
|
|
113
|
+
children: /* @__PURE__ */ d(h, {
|
|
114
|
+
row: t,
|
|
115
|
+
endingIn: w.accountEndingIn
|
|
116
|
+
})
|
|
117
|
+
}) : /* @__PURE__ */ d("div", {
|
|
118
|
+
className: g,
|
|
119
|
+
children: /* @__PURE__ */ d(h, {
|
|
120
|
+
row: t,
|
|
121
|
+
endingIn: w.accountEndingIn
|
|
122
|
+
})
|
|
123
|
+
})]
|
|
124
|
+
}, t.id))
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
export { _ as RecentActivityCard };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { MASKED_ACCOUNT_NUMBER_LABELS_EN as e } from "../../../../../shared/ui/dist/lib/MaskedAccountNumber/labels.js";
|
|
2
|
+
import "../../../../../shared/ui/dist/index.js";
|
|
3
|
+
// ../../libs/tesouro-embedded-components-react/recent-activity-widget/ui/dist/lib/RecentActivityCard/labels.js
|
|
4
|
+
var t = {
|
|
5
|
+
title: "Recent activity",
|
|
6
|
+
list: "Recent transactions",
|
|
7
|
+
loading: "Loading recent activity",
|
|
8
|
+
accountEndingIn: e.endingIn,
|
|
9
|
+
emptyTitle: "No activity yet",
|
|
10
|
+
emptyDescription: "Transactions on your accounts will show up here.",
|
|
11
|
+
errorTitle: "Couldn’t load recent activity",
|
|
12
|
+
errorDescription: "Check your connection and try again.",
|
|
13
|
+
retry: "Try again"
|
|
14
|
+
};
|
|
15
|
+
export { t as RECENT_ACTIVITY_CARD_LABELS_EN };
|