@mx-cartographer/experiences 9.7.174 → 9.7.176

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 (35) hide show
  1. package/CHANGELOG.md +8 -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/goals/components/actions/AmountToSaveAction.es.js +20 -19
  5. package/dist/goals/components/actions/AmountToSaveAction.es.js.map +1 -1
  6. package/dist/goals/components/actions/ContributionAction.es.js +20 -19
  7. package/dist/goals/components/actions/ContributionAction.es.js.map +1 -1
  8. package/dist/goals/components/actions/MonthlyPaymentAction.es.js +3 -2
  9. package/dist/goals/components/actions/MonthlyPaymentAction.es.js.map +1 -1
  10. package/dist/goals/components/actions/OriginalBalanceAction.es.js +4 -3
  11. package/dist/goals/components/actions/OriginalBalanceAction.es.js.map +1 -1
  12. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.d.ts +11 -0
  13. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js +164 -0
  14. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js.map +1 -0
  15. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/index.d.ts +1 -0
  16. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.d.ts +46 -0
  17. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.es.js +58 -0
  18. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.es.js.map +1 -0
  19. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +2 -1
  20. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +72 -56
  21. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.d.ts +7 -1
  23. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +84 -82
  24. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  25. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +4 -0
  26. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +169 -133
  27. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  28. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +2 -0
  29. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
  30. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  31. package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
  32. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  33. package/dist/insights-v2/mappings/blocks.es.js +148 -140
  34. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  35. package/package.json +1 -1
@@ -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,Q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
+ {"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,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,EAAA,IACE,GAAmB,KAAqB,EAAE,GAExC,EACJ,kBAAA,GACA,kBAAA,GACA,oBAAA,GACA,iBAAA,GACA,cAAA,GACA,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,GAAk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e;AAAA,IACrB,MAAM,GAAe;AAAA,IACrB,mBAAmB;AAAA,IACJ,eAAA;AAAA,IACf,gBAAgB,GAAe;AAAA,IAC/B,MAAM;AAAA,IACN,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"}
@@ -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>>;
@@ -1,17 +1,17 @@
1
- import { buildDynamicCopy as h } from "../../../core/utils/Localization.es.js";
2
- import { DATE_FORMATS_INTL as N, formatDate as O } from "../../../core/constants/DateFormats.es.js";
3
- import { TransactionStatus as Y } from "../../../core/types/Transaction.es.js";
1
+ import { buildDynamicCopy as g } from "../../../core/utils/Localization.es.js";
2
+ import { DATE_FORMATS_INTL as b, formatDate as T } from "../../../core/constants/DateFormats.es.js";
3
+ import { TransactionStatus as F } from "../../../core/types/Transaction.es.js";
4
4
  import { fromUnixUTC as L } from "../../../core/utils/DateUtil.es.js";
5
- import { CURRENCY_FORMAT as F } from "../../../core/utils/NumberFormatting.es.js";
6
- import { getCategoryColor as k } from "../../../core/utils/CategoryUtil.es.js";
7
- import { buildDataSeries as U } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
8
- import { asGuidList as A, asNonEmptyText as l, asNumber as b } from "../../blocks/slotReaders.es.js";
9
- import { getLayoutConfig as T } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
10
- import V from "../../components/LogoMark.es.js";
11
- import { calendarDateOf as x, toDrillDownSlotData as W } from "./utils.es.js";
12
- import { Icon as B } from "@mxenabled/mx-icons";
13
- import { jsx as c } from "react/jsx-runtime";
14
- import { endOfMonth as M, fromUnixTime as z, isValid as E, parseISO as m, startOfMonth as I } from "date-fns";
5
+ import { CURRENCY_FORMAT as x } from "../../../core/utils/NumberFormatting.es.js";
6
+ import { getCategoryColor as V } from "../../../core/utils/CategoryUtil.es.js";
7
+ import { buildDataSeries as H } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
8
+ import { asGuidList as A, asNonEmptyText as c, asNumber as m } from "../../blocks/slotReaders.es.js";
9
+ import { getLayoutConfig as O } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
10
+ import B from "../../components/LogoMark.es.js";
11
+ import { calendarDateOf as z, toDrillDownSlotData as W } from "./utils.es.js";
12
+ import { Icon as R } from "@mxenabled/mx-icons";
13
+ import { jsx as i } from "react/jsx-runtime";
14
+ import { endOfMonth as E, fromUnixTime as j, isValid as C, parseISO as h, startOfMonth as D } from "date-fns";
15
15
  var n = {
16
16
  TRANSACTION: "not_standard_amount",
17
17
  CATEGORY_SPEND: "category_spend",
@@ -26,169 +26,181 @@ var n = {
26
26
  DEPOSIT_SUMMARY: "monthly_deposit_summary",
27
27
  LOW_BALANCE: "low_balance",
28
28
  SUBSCRIPTION_AGGREGATE: "monthly_subscription_aggregate",
29
- MERCHANT_BUDGET: "merchant_budget"
30
- }, G = (t) => t.insights_feed?.general?.transaction_history_title ?? "", g = (t, e) => e && k(e, t) || t.palette.primary.main, f = (t) => typeof t == "string" ? m(t) : new Date(t ?? NaN), y = (t) => ({
31
- start: I(f(t)),
32
- end: M(f(t))
33
- }), w = (t) => t?.length ? { accounts: t } : {}, j = ({ beat: t }) => {
29
+ MERCHANT_BUDGET: "merchant_budget",
30
+ TOP_MERCHANT: "top_merchant"
31
+ }, G = (t) => t.insights_feed?.general?.transaction_history_title ?? "", d = (t, e) => e && V(e, t) || t.palette.primary.main, p = (t) => typeof t == "string" ? h(t) : new Date(t ?? NaN), v = (t) => ({
32
+ start: D(p(t)),
33
+ end: E(p(t))
34
+ }), P = (t) => t?.length ? { accounts: t } : {}, K = ({ beat: t }) => {
34
35
  const { account_guid: e, from_date: a, to_date: r } = t.insights_payload?.drilldown_data ?? {};
35
36
  return typeof e != "string" || typeof a != "number" || typeof r != "number" || !Number.isFinite(a) || !Number.isFinite(r) || r <= a ? {
36
37
  accounts: [],
37
38
  custom: () => !1
38
39
  } : {
39
40
  accounts: [e],
40
- custom: (o) => !o.is_hidden && o.feed_status !== Y.PENDING,
41
+ custom: (o) => !o.is_hidden && o.feed_status !== F.PENDING,
41
42
  showSplits: !0,
42
43
  dateRange: {
43
44
  start: L(a),
44
45
  end: L(r - 1)
45
46
  }
46
47
  };
47
- }, K = (t) => {
48
+ }, q = (t) => {
48
49
  const e = t?.drilldown_data ?? {};
49
50
  return {
50
51
  transaction_guids: A(e.transaction_guids),
51
- date: x(e.due_date),
52
- category_guid: l(e.category_guid),
53
- average_amount: b(e.average_amount),
54
- merchant_name: l(e.merchant_name)
52
+ date: z(e.due_date),
53
+ category_guid: c(e.category_guid),
54
+ average_amount: m(e.average_amount),
55
+ merchant_name: c(e.merchant_name)
55
56
  };
56
- }, _ = (t) => {
57
+ }, l = (t) => {
57
58
  const e = t;
58
59
  return Array.isArray(e?.names) && Array.isArray(e?.data) ? e : void 0;
59
- }, q = (t) => {
60
+ }, J = (t) => {
60
61
  const e = t?.drilldown_data ?? {};
61
62
  return {
62
63
  account_guids: A(e.account_guids),
63
- data_series: _(e.data_series),
64
- average_amount: b(e.average_amount)
64
+ data_series: l(e.data_series),
65
+ average_amount: m(e.average_amount)
65
66
  };
66
- }, J = (t) => {
67
+ }, Q = (t) => {
67
68
  const e = t?.drilldown_data ?? {}, a = t?.instance_slot?.data, r = t?.instance_slot_data;
68
69
  return {
69
- data_series: _(e.data_series),
70
- average_amount: b(e.average_amount),
71
- merchant_guid: l(a?.merchant_guid) ?? l(r?.merchant_guid),
72
- merchant_name: l(a?.merchant_name) ?? l(r?.merchant_name)
70
+ data_series: l(e.data_series),
71
+ average_amount: m(e.average_amount),
72
+ merchant_guid: c(a?.merchant_guid) ?? c(r?.merchant_guid),
73
+ merchant_name: c(a?.merchant_name) ?? c(r?.merchant_name)
73
74
  };
74
- }, P = ["income", "other"], Q = (t) => {
75
+ }, X = (t, e) => {
76
+ const a = e ?? {};
77
+ return {
78
+ data_series: l(a.data_series),
79
+ average_amount: m(a.average_amount),
80
+ category_guid: c(a.category_guid),
81
+ described_month: c(a.described_month),
82
+ merchant_guid: c(a.merchant_guid),
83
+ merchant_name: c(a.merchant_name),
84
+ rank: m(a.rank)
85
+ };
86
+ }, k = ["income", "other"], Z = (t) => {
75
87
  const e = t?.drilldown_data ?? {}, a = t?.instance_slot?.data?.legends?.map(({ label: r }) => r);
76
88
  return {
77
- data_series: _(e.data_series),
78
- average_amount: b(e.average_amount),
89
+ data_series: l(e.data_series),
90
+ average_amount: m(e.average_amount),
79
91
  income_transaction_guids: A(e.income_transaction_guids),
80
- sub_tab_labels: a?.length === P.length ? a : void 0
92
+ sub_tab_labels: a?.length === k.length ? a : void 0
81
93
  };
82
- }, X = 2, H = (t, e) => {
83
- const a = e ?? {}, r = _(a.series), o = Array.isArray(a.labels) ? a.labels.map(l) : [];
84
- return !r || o.length !== X || !o.every((s) => !!s) ? {} : {
94
+ }, $ = 2, Y = (t, e) => {
95
+ const a = e ?? {}, r = l(a.series), o = Array.isArray(a.labels) ? a.labels.map(c) : [];
96
+ return !r || o.length !== $ || !o.every((s) => !!s) ? {} : {
85
97
  data_series: r,
86
98
  legends: o.map((s) => ({
87
99
  label: s,
88
100
  value: 0
89
101
  }))
90
102
  };
91
- }, R = (t, e) => U(_(e?.series)).flatMap((a) => a.aggregated_guids ?? []), Z = (t, e) => {
103
+ }, U = (t, e) => H(l(e?.series)).flatMap((a) => a.aggregated_guids ?? []), tt = (t, e) => {
92
104
  const a = e.transaction_history_block?.monthly_debt_to_income_tip_message, r = e.transaction_history_block?.monthly_debt_to_income_tip_limit;
93
105
  if (!(!a || !r))
94
106
  return {
95
- message: h(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: r })),
107
+ message: g(a, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ i("strong", { children: r })),
96
108
  onDismiss: () => t(!0)
97
109
  };
98
- }, $ = (t, e) => {
99
- const a = H(t, e);
110
+ }, et = (t, e) => {
111
+ const a = Y(t, e);
100
112
  return a.data_series ? a : W(t?.instance_slot?.data ?? {});
101
- }, tt = (t, e) => {
113
+ }, at = (t, e) => {
102
114
  const a = e.transaction_history_block?.savings_to_income_tip_message, r = e.transaction_history_block?.savings_to_income_tip_percentage;
103
115
  if (!(!a || !r))
104
116
  return {
105
- message: h(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: r })),
117
+ message: g(a, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ i("strong", { children: r })),
106
118
  onDismiss: () => t(!0)
107
119
  };
108
- }, et = (t) => U(_(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), at = (t, e, a, r) => {
120
+ }, rt = (t) => H(l(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), ot = (t, e, a, r) => {
109
121
  const o = r?.merchant_name, s = r?.date;
110
122
  if (!o || !s) return;
111
- const i = e.transaction_history_block?.upcoming_bill_tip_message;
112
- if (i)
113
- return { message: h(i, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), o, O(m(s), N.FULL_MONTH_DAY)) };
114
- }, D = ({ beatTransactions: t, dataSeries: e, selectedIndex: a }) => {
115
- const r = e[a], o = r?.guid, s = t.find((i) => i.guid === o)?.has_been_split;
123
+ const _ = e.transaction_history_block?.upcoming_bill_tip_message;
124
+ if (_)
125
+ return { message: g(_, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), o, T(h(s), b.FULL_MONTH_DAY)) };
126
+ }, M = ({ beatTransactions: t, dataSeries: e, selectedIndex: a }) => {
127
+ const r = e[a], o = r?.guid, s = t.find((_) => _.guid === o)?.has_been_split;
116
128
  return {
117
- custom: (i) => i.guid === o,
118
- dateRange: y(r?.date),
129
+ custom: (_) => _.guid === o,
130
+ dateRange: v(r?.date),
119
131
  showSplits: !s
120
132
  };
121
- }, rt = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
133
+ }, st = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
122
134
  const r = t[e], o = a.category_guid ?? r?.guid;
123
135
  return {
124
136
  custom: (s) => s.category_guid === o || s.top_level_category_guid === o,
125
- dateRange: y(r?.date)
137
+ dateRange: v(r?.date)
126
138
  };
127
- }, ot = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: a, instanceSlotData: r }) => {
139
+ }, nt = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: a, instanceSlotData: r }) => {
128
140
  const o = t[e];
129
141
  return {
130
142
  custom: (s) => !!s.top_level_category_guid && a.includes(s.top_level_category_guid),
131
- dateRange: y(o?.date),
132
- ...w(r.account_guids)
143
+ dateRange: v(o?.date),
144
+ ...P(r.account_guids)
133
145
  };
134
- }, st = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
135
- const r = a.merchant_guid, o = m(t[e]?.date ?? "");
136
- return !r || !E(o) ? {
146
+ }, w = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
147
+ const r = a.merchant_guid, o = h(t[e]?.date ?? "");
148
+ return !r || !C(o) ? {
137
149
  accounts: [],
138
150
  custom: () => !1
139
151
  } : {
140
152
  custom: (s) => s.merchant_guid === r && !s.is_hidden,
141
153
  dateRange: {
142
- start: I(o),
143
- end: M(o)
154
+ start: D(o),
155
+ end: E(o)
144
156
  }
145
157
  };
146
- }, nt = (t) => typeof t == "number" ? z(t) : m(t ?? ""), it = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: r, instanceSlotData: o }) => {
147
- const s = e[a], { start: i, end: u } = y(s?.date), d = nt(t.created_at), p = o.account_guids, C = {
148
- start: i,
149
- end: r && E(d) && d < u ? d : u
158
+ }, it = (t) => typeof t == "number" ? j(t) : h(t ?? ""), ct = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: r, instanceSlotData: o }) => {
159
+ const s = e[a], { start: _, end: S } = v(s?.date), u = it(t.created_at), f = o.account_guids, I = {
160
+ start: _,
161
+ end: r && C(u) && u < S ? u : S
150
162
  };
151
- return p?.length ? {
152
- dateRange: C,
153
- accounts: p
163
+ return f?.length ? {
164
+ dateRange: I,
165
+ accounts: f
154
166
  } : {
155
- dateRange: C,
167
+ dateRange: I,
156
168
  accounts: [],
157
169
  custom: () => !1
158
170
  };
159
- }, v = (t, e, a) => {
160
- const r = new Set(t), o = m(e ?? "");
161
- return !r.size || !E(o) ? {
171
+ }, N = (t, e, a) => {
172
+ const r = new Set(t), o = h(e ?? "");
173
+ return !r.size || !C(o) ? {
162
174
  accounts: [],
163
175
  custom: () => !1
164
176
  } : {
165
177
  custom: (s) => r.has(s.guid),
166
178
  dateRange: {
167
- start: I(o),
168
- end: M(o)
179
+ start: D(o),
180
+ end: E(o)
169
181
  },
170
- ...w(a)
182
+ ...P(a)
171
183
  };
172
- }, ct = ({ beat: t, dataSeries: e, selectedIndex: a }) => v(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), S = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: r }) => {
184
+ }, _t = ({ beat: t, dataSeries: e, selectedIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), y = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: r }) => {
173
185
  const o = e[a];
174
- return v(r === 1 ? o?.comparisonGuids : o?.mainGuids, o?.date, t.account_guids);
175
- }, lt = ({ beat: t, dataSeries: e, subIndex: a }) => v(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), _t = (t) => {
176
- const { dataSeries: e, selectedIndex: a, subIndex: r, instanceSlotData: o } = t, s = e[a], i = new Set(o.income_transaction_guids), u = P[r] === "income", d = o.sub_tab_labels ? s?.aggregated_guids?.filter((p) => i.has(p) === u) : s?.aggregated_guids;
177
- return v(d, s?.date);
178
- }, Dt = {
186
+ return N(r === 1 ? o?.comparisonGuids : o?.mainGuids, o?.date, t.account_guids);
187
+ }, lt = ({ beat: t, dataSeries: e, subIndex: a }) => N(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), dt = (t) => {
188
+ const { dataSeries: e, selectedIndex: a, subIndex: r, instanceSlotData: o } = t, s = e[a], _ = new Set(o.income_transaction_guids), S = k[r] === "income", u = o.sub_tab_labels ? s?.aggregated_guids?.filter((f) => _.has(f) === S) : s?.aggregated_guids;
189
+ return N(u, s?.date);
190
+ }, At = {
179
191
  [n.TRANSACTION]: {
180
192
  title: G,
181
193
  top: "singleBar",
182
194
  scope: "store",
183
195
  filterMode: "store",
184
- filterStrategy: D,
185
- colors: (t, e) => [g(t, e)],
196
+ filterStrategy: M,
197
+ colors: (t, e) => [d(t, e)],
186
198
  header: (t) => {
187
199
  const { title: e, subHeader: a } = t;
188
200
  return {
189
201
  heading: e,
190
202
  subHeadingText: a?.text || void 0,
191
- icon: /* @__PURE__ */ c(V, {
203
+ icon: /* @__PURE__ */ i(B, {
192
204
  logo: {
193
205
  ...a?.logo,
194
206
  merchant_name: a?.text ?? a?.logo?.merchant_name
@@ -198,21 +210,21 @@ var n = {
198
210
  };
199
211
  },
200
212
  tipSection: (t, e, a = "") => ({
201
- message: h(e.general.tip_section_message, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: a })),
213
+ message: g(e.general.tip_section_message, /* @__PURE__ */ i("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ i("strong", { children: a })),
202
214
  onDismiss: () => t(!0)
203
215
  })
204
216
  },
205
217
  [n.CATEGORY_SPEND]: {
206
218
  top: "singleBar",
207
- averageFormat: F.whole,
208
- filterStrategy: rt,
219
+ averageFormat: x.whole,
220
+ filterStrategy: st,
209
221
  scope: "store",
210
222
  filterMode: "store",
211
- colors: (t, e) => [g(t, e)],
223
+ colors: (t, e) => [d(t, e)],
212
224
  header: (t) => ({
213
225
  heading: t.categoryName,
214
- subHeadingText: t.selectedDate && O(f(t.selectedDate), N.MONTH_LONG) || "",
215
- icon: /* @__PURE__ */ c(B, {
226
+ subHeadingText: t.selectedDate && T(p(t.selectedDate), b.MONTH_LONG) || "",
227
+ icon: /* @__PURE__ */ i(R, {
216
228
  color: "primary",
217
229
  name: "calendar_month",
218
230
  size: 16
@@ -221,7 +233,7 @@ var n = {
221
233
  },
222
234
  [n.MONTHLY_SPEND]: {
223
235
  top: "singleBar",
224
- filterStrategy: ot,
236
+ filterStrategy: nt,
225
237
  scope: "store",
226
238
  filterMode: "store",
227
239
  colors: (t) => [t.palette.chart.chart2 ?? t.palette.primary.main]
@@ -229,104 +241,127 @@ var n = {
229
241
  [n.ACCOUNT_BALANCE]: {
230
242
  title: (t, e) => e?.insights_payload?.title || void 0,
231
243
  top: "singleBar",
232
- filterStrategy: it,
233
- slotData: q,
244
+ filterStrategy: ct,
245
+ slotData: J,
234
246
  scope: "store",
235
247
  filterMode: "store",
236
248
  colors: (t) => [t.palette.success.main]
237
249
  },
238
250
  [n.UPCOMING_BILL]: {
239
251
  top: "upcomingBill",
240
- filterStrategy: D,
252
+ filterStrategy: M,
241
253
  scope: "beat",
242
254
  filterMode: "local",
243
- colors: (t, e) => [g(t, e)],
244
- slotData: K,
255
+ colors: (t, e) => [d(t, e)],
256
+ slotData: q,
245
257
  fetchMissingTransactions: (t) => t.insights_payload?.drilldown_data?.transaction_guids,
246
- tipSection: at
258
+ tipSection: ot
247
259
  },
248
260
  [n.DEPOSIT_SUMMARY]: {
249
261
  top: "singleBar",
250
- filterStrategy: _t,
262
+ filterStrategy: dt,
251
263
  scope: "store",
252
264
  filterMode: "store",
253
265
  colors: (t) => [t.palette.success.main],
254
- slotData: Q,
255
- fetchMissingTransactions: et,
266
+ slotData: Z,
267
+ fetchMissingTransactions: rt,
256
268
  subTabs: ({ instanceSlotData: t }) => t.sub_tab_labels ?? []
257
269
  },
258
270
  [n.LOW_BALANCE]: {
259
271
  top: "list",
260
- filterStrategy: j,
272
+ filterStrategy: K,
261
273
  scope: "store",
262
274
  filterMode: "store",
263
275
  colors: (t) => [t.palette.primary.main]
264
276
  },
265
277
  [n.SUBSCRIPTION_AGGREGATE]: {
266
278
  top: "monthTabs",
267
- filterStrategy: ct,
279
+ filterStrategy: _t,
268
280
  scope: "store",
269
281
  filterMode: "store",
270
282
  colors: (t) => [t.palette.primary.main]
271
283
  },
272
284
  [n.MERCHANT_BUDGET]: {
273
285
  top: "singleBar",
274
- filterStrategy: st,
275
- slotData: J,
286
+ filterStrategy: w,
287
+ slotData: Q,
276
288
  scope: "store",
277
289
  filterMode: "store",
278
290
  colors: (t) => [t.palette.chart.chart1 ?? t.palette.primary.main],
279
291
  header: (t) => ({
280
292
  heading: t.slotData?.merchant_name ?? t.title,
281
- subHeadingText: t.selectedDate && O(f(t.selectedDate), N.MONTH_LONG) || "",
282
- icon: /* @__PURE__ */ c(B, {
293
+ subHeadingText: t.selectedDate && T(p(t.selectedDate), b.MONTH_LONG) || "",
294
+ icon: /* @__PURE__ */ i(R, {
283
295
  color: "primary",
284
296
  name: "calendar_month",
285
297
  size: 16
286
298
  })
287
299
  })
288
300
  },
301
+ [n.TOP_MERCHANT]: {
302
+ top: "singleBar",
303
+ filterStrategy: w,
304
+ slotData: X,
305
+ scope: "store",
306
+ filterMode: "store",
307
+ colors: (t, e) => [d(t, e)],
308
+ header: ({ copy: t, slotData: e, title: a }) => {
309
+ const r = e?.merchant_name, o = t?.top_merchants, s = e?.described_month && T(p(e.described_month), b.MONTH_SHORT_YEAR) || "";
310
+ return {
311
+ heading: r && o?.merchant_spending ? g(o.merchant_spending, r) : r ?? a,
312
+ subHeadingText: e?.rank && o?.most_visited_merchant ? g(o.most_visited_merchant, String(e.rank), s) : s,
313
+ logo: e?.merchant_guid ? /* @__PURE__ */ i(B, {
314
+ logo: {
315
+ category_guid: e.category_guid,
316
+ merchant_guid: e.merchant_guid,
317
+ merchant_name: r
318
+ },
319
+ size: 40
320
+ }) : void 0
321
+ };
322
+ }
323
+ },
289
324
  [n.SPEND_TO_INCOME]: {
290
325
  top: "doubleBar",
291
- filterStrategy: S,
326
+ filterStrategy: y,
292
327
  scope: "store",
293
328
  filterMode: "store",
294
- colors: (t) => T(t, "spend_to_income")?.color ?? [],
329
+ colors: (t) => O(t, "spend_to_income")?.color ?? [],
295
330
  boldLabel: !0,
296
331
  subTabAriaLabels: (t) => [t.general.spend_transactions, t.general.income_transactions]
297
332
  },
298
333
  [n.COST_OF_LIVING]: {
299
334
  top: "doubleBar",
300
- filterStrategy: S,
335
+ filterStrategy: y,
301
336
  scope: "store",
302
337
  filterMode: "store",
303
- colors: (t, e) => [g(t, e), t.palette.chart.chart4 ?? t.palette.primary.main],
338
+ colors: (t, e) => [d(t, e), t.palette.chart.chart4 ?? t.palette.primary.main],
304
339
  subTabAriaLabels: (t) => [void 0, t.general.income_transactions]
305
340
  },
306
341
  [n.DEBT_TO_INCOME]: {
307
342
  title: (t) => t.insights_feed?.transaction_history_block?.monthly_debt_to_income_drawer_title ?? G(t),
308
343
  top: "doubleBar",
309
- filterStrategy: S,
344
+ filterStrategy: y,
310
345
  scope: "store",
311
346
  filterMode: "store",
312
- colors: (t) => T(t, "debt_to_income")?.color ?? [],
347
+ colors: (t) => O(t, "debt_to_income")?.color ?? [],
313
348
  boldLabel: !0,
314
349
  subTabAriaLabels: (t) => [void 0, t.general.income_transactions],
315
- slotData: H,
316
- fetchMissingTransactions: R,
317
- tipSection: Z
350
+ slotData: Y,
351
+ fetchMissingTransactions: U,
352
+ tipSection: tt
318
353
  },
319
354
  [n.SAVINGS_TO_INCOME]: {
320
355
  top: "doubleBar",
321
- filterStrategy: S,
356
+ filterStrategy: y,
322
357
  scope: "store",
323
358
  filterMode: "store",
324
- colors: (t) => T(t, "savings_to_income")?.color ?? [],
359
+ colors: (t) => O(t, "savings_to_income")?.color ?? [],
325
360
  boldLabel: !0,
326
361
  subTabAriaLabels: (t) => [t.general.savings_transactions, t.general.income_transactions],
327
- slotData: $,
328
- fetchMissingTransactions: R,
329
- tipSection: tt
362
+ slotData: et,
363
+ fetchMissingTransactions: U,
364
+ tipSection: at
330
365
  },
331
366
  [n.NON_ESSENTIAL_CATEGORY]: {
332
367
  top: "tabsOnly",
@@ -335,22 +370,23 @@ var n = {
335
370
  filterMode: "store",
336
371
  colors: (t) => [t.palette.primary.main]
337
372
  }
338
- }, At = {
373
+ }, Et = {
339
374
  top: "singleBar",
340
- filterStrategy: D,
375
+ filterStrategy: M,
341
376
  scope: "store",
342
377
  filterMode: "store",
343
- colors: (t, e) => [g(t, e)]
378
+ colors: (t, e) => [d(t, e)]
344
379
  };
345
380
  export {
346
381
  n as DRILLDOWN_VARIANTS,
347
- At as FALLBACK,
348
- Dt as layout,
349
- H as resolveDebtToIncomeSlotData,
350
- Q as resolveDepositSummarySlotData,
351
- J as resolveMerchantBudgetSlotData,
352
- q as resolveSavingsContributionsSlotData,
353
- K as resolveUpcomingBillSlotData
382
+ Et as FALLBACK,
383
+ At as layout,
384
+ Y as resolveDebtToIncomeSlotData,
385
+ Z as resolveDepositSummarySlotData,
386
+ Q as resolveMerchantBudgetSlotData,
387
+ J as resolveSavingsContributionsSlotData,
388
+ X as resolveTopMerchantSlotData,
389
+ q as resolveUpcomingBillSlotData
354
390
  };
355
391
 
356
392
  //# sourceMappingURL=layout.es.js.map