@mx-cartographer/experiences 9.7.144 → 9.7.146

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 (26) hide show
  1. package/CHANGELOG.md +11 -1
  2. package/dist/core/types/Insights.d.ts +6 -5
  3. package/dist/core/types/Insights.es.js.map +1 -1
  4. package/dist/core/types/localization/InsightsFeedCopy.d.ts +2 -0
  5. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +11 -12
  6. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js +13 -12
  8. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.es.js +2 -1
  10. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.es.js.map +1 -1
  11. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.d.ts +5 -5
  12. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +25 -26
  13. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +2 -1
  15. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  16. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +3 -0
  17. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +170 -131
  18. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  19. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +1 -0
  20. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
  21. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js +34 -31
  22. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/SavingsSummaryBlock.es.js.map +1 -1
  23. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/layout.d.ts +11 -0
  24. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/layout.es.js +13 -0
  25. package/dist/insights-v2/blocks/ComponentBlocks/SavingsSummaryBlock/layout.es.js.map +1 -0
  26. 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, 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 splitProjectedTransaction,\n toStoreFilter,\n} from './utils'\nimport {\n Drawer,\n useInsightsV2Store,\n useGlobalCopyStore,\n useGlobalUiStore,\n Loader,\n} from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\n\ninterface TransactionHistoryProp {\n beat: Beat\n}\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 call.\n const openedCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n insights_payload?.primary_cta,\n insights_payload?.secondary_cta,\n insights_payload?.in_description_cta,\n )\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 beatTransactions: resolveBeatTransactions,\n hideListHeader,\n averageFormat,\n subTabs,\n } = getDrillDownConfig(dynamicCtaVariant ?? '')\n\n const {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n } = useTransactionHistory(\n beat,\n { slotData, beatTransactions: resolveBeatTransactions },\n openedCta?.drilldown_data,\n )\n\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { isCopyLoaded } = useGlobalUiStore()\n\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n\n const [closeTipSection, setCloseTipSection] = useState(false)\n\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n // `getFlattenedDataSeries` runs ahead of the copy-loaded guard below, hence the literal fallback.\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 })\n\n const barColors = colors(theme, instanceSlotData?.category_guid)\n\n if (!isCopyLoaded) return <Loader />\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 // Upcoming Bill appends a synthesized projected bill: it draws the last bar and its own labelled\n // row, but is never a plain list row or a CSV line.\n const { transactions: listTransactions, projectedTransaction } =\n splitProjectedTransaction(beatTransactions)\n\n const baseTransactions: Transaction[] | undefined =\n filterMode === 'local' ? listTransactions : undefined\n\n const projectedHeading = insightsCopy.general.projected_amount\n const projectedRow =\n projectedTransaction &&\n projectedHeading &&\n resolveFilter(selectedIndex).custom?.(projectedTransaction)\n ? { heading: projectedHeading, transaction: projectedTransaction }\n : 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 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 hideListHeader={hideListHeader}\n projectedRow={projectedRow}\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":";;;;;;;;;;;;;;;;;;;;AAyCA,IAAa,KAA0B,GAAA,CAAU,EAAE,MAAA,EAAA,MAAmC;AACpF,QAAM,IAAQ,GAAS,GAEjB,EAAE,cAAA,GAA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AAoB,GAAc,GAAW,MAAM,CAAgB,KAC7E,IACN;AAAA,IACmB,mBAAA;AAAA,IACnB,gBAAA,CAAiB,MAAS;AACxB,MAAA,EAAiB,EAAE,kBAAkB,EAAK,CAAC,GAC3C,EAA4B,EAAI;AAAA,IAClC;AAAA,EACD,CAAA,GACD,gBAAA,EAAC,IAAD;AAAA,IACE,gBAAgB,GAAW;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAA,MAAe;AACb,MAAA,EAA4B,EAAK,GAIjC,EAAiB,EAAE,kBAAkB,OAAU,CAAC,GAGhD,EAA4B;AAAA,IAC9B;AAAA,IACA,OAAO,EAAa,QAAQ;AAAA,IAE5B,UAAA,gBAAA,EAAC,IAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,EAChC,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
1
+ {"version":3,"file":"TransactionHistoryBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport type { Beat, DataSeries, 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 splitProjectedTransaction,\n toStoreFilter,\n} from './utils'\nimport {\n Drawer,\n useInsightsV2Store,\n useGlobalCopyStore,\n useGlobalUiStore,\n Loader,\n} from '../../../common'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { getDynamicCtaBasedOnTriggers } from '../util'\n\ninterface TransactionHistoryProp {\n beat: Beat\n}\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 call.\n const openedCta = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n insights_payload?.primary_cta,\n insights_payload?.secondary_cta,\n insights_payload?.in_description_cta,\n )\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 beatTransactions: resolveBeatTransactions,\n hideListHeader,\n averageFormat,\n subTabs,\n } = getDrillDownConfig(dynamicCtaVariant ?? '')\n\n const {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n } = useTransactionHistory(\n beat,\n { slotData, beatTransactions: resolveBeatTransactions },\n openedCta?.drilldown_data,\n )\n\n const { common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { isCopyLoaded } = useGlobalUiStore()\n\n const [isTransactionDetailsOpen, setIsTransactionDetailsOpen] = useState(false)\n\n const [closeTipSection, setCloseTipSection] = useState(false)\n\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n // `getFlattenedDataSeries` runs ahead of the copy-loaded guard below, hence the literal fallback.\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 if (!isCopyLoaded) return <Loader />\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 // Upcoming Bill appends a synthesized projected bill: it draws the last bar and its own labelled\n // row, but is never a plain list row or a CSV line.\n const { transactions: listTransactions, projectedTransaction } =\n splitProjectedTransaction(beatTransactions)\n\n const baseTransactions: Transaction[] | undefined =\n filterMode === 'local' ? listTransactions : undefined\n\n const projectedHeading = insightsCopy.general.projected_amount\n const projectedRow =\n projectedTransaction &&\n projectedHeading &&\n resolveFilter(selectedIndex).custom?.(projectedTransaction)\n ? { heading: projectedHeading, transaction: projectedTransaction }\n : 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 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 hideListHeader={hideListHeader}\n projectedRow={projectedRow}\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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,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"}
@@ -17,6 +17,7 @@ export interface DrillDownHeaderContext {
17
17
  subHeader?: Subtitle;
18
18
  categoryName: string;
19
19
  selectedDate?: string | Date;
20
+ slotData?: DrillDownSlotData;
20
21
  }
21
22
  export declare const DRILLDOWN_VARIANTS: {
22
23
  readonly TRANSACTION: "not_standard_amount";
@@ -32,6 +33,7 @@ export declare const DRILLDOWN_VARIANTS: {
32
33
  readonly DEPOSIT_SUMMARY: "monthly_deposit_summary";
33
34
  readonly LOW_BALANCE: "low_balance";
34
35
  readonly SUBSCRIPTION_AGGREGATE: "monthly_subscription_aggregate";
36
+ readonly MERCHANT_BUDGET: "merchant_budget";
35
37
  };
36
38
  export type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS];
37
39
  /** One flattened data_series row a filterStrategy indexes; fields are optional because the backend keys rows dynamically. */
@@ -80,6 +82,7 @@ export interface DrillDownVariantConfig {
80
82
  }
81
83
  export declare const resolveUpcomingBillSlotData: SlotDataResolver;
82
84
  export declare const resolveSavingsContributionsSlotData: SlotDataResolver;
85
+ export declare const resolveMerchantBudgetSlotData: SlotDataResolver;
83
86
  export declare const resolveDepositSummarySlotData: SlotDataResolver;
84
87
  export declare const resolveDebtToIncomeSlotData: SlotDataResolver;
85
88
  export declare const resolveUpcomingBillTransactions: BeatTransactionsResolver;
@@ -1,17 +1,17 @@
1
- import { buildDynamicCopy as S } from "../../../core/utils/Localization.es.js";
2
- import { DATE_FORMATS_INTL as M, formatDate as C } from "../../../core/constants/DateFormats.es.js";
3
- import { TransactionStatus as P } from "../../../core/types/Transaction.es.js";
4
- import { fromUnixUTC as D } from "../../../core/utils/DateUtil.es.js";
1
+ import { buildDynamicCopy as T } 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 H } from "../../../core/types/Transaction.es.js";
4
+ import { fromUnixUTC as L } from "../../../core/utils/DateUtil.es.js";
5
5
  import { CURRENCY_FORMAT as Y } from "../../../core/utils/NumberFormatting.es.js";
6
6
  import { getCategoryColor as F } from "../../../core/utils/CategoryUtil.es.js";
7
- import { buildDataSeries as E } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
8
- import { asGuidList as O, asNonEmptyText as v, asNumber as p } from "../../blocks/slotReaders.es.js";
9
- import { getLayoutConfig as T } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
10
- import H from "../../components/LogoMark.es.js";
11
- import { buildProjectedBillTransaction as x, calendarDateOf as k, toDrillDownSlotData as V } from "./utils.es.js";
12
- import { Icon as W } from "@mxenabled/mx-icons";
7
+ import { buildDataSeries as R } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
8
+ import { asGuidList as A, asNonEmptyText as l, asNumber as m } from "../../blocks/slotReaders.es.js";
9
+ import { getLayoutConfig as b } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
10
+ import k from "../../components/LogoMark.es.js";
11
+ import { buildProjectedBillTransaction as V, calendarDateOf as x, toDrillDownSlotData as W } from "./utils.es.js";
12
+ import { Icon as B } from "@mxenabled/mx-icons";
13
13
  import { jsx as c } from "react/jsx-runtime";
14
- import { endOfMonth as L, fromUnixTime as j, isValid as B, parseISO as f, startOfMonth as G } from "date-fns";
14
+ import { endOfMonth as M, fromUnixTime as z, isValid as E, parseISO as u, startOfMonth as I } from "date-fns";
15
15
  var n = {
16
16
  TRANSACTION: "not_standard_amount",
17
17
  CATEGORY_SPEND: "category_spend",
@@ -25,155 +25,176 @@ var n = {
25
25
  NON_ESSENTIAL_CATEGORY: "non_essential_category_summary",
26
26
  DEPOSIT_SUMMARY: "monthly_deposit_summary",
27
27
  LOW_BALANCE: "low_balance",
28
- SUBSCRIPTION_AGGREGATE: "monthly_subscription_aggregate"
29
- }, _ = (t, e) => e && F(e, t) || t.palette.primary.main, h = (t) => typeof t == "string" ? f(t) : new Date(t ?? NaN), y = (t) => ({
30
- start: G(h(t)),
31
- end: L(h(t))
32
- }), R = (t) => t?.length ? { accounts: t } : {}, z = ({ beat: t }) => {
33
- const { account_guid: e, from_date: a, to_date: o } = t.insights_payload?.drilldown_data ?? {};
34
- return typeof e != "string" || typeof a != "number" || typeof o != "number" || !Number.isFinite(a) || !Number.isFinite(o) || o <= a ? {
28
+ SUBSCRIPTION_AGGREGATE: "monthly_subscription_aggregate",
29
+ MERCHANT_BUDGET: "merchant_budget"
30
+ }, g = (t, e) => e && F(e, t) || t.palette.primary.main, h = (t) => typeof t == "string" ? u(t) : new Date(t ?? NaN), v = (t) => ({
31
+ start: I(h(t)),
32
+ end: M(h(t))
33
+ }), U = (t) => t?.length ? { accounts: t } : {}, j = ({ beat: t }) => {
34
+ const { account_guid: e, from_date: a, to_date: r } = t.insights_payload?.drilldown_data ?? {};
35
+ return typeof e != "string" || typeof a != "number" || typeof r != "number" || !Number.isFinite(a) || !Number.isFinite(r) || r <= a ? {
35
36
  accounts: [],
36
37
  custom: () => !1
37
38
  } : {
38
39
  accounts: [e],
39
- custom: (r) => !r.is_hidden && r.feed_status !== P.PENDING,
40
+ custom: (o) => !o.is_hidden && o.feed_status !== H.PENDING,
40
41
  showSplits: !0,
41
42
  dateRange: {
42
- start: D(a),
43
- end: D(o - 1)
43
+ start: L(a),
44
+ end: L(r - 1)
44
45
  }
45
46
  };
46
47
  }, K = (t) => {
47
48
  const e = t?.drilldown_data ?? {};
48
49
  return {
49
- transaction_guids: O(e.transaction_guids),
50
- date: k(e.due_date),
51
- amount: p(e.amount),
52
- category_guid: v(e.category_guid),
53
- average_amount: p(e.average_amount),
54
- merchant_name: v(e.merchant_name)
50
+ transaction_guids: A(e.transaction_guids),
51
+ date: x(e.due_date),
52
+ amount: m(e.amount),
53
+ category_guid: l(e.category_guid),
54
+ average_amount: m(e.average_amount),
55
+ merchant_name: l(e.merchant_name)
55
56
  };
56
- }, g = (t) => {
57
+ }, _ = (t) => {
57
58
  const e = t;
58
59
  return Array.isArray(e?.names) && Array.isArray(e?.data) ? e : void 0;
59
60
  }, q = (t) => {
60
61
  const e = t?.drilldown_data ?? {};
61
62
  return {
62
- account_guids: O(e.account_guids),
63
- data_series: g(e.data_series),
64
- average_amount: p(e.average_amount)
63
+ account_guids: A(e.account_guids),
64
+ data_series: _(e.data_series),
65
+ average_amount: m(e.average_amount)
65
66
  };
66
- }, U = ["income", "other"], J = (t) => {
67
- const e = t?.drilldown_data ?? {}, a = t?.instance_slot?.data?.legends?.map(({ label: o }) => o);
67
+ }, J = (t) => {
68
+ const e = t?.drilldown_data ?? {}, a = t?.instance_slot?.data, r = t?.instance_slot_data;
68
69
  return {
69
- data_series: g(e.data_series),
70
- average_amount: p(e.average_amount),
71
- income_transaction_guids: O(e.income_transaction_guids),
72
- sub_tab_labels: a?.length === U.length ? a : void 0
70
+ data_series: _(e.data_series),
71
+ average_amount: m(e.average_amount),
72
+ merchant_guid: l(a?.merchant_guid) ?? l(r?.merchant_guid),
73
+ merchant_name: l(a?.merchant_name) ?? l(r?.merchant_name)
73
74
  };
74
- }, Q = 2, w = (t, e) => {
75
- const a = e ?? {}, o = g(a.series), r = Array.isArray(a.labels) ? a.labels.map(v) : [];
76
- return !o || r.length !== Q || !r.every((s) => !!s) ? {} : {
77
- data_series: o,
78
- legends: r.map((s) => ({
75
+ }, w = ["income", "other"], Q = (t) => {
76
+ const e = t?.drilldown_data ?? {}, a = t?.instance_slot?.data?.legends?.map(({ label: r }) => r);
77
+ return {
78
+ data_series: _(e.data_series),
79
+ average_amount: m(e.average_amount),
80
+ income_transaction_guids: A(e.income_transaction_guids),
81
+ sub_tab_labels: a?.length === w.length ? a : void 0
82
+ };
83
+ }, X = 2, P = (t, e) => {
84
+ const a = e ?? {}, r = _(a.series), o = Array.isArray(a.labels) ? a.labels.map(l) : [];
85
+ return !r || o.length !== X || !o.every((s) => !!s) ? {} : {
86
+ data_series: r,
87
+ legends: o.map((s) => ({
79
88
  label: s,
80
89
  value: 0
81
90
  }))
82
91
  };
83
- }, I = (t, e) => E(g(e?.series)).flatMap((a) => a.aggregated_guids ?? []), X = (t, e) => {
84
- const a = e.transaction_history_block?.monthly_debt_to_income_tip_message, o = e.transaction_history_block?.monthly_debt_to_income_tip_limit;
85
- if (!(!a || !o))
92
+ }, G = (t, e) => R(_(e?.series)).flatMap((a) => a.aggregated_guids ?? []), Z = (t, e) => {
93
+ const a = e.transaction_history_block?.monthly_debt_to_income_tip_message, r = e.transaction_history_block?.monthly_debt_to_income_tip_limit;
94
+ if (!(!a || !r))
86
95
  return {
87
- message: S(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: o })),
96
+ message: T(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: r })),
88
97
  onDismiss: () => t(!0)
89
98
  };
90
- }, Z = (t, e) => {
91
- const a = w(t, e);
92
- return a.data_series ? a : V(t?.instance_slot?.data ?? {});
93
99
  }, $ = (t, e) => {
94
- const a = e.transaction_history_block?.savings_to_income_tip_message, o = e.transaction_history_block?.savings_to_income_tip_percentage;
95
- if (!(!a || !o))
100
+ const a = P(t, e);
101
+ return a.data_series ? a : W(t?.instance_slot?.data ?? {});
102
+ }, tt = (t, e) => {
103
+ const a = e.transaction_history_block?.savings_to_income_tip_message, r = e.transaction_history_block?.savings_to_income_tip_percentage;
104
+ if (!(!a || !r))
96
105
  return {
97
- message: S(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: o })),
106
+ message: T(a, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: r })),
98
107
  onDismiss: () => t(!0)
99
108
  };
100
- }, tt = (t) => E(g(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), et = (t, e) => {
101
- const a = x(t, e);
109
+ }, et = (t) => R(_(t.insights_payload?.drilldown_data?.data_series)).flatMap((e) => e.aggregated_guids ?? []), at = (t, e) => {
110
+ const a = V(t, e);
102
111
  return a ? [...t, a] : t;
103
- }, at = (t, e, a, o) => {
104
- const r = o?.merchant_name, s = o?.date;
105
- if (!r || !s) return;
112
+ }, rt = (t, e, a, r) => {
113
+ const o = r?.merchant_name, s = r?.date;
114
+ if (!o || !s) return;
106
115
  const i = e.transaction_history_block?.upcoming_bill_tip_message;
107
116
  if (i)
108
117
  return {
109
- message: S(i, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), r, C(f(s), M.FULL_MONTH_DAY)),
118
+ message: T(i, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), o, O(u(s), N.FULL_MONTH_DAY)),
110
119
  onDismiss: () => t(!0)
111
120
  };
112
- }, N = ({ beatTransactions: t, dataSeries: e, selectedIndex: a }) => {
113
- const o = e[a], r = o?.guid, s = t.find((i) => i.guid === r)?.has_been_split;
121
+ }, D = ({ beatTransactions: t, dataSeries: e, selectedIndex: a }) => {
122
+ const r = e[a], o = r?.guid, s = t.find((i) => i.guid === o)?.has_been_split;
114
123
  return {
115
- custom: (i) => i.guid === r,
116
- dateRange: y(o?.date),
124
+ custom: (i) => i.guid === o,
125
+ dateRange: v(r?.date),
117
126
  showSplits: !s
118
127
  };
119
128
  }, ot = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
120
- const o = t[e], r = a.category_guid ?? o?.guid;
129
+ const r = t[e], o = a.category_guid ?? r?.guid;
121
130
  return {
122
- custom: (s) => s.category_guid === r || s.top_level_category_guid === r,
123
- dateRange: y(o?.date)
131
+ custom: (s) => s.category_guid === o || s.top_level_category_guid === o,
132
+ dateRange: v(r?.date)
124
133
  };
125
- }, rt = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: a, instanceSlotData: o }) => {
126
- const r = t[e];
134
+ }, st = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: a, instanceSlotData: r }) => {
135
+ const o = t[e];
127
136
  return {
128
137
  custom: (s) => !!s.top_level_category_guid && a.includes(s.top_level_category_guid),
129
- dateRange: y(r?.date),
130
- ...R(o.account_guids)
138
+ dateRange: v(o?.date),
139
+ ...U(r.account_guids)
140
+ };
141
+ }, nt = ({ dataSeries: t, selectedIndex: e, instanceSlotData: a }) => {
142
+ const r = a.merchant_guid, o = u(t[e]?.date ?? "");
143
+ return !r || !E(o) ? {
144
+ accounts: [],
145
+ custom: () => !1
146
+ } : {
147
+ custom: (s) => s.merchant_guid === r && !s.is_hidden,
148
+ dateRange: {
149
+ start: I(o),
150
+ end: M(o)
151
+ }
131
152
  };
132
- }, st = (t) => typeof t == "number" ? j(t) : f(t ?? ""), nt = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: o, instanceSlotData: r }) => {
133
- const s = e[a], { start: i, end: d } = y(s?.date), l = st(t.created_at), m = r.account_guids, A = {
153
+ }, it = (t) => typeof t == "number" ? z(t) : u(t ?? ""), ct = ({ beat: t, dataSeries: e, selectedIndex: a, isLastTab: r, instanceSlotData: o }) => {
154
+ const s = e[a], { start: i, end: p } = v(s?.date), d = it(t.created_at), S = o.account_guids, C = {
134
155
  start: i,
135
- end: o && B(l) && l < d ? l : d
156
+ end: r && E(d) && d < p ? d : p
136
157
  };
137
- return m?.length ? {
138
- dateRange: A,
139
- accounts: m
158
+ return S?.length ? {
159
+ dateRange: C,
160
+ accounts: S
140
161
  } : {
141
- dateRange: A,
162
+ dateRange: C,
142
163
  accounts: [],
143
164
  custom: () => !1
144
165
  };
145
- }, b = (t, e, a) => {
146
- const o = new Set(t), r = f(e ?? "");
147
- return !o.size || !B(r) ? {
166
+ }, y = (t, e, a) => {
167
+ const r = new Set(t), o = u(e ?? "");
168
+ return !r.size || !E(o) ? {
148
169
  accounts: [],
149
170
  custom: () => !1
150
171
  } : {
151
- custom: (s) => o.has(s.guid),
172
+ custom: (s) => r.has(s.guid),
152
173
  dateRange: {
153
- start: G(r),
154
- end: L(r)
174
+ start: I(o),
175
+ end: M(o)
155
176
  },
156
- ...R(a)
177
+ ...U(a)
157
178
  };
158
- }, it = ({ beat: t, dataSeries: e, selectedIndex: a }) => b(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), u = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: o }) => {
159
- const r = e[a];
160
- return b(o === 1 ? r?.comparisonGuids : r?.mainGuids, r?.date, t.account_guids);
161
- }, ct = ({ beat: t, dataSeries: e, subIndex: a }) => b(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), lt = (t) => {
162
- const { dataSeries: e, selectedIndex: a, subIndex: o, instanceSlotData: r } = t, s = e[a], i = new Set(r.income_transaction_guids), d = U[o] === "income", l = r.sub_tab_labels ? s?.aggregated_guids?.filter((m) => i.has(m) === d) : s?.aggregated_guids;
163
- return b(l, s?.date);
164
- }, Ot = {
179
+ }, lt = ({ beat: t, dataSeries: e, selectedIndex: a }) => y(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), f = ({ beat: t, comparisonBars: e, selectedIndex: a, subIndex: r }) => {
180
+ const o = e[a];
181
+ return y(r === 1 ? o?.comparisonGuids : o?.mainGuids, o?.date, t.account_guids);
182
+ }, _t = ({ beat: t, dataSeries: e, subIndex: a }) => y(e[a]?.aggregated_guids, e[a]?.date, t.account_guids), dt = (t) => {
183
+ const { dataSeries: e, selectedIndex: a, subIndex: r, instanceSlotData: o } = t, s = e[a], i = new Set(o.income_transaction_guids), p = w[r] === "income", d = o.sub_tab_labels ? s?.aggregated_guids?.filter((S) => i.has(S) === p) : s?.aggregated_guids;
184
+ return y(d, s?.date);
185
+ }, At = {
165
186
  [n.TRANSACTION]: {
166
187
  top: "singleBar",
167
188
  scope: "store",
168
189
  filterMode: "store",
169
- filterStrategy: N,
170
- colors: (t, e) => [_(t, e)],
190
+ filterStrategy: D,
191
+ colors: (t, e) => [g(t, e)],
171
192
  header: (t) => {
172
193
  const { title: e, subHeader: a } = t;
173
194
  return {
174
195
  heading: e,
175
196
  subHeadingText: a?.text || void 0,
176
- icon: /* @__PURE__ */ c(H, {
197
+ icon: /* @__PURE__ */ c(k, {
177
198
  logo: {
178
199
  ...a?.logo,
179
200
  merchant_name: a?.text ?? a?.logo?.merchant_name
@@ -183,7 +204,7 @@ var n = {
183
204
  };
184
205
  },
185
206
  tipSection: (t, e, a = "") => ({
186
- message: S(e.general.tip_section_message, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: a })),
207
+ message: T(e.general.tip_section_message, /* @__PURE__ */ c("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ c("strong", { children: a })),
187
208
  onDismiss: () => t(!0)
188
209
  })
189
210
  },
@@ -193,11 +214,11 @@ var n = {
193
214
  filterStrategy: ot,
194
215
  scope: "store",
195
216
  filterMode: "store",
196
- colors: (t, e) => [_(t, e)],
217
+ colors: (t, e) => [g(t, e)],
197
218
  header: (t) => ({
198
219
  heading: t.categoryName,
199
- subHeadingText: t.selectedDate && C(h(t.selectedDate), M.MONTH_LONG) || "",
200
- icon: /* @__PURE__ */ c(W, {
220
+ subHeadingText: t.selectedDate && O(h(t.selectedDate), N.MONTH_LONG) || "",
221
+ icon: /* @__PURE__ */ c(B, {
201
222
  color: "primary",
202
223
  name: "calendar_month",
203
224
  size: 16
@@ -206,14 +227,14 @@ var n = {
206
227
  },
207
228
  [n.MONTHLY_SPEND]: {
208
229
  top: "singleBar",
209
- filterStrategy: rt,
230
+ filterStrategy: st,
210
231
  scope: "store",
211
232
  filterMode: "store",
212
233
  colors: (t) => [t.palette.chart.chart2 ?? t.palette.primary.main]
213
234
  },
214
235
  [n.ACCOUNT_BALANCE]: {
215
236
  top: "singleBar",
216
- filterStrategy: nt,
237
+ filterStrategy: ct,
217
238
  slotData: q,
218
239
  scope: "store",
219
240
  filterMode: "store",
@@ -221,28 +242,28 @@ var n = {
221
242
  },
222
243
  [n.UPCOMING_BILL]: {
223
244
  top: "upcomingBill",
224
- filterStrategy: N,
245
+ filterStrategy: D,
225
246
  scope: "beat",
226
247
  filterMode: "local",
227
- colors: (t, e) => [_(t, e)],
248
+ colors: (t, e) => [g(t, e)],
228
249
  slotData: K,
229
- beatTransactions: et,
250
+ beatTransactions: at,
230
251
  fetchMissingTransactions: (t) => t.insights_payload?.drilldown_data?.transaction_guids,
231
- tipSection: at
252
+ tipSection: rt
232
253
  },
233
254
  [n.DEPOSIT_SUMMARY]: {
234
255
  top: "singleBar",
235
- filterStrategy: lt,
256
+ filterStrategy: dt,
236
257
  scope: "store",
237
258
  filterMode: "store",
238
259
  colors: (t) => [t.palette.success.main],
239
- slotData: J,
240
- fetchMissingTransactions: tt,
260
+ slotData: Q,
261
+ fetchMissingTransactions: et,
241
262
  subTabs: ({ instanceSlotData: t }) => t.sub_tab_labels ?? []
242
263
  },
243
264
  [n.LOW_BALANCE]: {
244
265
  top: "list",
245
- filterStrategy: z,
266
+ filterStrategy: j,
246
267
  scope: "store",
247
268
  filterMode: "store",
248
269
  colors: (t) => [t.palette.primary.main],
@@ -250,72 +271,90 @@ var n = {
250
271
  },
251
272
  [n.SUBSCRIPTION_AGGREGATE]: {
252
273
  top: "monthTabs",
253
- filterStrategy: it,
274
+ filterStrategy: lt,
254
275
  scope: "store",
255
276
  filterMode: "store",
256
277
  colors: (t) => [t.palette.primary.main]
257
278
  },
279
+ [n.MERCHANT_BUDGET]: {
280
+ top: "singleBar",
281
+ filterStrategy: nt,
282
+ slotData: J,
283
+ scope: "store",
284
+ filterMode: "store",
285
+ colors: (t) => [t.palette.chart.chart1 ?? t.palette.primary.main],
286
+ header: (t) => ({
287
+ heading: t.slotData?.merchant_name ?? t.title,
288
+ subHeadingText: t.selectedDate && O(h(t.selectedDate), N.MONTH_LONG) || "",
289
+ icon: /* @__PURE__ */ c(B, {
290
+ color: "primary",
291
+ name: "calendar_month",
292
+ size: 16
293
+ })
294
+ })
295
+ },
258
296
  [n.SPEND_TO_INCOME]: {
259
297
  top: "doubleBar",
260
- filterStrategy: u,
298
+ filterStrategy: f,
261
299
  scope: "store",
262
300
  filterMode: "store",
263
- colors: (t) => T(t, "spend_to_income")?.color ?? [],
301
+ colors: (t) => b(t, "spend_to_income")?.color ?? [],
264
302
  subTabAriaLabels: (t) => [t.general.spend_transactions, t.general.income_transactions]
265
303
  },
266
304
  [n.COST_OF_LIVING]: {
267
305
  top: "doubleBar",
268
- filterStrategy: u,
306
+ filterStrategy: f,
269
307
  scope: "store",
270
308
  filterMode: "store",
271
- colors: (t, e) => [_(t, e), t.palette.chart.chart4 ?? t.palette.primary.main],
309
+ colors: (t, e) => [g(t, e), t.palette.chart.chart4 ?? t.palette.primary.main],
272
310
  subTabAriaLabels: (t) => [void 0, t.general.income_transactions]
273
311
  },
274
312
  [n.DEBT_TO_INCOME]: {
275
313
  top: "doubleBar",
276
- filterStrategy: u,
314
+ filterStrategy: f,
277
315
  scope: "store",
278
316
  filterMode: "store",
279
- colors: (t) => T(t, "debt_to_income")?.color ?? [],
317
+ colors: (t) => b(t, "debt_to_income")?.color ?? [],
280
318
  subTabAriaLabels: (t) => [void 0, t.general.income_transactions],
281
- slotData: w,
282
- fetchMissingTransactions: I,
283
- tipSection: X
319
+ slotData: P,
320
+ fetchMissingTransactions: G,
321
+ tipSection: Z
284
322
  },
285
323
  [n.SAVINGS_TO_INCOME]: {
286
324
  top: "doubleBar",
287
- filterStrategy: u,
325
+ filterStrategy: f,
288
326
  scope: "store",
289
327
  filterMode: "store",
290
- colors: (t) => T(t, "savings_to_income")?.color ?? [],
328
+ colors: (t) => b(t, "savings_to_income")?.color ?? [],
291
329
  subTabAriaLabels: (t) => [t.general.savings_transactions, t.general.income_transactions],
292
- slotData: Z,
293
- fetchMissingTransactions: I,
294
- tipSection: $
330
+ slotData: $,
331
+ fetchMissingTransactions: G,
332
+ tipSection: tt
295
333
  },
296
334
  [n.NON_ESSENTIAL_CATEGORY]: {
297
335
  top: "tabsOnly",
298
- filterStrategy: ct,
336
+ filterStrategy: _t,
299
337
  scope: "store",
300
338
  filterMode: "store",
301
339
  colors: (t) => [t.palette.primary.main]
302
340
  }
303
- }, At = {
341
+ }, Mt = {
304
342
  top: "singleBar",
305
- filterStrategy: N,
343
+ filterStrategy: D,
306
344
  scope: "store",
307
345
  filterMode: "store",
308
- colors: (t, e) => [_(t, e)]
346
+ colors: (t, e) => [g(t, e)]
309
347
  };
310
348
  export {
311
349
  n as DRILLDOWN_VARIANTS,
312
- At as FALLBACK,
313
- Ot as layout,
314
- w as resolveDebtToIncomeSlotData,
315
- J as resolveDepositSummarySlotData,
350
+ Mt as FALLBACK,
351
+ At as layout,
352
+ P as resolveDebtToIncomeSlotData,
353
+ Q as resolveDepositSummarySlotData,
354
+ J as resolveMerchantBudgetSlotData,
316
355
  q as resolveSavingsContributionsSlotData,
317
356
  K as resolveUpcomingBillSlotData,
318
- et as resolveUpcomingBillTransactions
357
+ at as resolveUpcomingBillTransactions
319
358
  };
320
359
 
321
360
  //# sourceMappingURL=layout.es.js.map