@mx-cartographer/experiences 9.7.174 → 9.7.175

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 (27) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/core/types/localization/InsightsFeedCopy.d.ts +20 -0
  3. package/dist/core/types/localization/index.d.ts +1 -1
  4. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.d.ts +11 -0
  5. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js +164 -0
  6. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js.map +1 -0
  7. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/index.d.ts +1 -0
  8. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.d.ts +46 -0
  9. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.es.js +58 -0
  10. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.es.js.map +1 -0
  11. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +2 -1
  12. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +72 -56
  13. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.d.ts +7 -1
  15. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +84 -82
  16. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +4 -0
  18. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +169 -133
  19. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  20. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +2 -0
  21. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
  22. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  23. package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
  24. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  25. package/dist/insights-v2/mappings/blocks.es.js +148 -140
  26. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  27. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionDrillDown.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\nimport { observer } from 'mobx-react-lite'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, Text } from '@mxenabled/mxui'\n\nimport {\n TipSection,\n type TipSectionProps,\n} from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { useGlobalCopyStore, useTransactionStore } from '../../../common'\nimport type { Transaction } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\nimport { TransactionList } from '../../../transactions'\nimport { SubTabs, subTabPanelProps, type SubTabsProps } from '../../components/SubTabs'\n\ninterface TabItem {\n label: string\n ariaLabel?: string\n}\n\nconst PANEL_ID = 'transaction-drill-down-panel'\nconst tabId = (index: number) => `transaction-details-tab-${index}`\nconst SUB_TABS_ID = 'transaction-drill-down-series'\n\ninterface TransactionDrillDownProps {\n ariaLabel?: string\n heading?: string\n subHeadingText?: string\n icon?: React.ReactNode\n tabs?: TabItem[]\n selectedIndex: number\n top: React.ReactNode\n tipSection?: TipSectionProps | false\n onSelectionChange?: (selectedIndex: number) => void\n onEachRowClick?: (guid: string) => void\n transactionFilter?: (selectedIndex: number) => (transaction: Transaction) => boolean\n baseTransactions?: Transaction[]\n // A second row of tabs between the chart and the list (the double-bar drawer's main / comparison\n // series, e.g. Spend / Income). Omitted for every single-series drawer.\n subTabs?: Omit<SubTabsProps, 'id'>\n}\n\nexport const TransactionDrillDown = observer(function TransactionDrillDown({\n ariaLabel,\n heading,\n subHeadingText,\n icon,\n tabs,\n selectedIndex,\n top,\n onSelectionChange,\n transactionFilter,\n tipSection,\n onEachRowClick,\n baseTransactions,\n subTabs,\n}: TransactionDrillDownProps) {\n const { transactions: transactionsCopy } = useGlobalCopyStore()\n const { sortedTransactionsWithSplits, tags, detailedTransactions } = useTransactionStore()\n\n const hasTabs = !!tabs?.length\n // Only a non-empty row gets the tabs and their panel.\n const seriesTabs = subTabs?.tabs.length ? subTabs : undefined\n const tablistLabel = ariaLabel ?? transactionsCopy.transactions_title\n\n const handlePrimaryChange = (_event: React.SyntheticEvent, newValue: number) => {\n onSelectionChange?.(newValue)\n }\n\n const filteredTransactions = transactionFilter\n ? (baseTransactions ?? detailedTransactions).filter(transactionFilter(selectedIndex))\n : undefined\n\n const exportTransactions = filteredTransactions ?? sortedTransactionsWithSplits\n\n return (\n <Box sx={{ bgcolor: 'background.paper', width: '100%' }}>\n {hasTabs && (\n <Tabs\n aria-label={tablistLabel}\n onChange={handlePrimaryChange}\n // The title sits 16px below the tab bar, as in every Figma chart drawer; the theme's 8px\n // gap under Tabs would make it 24.\n sx={{ mb: 0 }}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs!.map((tab, index) => (\n <Tab\n aria-controls={PANEL_ID}\n aria-label={tab.ariaLabel}\n id={tabId(index)}\n key={`${tab.label}-${index}`}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )}\n\n <Box\n aria-labelledby={hasTabs ? tabId(selectedIndex) : undefined}\n id={PANEL_ID}\n role={hasTabs ? 'tabpanel' : undefined}\n >\n {(heading || subHeadingText) && (\n <Stack sx={{ gap: 4, pt: 16, px: 24 }}>\n {heading && <H3>{heading}</H3>}\n {subHeadingText && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {icon}\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.52px' }}\n textTransform=\"uppercase\"\n variant=\"body2\"\n >\n {subHeadingText}\n </Text>\n </Stack>\n )}\n </Stack>\n )}\n\n {/* Figma's chart drawer pads the chart 16px above and below; a drawer with no chart has no box. */}\n {top && <Box sx={{ pb: 16, pt: 16 }}>{top}</Box>}\n\n {/* Every Figma chart drawer puts the tip under the chart, above any sub-tabs. */}\n {tipSection && <TipSection icon={DRAWER_TIP_ICON} {...tipSection} />}\n\n {seriesTabs && <SubTabs {...seriesTabs} id={SUB_TABS_ID} />}\n\n {/* The content the sub-tabs control, as the month tabs' panel above. */}\n <Box {...(seriesTabs && subTabPanelProps(SUB_TABS_ID, seriesTabs.selectedIndex))}>\n <Stack\n sx={{\n alignItems: 'center',\n borderBottomColor: 'divider',\n borderBottomStyle: 'solid',\n borderBottomWidth: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 4,\n pt: 16,\n px: 24,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {transactionsCopy.transactions_title}\n </Text>\n {exportTransactions.length > 0 && (\n <Button\n onClick={() => {\n exportTransactionsToCSV(exportTransactions, tags)\n }}\n startIcon={<Icon name=\"ios_share\" />}\n sx={{ height: 28 }}\n >\n <Text bold={true} variant=\"body2\">\n {transactionsCopy.export_csv_btn}\n </Text>\n </Button>\n )}\n </Stack>\n\n {/* The list's scroll box is taller than its rows; Figma fills the space below the last row\n with background.default, and each row paints its own paper. */}\n <Box sx={{ bgcolor: 'background.default' }}>\n <TransactionList transaction={filteredTransactions} onClick={onEachRowClick} />\n </Box>\n </Box>\n </Box>\n </Box>\n )\n})\n\nexport default TransactionDrillDown\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,IAAM,IAAW,gCACX,I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AA,YAXF,UAAA,CAaE,gBAAA,EAAC,GAAD;AAAA,cAAM,MAAM;AAAA,cAAM,SAAQ;AAAA,cACvB,UAAA,EAAiB;AAAA,YACd,CAAA,GACL,EAAmB,SAAS,KAC3B,gBAAA,EAAC,GAAD;AAAA,cACE,SAAA,MAAe;AACb,gBAAA,EAAwB,GAAoB,CAAI;AAAA,cAClD;AAAA,cACA,WAAW,gBAAA,EAAC,GAAD,EAAM,MAAK,YAAa,CAAA;AAAA,cACnC,IAAI,EAAE,QAAQ,GAAG;AAAA,cAEjB,UAAA,gBAAA,EAAC,GAAD;AAAA,gBAAM,MAAM;AAAA,gBAAM,SAAQ;AAAA,gBACvB,UAAA,EAAiB;AAAA,cACd,CAAA;AAAA,YACA,CAAA,CAEL;AAAA,UAIP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,YAAK,IAAI,EAAE,SAAS,qBAAqB;AAAA,YACvC,UAAA,gBAAA,EAAC,GAAD;AAAA,cAAiB,aAAa;AAAA,cAAsB,SAAS;AAAA,YAAiB,CAAA;AAAA,UAC3E,CAAA,CACF;AAAA;MACF;AAAA,IACF,CAAA,CAAA;AAAA;AAET,CAAC"}
1
+ {"version":3,"file":"TransactionDrillDown.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\nimport { observer } from 'mobx-react-lite'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, Text } from '@mxenabled/mxui'\n\nimport {\n TipSection,\n type TipSectionProps,\n} from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { useGlobalCopyStore, useTransactionStore } from '../../../common'\nimport type { Transaction } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\nimport { TransactionList } from '../../../transactions'\nimport { SubTabs, subTabPanelProps, type SubTabsProps } from '../../components/SubTabs'\n\ninterface TabItem {\n label: string\n ariaLabel?: string\n}\n\nconst PANEL_ID = 'transaction-drill-down-panel'\nconst tabId = (index: number) => `transaction-details-tab-${index}`\nconst SUB_TABS_ID = 'transaction-drill-down-series'\n\ninterface TransactionDrillDownProps {\n ariaLabel?: string\n heading?: string\n subHeadingText?: string\n icon?: React.ReactNode\n // A logo left of the heading and sub-heading (Top Merchant's merchant, Figma `<Logo>` 40px).\n logo?: React.ReactNode\n tabs?: TabItem[]\n selectedIndex: number\n top: React.ReactNode\n tipSection?: TipSectionProps | false\n onSelectionChange?: (selectedIndex: number) => void\n onEachRowClick?: (guid: string) => void\n transactionFilter?: (selectedIndex: number) => (transaction: Transaction) => boolean\n baseTransactions?: Transaction[]\n // A second row of tabs between the chart and the list (the double-bar drawer's main / comparison\n // series, e.g. Spend / Income). Omitted for every single-series drawer.\n subTabs?: Omit<SubTabsProps, 'id'>\n}\n\nexport const TransactionDrillDown = observer(function TransactionDrillDown({\n ariaLabel,\n heading,\n subHeadingText,\n icon,\n logo,\n tabs,\n selectedIndex,\n top,\n onSelectionChange,\n transactionFilter,\n tipSection,\n onEachRowClick,\n baseTransactions,\n subTabs,\n}: TransactionDrillDownProps) {\n const { transactions: transactionsCopy } = useGlobalCopyStore()\n const { sortedTransactionsWithSplits, tags, detailedTransactions } = useTransactionStore()\n\n const hasTabs = !!tabs?.length\n // Only a non-empty row gets the tabs and their panel.\n const seriesTabs = subTabs?.tabs.length ? subTabs : undefined\n const tablistLabel = ariaLabel ?? transactionsCopy.transactions_title\n\n const handlePrimaryChange = (_event: React.SyntheticEvent, newValue: number) => {\n onSelectionChange?.(newValue)\n }\n\n const filteredTransactions = transactionFilter\n ? (baseTransactions ?? detailedTransactions).filter(transactionFilter(selectedIndex))\n : undefined\n\n const exportTransactions = filteredTransactions ?? sortedTransactionsWithSplits\n\n return (\n <Box sx={{ bgcolor: 'background.paper', width: '100%' }}>\n {hasTabs && (\n <Tabs\n aria-label={tablistLabel}\n onChange={handlePrimaryChange}\n // The title sits 16px below the tab bar, as in every Figma chart drawer; the theme's 8px\n // gap under Tabs would make it 24.\n sx={{ mb: 0 }}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs!.map((tab, index) => (\n <Tab\n aria-controls={PANEL_ID}\n aria-label={tab.ariaLabel}\n id={tabId(index)}\n key={`${tab.label}-${index}`}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )}\n\n <Box\n aria-labelledby={hasTabs ? tabId(selectedIndex) : undefined}\n id={PANEL_ID}\n role={hasTabs ? 'tabpanel' : undefined}\n >\n {(heading || subHeadingText) && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12, pt: 16, px: 24 }}>\n {logo && (\n <Box aria-hidden={true} sx={{ display: 'flex', flexShrink: 0 }}>\n {logo}\n </Box>\n )}\n <Stack sx={{ flexGrow: 1, gap: 4, minWidth: 0 }}>\n {heading && <H3>{heading}</H3>}\n {subHeadingText && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {icon}\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.52px' }}\n textTransform=\"uppercase\"\n variant=\"body2\"\n >\n {subHeadingText}\n </Text>\n </Stack>\n )}\n </Stack>\n </Stack>\n )}\n\n {/* Figma's chart drawer pads the chart 16px above and below; a drawer with no chart has no box. */}\n {top && <Box sx={{ pb: 16, pt: 16 }}>{top}</Box>}\n\n {/* Every Figma chart drawer puts the tip under the chart, above any sub-tabs. */}\n {tipSection && <TipSection icon={DRAWER_TIP_ICON} {...tipSection} />}\n\n {seriesTabs && <SubTabs {...seriesTabs} id={SUB_TABS_ID} />}\n\n {/* The content the sub-tabs control, as the month tabs' panel above. */}\n <Box {...(seriesTabs && subTabPanelProps(SUB_TABS_ID, seriesTabs.selectedIndex))}>\n <Stack\n sx={{\n alignItems: 'center',\n borderBottomColor: 'divider',\n borderBottomStyle: 'solid',\n borderBottomWidth: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 4,\n pt: 16,\n px: 24,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {transactionsCopy.transactions_title}\n </Text>\n {exportTransactions.length > 0 && (\n <Button\n onClick={() => {\n exportTransactionsToCSV(exportTransactions, tags)\n }}\n startIcon={<Icon name=\"ios_share\" />}\n sx={{ height: 28 }}\n >\n <Text bold={true} variant=\"body2\">\n {transactionsCopy.export_csv_btn}\n </Text>\n </Button>\n )}\n </Stack>\n\n {/* The list's scroll box is taller than its rows; Figma fills the space below the last row\n with background.default, and each row paints its own paper. */}\n <Box sx={{ bgcolor: 'background.default' }}>\n <TransactionList transaction={filteredTransactions} onClick={onEachRowClick} />\n </Box>\n </Box>\n </Box>\n </Box>\n )\n})\n\nexport default TransactionDrillDown\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,IAAM,IAAW,gCACX,IAAA,CAAS,MAAkB,2BAA2B,CAAA,IACtD,IAAc,iCAsBP,KAAuB,EAAS,SAA8B,EACzE,WAAA,GACA,SAAA,GACA,gBAAA,GACA,MAAA,GACA,MAAA,GACA,MAAA,GACA,eAAA,GACA,KAAA,GACA,mBAAA,GACA,mBAAA,GACA,YAAA,GACA,gBAAA,GACA,kBAAA,GACA,SAAA,EAAA,GAC4B;AAC5B,QAAM,EAAE,cAAc,EAAA,IAAqB,EAAmB,GACxD,EAAE,8BAAA,GAA8B,MAAA,GAAM,sBAAA,EAAA,IAAyB,EAAoB,GAEnF,IAAU,CAAC,CAAC,GAAM,QAElB,IAAa,GAAS,KAAK,SAAS,IAAU,QAC9C,IAAe,KAAa,EAAiB,oBAE7C,IAAA,CAAuB,GAA8B,MAAqB;AAC9E,IAAA,IAAoB,CAAQ;AAAA,EAC9B,GAEM,IAAuB,KACxB,KAAoB,GAAsB,OAAO,EAAkB,CAAa,CAAC,IAClF,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AAA,cACA,WAAW,gBAAA,EAAC,GAAD,EAAM,MAAK,YAAa,CAAA;AAAA,cACnC,IAAI,EAAE,QAAQ,GAAG;AAAA,cAEjB,UAAA,gBAAA,EAAC,GAAD;AAAA,gBAAM,MAAM;AAAA,gBAAM,SAAQ;AAAA,gBACvB,UAAA,EAAiB;AAAA,cACd,CAAA;AAAA,YACA,CAAA,CAEL;AAAA,UAIP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,YAAK,IAAI,EAAE,SAAS,qBAAqB;AAAA,YACvC,UAAA,gBAAA,EAAC,GAAD;AAAA,cAAiB,aAAa;AAAA,cAAsB,SAAS;AAAA,YAAiB,CAAA;AAAA,UAC3E,CAAA,CACF;AAAA;MACF;AAAA,IACF,CAAA,CAAA;AAAA;AAET,CAAC"}
@@ -1,9 +1,15 @@
1
1
  import { Beat, GlobalCopy } from '../../../core';
2
+ import { OpenedCta } from '../util';
2
3
  interface TransactionHistoryProp {
3
4
  beat: Beat;
5
+ /**
6
+ * The CTA to draw, for a drawer nested inside another block's drawer (Top Merchants → Merchant
7
+ * History). Absent: the CTA that opened the beat's drawer.
8
+ */
9
+ cta?: OpenedCta;
4
10
  }
5
11
  export declare const selectTransactionHistoryCopy: (copy: GlobalCopy) => import('../../../core').InsightsFeedCopy;
6
- export declare const TransactionHistoryBlock: (({ beat }: TransactionHistoryProp) => import("react/jsx-runtime").JSX.Element) & {
12
+ export declare const TransactionHistoryBlock: (({ beat, cta }: TransactionHistoryProp) => import("react/jsx-runtime").JSX.Element) & {
7
13
  displayName: string;
8
14
  };
9
15
  export {};
@@ -1,109 +1,110 @@
1
- import { useGlobalCopyStore as ft, useInsightsV2Store as ht } from "../../../common/context/hooks.es.js";
2
- import { CURRENCY_FORMAT as Ct, formatCurrency as _t } from "../../../core/utils/NumberFormatting.es.js";
3
- import yt from "../../../common/components/drawer/Drawer.es.js";
4
- import { BAR_ARIA_LABEL as Tt } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
5
- import { BarChartV2 as At } from "../../components/chartblocks/BarchartV2.es.js";
6
- import { EmptyBarChart as Dt } from "../../components/chartblocks/EmptyBarChart.es.js";
1
+ import { useGlobalCopyStore as Ct, useInsightsV2Store as yt } from "../../../common/context/hooks.es.js";
2
+ import { CURRENCY_FORMAT as _t, formatCurrency as Tt } from "../../../core/utils/NumberFormatting.es.js";
3
+ import At from "../../../common/components/drawer/Drawer.es.js";
4
+ import { BAR_ARIA_LABEL as Dt } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
5
+ import { BarChartV2 as St } from "../../components/chartblocks/BarchartV2.es.js";
6
+ import { EmptyBarChart as vt } from "../../components/chartblocks/EmptyBarChart.es.js";
7
7
  import { ANALYTICS_EVENTS_CONFIG as M } from "../../analytics/analyticsEventsConfig.es.js";
8
- import { useAnalyticsEvent as St } from "../../analytics/useAnalyticsEvent.es.js";
9
- import { DoubleBarChart as vt } from "../../components/chartblocks/DoubleBarChart.es.js";
10
- import { toLegendItems as Bt } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
11
- import { getDefaultSelection as Lt, getDrillDownConfig as It, getFlattenedDataSeries as Et, resolveDrillDownSubHeader as Rt, toStoreFilter as xt } from "./utils.es.js";
12
- import { useOpenedCta as Ft } from "../useOpenedCta.es.js";
13
- import { TransactionDrillDown as Ot } from "./TransactionDrillDown.es.js";
14
- import { useTransactionHistory as Gt } from "./useTransactionHistory.es.js";
15
- import { TransactionDetailsBlock as Ht } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
16
- import { useRequiredCopy as wt } from "../useRequiredCopy.es.js";
17
- import { useLayoutEffect as Nt, useState as d } from "react";
18
- import { observer as jt } from "mobx-react-lite";
19
- import { Fragment as kt, jsx as l, jsxs as Mt } from "react/jsx-runtime";
20
- import { useTheme as Kt } from "@mui/material/styles";
21
- var Vt = (a) => a.insights_feed, me = jt(({ beat: a }) => {
22
- const y = Kt(), { actionDrawer: K, setActionContext: T } = ht(), { insights_payload: A } = a, D = Ft(a), V = D?.variant, { top: e, filterMode: m, header: P, colors: z, filterStrategy: Y, tipSection: S, subTabAriaLabels: q, slotData: U, averageFormat: W, subTabs: $, boldLabel: J } = It(V ?? ""), { instanceSlotData: o, beatTransactions: u, spendCategoryGuids: v, allAccountGuids: B, categoryName: Q, displayedDateRange: f, transactionStore: X } = Gt(a, { slotData: U }, D?.drilldown_data), { common: Z } = ft(), r = wt(Vt), [tt, L] = d(!1), [et, ot] = d(!1), I = St(), { dataSeries: g, chartData: p, comparisonBars: s } = Et({
8
+ import { useAnalyticsEvent as Bt } from "../../analytics/useAnalyticsEvent.es.js";
9
+ import { DoubleBarChart as Lt } from "../../components/chartblocks/DoubleBarChart.es.js";
10
+ import { toLegendItems as It } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
11
+ import { getDefaultSelection as Et, getDrillDownConfig as Rt, getFlattenedDataSeries as xt, resolveDrillDownSubHeader as Ft, toStoreFilter as Ot } from "./utils.es.js";
12
+ import { useOpenedCta as Gt } from "../useOpenedCta.es.js";
13
+ import { TransactionDrillDown as Ht } from "./TransactionDrillDown.es.js";
14
+ import { useTransactionHistory as wt } from "./useTransactionHistory.es.js";
15
+ import { TransactionDetailsBlock as Nt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
16
+ import { useRequiredCopy as jt } from "../useRequiredCopy.es.js";
17
+ import { useLayoutEffect as kt, useState as d } from "react";
18
+ import { observer as Mt } from "mobx-react-lite";
19
+ import { Fragment as Kt, jsx as l, jsxs as Vt } from "react/jsx-runtime";
20
+ import { useTheme as Pt } from "@mui/material/styles";
21
+ var zt = (a) => a.insights_feed, ge = Mt(({ beat: a, cta: K }) => {
22
+ const _ = Pt(), { actionDrawer: V, setActionContext: T } = yt(), { insights_payload: A } = a, P = Gt(a), D = K ?? P, z = D?.variant, { top: e, filterMode: m, header: Y, colors: q, filterStrategy: U, tipSection: S, subTabAriaLabels: W, slotData: $, averageFormat: J, subTabs: Q, boldLabel: X } = Rt(z ?? ""), { instanceSlotData: o, beatTransactions: u, spendCategoryGuids: v, allAccountGuids: B, categoryName: Z, displayedDateRange: h, transactionStore: tt } = wt(a, { slotData: $ }, D?.drilldown_data), { common: et } = Ct(), n = jt(zt), [ot, L] = d(!1), [at, nt] = d(!1), I = Bt(), { dataSeries: g, chartData: p, comparisonBars: s } = xt({
23
23
  data: o?.data_series,
24
- ariaLabel: e === "doubleBar" ? r?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : Tt,
24
+ ariaLabel: e === "doubleBar" ? n?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : Dt,
25
25
  top: e,
26
26
  beatTransactions: u
27
- }), c = e === "doubleBar", at = e === "tabsOnly", i = c ? s : p, { chartBarIndex: E, subTabIndex: nt } = Lt({
27
+ }), c = e === "doubleBar", rt = e === "tabsOnly", i = c ? s : p, { chartBarIndex: E, subTabIndex: st } = Et({
28
28
  chartTabCount: p.length,
29
29
  comparisonTabCount: s.length,
30
- actionDrawer: K,
30
+ actionDrawer: V,
31
31
  beatGuid: a.guid
32
- }), [n, h] = d(E), [C, R] = d(nt), [rt, st] = d(i.length);
33
- i.length !== rt && (st(i.length), h(E));
34
- const x = (t) => Y({
32
+ }), [r, C] = d(E), [y, R] = d(st), [it, lt] = d(i.length);
33
+ i.length !== it && (lt(i.length), C(E));
34
+ const x = (t) => U({
35
35
  beat: a,
36
36
  beatTransactions: u,
37
37
  dataSeries: g,
38
38
  comparisonBars: s,
39
39
  selectedIndex: t,
40
- subIndex: C,
40
+ subIndex: y,
41
41
  isLastTab: t === i.length - 1,
42
42
  instanceSlotData: o,
43
43
  spendCategoryGuids: v,
44
- displayedDateRange: f
45
- }), it = u.map((t) => t.guid).join(","), lt = v.join(","), ct = B.join(","), dt = e === "list" || e === "tabsOnly" || e === "monthTabs" || g.length > 0, F = () => {
44
+ displayedDateRange: h
45
+ }), ct = u.map((t) => t.guid).join(","), dt = v.join(","), mt = B.join(","), ut = e === "list" || e === "tabsOnly" || e === "monthTabs" || g.length > 0, F = () => {
46
46
  if (m !== "store") return;
47
- const t = dt ? x(n) : {
47
+ const t = ut ? x(r) : {
48
48
  accounts: [],
49
49
  custom: () => !1
50
50
  };
51
- X.setFilter(xt(t, {
51
+ tt.setFilter(Ot(t, {
52
52
  allAccountGuids: B,
53
- displayedDateRange: f
53
+ displayedDateRange: h
54
54
  }));
55
55
  };
56
- Nt(() => {
56
+ kt(() => {
57
57
  F();
58
58
  }, [
59
59
  a.guid,
60
- n,
61
- C,
60
+ r,
61
+ y,
62
62
  m,
63
63
  g.length,
64
64
  o,
65
- f,
66
- lt,
65
+ h,
66
+ dt,
67
+ mt,
67
68
  ct,
68
- it,
69
69
  e
70
70
  ]);
71
- const O = Rt(A), _ = P?.({
71
+ const O = Ft(A), b = Y?.({
72
72
  title: A?.title,
73
73
  subHeader: O,
74
- categoryName: Q,
75
- selectedDate: p[n]?.date ?? void 0,
76
- slotData: o
77
- }), G = z(y, o?.category_guid), [H, w] = o?.legends ?? [], mt = m === "local" ? (t) => x(t).custom ?? (() => !0) : void 0, ut = m === "local" ? u : void 0, N = (t, b) => {
78
- I(M.DRAWER_CHART_BAR_CLICKED), h(t), b !== void 0 && R(b);
79
- }, gt = (t) => {
80
- I(M.TAB_SELECTED), h(t);
81
- }, j = c ? Bt([{
74
+ categoryName: Z,
75
+ selectedDate: p[r]?.date ?? void 0,
76
+ slotData: o,
77
+ copy: n
78
+ }), G = q(_, o?.category_guid), [H, w] = o?.legends ?? [], gt = m === "local" ? (t) => x(t).custom ?? (() => !0) : void 0, pt = m === "local" ? u : void 0, N = (t, f) => {
79
+ I(M.DRAWER_CHART_BAR_CLICKED), C(t), f !== void 0 && R(f);
80
+ }, bt = (t) => {
81
+ I(M.TAB_SELECTED), C(t);
82
+ }, j = c ? It([{
82
83
  ...H,
83
- value: s[n]?.main
84
+ value: s[r]?.main
84
85
  }, {
85
86
  ...w,
86
- value: s[n]?.comparison
87
- }]) : void 0, pt = q?.(r) ?? [], k = c ? (j ?? []).map((t, b) => ({
87
+ value: s[r]?.comparison
88
+ }]) : void 0, ft = W?.(n) ?? [], k = c ? (j ?? []).map((t, f) => ({
88
89
  label: t.label,
89
- ariaLabel: pt[b]
90
- })) : at ? g.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : $?.({
90
+ ariaLabel: ft[f]
91
+ })) : rt ? g.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : Q?.({
91
92
  instanceSlotData: o,
92
- copy: r
93
- }).map((t) => ({ label: t })) ?? [], bt = c || e === "singleBar" || e === "upcomingBill" ? i.length ? c ? /* @__PURE__ */ l(vt, {
93
+ copy: n
94
+ }).map((t) => ({ label: t })) ?? [], ht = c || e === "singleBar" || e === "upcomingBill" ? i.length ? c ? /* @__PURE__ */ l(Lt, {
94
95
  bars: s,
95
- boldLabel: J,
96
+ boldLabel: X,
96
97
  colors: G,
97
98
  legendPosition: "top",
98
99
  legends: j,
99
100
  onBarClick: N,
100
- selectedIndex: n
101
- }) : /* @__PURE__ */ l(At, {
101
+ selectedIndex: r
102
+ }) : /* @__PURE__ */ l(St, {
102
103
  amounts: {
103
104
  average: o?.average_amount,
104
- formattedAverage: _t(o?.average_amount ?? 0, W ?? Ct.cents)
105
+ formattedAverage: Tt(o?.average_amount ?? 0, J ?? _t.cents)
105
106
  },
106
- color: G[0] ?? y.palette.primary.main,
107
+ color: G[0] ?? _.palette.primary.main,
107
108
  data: p,
108
109
  legendPosition: "top",
109
110
  heightOverride: 172,
@@ -113,43 +114,44 @@ var Vt = (a) => a.insights_feed, me = jt(({ beat: a }) => {
113
114
  left: 24,
114
115
  right: 24
115
116
  },
116
- monthlyAmountLabel: H?.label ?? r.general.monthly_amount,
117
+ monthlyAmountLabel: H?.label ?? n.general.monthly_amount,
117
118
  onBarClick: N,
118
- selectedTabIndex: n,
119
- trendAmountLabel: w?.label ?? r.general.trend
120
- }) : /* @__PURE__ */ l(Dt, {}) : null;
121
- return /* @__PURE__ */ Mt(kt, { children: [/* @__PURE__ */ l(Ot, {
122
- baseTransactions: ut,
123
- heading: _?.heading,
124
- icon: _?.icon,
125
- onSelectionChange: gt,
126
- selectedIndex: n,
127
- subHeadingText: _?.subHeadingText,
119
+ selectedTabIndex: r,
120
+ trendAmountLabel: w?.label ?? n.general.trend
121
+ }) : /* @__PURE__ */ l(vt, {}) : null;
122
+ return /* @__PURE__ */ Vt(Kt, { children: [/* @__PURE__ */ l(Ht, {
123
+ baseTransactions: pt,
124
+ heading: b?.heading,
125
+ icon: b?.icon,
126
+ logo: b?.logo,
127
+ onSelectionChange: bt,
128
+ selectedIndex: r,
129
+ subHeadingText: b?.subHeadingText,
128
130
  tabs: i,
129
- top: bt,
131
+ top: ht,
130
132
  ...k.length > 0 && { subTabs: {
131
133
  tabs: k,
132
- selectedIndex: C,
134
+ selectedIndex: y,
133
135
  onChange: R
134
136
  } },
135
- ...S && { tipSection: !et && (S(ot, r, O?.text, o) ?? !1) },
136
- transactionFilter: mt,
137
+ ...S && { tipSection: !at && (S(nt, n, O?.text, o) ?? !1) },
138
+ transactionFilter: gt,
137
139
  onEachRowClick: (t) => {
138
140
  T({ transaction_guid: t }), L(!0);
139
141
  }
140
- }), /* @__PURE__ */ l(yt, {
141
- ariaLabelClose: Z.close_aria,
142
- isOpen: tt,
142
+ }), /* @__PURE__ */ l(At, {
143
+ ariaLabelClose: et.close_aria,
144
+ isOpen: ot,
143
145
  onClose: () => {
144
146
  L(!1), T({ transaction_guid: void 0 }), F();
145
147
  },
146
- title: r.general.transaction_details_title,
147
- children: /* @__PURE__ */ l(Ht, { beat: a })
148
+ title: n.general.transaction_details_title,
149
+ children: /* @__PURE__ */ l(Nt, { beat: a })
148
150
  })] });
149
151
  });
150
152
  export {
151
- me as TransactionHistoryBlock,
152
- Vt as selectTransactionHistoryCopy
153
+ ge as TransactionHistoryBlock,
154
+ zt as selectTransactionHistoryCopy
153
155
  };
154
156
 
155
157
  //# 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 { useRequiredCopy } from '../useRequiredCopy'\n\ninterface TransactionHistoryProp {\n beat: Beat\n}\n\nexport const selectTransactionHistoryCopy = (copy: GlobalCopy) => copy.insights_feed\n\nexport const TransactionHistoryBlock = observer(({ beat }: 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 openedCta = useOpenedCta(beat)\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 })\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 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":";;;;;;;;;;;;;;;;;;;;AAmCA,IAAa,KAAA,CAAgC,MAAqB,EAAK,eAE1D,KAA0B,GAAA,CAAU,EAAE,MAAA,EAAA,MAAmC;AACpF,QAAM,IAAQ,GAAS,GAEjB,EAAE,cAAA,GAAc,kBAAA,EAAA,IAAqB,GAAmB,GAExD,EAAE,kBAAA,EAAA,IAAqB,GAKvB,IAAY,GAAa,CAAI,GAC7B,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,EAAA,IACE,GAAmB,KAAqB,EAAE,GAExC,EACJ,kBAAA,GACA,kBAAA,GACA,oBAAA,GACA,iBAAA,GACA,cAAA,GACA,oBAAA,GACA,kBAAA,EAAA,IACE,GAAsB,GAAM,EAAE,UAAA,EAAS,GAAG,GAAW,cAAc,GAEjE,EAAE,QAAQ,EAAA,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,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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,EAAW;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 } = 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 </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,cAA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C,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"}
@@ -11,6 +11,7 @@ export interface DrillDownHeader {
11
11
  heading?: string;
12
12
  subHeadingText?: string;
13
13
  icon?: ReactNode;
14
+ logo?: ReactNode;
14
15
  }
15
16
  export interface DrillDownHeaderContext {
16
17
  title?: string;
@@ -18,6 +19,7 @@ export interface DrillDownHeaderContext {
18
19
  categoryName: string;
19
20
  selectedDate?: string | Date;
20
21
  slotData?: DrillDownSlotData;
22
+ copy?: InsightsFeedCopy;
21
23
  }
22
24
  export declare const DRILLDOWN_VARIANTS: {
23
25
  readonly TRANSACTION: "not_standard_amount";
@@ -34,6 +36,7 @@ export declare const DRILLDOWN_VARIANTS: {
34
36
  readonly LOW_BALANCE: "low_balance";
35
37
  readonly SUBSCRIPTION_AGGREGATE: "monthly_subscription_aggregate";
36
38
  readonly MERCHANT_BUDGET: "merchant_budget";
39
+ readonly TOP_MERCHANT: "top_merchant";
37
40
  };
38
41
  export type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS];
39
42
  /** One flattened data_series row a filterStrategy indexes; fields are optional because the backend keys rows dynamically. */
@@ -83,6 +86,7 @@ export interface DrillDownVariantConfig {
83
86
  export declare const resolveUpcomingBillSlotData: SlotDataResolver;
84
87
  export declare const resolveSavingsContributionsSlotData: SlotDataResolver;
85
88
  export declare const resolveMerchantBudgetSlotData: SlotDataResolver;
89
+ export declare const resolveTopMerchantSlotData: SlotDataResolver;
86
90
  export declare const resolveDepositSummarySlotData: SlotDataResolver;
87
91
  export declare const resolveDebtToIncomeSlotData: SlotDataResolver;
88
92
  export declare const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>>;