@mx-cartographer/experiences 9.7.174 → 9.7.176
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/core/types/localization/InsightsFeedCopy.d.ts +20 -0
- package/dist/core/types/localization/index.d.ts +1 -1
- package/dist/goals/components/actions/AmountToSaveAction.es.js +20 -19
- package/dist/goals/components/actions/AmountToSaveAction.es.js.map +1 -1
- package/dist/goals/components/actions/ContributionAction.es.js +20 -19
- package/dist/goals/components/actions/ContributionAction.es.js.map +1 -1
- package/dist/goals/components/actions/MonthlyPaymentAction.es.js +3 -2
- package/dist/goals/components/actions/MonthlyPaymentAction.es.js.map +1 -1
- package/dist/goals/components/actions/OriginalBalanceAction.es.js +4 -3
- package/dist/goals/components/actions/OriginalBalanceAction.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.d.ts +11 -0
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js +164 -0
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/index.d.ts +1 -0
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.d.ts +46 -0
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.es.js +58 -0
- package/dist/insights-v2/actionBlocks/TopMerchantsBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +2 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +72 -56
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.d.ts +7 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +84 -82
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +4 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +169 -133
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +2 -0
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +148 -140
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { asNonEmptyText as n, asNumber as o } from "../../blocks/slotReaders.es.js";
|
|
2
|
+
import { actionBlocksKey as d } from "../../mappings/actionBlocksKey.es.js";
|
|
3
|
+
import { DRILLDOWN_VARIANTS as u } from "../TransactionHistoryBlock/layout.es.js";
|
|
4
|
+
var m = (r) => typeof r == "object" && r !== null && !Array.isArray(r), y = (r) => m(r) && Array.isArray(r.names) && Array.isArray(r.data) && r.data.every(Array.isArray), _ = (r) => {
|
|
5
|
+
if (!m(r)) return;
|
|
6
|
+
const e = n(r.merchant_guid), a = n(r.merchant_name), t = o(r.total);
|
|
7
|
+
if (!(!e || !a || t === void 0))
|
|
8
|
+
return {
|
|
9
|
+
merchantGuid: e,
|
|
10
|
+
merchantName: a,
|
|
11
|
+
categoryGuid: n(r.category_guid),
|
|
12
|
+
total: t,
|
|
13
|
+
transactionCount: o(r.transaction_count) ?? 0,
|
|
14
|
+
averageAmount: o(r.average_amount)
|
|
15
|
+
};
|
|
16
|
+
}, l = (r) => {
|
|
17
|
+
const e = (Array.isArray(r?.merchants) ? r.merchants : []).map(_).filter((a) => a !== void 0).sort((a, t) => t.total - a.total).slice(0, 10).map((a, t) => ({
|
|
18
|
+
...a,
|
|
19
|
+
rank: t + 1
|
|
20
|
+
}));
|
|
21
|
+
return {
|
|
22
|
+
describedMonth: n(r?.described_month),
|
|
23
|
+
totalAmount: o(r?.total_amount) ?? e.reduce((a, { total: t }) => a + t, 0),
|
|
24
|
+
merchants: e,
|
|
25
|
+
merchantHistory: y(r?.merchant_history) ? r.merchant_history : void 0
|
|
26
|
+
};
|
|
27
|
+
}, A = (r, e) => {
|
|
28
|
+
const a = r?.names ?? [], t = r?.data ?? [], i = a.indexOf("date"), s = a.indexOf(e);
|
|
29
|
+
if (!(i < 0 || s < 0))
|
|
30
|
+
return {
|
|
31
|
+
names: ["date", "amount"],
|
|
32
|
+
types: ["date", "currency"],
|
|
33
|
+
data: t.map((c) => [c[i], c[s]])
|
|
34
|
+
};
|
|
35
|
+
}, p = (r, e, a) => {
|
|
36
|
+
const t = A(e, r.merchantGuid);
|
|
37
|
+
return {
|
|
38
|
+
label: "",
|
|
39
|
+
block: d.TRANSCATION_HISTORY_ACTION_BLOCK,
|
|
40
|
+
variant: u.TOP_MERCHANT,
|
|
41
|
+
drilldown_data: {
|
|
42
|
+
merchant_guid: r.merchantGuid,
|
|
43
|
+
merchant_name: r.merchantName,
|
|
44
|
+
rank: r.rank,
|
|
45
|
+
...a && { described_month: a },
|
|
46
|
+
...r.categoryGuid && { category_guid: r.categoryGuid },
|
|
47
|
+
...r.averageAmount !== void 0 && { average_amount: r.averageAmount },
|
|
48
|
+
...t && { data_series: t }
|
|
49
|
+
}
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
export {
|
|
53
|
+
p as merchantHistoryCta,
|
|
54
|
+
A as merchantSeries,
|
|
55
|
+
l as readTopMerchants
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=layout.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TopMerchantsBlock/layout.ts"],"sourcesContent":["import type { DataSeries, DrilldownData, PrimaryCTA } from '../../../core'\nimport { asNonEmptyText, asNumber } from '../../blocks/slotReaders'\nimport { actionBlocksKey } from '../../mappings/actionBlocksKey'\nimport { DRILLDOWN_VARIANTS } from '../TransactionHistoryBlock/layout'\n\n/** The drawer lists at most this many merchants (Figma: \"Top 10 list\"). */\nexport const TOP_MERCHANTS_MAX = 10\n\n/** One ranked merchant in the Top Merchants drawer. */\nexport interface TopMerchant {\n /** 1-based place in the month's ranking. */\n rank: number\n merchantGuid: string\n merchantName: string\n categoryGuid?: string\n total: number\n transactionCount: number\n averageAmount?: number\n}\n\nexport interface TopMerchantsData {\n /** The month the ranking covers, `YYYY-MM-DD`. */\n describedMonth?: string\n /** The headline amount: the payload's total, else the sum of the listed merchants. */\n totalAmount: number\n merchants: TopMerchant[]\n /** Six months of spend, one column per merchant guid (`names: ['date', ...guids]`). */\n merchantHistory?: DataSeries\n}\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === 'object' && value !== null && !Array.isArray(value)\n\nconst isDataSeries = (value: unknown): value is DataSeries =>\n isRecord(value) &&\n Array.isArray(value.names) &&\n Array.isArray(value.data) &&\n value.data.every(Array.isArray)\n\nconst readMerchant = (row: unknown): Omit<TopMerchant, 'rank'> | undefined => {\n if (!isRecord(row)) return undefined\n\n const merchantGuid = asNonEmptyText(row.merchant_guid)\n const merchantName = asNonEmptyText(row.merchant_name)\n const total = asNumber(row.total)\n\n // A row the drawer cannot name or price is dropped rather than drawn half-empty.\n if (!merchantGuid || !merchantName || total === undefined) return undefined\n\n return {\n merchantGuid,\n merchantName,\n categoryGuid: asNonEmptyText(row.category_guid),\n total,\n transactionCount: asNumber(row.transaction_count) ?? 0,\n averageAmount: asNumber(row.average_amount),\n }\n}\n\n/**\n * The Top Merchants drawer's facts, from the drilldown_data of the CTA that opened it (proposed\n * contract, pending tupac/ditto):\n *\n * ```\n * {\n * total_amount: 2350,\n * described_month: '2026-06-01',\n * merchants: [{ merchant_guid, merchant_name, category_guid, total, transaction_count, average_amount }],\n * merchant_history: { names: ['date', 'MCH-…', …], types: ['date', 'currency', …], data: [['2026-01-01', 12.5, …], …] },\n * }\n * ```\n *\n * Merchants are ranked by total, highest first, and capped at ten.\n */\nexport const readTopMerchants = (data?: DrilldownData): TopMerchantsData => {\n const rows = Array.isArray(data?.merchants) ? data.merchants : []\n const merchants = rows\n .map(readMerchant)\n .filter((merchant): merchant is Omit<TopMerchant, 'rank'> => merchant !== undefined)\n .sort((a, b) => b.total - a.total)\n .slice(0, TOP_MERCHANTS_MAX)\n .map((merchant, index) => ({ ...merchant, rank: index + 1 }))\n\n return {\n describedMonth: asNonEmptyText(data?.described_month),\n totalAmount:\n asNumber(data?.total_amount) ?? merchants.reduce((sum, { total }) => sum + total, 0),\n merchants,\n merchantHistory: isDataSeries(data?.merchant_history) ? data.merchant_history : undefined,\n }\n}\n\n/** One merchant's column of the shared history, as the two-column series a bar chart reads. */\nexport const merchantSeries = (\n history: DataSeries | undefined,\n merchantGuid: string,\n): DataSeries | undefined => {\n const names = history?.names ?? []\n const rows = history?.data ?? []\n const dateIndex = names.indexOf('date')\n const amountIndex = names.indexOf(merchantGuid)\n\n if (dateIndex < 0 || amountIndex < 0) return undefined\n\n return {\n names: ['date', 'amount'],\n types: ['date', 'currency'],\n data: rows.map((row) => [row[dateIndex], row[amountIndex]]),\n } as DataSeries\n}\n\n/**\n * The CTA a row hands the nested Merchant History drawer: Transaction History's `top_merchant`\n * variant, fed the merchant's own six months, average, category, rank, and the described month.\n */\nexport const merchantHistoryCta = (\n merchant: TopMerchant,\n history: DataSeries | undefined,\n describedMonth?: string,\n): PrimaryCTA => {\n const dataSeries = merchantSeries(history, merchant.merchantGuid)\n\n return {\n label: '',\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n variant: DRILLDOWN_VARIANTS.TOP_MERCHANT,\n drilldown_data: {\n merchant_guid: merchant.merchantGuid,\n merchant_name: merchant.merchantName,\n rank: merchant.rank,\n ...(describedMonth && { described_month: describedMonth }),\n ...(merchant.categoryGuid && { category_guid: merchant.categoryGuid }),\n ...(merchant.averageAmount !== undefined && { average_amount: merchant.averageAmount }),\n ...(dataSeries && { data_series: dataSeries }),\n },\n }\n}\n"],"mappings":";;;AA8BA,IAAM,IAAA,CAAY,MAChB,OAAO,KAAU,YAAY,MAAU,QAAQ,CAAC,MAAM,QAAQ,CAAK,GAE/D,IAAA,CAAgB,MACpB,EAAS,CAAK,KACd,MAAM,QAAQ,EAAM,KAAK,KACzB,MAAM,QAAQ,EAAM,IAAI,KACxB,EAAM,KAAK,MAAM,MAAM,OAAO,GAE1B,IAAA,CAAgB,MAAwD;AAC5E,MAAI,CAAC,EAAS,CAAG,EAAG;AAEpB,QAAM,IAAe,EAAe,EAAI,aAAa,GAC/C,IAAe,EAAe,EAAI,aAAa,GAC/C,IAAQ,EAAS,EAAI,KAAK;AAGhC,MAAI,GAAC,KAAgB,CAAC,KAAgB,MAAU;AAEhD,WAAO;AAAA,MACL,cAAA;AAAA,MACA,cAAA;AAAA,MACA,cAAc,EAAe,EAAI,aAAa;AAAA,MAC9C,OAAA;AAAA,MACA,kBAAkB,EAAS,EAAI,iBAAiB,KAAK;AAAA,MACrD,eAAe,EAAS,EAAI,cAAc;AAAA,IAC5C;AACF,GAiBa,IAAA,CAAoB,MAA2C;AAE1E,QAAM,KADO,MAAM,QAAQ,GAAM,SAAS,IAAI,EAAK,YAAY,CAAC,GAE7D,IAAI,CAAY,EAChB,OAAA,CAAQ,MAAoD,MAAa,MAAS,EAClF,KAAA,CAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,KAAK,EAChC,MAAM,GAAA,EAAoB,EAC1B,IAAA,CAAK,GAAU,OAAW;AAAA,IAAE,GAAG;AAAA,IAAU,MAAM,IAAQ;AAAA,EAAE,EAAE;AAE9D,SAAO;AAAA,IACL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
|
14
|
+
logo?: React.ReactNode;
|
|
14
15
|
tabs?: TabItem[];
|
|
15
16
|
selectedIndex: number;
|
|
16
17
|
top: React.ReactNode;
|
|
@@ -21,7 +22,7 @@ interface TransactionDrillDownProps {
|
|
|
21
22
|
baseTransactions?: Transaction[];
|
|
22
23
|
subTabs?: Omit<SubTabsProps, 'id'>;
|
|
23
24
|
}
|
|
24
|
-
export declare const TransactionDrillDown: (({ ariaLabel, heading, subHeadingText, icon, tabs, selectedIndex, top, onSelectionChange, transactionFilter, tipSection, onEachRowClick, baseTransactions, subTabs, }: TransactionDrillDownProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
25
|
+
export declare const TransactionDrillDown: (({ ariaLabel, heading, subHeadingText, icon, logo, tabs, selectedIndex, top, onSelectionChange, transactionFilter, tipSection, onEachRowClick, baseTransactions, subTabs, }: TransactionDrillDownProps) => import("react/jsx-runtime").JSX.Element) & {
|
|
25
26
|
displayName: string;
|
|
26
27
|
};
|
|
27
28
|
export default TransactionDrillDown;
|
|
@@ -1,38 +1,38 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { exportTransactionsToCSV as
|
|
3
|
-
import
|
|
1
|
+
import { useGlobalCopyStore as A, useTransactionStore as R } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { exportTransactionsToCSV as E } from "../../../core/utils/TransactionUtils.es.js";
|
|
3
|
+
import G from "../../../transactions/components/shared/TransactionList.es.js";
|
|
4
4
|
import { TipSection as N } from "../../../insights/components/shared/ChartDrawerTemplate/TipSection.es.js";
|
|
5
|
-
import { DRAWER_TIP_ICON as
|
|
6
|
-
import { SubTabs as
|
|
5
|
+
import { DRAWER_TIP_ICON as O } from "../../components/drawerTip.es.js";
|
|
6
|
+
import { SubTabs as U, subTabPanelProps as V } from "../../components/SubTabs.es.js";
|
|
7
7
|
import "react";
|
|
8
|
-
import { observer as
|
|
9
|
-
import
|
|
10
|
-
import { H3 as
|
|
11
|
-
import
|
|
12
|
-
import { Icon as
|
|
8
|
+
import { observer as q } from "mobx-react-lite";
|
|
9
|
+
import e from "@mui/material/Stack";
|
|
10
|
+
import { H3 as z, Text as p } from "@mxenabled/mxui";
|
|
11
|
+
import J from "@mui/material/Button";
|
|
12
|
+
import { Icon as K } from "@mxenabled/mx-icons";
|
|
13
13
|
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
14
14
|
import t from "@mui/material/Box";
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
var
|
|
18
|
-
const { transactions:
|
|
15
|
+
import M from "@mui/material/Tab";
|
|
16
|
+
import Q from "@mui/material/Tabs";
|
|
17
|
+
var y = "transaction-drill-down-panel", S = (b) => `transaction-details-tab-${b}`, w = "transaction-drill-down-series", pr = q(function({ ariaLabel: C, heading: l, subHeadingText: s, icon: D, logo: h, tabs: f, selectedIndex: c, top: x, onSelectionChange: I, transactionFilter: T, tipSection: u, onEachRowClick: B, baseTransactions: k, subTabs: v }) {
|
|
18
|
+
const { transactions: d } = A(), { sortedTransactionsWithSplits: W, tags: P, detailedTransactions: L } = R(), m = !!f?.length, a = v?.tabs.length ? v : void 0, $ = C ?? d.transactions_title, j = (i, n) => {
|
|
19
19
|
I?.(n);
|
|
20
|
-
},
|
|
20
|
+
}, g = T ? (k ?? L).filter(T(c)) : void 0, _ = g ?? W;
|
|
21
21
|
return /* @__PURE__ */ o(t, {
|
|
22
22
|
sx: {
|
|
23
23
|
bgcolor: "background.paper",
|
|
24
24
|
width: "100%"
|
|
25
25
|
},
|
|
26
|
-
children: [
|
|
27
|
-
"aria-label":
|
|
28
|
-
onChange:
|
|
26
|
+
children: [m && /* @__PURE__ */ r(Q, {
|
|
27
|
+
"aria-label": $,
|
|
28
|
+
onChange: j,
|
|
29
29
|
sx: { mb: 0 },
|
|
30
|
-
value:
|
|
30
|
+
value: c,
|
|
31
31
|
variant: "fullWidth",
|
|
32
|
-
children: f.map((i, n) => /* @__PURE__ */ r(
|
|
33
|
-
"aria-controls":
|
|
32
|
+
children: f.map((i, n) => /* @__PURE__ */ r(M, {
|
|
33
|
+
"aria-controls": y,
|
|
34
34
|
"aria-label": i.ariaLabel,
|
|
35
|
-
id:
|
|
35
|
+
id: S(n),
|
|
36
36
|
label: i.label,
|
|
37
37
|
sx: {
|
|
38
38
|
minWidth: "auto",
|
|
@@ -40,49 +40,65 @@ var _ = "transaction-drill-down-panel", y = (b) => `transaction-details-tab-${b}
|
|
|
40
40
|
}
|
|
41
41
|
}, `${i.label}-${n}`))
|
|
42
42
|
}), /* @__PURE__ */ o(t, {
|
|
43
|
-
"aria-labelledby":
|
|
44
|
-
id:
|
|
45
|
-
role:
|
|
43
|
+
"aria-labelledby": m ? S(c) : void 0,
|
|
44
|
+
id: y,
|
|
45
|
+
role: m ? "tabpanel" : void 0,
|
|
46
46
|
children: [
|
|
47
|
-
(
|
|
47
|
+
(l || s) && /* @__PURE__ */ o(e, {
|
|
48
48
|
sx: {
|
|
49
|
-
|
|
49
|
+
alignItems: "center",
|
|
50
|
+
flexDirection: "row",
|
|
51
|
+
gap: 12,
|
|
50
52
|
pt: 16,
|
|
51
53
|
px: 24
|
|
52
54
|
},
|
|
53
|
-
children: [
|
|
55
|
+
children: [h && /* @__PURE__ */ r(t, {
|
|
56
|
+
"aria-hidden": !0,
|
|
54
57
|
sx: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
+
display: "flex",
|
|
59
|
+
flexShrink: 0
|
|
60
|
+
},
|
|
61
|
+
children: h
|
|
62
|
+
}), /* @__PURE__ */ o(e, {
|
|
63
|
+
sx: {
|
|
64
|
+
flexGrow: 1,
|
|
65
|
+
gap: 4,
|
|
66
|
+
minWidth: 0
|
|
58
67
|
},
|
|
59
|
-
children: [
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
68
|
+
children: [l && /* @__PURE__ */ r(z, { children: l }), s && /* @__PURE__ */ o(e, {
|
|
69
|
+
sx: {
|
|
70
|
+
alignItems: "center",
|
|
71
|
+
flexDirection: "row",
|
|
72
|
+
gap: 8
|
|
73
|
+
},
|
|
74
|
+
children: [D, /* @__PURE__ */ r(p, {
|
|
75
|
+
color: "text.secondary",
|
|
76
|
+
sx: { letterSpacing: "0.52px" },
|
|
77
|
+
textTransform: "uppercase",
|
|
78
|
+
variant: "body2",
|
|
79
|
+
children: s
|
|
80
|
+
})]
|
|
65
81
|
})]
|
|
66
82
|
})]
|
|
67
83
|
}),
|
|
68
|
-
|
|
84
|
+
x && /* @__PURE__ */ r(t, {
|
|
69
85
|
sx: {
|
|
70
86
|
pb: 16,
|
|
71
87
|
pt: 16
|
|
72
88
|
},
|
|
73
|
-
children:
|
|
89
|
+
children: x
|
|
74
90
|
}),
|
|
75
|
-
|
|
76
|
-
icon:
|
|
77
|
-
...
|
|
91
|
+
u && /* @__PURE__ */ r(N, {
|
|
92
|
+
icon: O,
|
|
93
|
+
...u
|
|
78
94
|
}),
|
|
79
|
-
a && /* @__PURE__ */ r(
|
|
95
|
+
a && /* @__PURE__ */ r(U, {
|
|
80
96
|
...a,
|
|
81
|
-
id:
|
|
97
|
+
id: w
|
|
82
98
|
}),
|
|
83
99
|
/* @__PURE__ */ o(t, {
|
|
84
|
-
...a &&
|
|
85
|
-
children: [/* @__PURE__ */ o(
|
|
100
|
+
...a && V(w, a.selectedIndex),
|
|
101
|
+
children: [/* @__PURE__ */ o(e, {
|
|
86
102
|
sx: {
|
|
87
103
|
alignItems: "center",
|
|
88
104
|
borderBottomColor: "divider",
|
|
@@ -97,24 +113,24 @@ var _ = "transaction-drill-down-panel", y = (b) => `transaction-details-tab-${b}
|
|
|
97
113
|
children: [/* @__PURE__ */ r(p, {
|
|
98
114
|
bold: !0,
|
|
99
115
|
variant: "body1",
|
|
100
|
-
children:
|
|
101
|
-
}),
|
|
116
|
+
children: d.transactions_title
|
|
117
|
+
}), _.length > 0 && /* @__PURE__ */ r(J, {
|
|
102
118
|
onClick: () => {
|
|
103
|
-
|
|
119
|
+
E(_, P);
|
|
104
120
|
},
|
|
105
|
-
startIcon: /* @__PURE__ */ r(
|
|
121
|
+
startIcon: /* @__PURE__ */ r(K, { name: "ios_share" }),
|
|
106
122
|
sx: { height: 28 },
|
|
107
123
|
children: /* @__PURE__ */ r(p, {
|
|
108
124
|
bold: !0,
|
|
109
125
|
variant: "body2",
|
|
110
|
-
children:
|
|
126
|
+
children: d.export_csv_btn
|
|
111
127
|
})
|
|
112
128
|
})]
|
|
113
129
|
}), /* @__PURE__ */ r(t, {
|
|
114
130
|
sx: { bgcolor: "background.default" },
|
|
115
|
-
children: /* @__PURE__ */ r(
|
|
116
|
-
transaction:
|
|
117
|
-
onClick:
|
|
131
|
+
children: /* @__PURE__ */ r(G, {
|
|
132
|
+
transaction: g,
|
|
133
|
+
onClick: B
|
|
118
134
|
})
|
|
119
135
|
})]
|
|
120
136
|
})
|
|
@@ -123,8 +139,8 @@ var _ = "transaction-drill-down-panel", y = (b) => `transaction-details-tab-${b}
|
|
|
123
139
|
});
|
|
124
140
|
});
|
|
125
141
|
export {
|
|
126
|
-
|
|
127
|
-
|
|
142
|
+
pr as TransactionDrillDown,
|
|
143
|
+
pr as default
|
|
128
144
|
};
|
|
129
145
|
|
|
130
146
|
//# sourceMappingURL=TransactionDrillDown.es.js.map
|
package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionDrillDown.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\nimport { observer } from 'mobx-react-lite'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, Text } from '@mxenabled/mxui'\n\nimport {\n TipSection,\n type TipSectionProps,\n} from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { useGlobalCopyStore, useTransactionStore } from '../../../common'\nimport type { Transaction } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\nimport { TransactionList } from '../../../transactions'\nimport { SubTabs, subTabPanelProps, type SubTabsProps } from '../../components/SubTabs'\n\ninterface TabItem {\n label: string\n ariaLabel?: string\n}\n\nconst PANEL_ID = 'transaction-drill-down-panel'\nconst tabId = (index: number) => `transaction-details-tab-${index}`\nconst SUB_TABS_ID = 'transaction-drill-down-series'\n\ninterface TransactionDrillDownProps {\n ariaLabel?: string\n heading?: string\n subHeadingText?: string\n icon?: React.ReactNode\n tabs?: TabItem[]\n selectedIndex: number\n top: React.ReactNode\n tipSection?: TipSectionProps | false\n onSelectionChange?: (selectedIndex: number) => void\n onEachRowClick?: (guid: string) => void\n transactionFilter?: (selectedIndex: number) => (transaction: Transaction) => boolean\n baseTransactions?: Transaction[]\n // A second row of tabs between the chart and the list (the double-bar drawer's main / comparison\n // series, e.g. Spend / Income). Omitted for every single-series drawer.\n subTabs?: Omit<SubTabsProps, 'id'>\n}\n\nexport const TransactionDrillDown = observer(function TransactionDrillDown({\n ariaLabel,\n heading,\n subHeadingText,\n icon,\n tabs,\n selectedIndex,\n top,\n onSelectionChange,\n transactionFilter,\n tipSection,\n onEachRowClick,\n baseTransactions,\n subTabs,\n}: TransactionDrillDownProps) {\n const { transactions: transactionsCopy } = useGlobalCopyStore()\n const { sortedTransactionsWithSplits, tags, detailedTransactions } = useTransactionStore()\n\n const hasTabs = !!tabs?.length\n // Only a non-empty row gets the tabs and their panel.\n const seriesTabs = subTabs?.tabs.length ? subTabs : undefined\n const tablistLabel = ariaLabel ?? transactionsCopy.transactions_title\n\n const handlePrimaryChange = (_event: React.SyntheticEvent, newValue: number) => {\n onSelectionChange?.(newValue)\n }\n\n const filteredTransactions = transactionFilter\n ? (baseTransactions ?? detailedTransactions).filter(transactionFilter(selectedIndex))\n : undefined\n\n const exportTransactions = filteredTransactions ?? sortedTransactionsWithSplits\n\n return (\n <Box sx={{ bgcolor: 'background.paper', width: '100%' }}>\n {hasTabs && (\n <Tabs\n aria-label={tablistLabel}\n onChange={handlePrimaryChange}\n // The title sits 16px below the tab bar, as in every Figma chart drawer; the theme's 8px\n // gap under Tabs would make it 24.\n sx={{ mb: 0 }}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs!.map((tab, index) => (\n <Tab\n aria-controls={PANEL_ID}\n aria-label={tab.ariaLabel}\n id={tabId(index)}\n key={`${tab.label}-${index}`}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )}\n\n <Box\n aria-labelledby={hasTabs ? tabId(selectedIndex) : undefined}\n id={PANEL_ID}\n role={hasTabs ? 'tabpanel' : undefined}\n >\n {(heading || subHeadingText) && (\n <Stack sx={{ gap: 4, pt: 16, px: 24 }}>\n {heading && <H3>{heading}</H3>}\n {subHeadingText && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {icon}\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.52px' }}\n textTransform=\"uppercase\"\n variant=\"body2\"\n >\n {subHeadingText}\n </Text>\n </Stack>\n )}\n </Stack>\n )}\n\n {/* Figma's chart drawer pads the chart 16px above and below; a drawer with no chart has no box. */}\n {top && <Box sx={{ pb: 16, pt: 16 }}>{top}</Box>}\n\n {/* Every Figma chart drawer puts the tip under the chart, above any sub-tabs. */}\n {tipSection && <TipSection icon={DRAWER_TIP_ICON} {...tipSection} />}\n\n {seriesTabs && <SubTabs {...seriesTabs} id={SUB_TABS_ID} />}\n\n {/* The content the sub-tabs control, as the month tabs' panel above. */}\n <Box {...(seriesTabs && subTabPanelProps(SUB_TABS_ID, seriesTabs.selectedIndex))}>\n <Stack\n sx={{\n alignItems: 'center',\n borderBottomColor: 'divider',\n borderBottomStyle: 'solid',\n borderBottomWidth: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 4,\n pt: 16,\n px: 24,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {transactionsCopy.transactions_title}\n </Text>\n {exportTransactions.length > 0 && (\n <Button\n onClick={() => {\n exportTransactionsToCSV(exportTransactions, tags)\n }}\n startIcon={<Icon name=\"ios_share\" />}\n sx={{ height: 28 }}\n >\n <Text bold={true} variant=\"body2\">\n {transactionsCopy.export_csv_btn}\n </Text>\n </Button>\n )}\n </Stack>\n\n {/* The list's scroll box is taller than its rows; Figma fills the space below the last row\n with background.default, and each row paints its own paper. */}\n <Box sx={{ bgcolor: 'background.default' }}>\n <TransactionList transaction={filteredTransactions} onClick={onEachRowClick} />\n </Box>\n </Box>\n </Box>\n </Box>\n )\n})\n\nexport default TransactionDrillDown\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,IAAM,IAAW,gCACX,IAAA,CAAS,MAAkB,2BAA2B,CAAA,IACtD,IAAc,iCAoBP,KAAuB,EAAS,SAA8B,EACzE,WAAA,GACA,SAAA,GACA,gBAAA,GACA,MAAA,GACA,MAAA,GACA,eAAA,GACA,KAAA,GACA,mBAAA,GACA,mBAAA,GACA,YAAA,GACA,gBAAA,GACA,kBAAA,GACA,SAAA,EAAA,GAC4B;AAC5B,QAAM,EAAE,cAAc,EAAA,IAAqB,EAAmB,GACxD,EAAE,8BAAA,GAA8B,MAAA,GAAM,sBAAA,EAAA,IAAyB,EAAoB,GAEnF,IAAU,CAAC,CAAC,GAAM,QAElB,IAAa,GAAS,KAAK,SAAS,IAAU,QAC9C,IAAe,KAAa,EAAiB,oBAE7C,IAAA,CAAuB,GAA8B,MAAqB;AAC9E,IAAA,IAAoB,CAAQ;AAAA,EAC9B,GAEM,IAAuB,KACxB,KAAoB,GAAsB,OAAO,EAAkB,CAAa,CAAC,IAClF,QAEE,IAAqB,KAAwB;AAEnD,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,IAAI;AAAA,MAAE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,CAAA,CACF;AAAA;MACF;AAAA,IACF,CAAA,CAAA;AAAA;AAET,CAAC"}
|
|
1
|
+
{"version":3,"file":"TransactionDrillDown.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\nimport { observer } from 'mobx-react-lite'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { H3, Text } from '@mxenabled/mxui'\n\nimport {\n TipSection,\n type TipSectionProps,\n} from '../../../insights/components/shared/ChartDrawerTemplate/TipSection'\nimport { useGlobalCopyStore, useTransactionStore } from '../../../common'\nimport type { Transaction } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\nimport { DRAWER_TIP_ICON } from '../../components/drawerTip'\nimport { TransactionList } from '../../../transactions'\nimport { SubTabs, subTabPanelProps, type SubTabsProps } from '../../components/SubTabs'\n\ninterface TabItem {\n label: string\n ariaLabel?: string\n}\n\nconst PANEL_ID = 'transaction-drill-down-panel'\nconst tabId = (index: number) => `transaction-details-tab-${index}`\nconst SUB_TABS_ID = 'transaction-drill-down-series'\n\ninterface TransactionDrillDownProps {\n ariaLabel?: string\n heading?: string\n subHeadingText?: string\n icon?: React.ReactNode\n // A logo left of the heading and sub-heading (Top Merchant's merchant, Figma `<Logo>` 40px).\n logo?: React.ReactNode\n tabs?: TabItem[]\n selectedIndex: number\n top: React.ReactNode\n tipSection?: TipSectionProps | false\n onSelectionChange?: (selectedIndex: number) => void\n onEachRowClick?: (guid: string) => void\n transactionFilter?: (selectedIndex: number) => (transaction: Transaction) => boolean\n baseTransactions?: Transaction[]\n // A second row of tabs between the chart and the list (the double-bar drawer's main / comparison\n // series, e.g. Spend / Income). Omitted for every single-series drawer.\n subTabs?: Omit<SubTabsProps, 'id'>\n}\n\nexport const TransactionDrillDown = observer(function TransactionDrillDown({\n ariaLabel,\n heading,\n subHeadingText,\n icon,\n logo,\n tabs,\n selectedIndex,\n top,\n onSelectionChange,\n transactionFilter,\n tipSection,\n onEachRowClick,\n baseTransactions,\n subTabs,\n}: TransactionDrillDownProps) {\n const { transactions: transactionsCopy } = useGlobalCopyStore()\n const { sortedTransactionsWithSplits, tags, detailedTransactions } = useTransactionStore()\n\n const hasTabs = !!tabs?.length\n // Only a non-empty row gets the tabs and their panel.\n const seriesTabs = subTabs?.tabs.length ? subTabs : undefined\n const tablistLabel = ariaLabel ?? transactionsCopy.transactions_title\n\n const handlePrimaryChange = (_event: React.SyntheticEvent, newValue: number) => {\n onSelectionChange?.(newValue)\n }\n\n const filteredTransactions = transactionFilter\n ? (baseTransactions ?? detailedTransactions).filter(transactionFilter(selectedIndex))\n : undefined\n\n const exportTransactions = filteredTransactions ?? sortedTransactionsWithSplits\n\n return (\n <Box sx={{ bgcolor: 'background.paper', width: '100%' }}>\n {hasTabs && (\n <Tabs\n aria-label={tablistLabel}\n onChange={handlePrimaryChange}\n // The title sits 16px below the tab bar, as in every Figma chart drawer; the theme's 8px\n // gap under Tabs would make it 24.\n sx={{ mb: 0 }}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs!.map((tab, index) => (\n <Tab\n aria-controls={PANEL_ID}\n aria-label={tab.ariaLabel}\n id={tabId(index)}\n key={`${tab.label}-${index}`}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )}\n\n <Box\n aria-labelledby={hasTabs ? tabId(selectedIndex) : undefined}\n id={PANEL_ID}\n role={hasTabs ? 'tabpanel' : undefined}\n >\n {(heading || subHeadingText) && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12, pt: 16, px: 24 }}>\n {logo && (\n <Box aria-hidden={true} sx={{ display: 'flex', flexShrink: 0 }}>\n {logo}\n </Box>\n )}\n <Stack sx={{ flexGrow: 1, gap: 4, minWidth: 0 }}>\n {heading && <H3>{heading}</H3>}\n {subHeadingText && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {icon}\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.52px' }}\n textTransform=\"uppercase\"\n variant=\"body2\"\n >\n {subHeadingText}\n </Text>\n </Stack>\n )}\n </Stack>\n </Stack>\n )}\n\n {/* Figma's chart drawer pads the chart 16px above and below; a drawer with no chart has no box. */}\n {top && <Box sx={{ pb: 16, pt: 16 }}>{top}</Box>}\n\n {/* Every Figma chart drawer puts the tip under the chart, above any sub-tabs. */}\n {tipSection && <TipSection icon={DRAWER_TIP_ICON} {...tipSection} />}\n\n {seriesTabs && <SubTabs {...seriesTabs} id={SUB_TABS_ID} />}\n\n {/* The content the sub-tabs control, as the month tabs' panel above. */}\n <Box {...(seriesTabs && subTabPanelProps(SUB_TABS_ID, seriesTabs.selectedIndex))}>\n <Stack\n sx={{\n alignItems: 'center',\n borderBottomColor: 'divider',\n borderBottomStyle: 'solid',\n borderBottomWidth: 1,\n flexDirection: 'row',\n justifyContent: 'space-between',\n pb: 4,\n pt: 16,\n px: 24,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {transactionsCopy.transactions_title}\n </Text>\n {exportTransactions.length > 0 && (\n <Button\n onClick={() => {\n exportTransactionsToCSV(exportTransactions, tags)\n }}\n startIcon={<Icon name=\"ios_share\" />}\n sx={{ height: 28 }}\n >\n <Text bold={true} variant=\"body2\">\n {transactionsCopy.export_csv_btn}\n </Text>\n </Button>\n )}\n </Stack>\n\n {/* The list's scroll box is taller than its rows; Figma fills the space below the last row\n with background.default, and each row paints its own paper. */}\n <Box sx={{ bgcolor: 'background.default' }}>\n <TransactionList transaction={filteredTransactions} onClick={onEachRowClick} />\n </Box>\n </Box>\n </Box>\n </Box>\n )\n})\n\nexport default TransactionDrillDown\n"],"mappings":";;;;;;;;;;;;;;;;AA4BA,IAAM,IAAW,gCACX,IAAA,CAAS,MAAkB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|
|
6
|
+
* The CTA to draw, for a drawer nested inside another block's drawer (Top Merchants → Merchant
|
|
7
|
+
* History). Absent: the CTA that opened the beat's drawer.
|
|
8
|
+
*/
|
|
9
|
+
cta?: OpenedCta;
|
|
4
10
|
}
|
|
5
11
|
export declare const selectTransactionHistoryCopy: (copy: GlobalCopy) => import('../../../core').InsightsFeedCopy;
|
|
6
|
-
export declare const TransactionHistoryBlock: (({ beat }: TransactionHistoryProp) => import("react/jsx-runtime").JSX.Element) & {
|
|
12
|
+
export declare const TransactionHistoryBlock: (({ beat, cta }: TransactionHistoryProp) => import("react/jsx-runtime").JSX.Element) & {
|
|
7
13
|
displayName: string;
|
|
8
14
|
};
|
|
9
15
|
export {};
|
|
@@ -1,109 +1,110 @@
|
|
|
1
|
-
import { useGlobalCopyStore as
|
|
2
|
-
import { CURRENCY_FORMAT as
|
|
3
|
-
import
|
|
4
|
-
import { BAR_ARIA_LABEL as
|
|
5
|
-
import { BarChartV2 as
|
|
6
|
-
import { EmptyBarChart as
|
|
1
|
+
import { useGlobalCopyStore as Ct, useInsightsV2Store as yt } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as _t, formatCurrency as Tt } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import At from "../../../common/components/drawer/Drawer.es.js";
|
|
4
|
+
import { BAR_ARIA_LABEL as Dt } from "../../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
5
|
+
import { BarChartV2 as St } from "../../components/chartblocks/BarchartV2.es.js";
|
|
6
|
+
import { EmptyBarChart as vt } from "../../components/chartblocks/EmptyBarChart.es.js";
|
|
7
7
|
import { ANALYTICS_EVENTS_CONFIG as M } from "../../analytics/analyticsEventsConfig.es.js";
|
|
8
|
-
import { useAnalyticsEvent as
|
|
9
|
-
import { DoubleBarChart as
|
|
10
|
-
import { toLegendItems as
|
|
11
|
-
import { getDefaultSelection as
|
|
12
|
-
import { useOpenedCta as
|
|
13
|
-
import { TransactionDrillDown as
|
|
14
|
-
import { useTransactionHistory as
|
|
15
|
-
import { TransactionDetailsBlock as
|
|
16
|
-
import { useRequiredCopy as
|
|
17
|
-
import { useLayoutEffect as
|
|
18
|
-
import { observer as
|
|
19
|
-
import { Fragment as
|
|
20
|
-
import { useTheme as
|
|
21
|
-
var
|
|
22
|
-
const
|
|
8
|
+
import { useAnalyticsEvent as Bt } from "../../analytics/useAnalyticsEvent.es.js";
|
|
9
|
+
import { DoubleBarChart as Lt } from "../../components/chartblocks/DoubleBarChart.es.js";
|
|
10
|
+
import { toLegendItems as It } from "../../blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js";
|
|
11
|
+
import { getDefaultSelection as Et, getDrillDownConfig as Rt, getFlattenedDataSeries as xt, resolveDrillDownSubHeader as Ft, toStoreFilter as Ot } from "./utils.es.js";
|
|
12
|
+
import { useOpenedCta as Gt } from "../useOpenedCta.es.js";
|
|
13
|
+
import { TransactionDrillDown as Ht } from "./TransactionDrillDown.es.js";
|
|
14
|
+
import { useTransactionHistory as wt } from "./useTransactionHistory.es.js";
|
|
15
|
+
import { TransactionDetailsBlock as Nt } from "../TransactionDetailsBlock/TransactionDetailsBlock.es.js";
|
|
16
|
+
import { useRequiredCopy as jt } from "../useRequiredCopy.es.js";
|
|
17
|
+
import { useLayoutEffect as kt, useState as d } from "react";
|
|
18
|
+
import { observer as Mt } from "mobx-react-lite";
|
|
19
|
+
import { Fragment as Kt, jsx as l, jsxs as Vt } from "react/jsx-runtime";
|
|
20
|
+
import { useTheme as Pt } from "@mui/material/styles";
|
|
21
|
+
var zt = (a) => a.insights_feed, ge = Mt(({ beat: a, cta: K }) => {
|
|
22
|
+
const _ = Pt(), { actionDrawer: V, setActionContext: T } = yt(), { insights_payload: A } = a, P = Gt(a), D = K ?? P, z = D?.variant, { top: e, filterMode: m, header: Y, colors: q, filterStrategy: U, tipSection: S, subTabAriaLabels: W, slotData: $, averageFormat: J, subTabs: Q, boldLabel: X } = Rt(z ?? ""), { instanceSlotData: o, beatTransactions: u, spendCategoryGuids: v, allAccountGuids: B, categoryName: Z, displayedDateRange: h, transactionStore: tt } = wt(a, { slotData: $ }, D?.drilldown_data), { common: et } = Ct(), n = jt(zt), [ot, L] = d(!1), [at, nt] = d(!1), I = Bt(), { dataSeries: g, chartData: p, comparisonBars: s } = xt({
|
|
23
23
|
data: o?.data_series,
|
|
24
|
-
ariaLabel: e === "doubleBar" ?
|
|
24
|
+
ariaLabel: e === "doubleBar" ? n?.general?.in_month_you_had_a_category_of_amount ?? "_1{month}, _2{category}: _3{amount}" : Dt,
|
|
25
25
|
top: e,
|
|
26
26
|
beatTransactions: u
|
|
27
|
-
}), c = e === "doubleBar",
|
|
27
|
+
}), c = e === "doubleBar", rt = e === "tabsOnly", i = c ? s : p, { chartBarIndex: E, subTabIndex: st } = Et({
|
|
28
28
|
chartTabCount: p.length,
|
|
29
29
|
comparisonTabCount: s.length,
|
|
30
|
-
actionDrawer:
|
|
30
|
+
actionDrawer: V,
|
|
31
31
|
beatGuid: a.guid
|
|
32
|
-
}), [
|
|
33
|
-
i.length !==
|
|
34
|
-
const x = (t) =>
|
|
32
|
+
}), [r, C] = d(E), [y, R] = d(st), [it, lt] = d(i.length);
|
|
33
|
+
i.length !== it && (lt(i.length), C(E));
|
|
34
|
+
const x = (t) => U({
|
|
35
35
|
beat: a,
|
|
36
36
|
beatTransactions: u,
|
|
37
37
|
dataSeries: g,
|
|
38
38
|
comparisonBars: s,
|
|
39
39
|
selectedIndex: t,
|
|
40
|
-
subIndex:
|
|
40
|
+
subIndex: y,
|
|
41
41
|
isLastTab: t === i.length - 1,
|
|
42
42
|
instanceSlotData: o,
|
|
43
43
|
spendCategoryGuids: v,
|
|
44
|
-
displayedDateRange:
|
|
45
|
-
}),
|
|
44
|
+
displayedDateRange: h
|
|
45
|
+
}), ct = u.map((t) => t.guid).join(","), dt = v.join(","), mt = B.join(","), ut = e === "list" || e === "tabsOnly" || e === "monthTabs" || g.length > 0, F = () => {
|
|
46
46
|
if (m !== "store") return;
|
|
47
|
-
const t =
|
|
47
|
+
const t = ut ? x(r) : {
|
|
48
48
|
accounts: [],
|
|
49
49
|
custom: () => !1
|
|
50
50
|
};
|
|
51
|
-
|
|
51
|
+
tt.setFilter(Ot(t, {
|
|
52
52
|
allAccountGuids: B,
|
|
53
|
-
displayedDateRange:
|
|
53
|
+
displayedDateRange: h
|
|
54
54
|
}));
|
|
55
55
|
};
|
|
56
|
-
|
|
56
|
+
kt(() => {
|
|
57
57
|
F();
|
|
58
58
|
}, [
|
|
59
59
|
a.guid,
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
r,
|
|
61
|
+
y,
|
|
62
62
|
m,
|
|
63
63
|
g.length,
|
|
64
64
|
o,
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
h,
|
|
66
|
+
dt,
|
|
67
|
+
mt,
|
|
67
68
|
ct,
|
|
68
|
-
it,
|
|
69
69
|
e
|
|
70
70
|
]);
|
|
71
|
-
const O =
|
|
71
|
+
const O = Ft(A), b = Y?.({
|
|
72
72
|
title: A?.title,
|
|
73
73
|
subHeader: O,
|
|
74
|
-
categoryName:
|
|
75
|
-
selectedDate: p[
|
|
76
|
-
slotData: o
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
74
|
+
categoryName: Z,
|
|
75
|
+
selectedDate: p[r]?.date ?? void 0,
|
|
76
|
+
slotData: o,
|
|
77
|
+
copy: n
|
|
78
|
+
}), G = q(_, o?.category_guid), [H, w] = o?.legends ?? [], gt = m === "local" ? (t) => x(t).custom ?? (() => !0) : void 0, pt = m === "local" ? u : void 0, N = (t, f) => {
|
|
79
|
+
I(M.DRAWER_CHART_BAR_CLICKED), C(t), f !== void 0 && R(f);
|
|
80
|
+
}, bt = (t) => {
|
|
81
|
+
I(M.TAB_SELECTED), C(t);
|
|
82
|
+
}, j = c ? It([{
|
|
82
83
|
...H,
|
|
83
|
-
value: s[
|
|
84
|
+
value: s[r]?.main
|
|
84
85
|
}, {
|
|
85
86
|
...w,
|
|
86
|
-
value: s[
|
|
87
|
-
}]) : void 0,
|
|
87
|
+
value: s[r]?.comparison
|
|
88
|
+
}]) : void 0, ft = W?.(n) ?? [], k = c ? (j ?? []).map((t, f) => ({
|
|
88
89
|
label: t.label,
|
|
89
|
-
ariaLabel:
|
|
90
|
-
})) :
|
|
90
|
+
ariaLabel: ft[f]
|
|
91
|
+
})) : rt ? g.flatMap((t) => t.localized_label ? [{ label: t.localized_label }] : []) : Q?.({
|
|
91
92
|
instanceSlotData: o,
|
|
92
|
-
copy:
|
|
93
|
-
}).map((t) => ({ label: t })) ?? [],
|
|
93
|
+
copy: n
|
|
94
|
+
}).map((t) => ({ label: t })) ?? [], ht = c || e === "singleBar" || e === "upcomingBill" ? i.length ? c ? /* @__PURE__ */ l(Lt, {
|
|
94
95
|
bars: s,
|
|
95
|
-
boldLabel:
|
|
96
|
+
boldLabel: X,
|
|
96
97
|
colors: G,
|
|
97
98
|
legendPosition: "top",
|
|
98
99
|
legends: j,
|
|
99
100
|
onBarClick: N,
|
|
100
|
-
selectedIndex:
|
|
101
|
-
}) : /* @__PURE__ */ l(
|
|
101
|
+
selectedIndex: r
|
|
102
|
+
}) : /* @__PURE__ */ l(St, {
|
|
102
103
|
amounts: {
|
|
103
104
|
average: o?.average_amount,
|
|
104
|
-
formattedAverage:
|
|
105
|
+
formattedAverage: Tt(o?.average_amount ?? 0, J ?? _t.cents)
|
|
105
106
|
},
|
|
106
|
-
color: G[0] ??
|
|
107
|
+
color: G[0] ?? _.palette.primary.main,
|
|
107
108
|
data: p,
|
|
108
109
|
legendPosition: "top",
|
|
109
110
|
heightOverride: 172,
|
|
@@ -113,43 +114,44 @@ var Vt = (a) => a.insights_feed, me = jt(({ beat: a }) => {
|
|
|
113
114
|
left: 24,
|
|
114
115
|
right: 24
|
|
115
116
|
},
|
|
116
|
-
monthlyAmountLabel: H?.label ??
|
|
117
|
+
monthlyAmountLabel: H?.label ?? n.general.monthly_amount,
|
|
117
118
|
onBarClick: N,
|
|
118
|
-
selectedTabIndex:
|
|
119
|
-
trendAmountLabel: w?.label ??
|
|
120
|
-
}) : /* @__PURE__ */ l(
|
|
121
|
-
return /* @__PURE__ */
|
|
122
|
-
baseTransactions:
|
|
123
|
-
heading:
|
|
124
|
-
icon:
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
119
|
+
selectedTabIndex: r,
|
|
120
|
+
trendAmountLabel: w?.label ?? n.general.trend
|
|
121
|
+
}) : /* @__PURE__ */ l(vt, {}) : null;
|
|
122
|
+
return /* @__PURE__ */ Vt(Kt, { children: [/* @__PURE__ */ l(Ht, {
|
|
123
|
+
baseTransactions: pt,
|
|
124
|
+
heading: b?.heading,
|
|
125
|
+
icon: b?.icon,
|
|
126
|
+
logo: b?.logo,
|
|
127
|
+
onSelectionChange: bt,
|
|
128
|
+
selectedIndex: r,
|
|
129
|
+
subHeadingText: b?.subHeadingText,
|
|
128
130
|
tabs: i,
|
|
129
|
-
top:
|
|
131
|
+
top: ht,
|
|
130
132
|
...k.length > 0 && { subTabs: {
|
|
131
133
|
tabs: k,
|
|
132
|
-
selectedIndex:
|
|
134
|
+
selectedIndex: y,
|
|
133
135
|
onChange: R
|
|
134
136
|
} },
|
|
135
|
-
...S && { tipSection: !
|
|
136
|
-
transactionFilter:
|
|
137
|
+
...S && { tipSection: !at && (S(nt, n, O?.text, o) ?? !1) },
|
|
138
|
+
transactionFilter: gt,
|
|
137
139
|
onEachRowClick: (t) => {
|
|
138
140
|
T({ transaction_guid: t }), L(!0);
|
|
139
141
|
}
|
|
140
|
-
}), /* @__PURE__ */ l(
|
|
141
|
-
ariaLabelClose:
|
|
142
|
-
isOpen:
|
|
142
|
+
}), /* @__PURE__ */ l(At, {
|
|
143
|
+
ariaLabelClose: et.close_aria,
|
|
144
|
+
isOpen: ot,
|
|
143
145
|
onClose: () => {
|
|
144
146
|
L(!1), T({ transaction_guid: void 0 }), F();
|
|
145
147
|
},
|
|
146
|
-
title:
|
|
147
|
-
children: /* @__PURE__ */ l(
|
|
148
|
+
title: n.general.transaction_details_title,
|
|
149
|
+
children: /* @__PURE__ */ l(Nt, { beat: a })
|
|
148
150
|
})] });
|
|
149
151
|
});
|
|
150
152
|
export {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
+
ge as TransactionHistoryBlock,
|
|
154
|
+
zt as selectTransactionHistoryCopy
|
|
153
155
|
};
|
|
154
156
|
|
|
155
157
|
//# sourceMappingURL=TransactionHistoryBlock.es.js.map
|