@mx-cartographer/experiences 9.7.169 → 9.7.171
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 +9 -1
- package/dist/common/components/CurrencyDialog.es.js +40 -37
- package/dist/common/components/CurrencyDialog.es.js.map +1 -1
- package/dist/common/components/SubheaderRow.es.js +11 -8
- package/dist/common/components/SubheaderRow.es.js.map +1 -1
- package/dist/core/types/InsightsInstanceSlotData.d.ts +2 -0
- package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +35 -34
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.d.ts +5 -1
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js +71 -59
- package/dist/insights-v2/actionBlocks/BudgetDetailsBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +17 -17
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.d.ts +6 -2
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +12 -10
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +74 -71
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +4 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +47 -51
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js +35 -35
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.d.ts +2 -4
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js +43 -69
- package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +8 -3
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +65 -66
- package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.d.ts +3 -1
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js +15 -13
- package/dist/insights-v2/blocks/ChartBlocks/DonutChartBlock/DonutChart.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +23 -17
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +179 -183
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/microinsights/MicroCardTemplate.es.js +1 -1
- package/dist/microinsights/MicroCardTemplate.es.js.map +1 -1
- package/dist/notifications/components/NotificationCard.es.js +18 -17
- package/dist/notifications/components/NotificationCard.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,44 +1,44 @@
|
|
|
1
1
|
import { DATE_FORMATS_INTL as m, formatDate as g } from "../../../core/constants/DateFormats.es.js";
|
|
2
2
|
import { fromUnixUTC as h } from "../../../core/utils/DateUtil.es.js";
|
|
3
|
-
import { buildChartData as c, buildDataSeries as
|
|
4
|
-
import { buildComparisonSeries as
|
|
5
|
-
import {
|
|
6
|
-
import { format as p, isValid as
|
|
7
|
-
var
|
|
8
|
-
if (
|
|
9
|
-
const e =
|
|
3
|
+
import { buildChartData as c, buildDataSeries as d } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
4
|
+
import { buildComparisonSeries as f } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
|
|
5
|
+
import { FALLBACK as D, layout as l } from "./layout.es.js";
|
|
6
|
+
import { format as p, isValid as _, parseISO as u } from "date-fns";
|
|
7
|
+
var S = (t) => t && Object.hasOwn(l, t) && l[t] || D, C = ({ data: t, ariaLabel: a, top: r, beatTransactions: i }) => {
|
|
8
|
+
if (r === "upcomingBill") {
|
|
9
|
+
const e = b(i);
|
|
10
10
|
return {
|
|
11
11
|
dataSeries: e,
|
|
12
|
-
chartData: c(e,
|
|
13
|
-
...
|
|
14
|
-
label: e[
|
|
15
|
-
} :
|
|
12
|
+
chartData: c(e, a).map((s, n) => e[n].label ? {
|
|
13
|
+
...s,
|
|
14
|
+
label: e[n].label
|
|
15
|
+
} : s),
|
|
16
16
|
comparisonBars: []
|
|
17
17
|
};
|
|
18
18
|
}
|
|
19
|
-
if (
|
|
20
|
-
dataSeries:
|
|
19
|
+
if (r === "tabsOnly") return {
|
|
20
|
+
dataSeries: d(t).filter((e) => e.localized_label),
|
|
21
21
|
chartData: [],
|
|
22
22
|
comparisonBars: []
|
|
23
23
|
};
|
|
24
|
-
if (
|
|
24
|
+
if (r === "list") return {
|
|
25
25
|
dataSeries: [],
|
|
26
26
|
chartData: [],
|
|
27
27
|
comparisonBars: []
|
|
28
28
|
};
|
|
29
|
-
const o = [...
|
|
30
|
-
switch (
|
|
29
|
+
const o = [...d(t)].sort((e, s) => !e.date || !s.date ? 0 : new Date(e.date).getTime() - new Date(s.date).getTime());
|
|
30
|
+
switch (r) {
|
|
31
31
|
case "doubleBar":
|
|
32
32
|
return {
|
|
33
33
|
dataSeries: o,
|
|
34
34
|
chartData: [],
|
|
35
|
-
comparisonBars:
|
|
35
|
+
comparisonBars: f(t, a)
|
|
36
36
|
};
|
|
37
37
|
case "singleBar":
|
|
38
38
|
case "monthTabs":
|
|
39
39
|
return {
|
|
40
40
|
dataSeries: o,
|
|
41
|
-
chartData: c(o,
|
|
41
|
+
chartData: c(o, a),
|
|
42
42
|
comparisonBars: []
|
|
43
43
|
};
|
|
44
44
|
}
|
|
@@ -47,46 +47,42 @@ var I = (t) => D[t] ?? f, O = ({ data: t, ariaLabel: r, top: a, beatTransactions
|
|
|
47
47
|
amount: t.amount,
|
|
48
48
|
guid: t.guid,
|
|
49
49
|
category_guid: t.top_level_category_guid ?? t.category_guid
|
|
50
|
-
}),
|
|
51
|
-
const
|
|
52
|
-
for (const e of
|
|
53
|
-
|
|
50
|
+
}), b = (t = []) => {
|
|
51
|
+
const a = [...t].sort((e, s) => e.date - s.date), r = /* @__PURE__ */ new Set(), i = [];
|
|
52
|
+
for (const e of a)
|
|
53
|
+
r.has(e.date) || (r.add(e.date), i.push(B(e)));
|
|
54
54
|
const o = i.map((e) => e.date.slice(0, 7));
|
|
55
55
|
return new Set(o).size === o.length ? i : i.map((e) => ({
|
|
56
56
|
...e,
|
|
57
57
|
label: g(u(e.date), m.MONTH_DAY)
|
|
58
58
|
}));
|
|
59
|
-
},
|
|
60
|
-
const i =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
return o?.[n] ?? i;
|
|
66
|
-
}, M = (t, r) => ({
|
|
67
|
-
accounts: t.accounts ?? r.allAccountGuids,
|
|
68
|
-
dateRange: t.dateRange ?? r.displayedDateRange,
|
|
59
|
+
}, I = (t, a, r) => {
|
|
60
|
+
const i = a.insights_feed?.transaction_history_block, o = `${t}_drawer_title`;
|
|
61
|
+
return S(t ?? void 0).title?.(a, r) ?? i?.[o] ?? a.insights_feed?.general?.transaction_history_title ?? "";
|
|
62
|
+
}, O = (t, a) => ({
|
|
63
|
+
accounts: t.accounts ?? a.allAccountGuids,
|
|
64
|
+
dateRange: t.dateRange ?? a.displayedDateRange,
|
|
69
65
|
custom: t.custom ?? (() => !0),
|
|
70
66
|
showSplits: t.showSplits ?? !1
|
|
71
|
-
}),
|
|
72
|
-
const o =
|
|
67
|
+
}), A = ({ chartTabCount: t, comparisonTabCount: a, actionDrawer: r, beatGuid: i }) => {
|
|
68
|
+
const o = a || t, e = r.guid === i && r.trigger === "chartBar", s = r.context, n = e ? s?.tabIndex ?? 0 : 0;
|
|
73
69
|
return e ? {
|
|
74
|
-
chartBarIndex: Math.min(Math.max(
|
|
75
|
-
subTabIndex:
|
|
70
|
+
chartBarIndex: Math.min(Math.max(s?.chartBarIndex ?? 0, 0), Math.max(0, o - 1)),
|
|
71
|
+
subTabIndex: n
|
|
76
72
|
} : {
|
|
77
73
|
chartBarIndex: Math.max(0, o - 1),
|
|
78
|
-
subTabIndex:
|
|
74
|
+
subTabIndex: n
|
|
79
75
|
};
|
|
80
|
-
},
|
|
81
|
-
const o =
|
|
76
|
+
}, F = (t) => typeof t == "string" && /^\d{4}-\d{2}-\d{2}$/.test(t) && _(u(t)) ? t : void 0, R = ({ series: t, category_guid: a, average_amount: r, additional_data: i }) => {
|
|
77
|
+
const o = d(t).map(({ guid: e }) => e).filter((e) => !!e);
|
|
82
78
|
return {
|
|
83
79
|
data_series: t,
|
|
84
|
-
category_guid:
|
|
85
|
-
average_amount:
|
|
80
|
+
category_guid: a,
|
|
81
|
+
average_amount: r,
|
|
86
82
|
legends: i,
|
|
87
83
|
transaction_guids: o.length ? o : void 0
|
|
88
84
|
};
|
|
89
|
-
},
|
|
85
|
+
}, U = (t) => {
|
|
90
86
|
if (t)
|
|
91
87
|
return {
|
|
92
88
|
text: t.subtitle ?? "",
|
|
@@ -97,15 +93,15 @@ var I = (t) => D[t] ?? f, O = ({ data: t, ariaLabel: r, top: a, beatTransactions
|
|
|
97
93
|
};
|
|
98
94
|
};
|
|
99
95
|
export {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
96
|
+
b as buildUpcomingBillSeries,
|
|
97
|
+
F as calendarDateOf,
|
|
98
|
+
A as getDefaultSelection,
|
|
99
|
+
I as getDrawerHeaderTitle,
|
|
100
|
+
S as getDrillDownConfig,
|
|
101
|
+
C as getFlattenedDataSeries,
|
|
102
|
+
U as resolveDrillDownSubHeader,
|
|
103
|
+
R as toDrillDownSlotData,
|
|
104
|
+
O as toStoreFilter
|
|
109
105
|
};
|
|
110
106
|
|
|
111
107
|
//# sourceMappingURL=utils.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/utils.ts"],"sourcesContent":["import { format, isValid, parseISO } from 'date-fns'\n\nimport type {\n ActionDrawerState,\n Beat,\n DataSeries,\n DrilldownPayload,\n DrilldownData,\n GlobalCopy,\n InsightsPayload,\n Subtitle,\n Transaction,\n} from '../../../core'\nimport type {\n BarChartBlockData,\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport {\n buildChartData,\n buildDataSeries,\n type ChartDataSeriesItem,\n} from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { buildComparisonSeries } from '../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils'\nimport {\n layout,\n FALLBACK,\n DRILLDOWN_VARIANTS,\n DrillDownVariant,\n DrillDownVariantConfig,\n} from './layout'\nimport { TransactionHistoryBlock } from '../../../core/types/localization/InsightsFeedCopy'\n\ninterface DefaultSelectionProp {\n chartTabCount: number\n comparisonTabCount: number\n actionDrawer: ActionDrawerState\n beatGuid: string\n}\nexport const getDrillDownConfig = (variant?: string): DrillDownVariantConfig =>\n layout[variant as DrillDownVariant] ?? FALLBACK\n\n// The shaped chart inputs a drill-down needs, derived once from the beat's data_series. `dataSeries`\n// is the flat per-bar source (indexes the filterStrategy); `chartData` feeds the single-bar chart;\n// `comparisonBars` feeds the double-bar chart and its month tabs (empty for every other top kind).\nexport interface FlattenedDataSeries {\n dataSeries: ChartDataSeriesItem[]\n chartData: ReturnType<typeof buildChartData>\n comparisonBars: DataSet[]\n}\n\n/**\n * Shapes the beat's raw data_series into the chart inputs for the variant's top kind: the single-bar\n * family (singleBar / upcomingBill), the double bar's month columns, or a tabs-only drawer's sides.\n */\ninterface FlattenedDataSeriesInput {\n data: DataSeries | undefined\n ariaLabel: string\n top: DrillDownVariantConfig['top']\n // UpcomingBill has no data_series; it builds its bars from these instead (its paid bills).\n beatTransactions: Transaction[]\n}\n\nexport const getFlattenedDataSeries = ({\n data,\n ariaLabel,\n top,\n beatTransactions,\n}: FlattenedDataSeriesInput): FlattenedDataSeries => {\n // UpcomingBill has no backend data_series: a bar per paid bill, each named by its month\n // (buildChartData's default MONTH_SHORT) as the design labels it, or by its day when two share one.\n if (top === 'upcomingBill') {\n const dataSeries = buildUpcomingBillSeries(beatTransactions)\n const chartData = buildChartData(dataSeries, ariaLabel).map((bar, index) =>\n dataSeries[index].label ? { ...bar, label: dataSeries[index].label } : bar,\n )\n return { dataSeries, chartData, comparisonBars: [] }\n }\n\n // Tabs only: the rows are the sides of one month, not bars. They keep their wire order, which the\n // side tabs and the filter's dataSeries[subIndex] both index; there is no chart and no month tab.\n if (top === 'tabsOnly') {\n return {\n dataSeries: buildDataSeries(data).filter((row) => row.localized_label),\n chartData: [],\n comparisonBars: [],\n }\n }\n\n // List: one account over a window the strategy reads from the beat; no series, chart or tabs.\n if (top === 'list') {\n return { dataSeries: [], chartData: [], comparisonBars: [] }\n }\n\n // The month families: the backend sends data_series newest-first, so normalize it date-ascending\n // here. chartData/tabs and the filter's dataSeries[selectedIndex] indexing both read this one\n // array, so they stay aligned and the last tab is the most recent month.\n const dataSeries = [...buildDataSeries(data)].sort((a, b) => {\n if (!a.date || !b.date) return 0\n\n return new Date(a.date).getTime() - new Date(b.date).getTime()\n })\n\n switch (top) {\n // Double bar: comparison beats build paired month columns (with their guids) instead of chartData.\n case 'doubleBar':\n return { dataSeries, chartData: [], comparisonBars: buildComparisonSeries(data, ariaLabel) }\n // Single bar draws chartData as bars; month tabs reads the same chartData for its tabs only.\n case 'singleBar':\n case 'monthTabs':\n return { dataSeries, chartData: buildChartData(dataSeries, ariaLabel), comparisonBars: [] }\n }\n}\n\n// One bar in the UpcomingBill chart. `date` is 'yyyy-MM-dd' so buildChartData/parseISO can read it.\n// `label` is set only when two bars share a month, so they are named by their day.\nexport interface UpcomingBillBar {\n date: string\n amount: number\n guid: string\n category_guid?: string\n label?: string\n}\n\n// The bill's UTC calendar day, the day the transaction list heads its row with\n// (fromUnixUTCToDayOfWeekAndDate); a local-time date put a UTC-midnight bill on the day before.\nconst toUpcomingBillBar = (transaction: Transaction): UpcomingBillBar => ({\n date: format(fromUnixUTC(transaction.date), 'yyyy-MM-dd'),\n amount: transaction.amount,\n guid: transaction.guid,\n category_guid: transaction.top_level_category_guid ?? transaction.category_guid,\n})\n\n/**\n * UpcomingBill has no data_series: build the bar series from its paid bills, oldest first, so the\n * drawer opens on the latest (Figma: history only). Bills are de-duped by date, each keeping its real\n * guid so the guid filter finds it. Bars are named by month; when two share a month, every bar is\n * named by its day so no two tabs read the same.\n */\nexport const buildUpcomingBillSeries = (transactions: Transaction[] = []): UpcomingBillBar[] => {\n const sorted = [...transactions].sort((a, b) => a.date - b.date)\n\n const seenDates = new Set<number>()\n const history: UpcomingBillBar[] = []\n for (const transaction of sorted) {\n if (seenDates.has(transaction.date)) continue\n seenDates.add(transaction.date)\n history.push(toUpcomingBillBar(transaction))\n }\n\n const months = history.map((bar) => bar.date.slice(0, 7))\n if (new Set(months).size === months.length) return history\n\n return history.map((bar) => ({\n ...bar,\n label: formatDate(parseISO(bar.date), DATE_FORMATS_INTL.MONTH_DAY),\n }))\n}\n\nexport const getDrawerHeaderTitle = (\n variant: string | null | undefined,\n copy: GlobalCopy,\n beat?: Beat,\n): string => {\n const transactionHistoryTitle = copy.insights_feed?.general?.transaction_history_title ?? ''\n const drawerTitleCopy = copy.insights_feed?.transaction_history_block as TransactionHistoryBlock\n\n if (variant === DRILLDOWN_VARIANTS.TRANSACTION) return transactionHistoryTitle\n\n // Savings Account Balances Summary: the drawer reads as the card it opens from (\"Savings\n // Contributions\", Figma 1135:50175), whatever the host's drawer copy says.\n const beatTitle = beat?.insights_payload?.title\n if (variant === DRILLDOWN_VARIANTS.ACCOUNT_BALANCE && beatTitle) return beatTitle\n\n // Safely access the drawer title from transaction_history_block. Debt to Income's ditto variant\n // (debt_to_income) keeps the host copy's existing monthly_debt_to_income_drawer_title. Savings to\n // Income's variant is savings_to_income, so it resolves savings_to_income_drawer_title through the\n // generic path below (it deliberately drops the monthly_ prefix; do not re-add it).\n const key = (\n variant === DRILLDOWN_VARIANTS.DEBT_TO_INCOME\n ? 'monthly_debt_to_income_drawer_title'\n : `${variant}_drawer_title`\n ) as keyof TransactionHistoryBlock\n return (drawerTitleCopy?.[key] as string) ?? transactionHistoryTitle\n}\n\nexport const toStoreFilter = (\n filter: TransactionFilter,\n defaults: { allAccountGuids: string[]; displayedDateRange: { start: Date; end: Date } },\n): TransactionFilter => ({\n accounts: filter.accounts ?? defaults.allAccountGuids,\n dateRange: filter.dateRange ?? defaults.displayedDateRange,\n custom: filter.custom ?? (() => true),\n showSplits: filter.showSplits ?? false,\n})\n\nexport const getDefaultSelection = ({\n chartTabCount,\n comparisonTabCount,\n actionDrawer,\n beatGuid,\n}: DefaultSelectionProp): { chartBarIndex: number; subTabIndex: number } => {\n // A double-bar drawer's tabs are its comparison columns; every other drawer's are its chart bars.\n const tabCount = comparisonTabCount || chartTabCount\n const openedViaChartBar = actionDrawer.guid === beatGuid && actionDrawer.trigger === 'chartBar'\n\n // actionDrawer.context is an opaque `unknown` bag; narrow it to the shape the chart blocks write.\n const context = actionDrawer.context as DrilldownPayload | undefined\n const subTabIndex = openedViaChartBar ? (context?.tabIndex ?? 0) : 0\n\n if (openedViaChartBar) {\n const clamped = Math.min(Math.max(context?.chartBarIndex ?? 0, 0), Math.max(0, tabCount - 1))\n return { chartBarIndex: clamped, subTabIndex }\n }\n\n return { chartBarIndex: Math.max(0, tabCount - 1), subTabIndex }\n}\n\n/**\n * The drawer's facts: the generic slot facts plus the bar chart's average, and the merchant a\n * variant's tip names.\n */\nexport type DrillDownSlotData = InsightsInstanceSlotData &\n Pick<BarChartBlockData, 'average_amount'> & {\n merchant_name?: string\n // Merchant Budget: the merchant whose transactions the drawer lists.\n merchant_guid?: string\n // Monthly Deposit Summary: the deposits on the Income sub-tab, across every month.\n income_transaction_guids?: string[]\n // A drawer's own sub-tab names when the card's legend rows aren't the chart's (Income / Other Deposits).\n sub_tab_labels?: string[]\n }\n\n// parseISO rejects impossible days such as 2026-02-30.\nexport const calendarDateOf = (value: unknown): string | undefined =>\n typeof value === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(value) && isValid(parseISO(value))\n ? value\n : undefined\n\n/**\n * Resolves the drawer's facts (bars, guids, colour, average, tip values) from the beat's payload, or\n * from the drilldown_data of the CTA that opened the drawer (`ctaDrilldownData`).\n */\nexport type SlotDataResolver = (\n payload: Partial<InsightsPayload> | undefined,\n ctaDrilldownData?: DrilldownData,\n) => DrillDownSlotData\n\n/** The drawer's facts from a bar chart's `instance_slot.data` (variants with no `slotData`). */\nexport const toDrillDownSlotData = ({\n series,\n category_guid,\n average_amount,\n additional_data,\n}: BarChartBlockData): DrillDownSlotData => {\n const transactionGuids = buildDataSeries(series)\n .map(({ guid }) => guid)\n .filter((guid): guid is string => !!guid)\n\n return {\n data_series: series,\n category_guid,\n average_amount,\n legends: additional_data,\n transaction_guids: transactionGuids.length ? transactionGuids : undefined,\n }\n}\n\n/** The drawer's sub-heading: the merchant name and logo. */\nexport const resolveDrillDownSubHeader = (\n payload: Partial<InsightsPayload> | undefined,\n): Subtitle | undefined => {\n if (!payload) return undefined\n\n return {\n text: payload.subtitle ?? '',\n logo: { merchant_guid: payload.logo?.guid, category_guid: '' },\n }\n}\n"],"mappings":";;;;;;AA0CA,IAAa,IAAA,CAAsB,MACjC,EAAO,CAAA,KAAgC,GAuB5B,IAAA,CAA0B,EACrC,MAAA,GACA,WAAA,GACA,KAAA,GACA,kBAAA,EAAA,MACmD;AAGnD,MAAI,MAAQ,gBAAgB;AAC1B,UAAM,IAAa,EAAwB,CAAgB;AAI3D,WAAO;AAAA,MAAE,YAAA;AAAA,MAAY,WAHH,EAAe,GAAY,CAAS,EAAE,IAAA,CAAK,GAAK,MAChE,EAAW,CAAA,EAAO,QAAQ;AAAA,QAAE,GAAG;AAAA,QAAK,OAAO,EAAW,CAAA,EAAO;AAAA,MAAM,IAAI,CAEpD;AAAA,MAAW,gBAAgB,CAAC;AAAA,IAAE;AAAA,EACrD;AAIA,MAAI,MAAQ,WACV,QAAO;AAAA,IACL,YAAY,EAAgB,CAAI,EAAE,OAAA,CAAQ,MAAQ,EAAI,eAAe;AAAA,IACrE,WAAW,CAAC;AAAA,IACZ,gBAAgB,CAAC;AAAA,EACnB;AAIF,MAAI,MAAQ,OACV,QAAO;AAAA,IAAE,YAAY,CAAC;AAAA,IAAG,WAAW,CAAC;AAAA,IAAG,gBAAgB,CAAC;AAAA,EAAE;AAM7D,QAAM,IAAa,CAAC,GAAG,EAAgB,CAAI,CAAC,EAAE,KAAA,CAAM,GAAG,MACjD,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAa,IAExB,IAAI,KAAK,EAAE,IAAI,EAAE,QAAQ,IAAI,IAAI,KAAK,EAAE,IAAI,EAAE,QAAQ,CAC9D;AAED,UAAQ,GAAR;AAAA,IAEE,KAAK;AACH,aAAO;AAAA,QAAE,YAAA;AAAA,QAAY,WAAW,CAAC;A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E,eAAe,EAAQ,MAAM;AAAA,QAAM,eAAe;AAAA,MAAG;AAAA,IAC/D;AACF"}
|
|
1
|
+
{"version":3,"file":"utils.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/utils.ts"],"sourcesContent":["import { format, isValid, parseISO } from 'date-fns'\n\nimport type {\n ActionDrawerState,\n Beat,\n DataSeries,\n DrilldownPayload,\n DrilldownData,\n GlobalCopy,\n InsightsPayload,\n Subtitle,\n Transaction,\n} from '../../../core'\nimport type {\n BarChartBlockData,\n DataSet,\n InsightsInstanceSlotData,\n} from '../../../core/types/InsightsInstanceSlotData'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../core/constants'\nimport type { TransactionFilter } from '../../../core/stores/TransactionStore'\nimport { fromUnixUTC } from '../../../core/utils/DateUtil'\nimport {\n buildChartData,\n buildDataSeries,\n type ChartDataSeriesItem,\n} from '../../blocks/ChartBlocks/BarchartBlock/utils'\nimport { buildComparisonSeries } from '../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils'\nimport { layout, FALLBACK, DrillDownVariant, DrillDownVariantConfig } from './layout'\nimport { TransactionHistoryBlock } from '../../../core/types/localization/InsightsFeedCopy'\n\ninterface DefaultSelectionProp {\n chartTabCount: number\n comparisonTabCount: number\n actionDrawer: ActionDrawerState\n beatGuid: string\n}\nexport const getDrillDownConfig = (variant?: string): DrillDownVariantConfig =>\n (variant && Object.hasOwn(layout, variant) && layout[variant as DrillDownVariant]) || FALLBACK\n\n// The shaped chart inputs a drill-down needs, derived once from the beat's data_series. `dataSeries`\n// is the flat per-bar source (indexes the filterStrategy); `chartData` feeds the single-bar chart;\n// `comparisonBars` feeds the double-bar chart and its month tabs (empty for every other top kind).\nexport interface FlattenedDataSeries {\n dataSeries: ChartDataSeriesItem[]\n chartData: ReturnType<typeof buildChartData>\n comparisonBars: DataSet[]\n}\n\n/**\n * Shapes the beat's raw data_series into the chart inputs for the variant's top kind: the single-bar\n * family (singleBar / upcomingBill), the double bar's month columns, or a tabs-only drawer's sides.\n */\ninterface FlattenedDataSeriesInput {\n data: DataSeries | undefined\n ariaLabel: string\n top: DrillDownVariantConfig['top']\n // UpcomingBill has no data_series; it builds its bars from these instead (its paid bills).\n beatTransactions: Transaction[]\n}\n\nexport const getFlattenedDataSeries = ({\n data,\n ariaLabel,\n top,\n beatTransactions,\n}: FlattenedDataSeriesInput): FlattenedDataSeries => {\n // UpcomingBill has no backend data_series: a bar per paid bill, each named by its month\n // (buildChartData's default MONTH_SHORT) as the design labels it, or by its day when two share one.\n if (top === 'upcomingBill') {\n const dataSeries = buildUpcomingBillSeries(beatTransactions)\n const chartData = buildChartData(dataSeries, ariaLabel).map((bar, index) =>\n dataSeries[index].label ? { ...bar, label: dataSeries[index].label } : bar,\n )\n return { dataSeries, chartData, comparisonBars: [] }\n }\n\n // Tabs only: the rows are the sides of one month, not bars. They keep their wire order, which the\n // side tabs and the filter's dataSeries[subIndex] both index; there is no chart and no month tab.\n if (top === 'tabsOnly') {\n return {\n dataSeries: buildDataSeries(data).filter((row) => row.localized_label),\n chartData: [],\n comparisonBars: [],\n }\n }\n\n // List: one account over a window the strategy reads from the beat; no series, chart or tabs.\n if (top === 'list') {\n return { dataSeries: [], chartData: [], comparisonBars: [] }\n }\n\n // The month families: the backend sends data_series newest-first, so normalize it date-ascending\n // here. chartData/tabs and the filter's dataSeries[selectedIndex] indexing both read this one\n // array, so they stay aligned and the last tab is the most recent month.\n const dataSeries = [...buildDataSeries(data)].sort((a, b) => {\n if (!a.date || !b.date) return 0\n\n return new Date(a.date).getTime() - new Date(b.date).getTime()\n })\n\n switch (top) {\n // Double bar: comparison beats build paired month columns (with their guids) instead of chartData.\n case 'doubleBar':\n return { dataSeries, chartData: [], comparisonBars: buildComparisonSeries(data, ariaLabel) }\n // Single bar draws chartData as bars; month tabs reads the same chartData for its tabs only.\n case 'singleBar':\n case 'monthTabs':\n return { dataSeries, chartData: buildChartData(dataSeries, ariaLabel), comparisonBars: [] }\n }\n}\n\n// One bar in the UpcomingBill chart. `date` is 'yyyy-MM-dd' so buildChartData/parseISO can read it.\n// `label` is set only when two bars share a month, so they are named by their day.\nexport interface UpcomingBillBar {\n date: string\n amount: number\n guid: string\n category_guid?: string\n label?: string\n}\n\n// The bill's UTC calendar day, the day the transaction list heads its row with\n// (fromUnixUTCToDayOfWeekAndDate); a local-time date put a UTC-midnight bill on the day before.\nconst toUpcomingBillBar = (transaction: Transaction): UpcomingBillBar => ({\n date: format(fromUnixUTC(transaction.date), 'yyyy-MM-dd'),\n amount: transaction.amount,\n guid: transaction.guid,\n category_guid: transaction.top_level_category_guid ?? transaction.category_guid,\n})\n\n/**\n * UpcomingBill has no data_series: build the bar series from its paid bills, oldest first, so the\n * drawer opens on the latest (Figma: history only). Bills are de-duped by date, each keeping its real\n * guid so the guid filter finds it. Bars are named by month; when two share a month, every bar is\n * named by its day so no two tabs read the same.\n */\nexport const buildUpcomingBillSeries = (transactions: Transaction[] = []): UpcomingBillBar[] => {\n const sorted = [...transactions].sort((a, b) => a.date - b.date)\n\n const seenDates = new Set<number>()\n const history: UpcomingBillBar[] = []\n for (const transaction of sorted) {\n if (seenDates.has(transaction.date)) continue\n seenDates.add(transaction.date)\n history.push(toUpcomingBillBar(transaction))\n }\n\n const months = history.map((bar) => bar.date.slice(0, 7))\n if (new Set(months).size === months.length) return history\n\n return history.map((bar) => ({\n ...bar,\n label: formatDate(parseISO(bar.date), DATE_FORMATS_INTL.MONTH_DAY),\n }))\n}\n\n/**\n * The variant's own title, else its `<variant>_drawer_title` copy (savings_to_income resolves\n * savings_to_income_drawer_title, deliberately without the monthly_ prefix), else the general title.\n */\nexport const getDrawerHeaderTitle = (\n variant: string | null | undefined,\n copy: GlobalCopy,\n beat?: Beat,\n): string => {\n const drawerTitles = copy.insights_feed?.transaction_history_block as TransactionHistoryBlock\n const key = `${variant}_drawer_title` as keyof TransactionHistoryBlock\n\n return (\n getDrillDownConfig(variant ?? undefined).title?.(copy, beat) ??\n (drawerTitles?.[key] as string | undefined) ??\n copy.insights_feed?.general?.transaction_history_title ??\n ''\n )\n}\n\nexport const toStoreFilter = (\n filter: TransactionFilter,\n defaults: { allAccountGuids: string[]; displayedDateRange: { start: Date; end: Date } },\n): TransactionFilter => ({\n accounts: filter.accounts ?? defaults.allAccountGuids,\n dateRange: filter.dateRange ?? defaults.displayedDateRange,\n custom: filter.custom ?? (() => true),\n showSplits: filter.showSplits ?? false,\n})\n\nexport const getDefaultSelection = ({\n chartTabCount,\n comparisonTabCount,\n actionDrawer,\n beatGuid,\n}: DefaultSelectionProp): { chartBarIndex: number; subTabIndex: number } => {\n // A double-bar drawer's tabs are its comparison columns; every other drawer's are its chart bars.\n const tabCount = comparisonTabCount || chartTabCount\n const openedViaChartBar = actionDrawer.guid === beatGuid && actionDrawer.trigger === 'chartBar'\n\n // actionDrawer.context is an opaque `unknown` bag; narrow it to the shape the chart blocks write.\n const context = actionDrawer.context as DrilldownPayload | undefined\n const subTabIndex = openedViaChartBar ? (context?.tabIndex ?? 0) : 0\n\n if (openedViaChartBar) {\n const clamped = Math.min(Math.max(context?.chartBarIndex ?? 0, 0), Math.max(0, tabCount - 1))\n return { chartBarIndex: clamped, subTabIndex }\n }\n\n return { chartBarIndex: Math.max(0, tabCount - 1), subTabIndex }\n}\n\n/**\n * The drawer's facts: the generic slot facts plus the bar chart's average, and the merchant a\n * variant's tip names.\n */\nexport type DrillDownSlotData = InsightsInstanceSlotData &\n Pick<BarChartBlockData, 'average_amount'> & {\n merchant_name?: string\n // Merchant Budget: the merchant whose transactions the drawer lists.\n merchant_guid?: string\n // Monthly Deposit Summary: the deposits on the Income sub-tab, across every month.\n income_transaction_guids?: string[]\n // A drawer's own sub-tab names when the card's legend rows aren't the chart's (Income / Other Deposits).\n sub_tab_labels?: string[]\n }\n\n// parseISO rejects impossible days such as 2026-02-30.\nexport const calendarDateOf = (value: unknown): string | undefined =>\n typeof value === 'string' && /^\\d{4}-\\d{2}-\\d{2}$/.test(value) && isValid(parseISO(value))\n ? value\n : undefined\n\n/**\n * Resolves the drawer's facts (bars, guids, colour, average, tip values) from the beat's payload, or\n * from the drilldown_data of the CTA that opened the drawer (`ctaDrilldownData`).\n */\nexport type SlotDataResolver = (\n payload: Partial<InsightsPayload> | undefined,\n ctaDrilldownData?: DrilldownData,\n) => DrillDownSlotData\n\n/** The drawer's facts from a bar chart's `instance_slot.data` (variants with no `slotData`). */\nexport const toDrillDownSlotData = ({\n series,\n category_guid,\n average_amount,\n additional_data,\n}: BarChartBlockData): DrillDownSlotData => {\n const transactionGuids = buildDataSeries(series)\n .map(({ guid }) => guid)\n .filter((guid): guid is string => !!guid)\n\n return {\n data_series: series,\n category_guid,\n average_amount,\n legends: additional_data,\n transaction_guids: transactionGuids.length ? transactionGuids : undefined,\n }\n}\n\n/** The drawer's sub-heading: the merchant name and logo. */\nexport const resolveDrillDownSubHeader = (\n payload: Partial<InsightsPayload> | undefined,\n): Subtitle | undefined => {\n if (!payload) return undefined\n\n return {\n text: payload.subtitle ?? '',\n logo: { merchant_guid: payload.logo?.guid, category_guid: '' },\n }\n}\n"],"mappings":";;;;;;AAoCA,IAAa,IAAA,CAAsB,MAChC,KAAW,OAAO,OAAO,GAAQ,CAAO,KAAK,EAAO,CAAA,KAAiC,GAuB3E,IAAA,CAA0B,EACrC,MAAA,GACA,WAAA,GACA,KAAA,GACA,kBAAA,EAAA,MACmD;AAGnD,MAAI,MAAQ,gBAAgB;AAC1B,UAAM,IAAa,EAAwB,CAAgB;AAI3D,WAAO;AAAA,MAAE,YAAA;AAAA,MAAY,WAHH,EAAe,GAAY,CAAS,EAAE,IAAA,CAAK,GAAK,MAChE,EAAW,CAAA,EAAO,QAAQ;AAAA,QAAE,GAAG;AAAA,QAAK,OAAO,EAAW,CAAA,EAAO;AAAA,MAAM,IAAI,CAEpD;AAAA,MAAW,gBAAgB,CAAC;AAAA,IAAE;AAAA,EACrD;AAIA,MAAI,MAAQ,WACV,QAAO;AAAA,IACL,YAAY,EAAgB,C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,gBAAA,GACA,iBAAA,EAAA,MAC0C;AAC1C,QAAM,IAAmB,EAAgB,CAAM,EAC5C,IAAA,CAAK,EAAE,MAAA,EAAA,MAAW,CAAI,EACtB,OAAA,CAAQ,MAAyB,CAAC,CAAC,CAAI;AAE1C,SAAO;AAAA,IACL,aAAa;AAAA,IACb,eAAA;AAAA,IACA,gBAAA;AAAA,IACA,SAAS;AAAA,IACT,mBAAmB,EAAiB,SAAS,IAAmB;AAAA,EAClE;AACF,GAGa,IAAA,CACX,MACyB;AACzB,MAAK;AAEL,WAAO;AAAA,MACL,MAAM,EAAQ,YAAY;AAAA,MAC1B,MAAM;AAAA,QAAE,eAAe,EAAQ,MAAM;AAAA,QAAM,eAAe;AAAA,MAAG;AAAA,IAC/D;AACF"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { useAccountStore as
|
|
1
|
+
import { useAccountStore as E, useGlobalCopyStore as F, useInsightsV2Store as $, useTransactionStore as P } from "../../../common/context/hooks.es.js";
|
|
2
2
|
import g from "../../../common/components/drawer/Drawer.es.js";
|
|
3
|
-
import
|
|
4
|
-
import { selectTransactionsByGuids as
|
|
5
|
-
import { frequencyWord as
|
|
3
|
+
import V from "../../../transactions/components/shared/TransactionList.es.js";
|
|
4
|
+
import { selectTransactionsByGuids as z } from "../../CommonUtils.es.js";
|
|
5
|
+
import { frequencyWord as U } from "../../components/SubscriptionStatus/subscriptionFrequency.es.js";
|
|
6
6
|
import { useOpenedCta as W } from "../useOpenedCta.es.js";
|
|
7
7
|
import { TransactionDetailsBlock as J } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
|
|
8
8
|
import { useRecurringTransactionPrepare as K } from "../RecurringTransactionBlock/useRecurringTransactionPrepare.es.js";
|
|
9
9
|
import { RecurringTransactionBlock as Q } from "../RecurringTransactionBlock/RecurringTransactionBlock.es.js";
|
|
10
10
|
import { HelpBlock as X } from "../HelpBlock/HelpBlock.es.js";
|
|
11
|
-
import {
|
|
12
|
-
import { TransactionAccountSubline as
|
|
11
|
+
import { TRANSACTION_LIST_VARIANTS as Y, readCreditLimitHeader as Z, readHelpHeader as tt, readSubscriptionHeader as nt, readSummary as ot, readTransactionFrequencies as et, transactionListLayout as it } from "./layout.es.js";
|
|
12
|
+
import { TransactionAccountSubline as rt } from "./TransactionAccountSubline.es.js";
|
|
13
13
|
import { TransactionListCreditLimitHeader as st } from "./TransactionListCreditLimitHeader.es.js";
|
|
14
14
|
import { TransactionListHelpHeader as at } from "./TransactionListHelpHeader.es.js";
|
|
15
15
|
import { TransactionListSubscriptionHeader as ct } from "./TransactionListSubscriptionHeader.es.js";
|
|
@@ -18,18 +18,18 @@ import f from "react";
|
|
|
18
18
|
import { observer as dt } from "mobx-react-lite";
|
|
19
19
|
import { Text as ut } from "@mxenabled/mxui";
|
|
20
20
|
import { Fragment as pt, jsx as t, jsxs as mt } from "react/jsx-runtime";
|
|
21
|
-
var _t = (
|
|
22
|
-
const a =
|
|
21
|
+
var _t = (o) => Array.isArray(o) && o.every((n) => typeof n == "string"), gt = (o, n) => {
|
|
22
|
+
const a = o.insights_payload?.drilldown_data, i = o.insights_payload?.instance_slot_data ?? {}, [l, c] = n && Object.hasOwn(n, "transaction_guids") ? ["cta.drilldown_data", n.transaction_guids] : a && Object.hasOwn(a, "transaction_guids") ? ["drilldown_data", a.transaction_guids] : ["instance_slot_data", i.transaction_guids];
|
|
23
23
|
if (c != null) {
|
|
24
24
|
if (_t(c)) return c;
|
|
25
25
|
console.warn(`[TransactionListBlock] ${l}.transaction_guids is not a list of guids — listing no transactions.`);
|
|
26
26
|
}
|
|
27
|
-
}, ft = (
|
|
28
|
-
const { common: a, insights_feed:
|
|
29
|
-
institutionGuid: x.accounts.find(({ guid: s }) => s ===
|
|
30
|
-
transaction:
|
|
31
|
-
}) : void 0, L = m ?
|
|
32
|
-
const s =
|
|
27
|
+
}, ft = (o) => (K(o), /* @__PURE__ */ t(Q, { ...o })), jt = dt(function({ beat: n }) {
|
|
28
|
+
const { common: a, insights_feed: i, recurring: l } = F(), { setActionContext: c } = $(), b = P(), x = E(), [O, T] = f.useState(!1), [w, S] = f.useState(!1), { is_zero_state: A, drilldown_data: k, title: I } = n.insights_payload ?? {}, e = W(n), u = gt(n, e?.drilldown_data), y = z(b.detailedTransactions, u), p = ot(e), B = p?.count ?? u?.length ?? 0, m = !A && (u?.length ?? 0) > 0, G = p !== void 0 && m, d = tt(e, k), h = Z(e), C = m ? nt(e) : void 0, R = it(e?.variant).accountSubline ? (r) => /* @__PURE__ */ t(rt, {
|
|
29
|
+
institutionGuid: x.accounts.find(({ guid: s }) => s === r.account_guid)?.institution_guid,
|
|
30
|
+
transaction: r
|
|
31
|
+
}) : void 0, L = m ? et(e) : void 0, D = L ? (r) => {
|
|
32
|
+
const s = U(l, L.get(r.guid));
|
|
33
33
|
return s ? /* @__PURE__ */ t(ut, {
|
|
34
34
|
bold: !0,
|
|
35
35
|
color: "text.secondary",
|
|
@@ -37,55 +37,55 @@ var _t = (e) => Array.isArray(e) && e.every((n) => typeof n == "string"), gt = (
|
|
|
37
37
|
variant: "caption",
|
|
38
38
|
children: s
|
|
39
39
|
}) : null;
|
|
40
|
-
} : void 0, [_, v] = f.useState(null),
|
|
41
|
-
const s =
|
|
40
|
+
} : void 0, [_, v] = f.useState(null), M = e?.variant === Y.SUBSCRIPTION_LIST, j = (r) => {
|
|
41
|
+
const s = M ? y.find((q) => q.guid === r)?.repeating_transaction_guid : void 0;
|
|
42
42
|
if (s) {
|
|
43
43
|
v(s);
|
|
44
44
|
return;
|
|
45
45
|
}
|
|
46
|
-
c({ transaction_guid:
|
|
47
|
-
}, H = () => v(null),
|
|
46
|
+
c({ transaction_guid: r }), T(!0);
|
|
47
|
+
}, H = () => v(null), N = () => {
|
|
48
48
|
T(!1), c({ transaction_guid: void 0 });
|
|
49
49
|
};
|
|
50
50
|
return /* @__PURE__ */ mt(pt, { children: [
|
|
51
|
-
|
|
52
|
-
copy:
|
|
51
|
+
G && /* @__PURE__ */ t(lt, {
|
|
52
|
+
copy: i.general,
|
|
53
53
|
count: B,
|
|
54
54
|
summary: p
|
|
55
55
|
}),
|
|
56
|
-
|
|
57
|
-
copy:
|
|
58
|
-
header:
|
|
56
|
+
h && /* @__PURE__ */ t(st, {
|
|
57
|
+
copy: i.transaction_list_block,
|
|
58
|
+
header: h
|
|
59
59
|
}),
|
|
60
60
|
C && /* @__PURE__ */ t(ct, {
|
|
61
|
-
copy:
|
|
61
|
+
copy: i.transaction_list_block ?? {},
|
|
62
62
|
header: C,
|
|
63
|
-
tipTitle:
|
|
63
|
+
tipTitle: i.general.tip_section_title
|
|
64
64
|
}),
|
|
65
65
|
d && /* @__PURE__ */ t(at, {
|
|
66
66
|
descriptionHtml: d.descriptionHtml,
|
|
67
67
|
learnMoreLabel: d.learnMore?.label,
|
|
68
68
|
onLearnMore: () => S(!0),
|
|
69
|
-
title:
|
|
69
|
+
title: I ?? ""
|
|
70
70
|
}),
|
|
71
|
-
/* @__PURE__ */ t(
|
|
72
|
-
onClick:
|
|
71
|
+
/* @__PURE__ */ t(V, {
|
|
72
|
+
onClick: j,
|
|
73
73
|
renderAmountCaption: D,
|
|
74
|
-
renderSecondaryText:
|
|
75
|
-
transaction:
|
|
74
|
+
renderSecondaryText: R,
|
|
75
|
+
transaction: y
|
|
76
76
|
}),
|
|
77
77
|
d?.learnMore && /* @__PURE__ */ t(g, {
|
|
78
78
|
ariaLabelClose: a.close_aria,
|
|
79
|
-
isOpen:
|
|
79
|
+
isOpen: w,
|
|
80
80
|
onClose: () => S(!1),
|
|
81
81
|
title: d.learnMore.label,
|
|
82
82
|
children: /* @__PURE__ */ t(X, { beat: n })
|
|
83
83
|
}),
|
|
84
84
|
/* @__PURE__ */ t(g, {
|
|
85
85
|
ariaLabelClose: a.close_aria,
|
|
86
|
-
isOpen:
|
|
87
|
-
onClose:
|
|
88
|
-
title:
|
|
86
|
+
isOpen: O,
|
|
87
|
+
onClose: N,
|
|
88
|
+
title: i.general.transaction_details_title,
|
|
89
89
|
children: /* @__PURE__ */ t(J, { beat: n })
|
|
90
90
|
}),
|
|
91
91
|
/* @__PURE__ */ t(g, {
|
|
@@ -103,7 +103,7 @@ var _t = (e) => Array.isArray(e) && e.every((n) => typeof n == "string"), gt = (
|
|
|
103
103
|
] });
|
|
104
104
|
});
|
|
105
105
|
export {
|
|
106
|
-
|
|
106
|
+
jt as TransactionListBlock
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
//# sourceMappingURL=TransactionListBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAccountStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, Transaction } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../RecurringTransactionBlock'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { useOpenedCta } from '../useOpenedCta'\nimport { HelpBlock } from '../HelpBlock'\nimport { frequencyWord } from '../../components/SubscriptionStatus/subscriptionFrequency'\nimport {\n ACCOUNT_SUBLINE_VARIANTS,\n readCreditLimitHeader,\n readHelpHeader,\n readSubscriptionHeader,\n readSummary,\n readTransactionFrequencies,\n TRANSACTION_LIST_VARIANTS,\n} from './layout'\nimport { TransactionAccountSubline } from './TransactionAccountSubline'\nimport { TransactionListCreditLimitHeader } from './TransactionListCreditLimitHeader'\nimport { TransactionListHelpHeader } from './TransactionListHelpHeader'\nimport { TransactionListSubscriptionHeader } from './TransactionListSubscriptionHeader'\nimport { TransactionListSummaryCard } from './TransactionListSummaryCard'\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string')\n\n/**\n * The guids the drawer lists, from the first source that names them: the clicked CTA's own\n * `drilldown_data` (each drawer's data rides on the CTA that opens it), then the card-level\n * `drilldown_data`, then V1's `instance_slot_data`. The payload is untrusted, so a present but\n * malformed list fails closed (no rows, and a warning) rather than showing another source's rows; a\n * non-array would otherwise reach new Set() inside selectTransactionsByGuids and match per-character.\n */\nconst resolveTransactionGuids = (\n beat: Beat,\n ctaDrilldown: Record<string, unknown> | undefined,\n): string[] | undefined => {\n const drilldown = beat.insights_payload?.drilldown_data\n const slotData = (beat.insights_payload?.instance_slot_data ?? {}) as InsightsInstanceSlotData\n const [source, value]: [string, unknown] =\n ctaDrilldown && Object.hasOwn(ctaDrilldown, 'transaction_guids')\n ? ['cta.drilldown_data', ctaDrilldown.transaction_guids]\n : drilldown && Object.hasOwn(drilldown, 'transaction_guids')\n ? ['drilldown_data', drilldown.transaction_guids]\n : ['instance_slot_data', slotData.transaction_guids]\n\n if (value == null) return undefined\n if (isStringArray(value)) return value\n\n console.warn(\n `[TransactionListBlock] ${source}.transaction_guids is not a list of guids — listing no transactions.`,\n )\n return undefined\n}\n\n/** The shared Expense Details, with its own open-time load: the list's drawer only loads transactions. */\nconst SubscriptionExpenseDetails = (\n props: React.ComponentProps<typeof RecurringTransactionBlock>,\n) => {\n useRecurringTransactionPrepare(props)\n\n return <RecurringTransactionBlock {...props} />\n}\n\nexport interface TransactionListBlockProps {\n beat: Beat\n}\n\n/**\n * Opens a date-grouped list of the transactions a beat points at. Tapping a row stacks\n * the Transaction Details drawer over the list.\n *\n * ActionBlockLayer owns the outer Drawer (title, close button, copy-loaded gate).\n */\nexport const TransactionListBlock = observer(function TransactionListBlock({\n beat,\n}: TransactionListBlockProps) {\n const {\n common: commonCopy,\n insights_feed: insightsCopy,\n recurring: recurringCopy,\n } = useGlobalCopyStore()\n const { setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n const accountStore = useAccountStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n const [isHelpOpen, setIsHelpOpen] = React.useState(false)\n\n // The clicked CTA carries the drawer's own data (its guids, and the summary figures), so read\n // the CTA that opened this drawer first. `readSummary` fails closed (no finite `amount` -> undefined),\n // so a plain list renders no card. A zero-state envelope, or one naming no transactions, has no\n // figures to head.\n const { is_zero_state, drilldown_data, title } = beat.insights_payload ?? {}\n const currentCta = useOpenedCta(beat)\n\n const guids = resolveTransactionGuids(beat, currentCta?.drilldown_data)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\n const summary = readSummary(currentCta)\n // Count comes from the CTA's `drilldown_data`; fall back to the named guid count so the pill never\n // flashes \"0 transactions\" if the payload omits it.\n const count = summary?.count ?? guids?.length ?? 0\n // One answer for \"lists something\", so the header, summary and captions never disagree.\n const hasRows = !is_zero_state && (guids?.length ?? 0) > 0\n const showSummary = summary !== undefined && hasRows\n const helpHeader = readHelpHeader(currentCta, drilldown_data)\n const creditLimitHeader = readCreditLimitHeader(currentCta)\n const subscriptionHeader = hasRows ? readSubscriptionHeader(currentCta) : undefined\n\n // Account-subtitled drawers (Figma: the Replenish Savings and Monthly Subscription Aggregate V2 drilldowns).\n const renderSecondaryText = ACCOUNT_SUBLINE_VARIANTS.has(currentCta?.variant)\n ? (transaction: Transaction) => (\n <TransactionAccountSubline\n institutionGuid={\n accountStore.accounts.find(({ guid }) => guid === transaction.account_guid)\n ?.institution_guid\n }\n transaction={transaction}\n />\n )\n : undefined\n\n // Each amount is captioned with its merchant's schedule, worded from the host's `recurring` copy.\n const frequencies = hasRows ? readTransactionFrequencies(currentCta) : undefined\n const renderAmountCaption = frequencies\n ? (transaction: Transaction) => {\n const word = frequencyWord(recurringCopy, frequencies.get(transaction.guid))\n\n return word ? (\n <Text\n bold={true}\n color=\"text.secondary\"\n sx={{ textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {word}\n </Text>\n ) : null\n }\n : undefined\n\n // A subscription row opens its schedule's Expense Details; any other row, Transaction Details.\n const [expenseGuid, setExpenseGuid] = React.useState<string | null>(null)\n const isSubscriptionList = currentCta?.variant === TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST\n\n const handleRowClick = (guid: string) => {\n const repeatingGuid = isSubscriptionList\n ? transactions.find((transaction) => transaction.guid === guid)?.repeating_transaction_guid\n : undefined\n\n if (repeatingGuid) {\n setExpenseGuid(repeatingGuid)\n return\n }\n\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const closeExpenseDetails = () => setExpenseGuid(null)\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n // Clear only the key this nested drawer owns — same convention as TransactionHistoryBlock.\n // `setActionContext` merges, so an explicit `{}` would be a no-op; naming the key keeps the\n // outer drawer's own context intact.\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n {showSummary && (\n <TransactionListSummaryCard copy={insightsCopy.general} count={count} summary={summary} />\n )}\n {creditLimitHeader && (\n <TransactionListCreditLimitHeader\n copy={insightsCopy.transaction_list_block}\n header={creditLimitHeader}\n />\n )}\n {subscriptionHeader && (\n <TransactionListSubscriptionHeader\n copy={insightsCopy.transaction_list_block ?? {}}\n header={subscriptionHeader}\n tipTitle={insightsCopy.general.tip_section_title}\n />\n )}\n {helpHeader && (\n <TransactionListHelpHeader\n descriptionHtml={helpHeader.descriptionHtml}\n learnMoreLabel={helpHeader.learnMore?.label}\n onLearnMore={() => setIsHelpOpen(true)}\n title={title ?? ''}\n />\n )}\n <TransactionList\n onClick={handleRowClick}\n renderAmountCaption={renderAmountCaption}\n renderSecondaryText={renderSecondaryText}\n transaction={transactions}\n />\n {helpHeader?.learnMore && (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n title={helpHeader.learnMore.label}\n >\n <HelpBlock beat={beat} />\n </Drawer>\n )}\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n <Drawer\n ariaLabelClose={recurringCopy.close_drawer_aria}\n isOpen={expenseGuid !== null}\n onClose={closeExpenseDetails}\n title={recurringCopy.expense_details}\n >\n {expenseGuid && (\n <SubscriptionExpenseDetails\n beat={beat}\n layout=\"insights\"\n onDeleted={closeExpenseDetails}\n repeatingTransactionGuid={expenseGuid}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,KAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,KAAA,CACJ,GACA,MACyB;AACzB,QAAM,IAAY,EAAK,kBAAkB,gBACnC,IAAY,EAAK,kBAAkB,sBAAsB,CAAC,GAC1D,CAAC,GAAQ,CAAA,IACb,KAAgB,OAAO,OAAO,GAAc,mBAAmB,IAC3D,CAAC,sBAAsB,EAAa,iBAAiB,IACrD,KAAa,OAAO,OAAO,GAAW,mBAAmB,IACvD,CAAC,kBAAkB,EAAU,iBAAiB,IAC9C,CAAC,sBAAsB,EAAS,iBAAiB;AAEzD,MAAI,KAAS,MACb;AAAA,QAAI,GAAc,CAAK,EAAG,QAAO;AAEjC,YAAQ,KACN,0BAA0B,CAAA,sEAC5B;AAAA;AAEF,GAGM,KAAA,CACJ,OAEA,EAA+B,CAAK,GAE7B,gBAAA,EAAC,GAAD,EAA2B,GAAI,EAAQ,CAAA,IAanC,KAAuB,GAAS,SAA8B,EACzE,MAAA,EAAA,GAC4B;AAC5B,QAAM,EACJ,QAAQ,GACR,eAAe,GACf,WAAW,EAAA,IACT,EAAmB,GACjB,EAAE,kBAAA,EAAA,IAAqB,EAAmB,GAC1C,IAAmB,EAAoB,GACvC,IAAe,EAAgB,GAE/B,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;AAAA,MAC3B,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,EAAa,QAAQ;AAAA,MAE5B,UAAA,gBAAA,EAAC,GAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,IAChC,CAAA;AAAA,IACR,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAc;AAAA,MAC9B,QAAQ,MAAgB;AAAA,MACxB,SAAS;AAAA,MACT,OAAO,EAAc;AAAA,MAEpB,UAAA,KACC,gBAAA,EAAC,IAAD;AAAA,QACQ,MAAA;AAAA,QACN,QAAO;AAAA,QACP,WAAW;AAAA,QACX,0BAA0B;AAAA,MAC3B,CAAA;AAAA,IAEG,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
|
|
1
|
+
{"version":3,"file":"TransactionListBlock.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionListBlock/TransactionListBlock.tsx"],"sourcesContent":["import React from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAccountStore,\n useGlobalCopyStore,\n useInsightsV2Store,\n useTransactionStore,\n} from '../../../common'\nimport type { Beat, Transaction } from '../../../core'\nimport type { InsightsInstanceSlotData } from '../../../core/types/InsightsInstanceSlotData'\nimport {\n RecurringTransactionBlock,\n useRecurringTransactionPrepare,\n} from '../RecurringTransactionBlock'\nimport { TransactionDetailsBlock } from '../TransactionDetailsBlock'\nimport { TransactionList } from '../../../transactions'\nimport { selectTransactionsByGuids } from '../../CommonUtils'\nimport { useOpenedCta } from '../useOpenedCta'\nimport { HelpBlock } from '../HelpBlock'\nimport { frequencyWord } from '../../components/SubscriptionStatus/subscriptionFrequency'\nimport {\n readCreditLimitHeader,\n readHelpHeader,\n readSubscriptionHeader,\n readSummary,\n readTransactionFrequencies,\n TRANSACTION_LIST_VARIANTS,\n transactionListLayout,\n} from './layout'\nimport { TransactionAccountSubline } from './TransactionAccountSubline'\nimport { TransactionListCreditLimitHeader } from './TransactionListCreditLimitHeader'\nimport { TransactionListHelpHeader } from './TransactionListHelpHeader'\nimport { TransactionListSubscriptionHeader } from './TransactionListSubscriptionHeader'\nimport { TransactionListSummaryCard } from './TransactionListSummaryCard'\n\nconst isStringArray = (value: unknown): value is string[] =>\n Array.isArray(value) && value.every((item) => typeof item === 'string')\n\n/**\n * The guids the drawer lists, from the first source that names them: the clicked CTA's own\n * `drilldown_data` (each drawer's data rides on the CTA that opens it), then the card-level\n * `drilldown_data`, then V1's `instance_slot_data`. The payload is untrusted, so a present but\n * malformed list fails closed (no rows, and a warning) rather than showing another source's rows; a\n * non-array would otherwise reach new Set() inside selectTransactionsByGuids and match per-character.\n */\nconst resolveTransactionGuids = (\n beat: Beat,\n ctaDrilldown: Record<string, unknown> | undefined,\n): string[] | undefined => {\n const drilldown = beat.insights_payload?.drilldown_data\n const slotData = (beat.insights_payload?.instance_slot_data ?? {}) as InsightsInstanceSlotData\n const [source, value]: [string, unknown] =\n ctaDrilldown && Object.hasOwn(ctaDrilldown, 'transaction_guids')\n ? ['cta.drilldown_data', ctaDrilldown.transaction_guids]\n : drilldown && Object.hasOwn(drilldown, 'transaction_guids')\n ? ['drilldown_data', drilldown.transaction_guids]\n : ['instance_slot_data', slotData.transaction_guids]\n\n if (value == null) return undefined\n if (isStringArray(value)) return value\n\n console.warn(\n `[TransactionListBlock] ${source}.transaction_guids is not a list of guids — listing no transactions.`,\n )\n return undefined\n}\n\n/** The shared Expense Details, with its own open-time load: the list's drawer only loads transactions. */\nconst SubscriptionExpenseDetails = (\n props: React.ComponentProps<typeof RecurringTransactionBlock>,\n) => {\n useRecurringTransactionPrepare(props)\n\n return <RecurringTransactionBlock {...props} />\n}\n\nexport interface TransactionListBlockProps {\n beat: Beat\n}\n\n/**\n * Opens a date-grouped list of the transactions a beat points at. Tapping a row stacks\n * the Transaction Details drawer over the list.\n *\n * ActionBlockLayer owns the outer Drawer (title, close button, copy-loaded gate).\n */\nexport const TransactionListBlock = observer(function TransactionListBlock({\n beat,\n}: TransactionListBlockProps) {\n const {\n common: commonCopy,\n insights_feed: insightsCopy,\n recurring: recurringCopy,\n } = useGlobalCopyStore()\n const { setActionContext } = useInsightsV2Store()\n const transactionStore = useTransactionStore()\n const accountStore = useAccountStore()\n\n const [isDetailsOpen, setIsDetailsOpen] = React.useState(false)\n const [isHelpOpen, setIsHelpOpen] = React.useState(false)\n\n // The clicked CTA carries the drawer's own data (its guids, and the summary figures), so read\n // the CTA that opened this drawer first. `readSummary` fails closed (no finite `amount` -> undefined),\n // so a plain list renders no card. A zero-state envelope, or one naming no transactions, has no\n // figures to head.\n const { is_zero_state, drilldown_data, title } = beat.insights_payload ?? {}\n const currentCta = useOpenedCta(beat)\n\n const guids = resolveTransactionGuids(beat, currentCta?.drilldown_data)\n const transactions = selectTransactionsByGuids(transactionStore.detailedTransactions, guids)\n const summary = readSummary(currentCta)\n // Count comes from the CTA's `drilldown_data`; fall back to the named guid count so the pill never\n // flashes \"0 transactions\" if the payload omits it.\n const count = summary?.count ?? guids?.length ?? 0\n // One answer for \"lists something\", so the header, summary and captions never disagree.\n const hasRows = !is_zero_state && (guids?.length ?? 0) > 0\n const showSummary = summary !== undefined && hasRows\n const helpHeader = readHelpHeader(currentCta, drilldown_data)\n const creditLimitHeader = readCreditLimitHeader(currentCta)\n const subscriptionHeader = hasRows ? readSubscriptionHeader(currentCta) : undefined\n\n // Account-subtitled drawers (Figma: the Replenish Savings and Monthly Subscription Aggregate V2 drilldowns).\n const renderSecondaryText = transactionListLayout(currentCta?.variant).accountSubline\n ? (transaction: Transaction) => (\n <TransactionAccountSubline\n institutionGuid={\n accountStore.accounts.find(({ guid }) => guid === transaction.account_guid)\n ?.institution_guid\n }\n transaction={transaction}\n />\n )\n : undefined\n\n // Each amount is captioned with its merchant's schedule, worded from the host's `recurring` copy.\n const frequencies = hasRows ? readTransactionFrequencies(currentCta) : undefined\n const renderAmountCaption = frequencies\n ? (transaction: Transaction) => {\n const word = frequencyWord(recurringCopy, frequencies.get(transaction.guid))\n\n return word ? (\n <Text\n bold={true}\n color=\"text.secondary\"\n sx={{ textTransform: 'uppercase' }}\n variant=\"caption\"\n >\n {word}\n </Text>\n ) : null\n }\n : undefined\n\n // A subscription row opens its schedule's Expense Details; any other row, Transaction Details.\n const [expenseGuid, setExpenseGuid] = React.useState<string | null>(null)\n const isSubscriptionList = currentCta?.variant === TRANSACTION_LIST_VARIANTS.SUBSCRIPTION_LIST\n\n const handleRowClick = (guid: string) => {\n const repeatingGuid = isSubscriptionList\n ? transactions.find((transaction) => transaction.guid === guid)?.repeating_transaction_guid\n : undefined\n\n if (repeatingGuid) {\n setExpenseGuid(repeatingGuid)\n return\n }\n\n setActionContext({ transaction_guid: guid })\n setIsDetailsOpen(true)\n }\n\n const closeExpenseDetails = () => setExpenseGuid(null)\n\n const handleDetailsClose = () => {\n setIsDetailsOpen(false)\n // Clear only the key this nested drawer owns — same convention as TransactionHistoryBlock.\n // `setActionContext` merges, so an explicit `{}` would be a no-op; naming the key keeps the\n // outer drawer's own context intact.\n setActionContext({ transaction_guid: undefined })\n }\n\n return (\n <>\n {showSummary && (\n <TransactionListSummaryCard copy={insightsCopy.general} count={count} summary={summary} />\n )}\n {creditLimitHeader && (\n <TransactionListCreditLimitHeader\n copy={insightsCopy.transaction_list_block}\n header={creditLimitHeader}\n />\n )}\n {subscriptionHeader && (\n <TransactionListSubscriptionHeader\n copy={insightsCopy.transaction_list_block ?? {}}\n header={subscriptionHeader}\n tipTitle={insightsCopy.general.tip_section_title}\n />\n )}\n {helpHeader && (\n <TransactionListHelpHeader\n descriptionHtml={helpHeader.descriptionHtml}\n learnMoreLabel={helpHeader.learnMore?.label}\n onLearnMore={() => setIsHelpOpen(true)}\n title={title ?? ''}\n />\n )}\n <TransactionList\n onClick={handleRowClick}\n renderAmountCaption={renderAmountCaption}\n renderSecondaryText={renderSecondaryText}\n transaction={transactions}\n />\n {helpHeader?.learnMore && (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isHelpOpen}\n onClose={() => setIsHelpOpen(false)}\n title={helpHeader.learnMore.label}\n >\n <HelpBlock beat={beat} />\n </Drawer>\n )}\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isDetailsOpen}\n onClose={handleDetailsClose}\n title={insightsCopy.general.transaction_details_title}\n >\n <TransactionDetailsBlock beat={beat} />\n </Drawer>\n <Drawer\n ariaLabelClose={recurringCopy.close_drawer_aria}\n isOpen={expenseGuid !== null}\n onClose={closeExpenseDetails}\n title={recurringCopy.expense_details}\n >\n {expenseGuid && (\n <SubscriptionExpenseDetails\n beat={beat}\n layout=\"insights\"\n onDeleted={closeExpenseDetails}\n repeatingTransactionGuid={expenseGuid}\n />\n )}\n </Drawer>\n </>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,KAAA,CAAiB,MACrB,MAAM,QAAQ,CAAK,KAAK,EAAM,MAAA,CAAO,MAAS,OAAO,KAAS,QAAQ,GASlE,KAAA,CACJ,GACA,MACyB;AACzB,QAAM,IAAY,EAAK,kBAAkB,gBACnC,IAAY,EAAK,kBAAkB,sBAAsB,CAAC,GAC1D,CAAC,GAAQ,CAAA,IACb,KAAgB,OAAO,OAAO,GAAc,mBAAmB,IAC3D,CAAC,sBAAsB,EAAa,iBAAiB,IACrD,KAAa,OAAO,OAAO,GAAW,mBAAmB,IACvD,CAAC,kBAAkB,EAAU,iBAAiB,IAC9C,CAAC,sBAAsB,EAAS,iBAAiB;AAEzD,MAAI,KAAS,MACb;AAAA,QAAI,GAAc,CAAK,EAAG,QAAO;AAEjC,YAAQ,KACN,0BAA0B,CAAA,sEAC5B;AAAA;AAEF,GAGM,KAAA,CACJ,OAEA,EAA+B,CAAK,GAE7B,gBAAA,EAAC,GAAD,EAA2B,GAAI,EAAQ,CAAA,IAanC,KAAuB,GAAS,SAA8B,EACzE,MAAA,EAAA,GAC4B;AAC5B,QAAM,EACJ,QAAQ,GACR,eAAe,GACf,WAAW,EAAA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AD,EAAiB,MAAA,EAAO,CAAA;AAAA,IAClB,CAAA;AAAA,IAEV,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAW;AAAA,MAC3B,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,OAAO,EAAa,QAAQ;AAAA,MAE5B,UAAA,gBAAA,EAAC,GAAD,EAA+B,MAAA,EAAO,CAAA;AAAA,IAChC,CAAA;AAAA,IACR,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAc;AAAA,MAC9B,QAAQ,MAAgB;AAAA,MACxB,SAAS;AAAA,MACT,OAAO,EAAc;AAAA,MAEpB,UAAA,KACC,gBAAA,EAAC,IAAD;AAAA,QACQ,MAAA;AAAA,QACN,QAAO;AAAA,QACP,WAAW;AAAA,QACX,0BAA0B;AAAA,MAC3B,CAAA;AAAA,IAEG,CAAA;AAAA,EACR,EAAA,CAAA;AAEN,CAAC"}
|
package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.d.ts
CHANGED
|
@@ -4,8 +4,6 @@ export interface TransactionListCreditLimitHeaderProps {
|
|
|
4
4
|
header: CreditLimitHeader;
|
|
5
5
|
copy?: TransactionListBlockCopy;
|
|
6
6
|
}
|
|
7
|
-
/** The Spending list's credit-limit header: card, balance, limit and
|
|
8
|
-
export declare const TransactionListCreditLimitHeader: (
|
|
9
|
-
displayName: string;
|
|
10
|
-
};
|
|
7
|
+
/** The Spending list's credit-limit header: card, balance, limit and how much of the limit is used. */
|
|
8
|
+
export declare const TransactionListCreditLimitHeader: ({ copy, header, }: TransactionListCreditLimitHeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
9
|
export default TransactionListCreditLimitHeader;
|
package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListCreditLimitHeader.es.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import w from "../../components/LogoFromGuid.es.js";
|
|
5
|
-
import { resolveCreditLimitAlertPercent as C } from "../AmountInputModalBlock/layout.es.js";
|
|
6
|
-
import { observer as $ } from "mobx-react-lite";
|
|
1
|
+
import { buildDynamicCopy as b } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as s, formatCurrency as h } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import f from "../../components/LogoFromGuid.es.js";
|
|
7
4
|
import r from "@mui/material/Stack";
|
|
8
5
|
import { Text as e } from "@mxenabled/mxui";
|
|
9
6
|
import { jsx as i, jsxs as t } from "react/jsx-runtime";
|
|
10
|
-
import
|
|
11
|
-
var
|
|
12
|
-
const {
|
|
7
|
+
import l from "@mui/material/Box";
|
|
8
|
+
var G = ({ copy: a, header: u }) => {
|
|
9
|
+
const { accountName: d, balance: x, institutionGuid: c, institutionName: p, limit: g, utilization: o } = u, m = Math.min(o, 100), n = a?.credit_limit_header_utilization ? b(a.credit_limit_header_utilization, `${o}%`) : void 0;
|
|
13
10
|
return /* @__PURE__ */ t(r, {
|
|
14
11
|
"data-testid": "credit-limit-header",
|
|
15
12
|
sx: {
|
|
@@ -27,10 +24,10 @@ var k = $(function({ copy: a, header: x }) {
|
|
|
27
24
|
flexDirection: "row",
|
|
28
25
|
gap: 12
|
|
29
26
|
},
|
|
30
|
-
children: [/* @__PURE__ */ i(
|
|
31
|
-
logo:
|
|
32
|
-
guid:
|
|
33
|
-
alt:
|
|
27
|
+
children: [/* @__PURE__ */ i(f, {
|
|
28
|
+
logo: c ? {
|
|
29
|
+
guid: c,
|
|
30
|
+
alt: p
|
|
34
31
|
} : null,
|
|
35
32
|
size: 40
|
|
36
33
|
}), /* @__PURE__ */ t(r, {
|
|
@@ -50,7 +47,7 @@ var k = $(function({ copy: a, header: x }) {
|
|
|
50
47
|
bold: !0,
|
|
51
48
|
truncate: !0,
|
|
52
49
|
variant: "body1",
|
|
53
|
-
children:
|
|
50
|
+
children: d ?? ""
|
|
54
51
|
}), a?.credit_limit_header_credit_limit && /* @__PURE__ */ i(e, {
|
|
55
52
|
color: "text.secondary",
|
|
56
53
|
variant: "body2",
|
|
@@ -65,74 +62,51 @@ var k = $(function({ copy: a, header: x }) {
|
|
|
65
62
|
children: [/* @__PURE__ */ i(e, {
|
|
66
63
|
bold: !0,
|
|
67
64
|
variant: "body1",
|
|
68
|
-
children:
|
|
65
|
+
children: h(x, s.cents)
|
|
69
66
|
}), /* @__PURE__ */ i(e, {
|
|
70
67
|
color: "text.secondary",
|
|
71
68
|
variant: "body2",
|
|
72
|
-
children:
|
|
69
|
+
children: h(g, s.cents)
|
|
73
70
|
})]
|
|
74
71
|
})]
|
|
75
72
|
})]
|
|
76
73
|
}), /* @__PURE__ */ t(r, {
|
|
77
74
|
sx: { gap: 2 },
|
|
78
|
-
children: [
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
},
|
|
104
|
-
children: [/* @__PURE__ */ i(n, {
|
|
105
|
-
"aria-hidden": !0,
|
|
106
|
-
sx: {
|
|
107
|
-
bgcolor: "divider",
|
|
108
|
-
height: 8,
|
|
109
|
-
left: `${o}%`,
|
|
110
|
-
position: "absolute",
|
|
111
|
-
transform: `translateX(-${o}%)`,
|
|
112
|
-
width: "1px"
|
|
113
|
-
}
|
|
114
|
-
}), /* @__PURE__ */ i(e, {
|
|
115
|
-
sx: {
|
|
116
|
-
left: `${o}%`,
|
|
117
|
-
position: "absolute",
|
|
118
|
-
top: 8,
|
|
119
|
-
transform: `translateX(-${o}%)`
|
|
120
|
-
},
|
|
121
|
-
variant: "caption",
|
|
122
|
-
children: `${o}%`
|
|
123
|
-
})]
|
|
124
|
-
}),
|
|
125
|
-
d && /* @__PURE__ */ i(e, {
|
|
75
|
+
children: [/* @__PURE__ */ i(l, {
|
|
76
|
+
"aria-label": d ?? n,
|
|
77
|
+
"aria-valuemax": 100,
|
|
78
|
+
"aria-valuemin": 0,
|
|
79
|
+
"aria-valuenow": m,
|
|
80
|
+
"aria-valuetext": `${o}%`,
|
|
81
|
+
role: "meter",
|
|
82
|
+
sx: {
|
|
83
|
+
bgcolor: "neutral.light",
|
|
84
|
+
borderRadius: "4px",
|
|
85
|
+
height: 12,
|
|
86
|
+
overflow: "hidden"
|
|
87
|
+
},
|
|
88
|
+
children: /* @__PURE__ */ i(l, { sx: {
|
|
89
|
+
bgcolor: "warning.main",
|
|
90
|
+
borderRadius: "4px",
|
|
91
|
+
height: "100%",
|
|
92
|
+
width: `${m}%`
|
|
93
|
+
} })
|
|
94
|
+
}), /* @__PURE__ */ i(l, {
|
|
95
|
+
sx: {
|
|
96
|
+
height: 24,
|
|
97
|
+
pt: 4
|
|
98
|
+
},
|
|
99
|
+
children: n && /* @__PURE__ */ i(e, {
|
|
126
100
|
variant: "caption",
|
|
127
|
-
children:
|
|
101
|
+
children: n
|
|
128
102
|
})
|
|
129
|
-
]
|
|
103
|
+
})]
|
|
130
104
|
})]
|
|
131
105
|
});
|
|
132
|
-
}
|
|
106
|
+
};
|
|
133
107
|
export {
|
|
134
|
-
|
|
135
|
-
|
|
108
|
+
G as TransactionListCreditLimitHeader,
|
|
109
|
+
G as default
|
|
136
110
|
};
|
|
137
111
|
|
|
138
112
|
//# sourceMappingURL=TransactionListCreditLimitHeader.es.js.map
|