@mx-cartographer/experiences 9.7.108 → 9.7.110
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 -0
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +7 -2
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +19 -6
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +100 -73
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/insights-v2/components/TransactionListCard.es.js +15 -15
- package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [9.7.110] - 11-05-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - Duplicate Payment shows its date header, rows and total on the full card, its rows on the mini card, and stacked logos with an error badge on the embedded card, which opens "View Transactions" (WEC-2207)
|
|
4
|
+
- **FIXED** - The date header on transaction cards is now bold and 40px tall, as designed (WEC-2207)
|
|
5
|
+
|
|
6
|
+
## [9.7.109] - 11-05-2026
|
|
7
|
+
|
|
8
|
+
- **CHANGED** - Micro Deposits' full and mini cards each have their own named variant, so the mini card never shows a date (WEC-2109)
|
|
9
|
+
|
|
1
10
|
## [9.7.108] - 11-05-2026
|
|
2
11
|
|
|
3
12
|
- **FIXED** - The Savings Account Balance Summary "Savings Contributions" drawer is titled with the card's own title, not the host's drawer copy (WEC-2023)
|
|
@@ -14,21 +14,26 @@ import { SxProps, Theme } from '@mui/material/styles';
|
|
|
14
14
|
* Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.
|
|
15
15
|
* - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`
|
|
16
16
|
* (Uncategorized Transactions V2 `complete`, "All Categorized!").
|
|
17
|
+
* - `ListWithHeaderFooter` — every row under a date header plus a total row (Duplicate Payment).
|
|
17
18
|
* - `SpendingSummary` — header, rows and footer, with the header text in `primary.main`
|
|
18
19
|
* (Weekend Spending Summary: the weekend above one row per category and "Total spent").
|
|
19
|
-
* - `
|
|
20
|
+
* - `CreditListWithHeader` — the date above the rows, each amount a green "+" credit (Micro Deposits' full).
|
|
21
|
+
* - `CreditSummary` — credit rows, header never shown (Micro Deposits' mini sends one summed row).
|
|
20
22
|
*/
|
|
21
23
|
export declare const transactionBlockVariant: {
|
|
22
24
|
readonly WithHeader: "with_header";
|
|
23
25
|
readonly WithHeaderFooter: "with_header_footer";
|
|
24
26
|
readonly NoHeader: "no_header";
|
|
25
27
|
readonly WithFooter: "with_footer";
|
|
28
|
+
readonly ListWithHeaderFooter: "list_with_header_footer";
|
|
29
|
+
readonly List: "list";
|
|
26
30
|
readonly UncategorizedTransaction: "uncategorized_transaction";
|
|
27
31
|
readonly InfoWash: "info_wash";
|
|
28
32
|
readonly WarningWash: "warning_wash";
|
|
29
33
|
readonly StatusMessage: "status_message";
|
|
30
34
|
readonly SpendingSummary: "spending_summary";
|
|
31
|
-
readonly
|
|
35
|
+
readonly CreditListWithHeader: "credit_list_with_header";
|
|
36
|
+
readonly CreditSummary: "credit_summary";
|
|
32
37
|
};
|
|
33
38
|
export type TransactionBlockVariant = (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant];
|
|
34
39
|
export interface TransactionLayoutConfig {
|
|
@@ -1,16 +1,19 @@
|
|
|
1
|
-
import { WARM_LIME_ACCENT_GRADIENT as r, WARNING_WASH_GRADIENT as
|
|
1
|
+
import { WARM_LIME_ACCENT_GRADIENT as r, WARNING_WASH_GRADIENT as a, getPrimaryWashGradient as o } from "../../../components/celebrationGradients.es.js";
|
|
2
2
|
var e = {
|
|
3
3
|
WithHeader: "with_header",
|
|
4
4
|
WithHeaderFooter: "with_header_footer",
|
|
5
5
|
NoHeader: "no_header",
|
|
6
6
|
WithFooter: "with_footer",
|
|
7
|
+
ListWithHeaderFooter: "list_with_header_footer",
|
|
8
|
+
List: "list",
|
|
7
9
|
UncategorizedTransaction: "uncategorized_transaction",
|
|
8
10
|
InfoWash: "info_wash",
|
|
9
11
|
WarningWash: "warning_wash",
|
|
10
12
|
StatusMessage: "status_message",
|
|
11
13
|
SpendingSummary: "spending_summary",
|
|
12
|
-
|
|
13
|
-
|
|
14
|
+
CreditListWithHeader: "credit_list_with_header",
|
|
15
|
+
CreditSummary: "credit_summary"
|
|
16
|
+
}, i = (t) => ({
|
|
14
17
|
[e.WithHeader]: {
|
|
15
18
|
showHeader: !0,
|
|
16
19
|
tintedCategoryLogo: !0
|
|
@@ -24,19 +27,24 @@ var e = {
|
|
|
24
27
|
showHeader: !1,
|
|
25
28
|
showFooter: !0
|
|
26
29
|
},
|
|
30
|
+
[e.ListWithHeaderFooter]: {
|
|
31
|
+
showHeader: !0,
|
|
32
|
+
showFooter: !0
|
|
33
|
+
},
|
|
34
|
+
[e.List]: { showHeader: !1 },
|
|
27
35
|
[e.UncategorizedTransaction]: {
|
|
28
36
|
showHeader: !0,
|
|
29
37
|
cardVariant: "primary"
|
|
30
38
|
},
|
|
31
39
|
[e.InfoWash]: {
|
|
32
40
|
showHeader: !1,
|
|
33
|
-
background: o(
|
|
41
|
+
background: o(t),
|
|
34
42
|
raised: !0,
|
|
35
43
|
showFrequency: !0
|
|
36
44
|
},
|
|
37
45
|
[e.WarningWash]: {
|
|
38
46
|
showHeader: !1,
|
|
39
|
-
background:
|
|
47
|
+
background: a,
|
|
40
48
|
showFrequency: !0,
|
|
41
49
|
followsSubscription: !0,
|
|
42
50
|
answeredBackground: r,
|
|
@@ -53,10 +61,15 @@ var e = {
|
|
|
53
61
|
showFooter: !0,
|
|
54
62
|
headerColor: "primary.main"
|
|
55
63
|
},
|
|
56
|
-
[e.
|
|
64
|
+
[e.CreditListWithHeader]: {
|
|
57
65
|
showHeader: !0,
|
|
58
66
|
tintedCategoryLogo: !0,
|
|
59
67
|
creditAmounts: !0
|
|
68
|
+
},
|
|
69
|
+
[e.CreditSummary]: {
|
|
70
|
+
showHeader: !1,
|
|
71
|
+
tintedCategoryLogo: !0,
|
|
72
|
+
creditAmounts: !0
|
|
60
73
|
}
|
|
61
74
|
});
|
|
62
75
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles'\n\nimport {\n WARM_LIME_ACCENT_GRADIENT,\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `WithHeaderFooter` — date header above the rows plus the footer/summary row from\n * `data.footer_text` / `data.footer_amount` (Replenish Savings' \"Remaining Balance\").\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — raised row (border + shadow) on the blue slot wash, with the\n * subscription's live frequency under the amount (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n * - `SpendingSummary` — header, rows and footer, with the header text in `primary.main`\n * (Weekend Spending Summary: the weekend above one row per category and \"Total spent\").\n * - `
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.ts"],"sourcesContent":["import type { SxProps, Theme } from '@mui/material/styles'\n\nimport {\n WARM_LIME_ACCENT_GRADIENT,\n WARNING_WASH_GRADIENT,\n getPrimaryWashGradient,\n} from '../../../components/celebrationGradients'\n\n/**\n * Transaction block variants, keyed by the backend `instance_slot.variant`. All render the same\n * pre-localized rows through `TransactionListCard`; only the header and the slot differ.\n *\n * - `WithHeader` — row under a date header (Fee Detected, Large Transaction).\n * - `WithHeaderFooter` — date header above the rows plus the footer/summary row from\n * `data.footer_text` / `data.footer_amount` (Replenish Savings' \"Remaining Balance\").\n * - `NoHeader` — the row alone (Large Transaction without a merchant).\n * - `UncategorizedTransaction` — filled primary header (\"{count} transactions\").\n * - `InfoWash` — raised row (border + shadow) on the blue slot wash, with the\n * subscription's live frequency under the amount (e.g. Subscription Detected).\n * - `WarningWash` — borderless row on the warning slot wash (e.g. Unexpected\n * Subscription Payment). Treatment names, not beat names, so any beat can reuse the wash.\n * - `StatusMessage` — no rows: an icon + message banner from `data.icon` / `data.message`\n * (Uncategorized Transactions V2 `complete`, \"All Categorized!\").\n * - `ListWithHeaderFooter` — every row under a date header plus a total row (Duplicate Payment).\n * - `SpendingSummary` — header, rows and footer, with the header text in `primary.main`\n * (Weekend Spending Summary: the weekend above one row per category and \"Total spent\").\n * - `CreditListWithHeader` — the date above the rows, each amount a green \"+\" credit (Micro Deposits' full).\n * - `CreditSummary` — credit rows, header never shown (Micro Deposits' mini sends one summed row).\n */\nexport const transactionBlockVariant = {\n WithHeader: 'with_header',\n WithHeaderFooter: 'with_header_footer',\n NoHeader: 'no_header',\n // A multi-row list with no in-card header plus a \"Total\" summary row (Weekly New Merchants; the\n // date range is the card subtitle). The plain no-footer list reuses `NoHeader`.\n WithFooter: 'with_footer',\n ListWithHeaderFooter: 'list_with_header_footer',\n List: 'list',\n UncategorizedTransaction: 'uncategorized_transaction',\n InfoWash: 'info_wash',\n WarningWash: 'warning_wash',\n StatusMessage: 'status_message',\n SpendingSummary: 'spending_summary',\n CreditListWithHeader: 'credit_list_with_header',\n CreditSummary: 'credit_summary',\n} as const\n\nexport type TransactionBlockVariant =\n (typeof transactionBlockVariant)[keyof typeof transactionBlockVariant]\n\nexport interface TransactionLayoutConfig {\n /** Show `instance_slot.data.header_text` above the rows. */\n showHeader: boolean\n /** Show the `data.footer_text` / `data.footer_amount` summary row beneath the rows. */\n showFooter?: boolean\n /** `TransactionListCard` style: grey utility header, or filled primary header. */\n cardVariant?: 'default' | 'primary'\n /** Theme colour for the header text, over the card style's own. */\n headerColor?: string\n /** CSS background for the slot behind the card; the card renders borderless unless `raised`. */\n background?: string\n /** Render `data.message` as a `StatusMessageCard` banner instead of the rows. */\n statusMessage?: boolean\n /** Caption each amount with the beat's live repeating transaction frequency. */\n showFrequency?: boolean\n /** Status badge and answered wash from the live repeating transaction. */\n followsSubscription?: boolean\n /** Wash once subscribed. */\n answeredBackground?: string\n /** Row card at `elevation/1` (needs `background`). */\n elevated?: boolean\n /** Slot padding override (CSS shorthand). */\n sx?: SxProps\n /** Border and shadow on the row card. */\n raised?: boolean\n /**\n * Tint a `CAT-` row logo as the Budget-style accent tile (category colour at 15% opacity, a 1px\n * category-colour border, a `text.primary` glyph) instead of mxui's default. Opt-in per variant so\n * it stays scoped to the beats that want it (Replenish Savings' multi-account Transfer row), not\n * every `transaction_block` consumer.\n */\n tintedCategoryLogo?: boolean\n /** Draw each amount as a credit: a \"+\" prefix in `success.main`. */\n creditAmounts?: boolean\n}\n\n/** Per-variant `TransactionListCard` props (mirrors DetailedAccountBlock's `getLayoutConfig`). */\nexport const getLayoutConfig = (\n theme: Theme,\n): Record<TransactionBlockVariant, TransactionLayoutConfig> => ({\n // `with_header` is Replenish Savings' multi-account card: its one summary row is a `CAT-` Transfer\n // logo, which we tint. (Other `with_header` beats, e.g. Large Transaction, use a merchant logo, so\n // the `CAT-` tint path never runs for them.)\n [transactionBlockVariant.WithHeader]: { showHeader: true, tintedCategoryLogo: true },\n [transactionBlockVariant.WithHeaderFooter]: { showHeader: true, showFooter: true },\n [transactionBlockVariant.NoHeader]: { showHeader: false },\n [transactionBlockVariant.WithFooter]: { showHeader: false, showFooter: true },\n [transactionBlockVariant.ListWithHeaderFooter]: { showHeader: true, showFooter: true },\n [transactionBlockVariant.List]: { showHeader: false },\n [transactionBlockVariant.UncategorizedTransaction]: { showHeader: true, cardVariant: 'primary' },\n [transactionBlockVariant.InfoWash]: {\n showHeader: false,\n background: getPrimaryWashGradient(theme),\n raised: true,\n showFrequency: true,\n },\n [transactionBlockVariant.WarningWash]: {\n showHeader: false,\n background: WARNING_WASH_GRADIENT,\n showFrequency: true,\n followsSubscription: true,\n answeredBackground: WARM_LIME_ACCENT_GRADIENT,\n elevated: true,\n // Room for the badge.\n sx: { p: '28px 24px 24px 32px' },\n },\n // Figma 1941:207336: the banner sits on the warm-to-lime slot wash.\n [transactionBlockVariant.StatusMessage]: {\n showHeader: false,\n statusMessage: true,\n background: WARM_LIME_ACCENT_GRADIENT,\n },\n [transactionBlockVariant.SpendingSummary]: {\n showHeader: true,\n showFooter: true,\n headerColor: 'primary.main',\n },\n [transactionBlockVariant.CreditListWithHeader]: {\n showHeader: true,\n tintedCategoryLogo: true,\n creditAmounts: true,\n },\n [transactionBlockVariant.CreditSummary]: {\n showHeader: false,\n tintedCategoryLogo: true,\n creditAmounts: true,\n },\n})\n"],"mappings":";AA6BA,IAAa,IAA0B;AAAA,EACrC,YAAY;AAAA,EACZ,kBAAkB;AAAA,EAClB,UAAU;AAAA,EAGV,YAAY;AAAA,EACZ,sBAAsB;AAAA,EACtB,MAAM;AAAA,EACN,0BAA0B;AAAA,EAC1B,UAAU;AAAA,EACV,aAAa;AAAA,EACb,eAAe;AAAA,EACf,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,eAAe;AACjB,GA0Ca,IAAA,CACX,OAC8D;AAAA,EAI7D,CAAA,EAAwB,UAAA,GAAa;AAAA,IAAE,YAAY;AAAA,IAAM,oBAAoB;AAAA,EAAK;AAAA,EAClF,CAAA,EAAwB,gBAAA,GAAmB;AAAA,IAAE,YAAY;AAAA,IAAM,YAAY;AAAA,EAAK;AAAA,EAChF,CAAA,EAAwB,QAAA,GAAW,EAAE,YAAY,GAAM;AAAA,EACvD,CAAA,EAAwB,UAAA,GAAa;AAAA,IAAE,YAAY;AAAA,IAAO,YAAY;AAAA,EAAK;AAAA,EAC3E,CAAA,EAAwB,oBAAA,GAAuB;AAAA,IAAE,YAAY;AAAA,IAAM,YAAY;AAAA,EAAK;AAAA,EACpF,CAAA,EAAwB,IAAA,GAAO,EAAE,YAAY,GAAM;AAAA,EACnD,CAAA,EAAwB,wBAAA,GAA2B;AAAA,IAAE,YAAY;AAAA,IAAM,aAAa;AAAA,EAAU;AAAA,EAC9F,CAAA,EAAwB,QAAA,GAAW;AAAA,IAClC,YAAY;AAAA,IACZ,YAAY,EAAuB,CAAK;AAAA,IACxC,QAAQ;AAAA,IACR,eAAe;AAAA,EACjB;AAAA,EACC,CAAA,EAAwB,WAAA,GAAc;AAAA,IACrC,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,qBAAqB;AAAA,IACrB,oBAAoB;AAAA,IACpB,UAAU;AAAA,IAEV,IAAI,EAAE,GAAG,sBAAsB;AAAA,EACjC;AAAA,EAEC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IACvC,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,YAAY;AAAA,EACd;AAAA,EACC,CAAA,EAAwB,eAAA,GAAkB;AAAA,IACzC,YAAY;AAAA,IACZ,YAAY;AAAA,IACZ,aAAa;AAAA,EACf;AAAA,EACC,CAAA,EAAwB,oBAAA,GAAuB;AAAA,IAC9C,YAAY;AAAA,IACZ,oBAAoB;AAAA,IACpB,eAAe;AAAA,EACjB;AAAA,EACC,CAAA,EAAwB,aAAA,GAAgB;AAAA,IACvC,YAAY;AAAA,IACZ,oBAAoB;AAAA,IACpB,eAAe;AAAA,EACjB;AACF"}
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { useGlobalStore as
|
|
2
|
-
import { slot as
|
|
1
|
+
import { useGlobalStore as V, useInsightsV2Store as G } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { slot as _ } from "../../core/types/Insights.es.js";
|
|
3
3
|
import { getCategoryColor as N } from "../../core/utils/CategoryUtil.es.js";
|
|
4
|
-
import { TinyBarChart as
|
|
5
|
-
import { BAR_ARIA_LABEL as
|
|
6
|
-
import { ThemedSVGImage as
|
|
7
|
-
import { postCtaMessage as
|
|
8
|
-
import
|
|
9
|
-
import { createVariantBlock as
|
|
10
|
-
import { ActionBlockLayer as
|
|
11
|
-
import
|
|
4
|
+
import { TinyBarChart as P } from "../../common/components/TinyBarChart.es.js";
|
|
5
|
+
import { BAR_ARIA_LABEL as W, buildChartData as K, buildDataSeries as j } from "../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
6
|
+
import { ThemedSVGImage as F } from "./chartblocks/ThemedSVGImage.es.js";
|
|
7
|
+
import { postCtaMessage as H } from "../ctaActions/runCtaAction.es.js";
|
|
8
|
+
import p from "./LogoFromGuid.es.js";
|
|
9
|
+
import { createVariantBlock as M } from "../blocks/createVariantBlock.es.js";
|
|
10
|
+
import { ActionBlockLayer as Z } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
11
|
+
import y from "./BadgedTile.es.js";
|
|
12
12
|
import { InsightOptionsMenu as X } from "./InsightOptionsMenu.es.js";
|
|
13
|
-
import { ReactComponent as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import { P as q, Text as
|
|
13
|
+
import { ReactComponent as $ } from "./shared/images/FeeDetected.es.js";
|
|
14
|
+
import S from "./StatusBadge.es.js";
|
|
15
|
+
import x from "@mui/material/Stack";
|
|
16
|
+
import { P as q, Text as C } from "@mxenabled/mxui";
|
|
17
17
|
import J from "@mui/material/Button";
|
|
18
|
-
import { Icon as
|
|
18
|
+
import { Icon as v } from "@mxenabled/mx-icons";
|
|
19
19
|
import { Fragment as Q, jsx as t, jsxs as d } from "react/jsx-runtime";
|
|
20
20
|
import e from "@mui/material/Box";
|
|
21
21
|
import U from "@mui/material/Card";
|
|
22
|
-
var Y = 2, c = 44,
|
|
22
|
+
var Y = 2, c = 44, I = 36, tt = 75, rt = 74, g = {
|
|
23
23
|
left: "50%",
|
|
24
24
|
position: "absolute",
|
|
25
25
|
top: "50%",
|
|
26
26
|
transform: "translate(-50%, -50%)"
|
|
27
|
-
},
|
|
27
|
+
}, k = ({ logo: r }) => r ? /* @__PURE__ */ t(p, {
|
|
28
28
|
logo: r,
|
|
29
29
|
size: c
|
|
30
30
|
}) : /* @__PURE__ */ t(e, {
|
|
@@ -37,29 +37,51 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
37
37
|
justifyContent: "center",
|
|
38
38
|
width: c
|
|
39
39
|
},
|
|
40
|
-
children: /* @__PURE__ */ t(
|
|
40
|
+
children: /* @__PURE__ */ t(v, {
|
|
41
41
|
color: "primary",
|
|
42
42
|
fill: !0,
|
|
43
43
|
name: "lightbulb",
|
|
44
44
|
size: 24
|
|
45
45
|
})
|
|
46
|
-
}),
|
|
47
|
-
center: /* @__PURE__ */ t(
|
|
46
|
+
}), w = ({ logo: r }) => /* @__PURE__ */ t(y, {
|
|
47
|
+
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
48
48
|
size: c,
|
|
49
49
|
sx: { flexShrink: 0 }
|
|
50
|
-
}), it = ({ logo: r }) => /* @__PURE__ */ t(
|
|
51
|
-
center: /* @__PURE__ */ t(
|
|
50
|
+
}), it = ({ logo: r }) => /* @__PURE__ */ t(y, {
|
|
51
|
+
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
52
52
|
size: c,
|
|
53
53
|
sx: { flexShrink: 0 },
|
|
54
|
-
topRight: /* @__PURE__ */ t(
|
|
55
|
-
}), et = () => /* @__PURE__ */ t(
|
|
54
|
+
topRight: /* @__PURE__ */ t(S, { tone: "warning" })
|
|
55
|
+
}), et = 24, ot = ({ logo: r }) => /* @__PURE__ */ t(y, {
|
|
56
|
+
bottomLeft: r ? /* @__PURE__ */ t(e, {
|
|
57
|
+
"aria-hidden": !0,
|
|
58
|
+
sx: {
|
|
59
|
+
borderRadius: "6px",
|
|
60
|
+
display: "flex",
|
|
61
|
+
outline: "2px solid",
|
|
62
|
+
outlineColor: "background.paper",
|
|
63
|
+
overflow: "hidden"
|
|
64
|
+
},
|
|
65
|
+
children: /* @__PURE__ */ t(p, {
|
|
66
|
+
logo: {
|
|
67
|
+
...r,
|
|
68
|
+
alt: void 0
|
|
69
|
+
},
|
|
70
|
+
size: et
|
|
71
|
+
})
|
|
72
|
+
}) : void 0,
|
|
73
|
+
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
74
|
+
size: c,
|
|
75
|
+
sx: { flexShrink: 0 },
|
|
76
|
+
topRight: /* @__PURE__ */ t(S, { tone: "error" })
|
|
77
|
+
}), at = () => /* @__PURE__ */ t(F, {
|
|
56
78
|
divProps: { style: {
|
|
57
79
|
flexShrink: 0,
|
|
58
80
|
lineHeight: 0,
|
|
59
81
|
width: "max-content"
|
|
60
82
|
} },
|
|
61
|
-
image:
|
|
62
|
-
}),
|
|
83
|
+
image: $
|
|
84
|
+
}), b = 24, nt = () => /* @__PURE__ */ t(e, {
|
|
63
85
|
"aria-hidden": !0,
|
|
64
86
|
"data-testid": "linked-logos-badge",
|
|
65
87
|
sx: {
|
|
@@ -74,12 +96,12 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
74
96
|
p: 2,
|
|
75
97
|
zIndex: 1
|
|
76
98
|
},
|
|
77
|
-
children: /* @__PURE__ */ t(
|
|
99
|
+
children: /* @__PURE__ */ t(v, {
|
|
78
100
|
name: "link",
|
|
79
101
|
size: 16,
|
|
80
102
|
sx: { color: "primary.contrastText" }
|
|
81
103
|
})
|
|
82
|
-
}),
|
|
104
|
+
}), st = () => /* @__PURE__ */ t(e, {
|
|
83
105
|
"aria-hidden": !0,
|
|
84
106
|
"data-testid": "linked-logos-badge",
|
|
85
107
|
sx: {
|
|
@@ -88,22 +110,22 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
88
110
|
bgcolor: "primary.contrastText",
|
|
89
111
|
borderRadius: "50%",
|
|
90
112
|
display: "flex",
|
|
91
|
-
height:
|
|
113
|
+
height: b,
|
|
92
114
|
justifyContent: "center",
|
|
93
115
|
overflow: "hidden",
|
|
94
|
-
width:
|
|
116
|
+
width: b,
|
|
95
117
|
zIndex: 1
|
|
96
118
|
},
|
|
97
|
-
children: /* @__PURE__ */ t(
|
|
119
|
+
children: /* @__PURE__ */ t(v, {
|
|
98
120
|
name: "swap_vertical_circle",
|
|
99
|
-
size:
|
|
121
|
+
size: b * 1.2,
|
|
100
122
|
sx: {
|
|
101
123
|
color: "primary.main",
|
|
102
124
|
flexShrink: 0,
|
|
103
125
|
transform: "rotate(-90deg)"
|
|
104
126
|
}
|
|
105
127
|
})
|
|
106
|
-
}),
|
|
128
|
+
}), lt = ({ data: r, template: o }) => {
|
|
107
129
|
const { from_logo: l, to_logo: a } = r ?? {}, i = o === "SwitchDirectDeposit";
|
|
108
130
|
return /* @__PURE__ */ d(e, {
|
|
109
131
|
sx: {
|
|
@@ -147,9 +169,9 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
147
169
|
position: "absolute",
|
|
148
170
|
top: 0
|
|
149
171
|
},
|
|
150
|
-
children: /* @__PURE__ */ t(
|
|
172
|
+
children: /* @__PURE__ */ t(p, {
|
|
151
173
|
logo: l,
|
|
152
|
-
size:
|
|
174
|
+
size: I
|
|
153
175
|
})
|
|
154
176
|
}),
|
|
155
177
|
/* @__PURE__ */ t(e, {
|
|
@@ -160,37 +182,38 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
160
182
|
position: "absolute",
|
|
161
183
|
right: 0
|
|
162
184
|
},
|
|
163
|
-
children: /* @__PURE__ */ t(
|
|
185
|
+
children: /* @__PURE__ */ t(p, {
|
|
164
186
|
logo: a,
|
|
165
|
-
size:
|
|
187
|
+
size: I
|
|
166
188
|
})
|
|
167
189
|
}),
|
|
168
|
-
i ? /* @__PURE__ */ t(
|
|
190
|
+
i ? /* @__PURE__ */ t(st, {}) : /* @__PURE__ */ t(nt, {})
|
|
169
191
|
]
|
|
170
192
|
});
|
|
171
|
-
},
|
|
172
|
-
const o = j(
|
|
193
|
+
}, dt = ({ data: r }) => {
|
|
194
|
+
const o = j(_(r, "series"));
|
|
173
195
|
if (!o.length) return null;
|
|
174
|
-
const l =
|
|
196
|
+
const l = _(r, "category_guid"), a = K(o, W).slice(-3);
|
|
175
197
|
return /* @__PURE__ */ t(e, {
|
|
176
198
|
"data-testid": "compact-insight-card-bar-chart",
|
|
177
199
|
sx: { flexShrink: 0 },
|
|
178
|
-
children: /* @__PURE__ */ t(
|
|
200
|
+
children: /* @__PURE__ */ t(P, {
|
|
179
201
|
color: (i) => l ? N(l, i) : i.palette.primary.main,
|
|
180
202
|
data: a
|
|
181
203
|
})
|
|
182
204
|
});
|
|
183
|
-
},
|
|
205
|
+
}, ct = M({
|
|
184
206
|
variants: {
|
|
185
|
-
category_color:
|
|
186
|
-
linked_logos:
|
|
187
|
-
minimal:
|
|
188
|
-
|
|
207
|
+
category_color: dt,
|
|
208
|
+
linked_logos: lt,
|
|
209
|
+
minimal: w,
|
|
210
|
+
stacked_logos: ot,
|
|
211
|
+
with_illustration: at,
|
|
189
212
|
with_warning_badge: it
|
|
190
213
|
},
|
|
191
|
-
fallback:
|
|
214
|
+
fallback: w,
|
|
192
215
|
name: "InsightVisual"
|
|
193
|
-
}),
|
|
216
|
+
}), pt = {
|
|
194
217
|
BillAmountNotStandard: {
|
|
195
218
|
key: "in_description_cta",
|
|
196
219
|
trigger: "inDescriptionCta"
|
|
@@ -199,28 +222,32 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
199
222
|
key: "in_description_cta",
|
|
200
223
|
trigger: "inDescriptionCta"
|
|
201
224
|
},
|
|
225
|
+
DuplicatePaymentV2: {
|
|
226
|
+
key: "in_description_cta",
|
|
227
|
+
trigger: "inDescriptionCta"
|
|
228
|
+
},
|
|
202
229
|
SwitchDirectDeposit: { key: "in_description_cta" }
|
|
203
|
-
},
|
|
204
|
-
const
|
|
205
|
-
if (s.stopPropagation(), !(o || !
|
|
230
|
+
}, gt = (r) => r.stopPropagation(), Tt = ({ beat: r, isCtaDisabled: o = !1, onCtaClick: l, onTap: a, payload: i }) => {
|
|
231
|
+
const D = V(), { openActionDrawer: B } = G(), { description: L, instance_slot: m, primary_cta: h, title: E } = i, n = pt[i.template ?? ""], f = n ? i[n.key] : h, u = i.in_description_cta?.post_message_metadata, R = !n || !!n.trigger || !!r && !!u, A = _(m.data, "logo"), z = (s) => {
|
|
232
|
+
if (s.stopPropagation(), !(o || !f)) {
|
|
206
233
|
if (n) {
|
|
207
|
-
if (r && n.trigger)
|
|
234
|
+
if (r && n.trigger) B({
|
|
208
235
|
guid: r.guid,
|
|
209
236
|
trigger: n.trigger
|
|
210
237
|
});
|
|
211
|
-
else if (r &&
|
|
212
|
-
const { action:
|
|
213
|
-
|
|
238
|
+
else if (r && u) {
|
|
239
|
+
const { action: O, ...T } = u;
|
|
240
|
+
H({
|
|
214
241
|
beat: r,
|
|
215
|
-
stores:
|
|
242
|
+
stores: D
|
|
216
243
|
}, {
|
|
217
|
-
action:
|
|
218
|
-
payload:
|
|
244
|
+
action: O,
|
|
245
|
+
payload: T
|
|
219
246
|
});
|
|
220
247
|
}
|
|
221
248
|
return;
|
|
222
249
|
}
|
|
223
|
-
|
|
250
|
+
h && l?.(h);
|
|
224
251
|
}
|
|
225
252
|
};
|
|
226
253
|
return /* @__PURE__ */ d(Q, { children: [/* @__PURE__ */ d(U, {
|
|
@@ -241,7 +268,7 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
241
268
|
pt: 8,
|
|
242
269
|
...a && { cursor: "pointer" }
|
|
243
270
|
},
|
|
244
|
-
children: [/* @__PURE__ */ d(
|
|
271
|
+
children: [/* @__PURE__ */ d(x, {
|
|
245
272
|
sx: {
|
|
246
273
|
alignItems: "center",
|
|
247
274
|
flexDirection: "row",
|
|
@@ -250,23 +277,23 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
250
277
|
pl: 8,
|
|
251
278
|
pt: 4
|
|
252
279
|
},
|
|
253
|
-
children: [/* @__PURE__ */ t(
|
|
280
|
+
children: [/* @__PURE__ */ t(C, {
|
|
254
281
|
bold: !0,
|
|
255
282
|
variant: "body1",
|
|
256
|
-
children:
|
|
283
|
+
children: E ?? ""
|
|
257
284
|
}), /* @__PURE__ */ t(e, {
|
|
258
|
-
onClick:
|
|
285
|
+
onClick: gt,
|
|
259
286
|
sx: { display: "flex" },
|
|
260
287
|
children: /* @__PURE__ */ t(X, {})
|
|
261
288
|
})]
|
|
262
|
-
}), /* @__PURE__ */ d(
|
|
289
|
+
}), /* @__PURE__ */ d(x, {
|
|
263
290
|
sx: {
|
|
264
291
|
alignItems: "center",
|
|
265
292
|
flexDirection: "row",
|
|
266
293
|
gap: 16,
|
|
267
294
|
pl: 8
|
|
268
295
|
},
|
|
269
|
-
children: [/* @__PURE__ */ d(
|
|
296
|
+
children: [/* @__PURE__ */ d(x, {
|
|
270
297
|
sx: {
|
|
271
298
|
alignSelf: "stretch",
|
|
272
299
|
flex: 1,
|
|
@@ -275,7 +302,7 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
275
302
|
pt: 2
|
|
276
303
|
},
|
|
277
304
|
children: [/* @__PURE__ */ t(q, {
|
|
278
|
-
dangerouslySetInnerHTML: { __html:
|
|
305
|
+
dangerouslySetInnerHTML: { __html: L.html_text },
|
|
279
306
|
"data-testid": "compact-insight-card-description",
|
|
280
307
|
sx: {
|
|
281
308
|
display: "-webkit-box",
|
|
@@ -286,9 +313,9 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
286
313
|
WebkitLineClamp: Y
|
|
287
314
|
},
|
|
288
315
|
variant: "subtitle2"
|
|
289
|
-
}),
|
|
316
|
+
}), f?.label && R && /* @__PURE__ */ t(J, {
|
|
290
317
|
"aria-disabled": o,
|
|
291
|
-
onClick:
|
|
318
|
+
onClick: z,
|
|
292
319
|
size: "small",
|
|
293
320
|
sx: {
|
|
294
321
|
alignSelf: "flex-start",
|
|
@@ -301,20 +328,20 @@ var Y = 2, c = 44, k = 36, tt = 75, rt = 74, g = {
|
|
|
301
328
|
}
|
|
302
329
|
},
|
|
303
330
|
variant: "text",
|
|
304
|
-
children: /* @__PURE__ */ t(
|
|
331
|
+
children: /* @__PURE__ */ t(C, {
|
|
305
332
|
bold: !0,
|
|
306
333
|
variant: "body2",
|
|
307
|
-
children:
|
|
334
|
+
children: f.label
|
|
308
335
|
})
|
|
309
336
|
})]
|
|
310
|
-
}), /* @__PURE__ */ t(
|
|
337
|
+
}), /* @__PURE__ */ t(ct, {
|
|
311
338
|
data: m.data,
|
|
312
339
|
logo: A,
|
|
313
340
|
template: i.template,
|
|
314
341
|
variant: m.variant
|
|
315
342
|
})]
|
|
316
343
|
})]
|
|
317
|
-
}), r && /* @__PURE__ */ t(
|
|
344
|
+
}), r && /* @__PURE__ */ t(Z, { beat: r })] });
|
|
318
345
|
};
|
|
319
346
|
export {
|
|
320
347
|
Tt as default
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CompactInsightCard.es.js","names":[],"sources":["../../../src/insights-v2/components/CompactInsightCard.tsx"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { useGlobalStore, useInsightsV2Store } from '../../common'\nimport { TinyBarChart } from '../../common/components/TinyBarChart'\nimport { slot } from '../../core'\nimport type {\n Beat,\n DataSeries,\n InsightsPayload,\n InstanceSlotData,\n LogoRef,\n PrimaryCTA,\n} from '../../core'\nimport type { ActionDrawerTrigger } from '../../core/stores'\nimport type { AccountSwitchBlockV2Data } from '../../core/types/InsightsInstanceSlotData'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport {\n BAR_ARIA_LABEL,\n buildChartData,\n buildDataSeries,\n} from '../blocks/ChartBlocks/BarchartBlock/utils'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { postCtaMessage } from '../ctaActions'\nimport BadgedTile from './BadgedTile'\nimport InsightOptionsMenu from './InsightOptionsMenu'\nimport LogoFromGuid from './LogoFromGuid'\nimport { ReactComponent as FeeDetectedIllustration } from './shared/images/FeeDetected.svg'\nimport { ThemedSVGImage } from './chartblocks/ThemedSVGImage'\nimport StatusBadge from './StatusBadge'\n\nconst DESCRIPTION_MAX_LINES = 2\n\n/** Figma 1941:111897: the tile the logo fills is 44px (rows are 32, the notification row 33). */\nconst ICON_SIZE = 44\n\ninterface InsightVisualProps {\n /** The slot's `logo`, when ditto's variant declares and fills one. */\n logo?: LogoRef | null\n /** The slot's whole `data`, for a visual drawn from more than the logo (`category_color`, `linked_logos`). */\n data?: InstanceSlotData\n /** The envelope's template, for a beat's own badge on `linked_logos`. */\n template?: string\n}\n\n// Figma 1943:219189: 36px logos at opposite corners of a 75×74 box, the badge and rings centred.\nconst LINKED_LOGO_SIZE = 36\nconst LINKED_BOX_WIDTH = 75\nconst LINKED_BOX_HEIGHT = 74\n\nconst CENTRED = {\n left: '50%',\n position: 'absolute',\n top: '50%',\n transform: 'translate(-50%, -50%)',\n} as const\n\n/** Figma 222:33404 (Embedded | Bill Amount Not Standard) shows the latest three bars. */\nconst BAR_CHART_BAR_COUNT = 3\n\n/** The slot's logo, or the neutral insight glyph when the slot carries none. */\nconst LogoOrFallback = ({ logo }: InsightVisualProps) =>\n logo ? (\n <LogoFromGuid logo={logo} size={ICON_SIZE} />\n ) : (\n <Box\n data-testid=\"compact-insight-card-fallback-icon\"\n sx={{\n alignItems: 'center',\n bgcolor: 'primary.lighter',\n display: 'flex',\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n }}\n >\n <Icon color=\"primary\" fill={true} name=\"lightbulb\" size={24} />\n </Box>\n )\n\n/** Micro, and any variant not registered below: the logo alone. */\nconst PlainVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile center={<LogoOrFallback logo={logo} />} size={ICON_SIZE} sx={{ flexShrink: 0 }} />\n)\n\n/** ditto `with_warning_badge`: the logo badged with a status glyph (Figma 1941:111897). */\nconst WarningBadgeVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"warning\" />}\n />\n)\n\n/**\n * ditto `with_illustration`: artwork in place of the logo tile (Fee Detected's search illustration).\n * A single SVG themed at runtime by `ThemedSVGImage`: its `brand300` elements are recolored to the\n * theme's `primary.main` (so it follows dark mode), while `fill=\"white\"` areas stay white. The\n * slot's `logo` is deliberately unused: the illustration replaces the tile.\n */\nconst IllustrationVisual = () => {\n return (\n <ThemedSVGImage\n divProps={{ style: { flexShrink: 0, lineHeight: 0, width: 'max-content' } }}\n image={FeeDetectedIllustration}\n />\n )\n}\n\nconst SWAP_BADGE_SIZE = 24\n\nconst LinkBadge = () => (\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-badge\"\n sx={{\n ...CENTRED,\n alignItems: 'center',\n bgcolor: 'primary.main',\n border: '2px solid',\n borderColor: 'primary.contrastText',\n borderRadius: '12px',\n display: 'flex',\n justifyContent: 'center',\n p: 2,\n zIndex: 1,\n }}\n >\n <Icon name=\"link\" size={16} sx={{ color: 'primary.contrastText' }} />\n </Box>\n)\n\n/**\n * Switch Direct Deposit (Figma 1941:167601): the outlined `swap_vertical_circle`, turned horizontal,\n * over a contrast disc: a primary ring and arrows on white. Drawn 1.2× so its circle fills 24px.\n */\nconst SwapBadge = () => (\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-badge\"\n sx={{\n ...CENTRED,\n alignItems: 'center',\n bgcolor: 'primary.contrastText',\n borderRadius: '50%',\n display: 'flex',\n height: SWAP_BADGE_SIZE,\n justifyContent: 'center',\n overflow: 'hidden',\n width: SWAP_BADGE_SIZE,\n zIndex: 1,\n }}\n >\n <Icon\n name=\"swap_vertical_circle\"\n size={SWAP_BADGE_SIZE * 1.2}\n sx={{ color: 'primary.main', flexShrink: 0, transform: 'rotate(-90deg)' }}\n />\n </Box>\n)\n\n/**\n * ditto `linked_logos` (Figma 1943:219189, Embedded | Discovered Accounts): the two institutions at\n * opposite corners of a 75×74 box — `from_logo` top-left, `to_logo` bottom-right — meeting on the\n * diagonal, with a badge over two rings at the centre (Switch Direct Deposit: the swap badge on an\n * outlined inner ring). The rings and badge are decorative (`aria-hidden`); each logo's accessible\n * name is its `alt`.\n */\nconst LinkedLogosVisual = ({ data, template }: InsightVisualProps) => {\n const { from_logo, to_logo } = (data ?? {}) as AccountSwitchBlockV2Data\n const isSwap = template === 'SwitchDirectDeposit'\n\n return (\n <Box\n sx={{\n flexShrink: 0,\n height: LINKED_BOX_HEIGHT,\n position: 'relative',\n width: LINKED_BOX_WIDTH,\n }}\n >\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-ring\"\n sx={{\n ...CENTRED,\n borderRadius: '50%',\n height: 36,\n width: 36,\n ...(isSwap\n ? { border: '2px solid', borderColor: 'primary.light' }\n : { bgcolor: 'primary.light' }),\n }}\n />\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-ring\"\n sx={{\n ...CENTRED,\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '50%',\n height: 48,\n width: 48,\n }}\n />\n <Box sx={{ borderRadius: '4px', left: 0, overflow: 'hidden', position: 'absolute', top: 0 }}>\n <LogoFromGuid logo={from_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n <Box\n sx={{ borderRadius: '4px', bottom: 0, overflow: 'hidden', position: 'absolute', right: 0 }}\n >\n <LogoFromGuid logo={to_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n {isSwap ? <SwapBadge /> : <LinkBadge />}\n </Box>\n )\n}\n\n/**\n * ditto `category_color`: a tiny bar chart of the latest bars in place of the logo tile, tinted by\n * the slot's category, the newest bar solid (Figma 222:33404). Draws nothing without a series.\n */\nconst BarChartVisual = ({ data }: InsightVisualProps) => {\n const series = buildDataSeries(slot<DataSeries>(data, 'series'))\n if (!series.length) return null\n\n const categoryGuid = slot<string>(data, 'category_guid')\n const bars = buildChartData(series, BAR_ARIA_LABEL).slice(-BAR_CHART_BAR_COUNT)\n\n return (\n <Box data-testid=\"compact-insight-card-bar-chart\" sx={{ flexShrink: 0 }}>\n <TinyBarChart\n color={(theme) =>\n categoryGuid ? getCategoryColor(categoryGuid, theme) : theme.palette.primary.main\n }\n data={bars}\n />\n </Box>\n )\n}\n\n/**\n * The card's right-hand visual, one component per ditto layout variant.\n *\n * A variant names a rendering *shape*, not an insight or a surface — `with_header` already serves\n * both Large Transaction and Fee Detected — so an insight wanting the badged logo reuses\n * `with_warning_badge`. Only a genuinely different visual registers a new entry, and existing ones\n * are never touched.\n *\n * `minimal` draws the plain logo and is registered explicitly even though it matches the fallback:\n * micro and notification resolve it on every render, and an unregistered variant warns. The\n * fallback is for variants we genuinely do not know.\n */\nconst InsightVisual = createVariantBlock<InsightVisualProps>({\n variants: {\n category_color: BarChartVisual,\n linked_logos: LinkedLogosVisual,\n minimal: PlainVisual,\n with_illustration: IllustrationVisual,\n with_warning_badge: WarningBadgeVisual,\n },\n fallback: PlainVisual,\n name: 'InsightVisual',\n})\n\n/**\n * Beats whose embedded CTA the card reads from its own envelope key and opens in this card's\n * `ActionBlockLayer`, as a bar click does on the full card. The trigger names that key, so the layer\n * resolves the same CTA. Without a trigger the link posts its host message instead (Switch Direct\n * Deposit's op_1: Atomic runs only in pulse). Every other beat keeps `primary_cta` and hands it to\n * the host's `onCtaClick` (e.g. `contact_support_block`). A new beat adds its template here.\n */\nconst BEAT_CTA_CONFIG: Record<\n string,\n { key: 'primary_cta' | 'in_description_cta'; trigger?: ActionDrawerTrigger }\n> = {\n BillAmountNotStandard: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n ConnectDiscoveredAccountsV2: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n SwitchDirectDeposit: { key: 'in_description_cta' },\n}\n\nexport interface CompactInsightCardProps {\n /** A `micro` or `embedded` envelope. */\n payload: InsightsPayload\n /** The envelope's beat; when given, the card mounts its `ActionBlockLayer` for CTA drawers. */\n beat?: Beat\n /**\n * Makes the whole card the tap target. What a tap does is the host's decision (post to the\n * host app, open a drawer, …); the card never opens anything itself. Omit for a static card.\n */\n onTap?: () => void\n /** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */\n onCtaClick?: (cta: PrimaryCTA) => void\n /**\n * Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot\n * honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).\n */\n isCtaDisabled?: boolean\n}\n\nconst stopPropagation = (event: MouseEvent) => event.stopPropagation()\n\n/**\n * The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).\n *\n * Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML\n * description with the primary CTA under it, and on the right the slot's `logo` in a\n * `<BadgedTile>`. Under ditto's `with_warning_badge` variant the tile takes a status badge; under\n * `minimal` it draws the logo alone. The card lays out from the envelope alone and never reads\n * `widget_type`.\n *\n * The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot\n * carries no logo. The `pill` on the same envelope is the transaction row's, not the card's.\n */\nconst CompactInsightCard = ({\n beat,\n isCtaDisabled = false,\n onCtaClick,\n onTap,\n payload,\n}: CompactInsightCardProps) => {\n const stores = useGlobalStore()\n const { openActionDrawer } = useInsightsV2Store()\n const { description, instance_slot, primary_cta, title } = payload\n const beatCta = BEAT_CTA_CONFIG[payload.template ?? '']\n const cta = beatCta ? payload[beatCta.key] : primary_cta\n const message = payload.in_description_cta?.post_message_metadata\n // A link that posts needs its beat and message; without them it draws nothing.\n const canAct = !beatCta || !!beatCta.trigger || (!!beat && !!message)\n // Reduced variants (`minimal`, `with_warning_badge`) declare a bare `logo` slot.\n const rowLogo = slot<LogoRef>(instance_slot.data, 'logo')\n\n const handleCtaClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (isCtaDisabled || !cta) return\n\n if (beatCta) {\n if (beat && beatCta.trigger) openActionDrawer({ guid: beat.guid, trigger: beatCta.trigger })\n else if (beat && message) {\n const { action, ...extras } = message\n postCtaMessage({ beat, stores }, { action, payload: extras })\n }\n return\n }\n if (primary_cta) onCtaClick?.(primary_cta)\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n // Only the card itself: Enter on the CTA button is the button's own click.\n if (event.target !== event.currentTarget) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onTap?.()\n }\n }\n\n const interactiveProps = onTap\n ? { onClick: onTap, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 }\n : {}\n\n return (\n <>\n <Card\n data-testid=\"compact-insight-card\"\n {...interactiveProps}\n sx={{\n minWidth: 288,\n pb: 12,\n pl: 8,\n pr: 16,\n pt: 8,\n ...(onTap && { cursor: 'pointer' }),\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 8,\n justifyContent: 'space-between',\n pl: 8,\n pt: 4,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {title ?? ''}\n </Text>\n {/* The menu renders only when the host wired `onMenuAction` (BeatActionsProvider). */}\n <Box onClick={stopPropagation} sx={{ display: 'flex' }}>\n <InsightOptionsMenu />\n </Box>\n </Stack>\n\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, pl: 8 }}>\n <Stack sx={{ alignSelf: 'stretch', flex: 1, gap: 8, minWidth: 0, pt: 2 }}>\n {/* `html_text` is rendered server-side by mrs_content from the ditto copy template (bold\n amount / merchant), not user-authored input; painted the same way `BaseLayout` paints\n the full card's description. */}\n <P\n dangerouslySetInnerHTML={{ __html: description.html_text }}\n data-testid=\"compact-insight-card-description\"\n sx={{\n display: '-webkit-box',\n fontWeight: 'fontWeightRegular',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: DESCRIPTION_MAX_LINES,\n }}\n variant=\"subtitle2\"\n />\n {cta?.label && canAct && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // The label lines up with the description (the column pads 8; the tap target keeps\n // its padding). `my: 0` drops the theme's -12px text-button margin.\n ml: -8,\n my: 0,\n px: 8,\n ...(isCtaDisabled && {\n color: 'text.disabled',\n cursor: 'default',\n }),\n }}\n variant=\"text\"\n >\n <Text bold={true} variant=\"body2\">\n {cta.label}\n </Text>\n </Button>\n )}\n </Stack>\n\n <InsightVisual\n data={instance_slot.data}\n logo={rowLogo}\n template={payload.template}\n variant={instance_slot.variant}\n />\n </Stack>\n </Card>\n {/* Outside the Card: the drawer is a portal, and its clicks would otherwise bubble to `onTap`. */}\n {beat && <ActionBlockLayer beat={beat} />}\n </>\n )\n}\n\nexport default CompactInsightCard\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,IAAwB,GAGxB,IAAY,IAYZ,IAAmB,IACnB,KAAmB,IACnB,KAAoB,IAEpB,IAAU;AAAA,EACd,MAAM;AAAA,EACN,UAAU;AAAA,EACV,KAAK;AAAA,EACL,WAAW;AACb,GAMM,IAAA,CAAkB,EAAE,MAAA,EAAA,MACxB,IACE,gBAAA,EAAC,GAAD;AAAA,EAAoB,MAAA;AAAA,EAAM,MAAM;AAAY,CAAA,IAE5C,gBAAA,EAAC,GAAD;AAAA,EACE,eAAY;AAAA,EACZ,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,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UAAW,MAAM;AAAA,UAAG,KAAK;AAAA,UAAG,UAAU;AAAA,UAAG,IAAI;AAAA,QAAE;AAAA,QAAvE,UAAA,CAIE,gBAAA,EAAC,GAAD;AAAA,UACE,yBAAyB,EAAE,QAAQ,EAAY,UAAU;AAAA,UACzD,eAAY;AAAA,UACZ,IAAI;AAAA,YACF,SAAS;AAAA,YACT,YAAY;AAAA,YACZ,UAAU;AAAA,YACV,cAAc;AAAA,YACd,iBAAiB;AAAA,YACjB,iBAAiB;AAAA,UACnB;AAAA,UACA,SAAQ;AAAA,QACT,CAAA,GACA,GAAK,SAAS,KACb,gBAAA,EAAC,GAAD;AAAA,UACE,iBAAe;AAAA,UACf,SAAS;AAAA,UACT,MAAK;AAAA,UACL,IAAI;AAAA,YACF,WAAW;AAAA,YAGX,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,GAAI,KAAiB;AAAA,cACnB,OAAO;AAAA,cACP,QAAQ;AAAA,YACV;AAAA,UACF;AAAA,UACA,SAAQ;AAAA,UAER,UAAA,gBAAA,EAAC,GAAD;AAAA,YAAM,MAAM;AAAA,YAAM,SAAQ;AAAA,YACvB,UAAA,EAAI;AAAA,UACD,CAAA;AAAA,QACA,CAAA,CAEL;AAAA,MAEP,CAAA,GAAA,gBAAA,EAAC,IAAD;AAAA,QACE,MAAM,EAAc;AAAA,QACpB,MAAM;AAAA,QACN,UAAU,EAAQ;AAAA,QAClB,SAAS,EAAc;AAAA,MACxB,CAAA,CACI;AAAA,IACH,CAAA,CAAA;AAAA,EAEL,CAAA,GAAA,KAAQ,gBAAA,EAAC,GAAD,EAAwB,MAAA,EAAO,CAAA,CACxC,EAAA,CAAA;AAEN"}
|
|
1
|
+
{"version":3,"file":"CompactInsightCard.es.js","names":[],"sources":["../../../src/insights-v2/components/CompactInsightCard.tsx"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { useGlobalStore, useInsightsV2Store } from '../../common'\nimport { TinyBarChart } from '../../common/components/TinyBarChart'\nimport { slot } from '../../core'\nimport type {\n Beat,\n DataSeries,\n InsightsPayload,\n InstanceSlotData,\n LogoRef,\n PrimaryCTA,\n} from '../../core'\nimport type { ActionDrawerTrigger } from '../../core/stores'\nimport type { AccountSwitchBlockV2Data } from '../../core/types/InsightsInstanceSlotData'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport {\n BAR_ARIA_LABEL,\n buildChartData,\n buildDataSeries,\n} from '../blocks/ChartBlocks/BarchartBlock/utils'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport { postCtaMessage } from '../ctaActions'\nimport BadgedTile from './BadgedTile'\nimport InsightOptionsMenu from './InsightOptionsMenu'\nimport LogoFromGuid from './LogoFromGuid'\nimport { ReactComponent as FeeDetectedIllustration } from './shared/images/FeeDetected.svg'\nimport { ThemedSVGImage } from './chartblocks/ThemedSVGImage'\nimport StatusBadge from './StatusBadge'\n\nconst DESCRIPTION_MAX_LINES = 2\n\n/** Figma 1941:111897: the tile the logo fills is 44px (rows are 32, the notification row 33). */\nconst ICON_SIZE = 44\n\ninterface InsightVisualProps {\n /** The slot's `logo`, when ditto's variant declares and fills one. */\n logo?: LogoRef | null\n /** The slot's whole `data`, for a visual drawn from more than the logo (`category_color`, `linked_logos`). */\n data?: InstanceSlotData\n /** The envelope's template, for a beat's own badge on `linked_logos`. */\n template?: string\n}\n\n// Figma 1943:219189: 36px logos at opposite corners of a 75×74 box, the badge and rings centred.\nconst LINKED_LOGO_SIZE = 36\nconst LINKED_BOX_WIDTH = 75\nconst LINKED_BOX_HEIGHT = 74\n\nconst CENTRED = {\n left: '50%',\n position: 'absolute',\n top: '50%',\n transform: 'translate(-50%, -50%)',\n} as const\n\n/** Figma 222:33404 (Embedded | Bill Amount Not Standard) shows the latest three bars. */\nconst BAR_CHART_BAR_COUNT = 3\n\n/** The slot's logo, or the neutral insight glyph when the slot carries none. */\nconst LogoOrFallback = ({ logo }: InsightVisualProps) =>\n logo ? (\n <LogoFromGuid logo={logo} size={ICON_SIZE} />\n ) : (\n <Box\n data-testid=\"compact-insight-card-fallback-icon\"\n sx={{\n alignItems: 'center',\n bgcolor: 'primary.lighter',\n display: 'flex',\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n }}\n >\n <Icon color=\"primary\" fill={true} name=\"lightbulb\" size={24} />\n </Box>\n )\n\n/** Micro, and any variant not registered below: the logo alone. */\nconst PlainVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile center={<LogoOrFallback logo={logo} />} size={ICON_SIZE} sx={{ flexShrink: 0 }} />\n)\n\n/** ditto `with_warning_badge`: the logo badged with a status glyph (Figma 1941:111897). */\nconst WarningBadgeVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"warning\" />}\n />\n)\n\nconst STACKED_LOGO_SIZE = 24\n\n/** ditto `stacked_logos`: the row logo twice, plus an error badge. The copy is `aria-hidden`, so the logo is named once. */\nconst StackedLogosVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n bottomLeft={\n logo ? (\n <Box\n aria-hidden={true}\n sx={{\n borderRadius: '6px',\n display: 'flex',\n outline: '2px solid',\n outlineColor: 'background.paper',\n overflow: 'hidden',\n }}\n >\n <LogoFromGuid logo={{ ...logo, alt: undefined }} size={STACKED_LOGO_SIZE} />\n </Box>\n ) : undefined\n }\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"error\" />}\n />\n)\n\n/**\n * ditto `with_illustration`: artwork in place of the logo tile (Fee Detected's search illustration).\n * A single SVG themed at runtime by `ThemedSVGImage`: its `brand300` elements are recolored to the\n * theme's `primary.main` (so it follows dark mode), while `fill=\"white\"` areas stay white. The\n * slot's `logo` is deliberately unused: the illustration replaces the tile.\n */\nconst IllustrationVisual = () => {\n return (\n <ThemedSVGImage\n divProps={{ style: { flexShrink: 0, lineHeight: 0, width: 'max-content' } }}\n image={FeeDetectedIllustration}\n />\n )\n}\n\nconst SWAP_BADGE_SIZE = 24\n\nconst LinkBadge = () => (\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-badge\"\n sx={{\n ...CENTRED,\n alignItems: 'center',\n bgcolor: 'primary.main',\n border: '2px solid',\n borderColor: 'primary.contrastText',\n borderRadius: '12px',\n display: 'flex',\n justifyContent: 'center',\n p: 2,\n zIndex: 1,\n }}\n >\n <Icon name=\"link\" size={16} sx={{ color: 'primary.contrastText' }} />\n </Box>\n)\n\n/**\n * Switch Direct Deposit (Figma 1941:167601): the outlined `swap_vertical_circle`, turned horizontal,\n * over a contrast disc: a primary ring and arrows on white. Drawn 1.2× so its circle fills 24px.\n */\nconst SwapBadge = () => (\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-badge\"\n sx={{\n ...CENTRED,\n alignItems: 'center',\n bgcolor: 'primary.contrastText',\n borderRadius: '50%',\n display: 'flex',\n height: SWAP_BADGE_SIZE,\n justifyContent: 'center',\n overflow: 'hidden',\n width: SWAP_BADGE_SIZE,\n zIndex: 1,\n }}\n >\n <Icon\n name=\"swap_vertical_circle\"\n size={SWAP_BADGE_SIZE * 1.2}\n sx={{ color: 'primary.main', flexShrink: 0, transform: 'rotate(-90deg)' }}\n />\n </Box>\n)\n\n/**\n * ditto `linked_logos` (Figma 1943:219189, Embedded | Discovered Accounts): the two institutions at\n * opposite corners of a 75×74 box — `from_logo` top-left, `to_logo` bottom-right — meeting on the\n * diagonal, with a badge over two rings at the centre (Switch Direct Deposit: the swap badge on an\n * outlined inner ring). The rings and badge are decorative (`aria-hidden`); each logo's accessible\n * name is its `alt`.\n */\nconst LinkedLogosVisual = ({ data, template }: InsightVisualProps) => {\n const { from_logo, to_logo } = (data ?? {}) as AccountSwitchBlockV2Data\n const isSwap = template === 'SwitchDirectDeposit'\n\n return (\n <Box\n sx={{\n flexShrink: 0,\n height: LINKED_BOX_HEIGHT,\n position: 'relative',\n width: LINKED_BOX_WIDTH,\n }}\n >\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-ring\"\n sx={{\n ...CENTRED,\n borderRadius: '50%',\n height: 36,\n width: 36,\n ...(isSwap\n ? { border: '2px solid', borderColor: 'primary.light' }\n : { bgcolor: 'primary.light' }),\n }}\n />\n <Box\n aria-hidden={true}\n data-testid=\"linked-logos-ring\"\n sx={{\n ...CENTRED,\n border: '1px solid',\n borderColor: 'divider',\n borderRadius: '50%',\n height: 48,\n width: 48,\n }}\n />\n <Box sx={{ borderRadius: '4px', left: 0, overflow: 'hidden', position: 'absolute', top: 0 }}>\n <LogoFromGuid logo={from_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n <Box\n sx={{ borderRadius: '4px', bottom: 0, overflow: 'hidden', position: 'absolute', right: 0 }}\n >\n <LogoFromGuid logo={to_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n {isSwap ? <SwapBadge /> : <LinkBadge />}\n </Box>\n )\n}\n\n/**\n * ditto `category_color`: a tiny bar chart of the latest bars in place of the logo tile, tinted by\n * the slot's category, the newest bar solid (Figma 222:33404). Draws nothing without a series.\n */\nconst BarChartVisual = ({ data }: InsightVisualProps) => {\n const series = buildDataSeries(slot<DataSeries>(data, 'series'))\n if (!series.length) return null\n\n const categoryGuid = slot<string>(data, 'category_guid')\n const bars = buildChartData(series, BAR_ARIA_LABEL).slice(-BAR_CHART_BAR_COUNT)\n\n return (\n <Box data-testid=\"compact-insight-card-bar-chart\" sx={{ flexShrink: 0 }}>\n <TinyBarChart\n color={(theme) =>\n categoryGuid ? getCategoryColor(categoryGuid, theme) : theme.palette.primary.main\n }\n data={bars}\n />\n </Box>\n )\n}\n\n/**\n * The card's right-hand visual, one component per ditto layout variant.\n *\n * A variant names a rendering *shape*, not an insight or a surface — `with_header` already serves\n * both Large Transaction and Fee Detected — so an insight wanting the badged logo reuses\n * `with_warning_badge`. Only a genuinely different visual registers a new entry, and existing ones\n * are never touched.\n *\n * `minimal` draws the plain logo and is registered explicitly even though it matches the fallback:\n * micro and notification resolve it on every render, and an unregistered variant warns. The\n * fallback is for variants we genuinely do not know.\n */\nconst InsightVisual = createVariantBlock<InsightVisualProps>({\n variants: {\n category_color: BarChartVisual,\n linked_logos: LinkedLogosVisual,\n minimal: PlainVisual,\n stacked_logos: StackedLogosVisual,\n with_illustration: IllustrationVisual,\n with_warning_badge: WarningBadgeVisual,\n },\n fallback: PlainVisual,\n name: 'InsightVisual',\n})\n\n/**\n * Beats whose embedded CTA the card reads from its own envelope key and opens in this card's\n * `ActionBlockLayer`, as a bar click does on the full card. The trigger names that key, so the layer\n * resolves the same CTA. Without a trigger the link posts its host message instead (Switch Direct\n * Deposit's op_1: Atomic runs only in pulse). Every other beat keeps `primary_cta` and hands it to\n * the host's `onCtaClick` (e.g. `contact_support_block`). A new beat adds its template here.\n */\nconst BEAT_CTA_CONFIG: Record<\n string,\n { key: 'primary_cta' | 'in_description_cta'; trigger?: ActionDrawerTrigger }\n> = {\n BillAmountNotStandard: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n ConnectDiscoveredAccountsV2: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n DuplicatePaymentV2: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n SwitchDirectDeposit: { key: 'in_description_cta' },\n}\n\nexport interface CompactInsightCardProps {\n /** A `micro` or `embedded` envelope. */\n payload: InsightsPayload\n /** The envelope's beat; when given, the card mounts its `ActionBlockLayer` for CTA drawers. */\n beat?: Beat\n /**\n * Makes the whole card the tap target. What a tap does is the host's decision (post to the\n * host app, open a drawer, …); the card never opens anything itself. Omit for a static card.\n */\n onTap?: () => void\n /** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */\n onCtaClick?: (cta: PrimaryCTA) => void\n /**\n * Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot\n * honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).\n */\n isCtaDisabled?: boolean\n}\n\nconst stopPropagation = (event: MouseEvent) => event.stopPropagation()\n\n/**\n * The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).\n *\n * Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML\n * description with the primary CTA under it, and on the right the slot's `logo` in a\n * `<BadgedTile>`. Under ditto's `with_warning_badge` variant the tile takes a status badge; under\n * `minimal` it draws the logo alone. The card lays out from the envelope alone and never reads\n * `widget_type`.\n *\n * The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot\n * carries no logo. The `pill` on the same envelope is the transaction row's, not the card's.\n */\nconst CompactInsightCard = ({\n beat,\n isCtaDisabled = false,\n onCtaClick,\n onTap,\n payload,\n}: CompactInsightCardProps) => {\n const stores = useGlobalStore()\n const { openActionDrawer } = useInsightsV2Store()\n const { description, instance_slot, primary_cta, title } = payload\n const beatCta = BEAT_CTA_CONFIG[payload.template ?? '']\n const cta = beatCta ? payload[beatCta.key] : primary_cta\n const message = payload.in_description_cta?.post_message_metadata\n // A link that posts needs its beat and message; without them it draws nothing.\n const canAct = !beatCta || !!beatCta.trigger || (!!beat && !!message)\n // Reduced variants (`minimal`, `with_warning_badge`) declare a bare `logo` slot.\n const rowLogo = slot<LogoRef>(instance_slot.data, 'logo')\n\n const handleCtaClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (isCtaDisabled || !cta) return\n\n if (beatCta) {\n if (beat && beatCta.trigger) openActionDrawer({ guid: beat.guid, trigger: beatCta.trigger })\n else if (beat && message) {\n const { action, ...extras } = message\n postCtaMessage({ beat, stores }, { action, payload: extras })\n }\n return\n }\n if (primary_cta) onCtaClick?.(primary_cta)\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n // Only the card itself: Enter on the CTA button is the button's own click.\n if (event.target !== event.currentTarget) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onTap?.()\n }\n }\n\n const interactiveProps = onTap\n ? { onClick: onTap, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 }\n : {}\n\n return (\n <>\n <Card\n data-testid=\"compact-insight-card\"\n {...interactiveProps}\n sx={{\n minWidth: 288,\n pb: 12,\n pl: 8,\n pr: 16,\n pt: 8,\n ...(onTap && { cursor: 'pointer' }),\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 8,\n justifyContent: 'space-between',\n pl: 8,\n pt: 4,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {title ?? ''}\n </Text>\n {/* The menu renders only when the host wired `onMenuAction` (BeatActionsProvider). */}\n <Box onClick={stopPropagation} sx={{ display: 'flex' }}>\n <InsightOptionsMenu />\n </Box>\n </Stack>\n\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 16, pl: 8 }}>\n <Stack sx={{ alignSelf: 'stretch', flex: 1, gap: 8, minWidth: 0, pt: 2 }}>\n {/* `html_text` is rendered server-side by mrs_content from the ditto copy template (bold\n amount / merchant), not user-authored input; painted the same way `BaseLayout` paints\n the full card's description. */}\n <P\n dangerouslySetInnerHTML={{ __html: description.html_text }}\n data-testid=\"compact-insight-card-description\"\n sx={{\n display: '-webkit-box',\n fontWeight: 'fontWeightRegular',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: DESCRIPTION_MAX_LINES,\n }}\n variant=\"subtitle2\"\n />\n {cta?.label && canAct && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // The label lines up with the description (the column pads 8; the tap target keeps\n // its padding). `my: 0` drops the theme's -12px text-button margin.\n ml: -8,\n my: 0,\n px: 8,\n ...(isCtaDisabled && {\n color: 'text.disabled',\n cursor: 'default',\n }),\n }}\n variant=\"text\"\n >\n <Text bold={true} variant=\"body2\">\n {cta.label}\n </Text>\n </Button>\n )}\n </Stack>\n\n <InsightVisual\n data={instance_slot.data}\n logo={rowLogo}\n template={payload.template}\n variant={instance_slot.variant}\n />\n </Stack>\n </Card>\n {/* Outside the Card: the drawer is a portal, and its clicks would otherwise bubble to `onTap`. */}\n {beat && <ActionBlockLayer beat={beat} />}\n </>\n )\n}\n\nexport default CompactInsightCard\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,IAAwB,GAGxB,IAAY,IAYZ,IAAmB,IACnB,KAAmB,IACnB,KAAoB,IAEpB,IAAU;AAAA,EACd,MAAM;AAAA,EACN,UAAU;AAAA,EACV,KAAK;AAAA,EACL,WAAW;AACb,GAMM,IAAA,CAAkB,EAAE,MAAA,EAAA,MACxB,IACE,gBAAA,EAAC,GAAD;AAAA,EAAoB,MAAA;AAAA,EAAM,MAAM;AAAY,CAAA,IAE5C,gBAAA,EAAC,GAAD;AAAA,EACE,eAAY;AAAA,EACZ,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,OAAO;AAAA,EACT;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAU,MAAM;AAAA,IAAM,MAAK;AAAA,IAAY,MAAM;AAAA,EAAK,CAAA;AAC3D,CAAA,GAIH,IAAA,CAAe,EAAE,MAAA,EAAA,MACrB,gBAAA,EAAC,GAAD;AAAA,EAAY,QAAQ,gBAAA,EAAC,GAAD,EAAsB,MAAA,EAAO,CAAA;AAAA,EAAG,MAAM;AAAA,EAAW,IAAI,EAAE,YAAY,EAAE;AAAI,CAAA,GAIzF,KAAA,CAAsB,EAAE,MAAA,EAAA,MAC5B,gBAA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,CAAA,GAAA,KAAQ,gBAAA,EAAC,GAAD,EAAwB,MAAA,EAAO,CAAA,CACxC,EAAA,CAAA;AAEN"}
|
|
@@ -3,7 +3,7 @@ import { ELEVATION_SHADOW as S } from "./shared/elevation.es.js";
|
|
|
3
3
|
import { Fragment as L } from "react";
|
|
4
4
|
import d from "@mui/material/Stack";
|
|
5
5
|
import { Text as m } from "@mxenabled/mxui";
|
|
6
|
-
import { Fragment as g, jsx as r, jsxs as
|
|
6
|
+
import { Fragment as g, jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
7
|
import B from "@mui/material/Box";
|
|
8
8
|
import u from "@mui/material/Divider";
|
|
9
9
|
var j = (n) => n === "primary" ? {
|
|
@@ -26,25 +26,25 @@ var j = (n) => n === "primary" ? {
|
|
|
26
26
|
headerBold: !0,
|
|
27
27
|
headerInsideBorder: !0,
|
|
28
28
|
headerSx: {
|
|
29
|
-
minHeight:
|
|
29
|
+
minHeight: 40,
|
|
30
30
|
px: 16,
|
|
31
31
|
py: 2
|
|
32
32
|
}
|
|
33
|
-
},
|
|
33
|
+
}, z = ({ background: n, badge: c, elevated: y = !1, footer: l, header: a, headerColor: C, raised: v = !1, rows: x, variant: f = "default", sx: w }) => {
|
|
34
34
|
if (x.length === 0) return null;
|
|
35
|
-
const e = j(
|
|
35
|
+
const e = j(f), o = !!n, t = o ? "8px" : e.radius, s = !!a && !o && e.headerInsideBorder, R = f === "default" ? C ?? e.headerColor : e.headerColor, h = a ? /* @__PURE__ */ r(d, {
|
|
36
36
|
sx: {
|
|
37
37
|
bgcolor: e.headerBg,
|
|
38
38
|
justifyContent: "center",
|
|
39
39
|
...e.headerSx
|
|
40
40
|
},
|
|
41
41
|
children: /* @__PURE__ */ r(m, {
|
|
42
|
-
bold: e.headerBold,
|
|
43
42
|
color: R,
|
|
43
|
+
sx: e.headerBold ? { fontWeight: 700 } : void 0,
|
|
44
44
|
variant: "caption",
|
|
45
|
-
children:
|
|
45
|
+
children: a
|
|
46
46
|
})
|
|
47
|
-
}) : null, T = l ? /* @__PURE__ */
|
|
47
|
+
}) : null, T = l ? /* @__PURE__ */ i(g, { children: [/* @__PURE__ */ r(u, {}), /* @__PURE__ */ i(d, {
|
|
48
48
|
sx: {
|
|
49
49
|
alignItems: "center",
|
|
50
50
|
bgcolor: o ? "background.paper" : "background.default",
|
|
@@ -67,12 +67,12 @@ var j = (n) => n === "primary" ? {
|
|
|
67
67
|
})] }) : null, k = /* @__PURE__ */ r(d, {
|
|
68
68
|
role: "list",
|
|
69
69
|
sx: { width: "100%" },
|
|
70
|
-
children: x.map((p,
|
|
70
|
+
children: x.map((p, b) => /* @__PURE__ */ i(L, { children: [b > 0 && /* @__PURE__ */ r(u, { role: "presentation" }), /* @__PURE__ */ r(B, {
|
|
71
71
|
role: "listitem",
|
|
72
72
|
children: /* @__PURE__ */ r(I, { ...p })
|
|
73
|
-
})] },
|
|
73
|
+
})] }, b))
|
|
74
74
|
});
|
|
75
|
-
return /* @__PURE__ */
|
|
75
|
+
return /* @__PURE__ */ i(d, {
|
|
76
76
|
"data-testid": "transaction-list-card",
|
|
77
77
|
sx: {
|
|
78
78
|
...o ? {
|
|
@@ -104,7 +104,7 @@ var j = (n) => n === "primary" ? {
|
|
|
104
104
|
},
|
|
105
105
|
children: h
|
|
106
106
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ i(d, {
|
|
108
108
|
sx: {
|
|
109
109
|
...o ? {
|
|
110
110
|
bgcolor: "background.paper",
|
|
@@ -123,13 +123,13 @@ var j = (n) => n === "primary" ? {
|
|
|
123
123
|
},
|
|
124
124
|
borderBottomLeftRadius: t,
|
|
125
125
|
borderBottomRightRadius: t,
|
|
126
|
-
borderTopLeftRadius: s || !
|
|
127
|
-
borderTopRightRadius: s || !
|
|
126
|
+
borderTopLeftRadius: s || !a ? t : 0,
|
|
127
|
+
borderTopRightRadius: s || !a ? t : 0,
|
|
128
128
|
overflow: "hidden",
|
|
129
129
|
width: "100%"
|
|
130
130
|
},
|
|
131
131
|
children: [
|
|
132
|
-
s && /* @__PURE__ */
|
|
132
|
+
s && /* @__PURE__ */ i(g, { children: [h, /* @__PURE__ */ r(u, {})] }),
|
|
133
133
|
k,
|
|
134
134
|
T
|
|
135
135
|
]
|
|
@@ -138,7 +138,7 @@ var j = (n) => n === "primary" ? {
|
|
|
138
138
|
});
|
|
139
139
|
};
|
|
140
140
|
export {
|
|
141
|
-
|
|
141
|
+
z as default
|
|
142
142
|
};
|
|
143
143
|
|
|
144
144
|
//# sourceMappingURL=TransactionListCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionListCard.es.js","names":[],"sources":["../../../src/insights-v2/components/TransactionListCard.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport InsightTransactionRow, { type InsightTransactionRowProps } from './InsightTransactionRow'\nimport { ELEVATION_SHADOW } from './shared/elevation'\n\nexport interface FooterRow {\n label: ReactNode\n amount: ReactNode\n amountColor?: string\n}\n\ntype TransactionListCardVariant = 'default' | 'primary'\n\ninterface TransactionListCardProps {\n /** Optional header label above the rows (e.g. \"{Date}\", \"3 transactions\"). */\n header?: ReactNode\n /** Theme colour for the header label, over the variant's own. */\n headerColor?: string\n /** One or more transaction rows. */\n rows: InsightTransactionRowProps[]\n /** Optional summary/total row rendered beneath a divider. */\n footer?: FooterRow\n /**\n * Card style:\n * - `default` — grey utility header, hairline border, radius 4.\n * - `primary` — filled `primary.main` header with white text and a matching\n * border, radius 8 (Figma \"Multi\" variant).\n *\n * In both cases the header is borderless; the border wraps the content block\n * below it.\n */\n variant?: TransactionListCardVariant\n /**\n * Optional background applied to the Slot behind the card. Must be a valid CSS\n * background string (gradient or color in CSS format); MUI theme tokens are\n * not resolved here (this is the CSS `background` shorthand, not `bgcolor`), so\n * use a CSS color literal instead. When set, the inner card renders borderless\n * on a white surface inside the padded Slot (Figma HSA Deposit), unless `raised`.\n */\n background?: string\n /** Status disc over the card's corner (needs `background`). */\n badge?: ReactNode\n /** Card at elevation/1 on the wash; not with `raised` (its shadow wins). */\n elevated?: boolean\n /** Border and shadow on the inner card; only with `background` (Figma Transaction Row). */\n raised?: boolean\n sx?: SxProps\n}\n\nconst getVariantStyles = (variant: TransactionListCardVariant) => {\n switch (variant) {\n case 'primary':\n // Borderless filled header on top of the bordered rows block.\n return {\n radius: '8px',\n borderColor: 'primary.main',\n headerBg: 'primary.main',\n headerColor: 'primary.contrastText',\n headerBold: false,\n headerInsideBorder: false,\n headerSx: { minHeight: 24, px: 12, py: 4 } as const,\n }\n default:\n // A single border wraps the card; the grey header sits inside it.\n return {\n radius: '8px',\n borderColor: 'divider',\n headerBg: 'background.default',\n headerColor: 'text.primary',\n headerBold: true,\n headerInsideBorder: true,\n headerSx: { minHeight: 36, px: 16, py: 2 } as const,\n }\n }\n}\n\n/**\n * List card composing an optional header label, one or more\n * `InsightTransactionRow`s (divided), and an optional footer/total row.\n * `variant` supplies the Figma design defaults for the two card styles.\n *\n * Scope is the Content section only; Header/Description are out of scope.\n */\nconst TransactionListCard = ({\n background,\n badge,\n elevated = false,\n footer,\n header,\n headerColor,\n raised = false,\n rows,\n variant = 'default',\n sx,\n}: TransactionListCardProps) => {\n // rows usually comes from mapped API data, so an empty array is reachable and\n // would render a broken border shell; render nothing instead.\n if (rows.length === 0) return null\n\n const styles = getVariantStyles(variant)\n const hasBackground = Boolean(background)\n const radius = hasBackground ? '8px' : styles.radius\n // The header sits inside the border only for the bordered `default` variant;\n // for `primary`/backgrounded cards it sits above a separately-bordered body.\n const headerInsideBorder = Boolean(header) && !hasBackground && styles.headerInsideBorder\n\n const headerTextColor =\n variant === 'default' ? (headerColor ?? styles.headerColor) : styles.headerColor\n\n const headerBlock = header ? (\n <Stack sx={{ bgcolor: styles.headerBg, justifyContent: 'center', ...styles.headerSx }}>\n <Text bold={styles.headerBold} color={headerTextColor} variant=\"caption\">\n {header}\n </Text>\n </Stack>\n ) : null\n\n const footerBlock = footer ? (\n <>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: hasBackground ? 'background.paper' : 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {footer.label}\n </Text>\n <Text bold={true} color={footer.amountColor ?? 'text.primary'} variant=\"body2\">\n {footer.amount}\n </Text>\n </Stack>\n </>\n ) : null\n\n const rowsBlock = (\n <Stack role=\"list\" sx={{ width: '100%' }}>\n {rows.map((row, index) => (\n // Static, caller-ordered list that may contain identical rows, so the\n // array index is the correct key (a content-based key would collide).\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={index}>\n {index > 0 && <Divider role=\"presentation\" />}\n <Box role=\"listitem\">\n <InsightTransactionRow {...row} />\n </Box>\n </Fragment>\n ))}\n </Stack>\n )\n\n return (\n <Stack\n data-testid=\"transaction-list-card\"\n sx={{\n ...(hasBackground ? { background, p: 16 } : { pt: 8, px: 16 }),\n ...(hasBackground && badge ? { position: 'relative' } : {}),\n width: '100%',\n ...sx,\n }}\n >\n {hasBackground &&\n badge && (\n // Centred on the card's top-left corner.\n <Box sx={{ left: 16, position: 'absolute', top: 12, zIndex: 1 }}>{badge}</Box>\n )}\n {/* Header above the border for `primary`/backgrounded cards; top-rounded. */}\n {!headerInsideBorder && headerBlock && (\n <Stack\n sx={{\n borderTopLeftRadius: radius,\n borderTopRightRadius: radius,\n overflow: 'hidden',\n }}\n >\n {headerBlock}\n </Stack>\n )}\n\n <Stack\n sx={{\n ...(hasBackground\n ? {\n bgcolor: 'background.paper',\n // elevation/1 shadow plus the dark-mode tint.\n ...(elevated && {\n backgroundImage: (theme: Theme) => theme.vars?.overlays?.[1] ?? 'none',\n boxShadow: ELEVATION_SHADOW[1],\n }),\n ...(raised && { border: '1px solid', borderColor: 'divider', boxShadow: 1 }),\n }\n : { border: '1px solid', borderColor: styles.borderColor }),\n borderBottomLeftRadius: radius,\n borderBottomRightRadius: radius,\n borderTopLeftRadius: headerInsideBorder || !header ? radius : 0,\n borderTopRightRadius: headerInsideBorder || !header ? radius : 0,\n overflow: 'hidden',\n width: '100%',\n }}\n >\n {/* Header inside the border for the `default` table variant. */}\n {headerInsideBorder && (\n <>\n {headerBlock}\n <Divider />\n </>\n )}\n {rowsBlock}\n {footerBlock}\n </Stack>\n </Stack>\n )\n}\n\nexport default TransactionListCard\n"],"mappings":";;;;;;;;AAwDA,IAAM,IAAA,CAAoB,MAChB,MACD,YAEI;AAAA,EACL,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,UAAU;AAAA,IAAE,WAAW;AAAA,IAAI,IAAI;AAAA,IAAI,IAAI;AAAA,EAAE;AAC3C,IAGO;AAAA,EACL,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,UAAU;AAAA,IAAE,WAAW;AAAA,IAAI,IAAI;AAAA,IAAI,IAAI;AAAA,EAAE;AAC3C,GAWA,IAAA,CAAuB,EAC3B,YAAA,GACA,OAAA,GACA,UAAA,IAAW,IACX,QAAA,GACA,QAAA,GACA,aAAA,GACA,QAAA,IAAS,IACT,MAAA,GACA,SAAA,IAAU,WACV,IAAA,EAAA,MAC8B;AAG9B,MAAI,EAAK,WAAW,EAAG,QAAO;AAE9B,QAAM,IAAS,EAAiB,CAAO,GACjC,IAAgB,EAAQ,GACxB,IAAS,IAAgB,QAAQ,EAAO,QAGxC,IAAqB,EAAQ,KAAW,CAAC,KAAiB,EAAO,oBAEjE,IACJ,MAAY,YAAa,KAAe,EAAO,cAAe,EAAO,aAEjE,I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AAU;AAAA,UACV,OAAO;AAAA,QACT;AAAA,QAnBF,UAAA;AAAA,UAsBG,KACC,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,GACD,gBAAA,EAAC,GAAD,CAAU,CAAA,CACV,EAAA,CAAA;AAAA,UAEH;AAAA,UACA;AAAA,QACI;AAAA;IACF;AAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"TransactionListCard.es.js","names":[],"sources":["../../../src/insights-v2/components/TransactionListCard.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport InsightTransactionRow, { type InsightTransactionRowProps } from './InsightTransactionRow'\nimport { ELEVATION_SHADOW } from './shared/elevation'\n\nexport interface FooterRow {\n label: ReactNode\n amount: ReactNode\n amountColor?: string\n}\n\ntype TransactionListCardVariant = 'default' | 'primary'\n\ninterface TransactionListCardProps {\n /** Optional header label above the rows (e.g. \"{Date}\", \"3 transactions\"). */\n header?: ReactNode\n /** Theme colour for the header label, over the variant's own. */\n headerColor?: string\n /** One or more transaction rows. */\n rows: InsightTransactionRowProps[]\n /** Optional summary/total row rendered beneath a divider. */\n footer?: FooterRow\n /**\n * Card style:\n * - `default` — grey utility header, hairline border, radius 4.\n * - `primary` — filled `primary.main` header with white text and a matching\n * border, radius 8 (Figma \"Multi\" variant).\n *\n * In both cases the header is borderless; the border wraps the content block\n * below it.\n */\n variant?: TransactionListCardVariant\n /**\n * Optional background applied to the Slot behind the card. Must be a valid CSS\n * background string (gradient or color in CSS format); MUI theme tokens are\n * not resolved here (this is the CSS `background` shorthand, not `bgcolor`), so\n * use a CSS color literal instead. When set, the inner card renders borderless\n * on a white surface inside the padded Slot (Figma HSA Deposit), unless `raised`.\n */\n background?: string\n /** Status disc over the card's corner (needs `background`). */\n badge?: ReactNode\n /** Card at elevation/1 on the wash; not with `raised` (its shadow wins). */\n elevated?: boolean\n /** Border and shadow on the inner card; only with `background` (Figma Transaction Row). */\n raised?: boolean\n sx?: SxProps\n}\n\nconst getVariantStyles = (variant: TransactionListCardVariant) => {\n switch (variant) {\n case 'primary':\n // Borderless filled header on top of the bordered rows block.\n return {\n radius: '8px',\n borderColor: 'primary.main',\n headerBg: 'primary.main',\n headerColor: 'primary.contrastText',\n headerBold: false,\n headerInsideBorder: false,\n headerSx: { minHeight: 24, px: 12, py: 4 } as const,\n }\n default:\n // A single border wraps the card; the grey header sits inside it.\n return {\n radius: '8px',\n borderColor: 'divider',\n headerBg: 'background.default',\n headerColor: 'text.primary',\n headerBold: true,\n headerInsideBorder: true,\n headerSx: { minHeight: 40, px: 16, py: 2 } as const,\n }\n }\n}\n\n/**\n * List card composing an optional header label, one or more\n * `InsightTransactionRow`s (divided), and an optional footer/total row.\n * `variant` supplies the Figma design defaults for the two card styles.\n *\n * Scope is the Content section only; Header/Description are out of scope.\n */\nconst TransactionListCard = ({\n background,\n badge,\n elevated = false,\n footer,\n header,\n headerColor,\n raised = false,\n rows,\n variant = 'default',\n sx,\n}: TransactionListCardProps) => {\n // rows usually comes from mapped API data, so an empty array is reachable and\n // would render a broken border shell; render nothing instead.\n if (rows.length === 0) return null\n\n const styles = getVariantStyles(variant)\n const hasBackground = Boolean(background)\n const radius = hasBackground ? '8px' : styles.radius\n // The header sits inside the border only for the bordered `default` variant;\n // for `primary`/backgrounded cards it sits above a separately-bordered body.\n const headerInsideBorder = Boolean(header) && !hasBackground && styles.headerInsideBorder\n\n const headerTextColor =\n variant === 'default' ? (headerColor ?? styles.headerColor) : styles.headerColor\n\n const headerBlock = header ? (\n <Stack sx={{ bgcolor: styles.headerBg, justifyContent: 'center', ...styles.headerSx }}>\n <Text\n color={headerTextColor}\n sx={styles.headerBold ? { fontWeight: 700 } : undefined}\n variant=\"caption\"\n >\n {header}\n </Text>\n </Stack>\n ) : null\n\n const footerBlock = footer ? (\n <>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: hasBackground ? 'background.paper' : 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {footer.label}\n </Text>\n <Text bold={true} color={footer.amountColor ?? 'text.primary'} variant=\"body2\">\n {footer.amount}\n </Text>\n </Stack>\n </>\n ) : null\n\n const rowsBlock = (\n <Stack role=\"list\" sx={{ width: '100%' }}>\n {rows.map((row, index) => (\n // Static, caller-ordered list that may contain identical rows, so the\n // array index is the correct key (a content-based key would collide).\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={index}>\n {index > 0 && <Divider role=\"presentation\" />}\n <Box role=\"listitem\">\n <InsightTransactionRow {...row} />\n </Box>\n </Fragment>\n ))}\n </Stack>\n )\n\n return (\n <Stack\n data-testid=\"transaction-list-card\"\n sx={{\n ...(hasBackground ? { background, p: 16 } : { pt: 8, px: 16 }),\n ...(hasBackground && badge ? { position: 'relative' } : {}),\n width: '100%',\n ...sx,\n }}\n >\n {hasBackground &&\n badge && (\n // Centred on the card's top-left corner.\n <Box sx={{ left: 16, position: 'absolute', top: 12, zIndex: 1 }}>{badge}</Box>\n )}\n {/* Header above the border for `primary`/backgrounded cards; top-rounded. */}\n {!headerInsideBorder && headerBlock && (\n <Stack\n sx={{\n borderTopLeftRadius: radius,\n borderTopRightRadius: radius,\n overflow: 'hidden',\n }}\n >\n {headerBlock}\n </Stack>\n )}\n\n <Stack\n sx={{\n ...(hasBackground\n ? {\n bgcolor: 'background.paper',\n // elevation/1 shadow plus the dark-mode tint.\n ...(elevated && {\n backgroundImage: (theme: Theme) => theme.vars?.overlays?.[1] ?? 'none',\n boxShadow: ELEVATION_SHADOW[1],\n }),\n ...(raised && { border: '1px solid', borderColor: 'divider', boxShadow: 1 }),\n }\n : { border: '1px solid', borderColor: styles.borderColor }),\n borderBottomLeftRadius: radius,\n borderBottomRightRadius: radius,\n borderTopLeftRadius: headerInsideBorder || !header ? radius : 0,\n borderTopRightRadius: headerInsideBorder || !header ? radius : 0,\n overflow: 'hidden',\n width: '100%',\n }}\n >\n {/* Header inside the border for the `default` table variant. */}\n {headerInsideBorder && (\n <>\n {headerBlock}\n <Divider />\n </>\n )}\n {rowsBlock}\n {footerBlock}\n </Stack>\n </Stack>\n )\n}\n\nexport default TransactionListCard\n"],"mappings":";;;;;;;;AAwDA,IAAM,IAAA,CAAoB,MAChB,MACD,YAEI;AAAA,EACL,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,UAAU;AAAA,IAAE,WAAW;AAAA,IAAI,IAAI;AAAA,IAAI,IAAI;AAAA,EAAE;AAC3C,IAGO;AAAA,EACL,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,UAAU;AAAA,EACV,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,oBAAoB;AAAA,EACpB,UAAU;AAAA,IAAE,WAAW;AAAA,IAAI,IAAI;AAAA,IAAI,IAAI;AAAA,EAAE;AAC3C,GAWA,IAAA,CAAuB,EAC3B,YAAA,GACA,OAAA,GACA,UAAA,IAAW,IACX,QAAA,GACA,QAAA,GACA,aAAA,GACA,QAAA,IAAS,IACT,MAAA,GACA,SAAA,IAAU,WACV,IAAA,EAAA,MAC8B;AAG9B,MAAI,EAAK,WAAW,EAAG,QAAO;AAE9B,QAAM,IAAS,EAAiB,CAAO,GACjC,IAAgB,EAAQ,GACxB,IAAS,IAAgB,QAAQ,EAAO,QAGxC,IAAqB,EAAQ,KAAW,CAAC,KAAiB,EAAO,oBAEjE,IACJ,MAAY,YAAa,KAAe,EAAO,cAAe,EAAO,aAEjE,IAAc,IAClB,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,SAAS,EAAO;AAAA,MAAU,gBAAgB;AAAA,MAAU,GAAG,EAAO;AAAA,IAAS;AA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