@mx-cartographer/experiences 9.7.196 → 9.7.197

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.
Files changed (23) hide show
  1. package/CHANGELOG.md +6 -1
  2. package/dist/insights/components/shared/Charts/BarChart/CustomBarPlotV2.d.ts +3 -1
  3. package/dist/insights/components/shared/Charts/BarChart/CustomBarPlotV2.es.js +29 -21
  4. package/dist/insights/components/shared/Charts/BarChart/CustomBarPlotV2.es.js.map +1 -1
  5. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +3 -1
  6. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +68 -63
  7. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  8. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +94 -91
  9. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  10. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -0
  11. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +7 -5
  12. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  13. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +59 -56
  14. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
  15. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.d.ts +1 -1
  16. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js +22 -11
  17. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js.map +1 -1
  18. package/dist/insights-v2/components/LogoClusterCard.es.js +9 -8
  19. package/dist/insights-v2/components/LogoClusterCard.es.js.map +1 -1
  20. package/dist/insights-v2/components/chartblocks/BarchartV2.d.ts +9 -1
  21. package/dist/insights-v2/components/chartblocks/BarchartV2.es.js +109 -85
  22. package/dist/insights-v2/components/chartblocks/BarchartV2.es.js.map +1 -1
  23. package/package.json +1 -1
@@ -1,111 +1,111 @@
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({
1
+ import { useGlobalCopyStore as Dt, useInsightsV2Store as Lt } from "../../../common/context/hooks.es.js";
2
+ import { CURRENCY_FORMAT as St, formatCurrency as vt } from "../../../core/utils/NumberFormatting.es.js";
3
+ import Bt from "../../../common/components/drawer/Drawer.es.js";
4
+ import { BAR_ARIA_LABEL as It } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
5
+ import { BarChartV2 as Et } from "../../components/chartblocks/BarchartV2.es.js";
6
+ import { EmptyBarChart as Rt } from "../../components/chartblocks/EmptyBarChart.es.js";
7
+ import { ANALYTICS_EVENTS_CONFIG as V } from "../../analytics/analyticsEventsConfig.es.js";
8
+ import { useAnalyticsEvent as xt } from "../../analytics/useAnalyticsEvent.es.js";
9
+ import { DoubleBarChart as Ft } from "../../components/chartblocks/DoubleBarChart.es.js";
10
+ import { toLegendItems as Ot } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
11
+ import { getDefaultSelection as wt, getDrillDownConfig as Ht, getFlattenedDataSeries as Gt, resolveDrillDownSubHeader as Mt, toStoreFilter as kt } from "./utils.es.js";
12
+ import { useOpenedCta as Nt } from "../useOpenedCta.es.js";
13
+ import { TransactionDrillDown as jt } from "./TransactionDrillDown.es.js";
14
+ import { useTransactionHistory as Vt } from "./useTransactionHistory.es.js";
15
+ import { TransactionDetailsBlock as Kt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
16
+ import { useRequiredCopy as Pt } from "../useRequiredCopy.es.js";
17
+ import { useLayoutEffect as zt, useState as d } from "react";
18
+ import { observer as Yt } from "mobx-react-lite";
19
+ import { Fragment as qt, jsx as l, jsxs as Ut } from "react/jsx-runtime";
20
+ import { useTheme as Wt } from "@mui/material/styles";
21
+ var $t = (a) => a.insights_feed, Ce = Yt(({ beat: a, cta: K }) => {
22
+ const _ = Wt(), { actionDrawer: P, setActionContext: A } = Lt(), { insights_payload: D } = a, z = Nt(a), L = K ?? z, Y = L?.variant, { top: e, filterMode: m, header: q, colors: U, filterStrategy: W, tipSection: S, subTabAriaLabels: $, slotData: J, averageFormat: Q, subTabs: X, boldLabel: Z, barLegendLabel: tt, showMonthlyAmount: et, showMonthTabs: ot = !0, showTransactionsHeader: at = !0 } = Ht(Y ?? ""), f = !ot && e === "singleBar", { instanceSlotData: o, beatTransactions: u, spendCategoryGuids: v, allAccountGuids: B, categoryName: nt, displayedDateRange: C, transactionStore: rt } = Vt(a, { slotData: J }, L?.drilldown_data), { common: st } = Dt(), n = Pt($t), [it, I] = d(!1), [lt, ct] = d(!1), E = xt(), { dataSeries: g, chartData: p, comparisonBars: i } = Gt({
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}" : St,
24
+ ariaLabel: e === "doubleBar" ? n?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : It,
25
25
  top: e,
26
26
  beatTransactions: u
27
- }), c = e === "doubleBar", it = e === "tabsOnly", i = c ? s : p, { chartBarIndex: E, subTabIndex: lt } = xt({
27
+ }), c = e === "doubleBar", dt = e === "tabsOnly", s = c ? i : p, { chartBarIndex: R, subTabIndex: mt } = wt({
28
28
  chartTabCount: p.length,
29
- comparisonTabCount: s.length,
30
- actionDrawer: K,
29
+ comparisonTabCount: i.length,
30
+ actionDrawer: P,
31
31
  beatGuid: a.guid
32
- }), [r, C] = d(E), [y, R] = d(lt), [ct, dt] = d(i.length);
33
- i.length !== ct && (dt(i.length), C(E));
34
- const x = (t) => U({
32
+ }), [r, y] = d(R), [T, x] = d(mt), [ut, gt] = d(s.length);
33
+ s.length !== ut && (gt(s.length), y(R));
34
+ const F = (t) => W({
35
35
  beat: a,
36
36
  beatTransactions: u,
37
37
  dataSeries: g,
38
- comparisonBars: s,
38
+ comparisonBars: i,
39
39
  selectedIndex: t,
40
- subIndex: y,
41
- isLastTab: t === i.length - 1,
40
+ subIndex: T,
41
+ isLastTab: t === s.length - 1,
42
42
  instanceSlotData: o,
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 = () => {
43
+ spendCategoryGuids: v,
44
+ displayedDateRange: C
45
+ }), pt = u.map((t) => t.guid).join(","), bt = v.join(","), ht = B.join(","), ft = e === "list" || e === "tabsOnly" || e === "monthTabs" || g.length > 0, O = () => {
46
46
  if (m !== "store") return;
47
- const t = pt ? x(r) : {
47
+ const t = ft ? F(r) : {
48
48
  accounts: [],
49
49
  custom: () => !1
50
50
  };
51
- ot.setFilter(Gt(t, {
52
- allAccountGuids: v,
53
- displayedDateRange: f
51
+ rt.setFilter(kt(t, {
52
+ allAccountGuids: B,
53
+ displayedDateRange: C
54
54
  }));
55
55
  };
56
- Vt(() => {
57
- F();
56
+ zt(() => {
57
+ O();
58
58
  }, [
59
59
  a.guid,
60
60
  r,
61
- y,
61
+ T,
62
62
  m,
63
63
  g.length,
64
64
  o,
65
- f,
66
- ut,
67
- gt,
68
- mt,
65
+ C,
66
+ bt,
67
+ ht,
68
+ pt,
69
69
  e
70
70
  ]);
71
- const O = wt(A), b = Y?.({
72
- title: A?.title,
73
- subHeader: O,
74
- categoryName: et,
71
+ const w = Mt(D), b = q?.({
72
+ title: D?.title,
73
+ subHeader: w,
74
+ categoryName: nt,
75
75
  selectedDate: p[r]?.date ?? void 0,
76
76
  slotData: o,
77
77
  copy: n
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([{
78
+ }), H = U(_, o?.category_guid), [G, M] = o?.legends ?? [], Ct = m === "local" ? (t) => F(t).custom ?? (() => !0) : void 0, yt = m === "local" ? u : void 0, k = (t, h) => {
79
+ E(V.DRAWER_CHART_BAR_CLICKED), y(t), h !== void 0 && x(h);
80
+ }, Tt = (t) => {
81
+ E(V.TAB_SELECTED), y(t);
82
+ }, N = c ? Ot([{
83
83
  ...G,
84
- value: s[r]?.main
84
+ value: i[r]?.main
85
85
  }, {
86
- ...H,
87
- value: s[r]?.comparison
88
- }]) : void 0, Ct = W?.(n) ?? [], j = c ? (N ?? []).map((t, h) => ({
86
+ ...M,
87
+ value: i[r]?.comparison
88
+ }]) : void 0, _t = $?.(n) ?? [], j = c ? (N ?? []).map((t, h) => ({
89
89
  label: t.label,
90
- ariaLabel: Ct[h]
91
- })) : it ? g.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : Q?.({
90
+ ariaLabel: _t[h]
91
+ })) : dt ? g.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : X?.({
92
92
  instanceSlotData: o,
93
93
  copy: n
94
- }).map((t) => ({ label: t })) ?? [], yt = c || e === "singleBar" || e === "upcomingBill" ? i.length ? c ? /* @__PURE__ */ l(Et, {
95
- bars: s,
96
- boldLabel: X,
97
- colors: w,
94
+ }).map((t) => ({ label: t })) ?? [], At = c || e === "singleBar" || e === "upcomingBill" ? s.length ? c ? /* @__PURE__ */ l(Ft, {
95
+ bars: i,
96
+ boldLabel: Z,
97
+ colors: H,
98
98
  legendPosition: "top",
99
99
  legendVariant: "body2",
100
100
  legends: N,
101
- onBarClick: M,
101
+ onBarClick: k,
102
102
  selectedIndex: r
103
- }) : /* @__PURE__ */ l(vt, {
103
+ }) : /* @__PURE__ */ l(Et, {
104
104
  amounts: {
105
105
  average: o?.average_amount,
106
- formattedAverage: Dt(o?.average_amount ?? 0, J ?? At.cents)
106
+ formattedAverage: vt(o?.average_amount ?? 0, Q ?? St.cents)
107
107
  },
108
- color: w[0] ?? _.palette.primary.main,
108
+ color: H[0] ?? _.palette.primary.main,
109
109
  data: p,
110
110
  legendPosition: "top",
111
111
  heightOverride: 172,
@@ -115,45 +115,48 @@ var qt = (a) => a.insights_feed, be = Kt(({ beat: a, cta: V }) => {
115
115
  left: 24,
116
116
  right: 24
117
117
  },
118
- monthlyAmountLabel: Z?.(n) ?? G?.label ?? n.general.monthly_amount,
119
- onBarClick: M,
118
+ monthlyAmountLabel: tt?.(n) ?? G?.label ?? n.general.monthly_amount,
119
+ keyboardSelectable: f,
120
+ onBarClick: k,
120
121
  selectedTabIndex: r,
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,
122
+ showMonthlyAmount: et,
123
+ trendAmountLabel: M?.label ?? n.general.trend
124
+ }) : /* @__PURE__ */ l(Rt, {}) : null;
125
+ return /* @__PURE__ */ Ut(qt, { children: [/* @__PURE__ */ l(jt, {
126
+ baseTransactions: yt,
126
127
  heading: b?.heading,
127
128
  icon: b?.icon,
128
129
  logo: b?.logo,
129
- onSelectionChange: ft,
130
+ onSelectionChange: Tt,
130
131
  selectedIndex: r,
131
132
  subHeadingText: b?.subHeadingText,
132
- tabs: i,
133
- top: yt,
133
+ showTransactionsHeader: at,
134
+ tabs: f ? void 0 : s,
135
+ ...f && { listLabel: s[r]?.label },
136
+ top: At,
134
137
  ...j.length > 0 && { subTabs: {
135
138
  tabs: j,
136
- selectedIndex: y,
137
- onChange: R
139
+ selectedIndex: T,
140
+ onChange: x
138
141
  } },
139
- ...L && { tipSection: !rt && (L(st, n, O?.text, o) ?? !1) },
140
- transactionFilter: bt,
142
+ ...S && { tipSection: !lt && (S(ct, n, w?.text, o) ?? !1) },
143
+ transactionFilter: Ct,
141
144
  onEachRowClick: (t) => {
142
- T({ transaction_guid: t }), B(!0);
145
+ A({ transaction_guid: t }), I(!0);
143
146
  }
144
- }), /* @__PURE__ */ l(Lt, {
145
- ariaLabelClose: at.close_aria,
146
- isOpen: nt,
147
+ }), /* @__PURE__ */ l(Bt, {
148
+ ariaLabelClose: st.close_aria,
149
+ isOpen: it,
147
150
  onClose: () => {
148
- B(!1), T({ transaction_guid: void 0 }), F();
151
+ I(!1), A({ transaction_guid: void 0 }), O();
149
152
  },
150
153
  title: n.general.transaction_details_title,
151
- children: /* @__PURE__ */ l(jt, { beat: a })
154
+ children: /* @__PURE__ */ l(Kt, { beat: a })
152
155
  })] });
153
156
  });
154
157
  export {
155
- be as TransactionHistoryBlock,
156
- qt as selectTransactionHistoryCopy
158
+ Ce as TransactionHistoryBlock,
159
+ $t as selectTransactionHistoryCopy
157
160
  };
158
161
 
159
162
  //# sourceMappingURL=TransactionHistoryBlock.es.js.map
@@ -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 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,KAAO,GACnB,IAAoB,GAAW,SAE/B,EACJ,KAAA,GACA,YAAA,GACA,QAAA,GACA,QAAA,GACA,gBAAA,GACA,YAAA,GACA,kBAAA,GACA,UAAA,GACA,eAAA,GACA,SAAA,GACA,WAAA,GACA,gBAAA,GACA,mBAAA,GAAA,IACE,GAAmB,KAAqB,EAAE,GAExC,EACJ,kBAAA,GACA,kBAAA,GACA,oBAAA,GACA,iBAAA,GACA,cAAA,IACA,oBAAA,GACA,kBAAA,GAAA,IACE,GAAsB,GAAM,EAAE,UAAA,EAAS,GAAG,GAAW,cAAc,GAEjE,EAAE,QAAQ,GAAA,IAAe,GAAmB,GAC5C,IAAe,GAAgB,EAA4B,GAE3D,CAAC,IAA0B,CAAA,IAA+B,EAAS,EAAK,GAExE,CAAC,IAAiB,EAAA,IAAsB,EAAS,EAAK,GAEtD,IAAqB,GAAkB,GAEvC,EAAE,YAAA,GAAY,WAAA,GAAW,gBAAA,EAAA,IAAmB,GAAuB;AAAA,IACvE,MAAM,GAAkB;AAAA,IACxB,WACE,MAAQ,cACH,GAAc,SAAS,yCAAA,wCAExB;AAAA,IACN,KAAA;AAAA,IACA,kBAAA;AAAA,EACF,CAAC,GAEK,IAAc,MAAQ,aACtB,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;AAAA,MAAE,MAAM;AAAA,MAAU,eAAe;AAAA,MAAU,UAAU;AAAA,IAAY,EAC5E;AAAA,IACA,GAAK,KAAc,EACjB,YACE,CAAC,OACA,EAAW,IAAoB,GAAc,GAAW,MAAM,CAAgB,KAC7E,IACN;AAAA,IACmB,mBAAA;AAAA,IACnB,gBAAA,CAAiB,MAAS;AACxB,MAAA,EAAiB,EAAE,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 showMonthTabs = true,\n showTransactionsHeader = true,\n } = getDrillDownConfig(dynamicCtaVariant ?? '')\n // Only a single-bar chart can stand in for the month tabs (its bars take the keyboard).\n const barsPickMonth = !showMonthTabs && top === 'singleBar'\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 keyboardSelectable={barsPickMonth}\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 showTransactionsHeader={showTransactionsHeader}\n tabs={barsPickMonth ? undefined : bars}\n {...(barsPickMonth && { listLabel: bars[selectedIndex]?.label })}\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,KAAO,GACnB,IAAoB,GAAW,SAE/B,EACJ,KAAA,GACA,YAAA,GACA,QAAA,GACA,QAAA,GACA,gBAAA,GACA,YAAA,GACA,kBAAA,GACA,UAAA,GACA,eAAA,GACA,SAAA,GACA,WAAA,GACA,gBAAA,IACA,mBAAA,IACA,eAAA,KAAgB,IAChB,wBAAA,KAAyB,GAAA,IACvB,GAAmB,KAAqB,EAAE,GAExC,IAAgB,CAAC,MAAiB,MAAQ,aAE1C,EACJ,kBAAA,GACA,kBAAA,GACA,oBAAA,GACA,iBAAA,GACA,cAAA,IACA,oBAAA,GACA,kBAAA,GAAA,IACE,GAAsB,GAAM,EAAE,UAAA,EAAS,GAAG,GAAW,cAAc,GAEjE,EAAE,QAAQ,GAAA,IAAe,GAAmB,GAC5C,IAAe,GAAgB,EAA4B,GAE3D,CAAC,IAA0B,CAAA,IAA+B,EAAS,EAAK,GAExE,CAAC,IAAiB,EAAA,IAAsB,EAAS,EAAK,GAEtD,IAAqB,GAAkB,GAEvC,EAAE,YAAA,GAAY,WAAA,GAAW,gBAAA,EAAA,IAAmB,GAAuB;AAAA,IACvE,MAAM,GAAkB;AAAA,IACxB,WACE,MAAQ,cACH,GAAc,SAAS,yCAAA,wCAExB;AAAA,IACN,KAAA;AAAA,IACA,k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AA;AAAA,IACxB,MAAM,IAAgB,SAAY;AAAA,IAClC,GAAK,KAAiB,EAAE,WAAW,EAAK,CAAA,GAAgB,MAAM;AAAA,IAC9D,KAAK;AAAA,IACL,GAAK,EAAS,SAAS,KAAK,EAC1B,SAAS;AAAA,MAAE,MAAM;AAAA,MAAU,eAAe;AAAA,MAAU,UAAU;AAAA,IAAY,EAC5E;AAAA,IACA,GAAK,KAAc,EACjB,YACE,CAAC,OACA,EAAW,IAAoB,GAAc,GAAW,MAAM,CAAgB,KAC7E,IACN;AAAA,IACmB,mBAAA;AAAA,IACnB,gBAAA,CAAiB,MAAS;AACxB,MAAA,EAAiB,EAAE,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"}
@@ -83,6 +83,8 @@ export interface DrillDownVariantConfig {
83
83
  boldLabel?: boolean;
84
84
  barLegendLabel?: (copy: InsightsFeedCopy) => string | undefined;
85
85
  showMonthlyAmount?: boolean;
86
+ showMonthTabs?: boolean;
87
+ showTransactionsHeader?: boolean;
86
88
  title?: (copy: GlobalCopy, beat?: Beat) => string | undefined;
87
89
  }
88
90
  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 y, formatDate as T } from "../../../core/constants/DateFormats.es.js";
2
+ import { DATE_FORMATS_INTL as T, formatDate as y } 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";
@@ -119,7 +119,7 @@ var n = {
119
119
  if (!o || !s) return;
120
120
  const _ = e.transaction_history_block?.upcoming_bill_tip_message;
121
121
  if (_)
122
- return { message: g(_, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), o, T(h(s), y.FULL_MONTH_DAY)) };
122
+ return { message: g(_, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), o, y(h(s), T.FULL_MONTH_DAY)) };
123
123
  }, M = ({ beatTransactions: t, dataSeries: e, selectedIndex: a }) => {
124
124
  const r = e[a], o = r?.guid, s = t.find((_) => _.guid === o)?.has_been_split;
125
125
  return {
@@ -220,7 +220,7 @@ var n = {
220
220
  colors: (t, e) => [d(t, e)],
221
221
  header: (t) => ({
222
222
  heading: t.categoryName,
223
- subHeadingText: t.selectedDate && T(p(t.selectedDate), y.MONTH_LONG) || "",
223
+ subHeadingText: t.selectedDate && y(p(t.selectedDate), T.MONTH_LONG) || "",
224
224
  icon: /* @__PURE__ */ i(R, {
225
225
  color: "primary",
226
226
  name: "calendar_month",
@@ -289,7 +289,7 @@ var n = {
289
289
  colors: (t) => [t.palette.chart.chart1 ?? t.palette.primary.main],
290
290
  header: (t) => ({
291
291
  heading: t.slotData?.merchant_name ?? t.title,
292
- subHeadingText: t.selectedDate && T(p(t.selectedDate), y.MONTH_LONG) || "",
292
+ subHeadingText: t.selectedDate && y(p(t.selectedDate), T.MONTH_LONG) || "",
293
293
  icon: /* @__PURE__ */ i(R, {
294
294
  color: "primary",
295
295
  name: "calendar_month",
@@ -299,13 +299,15 @@ var n = {
299
299
  },
300
300
  [n.TOP_MERCHANT]: {
301
301
  top: "singleBar",
302
+ showMonthTabs: !1,
303
+ showTransactionsHeader: !1,
302
304
  filterStrategy: U,
303
305
  slotData: X,
304
306
  scope: "store",
305
307
  filterMode: "store",
306
308
  colors: (t, e) => [d(t, e)],
307
309
  header: ({ copy: t, slotData: e, title: a }) => {
308
- const r = e?.merchant_name, o = t?.top_merchants, s = e?.described_month && T(p(e.described_month), y.MONTH_SHORT_YEAR) || "";
310
+ const r = e?.merchant_name, o = t?.top_merchants, s = e?.described_month && y(p(e.described_month), T.MONTH_SHORT_YEAR) || "";
309
311
  return {
310
312
  heading: r && o?.merchant_spending ? g(o.merchant_spending, r) : r ?? a,
311
313
  subHeadingText: e?.rank && o?.most_visited_merchant ? g(o.most_visited_merchant, String(e.rank), s) : s,