@mx-cartographer/experiences 9.7.128 → 9.7.130
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 +8 -0
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +11 -15
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.d.ts +5 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js +78 -30
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.d.ts +26 -13
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js +107 -136
- package/dist/insights-v2/actionBlocks/AccountListBlock/AccountListContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.d.ts +21 -7
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js +34 -17
- package/dist/insights-v2/actionBlocks/AccountListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.d.ts +3 -1
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js +10 -8
- package/dist/insights-v2/actionBlocks/AccountListBlock/useAccountListPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js +46 -45
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js +23 -22
- package/dist/insights-v2/actionBlocks/CreditUtilizationBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +26 -25
- package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.d.ts +0 -1
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.es.js +6 -6
- package/dist/insights-v2/actionBlocks/HelpBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +8 -7
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.es.js +11 -13
- package/dist/insights-v2/actionBlocks/OverdraftBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.d.ts +10 -12
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js +20 -19
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/RecurringTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.d.ts +3 -12
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js +8 -8
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.d.ts +9 -0
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js +27 -10
- package/dist/insights-v2/actionBlocks/RecurringTransactionBlock/useRecurringTransactionPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.d.ts +1 -7
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js +49 -59
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js +29 -75
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.d.ts +12 -0
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js +18 -9
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +14 -13
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +10 -9
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +0 -3
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +30 -33
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +31 -30
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +14 -14
- package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/RepeatingTransactionBlock/RepeatingTransactionBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +11 -10
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +5 -5
- package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/EmergencySavingsAccountPicker.es.js +1 -1
- package/dist/insights-v2/blocks/slotReaders.d.ts +5 -0
- package/dist/insights-v2/blocks/slotReaders.es.js +7 -5
- package/dist/insights-v2/blocks/slotReaders.es.js.map +1 -1
- package/dist/insights-v2/components/AmountBreakdownCard.es.js +9 -8
- package/dist/insights-v2/components/AmountBreakdownCard.es.js.map +1 -1
- package/dist/insights-v2/components/InsightListRow.d.ts +31 -0
- package/dist/insights-v2/components/InsightListRow.es.js +111 -0
- package/dist/insights-v2/components/InsightListRow.es.js.map +1 -0
- package/dist/insights-v2/components/SubTabs.d.ts +2 -1
- package/dist/insights-v2/components/SubTabs.es.js +10 -10
- package/dist/insights-v2/components/SubTabs.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +12 -12
- package/dist/insights-v2/mappings/blocks.es.js +21 -21
- package/dist/recurringtransactions/components/RecurringTransactionDetails.d.ts +3 -1
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +169 -120
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js.map +1 -1
- package/dist/recurringtransactions/components/RecurringTransactionList.d.ts +3 -1
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js +151 -118
- package/dist/recurringtransactions/components/RecurringTransactionList.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -6
- package/dist/transactions/components/shared/TransactionDetails.es.js +149 -199
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/Description.d.ts +2 -0
- package/dist/transactions/components/shared/transactiondetails/Description.es.js +59 -50
- package/dist/transactions/components/shared/transactiondetails/Description.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.d.ts +10 -0
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js +68 -0
- package/dist/transactions/components/shared/transactiondetails/TransactionHeaderParts.es.js.map +1 -0
- package/package.json +1 -1
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import { formatSignedCurrency as
|
|
2
|
-
import { getLogoElevation as
|
|
1
|
+
import { formatSignedCurrency as l } from "../../../core/utils/NumberFormatting.es.js";
|
|
2
|
+
import { getLogoElevation as h } from "../../components/logoShadow.es.js";
|
|
3
|
+
import s from "../../components/InsightListRow.es.js";
|
|
3
4
|
import { createElement as b } from "react";
|
|
4
5
|
import i from "@mui/material/Stack";
|
|
5
6
|
import { Text as a } from "@mxenabled/mxui";
|
|
6
7
|
import { jsx as r, jsxs as n } from "react/jsx-runtime";
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
var
|
|
8
|
+
import u from "@mui/material/Box";
|
|
9
|
+
import x from "@mui/material/Divider";
|
|
10
|
+
var c = ({ label: t, value: o }) => /* @__PURE__ */ n(i, {
|
|
10
11
|
sx: {
|
|
11
12
|
alignItems: "center",
|
|
12
13
|
flexDirection: "row",
|
|
@@ -22,9 +23,9 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
22
23
|
bold: !0,
|
|
23
24
|
sx: { fontVariantNumeric: "tabular-nums" },
|
|
24
25
|
variant: "body1",
|
|
25
|
-
children:
|
|
26
|
+
children: o
|
|
26
27
|
})]
|
|
27
|
-
}),
|
|
28
|
+
}), f = ({ cashOnHand: t, cashOnHandLabel: o, remaining: e, upcomingExpenses: d, upcomingExpensesLabel: p }) => /* @__PURE__ */ r(i, {
|
|
28
29
|
sx: {
|
|
29
30
|
pb: 8,
|
|
30
31
|
pt: 24,
|
|
@@ -34,12 +35,12 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
34
35
|
sx: {
|
|
35
36
|
bgcolor: "background.paper",
|
|
36
37
|
borderRadius: "8px",
|
|
37
|
-
boxShadow:
|
|
38
|
+
boxShadow: h,
|
|
38
39
|
gap: 16,
|
|
39
40
|
p: 16
|
|
40
41
|
},
|
|
41
|
-
children: [
|
|
42
|
-
"aria-label": `${
|
|
42
|
+
children: [e && /* @__PURE__ */ n(i, {
|
|
43
|
+
"aria-label": `${l(e.amount)}, ${e.caption}`,
|
|
43
44
|
role: "group",
|
|
44
45
|
sx: {
|
|
45
46
|
alignItems: "center",
|
|
@@ -52,12 +53,12 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
52
53
|
bold: !0,
|
|
53
54
|
component: "p",
|
|
54
55
|
variant: "h2",
|
|
55
|
-
children:
|
|
56
|
+
children: l(e.amount)
|
|
56
57
|
}), /* @__PURE__ */ r(a, {
|
|
57
58
|
"aria-hidden": !0,
|
|
58
59
|
color: "text.secondary",
|
|
59
60
|
variant: "subtitle2",
|
|
60
|
-
children:
|
|
61
|
+
children: e.caption
|
|
61
62
|
})]
|
|
62
63
|
}), /* @__PURE__ */ n(i, {
|
|
63
64
|
sx: {
|
|
@@ -67,66 +68,19 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
67
68
|
overflow: "hidden"
|
|
68
69
|
},
|
|
69
70
|
children: [
|
|
70
|
-
/* @__PURE__ */ r(
|
|
71
|
-
label:
|
|
72
|
-
value:
|
|
71
|
+
/* @__PURE__ */ r(c, {
|
|
72
|
+
label: o,
|
|
73
|
+
value: l(t)
|
|
73
74
|
}),
|
|
74
|
-
/* @__PURE__ */ r(
|
|
75
|
-
/* @__PURE__ */ r(
|
|
76
|
-
label:
|
|
77
|
-
value:
|
|
75
|
+
/* @__PURE__ */ r(x, {}),
|
|
76
|
+
/* @__PURE__ */ r(c, {
|
|
77
|
+
label: p,
|
|
78
|
+
value: l(-d)
|
|
78
79
|
})
|
|
79
80
|
]
|
|
80
81
|
})]
|
|
81
82
|
})
|
|
82
|
-
}),
|
|
83
|
-
component: "li",
|
|
84
|
-
sx: { position: "relative" },
|
|
85
|
-
children: [/* @__PURE__ */ n(i, {
|
|
86
|
-
sx: {
|
|
87
|
-
alignItems: "center",
|
|
88
|
-
flexDirection: "row",
|
|
89
|
-
gap: 16,
|
|
90
|
-
px: 24,
|
|
91
|
-
py: 16
|
|
92
|
-
},
|
|
93
|
-
children: [/* @__PURE__ */ n(i, {
|
|
94
|
-
sx: {
|
|
95
|
-
alignItems: "center",
|
|
96
|
-
flexDirection: "row",
|
|
97
|
-
flexGrow: 1,
|
|
98
|
-
gap: 12,
|
|
99
|
-
minWidth: 0
|
|
100
|
-
},
|
|
101
|
-
children: [/* @__PURE__ */ r(p, {
|
|
102
|
-
sx: {
|
|
103
|
-
display: "flex",
|
|
104
|
-
flexShrink: 0,
|
|
105
|
-
height: 32,
|
|
106
|
-
width: 32
|
|
107
|
-
},
|
|
108
|
-
children: o
|
|
109
|
-
}), /* @__PURE__ */ r(a, {
|
|
110
|
-
truncate: !0,
|
|
111
|
-
variant: "body1",
|
|
112
|
-
children: l
|
|
113
|
-
})]
|
|
114
|
-
}), /* @__PURE__ */ r(a, {
|
|
115
|
-
bold: !0,
|
|
116
|
-
sx: {
|
|
117
|
-
flexShrink: 0,
|
|
118
|
-
fontVariantNumeric: "tabular-nums"
|
|
119
|
-
},
|
|
120
|
-
variant: "body1",
|
|
121
|
-
children: d(t)
|
|
122
|
-
})]
|
|
123
|
-
}), /* @__PURE__ */ r(s, { sx: {
|
|
124
|
-
bottom: 0,
|
|
125
|
-
left: e ? 0 : 24,
|
|
126
|
-
position: "absolute",
|
|
127
|
-
right: 0
|
|
128
|
-
} })]
|
|
129
|
-
}), m = ({ header: t, rows: e }) => /* @__PURE__ */ n(i, { children: [/* @__PURE__ */ r(p, {
|
|
83
|
+
}), m = ({ header: t, rows: o }) => /* @__PURE__ */ n(i, { children: [/* @__PURE__ */ r(u, {
|
|
130
84
|
sx: {
|
|
131
85
|
pb: 4,
|
|
132
86
|
pt: 16,
|
|
@@ -146,24 +100,24 @@ var h = ({ label: t, value: e }) => /* @__PURE__ */ n(i, {
|
|
|
146
100
|
m: 0,
|
|
147
101
|
p: 0
|
|
148
102
|
},
|
|
149
|
-
children:
|
|
150
|
-
...
|
|
151
|
-
isLast:
|
|
152
|
-
key:
|
|
103
|
+
children: o.map(({ key: e, ...d }, p) => /* @__PURE__ */ b(s, {
|
|
104
|
+
...d,
|
|
105
|
+
isLast: p === o.length - 1,
|
|
106
|
+
key: e
|
|
153
107
|
}))
|
|
154
|
-
})] }),
|
|
108
|
+
})] }), I = ({ accounts: t, expenses: o, summary: e }) => /* @__PURE__ */ n(i, {
|
|
155
109
|
sx: {
|
|
156
110
|
bgcolor: "background.default",
|
|
157
111
|
pb: 24
|
|
158
112
|
},
|
|
159
113
|
children: [
|
|
160
|
-
/* @__PURE__ */ r(
|
|
114
|
+
/* @__PURE__ */ r(f, { ...e }),
|
|
161
115
|
t.rows.length > 0 && /* @__PURE__ */ r(m, { ...t }),
|
|
162
|
-
|
|
116
|
+
o.rows.length > 0 && /* @__PURE__ */ r(m, { ...o })
|
|
163
117
|
]
|
|
164
118
|
});
|
|
165
119
|
export {
|
|
166
|
-
|
|
120
|
+
I as default
|
|
167
121
|
};
|
|
168
122
|
|
|
169
123
|
//# sourceMappingURL=RemainingCashContent.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RemainingCashContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nexport interface RemainingCashRow {\n key: string\n name: string\n amount: number\n /** The row's 32px logo: an account's institution or an expense's category. */\n leading: ReactNode\n}\n\ninterface RemainingCashSectionProps {\n header: string\n /** Already grouped and ordered, including any \"Other (#)\" row. */\n rows: RemainingCashRow[]\n}\n\ninterface RemainingCashSummaryProps {\n /** Omitted when there is no upcoming payday: a \"remaining until payday\" figure has no meaning. */\n remaining?: { amount: number; caption: string }\n cashOnHand: number\n upcomingExpenses: number\n cashOnHandLabel: string\n upcomingExpensesLabel: string\n}\n\nexport interface RemainingCashContentProps {\n summary: RemainingCashSummaryProps\n accounts: RemainingCashSectionProps\n expenses: RemainingCashSectionProps\n}\n\nconst BreakdownRow = ({ label, value }: { label: string; value: string }) => (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, minHeight: 44, px: 24 }}>\n <Text sx={{ flexGrow: 1 }} variant=\"body1\">\n {label}\n </Text>\n <Text bold={true} sx={{ fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {value}\n </Text>\n </Stack>\n)\n\nconst Summary = ({\n cashOnHand,\n cashOnHandLabel,\n remaining,\n upcomingExpenses,\n upcomingExpensesLabel,\n}: RemainingCashSummaryProps) => (\n <Stack sx={{ pb: 8, pt: 24, px: 24 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 16,\n p: 16,\n }}\n >\n {remaining && (\n // One announcement (\"$2,350.00, Remaining until payday (7 days)\") instead of two loose text\n // nodes. The amount keeps the h2 look but is a paragraph: it is a value, not a heading.\n <Stack\n aria-label={`${formatSignedCurrency(remaining.amount)}, ${remaining.caption}`}\n role=\"group\"\n sx={{ alignItems: 'center', justifyContent: 'center', minHeight: 72, p: 12 }}\n >\n <Text aria-hidden={true} bold={true} component=\"p\" variant=\"h2\">\n {formatSignedCurrency(remaining.amount)}\n </Text>\n <Text aria-hidden={true} color=\"text.secondary\" variant=\"subtitle2\">\n {remaining.caption}\n </Text>\n </Stack>\n )}\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n }}\n >\n <BreakdownRow label={cashOnHandLabel} value={formatSignedCurrency(cashOnHand)} />\n <Divider />\n {/* Shown as a deduction (-$1,200.00) per Figma; the expense rows below show positive amounts. */}\n <BreakdownRow\n label={upcomingExpensesLabel}\n value={formatSignedCurrency(-upcomingExpenses)}\n />\n </Stack>\n </Stack>\n </Stack>\n)\n\n
|
|
1
|
+
{"version":3,"file":"RemainingCashContent.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatSignedCurrency } from '../../../core/utils/NumberFormatting'\nimport InsightListRow from '../../components/InsightListRow'\nimport { getLogoElevation } from '../../components/logoShadow'\n\nexport interface RemainingCashRow {\n key: string\n name: string\n amount: number\n /** The row's 32px logo: an account's institution or an expense's category. */\n leading: ReactNode\n}\n\ninterface RemainingCashSectionProps {\n header: string\n /** Already grouped and ordered, including any \"Other (#)\" row. */\n rows: RemainingCashRow[]\n}\n\ninterface RemainingCashSummaryProps {\n /** Omitted when there is no upcoming payday: a \"remaining until payday\" figure has no meaning. */\n remaining?: { amount: number; caption: string }\n cashOnHand: number\n upcomingExpenses: number\n cashOnHandLabel: string\n upcomingExpensesLabel: string\n}\n\nexport interface RemainingCashContentProps {\n summary: RemainingCashSummaryProps\n accounts: RemainingCashSectionProps\n expenses: RemainingCashSectionProps\n}\n\nconst BreakdownRow = ({ label, value }: { label: string; value: string }) => (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, minHeight: 44, px: 24 }}>\n <Text sx={{ flexGrow: 1 }} variant=\"body1\">\n {label}\n </Text>\n <Text bold={true} sx={{ fontVariantNumeric: 'tabular-nums' }} variant=\"body1\">\n {value}\n </Text>\n </Stack>\n)\n\nconst Summary = ({\n cashOnHand,\n cashOnHandLabel,\n remaining,\n upcomingExpenses,\n upcomingExpensesLabel,\n}: RemainingCashSummaryProps) => (\n <Stack sx={{ pb: 8, pt: 24, px: 24 }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: getLogoElevation,\n gap: 16,\n p: 16,\n }}\n >\n {remaining && (\n // One announcement (\"$2,350.00, Remaining until payday (7 days)\") instead of two loose text\n // nodes. The amount keeps the h2 look but is a paragraph: it is a value, not a heading.\n <Stack\n aria-label={`${formatSignedCurrency(remaining.amount)}, ${remaining.caption}`}\n role=\"group\"\n sx={{ alignItems: 'center', justifyContent: 'center', minHeight: 72, p: 12 }}\n >\n <Text aria-hidden={true} bold={true} component=\"p\" variant=\"h2\">\n {formatSignedCurrency(remaining.amount)}\n </Text>\n <Text aria-hidden={true} color=\"text.secondary\" variant=\"subtitle2\">\n {remaining.caption}\n </Text>\n </Stack>\n )}\n <Stack\n sx={{\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '8px',\n overflow: 'hidden',\n }}\n >\n <BreakdownRow label={cashOnHandLabel} value={formatSignedCurrency(cashOnHand)} />\n <Divider />\n {/* Shown as a deduction (-$1,200.00) per Figma; the expense rows below show positive amounts. */}\n <BreakdownRow\n label={upcomingExpensesLabel}\n value={formatSignedCurrency(-upcomingExpenses)}\n />\n </Stack>\n </Stack>\n </Stack>\n)\n\n// The drawer title is the h2, so section headers are h3 and each section is a real list.\nconst Section = ({ header, rows }: RemainingCashSectionProps) => (\n <Stack>\n <Box sx={{ pb: 4, pt: 16, px: 24 }}>\n <Text bold={true} component=\"h3\" variant=\"body1\">\n {header}\n </Text>\n </Box>\n <Stack component=\"ul\" sx={{ bgcolor: 'background.paper', listStyle: 'none', m: 0, p: 0 }}>\n {rows.map(({ key, ...row }, index) => (\n <InsightListRow {...row} isLast={index === rows.length - 1} key={key} />\n ))}\n </Stack>\n </Stack>\n)\n\n/** Presentational body of the Remaining Cash drawer (Figma 9936:39163, minus the drawer header). */\nconst RemainingCashContent = ({ accounts, expenses, summary }: RemainingCashContentProps) => (\n <Stack sx={{ bgcolor: 'background.default', pb: 24 }}>\n <Summary {...summary} />\n {accounts.rows.length > 0 && <Section {...accounts} />}\n {expenses.rows.length > 0 && <Section {...expenses} />}\n </Stack>\n)\n\nexport default RemainingCashContent\n"],"mappings":";;;;;;;;;AAyCA,IAAM,IAAA,CAAgB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I,CAAA,CACF,EAAA,CAAA,GAIH,IAAA,CAAwB,EAAE,UAAA,GAAU,UAAA,GAAU,SAAA,EAAA,MAClD,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,SAAS;AAAA,IAAsB,IAAI;AAAA,EAAG;AAAA,EAAnD,UAAA;AAAA,IACE,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAU,CAAA;AAAA,IACtB,EAAS,KAAK,SAAS,KAAK,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAW,CAAA;AAAA,IACpD,EAAS,KAAK,SAAS,KAAK,gBAAA,EAAC,GAAD,EAAS,GAAI,EAAW,CAAA;AAAA,EAChD"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
1
2
|
import { RemainingCashCopy } from '../../../core';
|
|
2
3
|
/** Rows shown per section before the rest fold into an "Other (#)" row (Figma shows two). */
|
|
3
4
|
export declare const ROW_LIMIT = 2;
|
|
@@ -12,5 +13,16 @@ export interface GroupedRows<T> {
|
|
|
12
13
|
export declare const groupRows: <T extends {
|
|
13
14
|
amount: number;
|
|
14
15
|
}>(rows: T[]) => GroupedRows<T>;
|
|
16
|
+
export interface FoldableRow {
|
|
17
|
+
key: string;
|
|
18
|
+
name: string;
|
|
19
|
+
amount: number;
|
|
20
|
+
leading: ReactNode;
|
|
21
|
+
}
|
|
22
|
+
/** Top rows by amount, then one "Other (#)" row with the rest's count and total. */
|
|
23
|
+
export declare const foldOtherRows: <T extends FoldableRow>(rows: T[], otherLabel: {
|
|
24
|
+
one: string;
|
|
25
|
+
multi: string;
|
|
26
|
+
}, otherLeading: ReactNode) => (T | FoldableRow)[];
|
|
15
27
|
export declare const getCaption: (copy: RemainingCashCopy, days: number) => string;
|
|
16
28
|
export declare const getOtherLabel: (templateOne: string, templateMulti: string, count: number) => string;
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { buildDynamicCopy as a, buildPluralCopy as i } from "../../../core/utils/Localization.es.js";
|
|
2
|
-
var
|
|
3
|
-
const
|
|
4
|
-
if (
|
|
5
|
-
const n =
|
|
2
|
+
var u = (r) => {
|
|
3
|
+
const t = [...r].sort((e, o) => o.amount - e.amount);
|
|
4
|
+
if (t.length <= 2) return { shown: t };
|
|
5
|
+
const n = t.slice(2);
|
|
6
6
|
return {
|
|
7
|
-
shown:
|
|
7
|
+
shown: t.slice(0, 2),
|
|
8
8
|
others: {
|
|
9
9
|
count: n.length,
|
|
10
10
|
total: n.reduce((e, o) => e + o.amount, 0)
|
|
11
11
|
}
|
|
12
12
|
};
|
|
13
|
-
},
|
|
13
|
+
}, m = (r, t, n) => {
|
|
14
|
+
const { others: e, shown: o } = u(r);
|
|
15
|
+
return e ? [...o, {
|
|
16
|
+
amount: e.total,
|
|
17
|
+
key: "other",
|
|
18
|
+
leading: n,
|
|
19
|
+
name: l(t.one, t.multi, e.count)
|
|
20
|
+
}] : o;
|
|
21
|
+
}, g = (r, t) => t === 1 ? r.remaining_until_payday_one : a(r.remaining_until_payday, String(t)), l = (r, t, n) => i(r, t, n, String(n));
|
|
14
22
|
export {
|
|
15
|
-
|
|
16
|
-
g as
|
|
17
|
-
l as
|
|
23
|
+
m as foldOtherRows,
|
|
24
|
+
g as getCaption,
|
|
25
|
+
l as getOtherLabel,
|
|
26
|
+
u as groupRows
|
|
18
27
|
};
|
|
19
28
|
|
|
20
29
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/layout.ts"],"sourcesContent":["import type { RemainingCashCopy } from '../../../core'\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\n\n/** Rows shown per section before the rest fold into an \"Other (#)\" row (Figma shows two). */\nexport const ROW_LIMIT = 2\n\nexport interface GroupedRows<T> {\n shown: T[]\n others?: { count: number; total: number }\n}\n\n/** Largest rows first (stable for ties), capped at `ROW_LIMIT`; the remainder as a count and total. */\nexport const groupRows = <T extends { amount: number }>(rows: T[]): GroupedRows<T> => {\n const sorted = [...rows].sort((a, b) => b.amount - a.amount)\n\n if (sorted.length <= ROW_LIMIT) return { shown: sorted }\n\n const rest = sorted.slice(ROW_LIMIT)\n\n return {\n shown: sorted.slice(0, ROW_LIMIT),\n others: { count: rest.length, total: rest.reduce((total, r) => total + r.amount, 0) },\n }\n}\n\nexport const getCaption = (copy: RemainingCashCopy, days: number): string => {\n if (days === 1) return copy.remaining_until_payday_one\n\n return buildDynamicCopy(copy.remaining_until_payday, String(days)) as string\n}\n\nexport const getOtherLabel = (templateOne: string, templateMulti: string, count: number): string =>\n buildPluralCopy(templateOne, templateMulti, count, String(count)) as string\n"],"mappings":";
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/RemainingCashBlock/layout.ts"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport type { RemainingCashCopy } from '../../../core'\nimport { buildDynamicCopy, buildPluralCopy } from '../../../core/utils/Localization'\n\n/** Rows shown per section before the rest fold into an \"Other (#)\" row (Figma shows two). */\nexport const ROW_LIMIT = 2\n\nexport interface GroupedRows<T> {\n shown: T[]\n others?: { count: number; total: number }\n}\n\n/** Largest rows first (stable for ties), capped at `ROW_LIMIT`; the remainder as a count and total. */\nexport const groupRows = <T extends { amount: number }>(rows: T[]): GroupedRows<T> => {\n const sorted = [...rows].sort((a, b) => b.amount - a.amount)\n\n if (sorted.length <= ROW_LIMIT) return { shown: sorted }\n\n const rest = sorted.slice(ROW_LIMIT)\n\n return {\n shown: sorted.slice(0, ROW_LIMIT),\n others: { count: rest.length, total: rest.reduce((total, r) => total + r.amount, 0) },\n }\n}\n\nexport interface FoldableRow {\n key: string\n name: string\n amount: number\n leading: ReactNode\n}\n\n/** Top rows by amount, then one \"Other (#)\" row with the rest's count and total. */\nexport const foldOtherRows = <T extends FoldableRow>(\n rows: T[],\n otherLabel: { one: string; multi: string },\n otherLeading: ReactNode,\n): (T | FoldableRow)[] => {\n const { others, shown } = groupRows(rows)\n\n if (!others) return shown\n\n return [\n ...shown,\n {\n amount: others.total,\n key: 'other',\n leading: otherLeading,\n name: getOtherLabel(otherLabel.one, otherLabel.multi, others.count),\n },\n ]\n}\n\nexport const getCaption = (copy: RemainingCashCopy, days: number): string => {\n if (days === 1) return copy.remaining_until_payday_one\n\n return buildDynamicCopy(copy.remaining_until_payday, String(days)) as string\n}\n\nexport const getOtherLabel = (templateOne: string, templateMulti: string, count: number): string =>\n buildPluralCopy(templateOne, templateMulti, count, String(count)) as string\n"],"mappings":";AAcA,IAAa,IAAA,CAA2C,MAA8B;AACpF,QAAM,IAAS,CAAC,GAAG,CAAI,EAAE,KAAA,CAAM,GAAG,MAAM,EAAE,SAAS,EAAE,MAAM;AAE3D,MAAI,EAAO,UAAA,EAAqB,QAAO,EAAE,OAAO,EAAO;AAEvD,QAAM,IAAO,EAAO,MAAA,CAAe;AAEnC,SAAO;AAAA,IACL,OAAO,EAAO,MAAM,GAAA,CAAY;AAAA,IAChC,QAAQ;AAAA,MAAE,OAAO,EAAK;AAAA,MAAQ,OAAO,EAAK,OAAA,CAAQ,GAAO,MAAM,IAAQ,EAAE,QAAQ,CAAC;AAAA,IAAE;AAAA,EACtF;AACF,GAUa,IAAA,CACX,GACA,GACA,MACwB;AACxB,QAAM,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAU,CAAI;AAExC,SAAK,IAEE,CACL,GAAG,GACH;AAAA,IACE,QAAQ,EAAO;AAAA,IACf,KAAK;AAAA,IACL,SAAS;AAAA,IACT,MAAM,EAAc,EAAW,KAAK,EAAW,OAAO,EAAO,KAAK;AAAA,EACpE,CACF,IAVoB;AAWtB,GAEa,IAAA,CAAc,GAAyB,MAC9C,MAAS,IAAU,EAAK,6BAErB,EAAiB,EAAK,wBAAwB,OAAO,CAAI,CAAC,GAGtD,IAAA,CAAiB,GAAqB,GAAuB,MACxE,EAAgB,GAAa,GAAe,GAAO,OAAO,CAAK,CAAC"}
|
|
@@ -4,9 +4,10 @@ import { TransactionStatus as U } from "../../../core/types/Transaction.es.js";
|
|
|
4
4
|
import { fromUnixUTC as A } from "../../../core/utils/DateUtil.es.js";
|
|
5
5
|
import { getCategoryColor as P } from "../../../core/utils/CategoryUtil.es.js";
|
|
6
6
|
import { buildDataSeries as M } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
7
|
+
import { asGuidList as N, asNonEmptyText as b, asNumber as u } from "../../blocks/slotReaders.es.js";
|
|
7
8
|
import { getLayoutConfig as I } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
|
|
8
9
|
import w from "../../components/LogoMark.es.js";
|
|
9
|
-
import { buildProjectedBillTransaction as H, calendarDateOf as Y
|
|
10
|
+
import { buildProjectedBillTransaction as H, calendarDateOf as Y } from "./utils.es.js";
|
|
10
11
|
import { Icon as F } from "@mxenabled/mx-icons";
|
|
11
12
|
import { jsx as c } from "react/jsx-runtime";
|
|
12
13
|
import { endOfMonth as C, fromUnixTime as x, isValid as L, parseISO as p, startOfMonth as B } from "date-fns";
|
|
@@ -46,9 +47,9 @@ var i = {
|
|
|
46
47
|
return {
|
|
47
48
|
transaction_guids: N(e.transaction_guids),
|
|
48
49
|
date: Y(e.due_date),
|
|
49
|
-
amount:
|
|
50
|
+
amount: u(e.amount),
|
|
50
51
|
category_guid: b(e.category_guid),
|
|
51
|
-
average_amount:
|
|
52
|
+
average_amount: u(e.average_amount),
|
|
52
53
|
merchant_name: b(e.merchant_name)
|
|
53
54
|
};
|
|
54
55
|
}, _ = (t) => {
|
|
@@ -59,13 +60,13 @@ var i = {
|
|
|
59
60
|
return {
|
|
60
61
|
account_guids: N(e.account_guids),
|
|
61
62
|
data_series: _(e.data_series),
|
|
62
|
-
average_amount:
|
|
63
|
+
average_amount: u(e.average_amount)
|
|
63
64
|
};
|
|
64
65
|
}, R = ["income", "other"], j = (t) => {
|
|
65
66
|
const e = t?.drilldown_data ?? {}, a = t?.instance_slot?.data?.legends?.map(({ label: o }) => o);
|
|
66
67
|
return {
|
|
67
68
|
data_series: _(e.data_series),
|
|
68
|
-
average_amount:
|
|
69
|
+
average_amount: u(e.average_amount),
|
|
69
70
|
income_transaction_guids: N(e.income_transaction_guids),
|
|
70
71
|
sub_tab_labels: a?.length === R.length ? a : void 0
|
|
71
72
|
};
|
|
@@ -118,13 +119,13 @@ var i = {
|
|
|
118
119
|
...G(o.account_guids)
|
|
119
120
|
};
|
|
120
121
|
}, et = (t) => typeof t == "number" ? x(t) : p(t ?? ""), at = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: o, instanceSlotData: r }) => {
|
|
121
|
-
const s = e[a], { start: n, end: g } = S(s?.date), l = et(t.created_at),
|
|
122
|
+
const s = e[a], { start: n, end: g } = S(s?.date), l = et(t.created_at), m = r.account_guids, O = {
|
|
122
123
|
start: n,
|
|
123
124
|
end: o && L(l) && l < g ? l : g
|
|
124
125
|
};
|
|
125
|
-
return
|
|
126
|
+
return m?.length ? {
|
|
126
127
|
dateRange: O,
|
|
127
|
-
accounts:
|
|
128
|
+
accounts: m
|
|
128
129
|
} : {
|
|
129
130
|
dateRange: O,
|
|
130
131
|
accounts: [],
|
|
@@ -147,9 +148,9 @@ var i = {
|
|
|
147
148
|
const r = e[a];
|
|
148
149
|
return f(o === 1 ? r?.comparisonGuids : r?.mainGuids, r?.date, t.account_guids);
|
|
149
150
|
}, rt = ({ beat: t, dataSeries: e, subIndex: a }) => f(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), st = (t) => {
|
|
150
|
-
const { dataSeries: e, selectedIndex: a, subIndex: o, instanceSlotData: r } = t, s = e[a], n = new Set(r.income_transaction_guids), g = R[o] === "income", l = r.sub_tab_labels ? s?.aggregated_guids?.filter((
|
|
151
|
+
const { dataSeries: e, selectedIndex: a, subIndex: o, instanceSlotData: r } = t, s = e[a], n = new Set(r.income_transaction_guids), g = R[o] === "income", l = r.sub_tab_labels ? s?.aggregated_guids?.filter((m) => n.has(m) === g) : s?.aggregated_guids;
|
|
151
152
|
return f(l, s?.date);
|
|
152
|
-
},
|
|
153
|
+
}, bt = {
|
|
153
154
|
[i.TRANSACTION]: {
|
|
154
155
|
top: "singleBar",
|
|
155
156
|
scope: "store",
|
|
@@ -279,7 +280,7 @@ var i = {
|
|
|
279
280
|
filterMode: "store",
|
|
280
281
|
colors: (t) => [t.palette.primary.main]
|
|
281
282
|
}
|
|
282
|
-
},
|
|
283
|
+
}, Tt = {
|
|
283
284
|
top: "singleBar",
|
|
284
285
|
filterStrategy: v,
|
|
285
286
|
scope: "store",
|
|
@@ -288,8 +289,8 @@ var i = {
|
|
|
288
289
|
};
|
|
289
290
|
export {
|
|
290
291
|
i as DRILLDOWN_VARIANTS,
|
|
291
|
-
|
|
292
|
-
|
|
292
|
+
Tt as FALLBACK,
|
|
293
|
+
bt as layout,
|
|
293
294
|
K as resolveDebtToIncomeSlotData,
|
|
294
295
|
j as resolveDepositSummarySlotData,
|
|
295
296
|
k as resolveSavingsContributionsSlotData,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Theme } from '@mui/material/styles'\nimport { endOfMonth, fromUnixTime, isValid, parseISO, startOfMonth } from 'date-fns'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport {\n type Beat,\n type DataSeries,\n type DrilldownData,\n type InsightsFeedCopy,\n type Subtitle,\n type Transaction,\n TransactionStatus,\n buildDynamicCopy,\n} from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport type {\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport LogoMark from '../../components/LogoMark'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { Icon } from '@mxenabled/mx-icons'\nimport {\n buildDataSeries,\n type ChartDataSeriesItem,\n} from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { getLayoutConfig as getDoubleBarLayoutConfig } from '../../blocks/ChartBlocks/DoubleBarChartBlock/layout'\nimport type { TipSectionProps } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport {\n type BeatTransactionsResolver,\n buildProjectedBillTransaction,\n calendarDateOf,\n type DrillDownSlotData,\n finiteNumberOf,\n guidListOf,\n nonEmptyStringOf,\n type SlotDataResolver,\n} from './utils'\n\nexport interface DrillDownHeader {\n heading?: string\n subHeadingText?: string\n icon?: ReactNode\n}\n\nexport interface DrillDownHeaderContext {\n title?: string\n subHeader?: Subtitle\n categoryName: string\n selectedDate?: string | Date\n}\n\nexport const DRILLDOWN_VARIANTS = {\n TRANSACTION: 'not_standard_amount',\n CATEGORY_SPEND: 'category_spend',\n MONTHLY_SPEND: 'monthly_spend_comparison',\n ACCOUNT_BALANCE: 'account_balance',\n UPCOMING_BILL: 'upcoming_bill',\n SPEND_TO_INCOME: 'monthly_spend_to_income',\n SAVINGS_TO_INCOME: 'monthly_savings_to_income',\n DEBT_TO_INCOME: 'debt_to_income',\n COST_OF_LIVING: 'cost_living_to_income',\n NON_ESSENTIAL_CATEGORY: 'non_essential_category_summary',\n DEPOSIT_SUMMARY: 'monthly_deposit_summary',\n LOW_BALANCE: 'low_balance',\n SUBSCRIPTION_AGGREGATE: 'monthly_subscription_aggregate',\n} as const\n\nexport type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS]\n\n/** One flattened data_series row a filterStrategy indexes; fields are optional because the backend keys rows dynamically. */\n\n// Resolves the top-chart palette from the theme (and the beat's category, when relevant).\nexport type ColorKind = (theme: Theme, categoryGuid?: string) => string[]\n\n// Resolves the dynamic drawer header (heading/sub-heading/icon JSX) from the selection context.\nexport type HeaderKind = (ctx: DrillDownHeaderContext) => DrillDownHeader\n\n/**\n * Everything a filterStrategy needs to turn the currently-selected bar/sub-tab into a\n * TransactionFilter. Data-only so strategies stay pure and testable.\n */\nexport interface FilterContext {\n beat: Beat\n beatTransactions: Transaction[]\n dataSeries: ChartDataSeriesItem[]\n // The double-bar drawer's month columns (main / comparison per month, with their guids); empty\n // for every other top kind.\n comparisonBars: DataSet[]\n selectedIndex: number\n subIndex: number\n isLastTab: boolean\n instanceSlotData: DrillDownSlotData\n spendCategoryGuids: string[]\n displayedDateRange: { start: Date; end: Date }\n}\n\n// Resolves the current selection into a TransactionFilter. Carried on each config row so behavior\n// lives next to the variant it belongs to (no separate strategy registry to chase).\nexport type FilterStrategy = (ctx: FilterContext) => TransactionFilter\n\n/** Sub-tabs under the chart (Income / Other Deposits); `subIndex` in `FilterContext` picks one. */\nexport type SubTabsKind = (ctx: {\n instanceSlotData: DrillDownSlotData\n copy: InsightsFeedCopy\n}) => string[]\n\nexport interface DrillDownVariantConfig {\n // `list`: no chart or tabs above the transaction list (an account's transactions for a window).\n // `monthTabs`: one tab per data_series month and no chart (a month's aggregated transactions).\n top: 'singleBar' | 'upcomingBill' | 'doubleBar' | 'tabsOnly' | 'monthTabs' | 'list'\n filterStrategy: FilterStrategy\n colors: ColorKind\n header?: HeaderKind\n // A second tab row under the chart that `subIndex` picks from (Income / Other Deposits).\n subTabs?: SubTabsKind\n // Where the drawer reads its facts. Absent: the bar chart's `instance_slot.data`.\n slotData?: SlotDataResolver\n // Builds the drawer's transactions from the beat's own. Absent: the beat's own, as they are.\n beatTransactions?: BeatTransactionsResolver\n // On open, returns the guids of the drawer's transactions to fetch by guid when the store lacks\n // them (older than its 90-day window), as pulse's BeatShell loads a legacy beat's: each drawer\n // reads them from wherever its beat keeps them (the beat, or the CTA that opened the drawer).\n // Absent: nothing is fetched.\n fetchMissingTransactions?: (beat: Beat, ctaDrilldownData?: DrilldownData) => unknown\n // undefined when the facts the tip needs are missing: the drawer shows no tip.\n tipSection?: (\n setCloseTipSection: (flag: boolean) => void,\n copy: InsightsFeedCopy,\n merchantName?: string,\n slotData?: DrillDownSlotData,\n ) => TipSectionProps | undefined\n scope: 'store' | 'beat'\n filterMode: 'store' | 'local'\n // Double bar: accessible names for the series tabs ([0] main, [1] comparison), as legacy pulse.\n subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[]\n // The list has no Transactions heading above it; the CSV export stays.\n hideListHeader?: boolean\n // The tip sits between the chart and the sub-tabs rather than under them.\n tipAboveSubTabs?: boolean\n // The average (Trend) legend's number format. Absent: cents ('0,0.00').\n averageFormat?: string\n}\nconst categoryColor = (theme: Theme, categoryGuid?: string): string =>\n (categoryGuid && getCategoryColor(categoryGuid, theme)) || theme.palette.primary.main\n\nconst toLocalDate = (date: string | number | Date | undefined) =>\n typeof date === 'string' ? parseISO(date) : new Date(date ?? NaN)\n\nconst monthRange = (date: string | number | Date | undefined) => ({\n start: startOfMonth(toLocalDate(date)),\n end: endOfMonth(toLocalDate(date)),\n})\n\n// Scopes a filter to the beat's accounts when the beat carries account_guids; otherwise leaves\n// accounts unset so the store default (all accounts) applies.\nconst accountScope = (accountGuids?: string[]): Pick<TransactionFilter, 'accounts'> =>\n accountGuids?.length ? { accounts: accountGuids } : {}\n\n// Low Account Balance — `drilldown_data` names one account and a window (epoch seconds at UTC\n// midnight, to_date exclusive); only settled, visible rows, a split purchase as its parts, as the\n// pulse drawer listed them. Fails closed: a drawer that cannot name its rows shows none.\nconst accountWindowStrategy: FilterStrategy = ({ beat }) => {\n const { account_guid, from_date, to_date } = beat.insights_payload?.drilldown_data ?? {}\n if (\n typeof account_guid !== 'string' ||\n typeof from_date !== 'number' ||\n typeof to_date !== 'number' ||\n !Number.isFinite(from_date) ||\n !Number.isFinite(to_date) ||\n to_date <= from_date\n ) {\n return { accounts: [], custom: () => false }\n }\n\n return {\n accounts: [account_guid],\n custom: (trn) => !trn.is_hidden && trn.feed_status !== TransactionStatus.PENDING,\n showSplits: true,\n dateRange: { start: fromUnixUTC(from_date), end: fromUnixUTC(to_date - 1) },\n }\n}\n\n// Upcoming Bill: each `drilldown_data` fact is narrowed (utils.ts) and a missing or mistyped one is\n// dropped. A bad due date, amount or guid list draws no chart and lists no rows.\n\nexport const resolveUpcomingBillSlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n\n return {\n transaction_guids: guidListOf(data.transaction_guids),\n date: calendarDateOf(data.due_date),\n amount: finiteNumberOf(data.amount),\n category_guid: nonEmptyStringOf(data.category_guid),\n average_amount: finiteNumberOf(data.average_amount),\n merchant_name: nonEmptyStringOf(data.merchant_name),\n }\n}\n\n// Savings Account Balances Summary: the drawer's bars, trend and accounts come from the beat's\n// drilldown_data alone (tupac SavingsAccountBalancesSummary::Factory.drilldown_data), each narrowed:\n// a missing or malformed fact is dropped, so the drawer draws no bars and lists no rows.\nconst dataSeriesOf = (value: unknown): DataSeries | undefined => {\n const series = value as DataSeries | undefined\n return Array.isArray(series?.names) && Array.isArray(series?.data) ? series : undefined\n}\n\nexport const resolveSavingsContributionsSlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n\n return {\n account_guids: guidListOf(data.account_guids),\n data_series: dataSeriesOf(data.data_series),\n average_amount: finiteNumberOf(data.average_amount),\n }\n}\n\n// Monthly Deposit Summary's sub-tabs, in the donut legend's order.\nconst DEPOSIT_SUB_TABS = ['income', 'other'] as const\n\n// Monthly Deposit Summary: tupac's drilldown_data carries the six months (data_series rows with\n// aggregated_guids), the income guids and the trend. The donut's legend rows are the card's, so they\n// only name the sub-tabs; with no `legends`, the chart legend falls back to Monthly Amount / Trend.\nexport const resolveDepositSummarySlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n const donutLegends = (payload?.instance_slot?.data as InsightsInstanceSlotData | undefined)\n ?.legends\n const subTabLabels = donutLegends?.map(({ label }) => label)\n\n return {\n data_series: dataSeriesOf(data.data_series),\n average_amount: finiteNumberOf(data.average_amount),\n income_transaction_guids: guidListOf(data.income_transaction_guids),\n sub_tab_labels: subTabLabels?.length === DEPOSIT_SUB_TABS.length ? subTabLabels : undefined,\n }\n}\n\n// Monthly Debt to Income Comparison: the 6 months and the Debt / Income legend labels come from the\n// drilldown_data of the CTA that opened the drawer (ditto primary_cta_drilldown_data), never the card's\n// slot or the beat. A malformed series, or labels that are not two non-blank strings, yield nothing,\n// so the drawer draws no bars and lists no rows.\nconst DEBT_TO_INCOME_SERIES_COUNT = 2\n\nexport const resolveDebtToIncomeSlotData: SlotDataResolver = (_payload, ctaDrilldownData) => {\n const data = ctaDrilldownData ?? {}\n const dataSeries = dataSeriesOf(data.series)\n const labels = Array.isArray(data.labels) ? data.labels.map(nonEmptyStringOf) : []\n if (\n !dataSeries ||\n labels.length !== DEBT_TO_INCOME_SERIES_COUNT ||\n !labels.every((label): label is string => !!label)\n ) {\n return {}\n }\n\n // The legend's amounts are the selected month's, which the drawer fills from the bars.\n return { data_series: dataSeries, legends: labels.map((label) => ({ label, value: 0 })) }\n}\n\n// Every month's debt and income guids from the opening CTA, so the drawer fetches the ones older\n// than the store's window.\nconst debtToIncomeGuidsOf = (_beat: Beat, ctaDrilldownData?: DrilldownData): string[] =>\n buildDataSeries(dataSeriesOf(ctaDrilldownData?.series)).flatMap(\n (row) => row.aggregated_guids ?? [],\n )\n\n// The drawer's tip, as Figma words it: the bold tip title and the bold limit (\"less than 30%\") from\n// the copy service. No hard-coded English: no tip until the copy service carries both strings.\nconst debtToIncomeTipSection: DrillDownVariantConfig['tipSection'] = (setCloseTipSection, copy) => {\n const message = copy.transaction_history_block?.monthly_debt_to_income_tip_message\n const limit = copy.transaction_history_block?.monthly_debt_to_income_tip_limit\n if (!message || !limit) return undefined\n\n return {\n message: buildDynamicCopy(\n message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{limit}</strong>,\n ) as ReactNode,\n onDismiss: () => setCloseTipSection(true),\n }\n}\n\n// Every month's deposit guids, so the drawer fetches the ones older than the store's window.\nconst depositGuidsOf = (beat: Beat): string[] =>\n buildDataSeries(dataSeriesOf(beat.insights_payload?.drilldown_data?.data_series)).flatMap(\n (row) => row.aggregated_guids ?? [],\n )\n\n// Upcoming Bill: the paid bills plus the projected bill (due date, amount) appended last, so the\n// bars and the projected tab's \"Projected amount\" row read the one list.\nexport const resolveUpcomingBillTransactions: BeatTransactionsResolver = (\n transactions,\n slotData,\n) => {\n const projected = buildProjectedBillTransaction(transactions, slotData)\n\n return projected ? [...transactions, projected] : transactions\n}\n\nconst upcomingBillTipSection: DrillDownVariantConfig['tipSection'] = (\n setCloseTipSection,\n copy,\n _merchantName,\n slotData,\n) => {\n const merchantName = slotData?.merchant_name\n const dueDate = slotData?.date\n if (!merchantName || !dueDate) return undefined\n\n // No hard-coded English: no tip until the copy service carries the message.\n const message = copy.transaction_history_block?.upcoming_bill_tip_message\n if (!message) return undefined\n\n return {\n message: buildDynamicCopy(\n message,\n <strong>{copy.general.tip_section_title}</strong>,\n merchantName,\n formatDate(parseISO(dueDate), DATE_FORMATS_INTL.FULL_MONTH_DAY),\n ) as ReactNode,\n onDismiss: () => setCloseTipSection(true),\n }\n}\n\n// ── Single-bar filter strategies (this MR) ────────────────────────────────────────────────────\n\n// BillAmountNotStandard / UpcomingBill — the series carries a transaction (TRN) guid; match a single\n// transaction by guid within its month.\nconst transactionGuidStrategy: FilterStrategy = ({\n beatTransactions,\n dataSeries,\n selectedIndex,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const seriesGuid = seriesItem?.guid\n const hasBeenSplit = beatTransactions.find((trn) => trn.guid === seriesGuid)?.has_been_split\n\n return {\n custom: (trn) => trn.guid === seriesGuid,\n dateRange: monthRange(seriesItem?.date),\n showSplits: !hasBeenSplit,\n }\n}\n\n// CategorySpendingV2 — match transactions in the beat's category (or whose top-level category is that\n// guid) within the month.\nconst categoryStrategy: FilterStrategy = ({ dataSeries, selectedIndex, instanceSlotData }) => {\n const seriesItem = dataSeries[selectedIndex]\n const categoryGuid = instanceSlotData.category_guid ?? seriesItem?.guid\n\n return {\n custom: (trn) =>\n trn.category_guid === categoryGuid || trn.top_level_category_guid === categoryGuid,\n dateRange: monthRange(seriesItem?.date),\n }\n}\n\n// MonthlySpendComparisonV2 — no per-bar guid; show all spending-category transactions\n// (income/transfers/investments excluded via spendCategoryGuids) within the month.\nconst spendCategoriesStrategy: FilterStrategy = ({\n dataSeries,\n selectedIndex,\n spendCategoryGuids,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n\n return {\n custom: (trn) =>\n !!trn.top_level_category_guid && spendCategoryGuids.includes(trn.top_level_category_guid),\n dateRange: monthRange(seriesItem?.date),\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// The beat's creation: tupac sends epoch seconds on the envelope and an ISO string on the wrapper.\nconst toCreatedAt = (createdAt: Beat['created_at']) =>\n typeof createdAt === 'number' ? fromUnixTime(createdAt) : parseISO(createdAt ?? '')\n\n// Savings Account Balances Summary: the beat's savings accounts within the month (the latest month\n// ends at the beat's creation). Fails closed: no drilldown_data accounts, no rows.\nconst accountDateStrategy: FilterStrategy = ({\n beat,\n dataSeries,\n selectedIndex,\n isLastTab,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const { start, end } = monthRange(seriesItem?.date)\n const createdAt = toCreatedAt(beat.created_at)\n const accountGuids = instanceSlotData.account_guids\n const dateRange = {\n start,\n end: isLastTab && isValid(createdAt) && createdAt < end ? createdAt : end,\n }\n\n if (!accountGuids?.length) return { dateRange, accounts: [], custom: () => false }\n\n return { dateRange, accounts: accountGuids }\n}\n\n// A row's stored guids within the row's month, scoped to the beat's accounts. parseISO reads the\n// 'yyyy-MM-dd' date as a local calendar day, so the month never shifts with the viewer's time zone.\n// Fails closed: a missing row, guid list or date matches nothing, never the store's displayed range.\nconst guidsWithinMonth = (\n guids: string[] | undefined,\n date: string | undefined,\n accountGuids?: string[],\n): TransactionFilter => {\n const guidSet = new Set(guids)\n const month = parseISO(date ?? '')\n if (!guidSet.size || !isValid(month)) return { accounts: [], custom: () => false }\n\n return {\n custom: (trn) => guidSet.has(trn.guid),\n dateRange: { start: startOfMonth(month), end: endOfMonth(month) },\n ...accountScope(accountGuids),\n }\n}\n\n// Monthly Subscription Aggregate — one data_series row per month, each naming its own\n// aggregated_guids; the selected month tab lists exactly those.\nconst monthlyAggregatedGuidsStrategy: FilterStrategy = ({ beat, dataSeries, selectedIndex }) =>\n guidsWithinMonth(\n dataSeries[selectedIndex]?.aggregated_guids,\n dataSeries[selectedIndex]?.date,\n beat.account_guids,\n )\n\n// ── Double-bar strategies ──────────────────────────────────────────────────────────────────────\n\n// Monthly Spend to Income Comparison — the selected month's main (Spend, sub-tab 0) or comparison\n// (Income, sub-tab 1) bar guids. The V2 payload carries no account_guids on instance_slot.data.\nconst comparisonGuidsStrategy: FilterStrategy = ({\n beat,\n comparisonBars,\n selectedIndex,\n subIndex,\n}) => {\n const bar = comparisonBars[selectedIndex]\n\n return guidsWithinMonth(\n subIndex === 1 ? bar?.comparisonGuids : bar?.mainGuids,\n bar?.date,\n beat.account_guids,\n )\n}\n\n// ── Tabs-only strategies ───────────────────────────────────────────────────────────────────────\n\n// Monthly Non-Essential Category Summary — the series is the two sides of one month (non-essential /\n// essential), not a time series; the selected sub-tab picks the row.\nconst aggregatedGuidsStrategy: FilterStrategy = ({ beat, dataSeries, subIndex }) =>\n guidsWithinMonth(\n dataSeries[subIndex]?.aggregated_guids,\n dataSeries[subIndex]?.date,\n beat.account_guids,\n )\n\n// Monthly Deposit Summary: the selected month's guids, split into the Income / Other Deposits sub-tab.\n// Not scoped to beat.account_guids: those are the beat month's accounts only, and an older month's\n// deposits can sit in other accounts; the row's aggregated_guids are already exact.\nconst depositSummaryStrategy: FilterStrategy = (ctx) => {\n const { dataSeries, selectedIndex, subIndex, instanceSlotData } = ctx\n const month = dataSeries[selectedIndex]\n const income = new Set(instanceSlotData.income_transaction_guids)\n const isIncome = DEPOSIT_SUB_TABS[subIndex] === 'income'\n const guids = instanceSlotData.sub_tab_labels\n ? month?.aggregated_guids?.filter((guid) => income.has(guid) === isIncome)\n : month?.aggregated_guids\n\n return guidsWithinMonth(guids, month?.date)\n}\n\nexport const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>> = {\n [DRILLDOWN_VARIANTS.TRANSACTION]: {\n top: 'singleBar',\n scope: 'store',\n filterMode: 'store',\n filterStrategy: transactionGuidStrategy,\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n const { title, subHeader } = ctx\n return {\n heading: title,\n subHeadingText: subHeader?.text || undefined,\n icon: (\n <LogoMark\n logo={{\n ...subHeader?.logo,\n merchant_name: subHeader?.text ?? subHeader?.logo?.merchant_name,\n }}\n size={16}\n />\n ),\n }\n },\n tipSection: (setCloseTipSection, copy, merchantName = '') => {\n return {\n message: buildDynamicCopy(\n copy.general.tip_section_message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{merchantName}</strong>,\n ),\n onDismiss: () => setCloseTipSection(true),\n } as TipSectionProps\n },\n },\n [DRILLDOWN_VARIANTS.CATEGORY_SPEND]: {\n top: 'singleBar',\n // As the card's Trend (Figma \"$x\"): whole dollars.\n averageFormat: '0,0',\n filterStrategy: categoryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n return {\n heading: ctx.categoryName,\n subHeadingText: ctx.selectedDate\n ? formatDate(toLocalDate(ctx.selectedDate), DATE_FORMATS_INTL.MONTH_LONG) || ''\n : '',\n // Figma: the month's calendar icon in primary.main.\n icon: <Icon color=\"primary\" name=\"calendar_month\" size={16} />,\n }\n },\n },\n [DRILLDOWN_VARIANTS.MONTHLY_SPEND]: {\n top: 'singleBar',\n filterStrategy: spendCategoriesStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.chart.chart2 ?? theme.palette.primary.main],\n },\n [DRILLDOWN_VARIANTS.ACCOUNT_BALANCE]: {\n top: 'singleBar',\n filterStrategy: accountDateStrategy,\n slotData: resolveSavingsContributionsSlotData,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n },\n // Upcoming Bill: one bar per paid bill plus the projected bill, all from `drilldown_data`; a bar's\n // tab lists that bill alone (filtered locally, as legacy pulse does).\n [DRILLDOWN_VARIANTS.UPCOMING_BILL]: {\n top: 'upcomingBill',\n filterStrategy: transactionGuidStrategy,\n scope: 'beat',\n filterMode: 'local',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n slotData: resolveUpcomingBillSlotData,\n beatTransactions: resolveUpcomingBillTransactions,\n fetchMissingTransactions: (beat) => beat.insights_payload?.drilldown_data?.transaction_guids,\n tipSection: upcomingBillTipSection,\n },\n\n // Monthly Deposit Summary: six months of deposits from drilldown_data, then Income / Other Deposits\n // tabs named by the donut's legend rows; without both rows, no sub-tabs.\n [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY]: {\n top: 'singleBar',\n filterStrategy: depositSummaryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n slotData: resolveDepositSummarySlotData,\n fetchMissingTransactions: depositGuidsOf,\n subTabs: ({ instanceSlotData }) => instanceSlotData.sub_tab_labels ?? [],\n },\n\n // Low Account Balance's \"Transactions\" link: the account's transactions for the alert's window.\n [DRILLDOWN_VARIANTS.LOW_BALANCE]: {\n top: 'list',\n filterStrategy: accountWindowStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n // Figma 438:27640 lists the rows straight under the drawer header.\n hideListHeader: true,\n },\n\n // Monthly Subscription Aggregate's \"View Transactions\": one tab per month, no chart, each month\n // listing its own aggregated_guids.\n [DRILLDOWN_VARIANTS.SUBSCRIPTION_AGGREGATE]: {\n top: 'monthTabs',\n filterStrategy: monthlyAggregatedGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n\n // ── Double-bar comparison beats (month tabs + main / comparison sub-tabs) ────────────────────\n // Monthly Spend to Income Comparison: Spend vs Income per month, in the card block's palette.\n [DRILLDOWN_VARIANTS.SPEND_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'spend_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [copy.general.spend_transactions, copy.general.income_transactions],\n },\n // Cost of Living to Income: one living-cost category (Housing, Groceries, ...) vs Income per month.\n // The cost bar takes the beat category's colour and Income the legacy chart4, as the pulse drawer.\n [DRILLDOWN_VARIANTS.COST_OF_LIVING]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [\n categoryColor(theme, categoryGuid),\n theme.palette.chart.chart4 ?? theme.palette.primary.main,\n ],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n },\n // Monthly Debt to Income Comparison: 6 months of Debt vs Income from the opening CTA's\n // drilldown_data, in the card block's palette so both series keep their card colours, plus the tip.\n [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'debt_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n slotData: resolveDebtToIncomeSlotData,\n fetchMissingTransactions: debtToIncomeGuidsOf,\n tipSection: debtToIncomeTipSection,\n // Figma 1117:8599: the tip above the Debt / Income tabs, and no Transactions heading.\n tipAboveSubTabs: true,\n hideListHeader: true,\n },\n // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n\n // Monthly Non-Essential Category Summary (tabs only): one side tab per series row, labelled by the\n // row's pre-localized label; a row without one gets no tab.\n [DRILLDOWN_VARIANTS.NON_ESSENTIAL_CATEGORY]: {\n top: 'tabsOnly',\n filterStrategy: aggregatedGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n}\n\n// Fallback for a missing/typo'd backend variant: a single-bar, store-scoped drawer filtered by the\n// beat's transaction guid and colored by category, so the drawer still renders instead of crashing.\nexport const FALLBACK: DrillDownVariantConfig = {\n top: 'singleBar',\n filterStrategy: transactionGuidStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n}\n"],"mappings":";;;;;;;;;;;;AAqDA,IAAa,IAAqB;AAAA,EAChC,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,wBAAwB;AAAA,EACxB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,wBAAwB;AAC1B,GA6EM,IAAA,CAAiB,GAAc,MAClC,KAAgB,EAAiB,GAAc,CAAK,KAAM,EAAM,QAAQ,QAAQ,MAE7E,IAAA,CAAe,MACnB,OAAO,KAAS,WAAW,EAAS,CAAI,IAAI,IAAI,KAAK,KAAQ,GAAG,GAE5D,IAAA,CAAc,OAA8C;AAAA,EAChE,OAAO,EAAa,EAAY,CAAI,CAAC;AAAA,EACrC,KAAK,EAAW,EAAY,CAAI,CAAC;AACnC,IAIM,IAAA,CAAgB,MACpB,GAAc,SAAS,EAAE,UAAU,EAAa,IAAI,CAAC,GAKjD,IAAA,CAAyC,EAAE,MAAA,EAAA,MAAW;AAC1D,QAAM,EAAE,cAAA,GAAc,WAAA,GAAW,SAAA,EAAA,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AChG;AAAA,EAGC,CAAA,EAAmB,cAAA,GAAiB;AAAA,IACnC,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,GAAc,MAA0B,CAC/C,EAAc,GAAO,CAAY,GACjC,EAAM,QAAQ,MAAM,UAAU,EAAM,QAAQ,QAAQ,IACtD;AAAA,IACA,kBAAA,CAAmB,MAAS,CAAC,QAAW,EAAK,QAAQ,mBAAmB;AAAA,EAC1E;AAAA,EAGC,CAAA,EAAmB,cAAA,GAAiB;AAAA,IACnC,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,MAAiB,EAAyB,GAAO,gBAAgB,GAAG,SAAS,CAAC;AAAA,IACvF,kBAAA,CAAmB,MAAS,CAAC,QAAW,EAAK,QAAQ,mBAAmB;AAAA,IACxE,UAAU;AAAA,IACV,0BAA0B;AAAA,IAC1B,YAAY;AAAA,IAEZ,iBAAiB;AAAA,IACjB,gBAAgB;AAAA,EAClB;AAAA,EAMC,CAAA,EAAmB,sBAAA,GAAyB;AAAA,IAC3C,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,MAAiB,CAAC,EAAM,QAAQ,QAAQ,IAAI;AAAA,EACvD;AACF,GAIa,KAAmC;AAAA,EAC9C,KAAK;AAAA,EACL,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAA,CAAS,GAAc,MAA0B,CAAC,EAAc,GAAO,CAAY,CAAC;AACtF"}
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Theme } from '@mui/material/styles'\nimport { endOfMonth, fromUnixTime, isValid, parseISO, startOfMonth } from 'date-fns'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport {\n type Beat,\n type DataSeries,\n type DrilldownData,\n type InsightsFeedCopy,\n type Subtitle,\n type Transaction,\n TransactionStatus,\n buildDynamicCopy,\n} from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport type {\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport LogoMark from '../../components/LogoMark'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { Icon } from '@mxenabled/mx-icons'\nimport {\n buildDataSeries,\n type ChartDataSeriesItem,\n} from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { getLayoutConfig as getDoubleBarLayoutConfig } from '../../blocks/ChartBlocks/DoubleBarChartBlock/layout'\nimport { asGuidList, asNonEmptyText, asNumber } from '../../blocks/slotReaders'\nimport type { TipSectionProps } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport {\n type BeatTransactionsResolver,\n buildProjectedBillTransaction,\n calendarDateOf,\n type DrillDownSlotData,\n type SlotDataResolver,\n} from './utils'\n\nexport interface DrillDownHeader {\n heading?: string\n subHeadingText?: string\n icon?: ReactNode\n}\n\nexport interface DrillDownHeaderContext {\n title?: string\n subHeader?: Subtitle\n categoryName: string\n selectedDate?: string | Date\n}\n\nexport const DRILLDOWN_VARIANTS = {\n TRANSACTION: 'not_standard_amount',\n CATEGORY_SPEND: 'category_spend',\n MONTHLY_SPEND: 'monthly_spend_comparison',\n ACCOUNT_BALANCE: 'account_balance',\n UPCOMING_BILL: 'upcoming_bill',\n SPEND_TO_INCOME: 'monthly_spend_to_income',\n SAVINGS_TO_INCOME: 'monthly_savings_to_income',\n DEBT_TO_INCOME: 'debt_to_income',\n COST_OF_LIVING: 'cost_living_to_income',\n NON_ESSENTIAL_CATEGORY: 'non_essential_category_summary',\n DEPOSIT_SUMMARY: 'monthly_deposit_summary',\n LOW_BALANCE: 'low_balance',\n SUBSCRIPTION_AGGREGATE: 'monthly_subscription_aggregate',\n} as const\n\nexport type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS]\n\n/** One flattened data_series row a filterStrategy indexes; fields are optional because the backend keys rows dynamically. */\n\n// Resolves the top-chart palette from the theme (and the beat's category, when relevant).\nexport type ColorKind = (theme: Theme, categoryGuid?: string) => string[]\n\n// Resolves the dynamic drawer header (heading/sub-heading/icon JSX) from the selection context.\nexport type HeaderKind = (ctx: DrillDownHeaderContext) => DrillDownHeader\n\n/**\n * Everything a filterStrategy needs to turn the currently-selected bar/sub-tab into a\n * TransactionFilter. Data-only so strategies stay pure and testable.\n */\nexport interface FilterContext {\n beat: Beat\n beatTransactions: Transaction[]\n dataSeries: ChartDataSeriesItem[]\n // The double-bar drawer's month columns (main / comparison per month, with their guids); empty\n // for every other top kind.\n comparisonBars: DataSet[]\n selectedIndex: number\n subIndex: number\n isLastTab: boolean\n instanceSlotData: DrillDownSlotData\n spendCategoryGuids: string[]\n displayedDateRange: { start: Date; end: Date }\n}\n\n// Resolves the current selection into a TransactionFilter. Carried on each config row so behavior\n// lives next to the variant it belongs to (no separate strategy registry to chase).\nexport type FilterStrategy = (ctx: FilterContext) => TransactionFilter\n\n/** Sub-tabs under the chart (Income / Other Deposits); `subIndex` in `FilterContext` picks one. */\nexport type SubTabsKind = (ctx: {\n instanceSlotData: DrillDownSlotData\n copy: InsightsFeedCopy\n}) => string[]\n\nexport interface DrillDownVariantConfig {\n // `list`: no chart or tabs above the transaction list (an account's transactions for a window).\n // `monthTabs`: one tab per data_series month and no chart (a month's aggregated transactions).\n top: 'singleBar' | 'upcomingBill' | 'doubleBar' | 'tabsOnly' | 'monthTabs' | 'list'\n filterStrategy: FilterStrategy\n colors: ColorKind\n header?: HeaderKind\n // A second tab row under the chart that `subIndex` picks from (Income / Other Deposits).\n subTabs?: SubTabsKind\n // Where the drawer reads its facts. Absent: the bar chart's `instance_slot.data`.\n slotData?: SlotDataResolver\n // Builds the drawer's transactions from the beat's own. Absent: the beat's own, as they are.\n beatTransactions?: BeatTransactionsResolver\n // On open, returns the guids of the drawer's transactions to fetch by guid when the store lacks\n // them (older than its 90-day window), as pulse's BeatShell loads a legacy beat's: each drawer\n // reads them from wherever its beat keeps them (the beat, or the CTA that opened the drawer).\n // Absent: nothing is fetched.\n fetchMissingTransactions?: (beat: Beat, ctaDrilldownData?: DrilldownData) => unknown\n // undefined when the facts the tip needs are missing: the drawer shows no tip.\n tipSection?: (\n setCloseTipSection: (flag: boolean) => void,\n copy: InsightsFeedCopy,\n merchantName?: string,\n slotData?: DrillDownSlotData,\n ) => TipSectionProps | undefined\n scope: 'store' | 'beat'\n filterMode: 'store' | 'local'\n // Double bar: accessible names for the series tabs ([0] main, [1] comparison), as legacy pulse.\n subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[]\n // The list has no Transactions heading above it; the CSV export stays.\n hideListHeader?: boolean\n // The tip sits between the chart and the sub-tabs rather than under them.\n tipAboveSubTabs?: boolean\n // The average (Trend) legend's number format. Absent: cents ('0,0.00').\n averageFormat?: string\n}\nconst categoryColor = (theme: Theme, categoryGuid?: string): string =>\n (categoryGuid && getCategoryColor(categoryGuid, theme)) || theme.palette.primary.main\n\nconst toLocalDate = (date: string | number | Date | undefined) =>\n typeof date === 'string' ? parseISO(date) : new Date(date ?? NaN)\n\nconst monthRange = (date: string | number | Date | undefined) => ({\n start: startOfMonth(toLocalDate(date)),\n end: endOfMonth(toLocalDate(date)),\n})\n\n// Scopes a filter to the beat's accounts when the beat carries account_guids; otherwise leaves\n// accounts unset so the store default (all accounts) applies.\nconst accountScope = (accountGuids?: string[]): Pick<TransactionFilter, 'accounts'> =>\n accountGuids?.length ? { accounts: accountGuids } : {}\n\n// Low Account Balance — `drilldown_data` names one account and a window (epoch seconds at UTC\n// midnight, to_date exclusive); only settled, visible rows, a split purchase as its parts, as the\n// pulse drawer listed them. Fails closed: a drawer that cannot name its rows shows none.\nconst accountWindowStrategy: FilterStrategy = ({ beat }) => {\n const { account_guid, from_date, to_date } = beat.insights_payload?.drilldown_data ?? {}\n if (\n typeof account_guid !== 'string' ||\n typeof from_date !== 'number' ||\n typeof to_date !== 'number' ||\n !Number.isFinite(from_date) ||\n !Number.isFinite(to_date) ||\n to_date <= from_date\n ) {\n return { accounts: [], custom: () => false }\n }\n\n return {\n accounts: [account_guid],\n custom: (trn) => !trn.is_hidden && trn.feed_status !== TransactionStatus.PENDING,\n showSplits: true,\n dateRange: { start: fromUnixUTC(from_date), end: fromUnixUTC(to_date - 1) },\n }\n}\n\n// Upcoming Bill: a missing or mistyped `drilldown_data` fact is dropped, so a bad due date, amount or\n// guid list draws no chart and lists no rows.\n\nexport const resolveUpcomingBillSlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n\n return {\n transaction_guids: asGuidList(data.transaction_guids),\n date: calendarDateOf(data.due_date),\n amount: asNumber(data.amount),\n category_guid: asNonEmptyText(data.category_guid),\n average_amount: asNumber(data.average_amount),\n merchant_name: asNonEmptyText(data.merchant_name),\n }\n}\n\n// Savings Account Balances Summary: the drawer's bars, trend and accounts come from the beat's\n// drilldown_data alone (tupac SavingsAccountBalancesSummary::Factory.drilldown_data), each narrowed:\n// a missing or malformed fact is dropped, so the drawer draws no bars and lists no rows.\nconst dataSeriesOf = (value: unknown): DataSeries | undefined => {\n const series = value as DataSeries | undefined\n return Array.isArray(series?.names) && Array.isArray(series?.data) ? series : undefined\n}\n\nexport const resolveSavingsContributionsSlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n\n return {\n account_guids: asGuidList(data.account_guids),\n data_series: dataSeriesOf(data.data_series),\n average_amount: asNumber(data.average_amount),\n }\n}\n\n// Monthly Deposit Summary's sub-tabs, in the donut legend's order.\nconst DEPOSIT_SUB_TABS = ['income', 'other'] as const\n\n// Monthly Deposit Summary: tupac's drilldown_data carries the six months (data_series rows with\n// aggregated_guids), the income guids and the trend. The donut's legend rows are the card's, so they\n// only name the sub-tabs; with no `legends`, the chart legend falls back to Monthly Amount / Trend.\nexport const resolveDepositSummarySlotData: SlotDataResolver = (payload) => {\n const data = payload?.drilldown_data ?? {}\n const donutLegends = (payload?.instance_slot?.data as InsightsInstanceSlotData | undefined)\n ?.legends\n const subTabLabels = donutLegends?.map(({ label }) => label)\n\n return {\n data_series: dataSeriesOf(data.data_series),\n average_amount: asNumber(data.average_amount),\n income_transaction_guids: asGuidList(data.income_transaction_guids),\n sub_tab_labels: subTabLabels?.length === DEPOSIT_SUB_TABS.length ? subTabLabels : undefined,\n }\n}\n\n// Monthly Debt to Income Comparison: the 6 months and the Debt / Income legend labels come from the\n// drilldown_data of the CTA that opened the drawer (ditto primary_cta_drilldown_data), never the card's\n// slot or the beat. A malformed series, or labels that are not two non-blank strings, yield nothing,\n// so the drawer draws no bars and lists no rows.\nconst DEBT_TO_INCOME_SERIES_COUNT = 2\n\nexport const resolveDebtToIncomeSlotData: SlotDataResolver = (_payload, ctaDrilldownData) => {\n const data = ctaDrilldownData ?? {}\n const dataSeries = dataSeriesOf(data.series)\n const labels = Array.isArray(data.labels) ? data.labels.map(asNonEmptyText) : []\n if (\n !dataSeries ||\n labels.length !== DEBT_TO_INCOME_SERIES_COUNT ||\n !labels.every((label): label is string => !!label)\n ) {\n return {}\n }\n\n // The legend's amounts are the selected month's, which the drawer fills from the bars.\n return { data_series: dataSeries, legends: labels.map((label) => ({ label, value: 0 })) }\n}\n\n// Every month's debt and income guids from the opening CTA, so the drawer fetches the ones older\n// than the store's window.\nconst debtToIncomeGuidsOf = (_beat: Beat, ctaDrilldownData?: DrilldownData): string[] =>\n buildDataSeries(dataSeriesOf(ctaDrilldownData?.series)).flatMap(\n (row) => row.aggregated_guids ?? [],\n )\n\n// The drawer's tip, as Figma words it: the bold tip title and the bold limit (\"less than 30%\") from\n// the copy service. No hard-coded English: no tip until the copy service carries both strings.\nconst debtToIncomeTipSection: DrillDownVariantConfig['tipSection'] = (setCloseTipSection, copy) => {\n const message = copy.transaction_history_block?.monthly_debt_to_income_tip_message\n const limit = copy.transaction_history_block?.monthly_debt_to_income_tip_limit\n if (!message || !limit) return undefined\n\n return {\n message: buildDynamicCopy(\n message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{limit}</strong>,\n ) as ReactNode,\n onDismiss: () => setCloseTipSection(true),\n }\n}\n\n// Every month's deposit guids, so the drawer fetches the ones older than the store's window.\nconst depositGuidsOf = (beat: Beat): string[] =>\n buildDataSeries(dataSeriesOf(beat.insights_payload?.drilldown_data?.data_series)).flatMap(\n (row) => row.aggregated_guids ?? [],\n )\n\n// Upcoming Bill: the paid bills plus the projected bill (due date, amount) appended last, so the\n// bars and the projected tab's \"Projected amount\" row read the one list.\nexport const resolveUpcomingBillTransactions: BeatTransactionsResolver = (\n transactions,\n slotData,\n) => {\n const projected = buildProjectedBillTransaction(transactions, slotData)\n\n return projected ? [...transactions, projected] : transactions\n}\n\nconst upcomingBillTipSection: DrillDownVariantConfig['tipSection'] = (\n setCloseTipSection,\n copy,\n _merchantName,\n slotData,\n) => {\n const merchantName = slotData?.merchant_name\n const dueDate = slotData?.date\n if (!merchantName || !dueDate) return undefined\n\n // No hard-coded English: no tip until the copy service carries the message.\n const message = copy.transaction_history_block?.upcoming_bill_tip_message\n if (!message) return undefined\n\n return {\n message: buildDynamicCopy(\n message,\n <strong>{copy.general.tip_section_title}</strong>,\n merchantName,\n formatDate(parseISO(dueDate), DATE_FORMATS_INTL.FULL_MONTH_DAY),\n ) as ReactNode,\n onDismiss: () => setCloseTipSection(true),\n }\n}\n\n// ── Single-bar filter strategies (this MR) ────────────────────────────────────────────────────\n\n// BillAmountNotStandard / UpcomingBill — the series carries a transaction (TRN) guid; match a single\n// transaction by guid within its month.\nconst transactionGuidStrategy: FilterStrategy = ({\n beatTransactions,\n dataSeries,\n selectedIndex,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const seriesGuid = seriesItem?.guid\n const hasBeenSplit = beatTransactions.find((trn) => trn.guid === seriesGuid)?.has_been_split\n\n return {\n custom: (trn) => trn.guid === seriesGuid,\n dateRange: monthRange(seriesItem?.date),\n showSplits: !hasBeenSplit,\n }\n}\n\n// CategorySpendingV2 — match transactions in the beat's category (or whose top-level category is that\n// guid) within the month.\nconst categoryStrategy: FilterStrategy = ({ dataSeries, selectedIndex, instanceSlotData }) => {\n const seriesItem = dataSeries[selectedIndex]\n const categoryGuid = instanceSlotData.category_guid ?? seriesItem?.guid\n\n return {\n custom: (trn) =>\n trn.category_guid === categoryGuid || trn.top_level_category_guid === categoryGuid,\n dateRange: monthRange(seriesItem?.date),\n }\n}\n\n// MonthlySpendComparisonV2 — no per-bar guid; show all spending-category transactions\n// (income/transfers/investments excluded via spendCategoryGuids) within the month.\nconst spendCategoriesStrategy: FilterStrategy = ({\n dataSeries,\n selectedIndex,\n spendCategoryGuids,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n\n return {\n custom: (trn) =>\n !!trn.top_level_category_guid && spendCategoryGuids.includes(trn.top_level_category_guid),\n dateRange: monthRange(seriesItem?.date),\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// The beat's creation: tupac sends epoch seconds on the envelope and an ISO string on the wrapper.\nconst toCreatedAt = (createdAt: Beat['created_at']) =>\n typeof createdAt === 'number' ? fromUnixTime(createdAt) : parseISO(createdAt ?? '')\n\n// Savings Account Balances Summary: the beat's savings accounts within the month (the latest month\n// ends at the beat's creation). Fails closed: no drilldown_data accounts, no rows.\nconst accountDateStrategy: FilterStrategy = ({\n beat,\n dataSeries,\n selectedIndex,\n isLastTab,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const { start, end } = monthRange(seriesItem?.date)\n const createdAt = toCreatedAt(beat.created_at)\n const accountGuids = instanceSlotData.account_guids\n const dateRange = {\n start,\n end: isLastTab && isValid(createdAt) && createdAt < end ? createdAt : end,\n }\n\n if (!accountGuids?.length) return { dateRange, accounts: [], custom: () => false }\n\n return { dateRange, accounts: accountGuids }\n}\n\n// A row's stored guids within the row's month, scoped to the beat's accounts. parseISO reads the\n// 'yyyy-MM-dd' date as a local calendar day, so the month never shifts with the viewer's time zone.\n// Fails closed: a missing row, guid list or date matches nothing, never the store's displayed range.\nconst guidsWithinMonth = (\n guids: string[] | undefined,\n date: string | undefined,\n accountGuids?: string[],\n): TransactionFilter => {\n const guidSet = new Set(guids)\n const month = parseISO(date ?? '')\n if (!guidSet.size || !isValid(month)) return { accounts: [], custom: () => false }\n\n return {\n custom: (trn) => guidSet.has(trn.guid),\n dateRange: { start: startOfMonth(month), end: endOfMonth(month) },\n ...accountScope(accountGuids),\n }\n}\n\n// Monthly Subscription Aggregate — one data_series row per month, each naming its own\n// aggregated_guids; the selected month tab lists exactly those.\nconst monthlyAggregatedGuidsStrategy: FilterStrategy = ({ beat, dataSeries, selectedIndex }) =>\n guidsWithinMonth(\n dataSeries[selectedIndex]?.aggregated_guids,\n dataSeries[selectedIndex]?.date,\n beat.account_guids,\n )\n\n// ── Double-bar strategies ──────────────────────────────────────────────────────────────────────\n\n// Monthly Spend to Income Comparison — the selected month's main (Spend, sub-tab 0) or comparison\n// (Income, sub-tab 1) bar guids. The V2 payload carries no account_guids on instance_slot.data.\nconst comparisonGuidsStrategy: FilterStrategy = ({\n beat,\n comparisonBars,\n selectedIndex,\n subIndex,\n}) => {\n const bar = comparisonBars[selectedIndex]\n\n return guidsWithinMonth(\n subIndex === 1 ? bar?.comparisonGuids : bar?.mainGuids,\n bar?.date,\n beat.account_guids,\n )\n}\n\n// ── Tabs-only strategies ───────────────────────────────────────────────────────────────────────\n\n// Monthly Non-Essential Category Summary — the series is the two sides of one month (non-essential /\n// essential), not a time series; the selected sub-tab picks the row.\nconst aggregatedGuidsStrategy: FilterStrategy = ({ beat, dataSeries, subIndex }) =>\n guidsWithinMonth(\n dataSeries[subIndex]?.aggregated_guids,\n dataSeries[subIndex]?.date,\n beat.account_guids,\n )\n\n// Monthly Deposit Summary: the selected month's guids, split into the Income / Other Deposits sub-tab.\n// Not scoped to beat.account_guids: those are the beat month's accounts only, and an older month's\n// deposits can sit in other accounts; the row's aggregated_guids are already exact.\nconst depositSummaryStrategy: FilterStrategy = (ctx) => {\n const { dataSeries, selectedIndex, subIndex, instanceSlotData } = ctx\n const month = dataSeries[selectedIndex]\n const income = new Set(instanceSlotData.income_transaction_guids)\n const isIncome = DEPOSIT_SUB_TABS[subIndex] === 'income'\n const guids = instanceSlotData.sub_tab_labels\n ? month?.aggregated_guids?.filter((guid) => income.has(guid) === isIncome)\n : month?.aggregated_guids\n\n return guidsWithinMonth(guids, month?.date)\n}\n\nexport const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>> = {\n [DRILLDOWN_VARIANTS.TRANSACTION]: {\n top: 'singleBar',\n scope: 'store',\n filterMode: 'store',\n filterStrategy: transactionGuidStrategy,\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n const { title, subHeader } = ctx\n return {\n heading: title,\n subHeadingText: subHeader?.text || undefined,\n icon: (\n <LogoMark\n logo={{\n ...subHeader?.logo,\n merchant_name: subHeader?.text ?? subHeader?.logo?.merchant_name,\n }}\n size={16}\n />\n ),\n }\n },\n tipSection: (setCloseTipSection, copy, merchantName = '') => {\n return {\n message: buildDynamicCopy(\n copy.general.tip_section_message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{merchantName}</strong>,\n ),\n onDismiss: () => setCloseTipSection(true),\n } as TipSectionProps\n },\n },\n [DRILLDOWN_VARIANTS.CATEGORY_SPEND]: {\n top: 'singleBar',\n // As the card's Trend (Figma \"$x\"): whole dollars.\n averageFormat: '0,0',\n filterStrategy: categoryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n return {\n heading: ctx.categoryName,\n subHeadingText: ctx.selectedDate\n ? formatDate(toLocalDate(ctx.selectedDate), DATE_FORMATS_INTL.MONTH_LONG) || ''\n : '',\n // Figma: the month's calendar icon in primary.main.\n icon: <Icon color=\"primary\" name=\"calendar_month\" size={16} />,\n }\n },\n },\n [DRILLDOWN_VARIANTS.MONTHLY_SPEND]: {\n top: 'singleBar',\n filterStrategy: spendCategoriesStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.chart.chart2 ?? theme.palette.primary.main],\n },\n [DRILLDOWN_VARIANTS.ACCOUNT_BALANCE]: {\n top: 'singleBar',\n filterStrategy: accountDateStrategy,\n slotData: resolveSavingsContributionsSlotData,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n },\n // Upcoming Bill: one bar per paid bill plus the projected bill, all from `drilldown_data`; a bar's\n // tab lists that bill alone (filtered locally, as legacy pulse does).\n [DRILLDOWN_VARIANTS.UPCOMING_BILL]: {\n top: 'upcomingBill',\n filterStrategy: transactionGuidStrategy,\n scope: 'beat',\n filterMode: 'local',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n slotData: resolveUpcomingBillSlotData,\n beatTransactions: resolveUpcomingBillTransactions,\n fetchMissingTransactions: (beat) => beat.insights_payload?.drilldown_data?.transaction_guids,\n tipSection: upcomingBillTipSection,\n },\n\n // Monthly Deposit Summary: six months of deposits from drilldown_data, then Income / Other Deposits\n // tabs named by the donut's legend rows; without both rows, no sub-tabs.\n [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY]: {\n top: 'singleBar',\n filterStrategy: depositSummaryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n slotData: resolveDepositSummarySlotData,\n fetchMissingTransactions: depositGuidsOf,\n subTabs: ({ instanceSlotData }) => instanceSlotData.sub_tab_labels ?? [],\n },\n\n // Low Account Balance's \"Transactions\" link: the account's transactions for the alert's window.\n [DRILLDOWN_VARIANTS.LOW_BALANCE]: {\n top: 'list',\n filterStrategy: accountWindowStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n // Figma 438:27640 lists the rows straight under the drawer header.\n hideListHeader: true,\n },\n\n // Monthly Subscription Aggregate's \"View Transactions\": one tab per month, no chart, each month\n // listing its own aggregated_guids.\n [DRILLDOWN_VARIANTS.SUBSCRIPTION_AGGREGATE]: {\n top: 'monthTabs',\n filterStrategy: monthlyAggregatedGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n\n // ── Double-bar comparison beats (month tabs + main / comparison sub-tabs) ────────────────────\n // Monthly Spend to Income Comparison: Spend vs Income per month, in the card block's palette.\n [DRILLDOWN_VARIANTS.SPEND_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'spend_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [copy.general.spend_transactions, copy.general.income_transactions],\n },\n // Cost of Living to Income: one living-cost category (Housing, Groceries, ...) vs Income per month.\n // The cost bar takes the beat category's colour and Income the legacy chart4, as the pulse drawer.\n [DRILLDOWN_VARIANTS.COST_OF_LIVING]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [\n categoryColor(theme, categoryGuid),\n theme.palette.chart.chart4 ?? theme.palette.primary.main,\n ],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n },\n // Monthly Debt to Income Comparison: 6 months of Debt vs Income from the opening CTA's\n // drilldown_data, in the card block's palette so both series keep their card colours, plus the tip.\n [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'debt_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n slotData: resolveDebtToIncomeSlotData,\n fetchMissingTransactions: debtToIncomeGuidsOf,\n tipSection: debtToIncomeTipSection,\n // Figma 1117:8599: the tip above the Debt / Income tabs, and no Transactions heading.\n tipAboveSubTabs: true,\n hideListHeader: true,\n },\n // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n\n // Monthly Non-Essential Category Summary (tabs only): one side tab per series row, labelled by the\n // row's pre-localized label; a row without one gets no tab.\n [DRILLDOWN_VARIANTS.NON_ESSENTIAL_CATEGORY]: {\n top: 'tabsOnly',\n filterStrategy: aggregatedGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n}\n\n// Fallback for a missing/typo'd backend variant: a single-bar, store-scoped drawer filtered by the\n// beat's transaction guid and colored by category, so the drawer still renders instead of crashing.\nexport const FALLBACK: DrillDownVariantConfig = {\n top: 'singleBar',\n filterStrategy: transactionGuidStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n}\n"],"mappings":";;;;;;;;;;;;;AAmDA,IAAa,IAAqB;AAAA,EAChC,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;AAAA,EAChB,wBAAwB;AAAA,EACxB,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb,wBAAwB;AAC1B,GA6EM,IAAA,CAAiB,GAAc,MAClC,KAAgB,EAAiB,GAAc,CAAK,KAAM,EAAM,QAAQ,QAAQ,MAE7E,IAAA,CAAe,MACnB,OAAO,KAAS,WAAW,EAAS,C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gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAA,CAAS,GAAc,MAA0B,CAAC,EAAc,GAAO,CAAY,CAAC;AACtF"}
|
package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { useInsightsV2Store as d, useTransactionStore as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
m
|
|
8
|
-
|
|
1
|
+
import { useInsightsV2Store as d, useTransactionStore as m } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { asGuidList as p } from "../../blocks/slotReaders.es.js";
|
|
3
|
+
import { getDrillDownConfig as f } from "./utils.es.js";
|
|
4
|
+
import { getDynamicCtaBasedOnTriggers as g } from "../util.es.js";
|
|
5
|
+
import l from "react";
|
|
6
|
+
var h = ({ beat: t }) => {
|
|
7
|
+
const { isTransactionDataLoaded: s, loadMissingTransactionData: n, loadTransactionsByGuids: r } = m(), { actionDrawer: c } = d();
|
|
8
|
+
l.useEffect(() => {
|
|
9
|
+
const a = t?.insights_payload, o = g(c, a?.primary_cta, a?.secondary_cta, a?.in_description_cta), { fetchMissingTransactions: e } = f(o?.variant ?? ""), i = p(e?.(t, o?.drilldown_data));
|
|
9
10
|
(async () => (s || await n(), i && await r(i)))();
|
|
10
11
|
}, []);
|
|
11
12
|
};
|
|
12
13
|
export {
|
|
13
|
-
|
|
14
|
+
h as useTransactionHistoryPrepare
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
//# sourceMappingURL=useTransactionHistoryPrepare.es.js.map
|
package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransactionHistoryPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useInsightsV2Store, useTransactionStore } from '../../../common'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { getDrillDownConfig
|
|
1
|
+
{"version":3,"file":"useTransactionHistoryPrepare.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.ts"],"sourcesContent":["import React from 'react'\n\nimport { useInsightsV2Store, useTransactionStore } from '../../../common'\nimport { asGuidList } from '../../blocks/slotReaders'\nimport type { ActionBlockProps } from '../../mappings/blocks'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\nimport { getDrillDownConfig } from './utils'\n\n/**\n * Open-time load for the Transaction History drawer. The list reads `detailedTransactions`, which\n * stays empty until beats, tags, taggings, rules and transactions are all loaded; a feed that never\n * mounted the transactions module has none of them. Loads only the missing pieces, so a host that\n * seeded any of them through `GlobalStore.loadData` keeps what it seeded.\n */\nexport const useTransactionHistoryPrepare = ({ beat }: ActionBlockProps) => {\n const { isTransactionDataLoaded, loadMissingTransactionData, loadTransactionsByGuids } =\n useTransactionStore()\n const { actionDrawer } = useInsightsV2Store()\n\n React.useEffect(() => {\n // A drawer whose registry entry names `fetchMissingTransactions` (Upcoming Bill) also fetches by\n // guid the transactions it returns that the store lacks, so each older paid bill gets its bar.\n const payload = beat?.insights_payload\n const openedCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n payload?.primary_cta,\n payload?.secondary_cta,\n payload?.in_description_cta,\n )\n const { fetchMissingTransactions } = getDrillDownConfig(openedCta?.variant ?? '')\n // The same narrowing the drawer applies, so the fetch and the chart agree on a valid guid list.\n const guids = asGuidList(fetchMissingTransactions?.(beat, openedCta?.drilldown_data))\n\n // The window load replaces the store's transactions, so it finishes before the by-guid fetch\n // adds the older ones; run together, it could wipe them out.\n const load = async () => {\n if (!isTransactionDataLoaded) await loadMissingTransactionData()\n if (guids) await loadTransactionsByGuids(guids)\n }\n void load()\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n}\n"],"mappings":";;;;;AAcA,IAAa,IAAA,CAAgC,EAAE,MAAA,EAAA,MAA6B;AAC1E,QAAM,EAAE,yBAAA,GAAyB,4BAAA,GAA4B,yBAAA,EAAA,IAC3D,EAAoB,GAChB,EAAE,cAAA,EAAA,IAAiB,EAAmB;AAE5C,EAAA,EAAM,UAAA,MAAgB;AAGpB,UAAM,IAAU,GAAM,kBAChB,IAAY,EAChB,GACA,GAAS,aACT,GAAS,eACT,GAAS,kBACX,GACM,EAAE,0BAAA,EAAA,IAA6B,EAAmB,GAAW,WAAW,EAAE,GAE1E,IAAQ,EAAW,IAA2B,GAAM,GAAW,cAAc,CAAC;AAQpF,KAJa,aACN,KAAyB,MAAM,EAA2B,GAC3D,KAAO,MAAM,EAAwB,CAAK;AAAA,EAIlD,GAAG,CAAC,CAAC;AACP"}
|
|
@@ -84,9 +84,6 @@ export type DrillDownSlotData = InsightsInstanceSlotData & Pick<BarChartBlockDat
|
|
|
84
84
|
sub_tab_labels?: string[];
|
|
85
85
|
};
|
|
86
86
|
export declare const utcDayToUnix: (day: string) => number;
|
|
87
|
-
export declare const finiteNumberOf: (value: unknown) => number | undefined;
|
|
88
|
-
export declare const nonEmptyStringOf: (value: unknown) => string | undefined;
|
|
89
|
-
export declare const guidListOf: (value: unknown) => string[] | undefined;
|
|
90
87
|
export declare const calendarDateOf: (value: unknown) => string | undefined;
|
|
91
88
|
/**
|
|
92
89
|
* Resolves the drawer's facts (bars, guids, colour, average, tip values) from the beat's payload, or
|