@mx-cartographer/experiences 9.7.185 → 9.7.186
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 +7 -0
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +2 -0
- package/dist/insights/hooks/useContainerDimensions.es.js +11 -9
- package/dist/insights/hooks/useContainerDimensions.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +79 -77
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +29 -30
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js +19 -19
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/ChartLegend.d.ts +3 -1
- package/dist/insights-v2/components/chartblocks/ChartLegend.es.js +10 -10
- package/dist/insights-v2/components/chartblocks/ChartLegend.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.d.ts +3 -1
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js +32 -31
- package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [9.7.186] - 11-18-2026
|
|
2
|
+
|
|
3
|
+
- **FIXED** - Monthly Deposit Summary's donut and legend stay centred in a wider card (WEC-2341)
|
|
4
|
+
- **FIXED** - Monthly Deposit Summary's drawer legend reads "Deposit", with no amount (WEC-2341)
|
|
5
|
+
- **FIXED** - Spend, Savings, Debt and Cost of Living to Income drawers draw their legend at one size (13px), and Savings to Income's tip has no close button (WEC-2341)
|
|
6
|
+
- **FIXED** - Bar charts follow their card's width when the car...
|
|
7
|
+
|
|
1
8
|
## [9.7.185] - 11-18-2026
|
|
2
9
|
|
|
3
10
|
- **CHANGED** - Insights 2.0 mini: the instance_slot fills the host's fixed-height card (Pulse's 312px mini slide) with its contents centred vertically, putting the description and link at the card's bottom. `BaseLayout` now wraps the block in a Box between the header and the description; full cards look unchanged (WEC-2365)
|
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { useEffect as
|
|
2
|
-
var
|
|
3
|
-
const [
|
|
1
|
+
import { useEffect as h, useState as u } from "react";
|
|
2
|
+
var c = (e) => {
|
|
3
|
+
const [o, d] = u({
|
|
4
4
|
width: 0,
|
|
5
5
|
height: 0
|
|
6
6
|
});
|
|
7
|
-
return
|
|
7
|
+
return h(() => {
|
|
8
8
|
const t = () => {
|
|
9
9
|
if (e.current) {
|
|
10
10
|
const { offsetWidth: n, offsetHeight: r } = e.current;
|
|
11
|
-
s
|
|
11
|
+
d((s) => s.width === n && s.height === r ? s : {
|
|
12
12
|
width: n,
|
|
13
13
|
height: r
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
t(), window.addEventListener("resize", t);
|
|
18
|
+
const i = typeof ResizeObserver < "u" ? new ResizeObserver(t) : void 0;
|
|
19
|
+
return e.current && i?.observe(e.current), () => {
|
|
20
|
+
window.removeEventListener("resize", t), i?.disconnect();
|
|
19
21
|
};
|
|
20
|
-
}, [e]),
|
|
22
|
+
}, [e]), o;
|
|
21
23
|
};
|
|
22
24
|
export {
|
|
23
|
-
|
|
25
|
+
c as useContainerDimensions
|
|
24
26
|
};
|
|
25
27
|
|
|
26
28
|
//# sourceMappingURL=useContainerDimensions.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useContainerDimensions.es.js","names":[],"sources":["../../../src/insights/hooks/useContainerDimensions.ts"],"sourcesContent":["import React, { useEffect, useState } from 'react'\n\nexport const useContainerDimensions = (containerRef: React.RefObject<HTMLDivElement | null>) => {\n const [dimensions, setDimensions] = useState({ width: 0, height: 0 })\n\n useEffect(() => {\n const updateDimensions = () => {\n if (containerRef.current) {\n const { offsetWidth, offsetHeight } = containerRef.current\n setDimensions({ width: offsetWidth, height: offsetHeight })\n }\n }\n\n updateDimensions()\n window.addEventListener('resize', updateDimensions)\n\n return () => {\n window.removeEventListener('resize', updateDimensions)\n }\n }, [containerRef])\n\n return dimensions\n}\n"],"mappings":";AAEA,IAAa,IAAA,CAA0B,MAAyD;AAC9F,QAAM,CAAC,GAAY,CAAA,IAAiB,EAAS;AAAA,IAAE,OAAO;AAAA,IAAG,QAAQ;AAAA,EAAE,CAAC;AAEpE,SAAA,EAAA,MAAgB;AACd,UAAM,IAAA,MAAyB;AAC7B,UAAI,EAAa,SAAS;AACxB,cAAM,EAAE,aAAA,GAAa,cAAA,EAAA,IAAiB,EAAa;
|
|
1
|
+
{"version":3,"file":"useContainerDimensions.es.js","names":[],"sources":["../../../src/insights/hooks/useContainerDimensions.ts"],"sourcesContent":["import React, { useEffect, useState } from 'react'\n\nexport const useContainerDimensions = (containerRef: React.RefObject<HTMLDivElement | null>) => {\n const [dimensions, setDimensions] = useState({ width: 0, height: 0 })\n\n useEffect(() => {\n const updateDimensions = () => {\n if (containerRef.current) {\n const { offsetWidth, offsetHeight } = containerRef.current\n // Same size → same object, so a resize tick that changes nothing doesn't re-render.\n setDimensions((prev) =>\n prev.width === offsetWidth && prev.height === offsetHeight\n ? prev\n : { width: offsetWidth, height: offsetHeight },\n )\n }\n }\n\n updateDimensions()\n window.addEventListener('resize', updateDimensions)\n // The container can resize without the window (a card narrowed after mount); without this a\n // chart keeps its first width and overflows the card.\n const observer =\n typeof ResizeObserver !== 'undefined' ? new ResizeObserver(updateDimensions) : undefined\n if (containerRef.current) observer?.observe(containerRef.current)\n\n return () => {\n window.removeEventListener('resize', updateDimensions)\n observer?.disconnect()\n }\n }, [containerRef])\n\n return dimensions\n}\n"],"mappings":";AAEA,IAAa,IAAA,CAA0B,MAAyD;AAC9F,QAAM,CAAC,GAAY,CAAA,IAAiB,EAAS;AAAA,IAAE,OAAO;AAAA,IAAG,QAAQ;AAAA,EAAE,CAAC;AAEpE,SAAA,EAAA,MAAgB;AACd,UAAM,IAAA,MAAyB;AAC7B,UAAI,EAAa,SAAS;AACxB,cAAM,EAAE,aAAA,GAAa,cAAA,EAAA,IAAiB,EAAa;AAEnD,QAAA,EAAA,CAAe,MACb,EAAK,UAAU,KAAe,EAAK,WAAW,IAC1C,IACA;AAAA,UAAE,OAAO;AAAA,UAAa,QAAQ;AAAA,QAAa,CACjD;AAAA,MACF;AAAA,IACF;AAEA,IAAA,EAAiB,GACjB,OAAO,iBAAiB,UAAU,CAAgB;AAGlD,UAAM,IACJ,OAAO,iBAAmB,MAAc,IAAI,eAAe,CAAgB,IAAI;AACjF,WAAI,EAAa,WAAS,GAAU,QAAQ,EAAa,OAAO,GAEhE,MAAa;AACX,aAAO,oBAAoB,UAAU,CAAgB,GACrD,GAAU,WAAW;AAAA,IACvB;AAAA,EACF,GAAG,CAAC,CAAY,CAAC,GAEV;AACT"}
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { CURRENCY_FORMAT as
|
|
3
|
-
import
|
|
4
|
-
import { BAR_ARIA_LABEL as
|
|
5
|
-
import { BarChartV2 as
|
|
6
|
-
import { EmptyBarChart as
|
|
7
|
-
import { ANALYTICS_EVENTS_CONFIG as
|
|
8
|
-
import { useAnalyticsEvent as
|
|
9
|
-
import { DoubleBarChart as
|
|
10
|
-
import { toLegendItems as
|
|
11
|
-
import { getDefaultSelection as
|
|
12
|
-
import { useOpenedCta as
|
|
13
|
-
import { TransactionDrillDown as
|
|
14
|
-
import { useTransactionHistory as
|
|
15
|
-
import { TransactionDetailsBlock as
|
|
16
|
-
import { useRequiredCopy as
|
|
17
|
-
import { useLayoutEffect as
|
|
18
|
-
import { observer as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
import { useTheme as
|
|
21
|
-
var
|
|
22
|
-
const _ =
|
|
1
|
+
import { useGlobalCopyStore as _t, useInsightsV2Store as Tt } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as At, formatCurrency as Dt } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import Lt from "../../../common/components/drawer/Drawer.es.js";
|
|
4
|
+
import { BAR_ARIA_LABEL as St } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
5
|
+
import { BarChartV2 as vt } from "../../components/chartblocks/BarchartV2.es.js";
|
|
6
|
+
import { EmptyBarChart as Bt } from "../../components/chartblocks/EmptyBarChart.es.js";
|
|
7
|
+
import { ANALYTICS_EVENTS_CONFIG as k } from "../../analytics/analyticsEventsConfig.es.js";
|
|
8
|
+
import { useAnalyticsEvent as It } from "../../analytics/useAnalyticsEvent.es.js";
|
|
9
|
+
import { DoubleBarChart as Et } from "../../components/chartblocks/DoubleBarChart.es.js";
|
|
10
|
+
import { toLegendItems as Rt } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
|
|
11
|
+
import { getDefaultSelection as xt, getDrillDownConfig as Ft, getFlattenedDataSeries as Ot, resolveDrillDownSubHeader as wt, toStoreFilter as Gt } from "./utils.es.js";
|
|
12
|
+
import { useOpenedCta as Ht } from "../useOpenedCta.es.js";
|
|
13
|
+
import { TransactionDrillDown as Mt } from "./TransactionDrillDown.es.js";
|
|
14
|
+
import { useTransactionHistory as Nt } from "./useTransactionHistory.es.js";
|
|
15
|
+
import { TransactionDetailsBlock as jt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
|
|
16
|
+
import { useRequiredCopy as kt } from "../useRequiredCopy.es.js";
|
|
17
|
+
import { useLayoutEffect as Vt, useState as d } from "react";
|
|
18
|
+
import { observer as Kt } from "mobx-react-lite";
|
|
19
|
+
import { Fragment as Pt, jsx as l, jsxs as zt } from "react/jsx-runtime";
|
|
20
|
+
import { useTheme as Yt } from "@mui/material/styles";
|
|
21
|
+
var qt = (a) => a.insights_feed, be = Kt(({ beat: a, cta: V }) => {
|
|
22
|
+
const _ = Yt(), { actionDrawer: K, setActionContext: T } = Tt(), { insights_payload: A } = a, P = Ht(a), D = V ?? P, z = D?.variant, { top: e, filterMode: m, header: Y, colors: q, filterStrategy: U, tipSection: L, subTabAriaLabels: W, slotData: $, averageFormat: J, subTabs: Q, boldLabel: X, barLegendLabel: Z, showMonthlyAmount: tt } = Ft(z ?? ""), { instanceSlotData: o, beatTransactions: u, spendCategoryGuids: S, allAccountGuids: v, categoryName: et, displayedDateRange: f, transactionStore: ot } = Nt(a, { slotData: $ }, D?.drilldown_data), { common: at } = _t(), n = kt(qt), [nt, B] = d(!1), [rt, st] = d(!1), I = It(), { dataSeries: g, chartData: p, comparisonBars: s } = Ot({
|
|
23
23
|
data: o?.data_series,
|
|
24
|
-
ariaLabel: e === "doubleBar" ? n?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" :
|
|
24
|
+
ariaLabel: e === "doubleBar" ? n?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : St,
|
|
25
25
|
top: e,
|
|
26
26
|
beatTransactions: u
|
|
27
|
-
}), c = e === "doubleBar",
|
|
27
|
+
}), c = e === "doubleBar", it = e === "tabsOnly", i = c ? s : p, { chartBarIndex: E, subTabIndex: lt } = xt({
|
|
28
28
|
chartTabCount: p.length,
|
|
29
29
|
comparisonTabCount: s.length,
|
|
30
|
-
actionDrawer:
|
|
30
|
+
actionDrawer: K,
|
|
31
31
|
beatGuid: a.guid
|
|
32
|
-
}), [r, C] = d(E), [y, R] = d(
|
|
33
|
-
i.length !==
|
|
32
|
+
}), [r, C] = d(E), [y, R] = d(lt), [ct, dt] = d(i.length);
|
|
33
|
+
i.length !== ct && (dt(i.length), C(E));
|
|
34
34
|
const x = (t) => U({
|
|
35
35
|
beat: a,
|
|
36
36
|
beatTransactions: u,
|
|
@@ -40,20 +40,20 @@ var zt = (a) => a.insights_feed, ge = Mt(({ beat: a, cta: K }) => {
|
|
|
40
40
|
subIndex: y,
|
|
41
41
|
isLastTab: t === i.length - 1,
|
|
42
42
|
instanceSlotData: o,
|
|
43
|
-
spendCategoryGuids:
|
|
44
|
-
displayedDateRange:
|
|
45
|
-
}),
|
|
43
|
+
spendCategoryGuids: S,
|
|
44
|
+
displayedDateRange: f
|
|
45
|
+
}), mt = u.map((t) => t.guid).join(","), ut = S.join(","), gt = v.join(","), pt = e === "list" || e === "tabsOnly" || e === "monthTabs" || g.length > 0, F = () => {
|
|
46
46
|
if (m !== "store") return;
|
|
47
|
-
const t =
|
|
47
|
+
const t = pt ? x(r) : {
|
|
48
48
|
accounts: [],
|
|
49
49
|
custom: () => !1
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
allAccountGuids:
|
|
53
|
-
displayedDateRange:
|
|
51
|
+
ot.setFilter(Gt(t, {
|
|
52
|
+
allAccountGuids: v,
|
|
53
|
+
displayedDateRange: f
|
|
54
54
|
}));
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
Vt(() => {
|
|
57
57
|
F();
|
|
58
58
|
}, [
|
|
59
59
|
a.guid,
|
|
@@ -62,49 +62,50 @@ var zt = (a) => a.insights_feed, ge = Mt(({ beat: a, cta: K }) => {
|
|
|
62
62
|
m,
|
|
63
63
|
g.length,
|
|
64
64
|
o,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
f,
|
|
66
|
+
ut,
|
|
67
|
+
gt,
|
|
67
68
|
mt,
|
|
68
|
-
ct,
|
|
69
69
|
e
|
|
70
70
|
]);
|
|
71
|
-
const O =
|
|
71
|
+
const O = wt(A), b = Y?.({
|
|
72
72
|
title: A?.title,
|
|
73
73
|
subHeader: O,
|
|
74
|
-
categoryName:
|
|
74
|
+
categoryName: et,
|
|
75
75
|
selectedDate: p[r]?.date ?? void 0,
|
|
76
76
|
slotData: o,
|
|
77
77
|
copy: n
|
|
78
|
-
}),
|
|
79
|
-
I(
|
|
80
|
-
},
|
|
81
|
-
I(
|
|
82
|
-
},
|
|
83
|
-
...
|
|
78
|
+
}), w = q(_, o?.category_guid), [G, H] = o?.legends ?? [], bt = m === "local" ? (t) => x(t).custom ?? (() => !0) : void 0, ht = m === "local" ? u : void 0, M = (t, h) => {
|
|
79
|
+
I(k.DRAWER_CHART_BAR_CLICKED), C(t), h !== void 0 && R(h);
|
|
80
|
+
}, ft = (t) => {
|
|
81
|
+
I(k.TAB_SELECTED), C(t);
|
|
82
|
+
}, N = c ? Rt([{
|
|
83
|
+
...G,
|
|
84
84
|
value: s[r]?.main
|
|
85
85
|
}, {
|
|
86
|
-
...
|
|
86
|
+
...H,
|
|
87
87
|
value: s[r]?.comparison
|
|
88
|
-
}]) : void 0,
|
|
88
|
+
}]) : void 0, Ct = W?.(n) ?? [], j = c ? (N ?? []).map((t, h) => ({
|
|
89
89
|
label: t.label,
|
|
90
|
-
ariaLabel:
|
|
91
|
-
})) :
|
|
90
|
+
ariaLabel: Ct[h]
|
|
91
|
+
})) : it ? g.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : Q?.({
|
|
92
92
|
instanceSlotData: o,
|
|
93
93
|
copy: n
|
|
94
|
-
}).map((t) => ({ label: t })) ?? [],
|
|
94
|
+
}).map((t) => ({ label: t })) ?? [], yt = c || e === "singleBar" || e === "upcomingBill" ? i.length ? c ? /* @__PURE__ */ l(Et, {
|
|
95
95
|
bars: s,
|
|
96
96
|
boldLabel: X,
|
|
97
|
-
colors:
|
|
97
|
+
colors: w,
|
|
98
98
|
legendPosition: "top",
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
legendVariant: "body2",
|
|
100
|
+
legends: N,
|
|
101
|
+
onBarClick: M,
|
|
101
102
|
selectedIndex: r
|
|
102
|
-
}) : /* @__PURE__ */ l(
|
|
103
|
+
}) : /* @__PURE__ */ l(vt, {
|
|
103
104
|
amounts: {
|
|
104
105
|
average: o?.average_amount,
|
|
105
|
-
formattedAverage:
|
|
106
|
+
formattedAverage: Dt(o?.average_amount ?? 0, J ?? At.cents)
|
|
106
107
|
},
|
|
107
|
-
color:
|
|
108
|
+
color: w[0] ?? _.palette.primary.main,
|
|
108
109
|
data: p,
|
|
109
110
|
legendPosition: "top",
|
|
110
111
|
heightOverride: 172,
|
|
@@ -114,44 +115,45 @@ var zt = (a) => a.insights_feed, ge = Mt(({ beat: a, cta: K }) => {
|
|
|
114
115
|
left: 24,
|
|
115
116
|
right: 24
|
|
116
117
|
},
|
|
117
|
-
monthlyAmountLabel:
|
|
118
|
-
onBarClick:
|
|
118
|
+
monthlyAmountLabel: Z?.(n) ?? G?.label ?? n.general.monthly_amount,
|
|
119
|
+
onBarClick: M,
|
|
119
120
|
selectedTabIndex: r,
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
121
|
+
showMonthlyAmount: tt,
|
|
122
|
+
trendAmountLabel: H?.label ?? n.general.trend
|
|
123
|
+
}) : /* @__PURE__ */ l(Bt, {}) : null;
|
|
124
|
+
return /* @__PURE__ */ zt(Pt, { children: [/* @__PURE__ */ l(Mt, {
|
|
125
|
+
baseTransactions: ht,
|
|
124
126
|
heading: b?.heading,
|
|
125
127
|
icon: b?.icon,
|
|
126
128
|
logo: b?.logo,
|
|
127
|
-
onSelectionChange:
|
|
129
|
+
onSelectionChange: ft,
|
|
128
130
|
selectedIndex: r,
|
|
129
131
|
subHeadingText: b?.subHeadingText,
|
|
130
132
|
tabs: i,
|
|
131
|
-
top:
|
|
132
|
-
...
|
|
133
|
-
tabs:
|
|
133
|
+
top: yt,
|
|
134
|
+
...j.length > 0 && { subTabs: {
|
|
135
|
+
tabs: j,
|
|
134
136
|
selectedIndex: y,
|
|
135
137
|
onChange: R
|
|
136
138
|
} },
|
|
137
|
-
...
|
|
138
|
-
transactionFilter:
|
|
139
|
+
...L && { tipSection: !rt && (L(st, n, O?.text, o) ?? !1) },
|
|
140
|
+
transactionFilter: bt,
|
|
139
141
|
onEachRowClick: (t) => {
|
|
140
|
-
T({ transaction_guid: t }),
|
|
142
|
+
T({ transaction_guid: t }), B(!0);
|
|
141
143
|
}
|
|
142
|
-
}), /* @__PURE__ */ l(
|
|
143
|
-
ariaLabelClose:
|
|
144
|
-
isOpen:
|
|
144
|
+
}), /* @__PURE__ */ l(Lt, {
|
|
145
|
+
ariaLabelClose: at.close_aria,
|
|
146
|
+
isOpen: nt,
|
|
145
147
|
onClose: () => {
|
|
146
|
-
|
|
148
|
+
B(!1), T({ transaction_guid: void 0 }), F();
|
|
147
149
|
},
|
|
148
150
|
title: n.general.transaction_details_title,
|
|
149
|
-
children: /* @__PURE__ */ l(
|
|
151
|
+
children: /* @__PURE__ */ l(jt, { beat: a })
|
|
150
152
|
})] });
|
|
151
153
|
});
|
|
152
154
|
export {
|
|
153
|
-
|
|
154
|
-
|
|
155
|
+
be as TransactionHistoryBlock,
|
|
156
|
+
qt as selectTransactionHistoryCopy
|
|
155
157
|
};
|
|
156
158
|
|
|
157
159
|
//# sourceMappingURL=TransactionHistoryBlock.es.js.map
|
package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionHistoryBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport type { Beat, DataSeries, GlobalCopy, Transaction } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport { BarChartV2 } from '../../components/chartblocks/BarchartV2'\nimport { DoubleBarChart } from '../../components/chartblocks/DoubleBarChart'\nimport { EmptyBarChart } from '../../components/chartblocks/EmptyBarChart'\nimport { BAR_ARIA_LABEL } from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport {\n COMPARISON_BAR_ARIA_LABEL,\n toLegendItems,\n} from '../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils'\n\nimport { TransactionDrillDown } from './TransactionDrillDown'\nimport { useTransactionHistory } from './useTransactionHistory'\nimport {\n getDefaultSelection,\n getDrillDownConfig,\n getFlattenedDataSeries,\n resolveDrillDownSubHeader,\n toStoreFilter,\n} from './utils'\nimport { Drawer, useInsightsV2Store, useGlobalCopyStore } from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { useOpenedCta } from '../useOpenedCta'\nimport type { OpenedCta } from '../util'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\ninterface TransactionHistoryProp {\n beat: Beat\n /**\n * The CTA to draw, for a drawer nested inside another block's drawer (Top Merchants → Merchant\n * History). Absent: the CTA that opened the beat's drawer.\n */\n cta?: OpenedCta\n}\n\nexport const selectTransactionHistoryCopy = (copy: GlobalCopy) => copy.insights_feed\n\nexport const TransactionHistoryBlock = observer(({ beat, cta }: TransactionHistoryProp) => {\n const theme = useTheme()\n\n const { actionDrawer, setActionContext } = useInsightsV2Store()\n\n const { insights_payload } = beat\n\n // The CTA that opened the drawer: its variant picks the view, and its drilldown_data feeds a\n // variant that reads its facts from the opener (Monthly Debt to Income). Only drilldown_data is passed\n // on: it is the payload's own object, stable across renders, while the opener may be rebuilt per render.\n const drawerCta = useOpenedCta(beat)\n const openedCta = cta ?? drawerCta\n const dynamicCtaVariant = openedCta?.variant\n\n const {\n top,\n filterMode,\n header,\n colors,\n filterStrategy,\n tipSection,\n subTabAriaLabels,\n slotData,\n averageFormat,\n subTabs,\n boldLabel,\n } = getDrillDownConfig(dynamicCtaVariant ?? '')\n\n const {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n } = useTransactionHistory(beat, { slotData }, openedCta?.drilldown_data)\n\n const { common: commonCopy } = useGlobalCopyStore()\n const insightsCopy = useRequiredCopy(selectTransactionHistoryCopy)\n\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n\n const [closeTipSection, setCloseTipSection] = useState(false)\n\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n const { dataSeries, chartData, comparisonBars } = getFlattenedDataSeries({\n data: instanceSlotData?.data_series as DataSeries,\n ariaLabel:\n top === 'doubleBar'\n ? (insightsCopy?.general?.in_month_you_had_a_category_of_amount ??\n COMPARISON_BAR_ARIA_LABEL)\n : BAR_ARIA_LABEL,\n top,\n beatTransactions,\n })\n\n const isDoubleBar = top === 'doubleBar'\n const isTabsOnly = top === 'tabsOnly'\n // The drawer's columns (and tabs): the double bar's month pairs, or the single bar's bars.\n const bars = isDoubleBar ? comparisonBars : chartData\n\n const { chartBarIndex, subTabIndex } = getDefaultSelection({\n chartTabCount: chartData.length,\n comparisonTabCount: comparisonBars.length,\n actionDrawer,\n beatGuid: beat.guid,\n })\n\n const [selectedIndex, setSelectedIndex] = useState(chartBarIndex)\n // The double-bar drawer's series tab (0 = main, e.g. Spend; 1 = comparison, e.g. Income).\n const [subIndex, setSubIndex] = useState(subTabIndex)\n\n // Bars built from the transaction store (Upcoming Bill's paid bills) can arrive after the drawer\n // opens: re-select the default when the bar count changes. Payload-built bars never change count.\n const [defaultedTabCount, setDefaultedTabCount] = useState(bars.length)\n if (bars.length !== defaultedTabCount) {\n setDefaultedTabCount(bars.length)\n setSelectedIndex(chartBarIndex)\n }\n\n const resolveFilter = (index: number) =>\n filterStrategy({\n beat,\n beatTransactions,\n dataSeries,\n comparisonBars,\n selectedIndex: index,\n subIndex,\n isLastTab: index === bars.length - 1,\n instanceSlotData,\n spendCategoryGuids,\n displayedDateRange,\n })\n\n // Content keys for the effect deps: these arrays get a new identity every render (MEW-3732).\n const beatTransactionGuidsKey = beatTransactions.map((transaction) => transaction.guid).join(',')\n const spendCategoryGuidsKey = spendCategoryGuids.join(',')\n const allAccountGuidsKey = allAccountGuids.join(',')\n\n // Re-applied on selection change and when the nested details drawer closes: AddMerchantBudgetAction\n // overwrites transactionStore.filter and never restores it. Chartless tops filter with no bars.\n const canApplyFilter =\n top === 'list' || top === 'tabsOnly' || top === 'monthTabs' || dataSeries.length > 0\n const applyCurrentSelectionFilter = () => {\n if (filterMode !== 'store') return\n // A chart drawer with no bars can name no rows: fail closed rather than keep the store's default\n // (every account) or a previous drawer's filter.\n const filter = canApplyFilter\n ? resolveFilter(selectedIndex)\n : { accounts: [], custom: () => false }\n transactionStore.setFilter(toStoreFilter(filter, { allAccountGuids, displayedDateRange }))\n }\n\n // store variants route the selection through the shared store filter; local (upcomingBill) variants\n // filter beatTransactions directly, so there's nothing to push to the store for them.\n useLayoutEffect(() => {\n applyCurrentSelectionFilter()\n }, [\n beat.guid,\n selectedIndex,\n subIndex,\n filterMode,\n dataSeries.length,\n instanceSlotData,\n displayedDateRange,\n spendCategoryGuidsKey,\n allAccountGuidsKey,\n beatTransactionGuidsKey,\n top,\n ])\n\n const subHeader = resolveDrillDownSubHeader(insights_payload)\n\n const headerContent = header?.({\n title: insights_payload?.title,\n subHeader,\n categoryName,\n selectedDate: chartData[selectedIndex]?.date ?? undefined,\n slotData: instanceSlotData,\n copy: insightsCopy,\n })\n\n const barColors = colors(theme, instanceSlotData?.category_guid)\n\n // `legends` is the block's additional_data ([0] main, [1] second series), as BarchartBlock reads it.\n const [mainLegend, comparisonLegend] = instanceSlotData?.legends ?? []\n\n const transactionFilter =\n filterMode === 'local'\n ? (index: number) => resolveFilter(index).custom ?? (() => true)\n : undefined\n\n const baseTransactions: Transaction[] | undefined =\n filterMode === 'local' ? beatTransactions : undefined\n\n // A chart bar click selects its column (and, on the double bar, its series); a month tab change\n // selects the month. MUI Tabs only fires onChange on real user selection, not on mount. The\n // series (Spend / Income) tab fires its own analytics via the shared SubTabs component.\n const selectBar = (index: number, seriesIndex?: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.DRAWER_CHART_BAR_CLICKED)\n setSelectedIndex(index)\n if (seriesIndex !== undefined) setSubIndex(seriesIndex)\n }\n const selectMonth = (index: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TAB_SELECTED)\n setSelectedIndex(index)\n }\n\n // Double bar: the Spend / Income labels come from copy (additional_data); the legend carries the\n // selected month's two totals, and its labels name the series tabs.\n const doubleBarLegends = isDoubleBar\n ? toLegendItems([\n { ...mainLegend, value: comparisonBars[selectedIndex]?.main },\n { ...comparisonLegend, value: comparisonBars[selectedIndex]?.comparison },\n ])\n : undefined\n\n // Legacy pulse named these tabs \"Spend transactions\" / \"Income transactions\" for screen readers.\n const seriesAriaLabels = subTabAriaLabels?.(insightsCopy) ?? []\n\n // The second tab row: the double bar's series, a tabs-only drawer's sides, or the variant's `subTabs`.\n const sideTabs = isDoubleBar\n ? (doubleBarLegends ?? []).map((legend, index) => ({\n label: legend.label,\n ariaLabel: seriesAriaLabels[index],\n }))\n : isTabsOnly\n ? dataSeries.flatMap((row) => (row.localized_label ? [{ label: row.localized_label }] : []))\n : (subTabs?.({ instanceSlotData, copy: insightsCopy }).map((label) => ({ label })) ?? [])\n\n const renderChart = () => {\n if (!bars.length) return <EmptyBarChart />\n\n return isDoubleBar ? (\n <DoubleBarChart\n bars={comparisonBars}\n boldLabel={boldLabel}\n colors={barColors}\n legendPosition=\"top\"\n legends={doubleBarLegends}\n onBarClick={selectBar}\n selectedIndex={selectedIndex}\n />\n ) : (\n <BarChartV2\n amounts={{\n average: instanceSlotData?.average_amount,\n formattedAverage: formatCurrency(\n instanceSlotData?.average_amount ?? 0,\n averageFormat ?? CURRENCY_FORMAT.cents,\n ),\n }}\n color={barColors[0] ?? theme.palette.primary.main}\n data={chartData}\n legendPosition=\"top\"\n // Figma's chart drawer: 172px of bars under the 24px legend, 200px in all.\n heightOverride={172}\n margin={{\n bottom: 8,\n top: 24,\n left: 24,\n right: 24,\n }}\n // TODO: Temporary fallback while the backend doesn't always send `legends` on every\n // beat/variant. Remove this once the backend guarantees `legends` on the payload.\n monthlyAmountLabel={mainLegend?.label ?? insightsCopy.general.monthly_amount}\n onBarClick={selectBar}\n selectedTabIndex={selectedIndex}\n trendAmountLabel={comparisonLegend?.label ?? insightsCopy.general.trend}\n />\n )\n }\n\n // `list` (Low Account Balance), `tabsOnly` (Non-Essential Category Summary) and `monthTabs`\n // (Monthly Subscription Aggregate) drawers have no chart above their transaction list.\n const chartTop =\n isDoubleBar || top === 'singleBar' || top === 'upcomingBill' ? renderChart() : null\n\n return (\n <>\n <TransactionDrillDown\n baseTransactions={baseTransactions}\n heading={headerContent?.heading}\n icon={headerContent?.icon}\n logo={headerContent?.logo}\n onSelectionChange={selectMonth}\n selectedIndex={selectedIndex}\n subHeadingText={headerContent?.subHeadingText}\n tabs={bars}\n top={chartTop}\n {...(sideTabs.length > 0 && {\n subTabs: { tabs: sideTabs, selectedIndex: subIndex, onChange: setSubIndex },\n })}\n {...(tipSection && {\n tipSection:\n !closeTipSection &&\n (tipSection(setCloseTipSection, insightsCopy, subHeader?.text, instanceSlotData) ??\n false),\n })}\n transactionFilter={transactionFilter}\n onEachRowClick={(guid) => {\n setActionContext({ transaction_guid: guid })\n setIsTransactionDetailsOpen(true)\n }}\n />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isTransactionDetailsOpen}\n onClose={() => {\n setIsTransactionDetailsOpen(false)\n // Clear only the key this nested drawer owns — setActionContext merges, so an\n // explicit `{}` would be a no-op and leave transaction_guid stuck in the shared\n // context, and the outer drawer's own context (e.g. chartBarIndex) must survive.\n setActionContext({ transaction_guid: undefined })\n // Re-apply this block's own filter: a further-nested AddMerchantBudgetAction drawer may\n // have overwritten transactionStore.filter (merchant_guid-only) without restoring it.\n applyCurrentSelectionFilter()\n }}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Dr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AAE,kBAAkB,EAAK,CAAC,GAC3C,EAA4B,EAAI;AAAA,IAClC;AAAA,EACD,CAAA,GACD,gBAAA,EAAC,IAAD;AAAA,IACE,gBAAgB,GAAW;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAA,MAAe;AACb,MAAA,EAA4B,EAAK,GAIjC,EAAiB,EAAE,kBAAkB,OAAU,CAAC,GAGhD,EAA4B;AAAA,IAC9B;AAAA,IACA,OAAO,EAAa,QAAQ;AAAA,IAE5B,UAAA,gBAAA,EAAC,IAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,EAChC,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
|
|
1
|
+
{"version":3,"file":"TransactionHistoryBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport type { Beat, DataSeries, GlobalCopy, Transaction } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport { BarChartV2 } from '../../components/chartblocks/BarchartV2'\nimport { DoubleBarChart } from '../../components/chartblocks/DoubleBarChart'\nimport { EmptyBarChart } from '../../components/chartblocks/EmptyBarChart'\nimport { BAR_ARIA_LABEL } from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport {\n COMPARISON_BAR_ARIA_LABEL,\n toLegendItems,\n} from '../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils'\n\nimport { TransactionDrillDown } from './TransactionDrillDown'\nimport { useTransactionHistory } from './useTransactionHistory'\nimport {\n getDefaultSelection,\n getDrillDownConfig,\n getFlattenedDataSeries,\n resolveDrillDownSubHeader,\n toStoreFilter,\n} from './utils'\nimport { Drawer, useInsightsV2Store, useGlobalCopyStore } from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { useOpenedCta } from '../useOpenedCta'\nimport type { OpenedCta } from '../util'\nimport { useRequiredCopy } from '../useRequiredCopy'\n\ninterface TransactionHistoryProp {\n beat: Beat\n /**\n * The CTA to draw, for a drawer nested inside another block's drawer (Top Merchants → Merchant\n * History). Absent: the CTA that opened the beat's drawer.\n */\n cta?: OpenedCta\n}\n\nexport const selectTransactionHistoryCopy = (copy: GlobalCopy) => copy.insights_feed\n\nexport const TransactionHistoryBlock = observer(({ beat, cta }: TransactionHistoryProp) => {\n const theme = useTheme()\n\n const { actionDrawer, setActionContext } = useInsightsV2Store()\n\n const { insights_payload } = beat\n\n // The CTA that opened the drawer: its variant picks the view, and its drilldown_data feeds a\n // variant that reads its facts from the opener (Monthly Debt to Income). Only drilldown_data is passed\n // on: it is the payload's own object, stable across renders, while the opener may be rebuilt per render.\n const drawerCta = useOpenedCta(beat)\n const openedCta = cta ?? drawerCta\n const dynamicCtaVariant = openedCta?.variant\n\n const {\n top,\n filterMode,\n header,\n colors,\n filterStrategy,\n tipSection,\n subTabAriaLabels,\n slotData,\n averageFormat,\n subTabs,\n boldLabel,\n barLegendLabel,\n showMonthlyAmount,\n } = getDrillDownConfig(dynamicCtaVariant ?? '')\n\n const {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n } = useTransactionHistory(beat, { slotData }, openedCta?.drilldown_data)\n\n const { common: commonCopy } = useGlobalCopyStore()\n const insightsCopy = useRequiredCopy(selectTransactionHistoryCopy)\n\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n\n const [closeTipSection, setCloseTipSection] = useState(false)\n\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n const { dataSeries, chartData, comparisonBars } = getFlattenedDataSeries({\n data: instanceSlotData?.data_series as DataSeries,\n ariaLabel:\n top === 'doubleBar'\n ? (insightsCopy?.general?.in_month_you_had_a_category_of_amount ??\n COMPARISON_BAR_ARIA_LABEL)\n : BAR_ARIA_LABEL,\n top,\n beatTransactions,\n })\n\n const isDoubleBar = top === 'doubleBar'\n const isTabsOnly = top === 'tabsOnly'\n // The drawer's columns (and tabs): the double bar's month pairs, or the single bar's bars.\n const bars = isDoubleBar ? comparisonBars : chartData\n\n const { chartBarIndex, subTabIndex } = getDefaultSelection({\n chartTabCount: chartData.length,\n comparisonTabCount: comparisonBars.length,\n actionDrawer,\n beatGuid: beat.guid,\n })\n\n const [selectedIndex, setSelectedIndex] = useState(chartBarIndex)\n // The double-bar drawer's series tab (0 = main, e.g. Spend; 1 = comparison, e.g. Income).\n const [subIndex, setSubIndex] = useState(subTabIndex)\n\n // Bars built from the transaction store (Upcoming Bill's paid bills) can arrive after the drawer\n // opens: re-select the default when the bar count changes. Payload-built bars never change count.\n const [defaultedTabCount, setDefaultedTabCount] = useState(bars.length)\n if (bars.length !== defaultedTabCount) {\n setDefaultedTabCount(bars.length)\n setSelectedIndex(chartBarIndex)\n }\n\n const resolveFilter = (index: number) =>\n filterStrategy({\n beat,\n beatTransactions,\n dataSeries,\n comparisonBars,\n selectedIndex: index,\n subIndex,\n isLastTab: index === bars.length - 1,\n instanceSlotData,\n spendCategoryGuids,\n displayedDateRange,\n })\n\n // Content keys for the effect deps: these arrays get a new identity every render (MEW-3732).\n const beatTransactionGuidsKey = beatTransactions.map((transaction) => transaction.guid).join(',')\n const spendCategoryGuidsKey = spendCategoryGuids.join(',')\n const allAccountGuidsKey = allAccountGuids.join(',')\n\n // Re-applied on selection change and when the nested details drawer closes: AddMerchantBudgetAction\n // overwrites transactionStore.filter and never restores it. Chartless tops filter with no bars.\n const canApplyFilter =\n top === 'list' || top === 'tabsOnly' || top === 'monthTabs' || dataSeries.length > 0\n const applyCurrentSelectionFilter = () => {\n if (filterMode !== 'store') return\n // A chart drawer with no bars can name no rows: fail closed rather than keep the store's default\n // (every account) or a previous drawer's filter.\n const filter = canApplyFilter\n ? resolveFilter(selectedIndex)\n : { accounts: [], custom: () => false }\n transactionStore.setFilter(toStoreFilter(filter, { allAccountGuids, displayedDateRange }))\n }\n\n // store variants route the selection through the shared store filter; local (upcomingBill) variants\n // filter beatTransactions directly, so there's nothing to push to the store for them.\n useLayoutEffect(() => {\n applyCurrentSelectionFilter()\n }, [\n beat.guid,\n selectedIndex,\n subIndex,\n filterMode,\n dataSeries.length,\n instanceSlotData,\n displayedDateRange,\n spendCategoryGuidsKey,\n allAccountGuidsKey,\n beatTransactionGuidsKey,\n top,\n ])\n\n const subHeader = resolveDrillDownSubHeader(insights_payload)\n\n const headerContent = header?.({\n title: insights_payload?.title,\n subHeader,\n categoryName,\n selectedDate: chartData[selectedIndex]?.date ?? undefined,\n slotData: instanceSlotData,\n copy: insightsCopy,\n })\n\n const barColors = colors(theme, instanceSlotData?.category_guid)\n\n // `legends` is the block's additional_data ([0] main, [1] second series), as BarchartBlock reads it.\n const [mainLegend, comparisonLegend] = instanceSlotData?.legends ?? []\n\n const transactionFilter =\n filterMode === 'local'\n ? (index: number) => resolveFilter(index).custom ?? (() => true)\n : undefined\n\n const baseTransactions: Transaction[] | undefined =\n filterMode === 'local' ? beatTransactions : undefined\n\n // A chart bar click selects its column (and, on the double bar, its series); a month tab change\n // selects the month. MUI Tabs only fires onChange on real user selection, not on mount. The\n // series (Spend / Income) tab fires its own analytics via the shared SubTabs component.\n const selectBar = (index: number, seriesIndex?: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.DRAWER_CHART_BAR_CLICKED)\n setSelectedIndex(index)\n if (seriesIndex !== undefined) setSubIndex(seriesIndex)\n }\n const selectMonth = (index: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TAB_SELECTED)\n setSelectedIndex(index)\n }\n\n // Double bar: the Spend / Income labels come from copy (additional_data); the legend carries the\n // selected month's two totals, and its labels name the series tabs.\n const doubleBarLegends = isDoubleBar\n ? toLegendItems([\n { ...mainLegend, value: comparisonBars[selectedIndex]?.main },\n { ...comparisonLegend, value: comparisonBars[selectedIndex]?.comparison },\n ])\n : undefined\n\n // Legacy pulse named these tabs \"Spend transactions\" / \"Income transactions\" for screen readers.\n const seriesAriaLabels = subTabAriaLabels?.(insightsCopy) ?? []\n\n // The second tab row: the double bar's series, a tabs-only drawer's sides, or the variant's `subTabs`.\n const sideTabs = isDoubleBar\n ? (doubleBarLegends ?? []).map((legend, index) => ({\n label: legend.label,\n ariaLabel: seriesAriaLabels[index],\n }))\n : isTabsOnly\n ? dataSeries.flatMap((row) => (row.localized_label ? [{ label: row.localized_label }] : []))\n : (subTabs?.({ instanceSlotData, copy: insightsCopy }).map((label) => ({ label })) ?? [])\n\n const renderChart = () => {\n if (!bars.length) return <EmptyBarChart />\n\n return isDoubleBar ? (\n <DoubleBarChart\n bars={comparisonBars}\n boldLabel={boldLabel}\n colors={barColors}\n legendPosition=\"top\"\n legendVariant=\"body2\"\n legends={doubleBarLegends}\n onBarClick={selectBar}\n selectedIndex={selectedIndex}\n />\n ) : (\n <BarChartV2\n amounts={{\n average: instanceSlotData?.average_amount,\n formattedAverage: formatCurrency(\n instanceSlotData?.average_amount ?? 0,\n averageFormat ?? CURRENCY_FORMAT.cents,\n ),\n }}\n color={barColors[0] ?? theme.palette.primary.main}\n data={chartData}\n legendPosition=\"top\"\n // Figma's chart drawer: 172px of bars under the 24px legend, 200px in all.\n heightOverride={172}\n margin={{\n bottom: 8,\n top: 24,\n left: 24,\n right: 24,\n }}\n // TODO: Temporary fallback while the backend doesn't always send `legends` on every\n // beat/variant. Remove this once the backend guarantees `legends` on the payload.\n monthlyAmountLabel={\n barLegendLabel?.(insightsCopy) ?? mainLegend?.label ?? insightsCopy.general.monthly_amount\n }\n onBarClick={selectBar}\n selectedTabIndex={selectedIndex}\n showMonthlyAmount={showMonthlyAmount}\n trendAmountLabel={comparisonLegend?.label ?? insightsCopy.general.trend}\n />\n )\n }\n\n // `list` (Low Account Balance), `tabsOnly` (Non-Essential Category Summary) and `monthTabs`\n // (Monthly Subscription Aggregate) drawers have no chart above their transaction list.\n const chartTop =\n isDoubleBar || top === 'singleBar' || top === 'upcomingBill' ? renderChart() : null\n\n return (\n <>\n <TransactionDrillDown\n baseTransactions={baseTransactions}\n heading={headerContent?.heading}\n icon={headerContent?.icon}\n logo={headerContent?.logo}\n onSelectionChange={selectMonth}\n selectedIndex={selectedIndex}\n subHeadingText={headerContent?.subHeadingText}\n tabs={bars}\n top={chartTop}\n {...(sideTabs.length > 0 && {\n subTabs: { tabs: sideTabs, selectedIndex: subIndex, onChange: setSubIndex },\n })}\n {...(tipSection && {\n tipSection:\n !closeTipSection &&\n (tipSection(setCloseTipSection, insightsCopy, subHeader?.text, instanceSlotData) ??\n false),\n })}\n transactionFilter={transactionFilter}\n onEachRowClick={(guid) => {\n setActionContext({ transaction_guid: guid })\n setIsTransactionDetailsOpen(true)\n }}\n />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isTransactionDetailsOpen}\n onClose={() => {\n setIsTransactionDetailsOpen(false)\n // Clear only the key this nested drawer owns — setActionContext merges, so an\n // explicit `{}` would be a no-op and leave transaction_guid stuck in the shared\n // context, and the outer drawer's own context (e.g. chartBarIndex) must survive.\n setActionContext({ transaction_guid: undefined })\n // Re-apply this block's own filter: a further-nested AddMerchantBudgetAction drawer may\n // have overwritten transactionStore.filter (merchant_guid-only) without restoring it.\n applyCurrentSelectionFilter()\n }}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,KAAA,CAAgC,MAAqB,EAAK,eAE1D,KAA0B,GAAA,CAAU,EAAE,MAAA,GAAM,KAAA,EAAA,MAAkC;AACzF,QAAM,IAAQ,GAAS,GAEjB,EAAE,cAAA,GAAc,kBAAA,EAAA,IAAqB,GAAmB,GAExD,EAAE,kBAAA,EAAA,IAAqB,GAKvB,IAAY,GAAa,CAAI,GAC7B,IAAY,KAA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,GAGhD,EAA4B;AAAA,IAC9B;AAAA,IACA,OAAO,EAAa,QAAQ;AAAA,IAE5B,UAAA,gBAAA,EAAC,IAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,EAChC,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
|
|
@@ -81,6 +81,8 @@ export interface DrillDownVariantConfig {
|
|
|
81
81
|
subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[];
|
|
82
82
|
averageFormat?: CurrencyFormat;
|
|
83
83
|
boldLabel?: boolean;
|
|
84
|
+
barLegendLabel?: (copy: InsightsFeedCopy) => string | undefined;
|
|
85
|
+
showMonthlyAmount?: boolean;
|
|
84
86
|
title?: (copy: GlobalCopy, beat?: Beat) => string | undefined;
|
|
85
87
|
}
|
|
86
88
|
export declare const resolveUpcomingBillSlotData: SlotDataResolver;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { buildDynamicCopy as g } from "../../../core/utils/Localization.es.js";
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
2
|
+
import { DATE_FORMATS_INTL as y, formatDate as T } from "../../../core/constants/DateFormats.es.js";
|
|
3
3
|
import { TransactionStatus as F } from "../../../core/types/Transaction.es.js";
|
|
4
4
|
import { fromUnixUTC as L } from "../../../core/utils/DateUtil.es.js";
|
|
5
5
|
import { CURRENCY_FORMAT as x } from "../../../core/utils/NumberFormatting.es.js";
|
|
@@ -11,7 +11,7 @@ import B from "../../components/LogoMark.es.js";
|
|
|
11
11
|
import { calendarDateOf as z, toDrillDownSlotData as W } from "./utils.es.js";
|
|
12
12
|
import { Icon as R } from "@mxenabled/mx-icons";
|
|
13
13
|
import { jsx as i } from "react/jsx-runtime";
|
|
14
|
-
import { endOfMonth as
|
|
14
|
+
import { endOfMonth as C, fromUnixTime as j, isValid as E, parseISO as h, startOfMonth as D } from "date-fns";
|
|
15
15
|
var n = {
|
|
16
16
|
TRANSACTION: "not_standard_amount",
|
|
17
17
|
CATEGORY_SPEND: "category_spend",
|
|
@@ -30,7 +30,7 @@ var n = {
|
|
|
30
30
|
TOP_MERCHANT: "top_merchant"
|
|
31
31
|
}, G = (t) => t.insights_feed?.general?.transaction_history_title ?? "", d = (t, e) => e && V(e, t) || t.palette.primary.main, p = (t) => typeof t == "string" ? h(t) : new Date(t ?? NaN), v = (t) => ({
|
|
32
32
|
start: D(p(t)),
|
|
33
|
-
end:
|
|
33
|
+
end: C(p(t))
|
|
34
34
|
}), P = (t) => t?.length ? { accounts: t } : {}, K = ({ beat: t }) => {
|
|
35
35
|
const { account_guid: e, from_date: a, to_date: r } = t.insights_payload?.drilldown_data ?? {};
|
|
36
36
|
return typeof e != "string" || typeof a != "number" || typeof r != "number" || !Number.isFinite(a) || !Number.isFinite(r) || r <= a ? {
|
|
@@ -100,7 +100,7 @@ var n = {
|
|
|
100
100
|
value: 0
|
|
101
101
|
}))
|
|
102
102
|
};
|
|
103
|
-
},
|
|
103
|
+
}, w = (t, e) => H(l(e?.series)).flatMap((a) => a.aggregated_guids ?? []), tt = (t, e) => {
|
|
104
104
|
const a = e.transaction_history_block?.monthly_debt_to_income_tip_message, r = e.transaction_history_block?.monthly_debt_to_income_tip_limit;
|
|
105
105
|
if (!(!a || !r))
|
|
106
106
|
return {
|
|
@@ -113,16 +113,13 @@ var n = {
|
|
|
113
113
|
}, at = (t, e) => {
|
|
114
114
|
const a = e.transaction_history_block?.savings_to_income_tip_message, r = e.transaction_history_block?.savings_to_income_tip_percentage;
|
|
115
115
|
if (!(!a || !r))
|
|
116
|
-
return {
|
|
117
|
-
message: g(a, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ i("strong", { children: r })),
|
|
118
|
-
onDismiss: () => t(!0)
|
|
119
|
-
};
|
|
116
|
+
return { message: g(a, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ i("strong", { children: r })) };
|
|
120
117
|
}, rt = (t) => H(l(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), ot = (t, e, a, r) => {
|
|
121
118
|
const o = r?.merchant_name, s = r?.date;
|
|
122
119
|
if (!o || !s) return;
|
|
123
120
|
const _ = e.transaction_history_block?.upcoming_bill_tip_message;
|
|
124
121
|
if (_)
|
|
125
|
-
return { message: g(_, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), o, T(h(s),
|
|
122
|
+
return { message: g(_, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), o, T(h(s), y.FULL_MONTH_DAY)) };
|
|
126
123
|
}, M = ({ beatTransactions: t, dataSeries: e, selectedIndex: a }) => {
|
|
127
124
|
const r = e[a], o = r?.guid, s = t.find((_) => _.guid === o)?.has_been_split;
|
|
128
125
|
return {
|
|
@@ -143,22 +140,22 @@ var n = {
|
|
|
143
140
|
dateRange: v(o?.date),
|
|
144
141
|
...P(r.account_guids)
|
|
145
142
|
};
|
|
146
|
-
},
|
|
143
|
+
}, U = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
|
|
147
144
|
const r = a.merchant_guid, o = h(t[e]?.date ?? "");
|
|
148
|
-
return !r || !
|
|
145
|
+
return !r || !E(o) ? {
|
|
149
146
|
accounts: [],
|
|
150
147
|
custom: () => !1
|
|
151
148
|
} : {
|
|
152
149
|
custom: (s) => s.merchant_guid === r && !s.is_hidden,
|
|
153
150
|
dateRange: {
|
|
154
151
|
start: D(o),
|
|
155
|
-
end:
|
|
152
|
+
end: C(o)
|
|
156
153
|
}
|
|
157
154
|
};
|
|
158
155
|
}, it = (t) => typeof t == "number" ? j(t) : h(t ?? ""), ct = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: r, instanceSlotData: o }) => {
|
|
159
156
|
const s = e[a], { start: _, end: S } = v(s?.date), u = it(t.created_at), f = o.account_guids, I = {
|
|
160
157
|
start: _,
|
|
161
|
-
end: r &&
|
|
158
|
+
end: r && E(u) && u < S ? u : S
|
|
162
159
|
};
|
|
163
160
|
return f?.length ? {
|
|
164
161
|
dateRange: I,
|
|
@@ -170,18 +167,18 @@ var n = {
|
|
|
170
167
|
};
|
|
171
168
|
}, N = (t, e, a) => {
|
|
172
169
|
const r = new Set(t), o = h(e ?? "");
|
|
173
|
-
return !r.size || !
|
|
170
|
+
return !r.size || !E(o) ? {
|
|
174
171
|
accounts: [],
|
|
175
172
|
custom: () => !1
|
|
176
173
|
} : {
|
|
177
174
|
custom: (s) => r.has(s.guid),
|
|
178
175
|
dateRange: {
|
|
179
176
|
start: D(o),
|
|
180
|
-
end:
|
|
177
|
+
end: C(o)
|
|
181
178
|
},
|
|
182
179
|
...P(a)
|
|
183
180
|
};
|
|
184
|
-
}, _t = ({ beat: t, dataSeries: e, selectedIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids),
|
|
181
|
+
}, _t = ({ beat: t, dataSeries: e, selectedIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), b = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: r }) => {
|
|
185
182
|
const o = e[a];
|
|
186
183
|
return N(r === 1 ? o?.comparisonGuids : o?.mainGuids, o?.date, t.account_guids);
|
|
187
184
|
}, lt = ({ beat: t, dataSeries: e, subIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), dt = (t) => {
|
|
@@ -223,7 +220,7 @@ var n = {
|
|
|
223
220
|
colors: (t, e) => [d(t, e)],
|
|
224
221
|
header: (t) => ({
|
|
225
222
|
heading: t.categoryName,
|
|
226
|
-
subHeadingText: t.selectedDate && T(p(t.selectedDate),
|
|
223
|
+
subHeadingText: t.selectedDate && T(p(t.selectedDate), y.MONTH_LONG) || "",
|
|
227
224
|
icon: /* @__PURE__ */ i(R, {
|
|
228
225
|
color: "primary",
|
|
229
226
|
name: "calendar_month",
|
|
@@ -265,7 +262,9 @@ var n = {
|
|
|
265
262
|
colors: (t) => [t.palette.success.main],
|
|
266
263
|
slotData: Z,
|
|
267
264
|
fetchMissingTransactions: rt,
|
|
268
|
-
subTabs: ({ instanceSlotData: t }) => t.sub_tab_labels ?? []
|
|
265
|
+
subTabs: ({ instanceSlotData: t }) => t.sub_tab_labels ?? [],
|
|
266
|
+
barLegendLabel: (t) => t.general.deposit,
|
|
267
|
+
showMonthlyAmount: !1
|
|
269
268
|
},
|
|
270
269
|
[n.LOW_BALANCE]: {
|
|
271
270
|
top: "list",
|
|
@@ -283,14 +282,14 @@ var n = {
|
|
|
283
282
|
},
|
|
284
283
|
[n.MERCHANT_BUDGET]: {
|
|
285
284
|
top: "singleBar",
|
|
286
|
-
filterStrategy:
|
|
285
|
+
filterStrategy: U,
|
|
287
286
|
slotData: Q,
|
|
288
287
|
scope: "store",
|
|
289
288
|
filterMode: "store",
|
|
290
289
|
colors: (t) => [t.palette.chart.chart1 ?? t.palette.primary.main],
|
|
291
290
|
header: (t) => ({
|
|
292
291
|
heading: t.slotData?.merchant_name ?? t.title,
|
|
293
|
-
subHeadingText: t.selectedDate && T(p(t.selectedDate),
|
|
292
|
+
subHeadingText: t.selectedDate && T(p(t.selectedDate), y.MONTH_LONG) || "",
|
|
294
293
|
icon: /* @__PURE__ */ i(R, {
|
|
295
294
|
color: "primary",
|
|
296
295
|
name: "calendar_month",
|
|
@@ -300,13 +299,13 @@ var n = {
|
|
|
300
299
|
},
|
|
301
300
|
[n.TOP_MERCHANT]: {
|
|
302
301
|
top: "singleBar",
|
|
303
|
-
filterStrategy:
|
|
302
|
+
filterStrategy: U,
|
|
304
303
|
slotData: X,
|
|
305
304
|
scope: "store",
|
|
306
305
|
filterMode: "store",
|
|
307
306
|
colors: (t, e) => [d(t, e)],
|
|
308
307
|
header: ({ copy: t, slotData: e, title: a }) => {
|
|
309
|
-
const r = e?.merchant_name, o = t?.top_merchants, s = e?.described_month && T(p(e.described_month),
|
|
308
|
+
const r = e?.merchant_name, o = t?.top_merchants, s = e?.described_month && T(p(e.described_month), y.MONTH_SHORT_YEAR) || "";
|
|
310
309
|
return {
|
|
311
310
|
heading: r && o?.merchant_spending ? g(o.merchant_spending, r) : r ?? a,
|
|
312
311
|
subHeadingText: e?.rank && o?.most_visited_merchant ? g(o.most_visited_merchant, String(e.rank), s) : s,
|
|
@@ -323,7 +322,7 @@ var n = {
|
|
|
323
322
|
},
|
|
324
323
|
[n.SPEND_TO_INCOME]: {
|
|
325
324
|
top: "doubleBar",
|
|
326
|
-
filterStrategy:
|
|
325
|
+
filterStrategy: b,
|
|
327
326
|
scope: "store",
|
|
328
327
|
filterMode: "store",
|
|
329
328
|
colors: (t) => O(t, "spend_to_income")?.color ?? [],
|
|
@@ -332,7 +331,7 @@ var n = {
|
|
|
332
331
|
},
|
|
333
332
|
[n.COST_OF_LIVING]: {
|
|
334
333
|
top: "doubleBar",
|
|
335
|
-
filterStrategy:
|
|
334
|
+
filterStrategy: b,
|
|
336
335
|
scope: "store",
|
|
337
336
|
filterMode: "store",
|
|
338
337
|
colors: (t, e) => [d(t, e), t.palette.chart.chart4 ?? t.palette.primary.main],
|
|
@@ -341,26 +340,26 @@ var n = {
|
|
|
341
340
|
[n.DEBT_TO_INCOME]: {
|
|
342
341
|
title: (t) => t.insights_feed?.transaction_history_block?.monthly_debt_to_income_drawer_title ?? G(t),
|
|
343
342
|
top: "doubleBar",
|
|
344
|
-
filterStrategy:
|
|
343
|
+
filterStrategy: b,
|
|
345
344
|
scope: "store",
|
|
346
345
|
filterMode: "store",
|
|
347
346
|
colors: (t) => O(t, "debt_to_income")?.color ?? [],
|
|
348
347
|
boldLabel: !0,
|
|
349
348
|
subTabAriaLabels: (t) => [void 0, t.general.income_transactions],
|
|
350
349
|
slotData: Y,
|
|
351
|
-
fetchMissingTransactions:
|
|
350
|
+
fetchMissingTransactions: w,
|
|
352
351
|
tipSection: tt
|
|
353
352
|
},
|
|
354
353
|
[n.SAVINGS_TO_INCOME]: {
|
|
355
354
|
top: "doubleBar",
|
|
356
|
-
filterStrategy:
|
|
355
|
+
filterStrategy: b,
|
|
357
356
|
scope: "store",
|
|
358
357
|
filterMode: "store",
|
|
359
358
|
colors: (t) => O(t, "savings_to_income")?.color ?? [],
|
|
360
359
|
boldLabel: !0,
|
|
361
360
|
subTabAriaLabels: (t) => [t.general.savings_transactions, t.general.income_transactions],
|
|
362
361
|
slotData: et,
|
|
363
|
-
fetchMissingTransactions:
|
|
362
|
+
fetchMissingTransactions: w,
|
|
364
363
|
tipSection: at
|
|
365
364
|
},
|
|
366
365
|
[n.NON_ESSENTIAL_CATEGORY]: {
|
|
@@ -370,7 +369,7 @@ var n = {
|
|
|
370
369
|
filterMode: "store",
|
|
371
370
|
colors: (t) => [t.palette.primary.main]
|
|
372
371
|
}
|
|
373
|
-
},
|
|
372
|
+
}, Ct = {
|
|
374
373
|
top: "singleBar",
|
|
375
374
|
filterStrategy: M,
|
|
376
375
|
scope: "store",
|
|
@@ -379,7 +378,7 @@ var n = {
|
|
|
379
378
|
};
|
|
380
379
|
export {
|
|
381
380
|
n as DRILLDOWN_VARIANTS,
|
|
382
|
-
|
|
381
|
+
Ct as FALLBACK,
|
|
383
382
|
At as layout,
|
|
384
383
|
Y as resolveDebtToIncomeSlotData,
|
|
385
384
|
Z as resolveDepositSummarySlotData,
|