@mx-cartographer/experiences 9.7.0 → 9.7.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/core/types/InsightsInstanceSlotData.d.ts +6 -2
- package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
- package/dist/finstrong/components/ManageDOB.es.js +16 -16
- package/dist/goals/components/GoalList.es.js +1 -1
- package/dist/goals/components/actions/BirthdayAction.es.js +11 -11
- package/dist/insights/components/insights/BillAmountNotStandard/BillAmountNotStandard.es.js +9 -9
- package/dist/insights/components/insights/BillAmountNotStandard/BillAmountNotStandardMUI.es.js +8 -8
- package/dist/insights/components/insights/MonthlySpendingComparisonV2/MonthlySpendingComparisonV2.es.js +9 -9
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js +11 -11
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.d.ts +7 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +24 -11
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js +4 -4
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +58 -58
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistory.d.ts +1 -3
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistory.es.js +14 -13
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistory.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +8 -2
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +56 -36
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.d.ts +7 -3
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +30 -32
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.d.ts +3 -2
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +16 -15
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js +5 -5
- package/dist/insights-v2/blocks/ComponentBlocks/DebtsBlock/DebtsBlock.es.js +6 -6
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.d.ts +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +24 -10
- package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +4 -4
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingBillBlock/UpcomingBillBlock.es.js +6 -6
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +24 -24
- package/dist/insights-v2/components/CompactInsightCard.d.ts +4 -2
- package/dist/insights-v2/components/CompactInsightCard.es.js +91 -59
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/EmptyBarChart.es.js +4 -4
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js +16 -15
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js.map +1 -1
- package/dist/insights-v2/index.es.js +122 -121
- package/dist/insights-v2/mappings/blocks.es.js +112 -99
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +10 -10
- package/dist/recurringtransactions/components/PaymentSchedule.es.js +11 -11
- package/dist/recurringtransactions/components/RecurringTransactionDetails.es.js +16 -16
- package/dist/settings/components/profile/ProfileTab.es.js +33 -33
- package/dist/transactions/components/shared/TransactionDetails.es.js +5 -4
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,75 +1,76 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { formatCurrency as
|
|
1
|
+
import { useGlobalCopyStore as Z, useGlobalUiStore as tt, useInsightsV2Store as et } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { formatCurrency as ot } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
3
|
import at from "../../../common/components/drawer/Drawer.es.js";
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import { getDefaultSelection as
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
19
|
-
|
|
4
|
+
import nt from "../../../common/components/Loader.es.js";
|
|
5
|
+
import { BAR_ARIA_LABEL as rt } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
6
|
+
import { BarChartV2 as it } from "../../components/chartblocks/BarchartV2.es.js";
|
|
7
|
+
import { EmptyBarChart as st } from "../../components/chartblocks/EmptyBarChart.es.js";
|
|
8
|
+
import { ANALYTICS_EVENTS_CONFIG as B } from "../../analytics/analyticsEventsConfig.es.js";
|
|
9
|
+
import { useAnalyticsEvent as lt } from "../../analytics/useAnalyticsEvent.es.js";
|
|
10
|
+
import { TransactionDrillDown as ct } from "./TransactionDrillDown.es.js";
|
|
11
|
+
import { getDefaultSelection as mt, getDrillDownConfig as dt, getFlattenedDataSeries as pt, resolveDrillDownSubHeader as gt, toStoreFilter as ut } from "./utils.es.js";
|
|
12
|
+
import { useTransactionHistory as ft } from "./useTransactionHistory.es.js";
|
|
13
|
+
import { getDynamicCtaBasedOnTriggers as ht } from "../util.es.js";
|
|
14
|
+
import { TransactionDetailsBlock as yt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
|
|
15
|
+
import { useLayoutEffect as Ct, useState as u } from "react";
|
|
16
|
+
import { observer as bt } from "mobx-react-lite";
|
|
17
|
+
import { Fragment as Tt, jsx as a, jsxs as _t } from "react/jsx-runtime";
|
|
18
|
+
import { useTheme as St } from "@mui/material/styles";
|
|
19
|
+
var Vt = bt(({ beat: o }) => {
|
|
20
|
+
const f = St(), { instanceSlotData: e, beatTransactions: l, spendCategoryGuids: h, allAccountGuids: y, categoryName: x, displayedDateRange: p, transactionStore: E } = ft(o), { actionDrawer: C, setActionContext: b } = et(), { common: I, insights_feed: c } = Z(), { isCopyLoaded: F } = tt(), [G, T] = u(!1), [R, H] = u(!1), _ = lt(), { insights_payload: n } = o, w = ht(C, n?.primary_cta, n?.secondary_cta, n?.in_description_cta)?.variant, { top: r, filterMode: m, header: O, colors: j, filterStrategy: k, tipSection: S } = dt(w ?? ""), { dataSeries: d, chartData: i, comparisonBars: K } = pt({
|
|
20
21
|
data: e?.data_series,
|
|
21
|
-
ariaLabel:
|
|
22
|
+
ariaLabel: rt,
|
|
22
23
|
top: r,
|
|
23
24
|
beatTransactions: l,
|
|
24
25
|
payload: e
|
|
25
|
-
}), { chartBarIndex:
|
|
26
|
+
}), { chartBarIndex: N, subTabIndex: V } = mt({
|
|
26
27
|
chartTabCount: i.length,
|
|
27
|
-
comparisonTabCount:
|
|
28
|
-
actionDrawer:
|
|
29
|
-
beatGuid:
|
|
30
|
-
}), [s, D] = u(
|
|
31
|
-
beat:
|
|
28
|
+
comparisonTabCount: K.length,
|
|
29
|
+
actionDrawer: C,
|
|
30
|
+
beatGuid: o.guid
|
|
31
|
+
}), [s, D] = u(N), A = (t) => k({
|
|
32
|
+
beat: o,
|
|
32
33
|
beatTransactions: l,
|
|
33
34
|
dataSeries: d,
|
|
34
35
|
selectedIndex: t,
|
|
35
|
-
subIndex:
|
|
36
|
+
subIndex: V,
|
|
36
37
|
isLastTab: t === d.length - 1,
|
|
37
38
|
instanceSlotData: e,
|
|
38
39
|
spendCategoryGuids: h,
|
|
39
40
|
displayedDateRange: p
|
|
40
|
-
}),
|
|
41
|
-
m !== "store" || !
|
|
41
|
+
}), M = l.map((t) => t.guid).join(","), P = h.join(","), U = y.join(","), W = r === "list" || d.length > 0, v = () => {
|
|
42
|
+
m !== "store" || !W || E.setFilter(ut(A(s), {
|
|
42
43
|
allAccountGuids: y,
|
|
43
44
|
displayedDateRange: p
|
|
44
45
|
}));
|
|
45
46
|
};
|
|
46
|
-
|
|
47
|
+
Ct(() => {
|
|
47
48
|
v();
|
|
48
49
|
}, [
|
|
49
|
-
|
|
50
|
+
o.guid,
|
|
50
51
|
s,
|
|
51
52
|
m,
|
|
52
53
|
d.length,
|
|
53
54
|
e,
|
|
54
55
|
p,
|
|
55
|
-
M,
|
|
56
56
|
P,
|
|
57
|
-
|
|
57
|
+
U,
|
|
58
|
+
M,
|
|
58
59
|
r
|
|
59
60
|
]);
|
|
60
|
-
const g =
|
|
61
|
-
title:
|
|
62
|
-
subHeader:
|
|
61
|
+
const L = gt(n), g = O?.({
|
|
62
|
+
title: n?.title,
|
|
63
|
+
subHeader: L,
|
|
63
64
|
categoryName: x,
|
|
64
65
|
selectedDate: i[s]?.date ?? void 0
|
|
65
|
-
}),
|
|
66
|
-
if (!
|
|
67
|
-
const
|
|
66
|
+
}), Y = j(f, e?.category_guid);
|
|
67
|
+
if (!F) return /* @__PURE__ */ a(nt, {});
|
|
68
|
+
const $ = [c.general.monthly_amount, c.general.trend], [q, z] = e?.legends?.length ? e.legends.map((t) => t.label) : $, J = m === "local" ? (t) => A(t).custom ?? (() => !0) : void 0, Q = m === "local" ? l : void 0, X = r === "singleBar" || r === "upcomingBill" ? i.length ? /* @__PURE__ */ a(it, {
|
|
68
69
|
amounts: {
|
|
69
70
|
average: e?.average_amount,
|
|
70
|
-
formattedAverage:
|
|
71
|
+
formattedAverage: ot(e?.average_amount ?? 0, "0,0.00")
|
|
71
72
|
},
|
|
72
|
-
color:
|
|
73
|
+
color: Y[0] ?? f.palette.primary.main,
|
|
73
74
|
data: i,
|
|
74
75
|
legendPosition: "top",
|
|
75
76
|
heightOverride: 142,
|
|
@@ -79,20 +80,19 @@ var kt = ht(({ beat: a }) => {
|
|
|
79
80
|
left: 24,
|
|
80
81
|
right: 24
|
|
81
82
|
},
|
|
82
|
-
monthlyAmountLabel:
|
|
83
|
+
monthlyAmountLabel: q,
|
|
83
84
|
onBarClick: (t) => {
|
|
84
|
-
_(
|
|
85
|
+
_(B.DRAWER_CHART_BAR_CLICKED), D(t);
|
|
85
86
|
},
|
|
86
87
|
selectedTabIndex: s,
|
|
87
|
-
trendAmountLabel:
|
|
88
|
-
}) : /* @__PURE__ */
|
|
89
|
-
return /* @__PURE__ */
|
|
90
|
-
|
|
91
|
-
baseTransactions: J,
|
|
88
|
+
trendAmountLabel: z
|
|
89
|
+
}) : /* @__PURE__ */ a(st, {}) : null;
|
|
90
|
+
return /* @__PURE__ */ _t(Tt, { children: [/* @__PURE__ */ a(ct, {
|
|
91
|
+
baseTransactions: Q,
|
|
92
92
|
heading: g?.heading,
|
|
93
93
|
icon: g?.icon,
|
|
94
94
|
onSelectionChange: (t) => {
|
|
95
|
-
_(
|
|
95
|
+
_(B.TAB_SELECTED), D(t);
|
|
96
96
|
},
|
|
97
97
|
selectedIndex: s,
|
|
98
98
|
subHeadingText: g?.subHeadingText,
|
|
@@ -100,24 +100,24 @@ var kt = ht(({ beat: a }) => {
|
|
|
100
100
|
ariaLabel: t.ariaLabel,
|
|
101
101
|
label: t.label
|
|
102
102
|
})),
|
|
103
|
-
top:
|
|
104
|
-
...S && { tipSection: !
|
|
105
|
-
transactionFilter:
|
|
103
|
+
top: X,
|
|
104
|
+
...S && { tipSection: !R && S(H, c, L?.text) },
|
|
105
|
+
transactionFilter: J,
|
|
106
106
|
onEachRowClick: (t) => {
|
|
107
|
-
|
|
107
|
+
b({ transaction_guid: t }), T(!0);
|
|
108
108
|
}
|
|
109
|
-
}), /* @__PURE__ */
|
|
110
|
-
ariaLabelClose:
|
|
111
|
-
isOpen:
|
|
109
|
+
}), /* @__PURE__ */ a(at, {
|
|
110
|
+
ariaLabelClose: I.close_aria,
|
|
111
|
+
isOpen: G,
|
|
112
112
|
onClose: () => {
|
|
113
|
-
T(!1),
|
|
113
|
+
T(!1), b({ transaction_guid: void 0 }), v();
|
|
114
114
|
},
|
|
115
115
|
title: c.general.transaction_details_title,
|
|
116
|
-
children: /* @__PURE__ */
|
|
116
|
+
children: /* @__PURE__ */ a(yt, { beat: o })
|
|
117
117
|
})] });
|
|
118
118
|
});
|
|
119
119
|
export {
|
|
120
|
-
|
|
120
|
+
Vt as TransactionHistoryBlock
|
|
121
121
|
};
|
|
122
122
|
|
|
123
123
|
//# sourceMappingURL=TransactionHistoryBlock.es.js.map
|
package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionHistoryBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport type { Beat, DataSeries, Transaction } from '../../../core'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport { BarChartV2 } from '../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../components/chartblocks/EmptyBarChart'\n\nimport { TransactionDrillDown } from './TransactionDrillDown'\nimport { useTransactionHistory } from './useTransactionHistory'\nimport {\n getDefaultSelection,\n getDrillDownConfig,\n getFlattenedDataSeries,\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 const {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n } = useTransactionHistory(beat)\n\n const { actionDrawer, setActionContext } = useInsightsV2Store()\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 const { insights_payload } = beat\n\n const dynamicCtaVariant = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n insights_payload?.primary_cta,\n insights_payload?.secondary_cta,\n insights_payload?.in_description_cta,\n )?.variant\n\n const { top, filterMode, header, colors, filterStrategy, tipSection } = getDrillDownConfig(\n dynamicCtaVariant ?? '',\n )\n\n const { dataSeries, chartData, comparisonBars } = getFlattenedDataSeries({\n data: instanceSlotData?.data_series as DataSeries,\n ariaLabel: instanceSlotData?.ariaLabel ?? '',\n top,\n beatTransactions,\n payload: instanceSlotData,\n })\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\n const resolveFilter = (index: number) =>\n filterStrategy({\n beat,\n beatTransactions,\n dataSeries,\n selectedIndex: index,\n subIndex: subTabIndex,\n isLastTab: index === dataSeries.length - 1,\n instanceSlotData,\n spendCategoryGuids,\n displayedDateRange,\n })\n\n // Apply the current selection's filter. Store variants route through the store filter; local\n // (upcomingBill) variants filter beatTransactions directly and only backfill the cache when the\n // Stable primitive keys for the collections below: beatTransactions/spendCategoryGuids/\n // allAccountGuids are recomputed (new array identity) every render, so depending on them directly\n // re-fires the effect each render (REVIEW.md MEW-3732). Key on content instead.\n const beatTransactionGuidsKey = beatTransactions.map((transaction) => transaction.guid).join(',')\n const spendCategoryGuidsKey = spendCategoryGuids.join(',')\n const allAccountGuidsKey = allAccountGuids.join(',')\n\n // Re-applies the current selection's filter to the shared transactionStore. Called both by the\n // effect below (on selection change) and when the nested TransactionDetailsBlock drawer closes:\n // AddMerchantBudgetAction (opened from within that drawer) overwrites transactionStore.filter\n // with a merchant_guid-only filter while its own drawer is open, and never restores it — leaving\n // the row list stuck showing only that one merchant's transactions after backing all the way out.\n // Re-running this on close re-derives the filter fresh instead of relying on whatever the nested\n // drawers left behind.\n // A `list` drawer has no bars: it filters once from the beat alone.\n const canApplyFilter = top === 'list' || dataSeries.length > 0\n const applyCurrentSelectionFilter = () => {\n if (filterMode !== 'store' || !canApplyFilter) return\n transactionStore.setFilter(\n toStoreFilter(resolveFilter(selectedIndex), { allAccountGuids, displayedDateRange }),\n )\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 filterMode,\n dataSeries.length,\n instanceSlotData,\n displayedDateRange,\n spendCategoryGuidsKey,\n allAccountGuidsKey,\n beatTransactionGuidsKey,\n top,\n ])\n\n const headerContent = header?.({\n title: insights_payload?.title,\n subHeader: insights_payload?.sub_title,\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 // TODO: Temporary fallback while the backend doesn't always send `legends` on every beat/variant.\n // Remove this once the backend guarantees `legends` on the payload.\n const legendFallbackLabels = [insightsCopy.general.monthly_amount, insightsCopy.general.trend]\n\n const [monthlyAmountLabel, trendAmountLabel] = instanceSlotData?.legends?.length\n ? instanceSlotData.legends.map((legend) => legend.label)\n : legendFallbackLabels\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 const isBarTop = top === 'singleBar' || top === 'upcomingBill'\n const chartTop = !isBarTop ? null : chartData.length ? (\n <BarChartV2\n amounts={{\n average: instanceSlotData?.average_amount,\n formattedAverage: formatCurrency(instanceSlotData?.average_amount ?? 0, '0,0.00'),\n }}\n color={barColors[0] ?? theme.palette.primary.main}\n data={chartData}\n legendPosition=\"top\"\n heightOverride={142}\n margin={{\n bottom: 8,\n top: 24,\n left: 24,\n right: 24,\n }}\n monthlyAmountLabel={monthlyAmountLabel}\n onBarClick={(index) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.DRAWER_CHART_BAR_CLICKED)\n setSelectedIndex(index)\n }}\n selectedTabIndex={selectedIndex}\n trendAmountLabel={trendAmountLabel}\n />\n ) : (\n <EmptyBarChart />\n )\n\n return (\n <>\n <TransactionDrillDown\n ariaLabel={instanceSlotData?.ariaLabel}\n baseTransactions={baseTransactions}\n heading={headerContent?.heading}\n icon={headerContent?.icon}\n onSelectionChange={(index) => {\n // MUI Tabs only fires onChange on real user selection, not on mount.\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TAB_SELECTED)\n setSelectedIndex(index)\n }}\n selectedIndex={selectedIndex}\n subHeadingText={headerContent?.subHeadingText}\n tabs={chartData.map((bar) => ({\n ariaLabel: bar.ariaLabel,\n label: bar.label,\n }))}\n top={chartTop}\n {...(tipSection && {\n tipSection:\n !closeTipSection &&\n tipSection(setCloseTipSection, insightsCopy, insights_payload?.sub_title?.text),\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":";;;;;;;;;;;;;;;;;AAiCA,IAAa,KAA0B,GAAA,CAAU,EAAE,MAAA,EAAA,MAAmC;AACpF,QAAM,IAAQ,GAAS,GACjB,EACJ,kBAAA,GACA,kBAAA,GACA,oBAAA,GACA,iBAAA,GACA,cAAA,GACA,oBAAA,GACA,kBAAA,EAAA,IACE,GAAsB,CAAI,GAExB,EAAE,cAAA,GAAc,kBAAA,EAAA,IAAqB,GAAmB,GAExD,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAiB,EAAmB,GAEzE,EAAE,cAAA,EAAA,IAAiB,EAAiB,GAEpC,CAAC,GAA0B,CAAA,IAA+B,EAAS,EAAK,GAExE,CAAC,GAAiB,CAAA,IAAsB,EAAS,EAAK,GAEtD,IAAqB,GAAkB,GAEvC,EAAE,kBAAA,EAAA,IAAqB,GAEvB,IAAoB,GACxB,GACA,GAAkB,aAClB,GAAkB,eAClB,GAAkB,kB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A,UAAA,CACE,gBAAA,EAAC,IAAD;AAAA,IACE,WAAW,GAAkB;AAAA,IACX,kBAAA;AAAA,IAClB,SAAS,GAAe;AAAA,IACxB,MAAM,GAAe;AAAA,IACrB,mBAAA,CAAoB,MAAU;AAE5B,MAAA,EAAmB,EAAwB,YAAY,GACvD,EAAiB,CAAK;AAAA,IACxB;AAAA,IACe,eAAA;AAAA,IACf,gBAAgB,GAAe;AAAA,IAC/B,MAAM,EAAU,IAAA,CAAK,OAAS;AAAA,MAC5B,WAAW,EAAI;AAAA,MACf,OAAO,EAAI;AAAA,IACb,EAAE;AAAA,IACF,KAAK;AAAA,IACL,GAAK,KAAc,EACjB,YACE,CAAC,KACD,EAAW,GAAoB,GAAc,GAAkB,WAAW,IAAI,EAClF;AAAA,IACmB,mBAAA;AAAA,IACnB,gBAAA,CAAiB,MAAS;AACxB,MAAA,EAAiB,EAAE,kBAAkB,EAAK,CAAC,GAC3C,EAA4B,EAAI;AAAA,IAClC;AAAA,EACD,CAAA,GACD,gBAAA,EAAC,IAAD;AAAA,IACE,gBAAgB,EAAW;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAA,MAAe;AACb,MAAA,EAA4B,EAAK,GAIjC,EAAiB,EAAE,kBAAkB,OAAU,CAAC,GAGhD,EAA4B;AAAA,IAC9B;AAAA,IACA,OAAO,EAAa,QAAQ;AAAA,IAE5B,UAAA,gBAAA,EAAC,IAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,EAChC,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
|
|
1
|
+
{"version":3,"file":"TransactionHistoryBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.tsx"],"sourcesContent":["import { useLayoutEffect, useState } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport type { Beat, DataSeries, Transaction } from '../../../core'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../analytics'\nimport { BarChartV2 } from '../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../components/chartblocks/EmptyBarChart'\nimport { BAR_ARIA_LABEL } from '../../blocks/ChartBlocks/BarchartBlock/utils'\n\nimport { TransactionDrillDown } from './TransactionDrillDown'\nimport { useTransactionHistory } from './useTransactionHistory'\nimport {\n getDefaultSelection,\n getDrillDownConfig,\n getFlattenedDataSeries,\n resolveDrillDownSubHeader,\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 const {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n } = useTransactionHistory(beat)\n\n const { actionDrawer, setActionContext } = useInsightsV2Store()\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 const { insights_payload } = beat\n\n const dynamicCtaVariant = getDynamicCtaBasedOnTriggers(\n actionDrawer,\n insights_payload?.primary_cta,\n insights_payload?.secondary_cta,\n insights_payload?.in_description_cta,\n )?.variant\n\n const { top, filterMode, header, colors, filterStrategy, tipSection } = getDrillDownConfig(\n dynamicCtaVariant ?? '',\n )\n\n const { dataSeries, chartData, comparisonBars } = getFlattenedDataSeries({\n data: instanceSlotData?.data_series as DataSeries,\n ariaLabel: BAR_ARIA_LABEL,\n top,\n beatTransactions,\n payload: instanceSlotData,\n })\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\n const resolveFilter = (index: number) =>\n filterStrategy({\n beat,\n beatTransactions,\n dataSeries,\n selectedIndex: index,\n subIndex: subTabIndex,\n isLastTab: index === dataSeries.length - 1,\n instanceSlotData,\n spendCategoryGuids,\n displayedDateRange,\n })\n\n // Apply the current selection's filter. Store variants route through the store filter; local\n // (upcomingBill) variants filter beatTransactions directly and only backfill the cache when the\n // Stable primitive keys for the collections below: beatTransactions/spendCategoryGuids/\n // allAccountGuids are recomputed (new array identity) every render, so depending on them directly\n // re-fires the effect each render (REVIEW.md MEW-3732). Key on content instead.\n const beatTransactionGuidsKey = beatTransactions.map((transaction) => transaction.guid).join(',')\n const spendCategoryGuidsKey = spendCategoryGuids.join(',')\n const allAccountGuidsKey = allAccountGuids.join(',')\n\n // Re-applies the current selection's filter to the shared transactionStore. Called both by the\n // effect below (on selection change) and when the nested TransactionDetailsBlock drawer closes:\n // AddMerchantBudgetAction (opened from within that drawer) overwrites transactionStore.filter\n // with a merchant_guid-only filter while its own drawer is open, and never restores it — leaving\n // the row list stuck showing only that one merchant's transactions after backing all the way out.\n // Re-running this on close re-derives the filter fresh instead of relying on whatever the nested\n // drawers left behind.\n // A `list` drawer has no bars: it filters once from the beat alone.\n const canApplyFilter = top === 'list' || dataSeries.length > 0\n const applyCurrentSelectionFilter = () => {\n if (filterMode !== 'store' || !canApplyFilter) return\n transactionStore.setFilter(\n toStoreFilter(resolveFilter(selectedIndex), { allAccountGuids, displayedDateRange }),\n )\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 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 // TODO: Temporary fallback while the backend doesn't always send `legends` on every beat/variant.\n // Remove this once the backend guarantees `legends` on the payload.\n const legendFallbackLabels = [insightsCopy.general.monthly_amount, insightsCopy.general.trend]\n\n const [monthlyAmountLabel, trendAmountLabel] = instanceSlotData?.legends?.length\n ? instanceSlotData.legends.map((legend) => legend.label)\n : legendFallbackLabels\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 const isBarTop = top === 'singleBar' || top === 'upcomingBill'\n const chartTop = !isBarTop ? null : chartData.length ? (\n <BarChartV2\n amounts={{\n average: instanceSlotData?.average_amount,\n formattedAverage: formatCurrency(instanceSlotData?.average_amount ?? 0, '0,0.00'),\n }}\n color={barColors[0] ?? theme.palette.primary.main}\n data={chartData}\n legendPosition=\"top\"\n heightOverride={142}\n margin={{\n bottom: 8,\n top: 24,\n left: 24,\n right: 24,\n }}\n monthlyAmountLabel={monthlyAmountLabel}\n onBarClick={(index) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.DRAWER_CHART_BAR_CLICKED)\n setSelectedIndex(index)\n }}\n selectedTabIndex={selectedIndex}\n trendAmountLabel={trendAmountLabel}\n />\n ) : (\n <EmptyBarChart />\n )\n\n return (\n <>\n <TransactionDrillDown\n baseTransactions={baseTransactions}\n heading={headerContent?.heading}\n icon={headerContent?.icon}\n onSelectionChange={(index) => {\n // MUI Tabs only fires onChange on real user selection, not on mount.\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TAB_SELECTED)\n setSelectedIndex(index)\n }}\n selectedIndex={selectedIndex}\n subHeadingText={headerContent?.subHeadingText}\n tabs={chartData.map((bar) => ({\n ariaLabel: bar.ariaLabel,\n label: bar.label,\n }))}\n top={chartTop}\n {...(tipSection && {\n tipSection:\n !closeTipSection && tipSection(setCloseTipSection, insightsCopy, subHeader?.text),\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,KAA0B,GAAA,CAAU,EAAE,MAAA,EAAA,MAAmC;AACpF,QAAM,IAAQ,GAAS,GACjB,EACJ,kBAAA,GACA,kBAAA,GACA,oBAAA,GACA,iBAAA,GACA,cAAA,GACA,oBAAA,GACA,kBAAA,EAAA,IACE,GAAsB,CAAI,GAExB,EAAE,cAAA,GAAc,kBAAA,EAAA,IAAqB,GAAmB,GAExD,EAAE,QAAQ,GAAY,eAAe,EAAA,IAAiB,EAAmB,GAEzE,EAAE,cAAA,EAAA,IAAiB,GAAiB,GAEpC,CAAC,GAA0B,CAAA,IAA+B,EAAS,EAAK,GAExE,CAAC,GAAiB,CAAA,IAAsB,EAAS,E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BAAkB;AAAA,IACA,kBAAA;AAAA,EACnB,CAAA,IAED,gBAAA,EAAC,IAAD,CAAgB,CAAA,IAzBW;AA4B7B,SACE,gBAAA,GAAA,IAAA,EAAA,UAAA,CACE,gBAAA,EAAC,IAAD;AAAA,IACoB,kBAAA;AAAA,IAClB,SAAS,GAAe;AAAA,IACxB,MAAM,GAAe;AAAA,IACrB,mBAAA,CAAoB,MAAU;AAE5B,MAAA,EAAmB,EAAwB,YAAY,GACvD,EAAiB,CAAK;AAAA,IACxB;AAAA,IACe,eAAA;AAAA,IACf,gBAAgB,GAAe;AAAA,IAC/B,MAAM,EAAU,IAAA,CAAK,OAAS;AAAA,MAC5B,WAAW,EAAI;AAAA,MACf,OAAO,EAAI;AAAA,IACb,EAAE;AAAA,IACF,KAAK;AAAA,IACL,GAAK,KAAc,EACjB,YACE,CAAC,KAAmB,EAAW,GAAoB,GAAc,GAAW,IAAI,EACpF;AAAA,IACmB,mBAAA;AAAA,IACnB,gBAAA,CAAiB,MAAS;AACxB,MAAA,EAAiB,EAAE,kBAAkB,EAAK,CAAC,GAC3C,EAA4B,EAAI;AAAA,IAClC;AAAA,EACD,CAAA,GACD,gBAAA,EAAC,IAAD;AAAA,IACE,gBAAgB,EAAW;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAA,MAAe;AACb,MAAA,EAA4B,EAAK,GAIjC,EAAiB,EAAE,kBAAkB,OAAU,CAAC,GAGhD,EAA4B;AAAA,IAC9B;AAAA,IACA,OAAO,EAAa,QAAQ;AAAA,IAE5B,UAAA,gBAAA,EAAC,IAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,EAChC,CAAA,CACR,EAAA,CAAA;AAEN,CAAC"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Beat } from '../../../core';
|
|
2
|
-
import { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData';
|
|
3
2
|
export declare const useTransactionHistory: (beat: Beat) => {
|
|
4
|
-
instanceSlotData:
|
|
3
|
+
instanceSlotData: import('./utils').DrillDownSlotData;
|
|
5
4
|
beatTransactions: import('../../../core').Transaction[];
|
|
6
|
-
primaryTransaction: import('../../../core').Transaction | undefined;
|
|
7
5
|
spendCategoryGuids: string[];
|
|
8
6
|
allAccountGuids: string[];
|
|
9
7
|
categoryName: string;
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { useAccountStore as
|
|
2
|
-
import { selectTransactionsByGuids as
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { useAccountStore as c, useCategoryStore as u, useGlobalUiStore as d, useTransactionStore as g } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { selectTransactionsByGuids as l } from "../../CommonUtils.es.js";
|
|
3
|
+
import { toDrillDownSlotData as m } from "./utils.es.js";
|
|
4
|
+
import { useMemo as p } from "react";
|
|
5
|
+
var f = (n) => {
|
|
6
|
+
const a = n.insights_payload, t = p(() => m(a?.instance_slot?.data ?? {}), [a]), s = g(), r = c(), e = u(), { displayedDateRange: i } = d();
|
|
5
7
|
return {
|
|
6
|
-
instanceSlotData:
|
|
7
|
-
beatTransactions:
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
transactionStore: o
|
|
8
|
+
instanceSlotData: t,
|
|
9
|
+
beatTransactions: l(s.detailedTransactions, t?.transaction_guids),
|
|
10
|
+
spendCategoryGuids: e.spendCategories.map((o) => o.guid),
|
|
11
|
+
allAccountGuids: r.accounts.map((o) => o.guid),
|
|
12
|
+
categoryName: e.getCategoryName(t?.category_guid ?? "") || "",
|
|
13
|
+
displayedDateRange: i,
|
|
14
|
+
transactionStore: s
|
|
14
15
|
};
|
|
15
16
|
};
|
|
16
17
|
export {
|
|
17
|
-
|
|
18
|
+
f as useTransactionHistory
|
|
18
19
|
};
|
|
19
20
|
|
|
20
21
|
//# sourceMappingURL=useTransactionHistory.es.js.map
|
package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistory.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useTransactionHistory.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistory.ts"],"sourcesContent":["import {\n useAccountStore,\n useCategoryStore,\n useGlobalUiStore,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat } from '../../../core'\nimport type {
|
|
1
|
+
{"version":3,"file":"useTransactionHistory.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistory.ts"],"sourcesContent":["import { useMemo } from 'react'\n\nimport {\n useAccountStore,\n useCategoryStore,\n useGlobalUiStore,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat } from '../../../core'\nimport type { BarChartBlockData } from '../../../core/types/InsightsInstanceSlotData'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { toDrillDownSlotData } from './utils'\n\nexport const useTransactionHistory = (beat: Beat) => {\n // Memoised: the drawer's filter effect depends on this object's identity.\n const insightsPayload = beat.insights_payload\n const instanceSlotData = useMemo(\n () => toDrillDownSlotData((insightsPayload?.instance_slot?.data ?? {}) as BarChartBlockData),\n [insightsPayload],\n )\n\n const transactionStore = useTransactionStore()\n const accountStore = useAccountStore()\n const categoryStore = useCategoryStore()\n const { displayedDateRange } = useGlobalUiStore()\n\n const beatTransactions = selectTransactionsByGuids(\n transactionStore.detailedTransactions,\n instanceSlotData?.transaction_guids,\n )\n\n const spendCategoryGuids = categoryStore.spendCategories.map((category) => category.guid)\n const allAccountGuids = accountStore.accounts.map((account) => account.guid)\n const categoryName = categoryStore.getCategoryName(instanceSlotData?.category_guid ?? '') || ''\n\n return {\n instanceSlotData,\n beatTransactions,\n spendCategoryGuids,\n allAccountGuids,\n categoryName,\n displayedDateRange,\n transactionStore,\n }\n}\n"],"mappings":";;;;AAaA,IAAa,IAAA,CAAyB,MAAe;AAEnD,QAAM,IAAkB,EAAK,kBACvB,IAAmB,EAAA,MACjB,EAAqB,GAAiB,eAAe,QAAQ,CAAC,CAAuB,GAC3F,CAAC,CAAe,CAClB,GAEM,IAAmB,EAAoB,GACvC,IAAe,EAAgB,GAC/B,IAAgB,EAAiB,GACjC,EAAE,oBAAA,EAAA,IAAuB,EAAiB;AAWhD,SAAO;AAAA,IACL,kBAAA;AAAA,IACA,kBAXuB,EACvB,EAAiB,sBACjB,GAAkB,iBASlB;AAAA,IACA,oBAPyB,EAAc,gBAAgB,IAAA,CAAK,MAAa,EAAS,IAOlF;AAAA,IACA,iBAPsB,EAAa,SAAS,IAAA,CAAK,MAAY,EAAQ,IAOrE;AAAA,IACA,cAPmB,EAAc,gBAAgB,GAAkB,iBAAiB,EAAE,KAAK;AAAA,IAQ3F,oBAAA;AAAA,IACA,kBAAA;AAAA,EACF;AACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ActionDrawerState, DataSeries, GlobalCopy, Transaction } from '../../../core';
|
|
2
|
-
import { DataSet } from '../../../core/types/InsightsInstanceSlotData';
|
|
1
|
+
import { ActionDrawerState, DataSeries, GlobalCopy, InsightsPayload, Subtitle, Transaction } from '../../../core';
|
|
2
|
+
import { BarChartBlockData, DataSet, InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData';
|
|
3
3
|
import { TransactionFilter } from '../../../core/stores/TransactionStore';
|
|
4
4
|
import { buildChartData, ChartDataSeriesItem } from '../../blocks/ChartBlocks/BarchartBlock/utils';
|
|
5
5
|
import { DrillDownVariantConfig } from './layout';
|
|
@@ -61,4 +61,10 @@ export declare const getDefaultSelection: ({ chartTabCount, actionDrawer, beatGu
|
|
|
61
61
|
chartBarIndex: number;
|
|
62
62
|
subTabIndex: number;
|
|
63
63
|
};
|
|
64
|
+
/** The drawer's facts: the generic slot facts plus the bar chart's average. */
|
|
65
|
+
export type DrillDownSlotData = InsightsInstanceSlotData & Pick<BarChartBlockData, 'average_amount'>;
|
|
66
|
+
/** The drawer's facts from a bar chart's `instance_slot.data`. */
|
|
67
|
+
export declare const toDrillDownSlotData: ({ series, category_guid, average_amount, additional_data, }: BarChartBlockData) => DrillDownSlotData;
|
|
68
|
+
/** The drawer's sub-heading: the merchant name and logo. */
|
|
69
|
+
export declare const resolveDrillDownSubHeader: (payload: Partial<InsightsPayload> | undefined) => Subtitle | undefined;
|
|
64
70
|
export {};
|
|
@@ -1,67 +1,87 @@
|
|
|
1
|
-
import { DATE_FORMATS_INTL as
|
|
2
|
-
import { buildChartData as s, buildDataSeries as
|
|
3
|
-
import { DRILLDOWN_VARIANTS as
|
|
1
|
+
import { DATE_FORMATS_INTL as l } from "../../../core/constants/DateFormats.es.js";
|
|
2
|
+
import { buildChartData as s, buildDataSeries as u } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
3
|
+
import { DRILLDOWN_VARIANTS as g, FALLBACK as m, layout as _ } from "./layout.es.js";
|
|
4
4
|
import { format as h, fromUnixTime as D } from "date-fns";
|
|
5
|
-
var
|
|
5
|
+
var y = (t) => _[t] ?? m, I = ({ data: t, ariaLabel: e, top: r, beatTransactions: n, payload: a }) => {
|
|
6
6
|
if (r === "upcomingBill") {
|
|
7
|
-
const d =
|
|
7
|
+
const d = S(n, a);
|
|
8
8
|
return {
|
|
9
9
|
dataSeries: d,
|
|
10
|
-
chartData: s(d, e,
|
|
10
|
+
chartData: s(d, e, l.MONTH_DAY),
|
|
11
11
|
comparisonBars: []
|
|
12
12
|
};
|
|
13
13
|
}
|
|
14
|
-
const
|
|
14
|
+
const o = [...u(t)].sort((d, i) => !d.date || !i.date ? 0 : new Date(d.date).getTime() - new Date(i.date).getTime());
|
|
15
15
|
return {
|
|
16
|
-
dataSeries:
|
|
17
|
-
chartData: s(
|
|
16
|
+
dataSeries: o,
|
|
17
|
+
chartData: s(o, e),
|
|
18
18
|
comparisonBars: []
|
|
19
19
|
};
|
|
20
|
-
},
|
|
20
|
+
}, f = "TRN-projected-bill", p = (t) => ({
|
|
21
21
|
date: h(D(t.date), "yyyy-MM-dd"),
|
|
22
22
|
amount: t.amount,
|
|
23
23
|
guid: t.guid,
|
|
24
24
|
category_guid: t.top_level_category_guid ?? t.category_guid
|
|
25
|
-
}),
|
|
25
|
+
}), S = (t = [], e) => {
|
|
26
26
|
if (!t.length || e?.date == null || e?.amount == null) return [];
|
|
27
|
-
const r = [...t].sort((i, c) => i.date - c.date),
|
|
27
|
+
const r = [...t].sort((i, c) => i.date - c.date), n = /* @__PURE__ */ new Set(), a = [];
|
|
28
28
|
for (const i of r)
|
|
29
|
-
|
|
30
|
-
const
|
|
29
|
+
n.has(i.date) || (n.add(i.date), a.push(p(i)));
|
|
30
|
+
const o = r[r.length - 1], d = {
|
|
31
31
|
date: e.date,
|
|
32
32
|
amount: e.amount,
|
|
33
|
-
guid:
|
|
34
|
-
category_guid:
|
|
33
|
+
guid: f,
|
|
34
|
+
category_guid: o.top_level_category_guid ?? o.category_guid
|
|
35
35
|
};
|
|
36
|
-
return [...
|
|
37
|
-
},
|
|
38
|
-
const r = e.insights_feed?.general?.transaction_history_title ?? "",
|
|
39
|
-
if (t ===
|
|
40
|
-
const
|
|
41
|
-
return
|
|
42
|
-
},
|
|
36
|
+
return [...a, d];
|
|
37
|
+
}, A = (t, e) => {
|
|
38
|
+
const r = e.insights_feed?.general?.transaction_history_title ?? "", n = e.insights_feed?.transaction_history_block;
|
|
39
|
+
if (t === g.TRANSACTION) return r;
|
|
40
|
+
const a = `${t}_drawer_title`;
|
|
41
|
+
return n?.[a] ?? r;
|
|
42
|
+
}, w = (t, e) => ({
|
|
43
43
|
accounts: t.accounts ?? e.allAccountGuids,
|
|
44
44
|
dateRange: t.dateRange ?? e.displayedDateRange,
|
|
45
45
|
custom: t.custom ?? (() => !0),
|
|
46
46
|
showSplits: t.showSplits ?? !1
|
|
47
|
-
}),
|
|
48
|
-
const
|
|
49
|
-
return
|
|
50
|
-
chartBarIndex: Math.min(Math.max(
|
|
51
|
-
subTabIndex:
|
|
47
|
+
}), R = ({ chartTabCount: t, actionDrawer: e, beatGuid: r }) => {
|
|
48
|
+
const n = e.guid === r && e.trigger === "chartBar", a = e.context, o = n ? a?.tabIndex ?? 0 : 0;
|
|
49
|
+
return n ? {
|
|
50
|
+
chartBarIndex: Math.min(Math.max(a?.chartBarIndex ?? 0, 0), Math.max(0, t - 1)),
|
|
51
|
+
subTabIndex: o
|
|
52
52
|
} : {
|
|
53
53
|
chartBarIndex: Math.max(0, t - 1),
|
|
54
|
-
subTabIndex:
|
|
54
|
+
subTabIndex: o
|
|
55
55
|
};
|
|
56
|
+
}, M = ({ series: t, category_guid: e, average_amount: r, additional_data: n }) => {
|
|
57
|
+
const a = u(t).map(({ guid: o }) => o).filter((o) => !!o);
|
|
58
|
+
return {
|
|
59
|
+
data_series: t,
|
|
60
|
+
category_guid: e,
|
|
61
|
+
average_amount: r,
|
|
62
|
+
legends: n,
|
|
63
|
+
transaction_guids: a.length ? a : void 0
|
|
64
|
+
};
|
|
65
|
+
}, b = (t) => {
|
|
66
|
+
if (t)
|
|
67
|
+
return {
|
|
68
|
+
text: t.subtitle ?? "",
|
|
69
|
+
logo: {
|
|
70
|
+
merchant_guid: t.logo?.guid,
|
|
71
|
+
category_guid: ""
|
|
72
|
+
}
|
|
73
|
+
};
|
|
56
74
|
};
|
|
57
75
|
export {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
76
|
+
f as PROJECTED_BILL_GUID,
|
|
77
|
+
S as buildUpcomingBillSeries,
|
|
78
|
+
R as getDefaultSelection,
|
|
79
|
+
A as getDrawerHeaderTitle,
|
|
80
|
+
y as getDrillDownConfig,
|
|
81
|
+
I as getFlattenedDataSeries,
|
|
82
|
+
b as resolveDrillDownSubHeader,
|
|
83
|
+
M as toDrillDownSlotData,
|
|
84
|
+
w as toStoreFilter
|
|
65
85
|
};
|
|
66
86
|
|
|
67
87
|
//# sourceMappingURL=utils.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/utils.ts"],"sourcesContent":["import { format, fromUnixTime } from 'date-fns'\n\nimport type {\n ActionDrawerState,\n DataSeries,\n DrilldownPayload,\n GlobalCopy,\n Transaction,\n} from '../../../core'\nimport { DATE_FORMATS_INTL } from '../../../core/constants'\nimport type { DataSet } from '../../../core/types/InsightsInstanceSlotData'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport {\n buildChartData,\n buildDataSeries,\n type ChartDataSeriesItem,\n} from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport {\n layout,\n FALLBACK,\n DRILLDOWN_VARIANTS,\n DrillDownVariant,\n DrillDownVariantConfig,\n} from './layout'\nimport { TransactionHistoryBlock } from '../../../core/types/localization/InsightsFeedCopy'\n\ninterface DefaultSelectionProp {\n chartTabCount: number\n comparisonTabCount: number\n actionDrawer: ActionDrawerState\n beatGuid: string\n}\nexport const getDrillDownConfig = (variant?: string): DrillDownVariantConfig =>\n layout[variant as DrillDownVariant] ?? FALLBACK\n\n// The shaped chart inputs a drill-down needs, derived once from the beat's data_series. `dataSeries`\n// is the flat per-bar source (indexes the filterStrategy); `chartData` feeds the single-bar chart;\n// `comparisonBars` is reserved for the double-bar MR (empty until then).\nexport interface FlattenedDataSeries {\n dataSeries: ChartDataSeriesItem[]\n chartData: ReturnType<typeof buildChartData>\n comparisonBars: DataSet[]\n}\n\n/**\n * Shapes the beat's raw data_series into the chart inputs for the variant's top kind. This MR handles\n * the single-bar family (singleBar / upcomingBill); the double-bar and tabsOnly branches are stubbed\n * for the next MR so the call site is already wired.\n */\ninterface FlattenedDataSeriesInput {\n data: DataSeries | undefined\n ariaLabel: string\n top: DrillDownVariantConfig['top']\n // UpcomingBill has no data_series; it builds its bars from these instead.\n beatTransactions: Transaction[]\n payload: { date?: string; amount?: number } | undefined\n}\n\nexport const getFlattenedDataSeries = ({\n data,\n ariaLabel,\n top,\n beatTransactions,\n payload,\n}: FlattenedDataSeriesInput): FlattenedDataSeries => {\n // UpcomingBill has no backend data_series: synthesize the bars from the beat's recurring-bill\n // transactions + the projected bill, and label each bar by day (MONTH_DAY) since a bar is one bill.\n if (top === 'upcomingBill') {\n const dataSeries = buildUpcomingBillSeries(beatTransactions, payload)\n return {\n dataSeries,\n chartData: buildChartData(dataSeries, ariaLabel, DATE_FORMATS_INTL.MONTH_DAY),\n comparisonBars: [],\n }\n }\n\n // Single-bar family (THIS MR): the backend sends data_series newest-first, so normalize it\n // date-ascending here. chartData/tabs and the filter's dataSeries[selectedIndex] indexing both read\n // this one array, so they stay aligned and the last tab is the most recent month.\n const dataSeries = [...buildDataSeries(data)].sort((a, b) => {\n if (!a.date || !b.date) return 0\n\n return new Date(a.date).getTime() - new Date(b.date).getTime()\n })\n\n // NEXT MR — double bar: comparison beats build paired bars instead of chartData.\n // if (top === \"doubleBar\") {\n // return { dataSeries, chartData: [], comparisonBars: buildComparisonSeries(data, ariaLabel) };\n // }\n //\n // NEXT MR — tabsOnly: donut-drawer beats render no top chart.\n // if (top === \"tabsOnly\") {\n // return { dataSeries, chartData: [], comparisonBars: [] };\n // }\n\n return { dataSeries, chartData: buildChartData(dataSeries, ariaLabel), comparisonBars: [] }\n}\n\n// Sentinel guid for the synthesized projected bill. It intentionally matches no real store\n// transaction, so the projected tab's guid filter yields an empty list (projected-bar-only scope).\nexport const PROJECTED_BILL_GUID = 'TRN-projected-bill'\n\n// One bar in the UpcomingBill chart. `date` is 'yyyy-MM-dd' so buildChartData/parseISO can read both\n// historical unix timestamps and the ISO payload date after normalization here.\nexport interface UpcomingBillBar {\n date: string\n amount: number\n guid: string\n category_guid?: string\n}\n\nconst toUpcomingBillBar = (transaction: Transaction): UpcomingBillBar => ({\n date: format(fromUnixTime(transaction.date), 'yyyy-MM-dd'),\n amount: transaction.amount,\n guid: transaction.guid,\n category_guid: transaction.top_level_category_guid ?? transaction.category_guid,\n})\n\n/**\n * UpcomingBill has no data_series: build the bar series straight from the beat's recurring-bill\n * transactions plus the synthesized projected bill from payload (mirrors pulse's magicTransactions).\n * Historical bills are de-duped by date and each keeps its real transaction guid so the guid filter\n * finds it in the store; the projected bar (cloned category from the latest bill) carries the\n * PROJECTED_BILL_GUID sentinel. The result is sorted date-ascending so the projected bill lands last.\n */\nexport const buildUpcomingBillSeries = (\n transactions: Transaction[] = [],\n payload: { date?: string; amount?: number } | undefined,\n): UpcomingBillBar[] => {\n if (!transactions.length || payload?.date == null || payload?.amount == null) {\n return []\n }\n\n const sorted = [...transactions].sort((a, b) => a.date - b.date)\n\n const seenDates = new Set<number>()\n const history: UpcomingBillBar[] = []\n for (const transaction of sorted) {\n if (seenDates.has(transaction.date)) continue\n seenDates.add(transaction.date)\n history.push(toUpcomingBillBar(transaction))\n }\n\n const latestBill = sorted[sorted.length - 1]\n const projected: UpcomingBillBar = {\n date: payload.date,\n amount: payload.amount,\n guid: PROJECTED_BILL_GUID,\n category_guid: latestBill.top_level_category_guid ?? latestBill.category_guid,\n }\n\n return [...history, projected]\n}\n\nexport const getDrawerHeaderTitle = (\n variant: string | null | undefined,\n copy: GlobalCopy,\n): string => {\n const transactionHistoryTitle = copy.insights_feed?.general?.transaction_history_title ?? ''\n const drawerTitleCopy = copy.insights_feed?.transaction_history_block as TransactionHistoryBlock\n\n if (variant === DRILLDOWN_VARIANTS.TRANSACTION) return transactionHistoryTitle\n\n // Safely access the drawer title from transaction_history_block\n const key = `${variant}_drawer_title` as keyof TransactionHistoryBlock\n return (drawerTitleCopy?.[key] as string) ?? transactionHistoryTitle\n}\n\nexport const toStoreFilter = (\n filter: TransactionFilter,\n defaults: { allAccountGuids: string[]; displayedDateRange: { start: Date; end: Date } },\n): TransactionFilter => ({\n accounts: filter.accounts ?? defaults.allAccountGuids,\n dateRange: filter.dateRange ?? defaults.displayedDateRange,\n custom: filter.custom ?? (() => true),\n showSplits: filter.showSplits ?? false,\n})\n\nexport const getDefaultSelection = ({\n chartTabCount,\n actionDrawer,\n beatGuid,\n}: DefaultSelectionProp): { chartBarIndex: number; subTabIndex: number } => {\n const openedViaChartBar = actionDrawer.guid === beatGuid && actionDrawer.trigger === 'chartBar'\n\n // actionDrawer.context is an opaque `unknown` bag; narrow it to the shape the chart blocks write.\n const context = actionDrawer.context as DrilldownPayload | undefined\n const subTabIndex = openedViaChartBar ? (context?.tabIndex ?? 0) : 0\n\n if (openedViaChartBar) {\n const clamped = Math.min(\n Math.max(context?.chartBarIndex ?? 0, 0),\n Math.max(0, chartTabCount - 1),\n )\n return { chartBarIndex: clamped, subTabIndex }\n }\n\n return { chartBarIndex: Math.max(0, chartTabCount - 1), subTabIndex }\n}\n"],"mappings":";;;;AAgCA,IAAa,IAAA,CAAsB,MACjC,EAAO,CAAA,KAAgC,GAyB5B,IAAA,CAA0B,EACrC,MAAA,GACA,WAAA,GACA,KAAA,GACA,kBAAA,GACA,SAAA,EAAA,MACmD;AAGnD,MAAI,MAAQ,gBAAgB;AAC1B,UAAM,IAAa,EAAwB,GAAkB,CAAO;AACpE,WAAO;AAAA,MACL,YAAA;AAAA,MACA,WAAW,EAAe,GAAY,GAAW,EAAkB,SAAS;AAAA,MAC5E,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAKA,QAAM,IAAa,CAAC,GAAG,EAAgB,CAAI,CAAC,EAAE,KAAA,CAAM,GAAG,MACjD,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAa,IAExB,IAAI,KAAK,EAAE,IAAI,EAAE,QAAQ,IAAI,IAAI,KAAK,EAAE,IAAI,EAAE,QAAQ,CAC9D;AAYD,SAAO;AAAA,IAAE,YAAA;AAAA,IAAY,WAAW,EAAe,GAAY,CAAS;AAAA,IAAG,gBAAgB,CAAC;AAAA,EAAE;AAC5F,GAIa,IAAsB,sBAW7B,IAAA,CAAqB,OAA+C;AAAA,EACxE,MAAM,EAAO,EAAa,EAAY,IAAI,GAAG,YAAY;AAAA,EACzD,QAAQ,EAAY;AAAA,EACpB,MAAM,EAAY;AAAA,EAClB,eAAe,EAA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,IAAI,GAAS,iBAAiB,GAAG,CAAC,GACvC,KAAK,IAAI,GAAG,IAAgB,CAAC,CAEP;AAAA,IAAS,aAAA;AAAA,EAAY,IAGxC;AAAA,IAAE,eAAe,KAAK,IAAI,GAAG,IAAgB,CAAC;AAAA,IAAG,aAAA;AAAA,EAAY;AACtE"}
|
|
1
|
+
{"version":3,"file":"utils.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/utils.ts"],"sourcesContent":["import { format, fromUnixTime } from 'date-fns'\n\nimport type {\n ActionDrawerState,\n DataSeries,\n DrilldownPayload,\n GlobalCopy,\n InsightsPayload,\n Subtitle,\n Transaction,\n} from '../../../core'\nimport { DATE_FORMATS_INTL } from '../../../core/constants'\nimport type {\n BarChartBlockData,\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport {\n buildChartData,\n buildDataSeries,\n type ChartDataSeriesItem,\n} from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport {\n layout,\n FALLBACK,\n DRILLDOWN_VARIANTS,\n DrillDownVariant,\n DrillDownVariantConfig,\n} from './layout'\nimport { TransactionHistoryBlock } from '../../../core/types/localization/InsightsFeedCopy'\n\ninterface DefaultSelectionProp {\n chartTabCount: number\n comparisonTabCount: number\n actionDrawer: ActionDrawerState\n beatGuid: string\n}\nexport const getDrillDownConfig = (variant?: string): DrillDownVariantConfig =>\n layout[variant as DrillDownVariant] ?? FALLBACK\n\n// The shaped chart inputs a drill-down needs, derived once from the beat's data_series. `dataSeries`\n// is the flat per-bar source (indexes the filterStrategy); `chartData` feeds the single-bar chart;\n// `comparisonBars` is reserved for the double-bar MR (empty until then).\nexport interface FlattenedDataSeries {\n dataSeries: ChartDataSeriesItem[]\n chartData: ReturnType<typeof buildChartData>\n comparisonBars: DataSet[]\n}\n\n/**\n * Shapes the beat's raw data_series into the chart inputs for the variant's top kind. This MR handles\n * the single-bar family (singleBar / upcomingBill); the double-bar and tabsOnly branches are stubbed\n * for the next MR so the call site is already wired.\n */\ninterface FlattenedDataSeriesInput {\n data: DataSeries | undefined\n ariaLabel: string\n top: DrillDownVariantConfig['top']\n // UpcomingBill has no data_series; it builds its bars from these instead.\n beatTransactions: Transaction[]\n payload: { date?: string; amount?: number } | undefined\n}\n\nexport const getFlattenedDataSeries = ({\n data,\n ariaLabel,\n top,\n beatTransactions,\n payload,\n}: FlattenedDataSeriesInput): FlattenedDataSeries => {\n // UpcomingBill has no backend data_series: synthesize the bars from the beat's recurring-bill\n // transactions + the projected bill, and label each bar by day (MONTH_DAY) since a bar is one bill.\n if (top === 'upcomingBill') {\n const dataSeries = buildUpcomingBillSeries(beatTransactions, payload)\n return {\n dataSeries,\n chartData: buildChartData(dataSeries, ariaLabel, DATE_FORMATS_INTL.MONTH_DAY),\n comparisonBars: [],\n }\n }\n\n // Single-bar family (THIS MR): the backend sends data_series newest-first, so normalize it\n // date-ascending here. chartData/tabs and the filter's dataSeries[selectedIndex] indexing both read\n // this one array, so they stay aligned and the last tab is the most recent month.\n const dataSeries = [...buildDataSeries(data)].sort((a, b) => {\n if (!a.date || !b.date) return 0\n\n return new Date(a.date).getTime() - new Date(b.date).getTime()\n })\n\n // NEXT MR — double bar: comparison beats build paired bars instead of chartData.\n // if (top === \"doubleBar\") {\n // return { dataSeries, chartData: [], comparisonBars: buildComparisonSeries(data, ariaLabel) };\n // }\n //\n // NEXT MR — tabsOnly: donut-drawer beats render no top chart.\n // if (top === \"tabsOnly\") {\n // return { dataSeries, chartData: [], comparisonBars: [] };\n // }\n\n return { dataSeries, chartData: buildChartData(dataSeries, ariaLabel), comparisonBars: [] }\n}\n\n// Sentinel guid for the synthesized projected bill. It intentionally matches no real store\n// transaction, so the projected tab's guid filter yields an empty list (projected-bar-only scope).\nexport const PROJECTED_BILL_GUID = 'TRN-projected-bill'\n\n// One bar in the UpcomingBill chart. `date` is 'yyyy-MM-dd' so buildChartData/parseISO can read both\n// historical unix timestamps and the ISO payload date after normalization here.\nexport interface UpcomingBillBar {\n date: string\n amount: number\n guid: string\n category_guid?: string\n}\n\nconst toUpcomingBillBar = (transaction: Transaction): UpcomingBillBar => ({\n date: format(fromUnixTime(transaction.date), 'yyyy-MM-dd'),\n amount: transaction.amount,\n guid: transaction.guid,\n category_guid: transaction.top_level_category_guid ?? transaction.category_guid,\n})\n\n/**\n * UpcomingBill has no data_series: build the bar series straight from the beat's recurring-bill\n * transactions plus the synthesized projected bill from payload (mirrors pulse's magicTransactions).\n * Historical bills are de-duped by date and each keeps its real transaction guid so the guid filter\n * finds it in the store; the projected bar (cloned category from the latest bill) carries the\n * PROJECTED_BILL_GUID sentinel. The result is sorted date-ascending so the projected bill lands last.\n */\nexport const buildUpcomingBillSeries = (\n transactions: Transaction[] = [],\n payload: { date?: string; amount?: number } | undefined,\n): UpcomingBillBar[] => {\n if (!transactions.length || payload?.date == null || payload?.amount == null) {\n return []\n }\n\n const sorted = [...transactions].sort((a, b) => a.date - b.date)\n\n const seenDates = new Set<number>()\n const history: UpcomingBillBar[] = []\n for (const transaction of sorted) {\n if (seenDates.has(transaction.date)) continue\n seenDates.add(transaction.date)\n history.push(toUpcomingBillBar(transaction))\n }\n\n const latestBill = sorted[sorted.length - 1]\n const projected: UpcomingBillBar = {\n date: payload.date,\n amount: payload.amount,\n guid: PROJECTED_BILL_GUID,\n category_guid: latestBill.top_level_category_guid ?? latestBill.category_guid,\n }\n\n return [...history, projected]\n}\n\nexport const getDrawerHeaderTitle = (\n variant: string | null | undefined,\n copy: GlobalCopy,\n): string => {\n const transactionHistoryTitle = copy.insights_feed?.general?.transaction_history_title ?? ''\n const drawerTitleCopy = copy.insights_feed?.transaction_history_block as TransactionHistoryBlock\n\n if (variant === DRILLDOWN_VARIANTS.TRANSACTION) return transactionHistoryTitle\n\n // Safely access the drawer title from transaction_history_block\n const key = `${variant}_drawer_title` as keyof TransactionHistoryBlock\n return (drawerTitleCopy?.[key] as string) ?? transactionHistoryTitle\n}\n\nexport const toStoreFilter = (\n filter: TransactionFilter,\n defaults: { allAccountGuids: string[]; displayedDateRange: { start: Date; end: Date } },\n): TransactionFilter => ({\n accounts: filter.accounts ?? defaults.allAccountGuids,\n dateRange: filter.dateRange ?? defaults.displayedDateRange,\n custom: filter.custom ?? (() => true),\n showSplits: filter.showSplits ?? false,\n})\n\nexport const getDefaultSelection = ({\n chartTabCount,\n actionDrawer,\n beatGuid,\n}: DefaultSelectionProp): { chartBarIndex: number; subTabIndex: number } => {\n const openedViaChartBar = actionDrawer.guid === beatGuid && actionDrawer.trigger === 'chartBar'\n\n // actionDrawer.context is an opaque `unknown` bag; narrow it to the shape the chart blocks write.\n const context = actionDrawer.context as DrilldownPayload | undefined\n const subTabIndex = openedViaChartBar ? (context?.tabIndex ?? 0) : 0\n\n if (openedViaChartBar) {\n const clamped = Math.min(\n Math.max(context?.chartBarIndex ?? 0, 0),\n Math.max(0, chartTabCount - 1),\n )\n return { chartBarIndex: clamped, subTabIndex }\n }\n\n return { chartBarIndex: Math.max(0, chartTabCount - 1), subTabIndex }\n}\n\n/** The drawer's facts: the generic slot facts plus the bar chart's average. */\nexport type DrillDownSlotData = InsightsInstanceSlotData & Pick<BarChartBlockData, 'average_amount'>\n\n/** The drawer's facts from a bar chart's `instance_slot.data`. */\nexport const toDrillDownSlotData = ({\n series,\n category_guid,\n average_amount,\n additional_data,\n}: BarChartBlockData): DrillDownSlotData => {\n const transactionGuids = buildDataSeries(series)\n .map(({ guid }) => guid)\n .filter((guid): guid is string => !!guid)\n\n return {\n data_series: series,\n category_guid,\n average_amount,\n legends: additional_data,\n transaction_guids: transactionGuids.length ? transactionGuids : undefined,\n }\n}\n\n/** The drawer's sub-heading: the merchant name and logo. */\nexport const resolveDrillDownSubHeader = (\n payload: Partial<InsightsPayload> | undefined,\n): Subtitle | undefined => {\n if (!payload) return undefined\n\n return {\n text: payload.subtitle ?? '',\n logo: { merchant_guid: payload.logo?.guid, category_guid: '' },\n }\n}\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AAC,CAAC,CAAI;AAE1C,SAAO;AAAA,IACL,aAAa;AAAA,IACb,eAAA;AAAA,IACA,gBAAA;AAAA,IACA,SAAS;AAAA,IACT,mBAAmB,EAAiB,SAAS,IAAmB;AAAA,EAClE;AACF,GAGa,IAAA,CACX,MACyB;AACzB,MAAK;AAEL,WAAO;AAAA,MACL,MAAM,EAAQ,YAAY;AAAA,MAC1B,MAAM;AAAA,QAAE,eAAe,EAAQ,MAAM;AAAA,QAAM,eAAe;AAAA,MAAG;AAAA,IAC/D;AACF"}
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { InsightsPayload } from '../../../../core';
|
|
2
|
+
interface BarchartBlockProps {
|
|
3
|
+
payload: InsightsPayload;
|
|
4
|
+
beatGuid?: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const BarchartBlock: (({ payload, beatGuid }: BarchartBlockProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
4
7
|
displayName: string;
|
|
5
8
|
};
|
|
9
|
+
export {};
|
|
@@ -1,51 +1,49 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { formatCurrency as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import { BarChartV2 as
|
|
6
|
-
import { EmptyBarChart as
|
|
7
|
-
import { ANALYTICS_EVENTS_CONFIG as
|
|
8
|
-
import { useAnalyticsEvent as
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import { observer as
|
|
12
|
-
import { jsx as
|
|
13
|
-
import { useTheme as
|
|
14
|
-
var
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const _ = [o.general.monthly_amount, o.general.trend], [A, y] = s.length ? s.map((r) => r.label) : _;
|
|
18
|
-
return t.length ? /* @__PURE__ */ e(E, {
|
|
1
|
+
import { useGlobalUiStore as _, useInsightsV2Store as b } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { formatCurrency as B } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import y from "../../../../common/components/Loader.es.js";
|
|
4
|
+
import { BAR_ARIA_LABEL as I, barChartVariant as L, buildChartData as T, buildDataSeries as S } from "./utils.es.js";
|
|
5
|
+
import { BarChartV2 as v } from "../../../components/chartblocks/BarchartV2.es.js";
|
|
6
|
+
import { EmptyBarChart as E } from "../../../components/chartblocks/EmptyBarChart.es.js";
|
|
7
|
+
import { ANALYTICS_EVENTS_CONFIG as R } from "../../../analytics/analyticsEventsConfig.es.js";
|
|
8
|
+
import { useAnalyticsEvent as N } from "../../../analytics/useAnalyticsEvent.es.js";
|
|
9
|
+
import { actionBlocksKey as x } from "../../../mappings/actionBlocksKey.es.js";
|
|
10
|
+
import D from "react";
|
|
11
|
+
import { observer as O } from "mobx-react-lite";
|
|
12
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
13
|
+
import { useTheme as k } from "@mui/material/styles";
|
|
14
|
+
var P = O(({ payload: a, beatGuid: n = "" }) => {
|
|
15
|
+
const m = k(), { openActionDrawer: i } = b(), { isCopyLoaded: s } = _(), { instance_slot: o, widget_type: c } = a, { series: l, category_guid: f, average_amount: e = 0, additional_data: d = [] } = o.data ?? {}, [p, u] = d, t = T(S(l), I), [A] = D.useState(t.length - 1), { color: h } = L(o, f, m), C = N();
|
|
16
|
+
return s ? t.length ? /* @__PURE__ */ r(v, {
|
|
19
17
|
amounts: {
|
|
20
|
-
average:
|
|
21
|
-
formattedAverage:
|
|
18
|
+
average: e,
|
|
19
|
+
formattedAverage: B(e, "0,0")
|
|
22
20
|
},
|
|
23
|
-
color:
|
|
21
|
+
color: h,
|
|
24
22
|
data: t,
|
|
25
|
-
monthlyAmountLabel:
|
|
23
|
+
monthlyAmountLabel: p?.label ?? "",
|
|
26
24
|
margin: {
|
|
27
25
|
bottom: 8,
|
|
28
26
|
left: 16,
|
|
29
27
|
right: 16,
|
|
30
28
|
top: 16
|
|
31
29
|
},
|
|
32
|
-
onBarClick: (
|
|
33
|
-
if (
|
|
34
|
-
|
|
35
|
-
guid:
|
|
30
|
+
onBarClick: (g) => {
|
|
31
|
+
if (c !== "full") return !1;
|
|
32
|
+
C(R.CHART_BAR_CLICKED), i({
|
|
33
|
+
guid: n,
|
|
36
34
|
trigger: "chartBar",
|
|
37
35
|
context: {
|
|
38
|
-
chartBarIndex:
|
|
39
|
-
block:
|
|
36
|
+
chartBarIndex: g,
|
|
37
|
+
block: x.TRANSCATION_HISTORY_ACTION_BLOCK
|
|
40
38
|
}
|
|
41
39
|
});
|
|
42
40
|
},
|
|
43
|
-
selectedTabIndex:
|
|
44
|
-
trendAmountLabel:
|
|
45
|
-
}) : /* @__PURE__ */
|
|
41
|
+
selectedTabIndex: A,
|
|
42
|
+
trendAmountLabel: u?.label ?? ""
|
|
43
|
+
}) : /* @__PURE__ */ r(E, {}) : /* @__PURE__ */ r(y, {});
|
|
46
44
|
});
|
|
47
45
|
export {
|
|
48
|
-
|
|
46
|
+
P as BarchartBlock
|
|
49
47
|
};
|
|
50
48
|
|
|
51
49
|
//# sourceMappingURL=BarchartBlock.es.js.map
|