@mx-cartographer/experiences 9.4.44 → 9.4.45
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 +5 -0
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js +12 -11
- package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +15 -14
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +10 -4
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -0
- package/dist/transactions/components/shared/TransactionDetails.es.js +69 -69
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [9.4.45] - 09-29-2026
|
|
2
|
+
|
|
3
|
+
- **CHANGED** - insights-v2 `BillAmountNotStandard` design tweaks: `BarchartBlock` and `TransactionHistoryBlock`'s drill-down chart now use explicit margins for consistent spacing instead of relying on unset/default values (WEC-1853)
|
|
4
|
+
- **ADDED** - `shouldShowEmbeddedCard` prop on `TransactionDetails` (default `true`), gating the embedded insight card (BillAmountNotStandard mini chart shown for a transaction's associated beat). Every PFM surface — Spending, Trends (category view + drawer), Budgets, Recurring Transactions, and the Accounts transaction tab — keeps showing the embedded card unchanged via the default; insights-v2's own `TransactionDetailsBlock` explicitly passes `false` so `BillAmountNotStandard`'s own drill-down drawer doesn't show a redundant embedded card of itself (WEC-1853)
|
|
5
|
+
|
|
1
6
|
## [9.4.44] - 09-25-2026
|
|
2
7
|
|
|
3
8
|
- **FIXED** - Budgets zero-state buttons now wrap and grow to fit longer localized copy instead of cropping or overflowing the text (MEW-4167)
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
1
|
+
import { useGlobalCopyStore as m } from "../../../common/context/hooks.es.js";
|
|
2
2
|
import s from "../../../common/components/Loader.es.js";
|
|
3
3
|
import c from "../../../transactions/components/shared/TransactionDetails.es.js";
|
|
4
|
-
import { useTransactionDetailsBlock as
|
|
4
|
+
import { useTransactionDetailsBlock as l } from "./useTransactionDetailsBlock.es.js";
|
|
5
5
|
import { observer as f } from "mobx-react-lite";
|
|
6
|
-
import
|
|
7
|
-
import { Text as
|
|
6
|
+
import p from "@mui/material/Stack";
|
|
7
|
+
import { Text as d } from "@mxenabled/mxui";
|
|
8
8
|
import { jsx as o } from "react/jsx-runtime";
|
|
9
|
-
var
|
|
10
|
-
const { common: i } =
|
|
11
|
-
return
|
|
12
|
-
bottomActions:
|
|
9
|
+
var S = f(function({ beat: t }) {
|
|
10
|
+
const { common: i } = m(), { bottomActions: e, isLoading: n, topActions: a, transaction: r } = l(t);
|
|
11
|
+
return n ? /* @__PURE__ */ o(s, {}) : r ? /* @__PURE__ */ o(c, {
|
|
12
|
+
bottomActions: e,
|
|
13
|
+
shouldShowEmbeddedCard: !1,
|
|
13
14
|
topActions: a,
|
|
14
15
|
transaction: r
|
|
15
|
-
}) : /* @__PURE__ */ o(
|
|
16
|
+
}) : /* @__PURE__ */ o(p, {
|
|
16
17
|
sx: { p: 24 },
|
|
17
|
-
children: /* @__PURE__ */ o(
|
|
18
|
+
children: /* @__PURE__ */ o(d, { children: i.error_message })
|
|
18
19
|
});
|
|
19
20
|
});
|
|
20
21
|
export {
|
|
21
|
-
|
|
22
|
+
S as TransactionDetailsBlock
|
|
22
23
|
};
|
|
23
24
|
|
|
24
25
|
//# sourceMappingURL=TransactionDetailsBlock.es.js.map
|
package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useGlobalCopyStore } from '../../../common'\nimport TransactionDetails from '../../../transactions/components/shared/TransactionDetails'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { useTransactionDetailsBlock } from './useTransactionDetailsBlock'\n\n/**\n * Single-transaction drawer content. The detail rendering and inline editing (category picker, date,\n * memo, tags, split/hide/merchant-budget) all live in the shared `TransactionDetails` component from\n * the transactions module — this block's job is only to resolve *which* transaction and *which*\n * actions, then hand off.\n *\n * `observer` is required: the resolved transaction comes from TransactionStore, and `usePrepare` may\n * still be loading it when this first renders. Without it the drawer would stay on the loader.\n */\nexport const TransactionDetailsBlock = observer(function TransactionDetailsBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy } = useGlobalCopyStore()\n const { bottomActions, isLoading, topActions, transaction } = useTransactionDetailsBlock(beat)\n\n if (isLoading) return <Loader />\n\n // Loading finished and the guid still resolves to nothing — a stale beat pointing at a deleted or\n // out-of-window transaction. Mirrors ActionBlockLayer's unknown-block branch rather than rendering\n // an empty drawer.\n if (!transaction) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy.error_message}</Text>\n </Stack>\n )\n }\n\n return (\n <TransactionDetails\n bottomActions={bottomActions}\n topActions={topActions}\n transaction={transaction}\n />\n )\n})\n"],"mappings":";;;;;;;;AAoBA,IAAa,IAA0B,EAAS,SAAiC,EAC/E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,eAAA,GAAe,WAAA,GAAW,YAAA,GAAY,aAAA,EAAA,IAAgB,EAA2B,CAAI;AAE7F,SAAI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAK1B,IASH,gBAAA,EAAC,GAAD;AAAA,IACiB,eAAA;AAAA,
|
|
1
|
+
{"version":3,"file":"TransactionDetailsBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionDetailsBlock/TransactionDetailsBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport { Loader, useGlobalCopyStore } from '../../../common'\nimport TransactionDetails from '../../../transactions/components/shared/TransactionDetails'\nimport type { ActionBlockProps } from '../../mappings/blocks'\n\nimport { useTransactionDetailsBlock } from './useTransactionDetailsBlock'\n\n/**\n * Single-transaction drawer content. The detail rendering and inline editing (category picker, date,\n * memo, tags, split/hide/merchant-budget) all live in the shared `TransactionDetails` component from\n * the transactions module — this block's job is only to resolve *which* transaction and *which*\n * actions, then hand off.\n *\n * `observer` is required: the resolved transaction comes from TransactionStore, and `usePrepare` may\n * still be loading it when this first renders. Without it the drawer would stay on the loader.\n */\nexport const TransactionDetailsBlock = observer(function TransactionDetailsBlock({\n beat,\n}: ActionBlockProps) {\n const { common: commonCopy } = useGlobalCopyStore()\n const { bottomActions, isLoading, topActions, transaction } = useTransactionDetailsBlock(beat)\n\n if (isLoading) return <Loader />\n\n // Loading finished and the guid still resolves to nothing — a stale beat pointing at a deleted or\n // out-of-window transaction. Mirrors ActionBlockLayer's unknown-block branch rather than rendering\n // an empty drawer.\n if (!transaction) {\n return (\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy.error_message}</Text>\n </Stack>\n )\n }\n\n return (\n <TransactionDetails\n bottomActions={bottomActions}\n // Embedded insight card is a PFM-only concern (TransactionDetails defaults to true); this beat's own drawer must not show a redundant embedded card of itself.\n shouldShowEmbeddedCard={false}\n topActions={topActions}\n transaction={transaction}\n />\n )\n})\n"],"mappings":";;;;;;;;AAoBA,IAAa,IAA0B,EAAS,SAAiC,EAC/E,MAAA,EAAA,GACmB;AACnB,QAAM,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,eAAA,GAAe,WAAA,GAAW,YAAA,GAAY,aAAA,EAAA,IAAgB,EAA2B,CAAI;AAE7F,SAAI,IAAkB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAK1B,IASH,gBAAA,EAAC,GAAD;AAAA,IACiB,eAAA;AAAA,IAEf,wBAAwB;AAAA,IACZ,YAAA;AAAA,IACC,aAAA;AAAA,EACd,CAAA,IAbC,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,GAAG,GAAG;AAAA,IACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,EAAW,cAAoB,CAAA;AAAA,EACjC,CAAA;AAab,CAAC"}
|
|
@@ -13,35 +13,35 @@ import { observer as mt } from "mobx-react-lite";
|
|
|
13
13
|
import { Fragment as gt, jsx as o, jsxs as pt } from "react/jsx-runtime";
|
|
14
14
|
import { useTheme as ut } from "@mui/material/styles";
|
|
15
15
|
var It = mt(({ beat: a }) => {
|
|
16
|
-
const
|
|
16
|
+
const h = ut(), { instanceSlotData: e, beatTransactions: s, spendCategoryGuids: b, allAccountGuids: f, categoryName: L, displayedDateRange: m, transactionStore: x } = nt(a), { actionDrawer: y, setActionContext: C } = X(), { common: B, insights_feed: l } = Q(), { isCopyLoaded: F } = W(), [I, T] = u(!1), [G, A] = u(!1), { insights_payload: n } = a, j = y.trigger === "secondaryCta" ? n?.secondary_cta?.variant : n?.primary_cta?.variant, { top: g, filterMode: c, header: k, colors: w, filterStrategy: H, tipSection: S } = it(j ?? ""), { dataSeries: d, chartData: r, comparisonBars: O } = st({
|
|
17
17
|
data: e?.data_series,
|
|
18
18
|
ariaLabel: e?.ariaLabel ?? "",
|
|
19
19
|
top: g,
|
|
20
20
|
beatTransactions: s,
|
|
21
21
|
payload: e
|
|
22
|
-
}), { chartBarIndex:
|
|
22
|
+
}), { chartBarIndex: E, subTabIndex: K } = rt({
|
|
23
23
|
chartTabCount: r.length,
|
|
24
|
-
comparisonTabCount:
|
|
24
|
+
comparisonTabCount: O.length,
|
|
25
25
|
actionDrawer: y,
|
|
26
26
|
beatGuid: a.guid
|
|
27
|
-
}), [i, _] = u(
|
|
27
|
+
}), [i, _] = u(E), D = (t) => H({
|
|
28
28
|
beat: a,
|
|
29
29
|
beatTransactions: s,
|
|
30
30
|
dataSeries: d,
|
|
31
31
|
selectedIndex: t,
|
|
32
|
-
subIndex:
|
|
32
|
+
subIndex: K,
|
|
33
33
|
isLastTab: t === d.length - 1,
|
|
34
34
|
instanceSlotData: e,
|
|
35
|
-
spendCategoryGuids:
|
|
35
|
+
spendCategoryGuids: b,
|
|
36
36
|
displayedDateRange: m
|
|
37
|
-
}), V = s.map((t) => t.guid).join(","), R =
|
|
37
|
+
}), V = s.map((t) => t.guid).join(","), R = b.join(","), M = f.join(","), v = () => {
|
|
38
38
|
c !== "store" || !d.length || x.setFilter(lt(D(i), {
|
|
39
39
|
allAccountGuids: f,
|
|
40
40
|
displayedDateRange: m
|
|
41
41
|
}));
|
|
42
42
|
};
|
|
43
43
|
dt(() => {
|
|
44
|
-
|
|
44
|
+
v();
|
|
45
45
|
}, [
|
|
46
46
|
a.guid,
|
|
47
47
|
i,
|
|
@@ -56,21 +56,22 @@ var It = mt(({ beat: a }) => {
|
|
|
56
56
|
const p = k?.({
|
|
57
57
|
title: n?.title,
|
|
58
58
|
subHeader: n?.sub_title,
|
|
59
|
-
categoryName:
|
|
59
|
+
categoryName: L,
|
|
60
60
|
selectedDate: r[i]?.date ?? void 0
|
|
61
|
-
}), N = w(
|
|
61
|
+
}), N = w(h, e?.category_guid);
|
|
62
62
|
if (!F) return /* @__PURE__ */ o(tt, {});
|
|
63
63
|
const P = [l.general.monthly_amount, l.general.trend], [U, $] = e?.legends?.length ? e.legends.map((t) => t.label) : P, q = c === "local" ? (t) => D(t).custom ?? (() => !0) : void 0, z = c === "local" ? s : void 0, J = g === "singleBar" || g === "upcomingBill" ? r.length ? /* @__PURE__ */ o(et, {
|
|
64
64
|
amounts: {
|
|
65
65
|
average: e?.average_amount,
|
|
66
66
|
formattedAverage: Z(e?.average_amount ?? 0, "0,0.00")
|
|
67
67
|
},
|
|
68
|
-
color: N[0] ??
|
|
68
|
+
color: N[0] ?? h.palette.primary.main,
|
|
69
69
|
data: r,
|
|
70
70
|
legendPosition: "top",
|
|
71
|
+
heightOverride: 142,
|
|
71
72
|
margin: {
|
|
72
|
-
bottom:
|
|
73
|
-
top:
|
|
73
|
+
bottom: 8,
|
|
74
|
+
top: 24,
|
|
74
75
|
left: 24,
|
|
75
76
|
right: 24
|
|
76
77
|
},
|
|
@@ -101,7 +102,7 @@ var It = mt(({ beat: a }) => {
|
|
|
101
102
|
ariaLabelClose: B.close_aria,
|
|
102
103
|
isOpen: I,
|
|
103
104
|
onClose: () => {
|
|
104
|
-
T(!1), C({ transaction_guid: void 0 }),
|
|
105
|
+
T(!1), C({ transaction_guid: void 0 }), v();
|
|
105
106
|
},
|
|
106
107
|
title: l.general.transaction_details_title,
|
|
107
108
|
children: /* @__PURE__ */ o(ct, { beat: a })
|
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 { 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'\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 { insights_payload } = beat\n\n const dynamicCtaVariant =\n actionDrawer.trigger === 'secondaryCta'\n ? insights_payload?.secondary_cta?.variant\n : insights_payload?.primary_cta?.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 const applyCurrentSelectionFilter = () => {\n if (filterMode !== 'store' || !dataSeries.length) 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 ])\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 margin={{\n bottom: 30,\n top: 20,\n left: 24,\n right: 24,\n }}\n monthlyAmountLabel={monthlyAmountLabel}\n onBarClick={setSelectedIndex}\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={setSelectedIndex}\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":";;;;;;;;;;;;;;AA+BA,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,EAAmB,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,EAAE,kBAAA,EAAA,IAAqB,GAEvB,IACJ,EAAa,YAAY,iBACrB,GAAkB,eAAe,UACjC,GAAkB,aAAa,SAE/B,EAAE,KAAA,GAAK,YAAA,GAAY,QAAA,GAAQ,QAAA,GAAQ,gBAAA,GAAgB,YAAA,EAAA,IAAe,GACtE,KAAqB,EACvB,GAEM,EAAE,YAAA,GAAY,WAAA,GAAW,gBAAA,EAAA,IAAmB,GAAuB;AAAA,IACvE,MAAM,GAAkB;AAAA,IACxB,WAAW,GAAkB,aAAa;AAAA,IAC1C,KAAA;AAAA,IACA,kBAAA;AAAA,IACA,SAAS;AAAA,EACX,CAAC,GAEK,EAAE,eAAA,GAAe,aAAA,EAAA,IAAgB,GAAoB;AAAA,IACzD,eAAe,EAAU;AAAA,IACzB,oBAAoB,EAAe;AAAA,IACnC,cAAA;AAAA,IACA,UAAU,EAAK;AAAA,EACjB,CAAC,GAEK,CAAC,GAAe,CAAA,IAAoB,EAAS,CAAa,GAE1D,IAAA,CAAiB,MACrB,EAAe;AA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U,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 { 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'\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 { insights_payload } = beat\n\n const dynamicCtaVariant =\n actionDrawer.trigger === 'secondaryCta'\n ? insights_payload?.secondary_cta?.variant\n : insights_payload?.primary_cta?.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 const applyCurrentSelectionFilter = () => {\n if (filterMode !== 'store' || !dataSeries.length) 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 ])\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={setSelectedIndex}\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={setSelectedIndex}\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":";;;;;;;;;;;;;;AA+BA,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,EAAmB,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,I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gBAAA,EAAC,IAAD;AAAA,IACE,WAAW,GAAkB;AAAA,IACX,kBAAA;AAAA,IAClB,SAAS,GAAe;AAAA,IACxB,MAAM,GAAe;AAAA,IACrB,mBAAmB;AAAA,IACJ,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,GAAD;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"}
|
|
@@ -10,8 +10,8 @@ import { observer as R } from "mobx-react-lite";
|
|
|
10
10
|
import { jsx as e } from "react/jsx-runtime";
|
|
11
11
|
import { useTheme as V } from "@mui/material/styles";
|
|
12
12
|
var J = R(({ payload: m, beatGuid: i = "" }) => {
|
|
13
|
-
const l = V(), { openActionDrawer: c } = L(), { insights_feed: o } = B(), { isCopyLoaded:
|
|
14
|
-
if (!
|
|
13
|
+
const l = V(), { openActionDrawer: c } = L(), { insights_feed: o } = B(), { isCopyLoaded: f } = A(), { instance_slot: p, instance_slot_data: a, widget_type: d } = m, { data_series: h, ariaLabel: g = "", average_amount: n = 0, legends: s = [] } = a, t = x(D(h), g), [u] = N.useState(t.length - 1), { color: b } = v(p, a, l);
|
|
14
|
+
if (!f) return /* @__PURE__ */ e(I, {});
|
|
15
15
|
const C = [o.general.monthly_amount, o.general.trend], [_, y] = s.length ? s.map((r) => r.label) : C;
|
|
16
16
|
return t.length ? /* @__PURE__ */ e(T, {
|
|
17
17
|
amounts: {
|
|
@@ -21,8 +21,14 @@ var J = R(({ payload: m, beatGuid: i = "" }) => {
|
|
|
21
21
|
color: b,
|
|
22
22
|
data: t,
|
|
23
23
|
monthlyAmountLabel: _,
|
|
24
|
+
margin: {
|
|
25
|
+
bottom: 8,
|
|
26
|
+
left: 16,
|
|
27
|
+
right: 16,
|
|
28
|
+
top: 16
|
|
29
|
+
},
|
|
24
30
|
onBarClick: (r) => {
|
|
25
|
-
if (
|
|
31
|
+
if (d !== "full") return !1;
|
|
26
32
|
c({
|
|
27
33
|
guid: i,
|
|
28
34
|
trigger: "chartBar",
|
|
@@ -32,7 +38,7 @@ var J = R(({ payload: m, beatGuid: i = "" }) => {
|
|
|
32
38
|
}
|
|
33
39
|
});
|
|
34
40
|
},
|
|
35
|
-
selectedTabIndex:
|
|
41
|
+
selectedTabIndex: u,
|
|
36
42
|
trendAmountLabel: y
|
|
37
43
|
}) : /* @__PURE__ */ e(k, {});
|
|
38
44
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarchartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n formatCurrency,\n Loader,\n useGlobalCopyStore,\n useGlobalUiStore,\n useInsightsV2Store,\n} from '../../../../common'\nimport type { DataSeries, DrilldownPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { BarChartV2 } from '../../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../../components/chartblocks/EmptyBarChart'\n\nimport type { BlockProps } from '../../types'\n\nimport { barChartVariant, buildChartData, buildDataSeries } from './utils'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\nexport const BarchartBlock = observer(\n ({ payload, beatGuid = '' }: BlockProps<BarChartBlockData>) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { isCopyLoaded } = useGlobalUiStore()\n const { instance_slot, instance_slot_data, widget_type } = payload\n const { data_series, ariaLabel = '', average_amount = 0, legends = [] } = instance_slot_data\n const chartData = buildChartData(buildDataSeries(data_series as DataSeries), ariaLabel)\n const [selectedTabIndex] = React.useState(chartData.length - 1)\n const { color } = barChartVariant(instance_slot, instance_slot_data, theme)\n\n if (!isCopyLoaded) {\n return <Loader />\n }\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 fallbackLabels = [insightsFeedCopy.general.monthly_amount, insightsFeedCopy.general.trend]\n\n const [monthlyAmountLabel, trendAmountLabel] = legends.length\n ? legends.map((legend) => legend.label)\n : fallbackLabels\n\n return chartData.length ? (\n <BarChartV2\n amounts={{\n average: average_amount,\n formattedAverage: formatCurrency(average_amount, '0,0'),\n }}\n color={color}\n data={chartData}\n monthlyAmountLabel={monthlyAmountLabel}\n onBarClick={(index) => {\n if (widget_type !== 'full') return false\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: index,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n selectedTabIndex={selectedTabIndex}\n trendAmountLabel={trendAmountLabel}\n />\n ) : (\n <EmptyBarChart />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;AAsBA,IAAa,IAAgB,EAAA,CAC1B,EAAE,SAAA,GAAS,UAA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","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n formatCurrency,\n Loader,\n useGlobalCopyStore,\n useGlobalUiStore,\n useInsightsV2Store,\n} from '../../../../common'\nimport type { DataSeries, DrilldownPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { BarChartV2 } from '../../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../../components/chartblocks/EmptyBarChart'\n\nimport type { BlockProps } from '../../types'\n\nimport { barChartVariant, buildChartData, buildDataSeries } from './utils'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\nexport const BarchartBlock = observer(\n ({ payload, beatGuid = '' }: BlockProps<BarChartBlockData>) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const { insights_feed: insightsFeedCopy } = useGlobalCopyStore()\n const { isCopyLoaded } = useGlobalUiStore()\n const { instance_slot, instance_slot_data, widget_type } = payload\n const { data_series, ariaLabel = '', average_amount = 0, legends = [] } = instance_slot_data\n const chartData = buildChartData(buildDataSeries(data_series as DataSeries), ariaLabel)\n const [selectedTabIndex] = React.useState(chartData.length - 1)\n const { color } = barChartVariant(instance_slot, instance_slot_data, theme)\n\n if (!isCopyLoaded) {\n return <Loader />\n }\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 fallbackLabels = [insightsFeedCopy.general.monthly_amount, insightsFeedCopy.general.trend]\n\n const [monthlyAmountLabel, trendAmountLabel] = legends.length\n ? legends.map((legend) => legend.label)\n : fallbackLabels\n\n return chartData.length ? (\n <BarChartV2\n amounts={{\n average: average_amount,\n formattedAverage: formatCurrency(average_amount, '0,0'),\n }}\n color={color}\n data={chartData}\n monthlyAmountLabel={monthlyAmountLabel}\n margin={{\n bottom: 8,\n left: 16,\n right: 16,\n top: 16,\n }}\n onBarClick={(index) => {\n if (widget_type !== 'full') return false\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: index,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n selectedTabIndex={selectedTabIndex}\n trendAmountLabel={trendAmountLabel}\n />\n ) : (\n <EmptyBarChart />\n )\n },\n)\n"],"mappings":";;;;;;;;;;;AAsBA,IAAa,IAAgB,EAAA,CAC1B,EAAE,SAAA,GAAS,UAAA,IAAW,GAAA,MAAwC;AAC7D,QAAM,IAAQ,EAAS,GACjB,EAAE,kBAAA,EAAA,IAAqB,EAAmB,GAC1C,EAAE,eAAe,EAAA,IAAqB,EAAmB,GACzD,EAAE,cAAA,EAAA,IAAiB,EAAiB,GACpC,EAAE,eAAA,GAAe,oBAAA,GAAoB,aAAA,EAAA,IAAgB,GACrD,EAAE,aAAA,GAAa,WAAA,IAAY,IAAI,gBAAA,IAAiB,GAAG,SAAA,IAAU,CAAC,EAAA,IAAM,GACpE,IAAY,EAAe,EAAgB,CAAyB,GAAG,CAAS,GAChF,CAAC,CAAA,IAAoB,EAAM,SAAS,EAAU,SAAS,CAAC,GACxD,EAAE,OAAA,EAAA,IAAU,EAAgB,GAAe,GAAoB,CAAK;AAE1E,MAAI,CAAC,EACH,QAAO,gBAAA,EAAC,GAAD,CAAS,CAAA;AAKlB,QAAM,IAAiB,CAAC,EAAiB,QAAQ,gBAAgB,EAAiB,QAAQ,KAAK,GAEzF,CAAC,GAAoB,CAAA,IAAoB,EAAQ,SACnD,EAAQ,IAAA,CAAK,MAAW,EAAO,KAAK,IACpC;AAEJ,SAAO,EAAU,SACf,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS;AAAA,MACP,SAAS;AAAA,MACT,kBAAkB,EAAe,GAAgB,KAAK;AAAA,IACxD;AAAA,IACO,OAAA;AAAA,IACP,MAAM;AAAA,IACc,oBAAA;AAAA,IACpB,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MACP,KAAK;AAAA,IACP;AAAA,IACA,YAAA,CAAa,MAAU;AACrB,UAAI,MAAgB,OAAQ,QAAO;AAEnC,MAAA,EAAiB;AAAA,QACf,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,eAAe;AAAA,UACf,OAAO,EAAgB;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACkB,kBAAA;AAAA,IACA,kBAAA;AAAA,EACnB,CAAA,IAED,gBAAA,EAAC,GAAD,CAAgB,CAAA;AAEpB,CACF"}
|
|
@@ -6,6 +6,7 @@ export interface TransactionDetailsProps {
|
|
|
6
6
|
canFlagTransaction?: boolean;
|
|
7
7
|
topActions?: TopActions[];
|
|
8
8
|
transaction: Transaction;
|
|
9
|
+
shouldShowEmbeddedCard?: boolean;
|
|
9
10
|
}
|
|
10
11
|
declare const _default: React.FunctionComponent<TransactionDetailsProps>;
|
|
11
12
|
export default _default;
|
|
@@ -1,50 +1,50 @@
|
|
|
1
1
|
import { buildDynamicCopy as G } from "../../../core/utils/Localization.es.js";
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
3
|
-
import { useCategoryStore as
|
|
4
|
-
import { ANALYTICS_EVENTS as
|
|
5
|
-
import { TransactionType as
|
|
6
|
-
import { isFeatureEnabled as
|
|
2
|
+
import { DATE_FORMATS_INTL as ie, formatDate as ae } from "../../../core/constants/DateFormats.es.js";
|
|
3
|
+
import { useCategoryStore as ne, useEvent as de, useGlobalCopyStore as se, useGlobalUiStore as le, useTransactionStore as me, useUserStore as ce } from "../../../common/context/hooks.es.js";
|
|
4
|
+
import { ANALYTICS_EVENTS as ue } from "../../../common/constants/Analytics.es.js";
|
|
5
|
+
import { TransactionType as pe } from "../../../core/types/Transaction.es.js";
|
|
6
|
+
import { isFeatureEnabled as ge } from "../../../core/utils/UserUtils.es.js";
|
|
7
7
|
import { formatCurrency as P } from "../../../core/utils/NumberFormatting.es.js";
|
|
8
|
-
import { fromUnixUTC as
|
|
9
|
-
import { isTransferTransaction as
|
|
10
|
-
import
|
|
11
|
-
import { BottomActions as m, DEFAULT_BOTTOM_ACTIONS as
|
|
12
|
-
import
|
|
13
|
-
import { EmbeddedCard as
|
|
14
|
-
import { AddMerchantBudgetAction as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import { getEmbeddedInstanceSlotByBeatTemplates as
|
|
8
|
+
import { fromUnixUTC as fe } from "../../../core/utils/DateUtil.es.js";
|
|
9
|
+
import { isTransferTransaction as he } from "../../../core/utils/TransactionUtils.es.js";
|
|
10
|
+
import _e from "../../../common/components/Loader.es.js";
|
|
11
|
+
import { BottomActions as m, DEFAULT_BOTTOM_ACTIONS as Te, DEFAULT_TOP_ACTIONS as Se, TopActions as f } from "../../constants/Actions.es.js";
|
|
12
|
+
import ye from "../../../insights/components/shared/ChartTransactionWithDrillDown.es.js";
|
|
13
|
+
import { EmbeddedCard as be } from "../../../insights/components/shared/InsightsCard/EmbeddedCard.es.js";
|
|
14
|
+
import { AddMerchantBudgetAction as De } from "./transactiondetails/actions/AddMerchantBudgetAction.es.js";
|
|
15
|
+
import Ae from "./transactiondetails/actions/CategoryAction.es.js";
|
|
16
|
+
import Ce from "./transactiondetails/actions/DateAction.es.js";
|
|
17
|
+
import ve from "./transactiondetails/actions/DeleteAction.es.js";
|
|
18
|
+
import xe from "./transactiondetails/actions/DeleteLogoAction.es.js";
|
|
19
|
+
import we from "./transactiondetails/actions/ExcludeAction.es.js";
|
|
20
|
+
import Ie from "./transactiondetails/actions/MemoAction.es.js";
|
|
21
|
+
import Le from "./transactiondetails/actions/SplitAction.es.js";
|
|
22
|
+
import Ee from "./transactiondetails/actions/TagsAction.es.js";
|
|
23
|
+
import Me from "./transactiondetails/Description.es.js";
|
|
24
|
+
import Be from "./transactiondetails/FlagTransaction.es.js";
|
|
25
|
+
import Oe from "./transactiondetails/TransactionDetailsView.es.js";
|
|
26
|
+
import { getEmbeddedInstanceSlotByBeatTemplates as Ne } from "./getEmbeddedInstanceSlotByBeatTemplates.es.js";
|
|
27
27
|
import a, { useMemo as U } from "react";
|
|
28
|
-
import { observer as
|
|
28
|
+
import { observer as Fe } from "mobx-react-lite";
|
|
29
29
|
import h from "@mui/material/Stack";
|
|
30
|
-
import { MerchantLogo as V, P as
|
|
31
|
-
import { endOfMonth as
|
|
32
|
-
import { isBefore as
|
|
30
|
+
import { MerchantLogo as V, P as Ge, Text as b } from "@mxenabled/mxui";
|
|
31
|
+
import { endOfMonth as Pe } from "date-fns/endOfMonth";
|
|
32
|
+
import { isBefore as Ue } from "date-fns/isBefore";
|
|
33
33
|
import { startOfMonth as k } from "date-fns/startOfMonth";
|
|
34
34
|
import D from "@mui/material/Paper";
|
|
35
35
|
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
36
|
-
import { useTheme as
|
|
37
|
-
import
|
|
36
|
+
import { useTheme as Ve } from "@mui/material/styles";
|
|
37
|
+
import ke from "@mui/material/Box";
|
|
38
38
|
import H from "@mui/material/Divider";
|
|
39
39
|
import R from "@mui/material/List";
|
|
40
|
-
import
|
|
41
|
-
import
|
|
42
|
-
var
|
|
43
|
-
const { onEvent:
|
|
44
|
-
a.useEffect(() =>
|
|
40
|
+
import He from "@mui/material/Alert";
|
|
41
|
+
import Re from "@mui/material/Snackbar";
|
|
42
|
+
var We = ({ bottomActions: _ = Te, canFlagTransaction: W = !0, topActions: A = Se, transaction: e, shouldShowEmbeddedCard: j = !0 }) => {
|
|
43
|
+
const { onEvent: z } = de(), { isCopyLoaded: q } = le(), { userFeatures: X } = ce(), { accounts: Y, common: $, insights_feed: d } = se(), { detailedCategories: C } = ne(), { alert: v, associatedBeats: x, detailedTransactions: w, cachedStartDate: I, loadEmbeddedInstanceTransactions: J, setAlert: L } = me(), [K, E] = a.useState(!1), [M, B] = a.useState(!1), [Q, Z] = a.useState(!1), ee = Ve(), te = e?.number && e.number.length > 4, O = e?.transaction_type === pe.CREDIT, N = he(e) && !!e.institutionName, s = a.useMemo(() => x.find((r) => r.associated_transaction_guid === e.guid), [x, e]), o = j ? Ne($, s) : null, [l, T] = a.useState(o ? o.dataSeries.length - 1 : 0);
|
|
44
|
+
a.useEffect(() => z(ue.TRANSACTION_DETAILS_VIEW, { transaction_guid: e.guid }), []), a.useEffect(() => {
|
|
45
45
|
if (!o || o.dataSeries.length === 0) return;
|
|
46
46
|
const { date: r } = o.dataSeries[l], i = k(r);
|
|
47
|
-
|
|
47
|
+
Ue(i, I) && (B(!0), J(i).finally(() => {
|
|
48
48
|
B(!1);
|
|
49
49
|
}));
|
|
50
50
|
}, [
|
|
@@ -63,11 +63,11 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
return null;
|
|
66
|
-
}, [o, C]),
|
|
66
|
+
}, [o, C]), re = U(() => {
|
|
67
67
|
if (!o?.dataSeries?.length) return [];
|
|
68
|
-
const { guid: r, date: i } = o.dataSeries[l], u = k(i), p =
|
|
68
|
+
const { guid: r, date: i } = o.dataSeries[l], u = k(i), p = Pe(i);
|
|
69
69
|
return w.filter((g) => {
|
|
70
|
-
const F =
|
|
70
|
+
const F = fe(g.date);
|
|
71
71
|
return F >= u && F <= p && g.guid === r;
|
|
72
72
|
});
|
|
73
73
|
}, [
|
|
@@ -76,9 +76,9 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
76
76
|
w,
|
|
77
77
|
M
|
|
78
78
|
]);
|
|
79
|
-
if (!
|
|
80
|
-
const c =
|
|
81
|
-
return /* @__PURE__ */ n(
|
|
79
|
+
if (!q) return /* @__PURE__ */ t(_e, {});
|
|
80
|
+
const c = ge(X, "MX_TXN_DETAILS_VIEW_ONLY"), oe = ee.palette.mode === "dark" ? "grey.800" : "grey.100";
|
|
81
|
+
return /* @__PURE__ */ n(ke, {
|
|
82
82
|
className: "mx-txn-transaction-details",
|
|
83
83
|
width: "100%",
|
|
84
84
|
children: [
|
|
@@ -96,7 +96,7 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
96
96
|
size: 64
|
|
97
97
|
})
|
|
98
98
|
}),
|
|
99
|
-
/* @__PURE__ */ t(
|
|
99
|
+
/* @__PURE__ */ t(Me, {
|
|
100
100
|
displayValue: N ? e.institutionName : void 0,
|
|
101
101
|
transaction: e,
|
|
102
102
|
viewOnly: c || N
|
|
@@ -105,13 +105,13 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
105
105
|
direction: "row",
|
|
106
106
|
justifyContent: "space-between",
|
|
107
107
|
sx: { minHeight: 44 },
|
|
108
|
-
children: [/* @__PURE__ */ n(
|
|
108
|
+
children: [/* @__PURE__ */ n(Ge, {
|
|
109
109
|
color: O ? "success.main" : "text.primary",
|
|
110
110
|
variant: "h1",
|
|
111
111
|
children: [O ? "+" : "", P(e.amount, "0,0.00")]
|
|
112
|
-
}), !c && W && /* @__PURE__ */ t(
|
|
112
|
+
}), !c && W && /* @__PURE__ */ t(Be, { transaction: e })]
|
|
113
113
|
}),
|
|
114
|
-
o?.instanceSlot && /* @__PURE__ */ t(
|
|
114
|
+
o?.instanceSlot && /* @__PURE__ */ t(be, {
|
|
115
115
|
callToAction: o.callToAction,
|
|
116
116
|
description: G(d.general.embedded_description, y.changetype, /* @__PURE__ */ t("strong", { children: y.percentageAmount })),
|
|
117
117
|
instanceSlot: o.instanceSlot,
|
|
@@ -122,7 +122,7 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
122
122
|
}),
|
|
123
123
|
/* @__PURE__ */ n(h, {
|
|
124
124
|
sx: {
|
|
125
|
-
bgcolor:
|
|
125
|
+
bgcolor: oe,
|
|
126
126
|
borderRadius: "4px",
|
|
127
127
|
gap: 4,
|
|
128
128
|
p: 8
|
|
@@ -130,7 +130,7 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
130
130
|
children: [/* @__PURE__ */ t(b, {
|
|
131
131
|
bold: !0,
|
|
132
132
|
children: `${e.account}
|
|
133
|
-
${
|
|
133
|
+
${te ? e.number : "•".repeat(4).concat(e.number ?? "")}`
|
|
134
134
|
}), /* @__PURE__ */ t(b, {
|
|
135
135
|
bold: !0,
|
|
136
136
|
truncate: !0,
|
|
@@ -143,11 +143,11 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
143
143
|
/* @__PURE__ */ t(D, {
|
|
144
144
|
square: !0,
|
|
145
145
|
sx: { boxShadow: "none" },
|
|
146
|
-
children: c ? /* @__PURE__ */ t(
|
|
147
|
-
r === f.Category && /* @__PURE__ */ t(
|
|
148
|
-
r === f.Date && /* @__PURE__ */ t(
|
|
149
|
-
r === f.Memo && /* @__PURE__ */ t(
|
|
150
|
-
r === f.Tags && /* @__PURE__ */ t(
|
|
146
|
+
children: c ? /* @__PURE__ */ t(Oe, { transaction: e }) : /* @__PURE__ */ t(R, { children: A.map((r, i) => /* @__PURE__ */ n(a.Fragment, { children: [
|
|
147
|
+
r === f.Category && /* @__PURE__ */ t(Ae, { transaction: e }),
|
|
148
|
+
r === f.Date && /* @__PURE__ */ t(Ce, { transaction: e }),
|
|
149
|
+
r === f.Memo && /* @__PURE__ */ t(Ie, { transaction: e }),
|
|
150
|
+
r === f.Tags && /* @__PURE__ */ t(Ee, { transaction: e }),
|
|
151
151
|
/* @__PURE__ */ t(H, {
|
|
152
152
|
component: "li",
|
|
153
153
|
variant: i < A.length - 1 ? "inset" : "fullWidth"
|
|
@@ -160,24 +160,24 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
160
160
|
ml: 26,
|
|
161
161
|
mt: 16,
|
|
162
162
|
variant: "body1",
|
|
163
|
-
children:
|
|
163
|
+
children: Y.actions
|
|
164
164
|
}), /* @__PURE__ */ t(D, {
|
|
165
165
|
square: !0,
|
|
166
166
|
sx: { boxShadow: "none" },
|
|
167
167
|
children: /* @__PURE__ */ n(R, { children: [S.map((r, i) => /* @__PURE__ */ n(a.Fragment, { children: [
|
|
168
|
-
r === m.MerchantBudget && /* @__PURE__ */ t(
|
|
169
|
-
r === m.SplitTransaction && /* @__PURE__ */ t(
|
|
170
|
-
r === m.HideTransaction && /* @__PURE__ */ t(
|
|
171
|
-
r === m.MerchantLogo && /* @__PURE__ */ t(
|
|
168
|
+
r === m.MerchantBudget && /* @__PURE__ */ t(De, { transaction: e }),
|
|
169
|
+
r === m.SplitTransaction && /* @__PURE__ */ t(Le, { transaction: e }),
|
|
170
|
+
r === m.HideTransaction && /* @__PURE__ */ t(we, { transaction: e }),
|
|
171
|
+
r === m.MerchantLogo && /* @__PURE__ */ t(xe, { transaction: e }),
|
|
172
172
|
/* @__PURE__ */ t(H, {
|
|
173
173
|
component: "li",
|
|
174
174
|
variant: i < S.length - 1 ? "inset" : "fullWidth"
|
|
175
175
|
})
|
|
176
|
-
] }, r)), e.is_manual && !e.parent_guid && !e.has_been_split && /* @__PURE__ */ t(
|
|
176
|
+
] }, r)), e.is_manual && !e.parent_guid && !e.has_been_split && /* @__PURE__ */ t(ve, { transaction: e })] })
|
|
177
177
|
})] })
|
|
178
178
|
] }),
|
|
179
|
-
s && o && /* @__PURE__ */ t(
|
|
180
|
-
ariaLabel:
|
|
179
|
+
s && o && /* @__PURE__ */ t(ye, {
|
|
180
|
+
ariaLabel: ae(o?.dataSeries[l]?.date, ie.MONTH),
|
|
181
181
|
barChartProps: {
|
|
182
182
|
amounts: {
|
|
183
183
|
average: s.payload.average_amount,
|
|
@@ -214,25 +214,25 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
214
214
|
merchantGuid: e.merchant_guid ?? "",
|
|
215
215
|
size: 16
|
|
216
216
|
}),
|
|
217
|
-
isOpen:
|
|
217
|
+
isOpen: K,
|
|
218
218
|
onClose: () => {
|
|
219
219
|
E(!1), T(o.dataSeries.length - 1);
|
|
220
220
|
},
|
|
221
221
|
onTabChange: (r) => {
|
|
222
222
|
T(r);
|
|
223
223
|
},
|
|
224
|
-
tipSection:
|
|
224
|
+
tipSection: Q ? void 0 : {
|
|
225
225
|
message: G(d.general.tip_section_message, /* @__PURE__ */ t("strong", { children: d.general.tip_section_title }), /* @__PURE__ */ t("strong", { children: s.primary_transaction?.description })),
|
|
226
|
-
onDismiss: () =>
|
|
226
|
+
onDismiss: () => Z(!0)
|
|
227
227
|
},
|
|
228
228
|
title: d.general.transaction_history_title,
|
|
229
229
|
transactionListProps: {
|
|
230
230
|
showLoader: M,
|
|
231
231
|
showInsights: !0,
|
|
232
|
-
transaction:
|
|
232
|
+
transaction: re
|
|
233
233
|
}
|
|
234
234
|
}),
|
|
235
|
-
/* @__PURE__ */ t(
|
|
235
|
+
/* @__PURE__ */ t(Re, {
|
|
236
236
|
anchorOrigin: {
|
|
237
237
|
vertical: "bottom",
|
|
238
238
|
horizontal: "right"
|
|
@@ -240,7 +240,7 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
240
240
|
autoHideDuration: 3500,
|
|
241
241
|
onClose: () => L(""),
|
|
242
242
|
open: !!v,
|
|
243
|
-
children: /* @__PURE__ */ t(
|
|
243
|
+
children: /* @__PURE__ */ t(He, {
|
|
244
244
|
closeText: "",
|
|
245
245
|
onClose: () => L(""),
|
|
246
246
|
severity: "success",
|
|
@@ -250,9 +250,9 @@ var Re = ({ bottomActions: _ = _e, canFlagTransaction: W = !0, topActions: A = T
|
|
|
250
250
|
})
|
|
251
251
|
]
|
|
252
252
|
});
|
|
253
|
-
},
|
|
253
|
+
}, Mt = Fe(We);
|
|
254
254
|
export {
|
|
255
|
-
|
|
255
|
+
Mt as default
|
|
256
256
|
};
|
|
257
257
|
|
|
258
258
|
//# sourceMappingURL=TransactionDetails.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionDetails.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionDetails.tsx"],"sourcesContent":["import React, { useMemo } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\nimport Paper from '@mui/material/Paper'\nimport Snackbar from '@mui/material/Snackbar'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { MerchantLogo, P, Text } from '@mxenabled/mxui'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useCategoryStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n useUserStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { Transaction, TransactionType } from '../../../core'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { isTransferTransaction } from '../../../core/utils/TransactionUtils'\nimport { isFeatureEnabled } from '../../../core/utils/UserUtils'\nimport { ChartTransactionWithDrillDown, EmbeddedCard } from '../../../insights'\n\nimport {\n BottomActions,\n DEFAULT_BOTTOM_ACTIONS,\n DEFAULT_TOP_ACTIONS,\n TopActions,\n} from '../../constants/Actions'\n\nimport {\n AddMerchantBudgetAction,\n CategoryAction,\n DateAction,\n DeleteAction,\n DeleteLogoAction,\n ExcludeAction,\n MemoAction,\n SplitAction,\n TagsAction,\n} from './transactiondetails/actions'\nimport Description from './transactiondetails/Description'\nimport FlagTransaction from './transactiondetails/FlagTransaction'\nimport TransactionDetailsView from './transactiondetails/TransactionDetailsView'\nimport { getEmbeddedInstanceSlotByBeatTemplates } from './getEmbeddedInstanceSlotByBeatTemplates'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\nexport interface TransactionDetailsProps {\n bottomActions?: BottomActions[]\n canFlagTransaction?: boolean\n topActions?: TopActions[]\n transaction: Transaction\n}\n\nconst TransactionDetails: React.FC<TransactionDetailsProps> = ({\n bottomActions = DEFAULT_BOTTOM_ACTIONS,\n canFlagTransaction = true,\n topActions = DEFAULT_TOP_ACTIONS,\n transaction,\n}) => {\n const { onEvent } = useEvent()\n const { isCopyLoaded } = useGlobalUiStore()\n const { userFeatures } = useUserStore()\n const { accounts: copy, common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { detailedCategories } = useCategoryStore()\n const {\n alert,\n associatedBeats,\n detailedTransactions,\n cachedStartDate,\n loadEmbeddedInstanceTransactions,\n setAlert,\n } = useTransactionStore()\n\n const [showTranscationDrilldownDrawer, setShowTransactionDrillDownDrawer] = React.useState(false)\n\n const [isLoading, setIsLoading] = React.useState(false)\n const [closeTipSection, setCloseTipSection] = React.useState(false)\n const theme = useTheme()\n\n const showFullNumber = transaction?.number && transaction.number.length > 4\n\n const isCredit = transaction?.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const embeddedData = getEmbeddedInstanceSlotByBeatTemplates(commonCopy, beat)\n\n const [selectedTabIndex, setSelectedTabIndex] = React.useState(\n embeddedData ? embeddedData.dataSeries.length - 1 : 0,\n )\n\n React.useEffect(\n () =>\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_VIEW, { transaction_guid: transaction.guid }),\n [],\n )\n\n React.useEffect(() => {\n if (!embeddedData || embeddedData.dataSeries.length === 0) return\n\n const { date: selectedSeriesItemDate } = embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n\n if (isBefore(start, cachedStartDate)) {\n setIsLoading(true)\n loadEmbeddedInstanceTransactions(start).finally(() => {\n setIsLoading(false)\n })\n }\n }, [selectedTabIndex, embeddedData, cachedStartDate])\n\n //if merchant_guid is null then no need to show the MerchantBudget action.\n const updatedBottomActions =\n bottomActions.includes(BottomActions.MerchantBudget) && !transaction?.merchant_guid\n ? bottomActions.filter((action) => action !== BottomActions.MerchantBudget)\n : bottomActions\n\n const embeddedCardDataCategory = useMemo(() => {\n if (embeddedData) {\n const category = detailedCategories.find(\n (cat) => cat.guid === transaction.top_level_category_guid,\n )\n const mean = beat?.payload?.average_amount ?? 0\n const currentAmount = transaction.amount\n\n let changetype = insightsCopy.general.increased_text\n if (currentAmount - mean < 0) {\n changetype = insightsCopy.general.decreased_text\n }\n const percentageAmount =\n mean === 0 ? 0 : Math.round((Math.abs(currentAmount - mean) / mean) * 100)\n\n return { category, percentageAmount, changetype }\n }\n return null\n }, [embeddedData, detailedCategories])\n\n const filteredTransactions = useMemo(() => {\n if (!embeddedData?.dataSeries?.length) {\n return []\n }\n\n const { guid: selectedSeriesItemGuid, date: selectedSeriesItemDate } =\n embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n const end = endOfMonth(selectedSeriesItemDate)\n\n return detailedTransactions.filter((t) => {\n const transactionDate = fromUnixUTC(t.date)\n return transactionDate >= start && transactionDate <= end && t.guid === selectedSeriesItemGuid\n })\n }, [selectedTabIndex, embeddedData, detailedTransactions, isLoading])\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n const shouldShowViewOnlyMode = isFeatureEnabled(userFeatures, 'MX_TXN_DETAILS_VIEW_ONLY')\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <Box className=\"mx-txn-transaction-details\" width=\"100%\">\n {transaction && (\n <Stack>\n <Stack gap={12} p={24}>\n <Paper elevation={2} sx={{ width: 64 }}>\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n size={64}\n />\n </Paper>\n\n <Description\n displayValue={showInstitution ? transaction.institutionName : undefined}\n transaction={transaction}\n viewOnly={shouldShowViewOnlyMode || showInstitution}\n />\n\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ minHeight: 44 }}>\n <P color={isCredit ? 'success.main' : 'text.primary'} variant=\"h1\">\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </P>\n {!shouldShowViewOnlyMode && canFlagTransaction && (\n <FlagTransaction transaction={transaction} />\n )}\n </Stack>\n\n {embeddedData?.instanceSlot && (\n <EmbeddedCard\n callToAction={embeddedData.callToAction}\n description={\n buildDynamicCopy(\n insightsCopy.general.embedded_description,\n embeddedCardDataCategory!.changetype,\n <strong>{embeddedCardDataCategory!.percentageAmount}</strong>,\n ) as string\n }\n instanceSlot={embeddedData.instanceSlot}\n onCtaClick={() => {\n setShowTransactionDrillDownDrawer(true)\n }}\n title={beat!.html_micro_title!}\n />\n )}\n <Stack sx={{ bgcolor: bgColor, borderRadius: '4px', gap: 4, p: 8 }}>\n <Text bold={true}>\n {`${transaction.account}\n ${\n showFullNumber\n ? transaction.number\n : '\\u2022'.repeat(4).concat(transaction.number ?? '')\n }`}\n </Text>\n <Text bold={true} truncate={true} variant=\"tiny\">\n {transaction.feed_description}\n </Text>\n </Stack>\n </Stack>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n {shouldShowViewOnlyMode ? (\n <TransactionDetailsView transaction={transaction} />\n ) : (\n <List>\n {topActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === TopActions.Category && <CategoryAction transaction={transaction} />}\n {action === TopActions.Date && <DateAction transaction={transaction} />}\n {action === TopActions.Memo && <MemoAction transaction={transaction} />}\n {action === TopActions.Tags && <TagsAction transaction={transaction} />}\n <Divider\n component=\"li\"\n variant={index < topActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n </List>\n )}\n </Paper>\n\n {!shouldShowViewOnlyMode && updatedBottomActions.length > 0 && (\n <React.Fragment>\n <Text bold={true} mb={8} ml={26} mt={16} variant=\"body1\">\n {copy.actions}\n </Text>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n <List>\n {updatedBottomActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === BottomActions.MerchantBudget && (\n <AddMerchantBudgetAction transaction={transaction} />\n )}\n {action === BottomActions.SplitTransaction && (\n <SplitAction transaction={transaction} />\n )}\n {action === BottomActions.HideTransaction && (\n <ExcludeAction transaction={transaction} />\n )}\n {action === BottomActions.MerchantLogo && (\n <DeleteLogoAction transaction={transaction} />\n )}\n <Divider\n component=\"li\"\n variant={index < updatedBottomActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n\n {/*\n Show DeleteAction only if:\n - The transaction is manual\n - The transaction is NOT a parent transaction (no parent_guid)\n - The transaction has NOT been split (has_been_split is false)\n \n This ensures delete is hidden for parent or split transactions.\n */}\n {transaction.is_manual &&\n !transaction.parent_guid &&\n !transaction.has_been_split && <DeleteAction transaction={transaction} />}\n </List>\n </Paper>\n </React.Fragment>\n )}\n </Stack>\n )}\n {beat && embeddedData && (\n <ChartTransactionWithDrillDown\n ariaLabel={formatDate(\n embeddedData?.dataSeries[selectedTabIndex]?.date,\n DATE_FORMATS_INTL.MONTH,\n )}\n barChartProps={{\n amounts: {\n average: beat.payload.average_amount,\n formattedAverage: formatCurrency(beat.payload.average_amount, '0,0'),\n },\n color: embeddedCardDataCategory!.category?.color || '',\n data: embeddedData.chartData,\n margin: { bottom: 10, left: 24, right: 24, top: 20 },\n monthlyAmountLabel: insightsCopy.general.monthly_amount,\n onBarClick: (index) => {\n setSelectedTabIndex(index)\n },\n trendAmountLabel: insightsCopy.general.trend,\n legendPosition: 'top',\n }}\n beat={{\n heading: beat.html_title,\n subHeading: {\n category_guid: transaction.category_guid ?? '',\n merchant_guid: transaction.merchant_guid ?? '',\n description: transaction.description ?? '',\n },\n }}\n data={embeddedData.chartData}\n defaultSelectedIndex={selectedTabIndex}\n icon={\n <MerchantLogo\n alt={transaction.description ?? ''}\n categoryGuid={transaction.category_guid ?? ''}\n merchantGuid={transaction.merchant_guid ?? ''}\n size={16}\n />\n }\n isOpen={showTranscationDrilldownDrawer}\n onClose={() => {\n setShowTransactionDrillDownDrawer(false)\n setSelectedTabIndex(embeddedData!.dataSeries.length - 1)\n }}\n onTabChange={(index: number) => {\n setSelectedTabIndex(index)\n }}\n tipSection={\n !closeTipSection\n ? {\n message: buildDynamicCopy(\n insightsCopy.general.tip_section_message,\n <strong>{insightsCopy.general.tip_section_title}</strong>,\n <strong>{beat.primary_transaction?.description}</strong>,\n ) as string,\n onDismiss: () => setCloseTipSection(true),\n }\n : undefined\n }\n title={insightsCopy.general.transaction_history_title}\n transactionListProps={{\n showLoader: isLoading,\n showInsights: true,\n transaction: filteredTransactions,\n }}\n />\n )}\n <Snackbar\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n autoHideDuration={3500}\n onClose={() => setAlert('')}\n open={Boolean(alert)}\n >\n <Alert closeText=\"\" onClose={() => setAlert('')} severity=\"success\" variant=\"filled\">\n {alert}\n </Alert>\n </Snackbar>\n </Box>\n )\n}\n\nexport default observer(TransactionDetails)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmEA,IAAM,KAAA,CAAyD,EAC7D,eAAA,IAAgB,IAChB,oBAAA,IAAqB,IACrB,YAAA,IAAa,IACb,aAAA,EAAA,MACI;AACJ,QAAM,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,cAAA,EAAA,IAAiB,GAAiB,GACpC,EAAE,cAAA,EAAA,IAAiB,GAAa,GAChC,EAAE,UAAU,GAAM,QAAQ,GA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,aAAa;AAAA,QACf;AAAA,MACD,CAAA;AAAA,MAEH,gBAAA,EAAC,IAAD;AAAA,QACE,cAAc;AAAA,UAAE,UAAU;AAAA,UAAU,YAAY;AAAA,QAAQ;AAAA,QACxD,kBAAkB;AAAA,QAClB,SAAA,MAAe,EAAS,EAAE;AAAA,QAC1B,MAAM,EAAQ;AAAA,QAEd,UAAA,gBAAA,EAAC,IAAD;AAAA,UAAO,WAAU;AAAA,UAAG,SAAA,MAAe,EAAS,EAAE;AAAA,UAAG,UAAS;AAAA,UAAU,SAAQ;AAAA,UACzE,UAAA;AAAA,QACI,CAAA;AAAA,MACC,CAAA;AAAA,IACP;AAAA;AAET,GAEA,KAAe,GAAS,EAAkB"}
|
|
1
|
+
{"version":3,"file":"TransactionDetails.es.js","names":[],"sources":["../../../../src/transactions/components/shared/TransactionDetails.tsx"],"sourcesContent":["import React, { useMemo } from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Alert from '@mui/material/Alert'\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport List from '@mui/material/List'\nimport Paper from '@mui/material/Paper'\nimport Snackbar from '@mui/material/Snackbar'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { MerchantLogo, P, Text } from '@mxenabled/mxui'\n\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfMonth } from 'date-fns/startOfMonth'\n\nimport {\n ANALYTICS_EVENTS,\n Loader,\n useCategoryStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n useUserStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { Transaction, TransactionType } from '../../../core'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { isTransferTransaction } from '../../../core/utils/TransactionUtils'\nimport { isFeatureEnabled } from '../../../core/utils/UserUtils'\nimport { ChartTransactionWithDrillDown, EmbeddedCard } from '../../../insights'\n\nimport {\n BottomActions,\n DEFAULT_BOTTOM_ACTIONS,\n DEFAULT_TOP_ACTIONS,\n TopActions,\n} from '../../constants/Actions'\n\nimport {\n AddMerchantBudgetAction,\n CategoryAction,\n DateAction,\n DeleteAction,\n DeleteLogoAction,\n ExcludeAction,\n MemoAction,\n SplitAction,\n TagsAction,\n} from './transactiondetails/actions'\nimport Description from './transactiondetails/Description'\nimport FlagTransaction from './transactiondetails/FlagTransaction'\nimport TransactionDetailsView from './transactiondetails/TransactionDetailsView'\nimport { getEmbeddedInstanceSlotByBeatTemplates } from './getEmbeddedInstanceSlotByBeatTemplates'\nimport { formatCurrency } from '../../../core/utils/NumberFormatting'\nimport { buildDynamicCopy } from '../../../core/utils/Localization'\n\nexport interface TransactionDetailsProps {\n bottomActions?: BottomActions[]\n canFlagTransaction?: boolean\n topActions?: TopActions[]\n transaction: Transaction\n shouldShowEmbeddedCard?: boolean\n}\n\nconst TransactionDetails: React.FC<TransactionDetailsProps> = ({\n bottomActions = DEFAULT_BOTTOM_ACTIONS,\n canFlagTransaction = true,\n topActions = DEFAULT_TOP_ACTIONS,\n transaction,\n shouldShowEmbeddedCard = true,\n}) => {\n const { onEvent } = useEvent()\n const { isCopyLoaded } = useGlobalUiStore()\n const { userFeatures } = useUserStore()\n const { accounts: copy, common: commonCopy, insights_feed: insightsCopy } = useGlobalCopyStore()\n\n const { detailedCategories } = useCategoryStore()\n const {\n alert,\n associatedBeats,\n detailedTransactions,\n cachedStartDate,\n loadEmbeddedInstanceTransactions,\n setAlert,\n } = useTransactionStore()\n\n const [showTranscationDrilldownDrawer, setShowTransactionDrillDownDrawer] = React.useState(false)\n\n const [isLoading, setIsLoading] = React.useState(false)\n const [closeTipSection, setCloseTipSection] = React.useState(false)\n const theme = useTheme()\n\n const showFullNumber = transaction?.number && transaction.number.length > 4\n\n const isCredit = transaction?.transaction_type === TransactionType.CREDIT\n\n const showInstitution = isTransferTransaction(transaction) && Boolean(transaction.institutionName)\n\n const beat = React.useMemo(() => {\n return associatedBeats.find((beat) => beat.associated_transaction_guid === transaction.guid)\n }, [associatedBeats, transaction])\n\n const embeddedData = shouldShowEmbeddedCard\n ? getEmbeddedInstanceSlotByBeatTemplates(commonCopy, beat)\n : null\n\n const [selectedTabIndex, setSelectedTabIndex] = React.useState(\n embeddedData ? embeddedData.dataSeries.length - 1 : 0,\n )\n\n React.useEffect(\n () =>\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_VIEW, { transaction_guid: transaction.guid }),\n [],\n )\n\n React.useEffect(() => {\n if (!embeddedData || embeddedData.dataSeries.length === 0) return\n\n const { date: selectedSeriesItemDate } = embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n\n if (isBefore(start, cachedStartDate)) {\n setIsLoading(true)\n loadEmbeddedInstanceTransactions(start).finally(() => {\n setIsLoading(false)\n })\n }\n }, [selectedTabIndex, embeddedData, cachedStartDate])\n\n //if merchant_guid is null then no need to show the MerchantBudget action.\n const updatedBottomActions =\n bottomActions.includes(BottomActions.MerchantBudget) && !transaction?.merchant_guid\n ? bottomActions.filter((action) => action !== BottomActions.MerchantBudget)\n : bottomActions\n\n const embeddedCardDataCategory = useMemo(() => {\n if (embeddedData) {\n const category = detailedCategories.find(\n (cat) => cat.guid === transaction.top_level_category_guid,\n )\n const mean = beat?.payload?.average_amount ?? 0\n const currentAmount = transaction.amount\n\n let changetype = insightsCopy.general.increased_text\n if (currentAmount - mean < 0) {\n changetype = insightsCopy.general.decreased_text\n }\n const percentageAmount =\n mean === 0 ? 0 : Math.round((Math.abs(currentAmount - mean) / mean) * 100)\n\n return { category, percentageAmount, changetype }\n }\n return null\n }, [embeddedData, detailedCategories])\n\n const filteredTransactions = useMemo(() => {\n if (!embeddedData?.dataSeries?.length) {\n return []\n }\n\n const { guid: selectedSeriesItemGuid, date: selectedSeriesItemDate } =\n embeddedData.dataSeries[selectedTabIndex]\n\n const start = startOfMonth(selectedSeriesItemDate)\n const end = endOfMonth(selectedSeriesItemDate)\n\n return detailedTransactions.filter((t) => {\n const transactionDate = fromUnixUTC(t.date)\n return transactionDate >= start && transactionDate <= end && t.guid === selectedSeriesItemGuid\n })\n }, [selectedTabIndex, embeddedData, detailedTransactions, isLoading])\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n const shouldShowViewOnlyMode = isFeatureEnabled(userFeatures, 'MX_TXN_DETAILS_VIEW_ONLY')\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <Box className=\"mx-txn-transaction-details\" width=\"100%\">\n {transaction && (\n <Stack>\n <Stack gap={12} p={24}>\n <Paper elevation={2} sx={{ width: 64 }}>\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n size={64}\n />\n </Paper>\n\n <Description\n displayValue={showInstitution ? transaction.institutionName : undefined}\n transaction={transaction}\n viewOnly={shouldShowViewOnlyMode || showInstitution}\n />\n\n <Stack direction=\"row\" justifyContent=\"space-between\" sx={{ minHeight: 44 }}>\n <P color={isCredit ? 'success.main' : 'text.primary'} variant=\"h1\">\n {isCredit ? '+' : ''}\n {formatCurrency(transaction.amount, '0,0.00')}\n </P>\n {!shouldShowViewOnlyMode && canFlagTransaction && (\n <FlagTransaction transaction={transaction} />\n )}\n </Stack>\n\n {embeddedData?.instanceSlot && (\n <EmbeddedCard\n callToAction={embeddedData.callToAction}\n description={\n buildDynamicCopy(\n insightsCopy.general.embedded_description,\n embeddedCardDataCategory!.changetype,\n <strong>{embeddedCardDataCategory!.percentageAmount}</strong>,\n ) as string\n }\n instanceSlot={embeddedData.instanceSlot}\n onCtaClick={() => {\n setShowTransactionDrillDownDrawer(true)\n }}\n title={beat!.html_micro_title!}\n />\n )}\n <Stack sx={{ bgcolor: bgColor, borderRadius: '4px', gap: 4, p: 8 }}>\n <Text bold={true}>\n {`${transaction.account}\n ${\n showFullNumber\n ? transaction.number\n : '\\u2022'.repeat(4).concat(transaction.number ?? '')\n }`}\n </Text>\n <Text bold={true} truncate={true} variant=\"tiny\">\n {transaction.feed_description}\n </Text>\n </Stack>\n </Stack>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n {shouldShowViewOnlyMode ? (\n <TransactionDetailsView transaction={transaction} />\n ) : (\n <List>\n {topActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === TopActions.Category && <CategoryAction transaction={transaction} />}\n {action === TopActions.Date && <DateAction transaction={transaction} />}\n {action === TopActions.Memo && <MemoAction transaction={transaction} />}\n {action === TopActions.Tags && <TagsAction transaction={transaction} />}\n <Divider\n component=\"li\"\n variant={index < topActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n </List>\n )}\n </Paper>\n\n {!shouldShowViewOnlyMode && updatedBottomActions.length > 0 && (\n <React.Fragment>\n <Text bold={true} mb={8} ml={26} mt={16} variant=\"body1\">\n {copy.actions}\n </Text>\n\n <Paper square={true} sx={{ boxShadow: 'none' }}>\n <List>\n {updatedBottomActions.map((action, index) => (\n <React.Fragment key={action}>\n {action === BottomActions.MerchantBudget && (\n <AddMerchantBudgetAction transaction={transaction} />\n )}\n {action === BottomActions.SplitTransaction && (\n <SplitAction transaction={transaction} />\n )}\n {action === BottomActions.HideTransaction && (\n <ExcludeAction transaction={transaction} />\n )}\n {action === BottomActions.MerchantLogo && (\n <DeleteLogoAction transaction={transaction} />\n )}\n <Divider\n component=\"li\"\n variant={index < updatedBottomActions.length - 1 ? 'inset' : 'fullWidth'}\n />\n </React.Fragment>\n ))}\n\n {/*\n Show DeleteAction only if:\n - The transaction is manual\n - The transaction is NOT a parent transaction (no parent_guid)\n - The transaction has NOT been split (has_been_split is false)\n \n This ensures delete is hidden for parent or split transactions.\n */}\n {transaction.is_manual &&\n !transaction.parent_guid &&\n !transaction.has_been_split && <DeleteAction transaction={transaction} />}\n </List>\n </Paper>\n </React.Fragment>\n )}\n </Stack>\n )}\n {beat && embeddedData && (\n <ChartTransactionWithDrillDown\n ariaLabel={formatDate(\n embeddedData?.dataSeries[selectedTabIndex]?.date,\n DATE_FORMATS_INTL.MONTH,\n )}\n barChartProps={{\n amounts: {\n average: beat.payload.average_amount,\n formattedAverage: formatCurrency(beat.payload.average_amount, '0,0'),\n },\n color: embeddedCardDataCategory!.category?.color || '',\n data: embeddedData.chartData,\n margin: { bottom: 10, left: 24, right: 24, top: 20 },\n monthlyAmountLabel: insightsCopy.general.monthly_amount,\n onBarClick: (index) => {\n setSelectedTabIndex(index)\n },\n trendAmountLabel: insightsCopy.general.trend,\n legendPosition: 'top',\n }}\n beat={{\n heading: beat.html_title,\n subHeading: {\n category_guid: transaction.category_guid ?? '',\n merchant_guid: transaction.merchant_guid ?? '',\n description: transaction.description ?? '',\n },\n }}\n data={embeddedData.chartData}\n defaultSelectedIndex={selectedTabIndex}\n icon={\n <MerchantLogo\n alt={transaction.description ?? ''}\n categoryGuid={transaction.category_guid ?? ''}\n merchantGuid={transaction.merchant_guid ?? ''}\n size={16}\n />\n }\n isOpen={showTranscationDrilldownDrawer}\n onClose={() => {\n setShowTransactionDrillDownDrawer(false)\n setSelectedTabIndex(embeddedData!.dataSeries.length - 1)\n }}\n onTabChange={(index: number) => {\n setSelectedTabIndex(index)\n }}\n tipSection={\n !closeTipSection\n ? {\n message: buildDynamicCopy(\n insightsCopy.general.tip_section_message,\n <strong>{insightsCopy.general.tip_section_title}</strong>,\n <strong>{beat.primary_transaction?.description}</strong>,\n ) as string,\n onDismiss: () => setCloseTipSection(true),\n }\n : undefined\n }\n title={insightsCopy.general.transaction_history_title}\n transactionListProps={{\n showLoader: isLoading,\n showInsights: true,\n transaction: filteredTransactions,\n }}\n />\n )}\n <Snackbar\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n autoHideDuration={3500}\n onClose={() => setAlert('')}\n open={Boolean(alert)}\n >\n <Alert closeText=\"\" onClose={() => setAlert('')} severity=\"success\" variant=\"filled\">\n {alert}\n </Alert>\n </Snackbar>\n </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