@mx-cartographer/experiences 9.7.150 → 9.7.152
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/CHANGELOG.md +16 -4
- package/dist/core/types/Insights.d.ts +7 -10
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +13 -7
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +33 -36
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +91 -54
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.d.ts +12 -0
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js +76 -0
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSubscriptionHeader.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +14 -0
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +76 -37
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.d.ts +4 -23
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +95 -72
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js +6 -6
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +4 -4
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.d.ts +3 -1
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js +5 -4
- package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js.map +1 -1
- package/dist/insights-v2/components/drawerTip.d.ts +2 -0
- package/dist/insights-v2/components/drawerTip.es.js +10 -0
- package/dist/insights-v2/components/drawerTip.es.js.map +1 -0
- package/dist/insights-v2/index.d.ts +0 -1
- package/dist/insights-v2/index.es.js +104 -106
- package/dist/transactions/components/shared/TransactionList.d.ts +2 -0
- package/dist/transactions/components/shared/TransactionList.es.js +48 -47
- package/dist/transactions/components/shared/TransactionList.es.js.map +1 -1
- package/dist/transactions/components/shared/transactionlist/TransactionRow.d.ts +2 -0
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js +50 -45
- package/dist/transactions/components/shared/transactionlist/TransactionRow.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/layout.d.ts +0 -17
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/layout.es.js +0 -24
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/layout.es.js.map +0 -1
- package/dist/insights-v2/components/ComponentBlocks/DepositLogo.es.js +0 -30
- package/dist/insights-v2/components/ComponentBlocks/DepositLogo.es.js.map +0 -1
- package/dist/insights-v2/components/DebtPayoffCard.d.ts +0 -48
- package/dist/insights-v2/components/DebtPayoffCard.es.js +0 -132
- package/dist/insights-v2/components/DebtPayoffCard.es.js.map +0 -1
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { useEvent as
|
|
2
|
-
import { fromUnixUTCToDayOfWeekAndDate as
|
|
3
|
-
import { VISUALLY_HIDDEN_SX as
|
|
4
|
-
import { ANALYTICS_EVENTS as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { useTransactionsUiStore as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import { hasInsetBorder as
|
|
1
|
+
import { useEvent as oe, useGlobalCopyStore as ne, useTransactionStore as re } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { fromUnixUTCToDayOfWeekAndDate as se } from "../../../core/utils/DateUtil.es.js";
|
|
3
|
+
import { VISUALLY_HIDDEN_SX as ie } from "../../../common/constants/Styles.es.js";
|
|
4
|
+
import { ANALYTICS_EVENTS as ae } from "../../../common/constants/Analytics.es.js";
|
|
5
|
+
import ce from "../../../common/components/Loader.es.js";
|
|
6
|
+
import le from "../../../common/components/ZeroState.es.js";
|
|
7
|
+
import { useTransactionsUiStore as ue } from "../../context/hooks.es.js";
|
|
8
|
+
import de from "./transactionlist/TransactionRow.es.js";
|
|
9
|
+
import fe from "../../../common/components/SubheaderRow.es.js";
|
|
10
|
+
import { hasInsetBorder as me, shouldShowDate as D } from "../../utils/Transactions.es.js";
|
|
11
11
|
import o from "react";
|
|
12
|
-
import { observer as
|
|
13
|
-
import { Fragment as
|
|
12
|
+
import { observer as pe } from "mobx-react-lite";
|
|
13
|
+
import { Fragment as ge, jsx as s, jsxs as b } from "react/jsx-runtime";
|
|
14
14
|
import u from "@mui/material/Box";
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { useVirtualizer as
|
|
18
|
-
var z = 65, y = 32,
|
|
15
|
+
import he from "@mui/material/Divider";
|
|
16
|
+
import xe from "@mui/material/List";
|
|
17
|
+
import { useVirtualizer as Se } from "@tanstack/react-virtual";
|
|
18
|
+
var z = 65, y = 32, ve = (g) => {
|
|
19
19
|
for (let r = g?.parentElement; r; r = r.parentElement) if (/(auto|scroll)/.test(getComputedStyle(r).overflowY)) return r;
|
|
20
20
|
return null;
|
|
21
|
-
},
|
|
21
|
+
}, Te = ({ bgcolor: g, filter: r, height: N = "calc(100dvh - 36px)", isRowDisabled: O, loader: B = /* @__PURE__ */ s(ce, {
|
|
22
22
|
label: "Loading",
|
|
23
23
|
size: 40
|
|
24
|
-
}), onClick: E,
|
|
25
|
-
const { isLoading:
|
|
24
|
+
}), onClick: E, renderAmountCaption: k, renderSecondaryText: U, scrollsWithParent: a = !1, showInsights: I = !1, showLoader: V = !1, showUnviewedIndicator: $ = !1, stickyHeader: h, transaction: _, width: x = "100%", zeroState: F = /* @__PURE__ */ s(le, {}) }) => {
|
|
25
|
+
const { isLoading: M, sortedTransactions: S } = re(), n = o.useMemo(() => {
|
|
26
26
|
const e = r ? S.filter(r) : S;
|
|
27
27
|
return _ ?? e;
|
|
28
28
|
}, [
|
|
29
29
|
S,
|
|
30
30
|
r,
|
|
31
31
|
_
|
|
32
|
-
]), { clearExpandedSplits:
|
|
32
|
+
]), { clearExpandedSplits: Y, setShowInsights: G, toggleSplit: j } = ue(), { onEvent: q } = oe(), { common: K } = ne(), [d, C] = o.useState(null), X = (e) => {
|
|
33
33
|
const t = n.find((i) => i.guid === e);
|
|
34
34
|
if (t?.has_been_split) {
|
|
35
|
-
|
|
35
|
+
j(t.guid);
|
|
36
36
|
return;
|
|
37
37
|
}
|
|
38
|
-
|
|
38
|
+
q(ae.ACCOUNT_DETAILS_CLICK_TRANSACTION, {
|
|
39
39
|
account_guid: t?.account_guid,
|
|
40
40
|
transaction_guid: e
|
|
41
41
|
}), E?.(e);
|
|
42
|
-
}, f = o.useRef(null),
|
|
42
|
+
}, f = o.useRef(null), Z = !!h, [R, J] = o.useState(null), [L, P] = o.useState(0), m = o.useRef(null), [w, Q] = o.useState(0);
|
|
43
43
|
o.useLayoutEffect(() => {
|
|
44
44
|
if (!a) return;
|
|
45
45
|
const e = f.current;
|
|
46
46
|
if (!e) return;
|
|
47
|
-
const t =
|
|
48
|
-
|
|
47
|
+
const t = ve(e) ?? e, i = () => {
|
|
48
|
+
P(e.getBoundingClientRect().top - t.getBoundingClientRect().top + t.scrollTop), Q(m.current?.offsetHeight ?? 0);
|
|
49
49
|
};
|
|
50
|
-
|
|
50
|
+
J(t), i();
|
|
51
51
|
const l = new ResizeObserver(i);
|
|
52
52
|
return l.observe(t.firstElementChild ?? t), m.current && l.observe(m.current), () => l.disconnect();
|
|
53
|
-
}, [a,
|
|
54
|
-
const p =
|
|
53
|
+
}, [a, Z]);
|
|
54
|
+
const p = Se({
|
|
55
55
|
count: n.length,
|
|
56
56
|
getScrollElement: () => a ? R : f.current,
|
|
57
57
|
estimateSize: (e) => z + (D(e, n) ? y : 0),
|
|
58
58
|
overscan: 5,
|
|
59
59
|
scrollMargin: L,
|
|
60
60
|
scrollPaddingStart: w
|
|
61
|
-
}), v = p.getVirtualItems(), c = v.at(-1)?.index ?? -1, H = n.length - (c + 1), T = !
|
|
61
|
+
}), v = p.getVirtualItems(), c = v.at(-1)?.index ?? -1, H = n.length - (c + 1), T = !M && !V, A = T && v.length > 0, W = p.getTotalSize() || "auto", ee = () => {
|
|
62
62
|
const e = c + 1;
|
|
63
63
|
p.scrollToIndex(e, { align: "start" }), C({
|
|
64
64
|
index: e,
|
|
@@ -69,7 +69,7 @@ var z = 65, y = 32, Se = (g) => {
|
|
|
69
69
|
if (!d) return;
|
|
70
70
|
const e = f.current?.querySelector(`[data-index="${d.index}"]`);
|
|
71
71
|
e?.focus(), (e || c !== d.from) && C(null);
|
|
72
|
-
}, [d, c]), o.useEffect(() => p.measure(), [n, R]), o.useEffect(() =>
|
|
72
|
+
}, [d, c]), o.useEffect(() => p.measure(), [n, R]), o.useEffect(() => G(I), [I]), o.useEffect(() => () => Y(), []), /* @__PURE__ */ b(ge, { children: [
|
|
73
73
|
h && /* @__PURE__ */ s(u, {
|
|
74
74
|
ref: m,
|
|
75
75
|
sx: {
|
|
@@ -81,7 +81,7 @@ var z = 65, y = 32, Se = (g) => {
|
|
|
81
81
|
},
|
|
82
82
|
children: h
|
|
83
83
|
}),
|
|
84
|
-
/* @__PURE__ */ s(
|
|
84
|
+
/* @__PURE__ */ s(xe, {
|
|
85
85
|
component: "div",
|
|
86
86
|
role: "list",
|
|
87
87
|
sx: { width: x },
|
|
@@ -92,15 +92,15 @@ var z = 65, y = 32, Se = (g) => {
|
|
|
92
92
|
role: "presentation",
|
|
93
93
|
width: x,
|
|
94
94
|
children: /* @__PURE__ */ b(u, {
|
|
95
|
-
height:
|
|
95
|
+
height: W,
|
|
96
96
|
position: "relative",
|
|
97
97
|
role: "presentation",
|
|
98
98
|
width: "100%",
|
|
99
99
|
children: [
|
|
100
100
|
!T && B,
|
|
101
|
-
T && n.length === 0 &&
|
|
101
|
+
T && n.length === 0 && F,
|
|
102
102
|
A && v.map((e) => {
|
|
103
|
-
const t = n[e.index], i = D(e.index, n), l =
|
|
103
|
+
const t = n[e.index], i = D(e.index, n), l = me(e.index, n), te = z + (i ? y : 0);
|
|
104
104
|
return /* @__PURE__ */ b(u, {
|
|
105
105
|
"aria-posinset": e.index + 1,
|
|
106
106
|
"aria-setsize": n.length,
|
|
@@ -108,7 +108,7 @@ var z = 65, y = 32, Se = (g) => {
|
|
|
108
108
|
role: "listitem",
|
|
109
109
|
tabIndex: -1,
|
|
110
110
|
sx: {
|
|
111
|
-
height:
|
|
111
|
+
height: te,
|
|
112
112
|
position: "absolute",
|
|
113
113
|
scrollMarginTop: w,
|
|
114
114
|
transform: `translateY(${e.start - L}px)`,
|
|
@@ -116,19 +116,20 @@ var z = 65, y = 32, Se = (g) => {
|
|
|
116
116
|
bgcolor: "background.paper"
|
|
117
117
|
},
|
|
118
118
|
children: [
|
|
119
|
-
i && /* @__PURE__ */ s(
|
|
119
|
+
i && /* @__PURE__ */ s(fe, {
|
|
120
120
|
bgcolor: g,
|
|
121
|
-
children:
|
|
121
|
+
children: se(t.date)
|
|
122
122
|
}),
|
|
123
|
-
/* @__PURE__ */ s(
|
|
123
|
+
/* @__PURE__ */ s(de, {
|
|
124
124
|
component: "div",
|
|
125
125
|
disabled: O?.(t),
|
|
126
|
-
...E && { onClick:
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
...E && { onClick: X },
|
|
127
|
+
renderAmountCaption: k,
|
|
128
|
+
renderSecondaryText: U,
|
|
129
|
+
showUnviewedIndicator: $,
|
|
129
130
|
transaction: t
|
|
130
131
|
}),
|
|
131
|
-
/* @__PURE__ */ s(
|
|
132
|
+
/* @__PURE__ */ s(he, { sx: { ml: l ? 68 : 0 } })
|
|
132
133
|
]
|
|
133
134
|
}, t.guid);
|
|
134
135
|
})
|
|
@@ -138,16 +139,16 @@ var z = 65, y = 32, Se = (g) => {
|
|
|
138
139
|
}),
|
|
139
140
|
A && H > 0 && /* @__PURE__ */ s(u, {
|
|
140
141
|
component: "button",
|
|
141
|
-
onClick:
|
|
142
|
-
sx:
|
|
142
|
+
onClick: ee,
|
|
143
|
+
sx: ie,
|
|
143
144
|
tabIndex: -1,
|
|
144
145
|
type: "button",
|
|
145
|
-
children: `${
|
|
146
|
+
children: `${K.view_more} (${H})`
|
|
146
147
|
})
|
|
147
148
|
] });
|
|
148
|
-
},
|
|
149
|
+
}, Ue = pe(Te);
|
|
149
150
|
export {
|
|
150
|
-
|
|
151
|
+
Ue as default
|
|
151
152
|
};
|
|
152
153
|
|
|
153
154
|
//# sourceMappingURL=TransactionList.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionList.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionList.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useEvent,\n useGlobalCopyStore,\n VISUALLY_HIDDEN_SX,\n ZeroState,\n} from '../../../common'\nimport { type Transaction } from '../../../core'\n\nimport { useTransactionsUiStore } from '../../context/hooks'\nimport { useTransactionStore } from '../../../common'\n\nimport SubheaderRow from '../../../common/components/SubheaderRow'\nimport TransactionRow from './transactionlist/TransactionRow'\n\nimport { hasInsetBorder, shouldShowDate } from '../../utils/Transactions'\nimport { fromUnixUTCToDayOfWeekAndDate } from '../../../core/utils/DateUtil'\n\nconst ROW_HEIGHT = 65\nconst DATE_ROW_HEIGHT = 32\n\nconst findScrollParent = (node: HTMLElement | null): HTMLElement | null => {\n for (let el = node?.parentElement; el; el = el.parentElement) {\n if (/(auto|scroll)/.test(getComputedStyle(el).overflowY)) return el\n }\n return null\n}\n\nexport interface TransactionListProps {\n bgcolor?: string\n filter?: (t: Transaction) => boolean\n height?: number | string\n /**\n * Marks rows that stay in the list but cannot be acted on. Disabled rows are rendered greyed\n * out and inert instead of being removed, so list membership and ordering are unaffected.\n */\n isRowDisabled?: (t: Transaction) => boolean\n loader?: React.JSX.Element\n onClick?: (guid: string) => void\n /** Replaces each row's category subline (see TransactionRow); omitted, rows show the category. */\n renderSecondaryText?: (transaction: Transaction) => React.ReactNode\n /** Virtualize against the nearest scrolling ancestor instead of an own fixed-height scroll box. */\n scrollsWithParent?: boolean\n /** Rendered above the rows; stays at the top of the scroll area when used with scrollsWithParent. */\n stickyHeader?: React.ReactNode\n showInsights?: boolean\n showLoader?: boolean\n showUnviewedIndicator?: boolean\n transaction?: Transaction[]\n width?: number | string\n zeroState?: React.JSX.Element\n}\n\nconst TransactionList: React.FC<TransactionListProps> = ({\n bgcolor,\n filter,\n height = 'calc(100dvh - 36px)',\n isRowDisabled,\n loader = <Loader label=\"Loading\" size={40} />,\n onClick,\n renderSecondaryText,\n scrollsWithParent = false,\n showInsights = false,\n showLoader = false,\n showUnviewedIndicator = false,\n stickyHeader,\n transaction,\n width = '100%',\n zeroState = <ZeroState />,\n}) => {\n const { isLoading, sortedTransactions: allTransactions } = useTransactionStore()\n const transactions = React.useMemo(() => {\n const updatedTransactions = filter ? allTransactions.filter(filter) : allTransactions\n return transaction ?? updatedTransactions\n }, [allTransactions, filter, transaction])\n\n const { clearExpandedSplits, setShowInsights, toggleSplit } = useTransactionsUiStore()\n const { onEvent } = useEvent()\n const { common: commonCopy } = useGlobalCopyStore()\n const [pendingFocus, setPendingFocus] = React.useState<{ index: number; from: number } | null>(\n null,\n )\n\n const handleClick = (guid: string) => {\n const transaction = transactions.find((t) => t.guid === guid)\n\n if (transaction?.has_been_split) {\n toggleSplit(transaction.guid)\n return\n }\n\n onEvent(ANALYTICS_EVENTS.ACCOUNT_DETAILS_CLICK_TRANSACTION, {\n account_guid: transaction?.account_guid,\n transaction_guid: guid,\n })\n onClick?.(guid)\n }\n\n const parentRef = React.useRef<HTMLDivElement>(null)\n const hasStickyHeader = Boolean(stickyHeader)\n const [scrollParent, setScrollParent] = React.useState<HTMLElement | null>(null)\n const [scrollMargin, setScrollMargin] = React.useState(0)\n const headerRef = React.useRef<HTMLDivElement>(null)\n const [headerHeight, setHeaderHeight] = React.useState(0)\n\n React.useLayoutEffect(() => {\n if (!scrollsWithParent) return\n const list = parentRef.current\n if (!list) return\n // With no scrolling ancestor the list itself is the viewport, so every row renders.\n const scroller = findScrollParent(list) ?? list\n\n const measureOffset = () => {\n setScrollMargin(\n list.getBoundingClientRect().top -\n scroller.getBoundingClientRect().top +\n scroller.scrollTop,\n )\n setHeaderHeight(headerRef.current?.offsetHeight ?? 0)\n }\n\n setScrollParent(scroller)\n measureOffset()\n const observer = new ResizeObserver(measureOffset)\n observer.observe(scroller.firstElementChild ?? scroller)\n if (headerRef.current) observer.observe(headerRef.current)\n return () => observer.disconnect()\n }, [scrollsWithParent, hasStickyHeader])\n\n const rowVirtualizer = useVirtualizer({\n count: transactions.length,\n getScrollElement: () => (scrollsWithParent ? scrollParent : parentRef.current),\n estimateSize: (i) => ROW_HEIGHT + (shouldShowDate(i, transactions) ? DATE_ROW_HEIGHT : 0),\n overscan: 5,\n scrollMargin,\n scrollPaddingStart: headerHeight,\n })\n\n const virtualItems = rowVirtualizer.getVirtualItems()\n const lastRenderedIndex = virtualItems.at(-1)?.index ?? -1\n const unrenderedCount = transactions.length - (lastRenderedIndex + 1)\n const isSettled = !isLoading && !showLoader\n const showRows = isSettled && virtualItems.length > 0\n // The total size comes from the row count, so a content-sized list has height before any row\n // is drawn. It is 0 only with no transactions, where the zero state needs 'auto'.\n const rowBoxHeight = rowVirtualizer.getTotalSize() || 'auto'\n\n // Screen reader reading modes do not scroll the list, so rows past the rendered window\n // are unreachable without this control.\n const showNextRows = () => {\n const nextIndex = lastRenderedIndex + 1\n rowVirtualizer.scrollToIndex(nextIndex, { align: 'start' })\n setPendingFocus({ index: nextIndex, from: lastRenderedIndex })\n }\n\n React.useEffect(() => {\n if (!pendingFocus) return\n const row = parentRef.current?.querySelector<HTMLElement>(\n `[data-index=\"${pendingFocus.index}\"]`,\n )\n row?.focus()\n // Give up once the window moves, so a missed row cannot take focus later.\n if (row || lastRenderedIndex !== pendingFocus.from) setPendingFocus(null)\n }, [pendingFocus, lastRenderedIndex])\n\n React.useEffect(() => rowVirtualizer.measure(), [transactions, scrollParent])\n React.useEffect(() => setShowInsights(showInsights), [showInsights])\n\n React.useEffect(() => {\n return () => clearExpandedSplits()\n }, [])\n\n return (\n <>\n {stickyHeader && (\n <Box\n ref={headerRef}\n sx={{\n bgcolor: 'background.paper',\n position: scrollsWithParent ? 'sticky' : undefined,\n top: 0,\n width,\n zIndex: 1,\n }}\n >\n {stickyHeader}\n </Box>\n )}\n <List component=\"div\" role=\"list\" sx={{ width: width }}>\n <Box\n height={scrollsWithParent ? undefined : height}\n overflow={scrollsWithParent ? undefined : 'auto'}\n ref={parentRef}\n role=\"presentation\"\n width={width}\n >\n <Box height={rowBoxHeight} position=\"relative\" role=\"presentation\" width=\"100%\">\n {!isSettled && loader}\n {isSettled && transactions.length === 0 && zeroState}\n {showRows &&\n virtualItems.map((row) => {\n const transaction = transactions[row.index]\n const showDate = shouldShowDate(row.index, transactions)\n const isInset = hasInsetBorder(row.index, transactions)\n const rowHeight = ROW_HEIGHT + (showDate ? DATE_ROW_HEIGHT : 0)\n\n return (\n <Box\n aria-posinset={row.index + 1}\n aria-setsize={transactions.length}\n data-index={row.index}\n key={transaction.guid}\n role=\"listitem\"\n tabIndex={-1}\n sx={{\n height: rowHeight,\n position: 'absolute',\n // Keeps a focused row from scrolling under the sticky header.\n scrollMarginTop: headerHeight,\n transform: `translateY(${row.start - scrollMargin}px)`,\n width: '100%',\n bgcolor: 'background.paper',\n }}\n >\n {showDate && (\n <SubheaderRow bgcolor={bgcolor}>\n {fromUnixUTCToDayOfWeekAndDate(transaction.date)}\n </SubheaderRow>\n )}\n <TransactionRow\n component=\"div\"\n disabled={isRowDisabled?.(transaction)}\n {...(onClick && { onClick: handleClick })}\n renderSecondaryText={renderSecondaryText}\n showUnviewedIndicator={showUnviewedIndicator}\n transaction={transaction}\n />\n <Divider sx={{ ml: isInset ? 68 : 0 }} />\n </Box>\n )\n })}\n </Box>\n </Box>\n </List>\n {showRows && unrenderedCount > 0 && (\n <Box\n component=\"button\"\n onClick={showNextRows}\n sx={VISUALLY_HIDDEN_SX}\n tabIndex={-1}\n type=\"button\"\n >\n {`${commonCopy.view_more} (${unrenderedCount})`}\n </Box>\n )}\n </>\n )\n}\n\nexport default observer(TransactionList)\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,IAAM,IAAa,IACb,IAAkB,IAElB,KAAA,CAAoB,MAAiD;AACzE,WAAS,IAAK,GAAM,eAAe,GAAI,IAAK,EAAG,cAC7C,KAAI,gBAAgB,KAAK,iBAAiB,CAAE,EAAE,SAAS,EAAG,QAAO;AAEnE,SAAO;AACT,GA2BM,KAAA,CAAmD,EACvD,SAAA,GACA,QAAA,GACA,QAAA,IAAS,uBACT,eAAA,GACA,QAAA,IAAS,gBAAA,EAAC,IAAD;AAAA,EAAQ,OAAM;AAAA,EAAU,MAAM;AAAK,CAAA,GAC5C,SAAA,GACA,qBAAA,GACA,mBAAA,IAAoB,IACpB,cAAA,IAAe,IACf,YAAA,IAAa,IACb,uBAAA,IAAwB,IACxB,cAAA,GACA,aAAA,GACA,OAAA,IAAQ,QACR,WAAA,IAAY,gBAAA,EAAC,IAAD,CAAY,CAAA,EAAA,MACpB;AACJ,QAAM,EAAE,WAAA,GAAW,oBAAoB,EAAA,IAAoB,GAAoB,GACzE,IAAe,EAAM,QAAA,MAAc;AACvC,UAAM,IAAsB,IAAS,EAAgB,OAAO,CAAM,IAAI;AACtE,WAAO,KAAe;AAAA,EACxB,GAAG;AAAA,IAAC;AA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A,EAAC,IAAD;AAAA,oBACE,WAAU;AAAA,oBACV,UAAU,IAAgB,CAAW;AAAA,oBACrC,GAAK,KAAW,EAAE,SAAS,EAAY;AAAA,oBAClB,qBAAA;AAAA,oBACE,uBAAA;AAAA,oBACV,aAAA;AAAA,kBACd,CAAA;AAAA,kBACD,gBAAA,EAAC,IAAD,EAAS,IAAI,EAAE,IAAI,IAAU,KAAK,EAAE,EAAI,CAAA;AAAA,gBACrC;AAAA,cA3BE,GAAA,EAAY,IA2Bd;AAAA,YAET,CAAC;AAAA,UACA;AAAA;MACF,CAAA;AAAA,IACD,CAAA;AAAA,IACL,KAAY,IAAkB,KAC7B,gBAAA,EAAC,GAAD;AAAA,MACE,WAAU;AAAA,MACV,SAAS;AAAA,MACT,IAAI;AAAA,MACJ,UAAU;AAAA,MACV,MAAK;AAAA,MAEJ,UAAA,GAAG,EAAW,SAAA,KAAc,CAAA;AAAA,IAC1B,CAAA;AAAA,EAEP,EAAA,CAAA;AAEN,GAEA,KAAe,GAAS,EAAe"}
|
|
1
|
+
{"version":3,"file":"TransactionList.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionList.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\nimport { useVirtualizer } from '@tanstack/react-virtual'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useEvent,\n useGlobalCopyStore,\n VISUALLY_HIDDEN_SX,\n ZeroState,\n} from '../../../common'\nimport { type Transaction } from '../../../core'\n\nimport { useTransactionsUiStore } from '../../context/hooks'\nimport { useTransactionStore } from '../../../common'\n\nimport SubheaderRow from '../../../common/components/SubheaderRow'\nimport TransactionRow from './transactionlist/TransactionRow'\n\nimport { hasInsetBorder, shouldShowDate } from '../../utils/Transactions'\nimport { fromUnixUTCToDayOfWeekAndDate } from '../../../core/utils/DateUtil'\n\nconst ROW_HEIGHT = 65\nconst DATE_ROW_HEIGHT = 32\n\nconst findScrollParent = (node: HTMLElement | null): HTMLElement | null => {\n for (let el = node?.parentElement; el; el = el.parentElement) {\n if (/(auto|scroll)/.test(getComputedStyle(el).overflowY)) return el\n }\n return null\n}\n\nexport interface TransactionListProps {\n bgcolor?: string\n filter?: (t: Transaction) => boolean\n height?: number | string\n /**\n * Marks rows that stay in the list but cannot be acted on. Disabled rows are rendered greyed\n * out and inert instead of being removed, so list membership and ordering are unaffected.\n */\n isRowDisabled?: (t: Transaction) => boolean\n loader?: React.JSX.Element\n onClick?: (guid: string) => void\n /** A caption under each row's amount (see TransactionRow); omitted, the amount stands alone. */\n renderAmountCaption?: (transaction: Transaction) => React.ReactNode\n /** Replaces each row's category subline (see TransactionRow); omitted, rows show the category. */\n renderSecondaryText?: (transaction: Transaction) => React.ReactNode\n /** Virtualize against the nearest scrolling ancestor instead of an own fixed-height scroll box. */\n scrollsWithParent?: boolean\n /** Rendered above the rows; stays at the top of the scroll area when used with scrollsWithParent. */\n stickyHeader?: React.ReactNode\n showInsights?: boolean\n showLoader?: boolean\n showUnviewedIndicator?: boolean\n transaction?: Transaction[]\n width?: number | string\n zeroState?: React.JSX.Element\n}\n\nconst TransactionList: React.FC<TransactionListProps> = ({\n bgcolor,\n filter,\n height = 'calc(100dvh - 36px)',\n isRowDisabled,\n loader = <Loader label=\"Loading\" size={40} />,\n onClick,\n renderAmountCaption,\n renderSecondaryText,\n scrollsWithParent = false,\n showInsights = false,\n showLoader = false,\n showUnviewedIndicator = false,\n stickyHeader,\n transaction,\n width = '100%',\n zeroState = <ZeroState />,\n}) => {\n const { isLoading, sortedTransactions: allTransactions } = useTransactionStore()\n const transactions = React.useMemo(() => {\n const updatedTransactions = filter ? allTransactions.filter(filter) : allTransactions\n return transaction ?? updatedTransactions\n }, [allTransactions, filter, transaction])\n\n const { clearExpandedSplits, setShowInsights, toggleSplit } = useTransactionsUiStore()\n const { onEvent } = useEvent()\n const { common: commonCopy } = useGlobalCopyStore()\n const [pendingFocus, setPendingFocus] = React.useState<{ index: number; from: number } | null>(\n null,\n )\n\n const handleClick = (guid: string) => {\n const transaction = transactions.find((t) => t.guid === guid)\n\n if (transaction?.has_been_split) {\n toggleSplit(transaction.guid)\n return\n }\n\n onEvent(ANALYTICS_EVENTS.ACCOUNT_DETAILS_CLICK_TRANSACTION, {\n account_guid: transaction?.account_guid,\n transaction_guid: guid,\n })\n onClick?.(guid)\n }\n\n const parentRef = React.useRef<HTMLDivElement>(null)\n const hasStickyHeader = Boolean(stickyHeader)\n const [scrollParent, setScrollParent] = React.useState<HTMLElement | null>(null)\n const [scrollMargin, setScrollMargin] = React.useState(0)\n const headerRef = React.useRef<HTMLDivElement>(null)\n const [headerHeight, setHeaderHeight] = React.useState(0)\n\n React.useLayoutEffect(() => {\n if (!scrollsWithParent) return\n const list = parentRef.current\n if (!list) return\n // With no scrolling ancestor the list itself is the viewport, so every row renders.\n const scroller = findScrollParent(list) ?? list\n\n const measureOffset = () => {\n setScrollMargin(\n list.getBoundingClientRect().top -\n scroller.getBoundingClientRect().top +\n scroller.scrollTop,\n )\n setHeaderHeight(headerRef.current?.offsetHeight ?? 0)\n }\n\n setScrollParent(scroller)\n measureOffset()\n const observer = new ResizeObserver(measureOffset)\n observer.observe(scroller.firstElementChild ?? scroller)\n if (headerRef.current) observer.observe(headerRef.current)\n return () => observer.disconnect()\n }, [scrollsWithParent, hasStickyHeader])\n\n const rowVirtualizer = useVirtualizer({\n count: transactions.length,\n getScrollElement: () => (scrollsWithParent ? scrollParent : parentRef.current),\n estimateSize: (i) => ROW_HEIGHT + (shouldShowDate(i, transactions) ? DATE_ROW_HEIGHT : 0),\n overscan: 5,\n scrollMargin,\n scrollPaddingStart: headerHeight,\n })\n\n const virtualItems = rowVirtualizer.getVirtualItems()\n const lastRenderedIndex = virtualItems.at(-1)?.index ?? -1\n const unrenderedCount = transactions.length - (lastRenderedIndex + 1)\n const isSettled = !isLoading && !showLoader\n const showRows = isSettled && virtualItems.length > 0\n // The total size comes from the row count, so a content-sized list has height before any row\n // is drawn. It is 0 only with no transactions, where the zero state needs 'auto'.\n const rowBoxHeight = rowVirtualizer.getTotalSize() || 'auto'\n\n // Screen reader reading modes do not scroll the list, so rows past the rendered window\n // are unreachable without this control.\n const showNextRows = () => {\n const nextIndex = lastRenderedIndex + 1\n rowVirtualizer.scrollToIndex(nextIndex, { align: 'start' })\n setPendingFocus({ index: nextIndex, from: lastRenderedIndex })\n }\n\n React.useEffect(() => {\n if (!pendingFocus) return\n const row = parentRef.current?.querySelector<HTMLElement>(\n `[data-index=\"${pendingFocus.index}\"]`,\n )\n row?.focus()\n // Give up once the window moves, so a missed row cannot take focus later.\n if (row || lastRenderedIndex !== pendingFocus.from) setPendingFocus(null)\n }, [pendingFocus, lastRenderedIndex])\n\n React.useEffect(() => rowVirtualizer.measure(), [transactions, scrollParent])\n React.useEffect(() => setShowInsights(showInsights), [showInsights])\n\n React.useEffect(() => {\n return () => clearExpandedSplits()\n }, [])\n\n return (\n <>\n {stickyHeader && (\n <Box\n ref={headerRef}\n sx={{\n bgcolor: 'background.paper',\n position: scrollsWithParent ? 'sticky' : undefined,\n top: 0,\n width,\n zIndex: 1,\n }}\n >\n {stickyHeader}\n </Box>\n )}\n <List component=\"div\" role=\"list\" sx={{ width: width }}>\n <Box\n height={scrollsWithParent ? undefined : height}\n overflow={scrollsWithParent ? undefined : 'auto'}\n ref={parentRef}\n role=\"presentation\"\n width={width}\n >\n <Box height={rowBoxHeight} position=\"relative\" role=\"presentation\" width=\"100%\">\n {!isSettled && loader}\n {isSettled && transactions.length === 0 && zeroState}\n {showRows &&\n virtualItems.map((row) => {\n const transaction = transactions[row.index]\n const showDate = shouldShowDate(row.index, transactions)\n const isInset = hasInsetBorder(row.index, transactions)\n const rowHeight = ROW_HEIGHT + (showDate ? DATE_ROW_HEIGHT : 0)\n\n return (\n <Box\n aria-posinset={row.index + 1}\n aria-setsize={transactions.length}\n data-index={row.index}\n key={transaction.guid}\n role=\"listitem\"\n tabIndex={-1}\n sx={{\n height: rowHeight,\n position: 'absolute',\n // Keeps a focused row from scrolling under the sticky header.\n scrollMarginTop: headerHeight,\n transform: `translateY(${row.start - scrollMargin}px)`,\n width: '100%',\n bgcolor: 'background.paper',\n }}\n >\n {showDate && (\n <SubheaderRow bgcolor={bgcolor}>\n {fromUnixUTCToDayOfWeekAndDate(transaction.date)}\n </SubheaderRow>\n )}\n <TransactionRow\n component=\"div\"\n disabled={isRowDisabled?.(transaction)}\n {...(onClick && { onClick: handleClick })}\n renderAmountCaption={renderAmountCaption}\n renderSecondaryText={renderSecondaryText}\n showUnviewedIndicator={showUnviewedIndicator}\n transaction={transaction}\n />\n <Divider sx={{ ml: isInset ? 68 : 0 }} />\n </Box>\n )\n })}\n </Box>\n </Box>\n </List>\n {showRows && unrenderedCount > 0 && (\n <Box\n component=\"button\"\n onClick={showNextRows}\n sx={VISUALLY_HIDDEN_SX}\n tabIndex={-1}\n type=\"button\"\n >\n {`${commonCopy.view_more} (${unrenderedCount})`}\n </Box>\n )}\n </>\n )\n}\n\nexport default observer(TransactionList)\n"],"mappings":";;;;;;;;;;;;;;;;;AA2BA,IAAM,IAAa,IACb,IAAkB,IAElB,KAAA,CAAoB,MAAiD;AACzE,WAAS,IAAK,GAAM,eAAe,GAAI,IAAK,EAAG,cAC7C,KAAI,gBAAgB,KAAK,iBAAiB,CAAE,EAAE,SAAS,EAAG,QAAO;AAEnE,SAAO;AACT,GA6BM,KAAA,CAAmD,EACvD,SAAA,GACA,QAAA,GACA,QAAA,IAAS,uBACT,eAAA,GACA,QAAA,IAAS,gBAAA,EAAC,IAAD;AAAA,EAAQ,OAAM;AAAA,EAAU,MAAM;AAAK,CAAA,GAC5C,SAAA,GACA,qBAAA,GACA,qBAAA,GACA,mBAAA,IAAoB,IACpB,cAAA,IAAe,IACf,YAAA,IAAa,IACb,uBAAA,IAAwB,IACxB,cAAA,GACA,aAAA,GACA,OAAA,IAAQ,QACR,WAAA,IAAY,gBAAA,EAAC,IA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QAAQ,CAAA;AAAA,kBACrC,OAAO;AAAA,kBACP,SAAS;AAAA,gBACX;AAAA,gBAfF,UAAA;AAAA,kBAiBG,KACC,gBAAA,EAAC,IAAD;AAAA,oBAAuB,SAAA;AAAA,oBACpB,UAAA,GAA8B,EAAY,IAAI;AAAA,kBACnC,CAAA;AAAA,kBAEhB,gBAAA,EAAC,IAAD;AAAA,oBACE,WAAU;AAAA,oBACV,UAAU,IAAgB,CAAW;AAAA,oBACrC,GAAK,KAAW,EAAE,SAAS,EAAY;AAAA,oBAClB,qBAAA;AAAA,oBACA,qBAAA;AAAA,oBACE,uBAAA;AAAA,oBACV,aAAA;AAAA,kBACd,CAAA;AAAA,kBACD,gBAAA,EAAC,IAAD,EAAS,IAAI,EAAE,IAAI,IAAU,KAAK,EAAE,EAAI,CAAA;AAAA,gBACrC;AAAA,cA5BE,GAAA,EAAY,IA4Bd;AAAA,YAET,CAAC;AAAA,UACA;AAAA;MACF,CAAA;AAAA,IACD,CAAA;AAAA,IACL,KAAY,IAAkB,KAC7B,gBAAA,EAAC,GAAD;AAAA,MACE,WAAU;AAAA,MACV,SAAS;AAAA,MACT,IAAI;AAAA,MACJ,UAAU;AAAA,MACV,MAAK;AAAA,MAEJ,UAAA,GAAG,EAAW,SAAA,KAAc,CAAA;AAAA,IAC1B,CAAA;AAAA,EAEP,EAAA,CAAA;AAEN,GAEA,KAAe,GAAS,EAAe"}
|
|
@@ -5,6 +5,8 @@ interface TransactionRowProps {
|
|
|
5
5
|
/** Shows the row greyed out and inert (see {@link ListItemWrapper}). */
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
onClick?: (guid: string) => void;
|
|
8
|
+
/** An opt-in caption under the amount (a subscription's frequency); other lists pass none. */
|
|
9
|
+
renderAmountCaption?: (transaction: Transaction) => React.ReactNode;
|
|
8
10
|
/**
|
|
9
11
|
* Replaces the category subline (the status icons and insight tag stay). Opt-in for one drawer's
|
|
10
12
|
* rows, e.g. the Insights 2.0 summary-header drawer's account subline; every other list keeps the category.
|
|
@@ -1,86 +1,91 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { TransactionType as
|
|
3
|
-
import { formatCurrency as
|
|
4
|
-
import { isTransferTransaction as
|
|
5
|
-
import { ListItemWrapper as
|
|
6
|
-
import { useTransactionsUiStore as
|
|
7
|
-
import { ON_CLICK_EVENTS as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import { observer as
|
|
1
|
+
import { useGlobalCopyStore as N, useTransactionStore as k } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { TransactionType as L } from "../../../../core/types/Transaction.es.js";
|
|
3
|
+
import { formatCurrency as E } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import { isTransferTransaction as R, isUnviewedTransaction as j } from "../../../../core/utils/TransactionUtils.es.js";
|
|
5
|
+
import { ListItemWrapper as M } from "../../../../common/components/ListItemWrapper.es.js";
|
|
6
|
+
import { useTransactionsUiStore as g } from "../../../context/hooks.es.js";
|
|
7
|
+
import { ON_CLICK_EVENTS as z } from "../../../constants/OnClickEvents.es.js";
|
|
8
|
+
import A from "../TransactionInsightTag.es.js";
|
|
9
|
+
import G from "../UnviewedIndicator.es.js";
|
|
10
|
+
import _ from "react";
|
|
11
|
+
import { observer as O } from "mobx-react-lite";
|
|
12
12
|
import n from "@mui/material/Stack";
|
|
13
|
-
import { Icon as
|
|
14
|
-
import { jsx as i, jsxs as
|
|
15
|
-
import { useTheme as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
var
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
return r.is_flagged &&
|
|
13
|
+
import { Icon as d, MerchantLogo as U, Text as a } from "@mxenabled/mxui";
|
|
14
|
+
import { jsx as i, jsxs as t } from "react/jsx-runtime";
|
|
15
|
+
import { useTheme as B } from "@mui/material/styles";
|
|
16
|
+
import D from "@mui/material/ListItemAvatar";
|
|
17
|
+
import K from "@mui/material/ListItemText";
|
|
18
|
+
var F = ({ transaction: e, disabled: h = !1, onClick: m, component: l, renderSecondaryText: c, renderAmountCaption: T, showUnviewedIndicator: y = !1 }) => {
|
|
19
|
+
const I = B().palette.mode === "dark", { associatedBeats: p } = k(), { expandedSplits: b } = g(), { transactions: v } = N(), { showInsights: x } = g(), u = e.transaction_type === L.CREDIT, w = R(e) && !!e.institutionName, f = _.useMemo(() => p.find((r) => r.associated_transaction_guid === e.guid), [p, e]), C = (r, s) => {
|
|
20
|
+
const o = [];
|
|
21
|
+
return r.is_flagged && o.push(/* @__PURE__ */ i(d, {
|
|
22
22
|
fill: !0,
|
|
23
23
|
name: "flag",
|
|
24
24
|
size: 16,
|
|
25
25
|
sx: { color: s ? "primary.main" : "warning.dark" }
|
|
26
|
-
}, "flag")), r.is_hidden &&
|
|
26
|
+
}, "flag")), r.is_hidden && o.push(/* @__PURE__ */ i(d, {
|
|
27
27
|
name: "visibility_off",
|
|
28
28
|
size: 16
|
|
29
|
-
}, "hidden")), r.has_been_split &&
|
|
29
|
+
}, "hidden")), r.has_been_split && o.push(/* @__PURE__ */ i(d, {
|
|
30
30
|
name: "call_split",
|
|
31
31
|
size: 16
|
|
32
|
-
}, "split")),
|
|
33
|
-
},
|
|
34
|
-
return /* @__PURE__ */
|
|
35
|
-
clickEventName:
|
|
36
|
-
...
|
|
32
|
+
}, "split")), y && j(r) && o.push(/* @__PURE__ */ i(G, {}, "unviewed")), o;
|
|
33
|
+
}, S = (r, s) => r.is_hidden ? s.is_excluded : r.has_been_split ? s.split_transaction_category_label : r.category || "";
|
|
34
|
+
return /* @__PURE__ */ t(M, {
|
|
35
|
+
clickEventName: z.ON_TRANSACTION_LIST_ITEM_CLICK,
|
|
36
|
+
...l && { component: l },
|
|
37
37
|
disabled: h,
|
|
38
38
|
onClick: m ? () => m(e.guid) : void 0,
|
|
39
39
|
sx: e.is_hidden ? {
|
|
40
40
|
backgroundColor: "grey.50",
|
|
41
41
|
color: "text.secondary"
|
|
42
42
|
} : void 0,
|
|
43
|
-
children: [/* @__PURE__ */ i(
|
|
43
|
+
children: [/* @__PURE__ */ i(D, { children: e.parent_guid && b.includes(e.parent_guid) ? /* @__PURE__ */ i(_.Fragment, {}) : /* @__PURE__ */ i(U, {
|
|
44
44
|
categoryGuid: e.top_level_category_guid || "",
|
|
45
45
|
merchantGuid: e.merchant_guid || ""
|
|
46
|
-
}) }), /* @__PURE__ */ i(
|
|
46
|
+
}) }), /* @__PURE__ */ i(K, {
|
|
47
47
|
disableTypography: !0,
|
|
48
|
-
secondary: /* @__PURE__ */
|
|
48
|
+
secondary: /* @__PURE__ */ t(n, {
|
|
49
49
|
direction: "row",
|
|
50
50
|
justifyContent: "space-between",
|
|
51
|
-
children: [/* @__PURE__ */
|
|
51
|
+
children: [/* @__PURE__ */ t(n, {
|
|
52
52
|
alignItems: "center",
|
|
53
53
|
direction: "row",
|
|
54
54
|
gap: 4,
|
|
55
|
-
children: [
|
|
55
|
+
children: [C(e, I), c ? c(e) : /* @__PURE__ */ i(a, {
|
|
56
56
|
truncate: !0,
|
|
57
57
|
variant: "caption",
|
|
58
|
-
children:
|
|
58
|
+
children: S(e, v)
|
|
59
59
|
})]
|
|
60
|
-
}), f &&
|
|
60
|
+
}), f && x && /* @__PURE__ */ i(A, { beat: f })]
|
|
61
61
|
}),
|
|
62
|
-
children: /* @__PURE__ */
|
|
62
|
+
children: /* @__PURE__ */ t(n, {
|
|
63
63
|
direction: "row",
|
|
64
64
|
justifyContent: "space-between",
|
|
65
65
|
sx: { gap: 8 },
|
|
66
|
-
children: [/* @__PURE__ */ i(
|
|
66
|
+
children: [/* @__PURE__ */ i(a, {
|
|
67
67
|
bold: !0,
|
|
68
68
|
truncate: !0,
|
|
69
69
|
variant: "body1",
|
|
70
|
-
children:
|
|
71
|
-
}), /* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
children: [
|
|
70
|
+
children: w ? e.institutionName : e.payee || e.description || e.feed_description
|
|
71
|
+
}), /* @__PURE__ */ t(n, {
|
|
72
|
+
sx: {
|
|
73
|
+
alignItems: "flex-end",
|
|
74
|
+
flexShrink: 0
|
|
75
|
+
},
|
|
76
|
+
children: [/* @__PURE__ */ t(a, {
|
|
77
|
+
bold: !0,
|
|
78
|
+
color: u ? "success.main" : "text.primary",
|
|
79
|
+
variant: "body1",
|
|
80
|
+
children: [u ? "+" : "", E(e.amount, "0,0.00")]
|
|
81
|
+
}), T?.(e)]
|
|
77
82
|
})]
|
|
78
83
|
})
|
|
79
84
|
})]
|
|
80
85
|
});
|
|
81
|
-
},
|
|
86
|
+
}, ne = O(F);
|
|
82
87
|
export {
|
|
83
|
-
|
|
88
|
+
ne as default
|
|
84
89
|
};
|
|
85
90
|
|
|
86
91
|
//# sourceMappingURL=TransactionRow.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionRow.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactionlist/TransactionRow.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, MerchantLogo, Text } from '@mxenabled/mxui'\n\nimport { ListItemWrapper, useGlobalCopyStore, useTransactionStore } from '../../../../common'\nimport { Transaction, TransactionType } from '../../../../core'\nimport {\n isTransferTransaction,\n isUnviewedTransaction,\n} from '../../../../core/utils/TransactionUtils'\n\nimport TransactionInsightTag from '../TransactionInsightTag'\nimport UnviewedIndicator from '../UnviewedIndicator'\n\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\nimport { useTransactionsUiStore } from '../../../context/hooks'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface TransactionRowProps {\n component?: React.ElementType\n /** Shows the row greyed out and inert (see {@link ListItemWrapper}). */\n disabled?: boolean\n onClick?: (guid: string) => void\n /**\n * Replaces the category subline (the status icons and insight tag stay). Opt-in for one drawer's\n * rows, e.g. the Insights 2.0 summary-header drawer's account subline; every other list keeps the category.\n */\n renderSecondaryText?: (transaction: Transaction) => React.ReactNode\n /** Only the Transactions widget marks a transaction viewed, so other widgets leave this off. */\n showUnviewedIndicator?: boolean\n transaction: Transaction\n}\n\nconst TransactionRow: React.FC<TransactionRowProps> = ({\n transaction,\n disabled = false,\n onClick,\n component,\n renderSecondaryText,\n showUnviewedIndicator = false,\n}) => {\n const theme = useTheme()\n const isDarkMode = theme.palette.mode === 'dark'\n\n const { associatedBeats } = useTransactionStore()\n const { expandedSplits } = useTransactionsUiStore()\n const { transactions: copy } = useGlobalCopyStore()\n const { showInsights } = useTransactionsUiStore()\n\n const isCredit = transaction.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const getTransactionStatusIcons = (\n transaction: Transaction,\n isDarkMode: boolean,\n ): React.ReactNode[] => {\n const icons: React.ReactNode[] = []\n\n if (transaction.is_flagged) {\n icons.push(\n <Icon\n fill={true}\n key=\"flag\"\n name=\"flag\"\n size={16}\n sx={{ color: isDarkMode ? 'primary.main' : 'warning.dark' }}\n />,\n )\n }\n\n if (transaction.is_hidden) {\n icons.push(<Icon key=\"hidden\" name=\"visibility_off\" size={16} />)\n }\n\n if (transaction.has_been_split) {\n icons.push(<Icon key=\"split\" name=\"call_split\" size={16} />)\n }\n\n if (showUnviewedIndicator && isUnviewedTransaction(transaction)) {\n icons.push(<UnviewedIndicator key=\"unviewed\" />)\n }\n\n return icons\n }\n\n const getTransactionCategoryText = (transaction: Transaction, copy: any): string => {\n if (transaction.is_hidden) {\n return copy.is_excluded\n }\n\n if (transaction.has_been_split) {\n return copy.split_transaction_category_label\n }\n\n return transaction.category || ''\n }\n\n return (\n //TODO: implement common/components/ListItemRow.tsx\n <ListItemWrapper\n clickEventName={ON_CLICK_EVENTS.ON_TRANSACTION_LIST_ITEM_CLICK}\n {...(component && { component })}\n disabled={disabled}\n onClick={onClick ? () => onClick(transaction.guid) : undefined}\n sx={\n transaction.is_hidden ? { backgroundColor: 'grey.50', color: 'text.secondary' } : undefined\n }\n >\n <ListItemAvatar>\n {transaction.parent_guid && expandedSplits.includes(transaction.parent_guid) ? (\n <React.Fragment />\n ) : (\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n />\n )}\n </ListItemAvatar>\n <ListItemText\n disableTypography={true}\n secondary={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Stack alignItems=\"center\" direction=\"row\" gap={4}>\n {getTransactionStatusIcons(transaction, isDarkMode)}\n {renderSecondaryText ? (\n renderSecondaryText(transaction)\n ) : (\n <Text truncate={true} variant=\"caption\">\n {getTransactionCategoryText(transaction, copy)}\n </Text>\n )}\n </Stack>\n {beat && showInsights && <TransactionInsightTag beat={beat} />}\n </Stack>\n }\n >\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ gap: 8 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {showInstitution\n ? transaction.institutionName\n : transaction.payee || transaction.description || transaction.feed_description}\n </Text>\n <
|
|
1
|
+
{"version":3,"file":"TransactionRow.es.js","names":[],"sources":["../../../../../src/transactions/components/shared/transactionlist/TransactionRow.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Icon, MerchantLogo, Text } from '@mxenabled/mxui'\n\nimport { ListItemWrapper, useGlobalCopyStore, useTransactionStore } from '../../../../common'\nimport { Transaction, TransactionType } from '../../../../core'\nimport {\n isTransferTransaction,\n isUnviewedTransaction,\n} from '../../../../core/utils/TransactionUtils'\n\nimport TransactionInsightTag from '../TransactionInsightTag'\nimport UnviewedIndicator from '../UnviewedIndicator'\n\nimport { ON_CLICK_EVENTS } from '../../../constants/OnClickEvents'\nimport { useTransactionsUiStore } from '../../../context/hooks'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\ninterface TransactionRowProps {\n component?: React.ElementType\n /** Shows the row greyed out and inert (see {@link ListItemWrapper}). */\n disabled?: boolean\n onClick?: (guid: string) => void\n /** An opt-in caption under the amount (a subscription's frequency); other lists pass none. */\n renderAmountCaption?: (transaction: Transaction) => React.ReactNode\n /**\n * Replaces the category subline (the status icons and insight tag stay). Opt-in for one drawer's\n * rows, e.g. the Insights 2.0 summary-header drawer's account subline; every other list keeps the category.\n */\n renderSecondaryText?: (transaction: Transaction) => React.ReactNode\n /** Only the Transactions widget marks a transaction viewed, so other widgets leave this off. */\n showUnviewedIndicator?: boolean\n transaction: Transaction\n}\n\nconst TransactionRow: React.FC<TransactionRowProps> = ({\n transaction,\n disabled = false,\n onClick,\n component,\n renderSecondaryText,\n renderAmountCaption,\n showUnviewedIndicator = false,\n}) => {\n const theme = useTheme()\n const isDarkMode = theme.palette.mode === 'dark'\n\n const { associatedBeats } = useTransactionStore()\n const { expandedSplits } = useTransactionsUiStore()\n const { transactions: copy } = useGlobalCopyStore()\n const { showInsights } = useTransactionsUiStore()\n\n const isCredit = transaction.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const getTransactionStatusIcons = (\n transaction: Transaction,\n isDarkMode: boolean,\n ): React.ReactNode[] => {\n const icons: React.ReactNode[] = []\n\n if (transaction.is_flagged) {\n icons.push(\n <Icon\n fill={true}\n key=\"flag\"\n name=\"flag\"\n size={16}\n sx={{ color: isDarkMode ? 'primary.main' : 'warning.dark' }}\n />,\n )\n }\n\n if (transaction.is_hidden) {\n icons.push(<Icon key=\"hidden\" name=\"visibility_off\" size={16} />)\n }\n\n if (transaction.has_been_split) {\n icons.push(<Icon key=\"split\" name=\"call_split\" size={16} />)\n }\n\n if (showUnviewedIndicator && isUnviewedTransaction(transaction)) {\n icons.push(<UnviewedIndicator key=\"unviewed\" />)\n }\n\n return icons\n }\n\n const getTransactionCategoryText = (transaction: Transaction, copy: any): string => {\n if (transaction.is_hidden) {\n return copy.is_excluded\n }\n\n if (transaction.has_been_split) {\n return copy.split_transaction_category_label\n }\n\n return transaction.category || ''\n }\n\n return (\n //TODO: implement common/components/ListItemRow.tsx\n <ListItemWrapper\n clickEventName={ON_CLICK_EVENTS.ON_TRANSACTION_LIST_ITEM_CLICK}\n {...(component && { component })}\n disabled={disabled}\n onClick={onClick ? () => onClick(transaction.guid) : undefined}\n sx={\n transaction.is_hidden ? { backgroundColor: 'grey.50', color: 'text.secondary' } : undefined\n }\n >\n <ListItemAvatar>\n {transaction.parent_guid && expandedSplits.includes(transaction.parent_guid) ? (\n <React.Fragment />\n ) : (\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n />\n )}\n </ListItemAvatar>\n <ListItemText\n disableTypography={true}\n secondary={\n <Stack direction=\"row\" justifyContent=\"space-between\">\n <Stack alignItems=\"center\" direction=\"row\" gap={4}>\n {getTransactionStatusIcons(transaction, isDarkMode)}\n {renderSecondaryText ? (\n renderSecondaryText(transaction)\n ) : (\n <Text truncate={true} variant=\"caption\">\n {getTransactionCategoryText(transaction, copy)}\n </Text>\n )}\n </Stack>\n {beat && showInsights && <TransactionInsightTag beat={beat} />}\n </Stack>\n }\n >\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ gap: 8 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {showInstitution\n ? transaction.institutionName\n : transaction.payee || transaction.description || transaction.feed_description}\n </Text>\n <Stack sx={{ alignItems: 'flex-end', flexShrink: 0 }}>\n <Text bold={true} color={isCredit ? 'success.main' : 'text.primary'} variant=\"body1\">\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </Text>\n {renderAmountCaption?.(transaction)}\n </Stack>\n </Stack>\n </ListItemText>\n </ListItemWrapper>\n )\n}\n\nexport default observer(TransactionRow)\n"],"mappings":";;;;;;;;;;;;;;;;;AAyCA,IAAM,IAAA,CAAiD,EACrD,aAAA,GACA,UAAA,IAAW,IACX,SAAA,GACA,WAAA,GACA,qBAAA,GACA,qBAAA,GACA,uBAAA,IAAwB,GAAA,MACpB;AAEJ,QAAM,IADQ,EACK,EAAM,QAAQ,SAAS,QAEpC,EAAE,iBAAA,EAAA,IAAoB,EAAoB,GAC1C,EAAE,gBAAA,EAAA,IAAmB,EAAuB,GAC5C,EAAE,cAAc,EAAA,IAAS,EAAmB,GAC5C,EAAE,cAAA,EAAA,IAAiB,EAAuB,GAE1C,IAAW,EAAY,qBAAqB,EAAgB,QAE5D,IAAkB,EAAsB,CAAW,KAAK,EAAQ,EAAY,iBAE5E,IAAO,EAAM,QAAA,MACV,EAAgB,KAAA,CAAM,MAAS,EAAK,gCAAgC,EAAY,IAAI,GAC1F,CAAC,GAAiB,CAAW,CAAC,GAE3B,IAAA,CACJ,GACA,MACsB;AACtB,UAAM,IAA2B,CAAC;AAElC,WAAI,EAAY,cACd,EAAM,KACJ,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MAEN,MAAK;AAAA,MACL,MAAM;AAAA,MACN,IAAI,EAAE,OAAO,IAAa,iBAAiB,eAAe;AAAA,IAC3D,GAJK,MAIL,CACH,GAGE,EAAY,aACd,EAAM,KAAK,gBAAA,EAAC,GAAD;AAAA,MAAmB,MAAK;AAAA,MAAiB,MAAM;AAAA,IAAK,GAA1C,QAA0C,CAAC,GAG9D,EAAY,kBACd,EAAM,KAAK,gBAAA,EAAC,GAAD;AAAA,MAAkB,MAAK;AAAA,MAAa,MAAM;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AO,CAAA,CACxD;AAAA;MAGT,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAO,WAAU;AAAA,QAAM,gBAAe;AAAA,QAAgB,IAAI,EAAE,KAAK,EAAE;AAAA,QAAnE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,UAAU;AAAA,UAAM,SAAQ;AAAA,UACvC,UAAA,IACG,EAAY,kBACZ,EAAY,SAAS,EAAY,eAAe,EAAY;AAAA,QAC5D,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,YAAY;AAAA,YAAY,YAAY;AAAA,UAAE;AAAA,UAAnD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,YAAM,MAAM;AAAA,YAAM,OAAO,IAAW,iBAAiB;AAAA,YAAgB,SAAQ;AAAA,YAA7E,UAAA,CACG,IAAW,MAAM,IACjB,EAAe,EAAY,QAAQ,QAAQ,CACxC;AAAA,UACL,CAAA,GAAA,IAAsB,CAAW,CAC7B;AAAA,QACF,CAAA,CAAA;AAAA;IACK,CAAA,CACC;AAAA;AAErB,GAEA,KAAe,EAAS,CAAc"}
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { DebtPayoffCardStyleProps } from '../../../components/DebtPayoffCard';
|
|
2
|
-
export declare const debtsBlockVariant: {
|
|
3
|
-
/** Debt Payoff Strategies, one account: balance plus projected payoff / monthly payment / rate rows. */
|
|
4
|
-
readonly ProjectedPayoff: "projected_payoff";
|
|
5
|
-
/** Debt Payoff Strategies, several accounts: one row per debt (balance, rate) and the total owed. */
|
|
6
|
-
readonly DebtSummary: "debt_summary";
|
|
7
|
-
};
|
|
8
|
-
export type DebtsBlockVariant = (typeof debtsBlockVariant)[keyof typeof debtsBlockVariant];
|
|
9
|
-
export interface DebtsBlockLayoutConfig {
|
|
10
|
-
/** Which card the variant draws: the single-account payoff card or the multi-account summary list. */
|
|
11
|
-
card: 'payoff' | 'summary';
|
|
12
|
-
/** Payoff card slot + pill tokens. */
|
|
13
|
-
style?: DebtPayoffCardStyleProps;
|
|
14
|
-
}
|
|
15
|
-
/** `projected_payoff` look: primary-tinted slot and pill. The card story mirrors it from here. */
|
|
16
|
-
export declare const PAYOFF_STYLE: DebtPayoffCardStyleProps;
|
|
17
|
-
export declare const DEBTS_LAYOUT: Record<string, DebtsBlockLayoutConfig>;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
var r = {
|
|
2
|
-
ProjectedPayoff: "projected_payoff",
|
|
3
|
-
DebtSummary: "debt_summary"
|
|
4
|
-
}, e = {
|
|
5
|
-
bgcolor: "primary.lighter",
|
|
6
|
-
pill: {
|
|
7
|
-
bgcolor: "primary.lighter",
|
|
8
|
-
labelColor: "text.primary"
|
|
9
|
-
}
|
|
10
|
-
}, a = {
|
|
11
|
-
card: "payoff",
|
|
12
|
-
style: e
|
|
13
|
-
}, o = {
|
|
14
|
-
[r.ProjectedPayoff]: a,
|
|
15
|
-
[r.DebtSummary]: { card: "summary" },
|
|
16
|
-
default: a
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
o as DEBTS_LAYOUT,
|
|
20
|
-
e as PAYOFF_STYLE,
|
|
21
|
-
r as debtsBlockVariant
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/DebtsBlock/layout.ts"],"sourcesContent":["import type { DebtPayoffCardStyleProps } from '../../../components/DebtPayoffCard'\n\nexport const debtsBlockVariant = {\n /** Debt Payoff Strategies, one account: balance plus projected payoff / monthly payment / rate rows. */\n ProjectedPayoff: 'projected_payoff',\n /** Debt Payoff Strategies, several accounts: one row per debt (balance, rate) and the total owed. */\n DebtSummary: 'debt_summary',\n} as const\n\nexport type DebtsBlockVariant = (typeof debtsBlockVariant)[keyof typeof debtsBlockVariant]\n\nexport interface DebtsBlockLayoutConfig {\n /** Which card the variant draws: the single-account payoff card or the multi-account summary list. */\n card: 'payoff' | 'summary'\n /** Payoff card slot + pill tokens. */\n style?: DebtPayoffCardStyleProps\n}\n\n/** `projected_payoff` look: primary-tinted slot and pill. The card story mirrors it from here. */\nexport const PAYOFF_STYLE: DebtPayoffCardStyleProps = {\n bgcolor: 'primary.lighter',\n pill: { bgcolor: 'primary.lighter', labelColor: 'text.primary' },\n}\n\nconst PROJECTED_PAYOFF: DebtsBlockLayoutConfig = { card: 'payoff', style: PAYOFF_STYLE }\n\nexport const DEBTS_LAYOUT: Record<string, DebtsBlockLayoutConfig> = {\n [debtsBlockVariant.ProjectedPayoff]: PROJECTED_PAYOFF,\n [debtsBlockVariant.DebtSummary]: { card: 'summary' },\n // Neutral fallback for an unknown variant: the payoff card. `resolveVariantConfig` warns first.\n default: PROJECTED_PAYOFF,\n}\n"],"mappings":"AAEA,IAAa,IAAoB;AAAA,EAE/B,iBAAiB;AAAA,EAEjB,aAAa;AACf,GAYa,IAAyC;AAAA,EACpD,SAAS;AAAA,EACT,MAAM;AAAA,IAAE,SAAS;AAAA,IAAmB,YAAY;AAAA,EAAe;AACjE,GAEM,IAA2C;AAAA,EAAE,MAAM;AAAA,EAAU,OAAO;AAAa,GAE1E,IAAuD;AAAA,EACjE,CAAA,EAAkB,eAAA,GAAkB;AAAA,EACpC,CAAA,EAAkB,WAAA,GAAc,EAAE,MAAM,UAAU;AAAA,EAEnD,SAAS;AACX"}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import s from "../LogoMark.es.js";
|
|
2
|
-
import i from "@mui/material/Stack";
|
|
3
|
-
import { Icon as n } from "@mxenabled/mx-icons";
|
|
4
|
-
import { jsx as o } from "react/jsx-runtime";
|
|
5
|
-
var a = 48, m = ({ iconName: t }) => /* @__PURE__ */ o(i, {
|
|
6
|
-
sx: {
|
|
7
|
-
alignItems: "center",
|
|
8
|
-
bgcolor: "success.main",
|
|
9
|
-
height: "100%",
|
|
10
|
-
justifyContent: "center",
|
|
11
|
-
width: "100%"
|
|
12
|
-
},
|
|
13
|
-
children: /* @__PURE__ */ o(n, {
|
|
14
|
-
name: t,
|
|
15
|
-
size: 24,
|
|
16
|
-
sx: { color: "success.contrastText" }
|
|
17
|
-
})
|
|
18
|
-
}), f = ({ iconName: t = "payments", institutionGuid: e, institutionName: r }) => e ? /* @__PURE__ */ o(s, {
|
|
19
|
-
logo: {
|
|
20
|
-
institution_guid: e,
|
|
21
|
-
institution_name: r
|
|
22
|
-
},
|
|
23
|
-
size: a
|
|
24
|
-
}) : /* @__PURE__ */ o(m, { iconName: t });
|
|
25
|
-
export {
|
|
26
|
-
f as DepositLogo,
|
|
27
|
-
f as default
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
//# sourceMappingURL=DepositLogo.es.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DepositLogo.es.js","names":[],"sources":["../../../../src/insights-v2/components/ComponentBlocks/DepositLogo.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport LogoMark from '../LogoMark'\n\ninterface DepositLogoProps {\n /** mx-icons glyph for the generic tile when no institution guid is sent. */\n iconName?: string\n /** Renders the institution's logo when present. */\n institutionGuid?: string\n /** The institution's name, used as the logo's alt text. */\n institutionName?: string\n}\n\nconst SIZE = 48\n\n/** Themed tile standing in for the logo when no guid is sent; theme colors keep it right in dark mode. */\nconst DepositLogoTile = ({ iconName }: { iconName: string }) => (\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon name={iconName} size={24} sx={{ color: 'success.contrastText' }} />\n </Stack>\n)\n\n/** Logo shown in a deposit callout: the institution's logo, or a themed generic tile without one. */\nexport const DepositLogo = ({\n iconName = 'payments',\n institutionGuid,\n institutionName,\n}: DepositLogoProps) =>\n institutionGuid ? (\n <LogoMark\n logo={{ institution_guid: institutionGuid, institution_name: institutionName }}\n size={SIZE}\n />\n ) : (\n <DepositLogoTile iconName={iconName} />\n )\n\nexport default DepositLogo\n"],"mappings":";;;;AAeA,IAAM,IAAO,IAGP,IAAA,CAAmB,EAAE,UAAA,EAAA,MACzB,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,OAAO;AAAA,EACT;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAU,MAAM;AAAA,IAAI,IAAI,EAAE,OAAO,uBAAuB;AAAA,EAAI,CAAA;AACnE,CAAA,GAII,IAAA,CAAe,EAC1B,UAAA,IAAW,YACX,iBAAA,GACA,iBAAA,EAAA,MAEA,IACE,gBAAA,EAAC,GAAD;AAAA,EACE,MAAM;AAAA,IAAE,kBAAkB;AAAA,IAAiB,kBAAkB;AAAA,EAAgB;AAAA,EAC7E,MAAM;AACP,CAAA,IAED,gBAAA,EAAC,GAAD,EAA2B,UAAA,EAAW,CAAA"}
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
export interface DebtPayoffStat {
|
|
3
|
-
/** Row label, e.g. "Projected payoff". */
|
|
4
|
-
label: ReactNode;
|
|
5
|
-
/** Pre-formatted row value, e.g. "Mar 2027". */
|
|
6
|
-
value: ReactNode;
|
|
7
|
-
}
|
|
8
|
-
export interface DebtPayoffPillConfig {
|
|
9
|
-
/** Pill background color token. The pill is borderless. */
|
|
10
|
-
bgcolor: string;
|
|
11
|
-
/** Pill label color token. */
|
|
12
|
-
labelColor: string;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* Style props for the card. The Debts block supplies them for its look; the card itself
|
|
16
|
-
* is variant-agnostic. Only what a caller sets today is here; add a knob with its first caller.
|
|
17
|
-
*/
|
|
18
|
-
export interface DebtPayoffCardStyleProps {
|
|
19
|
-
/** Slot surface token behind the white card. Default `background.default`. */
|
|
20
|
-
bgcolor?: string;
|
|
21
|
-
/** Status pill color tokens. */
|
|
22
|
-
pill?: DebtPayoffPillConfig;
|
|
23
|
-
}
|
|
24
|
-
interface DebtPayoffCardProps extends DebtPayoffCardStyleProps {
|
|
25
|
-
/** Institution/account logo rendered beside the account name. */
|
|
26
|
-
logo: ReactNode;
|
|
27
|
-
/** Primary line, e.g. "Epic Bank Credit *0987". */
|
|
28
|
-
name: ReactNode;
|
|
29
|
-
/** Optional secondary line beneath the name, e.g. "Credit Card". */
|
|
30
|
-
subtitle?: ReactNode;
|
|
31
|
-
/** Caption above the balance, e.g. "Current balance". Rendered only together with `balance`. */
|
|
32
|
-
balanceLabel?: ReactNode;
|
|
33
|
-
/** Pre-formatted balance, e.g. "$4,500.00". Omitted (with its caption) when unknown. */
|
|
34
|
-
balance?: ReactNode;
|
|
35
|
-
/** Label/value rows beneath the balance (payoff date, monthly payment, rate). */
|
|
36
|
-
stats?: DebtPayoffStat[];
|
|
37
|
-
/** Optional status pill label beside the account, e.g. the payoff strategy name. */
|
|
38
|
-
statusLabel?: ReactNode;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* A debt account card: logo + account name row (with an optional status pill), the current
|
|
42
|
-
* balance, and a divided list of label/value payoff stats, on a tinted slot.
|
|
43
|
-
*
|
|
44
|
-
* Purely presentational — it knows nothing about beats or variants; the Debts block passes
|
|
45
|
-
* the style props for its look.
|
|
46
|
-
*/
|
|
47
|
-
declare const DebtPayoffCard: ({ balance, balanceLabel, bgcolor, logo, name, pill, stats, statusLabel, subtitle, }: DebtPayoffCardProps) => import("react/jsx-runtime").JSX.Element;
|
|
48
|
-
export default DebtPayoffCard;
|