@mx-cartographer/experiences 9.7.47 → 9.7.49
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 +8 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +45 -37
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/transactions/components/shared/TransactionDetails.es.js +186 -159
- package/dist/transactions/components/shared/TransactionDetails.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [9.7.49] - 10-26-2026
|
|
2
|
+
|
|
3
|
+
- **FIXED** - Transaction Details drilldown design QA (WEC-2137): the merchant logo no longer carries an elevation shadow (64px, radius 8, flat), and the account feed line is 9/12 bold 700 uppercase with 0.27px tracking in `text.secondary`, with the masked account number on that line instead of the account name line. A long feed description truncates in its line without pushing the number out, the number is omitted when the account has none, and the logo keeps a `background.paper` surface
|
|
4
|
+
|
|
5
|
+
## [9.7.48] - 10-26-2026
|
|
6
|
+
|
|
7
|
+
- **ADDED** - Cost of Living to Income's "View more" drawer on Insights 2.0 (MEW2-3368): the `transaction_history_block` `cost_living_to_income` entry, a double bar of the living-cost category vs income per month with month tabs and category / Income tabs, listing the tapped bar's transactions by its `aggregated_guids` and the empty state for a bar that names none. Configuration only, on the double-bar drawer from WEC-2101: the cost bar takes the beat category's colour and income chart4, as the pulse drawer did. Fixture (`CostOfLivingToIncomeBeats.ts` and its transactions in `CostOfLivingToIncomeTransactions.ts`, outside the shared mock generator), drawer story, contract test and `docs/action-blocks/transaction-history-block.md`
|
|
8
|
+
|
|
1
9
|
## [9.7.47] - 10-26-2026
|
|
2
10
|
|
|
3
11
|
- **ADDED** - Bill Amount Not Standard beat contract test (`src/insights-v2/components/__tests__/BillAmountNotStandardContract.test.tsx`): the registered card and drawer blocks, the chart with one bar per bill payment and the average as Trend, the one payment behind a tapped bar from the drawer's tabs and from the card's chart, the payment's detail view with its actions, split handling, a bar whose payment the store does not hold, and closing, driven through `BaseLayout` from the shipped fixture. The fixture's four payments are pinned in `mock/generateTransactions.ts` (`billAmountNotStandardTransactions`) with their merchant in `Merchants.json`, and the legacy half of the `BarchartBlockBeats.ts` wrapper now carries the same transactions, timestamps and copy as its envelope; fixture pins in `blocks.test.ts`; `InsightsV2/Insights/BillAmountNotStandard` story; `docs/action-blocks/transaction-history-block.md`. No runtime change (MEW2-3358)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
1
|
+
import { buildDynamicCopy as O } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as T, formatDate as C } from "../../../core/constants/DateFormats.es.js";
|
|
3
3
|
import { fromUnixUTC as p } from "../../../core/utils/DateUtil.es.js";
|
|
4
|
-
import { getCategoryColor as
|
|
5
|
-
import { getLayoutConfig as
|
|
6
|
-
import { MerchantLogo as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { jsx as
|
|
9
|
-
import { endOfMonth as
|
|
4
|
+
import { getCategoryColor as A } from "../../../core/utils/CategoryUtil.es.js";
|
|
5
|
+
import { getLayoutConfig as I } from "../../blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js";
|
|
6
|
+
import { MerchantLogo as L } from "@mxenabled/mxui";
|
|
7
|
+
import { Icon as h } from "@mxenabled/mx-icons";
|
|
8
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
9
|
+
import { endOfMonth as f, isValid as M, parseISO as N, startOfMonth as S } from "date-fns";
|
|
10
10
|
var i = {
|
|
11
11
|
TRANSACTION: "not_standard_amount",
|
|
12
12
|
CATEGORY_SPEND: "category_spend",
|
|
@@ -20,10 +20,10 @@ var i = {
|
|
|
20
20
|
NON_ESSENTIAL_CATEGORY: "non_essential_category_summary",
|
|
21
21
|
DEPOSIT_SUMMARY: "monthly_deposit_summary",
|
|
22
22
|
LOW_BALANCE: "low_balance"
|
|
23
|
-
},
|
|
24
|
-
start:
|
|
25
|
-
end:
|
|
26
|
-
}), u = (t) => t?.length ? { accounts: t } : {},
|
|
23
|
+
}, c = (t, e) => e && A(e, t) || t.palette.primary.main, g = (t) => typeof t == "string" ? N(t) : new Date(t ?? NaN), _ = (t) => ({
|
|
24
|
+
start: S(g(t)),
|
|
25
|
+
end: f(g(t))
|
|
26
|
+
}), u = (t) => t?.length ? { accounts: t } : {}, b = ({ beat: t }) => {
|
|
27
27
|
const { account_guid: e, from_date: o, to_date: r } = t.insights_payload?.drilldown_data ?? {};
|
|
28
28
|
return typeof e != "string" || typeof o != "number" || typeof r != "number" || !Number.isFinite(o) || !Number.isFinite(r) || r <= o ? {
|
|
29
29
|
accounts: [],
|
|
@@ -48,48 +48,48 @@ var i = {
|
|
|
48
48
|
custom: (s) => s.category_guid === a || s.top_level_category_guid === a,
|
|
49
49
|
dateRange: _(r?.date)
|
|
50
50
|
};
|
|
51
|
-
},
|
|
51
|
+
}, v = ({ dataSeries: t, selectedIndex: e, spendCategoryGuids: o, instanceSlotData: r }) => {
|
|
52
52
|
const a = t[e];
|
|
53
53
|
return {
|
|
54
54
|
custom: (s) => !!s.top_level_category_guid && o.includes(s.top_level_category_guid),
|
|
55
55
|
dateRange: _(a?.date),
|
|
56
56
|
...u(r.account_guids)
|
|
57
57
|
};
|
|
58
|
-
},
|
|
59
|
-
const s = e[o], { start: n, end:
|
|
58
|
+
}, D = ({ beat: t, dataSeries: e, selectedIndex: o, isLastTab: r, instanceSlotData: a }) => {
|
|
59
|
+
const s = e[o], { start: n, end: d } = _(s?.date);
|
|
60
60
|
return {
|
|
61
61
|
dateRange: {
|
|
62
62
|
start: n,
|
|
63
|
-
end: r && t.created_at ? new Date(t.created_at) :
|
|
63
|
+
end: r && t.created_at ? new Date(t.created_at) : d
|
|
64
64
|
},
|
|
65
65
|
...u(a.account_guids)
|
|
66
66
|
};
|
|
67
|
-
},
|
|
68
|
-
const a = e[o], s = new Set(r === 1 ? a?.comparisonGuids : a?.mainGuids), n =
|
|
69
|
-
return !s.size || !
|
|
67
|
+
}, y = ({ beat: t, comparisonBars: e, selectedIndex: o, subIndex: r }) => {
|
|
68
|
+
const a = e[o], s = new Set(r === 1 ? a?.comparisonGuids : a?.mainGuids), n = N(a?.date ?? "");
|
|
69
|
+
return !s.size || !M(n) ? {
|
|
70
70
|
accounts: [],
|
|
71
71
|
custom: () => !1
|
|
72
72
|
} : {
|
|
73
|
-
custom: (
|
|
73
|
+
custom: (d) => s.has(d.guid),
|
|
74
74
|
dateRange: {
|
|
75
|
-
start:
|
|
76
|
-
end:
|
|
75
|
+
start: S(n),
|
|
76
|
+
end: f(n)
|
|
77
77
|
},
|
|
78
78
|
...u(t.account_guids)
|
|
79
79
|
};
|
|
80
|
-
},
|
|
80
|
+
}, x = {
|
|
81
81
|
[i.TRANSACTION]: {
|
|
82
82
|
top: "singleBar",
|
|
83
83
|
scope: "store",
|
|
84
84
|
filterMode: "store",
|
|
85
85
|
filterStrategy: m,
|
|
86
|
-
colors: (t, e) => [
|
|
86
|
+
colors: (t, e) => [c(t, e)],
|
|
87
87
|
header: (t) => {
|
|
88
88
|
const { title: e, subHeader: o } = t;
|
|
89
89
|
return {
|
|
90
90
|
heading: e,
|
|
91
91
|
subHeadingText: o?.text || void 0,
|
|
92
|
-
icon: /* @__PURE__ */
|
|
92
|
+
icon: /* @__PURE__ */ l(L, {
|
|
93
93
|
alt: o?.text,
|
|
94
94
|
categoryGuid: o?.logo?.category_guid || "",
|
|
95
95
|
merchantGuid: o?.logo?.merchant_guid || "",
|
|
@@ -98,7 +98,7 @@ var i = {
|
|
|
98
98
|
};
|
|
99
99
|
},
|
|
100
100
|
tipSection: (t, e, o = "") => ({
|
|
101
|
-
message:
|
|
101
|
+
message: O(e.general.tip_section_message, /* @__PURE__ */ l("strong", { children: e.general.tip_section_title }), /* @__PURE__ */ l("strong", { children: o })),
|
|
102
102
|
onDismiss: () => t(!0)
|
|
103
103
|
})
|
|
104
104
|
},
|
|
@@ -107,11 +107,11 @@ var i = {
|
|
|
107
107
|
filterStrategy: E,
|
|
108
108
|
scope: "store",
|
|
109
109
|
filterMode: "store",
|
|
110
|
-
colors: (t, e) => [
|
|
110
|
+
colors: (t, e) => [c(t, e)],
|
|
111
111
|
header: (t) => ({
|
|
112
112
|
heading: t.categoryName,
|
|
113
|
-
subHeadingText: t.selectedDate && C(
|
|
114
|
-
icon: /* @__PURE__ */
|
|
113
|
+
subHeadingText: t.selectedDate && C(g(t.selectedDate), T.MONTH_LONG) || "",
|
|
114
|
+
icon: /* @__PURE__ */ l(h, {
|
|
115
115
|
name: "calendar_month",
|
|
116
116
|
size: 16
|
|
117
117
|
})
|
|
@@ -119,14 +119,14 @@ var i = {
|
|
|
119
119
|
},
|
|
120
120
|
[i.MONTHLY_SPEND]: {
|
|
121
121
|
top: "singleBar",
|
|
122
|
-
filterStrategy:
|
|
122
|
+
filterStrategy: v,
|
|
123
123
|
scope: "store",
|
|
124
124
|
filterMode: "store",
|
|
125
125
|
colors: (t) => [t.palette.chart.chart2 ?? t.palette.primary.main]
|
|
126
126
|
},
|
|
127
127
|
[i.ACCOUNT_BALANCE]: {
|
|
128
128
|
top: "singleBar",
|
|
129
|
-
filterStrategy:
|
|
129
|
+
filterStrategy: D,
|
|
130
130
|
scope: "store",
|
|
131
131
|
filterMode: "store",
|
|
132
132
|
colors: (t) => [t.palette.success.main]
|
|
@@ -136,34 +136,42 @@ var i = {
|
|
|
136
136
|
filterStrategy: m,
|
|
137
137
|
scope: "beat",
|
|
138
138
|
filterMode: "local",
|
|
139
|
-
colors: (t, e) => [
|
|
139
|
+
colors: (t, e) => [c(t, e)]
|
|
140
140
|
},
|
|
141
141
|
[i.LOW_BALANCE]: {
|
|
142
142
|
top: "list",
|
|
143
|
-
filterStrategy:
|
|
143
|
+
filterStrategy: b,
|
|
144
144
|
scope: "store",
|
|
145
145
|
filterMode: "store",
|
|
146
146
|
colors: (t) => [t.palette.primary.main]
|
|
147
147
|
},
|
|
148
148
|
[i.SPEND_TO_INCOME]: {
|
|
149
149
|
top: "doubleBar",
|
|
150
|
-
filterStrategy:
|
|
150
|
+
filterStrategy: y,
|
|
151
151
|
scope: "store",
|
|
152
152
|
filterMode: "store",
|
|
153
|
-
colors: (t) =>
|
|
153
|
+
colors: (t) => I(t, "spend_to_income")?.color ?? [],
|
|
154
154
|
subTabAriaLabels: (t) => [t.general.spend_transactions, t.general.income_transactions]
|
|
155
|
+
},
|
|
156
|
+
[i.COST_OF_LIVING]: {
|
|
157
|
+
top: "doubleBar",
|
|
158
|
+
filterStrategy: y,
|
|
159
|
+
scope: "store",
|
|
160
|
+
filterMode: "store",
|
|
161
|
+
colors: (t, e) => [c(t, e), t.palette.chart.chart4 ?? t.palette.primary.main],
|
|
162
|
+
subTabAriaLabels: (t) => [void 0, t.general.income_transactions]
|
|
155
163
|
}
|
|
156
164
|
}, V = {
|
|
157
165
|
top: "singleBar",
|
|
158
166
|
filterStrategy: m,
|
|
159
167
|
scope: "store",
|
|
160
168
|
filterMode: "store",
|
|
161
|
-
colors: (t, e) => [
|
|
169
|
+
colors: (t, e) => [c(t, e)]
|
|
162
170
|
};
|
|
163
171
|
export {
|
|
164
172
|
i as DRILLDOWN_VARIANTS,
|
|
165
173
|
V as FALLBACK,
|
|
166
|
-
|
|
174
|
+
x as layout
|
|
167
175
|
};
|
|
168
176
|
|
|
169
177
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Theme } from '@mui/material/styles'\nimport { endOfMonth, isValid, parseISO, startOfMonth } from 'date-fns'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport {\n type Beat,\n type InsightsFeedCopy,\n type Subtitle,\n type Transaction,\n buildDynamicCopy,\n} from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport type {\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport { MerchantLogo } from '@mxenabled/mxui'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { Icon } from '@mxenabled/mx-icons'\nimport type { ChartDataSeriesItem } from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { getLayoutConfig as getDoubleBarLayoutConfig } from '../../blocks/ChartBlocks/DoubleBarChartBlock/layout'\nimport type { TipSectionProps } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\n\nexport interface DrillDownHeader {\n heading?: string\n subHeadingText?: string\n icon?: ReactNode\n}\n\nexport interface DrillDownHeaderContext {\n title?: string\n subHeader?: Subtitle\n categoryName: string\n selectedDate?: string | Date\n}\n\nexport const DRILLDOWN_VARIANTS = {\n TRANSACTION: 'not_standard_amount',\n CATEGORY_SPEND: 'category_spend',\n MONTHLY_SPEND: 'monthly_spend_comparison',\n ACCOUNT_BALANCE: 'account_balance',\n UPCOMING_BILL: 'upcoming_bill',\n SPEND_TO_INCOME: 'monthly_spend_to_income',\n SAVINGS_TO_INCOME: 'monthly_savings_to_income',\n DEBT_TO_INCOME: 'monthly_debt_to_income',\n COST_OF_LIVING: 'cost_living_to_income',\n NON_ESSENTIAL_CATEGORY: 'non_essential_category_summary',\n DEPOSIT_SUMMARY: 'monthly_deposit_summary',\n LOW_BALANCE: 'low_balance',\n} as const\n\nexport type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS]\n\n/**\n * One row of the flattened data_series a filterStrategy indexes into: a single-bar monthly total or a\n * synthesized upcoming-bill bar. Fields are optional because the backend keys each row dynamically\n * from data_series.names and not every variant carries a guid/category. Double-bar comparison rows\n * will extend this in the next MR.\n */\n\n// Resolves the top-chart palette from the theme (and the beat's category, when relevant).\nexport type ColorKind = (theme: Theme, categoryGuid?: string) => string[]\n\n// Resolves the dynamic drawer header (heading/sub-heading/icon JSX) from the selection context.\nexport type HeaderKind = (ctx: DrillDownHeaderContext) => DrillDownHeader\n\n/**\n * Everything a filterStrategy needs to turn the currently-selected bar/sub-tab into a\n * TransactionFilter. Data-only so strategies stay pure and testable.\n */\nexport interface FilterContext {\n beat: Beat\n beatTransactions: Transaction[]\n dataSeries: ChartDataSeriesItem[]\n // The double-bar drawer's month columns (main / comparison per month, with their guids); empty\n // for every other top kind.\n comparisonBars: DataSet[]\n selectedIndex: number\n subIndex: number\n isLastTab: boolean\n instanceSlotData: InsightsInstanceSlotData\n spendCategoryGuids: string[]\n displayedDateRange: { start: Date; end: Date }\n}\n\n// Resolves the current selection into a TransactionFilter. Carried on each config row so behavior\n// lives next to the variant it belongs to (no separate strategy registry to chase).\nexport type FilterStrategy = (ctx: FilterContext) => TransactionFilter\n\nexport interface DrillDownVariantConfig {\n // `list`: no chart or tabs above the transaction list (an account's transactions for a window).\n top: 'singleBar' | 'upcomingBill' | 'doubleBar' | 'tabsOnly' | 'list'\n filterStrategy: FilterStrategy\n colors: ColorKind\n header?: HeaderKind\n tipSection?: (\n setCloseTipSection: (flag: boolean) => void,\n copy: InsightsFeedCopy,\n merchantName?: string,\n ) => TipSectionProps\n scope: 'store' | 'beat'\n filterMode: 'store' | 'local'\n // Double bar: accessible names for the series tabs ([0] main, [1] comparison), as legacy pulse.\n subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[]\n}\nconst categoryColor = (theme: Theme, categoryGuid?: string): string =>\n (categoryGuid && getCategoryColor(categoryGuid, theme)) || theme.palette.primary.main\n\nconst toLocalDate = (date: string | number | Date | undefined) =>\n typeof date === 'string' ? parseISO(date) : new Date(date ?? NaN)\n\nconst monthRange = (date: string | number | Date | undefined) => ({\n start: startOfMonth(toLocalDate(date)),\n end: endOfMonth(toLocalDate(date)),\n})\n\n// Scopes a filter to the beat's accounts when the beat carries account_guids; otherwise leaves\n// accounts unset so the store default (all accounts) applies.\nconst accountScope = (accountGuids?: string[]): Pick<TransactionFilter, 'accounts'> =>\n accountGuids?.length ? { accounts: accountGuids } : {}\n\n// Low Account Balance — `drilldown_data` names one account and a window (epoch seconds at UTC\n// midnight, to_date exclusive). Fails closed: a drawer that cannot name its rows shows none.\nconst accountWindowStrategy: FilterStrategy = ({ beat }) => {\n const { account_guid, from_date, to_date } = beat.insights_payload?.drilldown_data ?? {}\n if (\n typeof account_guid !== 'string' ||\n typeof from_date !== 'number' ||\n typeof to_date !== 'number' ||\n !Number.isFinite(from_date) ||\n !Number.isFinite(to_date) ||\n to_date <= from_date\n ) {\n return { accounts: [], custom: () => false }\n }\n\n return {\n accounts: [account_guid],\n dateRange: { start: fromUnixUTC(from_date), end: fromUnixUTC(to_date - 1) },\n }\n}\n\n// ── Single-bar filter strategies (this MR) ────────────────────────────────────────────────────\n\n// BillAmountNotStandard / UpcomingBill — the series carries a transaction (TRN) guid; match a single\n// transaction by guid within its month.\nconst transactionGuidStrategy: FilterStrategy = ({\n beatTransactions,\n dataSeries,\n selectedIndex,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const seriesGuid = seriesItem?.guid\n const hasBeenSplit = beatTransactions.find((trn) => trn.guid === seriesGuid)?.has_been_split\n\n return {\n custom: (trn) => trn.guid === seriesGuid,\n dateRange: monthRange(seriesItem?.date),\n showSplits: !hasBeenSplit,\n }\n}\n\n// CategorySpendingV2 — match transactions in the beat's category (or whose top-level category is that\n// guid) within the month.\nconst categoryStrategy: FilterStrategy = ({ dataSeries, selectedIndex, instanceSlotData }) => {\n const seriesItem = dataSeries[selectedIndex]\n const categoryGuid = instanceSlotData.category_guid ?? seriesItem?.guid\n\n return {\n custom: (trn) =>\n trn.category_guid === categoryGuid || trn.top_level_category_guid === categoryGuid,\n dateRange: monthRange(seriesItem?.date),\n }\n}\n\n// MonthlySpendComparisonV2 — no per-bar guid; show all spending-category transactions\n// (income/transfers/investments excluded via spendCategoryGuids) within the month.\nconst spendCategoriesStrategy: FilterStrategy = ({\n dataSeries,\n selectedIndex,\n spendCategoryGuids,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n\n return {\n custom: (trn) =>\n !!trn.top_level_category_guid && spendCategoryGuids.includes(trn.top_level_category_guid),\n dateRange: monthRange(seriesItem?.date),\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// SavingsAccountBalancesSummary — balances, not categorized spend. Filter by month only; the most\n// recent month is capped at the beat's creation time to match the snapshot the balance was computed\n// from.\nconst accountDateStrategy: FilterStrategy = ({\n beat,\n dataSeries,\n selectedIndex,\n isLastTab,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const { start, end } = monthRange(seriesItem?.date)\n\n return {\n dateRange: {\n start,\n end: isLastTab && beat.created_at ? new Date(beat.created_at) : end,\n },\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// ── Double-bar strategies ──────────────────────────────────────────────────────────────────────\n\n// Monthly Spend to Income Comparison — the selected month's main (Spend, sub-tab 0) or comparison\n// (Income, sub-tab 1) transactions: membership in that bar's stored guids (data_series\n// aggregated_guids), within the month. Fails closed: a bar that names no guids for the tab shows none.\nconst comparisonGuidsStrategy: FilterStrategy = ({\n beat,\n comparisonBars,\n selectedIndex,\n subIndex,\n}) => {\n const bar = comparisonBars[selectedIndex]\n const guids = new Set(subIndex === 1 ? bar?.comparisonGuids : bar?.mainGuids)\n // parseISO reads the 'yyyy-MM-dd' bar date as a local calendar day, so the month never shifts with\n // the viewer's time zone; a missing bar, guid list or date fails closed.\n const month = parseISO(bar?.date ?? '')\n if (!guids.size || !isValid(month)) return { accounts: [], custom: () => false }\n\n return {\n custom: (trn) => guids.has(trn.guid),\n dateRange: { start: startOfMonth(month), end: endOfMonth(month) },\n // The V2 payload carries no account_guids (neither instance_slot.data nor insights_payload).\n ...accountScope(beat.account_guids),\n }\n}\n\n// TODO(next MR — tabsOnly): aggregatedGuids / depositSummary strategies for the donut-drawer beats.\n\nexport const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>> = {\n [DRILLDOWN_VARIANTS.TRANSACTION]: {\n top: 'singleBar',\n scope: 'store',\n filterMode: 'store',\n filterStrategy: transactionGuidStrategy,\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n const { title, subHeader } = ctx\n return {\n heading: title,\n subHeadingText: subHeader?.text || undefined,\n icon: (\n <MerchantLogo\n alt={subHeader?.text}\n categoryGuid={subHeader?.logo?.category_guid || ''}\n merchantGuid={subHeader?.logo?.merchant_guid || ''}\n size={16}\n />\n ),\n }\n },\n tipSection: (setCloseTipSection, copy, merchantName = '') => {\n return {\n message: buildDynamicCopy(\n copy.general.tip_section_message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{merchantName}</strong>,\n ),\n onDismiss: () => setCloseTipSection(true),\n } as TipSectionProps\n },\n },\n [DRILLDOWN_VARIANTS.CATEGORY_SPEND]: {\n top: 'singleBar',\n filterStrategy: categoryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n return {\n heading: ctx.categoryName,\n subHeadingText: ctx.selectedDate\n ? formatDate(toLocalDate(ctx.selectedDate), DATE_FORMATS_INTL.MONTH_LONG) || ''\n : '',\n icon: <Icon name=\"calendar_month\" size={16} />,\n }\n },\n },\n [DRILLDOWN_VARIANTS.MONTHLY_SPEND]: {\n top: 'singleBar',\n filterStrategy: spendCategoriesStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.chart.chart2 ?? theme.palette.primary.main],\n },\n [DRILLDOWN_VARIANTS.ACCOUNT_BALANCE]: {\n top: 'singleBar',\n filterStrategy: accountDateStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n },\n [DRILLDOWN_VARIANTS.UPCOMING_BILL]: {\n top: 'upcomingBill',\n filterStrategy: transactionGuidStrategy,\n scope: 'beat',\n filterMode: 'local',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n },\n\n // Low Account Balance's \"Transactions\" link: the account's transactions for the alert's window.\n [DRILLDOWN_VARIANTS.LOW_BALANCE]: {\n top: 'list',\n filterStrategy: accountWindowStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n\n // ── Double-bar comparison beats (month tabs + main / comparison sub-tabs) ────────────────────\n // Monthly Spend to Income Comparison: Spend vs Income per month, in the card block's palette.\n [DRILLDOWN_VARIANTS.SPEND_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'spend_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [copy.general.spend_transactions, copy.general.income_transactions],\n },\n // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n // [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: comparison('debtVsIncome'),\n // [DRILLDOWN_VARIANTS.COST_OF_LIVING]: comparison('costOfLiving'),\n //\n // ── NEXT MR: tabsOnly donut-drawer beats (no top chart) ───────────────────────────────────\n // [DRILLDOWN_VARIANTS.NON_ESSENTIAL_CATEGORY]: { top: 'tabsOnly', ... },\n // [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY]: { top: 'tabsOnly', ... },\n}\n\n// Fallback for a missing/typo'd backend variant: a single-bar, store-scoped drawer filtered by the\n// beat's transaction guid and colored by category, so the drawer still renders instead of crashing.\nexport const FALLBACK: DrillDownVariantConfig = {\n top: 'singleBar',\n filterStrategy: transactionGuidStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid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B,eAAA,GAAkB;AAAA,IACpC,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,MAAiB,EAAyB,GAAO,iBAAiB,GAAG,SAAS,CAAC;AAAA,IACxF,kBAAA,CAAmB,MAAS,CAAC,EAAK,QAAQ,oBAAoB,EAAK,QAAQ,mBAAmB;AAAA,EAChG;AASF,GAIa,IAAmC;AAAA,EAC9C,KAAK;AAAA,EACL,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAA,CAAS,GAAc,MAA0B,CAAC,EAAc,GAAO,CAAY,CAAC;AACtF"}
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/layout.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\nimport type { Theme } from '@mui/material/styles'\nimport { endOfMonth, isValid, parseISO, startOfMonth } from 'date-fns'\nimport { getCategoryColor } from '../../../core/utils/CategoryUtil'\nimport {\n type Beat,\n type InsightsFeedCopy,\n type Subtitle,\n type Transaction,\n buildDynamicCopy,\n} from '../../../core'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport type {\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport { MerchantLogo } from '@mxenabled/mxui'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport { Icon } from '@mxenabled/mx-icons'\nimport type { ChartDataSeriesItem } from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { getLayoutConfig as getDoubleBarLayoutConfig } from '../../blocks/ChartBlocks/DoubleBarChartBlock/layout'\nimport type { TipSectionProps } from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\n\nexport interface DrillDownHeader {\n heading?: string\n subHeadingText?: string\n icon?: ReactNode\n}\n\nexport interface DrillDownHeaderContext {\n title?: string\n subHeader?: Subtitle\n categoryName: string\n selectedDate?: string | Date\n}\n\nexport const DRILLDOWN_VARIANTS = {\n TRANSACTION: 'not_standard_amount',\n CATEGORY_SPEND: 'category_spend',\n MONTHLY_SPEND: 'monthly_spend_comparison',\n ACCOUNT_BALANCE: 'account_balance',\n UPCOMING_BILL: 'upcoming_bill',\n SPEND_TO_INCOME: 'monthly_spend_to_income',\n SAVINGS_TO_INCOME: 'monthly_savings_to_income',\n DEBT_TO_INCOME: 'monthly_debt_to_income',\n COST_OF_LIVING: 'cost_living_to_income',\n NON_ESSENTIAL_CATEGORY: 'non_essential_category_summary',\n DEPOSIT_SUMMARY: 'monthly_deposit_summary',\n LOW_BALANCE: 'low_balance',\n} as const\n\nexport type DrillDownVariant = (typeof DRILLDOWN_VARIANTS)[keyof typeof DRILLDOWN_VARIANTS]\n\n/**\n * One row of the flattened data_series a filterStrategy indexes into: a single-bar monthly total or a\n * synthesized upcoming-bill bar. Fields are optional because the backend keys each row dynamically\n * from data_series.names and not every variant carries a guid/category. Double-bar comparison rows\n * will extend this in the next MR.\n */\n\n// Resolves the top-chart palette from the theme (and the beat's category, when relevant).\nexport type ColorKind = (theme: Theme, categoryGuid?: string) => string[]\n\n// Resolves the dynamic drawer header (heading/sub-heading/icon JSX) from the selection context.\nexport type HeaderKind = (ctx: DrillDownHeaderContext) => DrillDownHeader\n\n/**\n * Everything a filterStrategy needs to turn the currently-selected bar/sub-tab into a\n * TransactionFilter. Data-only so strategies stay pure and testable.\n */\nexport interface FilterContext {\n beat: Beat\n beatTransactions: Transaction[]\n dataSeries: ChartDataSeriesItem[]\n // The double-bar drawer's month columns (main / comparison per month, with their guids); empty\n // for every other top kind.\n comparisonBars: DataSet[]\n selectedIndex: number\n subIndex: number\n isLastTab: boolean\n instanceSlotData: InsightsInstanceSlotData\n spendCategoryGuids: string[]\n displayedDateRange: { start: Date; end: Date }\n}\n\n// Resolves the current selection into a TransactionFilter. Carried on each config row so behavior\n// lives next to the variant it belongs to (no separate strategy registry to chase).\nexport type FilterStrategy = (ctx: FilterContext) => TransactionFilter\n\nexport interface DrillDownVariantConfig {\n // `list`: no chart or tabs above the transaction list (an account's transactions for a window).\n top: 'singleBar' | 'upcomingBill' | 'doubleBar' | 'tabsOnly' | 'list'\n filterStrategy: FilterStrategy\n colors: ColorKind\n header?: HeaderKind\n tipSection?: (\n setCloseTipSection: (flag: boolean) => void,\n copy: InsightsFeedCopy,\n merchantName?: string,\n ) => TipSectionProps\n scope: 'store' | 'beat'\n filterMode: 'store' | 'local'\n // Double bar: accessible names for the series tabs ([0] main, [1] comparison), as legacy pulse.\n subTabAriaLabels?: (copy: InsightsFeedCopy) => (string | undefined)[]\n}\nconst categoryColor = (theme: Theme, categoryGuid?: string): string =>\n (categoryGuid && getCategoryColor(categoryGuid, theme)) || theme.palette.primary.main\n\nconst toLocalDate = (date: string | number | Date | undefined) =>\n typeof date === 'string' ? parseISO(date) : new Date(date ?? NaN)\n\nconst monthRange = (date: string | number | Date | undefined) => ({\n start: startOfMonth(toLocalDate(date)),\n end: endOfMonth(toLocalDate(date)),\n})\n\n// Scopes a filter to the beat's accounts when the beat carries account_guids; otherwise leaves\n// accounts unset so the store default (all accounts) applies.\nconst accountScope = (accountGuids?: string[]): Pick<TransactionFilter, 'accounts'> =>\n accountGuids?.length ? { accounts: accountGuids } : {}\n\n// Low Account Balance — `drilldown_data` names one account and a window (epoch seconds at UTC\n// midnight, to_date exclusive). Fails closed: a drawer that cannot name its rows shows none.\nconst accountWindowStrategy: FilterStrategy = ({ beat }) => {\n const { account_guid, from_date, to_date } = beat.insights_payload?.drilldown_data ?? {}\n if (\n typeof account_guid !== 'string' ||\n typeof from_date !== 'number' ||\n typeof to_date !== 'number' ||\n !Number.isFinite(from_date) ||\n !Number.isFinite(to_date) ||\n to_date <= from_date\n ) {\n return { accounts: [], custom: () => false }\n }\n\n return {\n accounts: [account_guid],\n dateRange: { start: fromUnixUTC(from_date), end: fromUnixUTC(to_date - 1) },\n }\n}\n\n// ── Single-bar filter strategies (this MR) ────────────────────────────────────────────────────\n\n// BillAmountNotStandard / UpcomingBill — the series carries a transaction (TRN) guid; match a single\n// transaction by guid within its month.\nconst transactionGuidStrategy: FilterStrategy = ({\n beatTransactions,\n dataSeries,\n selectedIndex,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const seriesGuid = seriesItem?.guid\n const hasBeenSplit = beatTransactions.find((trn) => trn.guid === seriesGuid)?.has_been_split\n\n return {\n custom: (trn) => trn.guid === seriesGuid,\n dateRange: monthRange(seriesItem?.date),\n showSplits: !hasBeenSplit,\n }\n}\n\n// CategorySpendingV2 — match transactions in the beat's category (or whose top-level category is that\n// guid) within the month.\nconst categoryStrategy: FilterStrategy = ({ dataSeries, selectedIndex, instanceSlotData }) => {\n const seriesItem = dataSeries[selectedIndex]\n const categoryGuid = instanceSlotData.category_guid ?? seriesItem?.guid\n\n return {\n custom: (trn) =>\n trn.category_guid === categoryGuid || trn.top_level_category_guid === categoryGuid,\n dateRange: monthRange(seriesItem?.date),\n }\n}\n\n// MonthlySpendComparisonV2 — no per-bar guid; show all spending-category transactions\n// (income/transfers/investments excluded via spendCategoryGuids) within the month.\nconst spendCategoriesStrategy: FilterStrategy = ({\n dataSeries,\n selectedIndex,\n spendCategoryGuids,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n\n return {\n custom: (trn) =>\n !!trn.top_level_category_guid && spendCategoryGuids.includes(trn.top_level_category_guid),\n dateRange: monthRange(seriesItem?.date),\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// SavingsAccountBalancesSummary — balances, not categorized spend. Filter by month only; the most\n// recent month is capped at the beat's creation time to match the snapshot the balance was computed\n// from.\nconst accountDateStrategy: FilterStrategy = ({\n beat,\n dataSeries,\n selectedIndex,\n isLastTab,\n instanceSlotData,\n}) => {\n const seriesItem = dataSeries[selectedIndex]\n const { start, end } = monthRange(seriesItem?.date)\n\n return {\n dateRange: {\n start,\n end: isLastTab && beat.created_at ? new Date(beat.created_at) : end,\n },\n ...accountScope(instanceSlotData.account_guids),\n }\n}\n\n// ── Double-bar strategies ──────────────────────────────────────────────────────────────────────\n\n// Monthly Spend to Income Comparison — the selected month's main (Spend, sub-tab 0) or comparison\n// (Income, sub-tab 1) transactions: membership in that bar's stored guids (data_series\n// aggregated_guids), within the month. Fails closed: a bar that names no guids for the tab shows none.\nconst comparisonGuidsStrategy: FilterStrategy = ({\n beat,\n comparisonBars,\n selectedIndex,\n subIndex,\n}) => {\n const bar = comparisonBars[selectedIndex]\n const guids = new Set(subIndex === 1 ? bar?.comparisonGuids : bar?.mainGuids)\n // parseISO reads the 'yyyy-MM-dd' bar date as a local calendar day, so the month never shifts with\n // the viewer's time zone; a missing bar, guid list or date fails closed.\n const month = parseISO(bar?.date ?? '')\n if (!guids.size || !isValid(month)) return { accounts: [], custom: () => false }\n\n return {\n custom: (trn) => guids.has(trn.guid),\n dateRange: { start: startOfMonth(month), end: endOfMonth(month) },\n // The V2 payload carries no account_guids (neither instance_slot.data nor insights_payload).\n ...accountScope(beat.account_guids),\n }\n}\n\n// TODO(next MR — tabsOnly): aggregatedGuids / depositSummary strategies for the donut-drawer beats.\n\nexport const layout: Partial<Record<DrillDownVariant, DrillDownVariantConfig>> = {\n [DRILLDOWN_VARIANTS.TRANSACTION]: {\n top: 'singleBar',\n scope: 'store',\n filterMode: 'store',\n filterStrategy: transactionGuidStrategy,\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n const { title, subHeader } = ctx\n return {\n heading: title,\n subHeadingText: subHeader?.text || undefined,\n icon: (\n <MerchantLogo\n alt={subHeader?.text}\n categoryGuid={subHeader?.logo?.category_guid || ''}\n merchantGuid={subHeader?.logo?.merchant_guid || ''}\n size={16}\n />\n ),\n }\n },\n tipSection: (setCloseTipSection, copy, merchantName = '') => {\n return {\n message: buildDynamicCopy(\n copy.general.tip_section_message,\n <strong>{copy.general.tip_section_title}</strong>,\n <strong>{merchantName}</strong>,\n ),\n onDismiss: () => setCloseTipSection(true),\n } as TipSectionProps\n },\n },\n [DRILLDOWN_VARIANTS.CATEGORY_SPEND]: {\n top: 'singleBar',\n filterStrategy: categoryStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n header: (ctx: DrillDownHeaderContext) => {\n return {\n heading: ctx.categoryName,\n subHeadingText: ctx.selectedDate\n ? formatDate(toLocalDate(ctx.selectedDate), DATE_FORMATS_INTL.MONTH_LONG) || ''\n : '',\n icon: <Icon name=\"calendar_month\" size={16} />,\n }\n },\n },\n [DRILLDOWN_VARIANTS.MONTHLY_SPEND]: {\n top: 'singleBar',\n filterStrategy: spendCategoriesStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.chart.chart2 ?? theme.palette.primary.main],\n },\n [DRILLDOWN_VARIANTS.ACCOUNT_BALANCE]: {\n top: 'singleBar',\n filterStrategy: accountDateStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.success.main],\n },\n [DRILLDOWN_VARIANTS.UPCOMING_BILL]: {\n top: 'upcomingBill',\n filterStrategy: transactionGuidStrategy,\n scope: 'beat',\n filterMode: 'local',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n },\n\n // Low Account Balance's \"Transactions\" link: the account's transactions for the alert's window.\n [DRILLDOWN_VARIANTS.LOW_BALANCE]: {\n top: 'list',\n filterStrategy: accountWindowStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => [theme.palette.primary.main],\n },\n\n // ── Double-bar comparison beats (month tabs + main / comparison sub-tabs) ────────────────────\n // Monthly Spend to Income Comparison: Spend vs Income per month, in the card block's palette.\n [DRILLDOWN_VARIANTS.SPEND_TO_INCOME]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme) => getDoubleBarLayoutConfig(theme, 'spend_to_income')?.color ?? [],\n subTabAriaLabels: (copy) => [copy.general.spend_transactions, copy.general.income_transactions],\n },\n // Cost of Living to Income: one living-cost category (Housing, Groceries, ...) vs Income per month.\n // The cost bar takes the beat category's colour and Income the legacy chart4, as the pulse drawer.\n [DRILLDOWN_VARIANTS.COST_OF_LIVING]: {\n top: 'doubleBar',\n filterStrategy: comparisonGuidsStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [\n categoryColor(theme, categoryGuid),\n theme.palette.chart.chart4 ?? theme.palette.primary.main,\n ],\n subTabAriaLabels: (copy) => [undefined, copy.general.income_transactions],\n },\n // NEXT MR — the other double-bar beats reuse comparisonGuidsStrategy with their own palettes:\n // [DRILLDOWN_VARIANTS.SAVINGS_TO_INCOME]: comparison('savingsVsIncome'),\n // [DRILLDOWN_VARIANTS.DEBT_TO_INCOME]: comparison('debtVsIncome'),\n //\n // ── NEXT MR: tabsOnly donut-drawer beats (no top chart) ───────────────────────────────────\n // [DRILLDOWN_VARIANTS.NON_ESSENTIAL_CATEGORY]: { top: 'tabsOnly', ... },\n // [DRILLDOWN_VARIANTS.DEPOSIT_SUMMARY]: { top: 'tabsOnly', ... },\n}\n\n// Fallback for a missing/typo'd backend variant: a single-bar, store-scoped drawer filtered by the\n// beat's transaction guid and colored by category, so the drawer still renders instead of crashing.\nexport const FALLBACK: DrillDownVariantConfig = {\n top: 'singleBar',\n filterStrategy: transactionGuidStrategy,\n scope: 'store',\n filterMode: 'store',\n colors: (theme: Theme, categoryGuid?: string) => [categoryColor(theme, categoryGuid)],\n}\n"],"mappings":";;;;;;;;;AAqCA,IAAa,IAAqB;AAAA,EAChC,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,mBAAmB;AAAA,EACnB,gBAAgB;AAAA,EAChB,gBAAgB;A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AChG;AAAA,EAGC,CAAA,EAAmB,cAAA,GAAiB;AAAA,IACnC,KAAK;AAAA,IACL,gBAAgB;AAAA,IAChB,OAAO;AAAA,IACP,YAAY;AAAA,IACZ,QAAA,CAAS,GAAc,MAA0B,CAC/C,EAAc,GAAO,CAAY,GACjC,EAAM,QAAQ,MAAM,UAAU,EAAM,QAAQ,QAAQ,IACtD;AAAA,IACA,kBAAA,CAAmB,MAAS,CAAC,QAAW,EAAK,QAAQ,mBAAmB;AAAA,EAC1E;AAQF,GAIa,IAAmC;AAAA,EAC9C,KAAK;AAAA,EACL,gBAAgB;AAAA,EAChB,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,QAAA,CAAS,GAAc,MAA0B,CAAC,EAAc,GAAO,CAAY,CAAC;AACtF"}
|
|
@@ -1,218 +1,245 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
3
|
-
import { useAppConfig as
|
|
4
|
-
import { TransactionType as
|
|
5
|
-
import { fromUnixUTC as
|
|
6
|
-
import { formatCurrency as
|
|
7
|
-
import { ANALYTICS_EVENTS as
|
|
8
|
-
import { isFeatureEnabled as
|
|
9
|
-
import { isTransferTransaction as
|
|
10
|
-
import
|
|
11
|
-
import { BottomActions as m, DEFAULT_BOTTOM_ACTIONS as
|
|
12
|
-
import { resolveInsightRender as
|
|
13
|
-
import { isContactSupportCtaDisabled as
|
|
14
|
-
import { actionBlocksKey as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import { EmbeddedCard as
|
|
19
|
-
import { AddMerchantBudgetAction as
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
import
|
|
31
|
-
import { getEmbeddedInstanceSlotByBeatTemplates as
|
|
32
|
-
import
|
|
33
|
-
import { observer as
|
|
34
|
-
import
|
|
35
|
-
import { MerchantLogo as
|
|
36
|
-
import { endOfMonth as
|
|
37
|
-
import { isBefore as
|
|
38
|
-
import { startOfMonth as
|
|
39
|
-
import
|
|
40
|
-
import { jsx as t, jsxs as
|
|
41
|
-
import { useTheme as
|
|
42
|
-
import
|
|
43
|
-
import
|
|
44
|
-
import
|
|
45
|
-
import
|
|
46
|
-
import
|
|
47
|
-
var
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
1
|
+
import { buildDynamicCopy as V } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as pe, formatDate as ge } from "../../../core/constants/DateFormats.es.js";
|
|
3
|
+
import { useAppConfig as fe, useCategoryStore as he, useEvent as _e, useGlobalCopyStore as Te, useGlobalUiStore as ye, useTransactionStore as Se, useUserStore as be } from "../../../common/context/hooks.es.js";
|
|
4
|
+
import { TransactionType as Ce } from "../../../core/types/Transaction.es.js";
|
|
5
|
+
import { fromUnixUTC as De } from "../../../core/utils/DateUtil.es.js";
|
|
6
|
+
import { formatCurrency as W } from "../../../core/utils/NumberFormatting.es.js";
|
|
7
|
+
import { ANALYTICS_EVENTS as ve } from "../../../common/constants/Analytics.es.js";
|
|
8
|
+
import { isFeatureEnabled as Ae } from "../../../core/utils/UserUtils.es.js";
|
|
9
|
+
import { isTransferTransaction as xe } from "../../../core/utils/TransactionUtils.es.js";
|
|
10
|
+
import Ie from "../../../common/components/Loader.es.js";
|
|
11
|
+
import { BottomActions as m, DEFAULT_BOTTOM_ACTIONS as Le, DEFAULT_TOP_ACTIONS as we, TopActions as h } from "../../constants/Actions.es.js";
|
|
12
|
+
import { resolveInsightRender as Ee } from "../../../insights-v2/resolveInsightRender.es.js";
|
|
13
|
+
import { isContactSupportCtaDisabled as Oe } from "../../../insights-v2/actionBlocks/ContactSupportActionBlock.es.js";
|
|
14
|
+
import { actionBlocksKey as Me } from "../../../insights-v2/mappings/actionBlocksKey.es.js";
|
|
15
|
+
import Ne from "../../../insights-v2/components/InsightErrorCard.es.js";
|
|
16
|
+
import Be from "../../../insights-v2/components/CompactInsightCard.es.js";
|
|
17
|
+
import ke from "../../../insights/components/shared/ChartTransactionWithDrillDown.es.js";
|
|
18
|
+
import { EmbeddedCard as Fe } from "../../../insights/components/shared/InsightsCard/EmbeddedCard.es.js";
|
|
19
|
+
import { AddMerchantBudgetAction as Re } from "./transactiondetails/actions/AddMerchantBudgetAction.es.js";
|
|
20
|
+
import Ge from "./transactiondetails/actions/CategoryAction.es.js";
|
|
21
|
+
import Pe from "./transactiondetails/actions/DateAction.es.js";
|
|
22
|
+
import Ue from "./transactiondetails/actions/DeleteAction.es.js";
|
|
23
|
+
import Ve from "./transactiondetails/actions/DeleteLogoAction.es.js";
|
|
24
|
+
import We from "./transactiondetails/actions/ExcludeAction.es.js";
|
|
25
|
+
import He from "./transactiondetails/actions/MemoAction.es.js";
|
|
26
|
+
import je from "./transactiondetails/actions/SplitAction.es.js";
|
|
27
|
+
import ze from "./transactiondetails/actions/TagsAction.es.js";
|
|
28
|
+
import Xe from "./transactiondetails/Description.es.js";
|
|
29
|
+
import qe from "./transactiondetails/FlagTransaction.es.js";
|
|
30
|
+
import Ke from "./transactiondetails/TransactionDetailsView.es.js";
|
|
31
|
+
import { getEmbeddedInstanceSlotByBeatTemplates as Ye } from "./getEmbeddedInstanceSlotByBeatTemplates.es.js";
|
|
32
|
+
import s, { useMemo as H } from "react";
|
|
33
|
+
import { observer as $e } from "mobx-react-lite";
|
|
34
|
+
import c from "@mui/material/Stack";
|
|
35
|
+
import { MerchantLogo as j, P as Ze, Text as _ } from "@mxenabled/mxui";
|
|
36
|
+
import { endOfMonth as Je } from "date-fns/endOfMonth";
|
|
37
|
+
import { isBefore as Qe } from "date-fns/isBefore";
|
|
38
|
+
import { startOfMonth as z } from "date-fns/startOfMonth";
|
|
39
|
+
import X from "@mui/material/Paper";
|
|
40
|
+
import { jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
41
|
+
import { useTheme as et } from "@mui/material/styles";
|
|
42
|
+
import q from "@mui/material/Box";
|
|
43
|
+
import K from "@mui/material/Divider";
|
|
44
|
+
import Y from "@mui/material/List";
|
|
45
|
+
import tt from "@mui/material/Alert";
|
|
46
|
+
import rt from "@mui/material/Snackbar";
|
|
47
|
+
var v = 64, ot = 8, $ = {
|
|
48
|
+
fontWeight: 700,
|
|
49
|
+
letterSpacing: "0.27px",
|
|
50
|
+
textTransform: "uppercase"
|
|
51
|
+
}, it = ({ bottomActions: T = Le, canFlagTransaction: Z = !0, topActions: A = we, transaction: e, shouldShowEmbeddedCard: x = !0, onContactSupport: I }) => {
|
|
52
|
+
const { onEvent: J } = _e(), { config: Q } = fe(), { isCopyLoaded: ee } = ye(), { userFeatures: te } = be(), { accounts: re, common: oe, insights_feed: d } = Te(), { detailedCategories: L } = he(), { alert: w, associatedBeats: E, detailedTransactions: O, cachedStartDate: M, loadEmbeddedInstanceTransactions: ie, setAlert: N } = Se(), [ae, B] = s.useState(!1), [k, F] = s.useState(!1), [ne, se] = s.useState(!1), de = et(), le = e?.number && e.number.length > 4, R = e?.number ? le ? e.number : `••••${e.number}` : void 0, G = e?.transaction_type === Ce.CREDIT, P = xe(e) && !!e.institutionName, a = s.useMemo(() => E.find((r) => r.associated_transaction_guid === e.guid), [E, e]), y = x ? Ee(a) : "legacy", S = y === "v2" ? a?.insights_payload : void 0, o = x && y === "legacy" ? Ye(oe, a) : null, me = (r) => {
|
|
53
|
+
r.block === Me.CONTACT_SUPPORT_ACTION_BLOCK && I?.();
|
|
54
|
+
}, [l, b] = s.useState(o ? o.dataSeries.length - 1 : 0);
|
|
55
|
+
s.useEffect(() => J(ve.TRANSACTION_DETAILS_VIEW, { transaction_guid: e.guid }), []), s.useEffect(() => {
|
|
56
|
+
if (!o || o.dataSeries.length === 0) return;
|
|
57
|
+
const { date: r } = o.dataSeries[l], i = z(r);
|
|
58
|
+
Qe(i, M) && (F(!0), ie(i).finally(() => {
|
|
55
59
|
F(!1);
|
|
56
60
|
}));
|
|
57
61
|
}, [
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
l,
|
|
63
|
+
o,
|
|
64
|
+
M
|
|
61
65
|
]);
|
|
62
|
-
const
|
|
63
|
-
if (
|
|
64
|
-
const
|
|
65
|
-
let
|
|
66
|
-
return
|
|
67
|
-
category:
|
|
68
|
-
percentageAmount: i === 0 ? 0 : Math.round(Math.abs(
|
|
69
|
-
changetype:
|
|
66
|
+
const C = T.includes(m.MerchantBudget) && !e?.merchant_guid ? T.filter((r) => r !== m.MerchantBudget) : T, D = H(() => {
|
|
67
|
+
if (o) {
|
|
68
|
+
const r = L.find((f) => f.guid === e.top_level_category_guid), i = a?.payload?.average_amount ?? 0, p = e.amount;
|
|
69
|
+
let g = d.general.increased_text;
|
|
70
|
+
return p - i < 0 && (g = d.general.decreased_text), {
|
|
71
|
+
category: r,
|
|
72
|
+
percentageAmount: i === 0 ? 0 : Math.round(Math.abs(p - i) / i * 100),
|
|
73
|
+
changetype: g
|
|
70
74
|
};
|
|
71
75
|
}
|
|
72
76
|
return null;
|
|
73
|
-
}, [
|
|
74
|
-
if (!
|
|
75
|
-
const { guid:
|
|
76
|
-
return
|
|
77
|
-
const
|
|
78
|
-
return
|
|
77
|
+
}, [o, L]), ce = H(() => {
|
|
78
|
+
if (!o?.dataSeries?.length) return [];
|
|
79
|
+
const { guid: r, date: i } = o.dataSeries[l], p = z(i), g = Je(i);
|
|
80
|
+
return O.filter((f) => {
|
|
81
|
+
const U = De(f.date);
|
|
82
|
+
return U >= p && U <= g && f.guid === r;
|
|
79
83
|
});
|
|
80
84
|
}, [
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
85
|
+
l,
|
|
86
|
+
o,
|
|
87
|
+
O,
|
|
84
88
|
k
|
|
85
89
|
]);
|
|
86
|
-
if (
|
|
87
|
-
const
|
|
88
|
-
return /* @__PURE__ */
|
|
90
|
+
if (!ee) return /* @__PURE__ */ t(Ie, {});
|
|
91
|
+
const u = Ae(te, "MX_TXN_DETAILS_VIEW_ONLY"), ue = de.palette.mode === "dark" ? "grey.800" : "grey.100";
|
|
92
|
+
return /* @__PURE__ */ n(q, {
|
|
89
93
|
className: "mx-txn-transaction-details",
|
|
90
94
|
width: "100%",
|
|
91
95
|
children: [
|
|
92
|
-
e && /* @__PURE__ */
|
|
93
|
-
/* @__PURE__ */
|
|
96
|
+
e && /* @__PURE__ */ n(c, { children: [
|
|
97
|
+
/* @__PURE__ */ n(c, {
|
|
94
98
|
gap: 12,
|
|
95
99
|
p: 24,
|
|
96
100
|
children: [
|
|
97
|
-
/* @__PURE__ */ t(
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
+
/* @__PURE__ */ t(q, {
|
|
102
|
+
sx: {
|
|
103
|
+
bgcolor: "background.paper",
|
|
104
|
+
borderRadius: `${ot}px`,
|
|
105
|
+
height: v,
|
|
106
|
+
overflow: "hidden",
|
|
107
|
+
width: v
|
|
108
|
+
},
|
|
109
|
+
children: /* @__PURE__ */ t(j, {
|
|
101
110
|
categoryGuid: e.top_level_category_guid || "",
|
|
102
111
|
merchantGuid: e.merchant_guid || "",
|
|
103
|
-
size:
|
|
112
|
+
size: v
|
|
104
113
|
})
|
|
105
114
|
}),
|
|
106
|
-
/* @__PURE__ */ t(
|
|
107
|
-
displayValue:
|
|
115
|
+
/* @__PURE__ */ t(Xe, {
|
|
116
|
+
displayValue: P ? e.institutionName : void 0,
|
|
108
117
|
transaction: e,
|
|
109
|
-
viewOnly:
|
|
118
|
+
viewOnly: u || P
|
|
110
119
|
}),
|
|
111
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ n(c, {
|
|
112
121
|
direction: "row",
|
|
113
122
|
justifyContent: "space-between",
|
|
114
123
|
sx: { minHeight: 44 },
|
|
115
|
-
children: [/* @__PURE__ */
|
|
116
|
-
color:
|
|
124
|
+
children: [/* @__PURE__ */ n(Ze, {
|
|
125
|
+
color: G ? "success.main" : "text.primary",
|
|
117
126
|
variant: "h1",
|
|
118
|
-
children: [
|
|
119
|
-
}), !
|
|
127
|
+
children: [G ? "+" : "", W(e.amount, "0,0.00")]
|
|
128
|
+
}), !u && Z && /* @__PURE__ */ t(qe, { transaction: e })]
|
|
120
129
|
}),
|
|
121
|
-
|
|
130
|
+
S && /* @__PURE__ */ t(Be, {
|
|
122
131
|
beat: a,
|
|
123
|
-
isCtaDisabled:
|
|
124
|
-
onCtaClick:
|
|
125
|
-
payload:
|
|
132
|
+
isCtaDisabled: Oe(S.primary_cta?.block, Q, I),
|
|
133
|
+
onCtaClick: me,
|
|
134
|
+
payload: S
|
|
126
135
|
}),
|
|
127
|
-
|
|
136
|
+
y === "error" && a && /* @__PURE__ */ t(Ne, {
|
|
128
137
|
beat: a,
|
|
129
138
|
variant: "plain"
|
|
130
139
|
}),
|
|
131
|
-
|
|
132
|
-
callToAction:
|
|
133
|
-
description:
|
|
134
|
-
instanceSlot:
|
|
140
|
+
o?.instanceSlot && /* @__PURE__ */ t(Fe, {
|
|
141
|
+
callToAction: o.callToAction,
|
|
142
|
+
description: V(d.general.embedded_description, D.changetype, /* @__PURE__ */ t("strong", { children: D.percentageAmount })),
|
|
143
|
+
instanceSlot: o.instanceSlot,
|
|
135
144
|
onCtaClick: () => {
|
|
136
|
-
|
|
145
|
+
B(!0);
|
|
137
146
|
},
|
|
138
147
|
title: a.html_micro_title
|
|
139
148
|
}),
|
|
140
|
-
/* @__PURE__ */
|
|
149
|
+
/* @__PURE__ */ n(c, {
|
|
141
150
|
sx: {
|
|
142
|
-
bgcolor:
|
|
151
|
+
bgcolor: ue,
|
|
143
152
|
borderRadius: "4px",
|
|
144
153
|
gap: 4,
|
|
145
154
|
p: 8
|
|
146
155
|
},
|
|
147
|
-
children: [/* @__PURE__ */ t(
|
|
156
|
+
children: [/* @__PURE__ */ t(_, {
|
|
148
157
|
bold: !0,
|
|
149
|
-
children:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
158
|
+
children: e.account
|
|
159
|
+
}), /* @__PURE__ */ n(c, {
|
|
160
|
+
alignItems: "baseline",
|
|
161
|
+
"data-testid": "account-feed-line",
|
|
162
|
+
direction: "row",
|
|
163
|
+
gap: 4,
|
|
164
|
+
sx: { overflow: "hidden" },
|
|
165
|
+
children: [/* @__PURE__ */ t(_, {
|
|
166
|
+
color: "text.secondary",
|
|
167
|
+
sx: {
|
|
168
|
+
...$,
|
|
169
|
+
minWidth: 0
|
|
170
|
+
},
|
|
171
|
+
truncate: !0,
|
|
172
|
+
variant: "tiny",
|
|
173
|
+
children: e.feed_description
|
|
174
|
+
}), R && /* @__PURE__ */ t(_, {
|
|
175
|
+
color: "text.secondary",
|
|
176
|
+
sx: {
|
|
177
|
+
...$,
|
|
178
|
+
flexShrink: 0
|
|
179
|
+
},
|
|
180
|
+
variant: "tiny",
|
|
181
|
+
children: R
|
|
182
|
+
})]
|
|
156
183
|
})]
|
|
157
184
|
})
|
|
158
185
|
]
|
|
159
186
|
}),
|
|
160
|
-
/* @__PURE__ */ t(
|
|
187
|
+
/* @__PURE__ */ t(X, {
|
|
161
188
|
square: !0,
|
|
162
189
|
sx: { boxShadow: "none" },
|
|
163
|
-
children:
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
/* @__PURE__ */ t(
|
|
190
|
+
children: u ? /* @__PURE__ */ t(Ke, { transaction: e }) : /* @__PURE__ */ t(Y, { children: A.map((r, i) => /* @__PURE__ */ n(s.Fragment, { children: [
|
|
191
|
+
r === h.Category && /* @__PURE__ */ t(Ge, { transaction: e }),
|
|
192
|
+
r === h.Date && /* @__PURE__ */ t(Pe, { transaction: e }),
|
|
193
|
+
r === h.Memo && /* @__PURE__ */ t(He, { transaction: e }),
|
|
194
|
+
r === h.Tags && /* @__PURE__ */ t(ze, { transaction: e }),
|
|
195
|
+
/* @__PURE__ */ t(K, {
|
|
169
196
|
component: "li",
|
|
170
|
-
variant: i <
|
|
197
|
+
variant: i < A.length - 1 ? "inset" : "fullWidth"
|
|
171
198
|
})
|
|
172
|
-
] },
|
|
199
|
+
] }, r)) })
|
|
173
200
|
}),
|
|
174
|
-
!
|
|
201
|
+
!u && C.length > 0 && /* @__PURE__ */ n(s.Fragment, { children: [/* @__PURE__ */ t(_, {
|
|
175
202
|
bold: !0,
|
|
176
203
|
mb: 8,
|
|
177
204
|
ml: 26,
|
|
178
205
|
mt: 16,
|
|
179
206
|
variant: "body1",
|
|
180
|
-
children:
|
|
181
|
-
}), /* @__PURE__ */ t(
|
|
207
|
+
children: re.actions
|
|
208
|
+
}), /* @__PURE__ */ t(X, {
|
|
182
209
|
square: !0,
|
|
183
210
|
sx: { boxShadow: "none" },
|
|
184
|
-
children: /* @__PURE__ */
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
/* @__PURE__ */ t(
|
|
211
|
+
children: /* @__PURE__ */ n(Y, { children: [C.map((r, i) => /* @__PURE__ */ n(s.Fragment, { children: [
|
|
212
|
+
r === m.MerchantBudget && /* @__PURE__ */ t(Re, { transaction: e }),
|
|
213
|
+
r === m.SplitTransaction && /* @__PURE__ */ t(je, { transaction: e }),
|
|
214
|
+
r === m.HideTransaction && /* @__PURE__ */ t(We, { transaction: e }),
|
|
215
|
+
r === m.MerchantLogo && /* @__PURE__ */ t(Ve, { transaction: e }),
|
|
216
|
+
/* @__PURE__ */ t(K, {
|
|
190
217
|
component: "li",
|
|
191
|
-
variant: i <
|
|
218
|
+
variant: i < C.length - 1 ? "inset" : "fullWidth"
|
|
192
219
|
})
|
|
193
|
-
] },
|
|
220
|
+
] }, r)), e.is_manual && !e.parent_guid && !e.has_been_split && /* @__PURE__ */ t(Ue, { transaction: e })] })
|
|
194
221
|
})] })
|
|
195
222
|
] }),
|
|
196
|
-
a &&
|
|
197
|
-
ariaLabel:
|
|
223
|
+
a && o && /* @__PURE__ */ t(ke, {
|
|
224
|
+
ariaLabel: ge(o?.dataSeries[l]?.date, pe.MONTH),
|
|
198
225
|
barChartProps: {
|
|
199
226
|
amounts: {
|
|
200
227
|
average: a.payload.average_amount,
|
|
201
|
-
formattedAverage:
|
|
228
|
+
formattedAverage: W(a.payload.average_amount, "0,0")
|
|
202
229
|
},
|
|
203
|
-
color:
|
|
204
|
-
data:
|
|
230
|
+
color: D.category?.color || "",
|
|
231
|
+
data: o.chartData,
|
|
205
232
|
margin: {
|
|
206
233
|
bottom: 10,
|
|
207
234
|
left: 24,
|
|
208
235
|
right: 24,
|
|
209
236
|
top: 20
|
|
210
237
|
},
|
|
211
|
-
monthlyAmountLabel:
|
|
212
|
-
onBarClick: (
|
|
213
|
-
|
|
238
|
+
monthlyAmountLabel: d.general.monthly_amount,
|
|
239
|
+
onBarClick: (r) => {
|
|
240
|
+
b(r);
|
|
214
241
|
},
|
|
215
|
-
trendAmountLabel:
|
|
242
|
+
trendAmountLabel: d.general.trend,
|
|
216
243
|
legendPosition: "top"
|
|
217
244
|
},
|
|
218
245
|
beat: {
|
|
@@ -223,43 +250,43 @@ var et = ({ bottomActions: _ = Ae, canFlagTransaction: K = !0, topActions: v = v
|
|
|
223
250
|
description: e.description ?? ""
|
|
224
251
|
}
|
|
225
252
|
},
|
|
226
|
-
data:
|
|
227
|
-
defaultSelectedIndex:
|
|
228
|
-
icon: /* @__PURE__ */ t(
|
|
253
|
+
data: o.chartData,
|
|
254
|
+
defaultSelectedIndex: l,
|
|
255
|
+
icon: /* @__PURE__ */ t(j, {
|
|
229
256
|
alt: e.description ?? "",
|
|
230
257
|
categoryGuid: e.category_guid ?? "",
|
|
231
258
|
merchantGuid: e.merchant_guid ?? "",
|
|
232
259
|
size: 16
|
|
233
260
|
}),
|
|
234
|
-
isOpen:
|
|
261
|
+
isOpen: ae,
|
|
235
262
|
onClose: () => {
|
|
236
|
-
|
|
263
|
+
B(!1), b(o.dataSeries.length - 1);
|
|
237
264
|
},
|
|
238
|
-
onTabChange: (
|
|
239
|
-
|
|
265
|
+
onTabChange: (r) => {
|
|
266
|
+
b(r);
|
|
240
267
|
},
|
|
241
|
-
tipSection:
|
|
242
|
-
message:
|
|
243
|
-
onDismiss: () =>
|
|
268
|
+
tipSection: ne ? void 0 : {
|
|
269
|
+
message: V(d.general.tip_section_message, /* @__PURE__ */ t("strong", { children: d.general.tip_section_title }), /* @__PURE__ */ t("strong", { children: a.primary_transaction?.description })),
|
|
270
|
+
onDismiss: () => se(!0)
|
|
244
271
|
},
|
|
245
|
-
title:
|
|
272
|
+
title: d.general.transaction_history_title,
|
|
246
273
|
transactionListProps: {
|
|
247
274
|
showLoader: k,
|
|
248
275
|
showInsights: !0,
|
|
249
|
-
transaction:
|
|
276
|
+
transaction: ce
|
|
250
277
|
}
|
|
251
278
|
}),
|
|
252
|
-
/* @__PURE__ */ t(
|
|
279
|
+
/* @__PURE__ */ t(rt, {
|
|
253
280
|
anchorOrigin: {
|
|
254
281
|
vertical: "bottom",
|
|
255
282
|
horizontal: "right"
|
|
256
283
|
},
|
|
257
284
|
autoHideDuration: 3500,
|
|
258
|
-
onClose: () =>
|
|
285
|
+
onClose: () => N(""),
|
|
259
286
|
open: !!w,
|
|
260
|
-
children: /* @__PURE__ */ t(
|
|
287
|
+
children: /* @__PURE__ */ t(tt, {
|
|
261
288
|
closeText: "",
|
|
262
|
-
onClose: () =>
|
|
289
|
+
onClose: () => N(""),
|
|
263
290
|
severity: "success",
|
|
264
291
|
variant: "filled",
|
|
265
292
|
children: w
|
|
@@ -267,9 +294,9 @@ var et = ({ bottomActions: _ = Ae, canFlagTransaction: K = !0, topActions: v = v
|
|
|
267
294
|
})
|
|
268
295
|
]
|
|
269
296
|
});
|
|
270
|
-
},
|
|
297
|
+
}, Zt = $e(it);
|
|
271
298
|
export {
|
|
272
|
-
|
|
299
|
+
Zt as default
|
|
273
300
|
};
|
|
274
301
|
|
|
275
302
|
//# 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 useAppConfig,\n useCategoryStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n useUserStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { type PrimaryCTA, Transaction, TransactionType } from '../../../core'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks`, whose chart blocks\n// reach back into transactions code — the circular-import/TDZ trap `actionBlocksKey.ts` documents.\nimport { isContactSupportCtaDisabled } from '../../../insights-v2/actionBlocks/ContactSupportActionBlock'\nimport CompactInsightCard from '../../../insights-v2/components/CompactInsightCard'\nimport InsightErrorCard from '../../../insights-v2/components/InsightErrorCard'\nimport { actionBlocksKey } from '../../../insights-v2/mappings/actionBlocksKey'\nimport { resolveInsightRender } from '../../../insights-v2/resolveInsightRender'\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 * Opens the host's contact-support flow when the embedded insight card's CTA is\n * `contact_support_block`. This module cannot import the help module (hosts that don't ship the\n * Help widget stub the import — pulse's webpack `IgnorePlugin`), so the host supplies it. Without\n * it, or with the client's `enable_support_requests` off, the CTA renders disabled.\n */\n onContactSupport?: () => void\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 onContactSupport,\n}) => {\n const { onEvent } = useEvent()\n const { config } = useAppConfig()\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 // Insights 2.0 (insights_v2.2.md §8.3, §10.1): branch on the beat the widget already matched from\n // its associated-beats fetch (which carries `widget_type=embedded`). `v2` renders the compact card\n // from the held envelope and `error` the error card, both in the slot above the account block;\n // only `legacy` runs the per-template switch below. There is deliberately no fetch on open.\n const insightRender = shouldShowEmbeddedCard ? resolveInsightRender(beat) : 'legacy'\n const v2Payload = insightRender === 'v2' ? beat?.insights_payload : undefined\n\n const embeddedData =\n shouldShowEmbeddedCard && insightRender === 'legacy'\n ? getEmbeddedInstanceSlotByBeatTemplates(commonCopy, beat)\n : null\n\n // `contact_support_block` hands off to the host's flow (see `onContactSupport`). The card itself\n // never opens anything; `isContactSupportCtaDisabled` keeps the CTA inert when it cannot be honoured.\n const handleV2CtaClick = (cta: PrimaryCTA) => {\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n onContactSupport?.()\n }\n }\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 {v2Payload && (\n <CompactInsightCard\n beat={beat}\n isCtaDisabled={isContactSupportCtaDisabled(\n v2Payload.primary_cta?.block,\n config,\n onContactSupport,\n )}\n onCtaClick={handleV2CtaClick}\n payload={v2Payload}\n />\n )}\n {insightRender === 'error' && beat && <InsightErrorCard beat={beat} variant=\"plain\" />}\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,IAAM,KAAA,CAAyD,EAC7D,eAAA,IAAgB,IAChB,oBAAA,IAAqB,IACrB,YAAA,IAAa,IACb,aAAA,GACA,wBAAA,IAAyB,IACzB,kBAAA,EAAA,MACI;AACJ,QAAM,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,QAAA,EAAA,IAAW,GAAa,GAC1B,EAAE,cAAA,EAAA,IAAiB,GAAiB,GACpC,EAAE,cAAA,EAAA,IAAiB,GAAa,G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ACb,UAAA,EAAkC,EAAK,GACvC,EAAoB,EAAc,WAAW,SAAS,CAAC;AAAA,QACzD;AAAA,QACA,aAAA,CAAc,MAAkB;AAC9B,UAAA,EAAoB,CAAK;AAAA,QAC3B;AAAA,QACA,YACG,KASG,SARA;AAAA,UACE,SAAS,EACP,EAAa,QAAQ,qBACrB,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAa,QAAQ,kBAA0B,CAAA,GACxD,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAK,qBAAqB,YAAoB,CAAA,CACzD;AAAA,UACA,WAAA,MAAiB,GAAmB,EAAI;AAAA,QAC1C;AAAA,QAGN,OAAO,EAAa,QAAQ;AAAA,QAC5B,sBAAsB;AAAA,UACpB,YAAY;AAAA,UACZ,cAAc;AAAA,UACd,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 useAppConfig,\n useCategoryStore,\n useEvent,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n useUserStore,\n} from '../../../common'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport { type PrimaryCTA, Transaction, TransactionType } from '../../../core'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks`, whose chart blocks\n// reach back into transactions code — the circular-import/TDZ trap `actionBlocksKey.ts` documents.\nimport { isContactSupportCtaDisabled } from '../../../insights-v2/actionBlocks/ContactSupportActionBlock'\nimport CompactInsightCard from '../../../insights-v2/components/CompactInsightCard'\nimport InsightErrorCard from '../../../insights-v2/components/InsightErrorCard'\nimport { actionBlocksKey } from '../../../insights-v2/mappings/actionBlocksKey'\nimport { resolveInsightRender } from '../../../insights-v2/resolveInsightRender'\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 * Opens the host's contact-support flow when the embedded insight card's CTA is\n * `contact_support_block`. This module cannot import the help module (hosts that don't ship the\n * Help widget stub the import — pulse's webpack `IgnorePlugin`), so the host supplies it. Without\n * it, or with the client's `enable_support_requests` off, the CTA renders disabled.\n */\n onContactSupport?: () => void\n}\n\nconst LOGO_SIZE = 64\n// Fixed per Figma; the theme's shape.borderRadius is client-configurable.\nconst LOGO_RADIUS = 8\n\n// Account feed line per Figma: 9/12 bold 700, uppercase, 0.27px tracking.\nconst FEED_LINE_SX = {\n fontWeight: 700,\n letterSpacing: '0.27px',\n textTransform: 'uppercase',\n} as const\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 onContactSupport,\n}) => {\n const { onEvent } = useEvent()\n const { config } = useAppConfig()\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 const maskedNumber = transaction?.number\n ? showFullNumber\n ? transaction.number\n : `\\u2022\\u2022\\u2022\\u2022${transaction.number}`\n : undefined\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 // Insights 2.0 (insights_v2.2.md §8.3, §10.1): branch on the beat the widget already matched from\n // its associated-beats fetch (which carries `widget_type=embedded`). `v2` renders the compact card\n // from the held envelope and `error` the error card, both in the slot above the account block;\n // only `legacy` runs the per-template switch below. There is deliberately no fetch on open.\n const insightRender = shouldShowEmbeddedCard ? resolveInsightRender(beat) : 'legacy'\n const v2Payload = insightRender === 'v2' ? beat?.insights_payload : undefined\n\n const embeddedData =\n shouldShowEmbeddedCard && insightRender === 'legacy'\n ? getEmbeddedInstanceSlotByBeatTemplates(commonCopy, beat)\n : null\n\n // `contact_support_block` hands off to the host's flow (see `onContactSupport`). The card itself\n // never opens anything; `isContactSupportCtaDisabled` keeps the CTA inert when it cannot be honoured.\n const handleV2CtaClick = (cta: PrimaryCTA) => {\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n onContactSupport?.()\n }\n }\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 <Box\n sx={{\n bgcolor: 'background.paper',\n borderRadius: `${LOGO_RADIUS}px`,\n height: LOGO_SIZE,\n overflow: 'hidden',\n width: LOGO_SIZE,\n }}\n >\n <MerchantLogo\n categoryGuid={transaction.top_level_category_guid || ''}\n merchantGuid={transaction.merchant_guid || ''}\n size={LOGO_SIZE}\n />\n </Box>\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 {v2Payload && (\n <CompactInsightCard\n beat={beat}\n isCtaDisabled={isContactSupportCtaDisabled(\n v2Payload.primary_cta?.block,\n config,\n onContactSupport,\n )}\n onCtaClick={handleV2CtaClick}\n payload={v2Payload}\n />\n )}\n {insightRender === 'error' && beat && <InsightErrorCard beat={beat} variant=\"plain\" />}\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}>{transaction.account}</Text>\n <Stack\n alignItems=\"baseline\"\n data-testid=\"account-feed-line\"\n direction=\"row\"\n gap={4}\n sx={{ overflow: 'hidden' }}\n >\n <Text\n color=\"text.secondary\"\n sx={{ ...FEED_LINE_SX, minWidth: 0 }}\n truncate={true}\n variant=\"tiny\"\n >\n {transaction.feed_description}\n </Text>\n {maskedNumber && (\n <Text\n color=\"text.secondary\"\n sx={{ ...FEED_LINE_SX, flexShrink: 0 }}\n variant=\"tiny\"\n >\n {maskedNumber}\n </Text>\n )}\n </Stack>\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmFA,IAAM,IAAY,IAEZ,KAAc,GAGd,IAAe;AAAA,EACnB,Y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