@mx-cartographer/experiences 9.7.138 → 9.7.139
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/dist/insights/components/shared/ChartDrawerTemplate/TipSection.es.js +19 -19
- package/dist/insights/components/shared/ChartDrawerTemplate/TipSection.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +57 -55
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
## [9.7.139] - 11-11-2026
|
|
2
|
+
|
|
3
|
+
- **FIXED** - Bill Amount Not Standard: the embedded card is 98px, matching Figma, instead of 109px; its chart is a fixed 75x54 (was 85x54, `TinyBarChart`'s default width); the Full/Embedded/Mini chart color and the drilldown tip's close/dismiss icon color (`text.primary`, now `TipSection`'s shared default for the dismiss icon only — the action/chevron icon is unchanged, pending its own Figma confirmation) (WEC-2291)
|
|
4
|
+
- **CHANGED** - Storybook: the Bill Amount Not Standard notification reads "Your bill from **{merchant}** increased/decreased by **{x}%**." (was the full card description), matching mrs_content's new `notification:` copy (WEC-2291)
|
|
5
|
+
|
|
1
6
|
## [9.7.138] - 11-11-2026
|
|
2
7
|
|
|
3
8
|
- **FIXED** - Set Up / Switch Direct Deposit complete tile: the wash is Figma's `linear-gradient(257deg, rgba(255, 224, 153, 0.2) 1.86%, rgba(173, 248, 44, 0.2) 101.54%)` (`DIRECT_DEPOSIT_COMPLETE_GRADIENT`); the warm-lime accent other blocks use is unchanged (WEC-2289)
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Icon as
|
|
3
|
-
import { jsx as r, jsxs as
|
|
4
|
-
import
|
|
5
|
-
var
|
|
1
|
+
import l from "@mui/material/Stack";
|
|
2
|
+
import { Icon as n, P as f } from "@mxenabled/mxui";
|
|
3
|
+
import { jsx as r, jsxs as a } from "react/jsx-runtime";
|
|
4
|
+
import x from "@mui/material/IconButton";
|
|
5
|
+
var h = {
|
|
6
6
|
color: "info",
|
|
7
7
|
name: "lightbulb",
|
|
8
8
|
size: 24
|
|
9
|
-
},
|
|
10
|
-
const
|
|
11
|
-
return /* @__PURE__ */
|
|
9
|
+
}, I = ({ message: m, tipAriaLabel: c, onDismiss: o, onAction: t, sx: s, icon: e = h }) => {
|
|
10
|
+
const i = t || o, p = t ? "chevron_right" : "close";
|
|
11
|
+
return /* @__PURE__ */ a(l, {
|
|
12
12
|
sx: {
|
|
13
13
|
backgroundColor: "primary.lighter",
|
|
14
14
|
borderRadius: "8px",
|
|
@@ -20,14 +20,14 @@ var x = {
|
|
|
20
20
|
justifyContent: "space-between",
|
|
21
21
|
flexDirection: "row",
|
|
22
22
|
gap: 8,
|
|
23
|
-
...
|
|
23
|
+
...s
|
|
24
24
|
},
|
|
25
|
-
children: [/* @__PURE__ */
|
|
25
|
+
children: [/* @__PURE__ */ a(l, {
|
|
26
26
|
sx: {
|
|
27
27
|
flexDirection: "row",
|
|
28
28
|
gap: 4
|
|
29
29
|
},
|
|
30
|
-
children: [/* @__PURE__ */ r(
|
|
30
|
+
children: [/* @__PURE__ */ r(n, {
|
|
31
31
|
color: e.color,
|
|
32
32
|
fill: !0,
|
|
33
33
|
name: e.name,
|
|
@@ -37,19 +37,19 @@ var x = {
|
|
|
37
37
|
fontWeight: 400,
|
|
38
38
|
noWrap: !1,
|
|
39
39
|
variant: "subtitle2",
|
|
40
|
-
children:
|
|
40
|
+
children: m
|
|
41
41
|
})]
|
|
42
|
-
}),
|
|
43
|
-
"aria-label":
|
|
44
|
-
onClick:
|
|
42
|
+
}), i && /* @__PURE__ */ r(x, {
|
|
43
|
+
"aria-label": c,
|
|
44
|
+
onClick: i,
|
|
45
45
|
size: "small",
|
|
46
46
|
sx: {
|
|
47
47
|
minHeight: 0,
|
|
48
48
|
minWidth: 0,
|
|
49
|
-
p: 0
|
|
49
|
+
p: 0,
|
|
50
|
+
...o && { "& .MuiSvgIcon-root": { color: "text.primary" } }
|
|
50
51
|
},
|
|
51
|
-
children: /* @__PURE__ */ r(
|
|
52
|
-
color: "primary",
|
|
52
|
+
children: /* @__PURE__ */ r(n, {
|
|
53
53
|
fill: !0,
|
|
54
54
|
name: p,
|
|
55
55
|
size: 20
|
|
@@ -58,7 +58,7 @@ var x = {
|
|
|
58
58
|
});
|
|
59
59
|
};
|
|
60
60
|
export {
|
|
61
|
-
|
|
61
|
+
I as TipSection
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
//# sourceMappingURL=TipSection.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TipSection.es.js","names":[],"sources":["../../../../../src/insights/components/shared/ChartDrawerTemplate/TipSection.tsx"],"sourcesContent":["import { Icon, P } from '@mxenabled/mxui'\n\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\nimport { type SxProps } from '@mui/material/styles'\n\nexport interface TipSectionIcon {\n color: 'info' | 'primary'\n name: string\n size: number\n}\n\nconst DEFAULT_TIP_ICON: TipSectionIcon = { color: 'info', name: 'lightbulb', size: 24 }\n\nexport interface TipSectionProps {\n message: React.ReactNode\n tipAriaLabel?: string\n onDismiss?: () => void\n onAction?: () => void\n sx?: SxProps\n icon?: TipSectionIcon\n}\n\nexport const TipSection = ({\n message,\n tipAriaLabel,\n onDismiss,\n onAction,\n sx,\n icon = DEFAULT_TIP_ICON,\n}: TipSectionProps) => {\n // Priority: action > dismiss > nothing\n const buttonHandler = onAction || onDismiss\n const iconName = onAction ? 'chevron_right' : 'close'\n\n return (\n <Stack\n sx={{\n backgroundColor: 'primary.lighter',\n borderRadius: '8px',\n mb: 24,\n mt: 12,\n p: 12,\n mx: 24,\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n flexDirection: 'row',\n gap: 8,\n ...sx,\n }}\n >\n <Stack sx={{ flexDirection: 'row', gap: 4 }}>\n <Icon color={icon.color} fill={true} name={icon.name} size={icon.size} />\n <P color=\"primary.dark\" fontWeight={400} noWrap={false} variant=\"subtitle2\">\n {message}\n </P>\n </Stack>\n\n {buttonHandler && (\n <IconButton\n aria-label={tipAriaLabel}\n onClick={buttonHandler}\n size=\"small\"\n sx={{
|
|
1
|
+
{"version":3,"file":"TipSection.es.js","names":[],"sources":["../../../../../src/insights/components/shared/ChartDrawerTemplate/TipSection.tsx"],"sourcesContent":["import { Icon, P } from '@mxenabled/mxui'\n\nimport IconButton from '@mui/material/IconButton'\nimport Stack from '@mui/material/Stack'\nimport { type SxProps } from '@mui/material/styles'\n\nexport interface TipSectionIcon {\n color: 'info' | 'primary'\n name: string\n size: number\n}\n\nconst DEFAULT_TIP_ICON: TipSectionIcon = { color: 'info', name: 'lightbulb', size: 24 }\n\nexport interface TipSectionProps {\n message: React.ReactNode\n tipAriaLabel?: string\n onDismiss?: () => void\n onAction?: () => void\n sx?: SxProps\n icon?: TipSectionIcon\n}\n\nexport const TipSection = ({\n message,\n tipAriaLabel,\n onDismiss,\n onAction,\n sx,\n icon = DEFAULT_TIP_ICON,\n}: TipSectionProps) => {\n // Priority: action > dismiss > nothing\n const buttonHandler = onAction || onDismiss\n const iconName = onAction ? 'chevron_right' : 'close'\n\n return (\n <Stack\n sx={{\n backgroundColor: 'primary.lighter',\n borderRadius: '8px',\n mb: 24,\n mt: 12,\n p: 12,\n mx: 24,\n alignItems: 'flex-start',\n justifyContent: 'space-between',\n flexDirection: 'row',\n gap: 8,\n ...sx,\n }}\n >\n <Stack sx={{ flexDirection: 'row', gap: 4 }}>\n <Icon color={icon.color} fill={true} name={icon.name} size={icon.size} />\n <P color=\"primary.dark\" fontWeight={400} noWrap={false} variant=\"subtitle2\">\n {message}\n </P>\n </Stack>\n\n {buttonHandler && (\n <IconButton\n aria-label={tipAriaLabel}\n onClick={buttonHandler}\n size=\"small\"\n sx={{\n minHeight: 0,\n minWidth: 0,\n p: 0,\n ...(onDismiss && { '& .MuiSvgIcon-root': { color: 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MAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAM,MAAM;AAAA,QAAU,MAAM;AAAA,MAAK,CAAA;AAAA,IACnC,CAAA,CAET;AAAA;AAEX"}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
1
|
import { useGlobalStore as V, useInsightsV2Store as G } from "../../common/context/hooks.es.js";
|
|
2
|
-
import { slot as
|
|
3
|
-
import { getCategoryColor as
|
|
4
|
-
import { TinyBarChart as
|
|
5
|
-
import { BAR_ARIA_LABEL as
|
|
6
|
-
import { ThemedSVGImage as
|
|
7
|
-
import { asLogoRef as
|
|
8
|
-
import { postCtaMessage as
|
|
2
|
+
import { slot as b } from "../../core/types/Insights.es.js";
|
|
3
|
+
import { getCategoryColor as H } from "../../core/utils/CategoryUtil.es.js";
|
|
4
|
+
import { TinyBarChart as W } from "../../common/components/TinyBarChart.es.js";
|
|
5
|
+
import { BAR_ARIA_LABEL as N, buildChartData as P, buildDataSeries as K } from "../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
6
|
+
import { ThemedSVGImage as j } from "./chartblocks/ThemedSVGImage.es.js";
|
|
7
|
+
import { asLogoRef as M } from "../blocks/slotReaders.es.js";
|
|
8
|
+
import { postCtaMessage as F } from "../ctaActions/runCtaAction.es.js";
|
|
9
9
|
import p from "./LogoFromGuid.es.js";
|
|
10
10
|
import { createVariantBlock as Z } from "../blocks/createVariantBlock.es.js";
|
|
11
11
|
import { ActionBlockLayer as X } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
12
|
-
import
|
|
12
|
+
import v from "./BadgedTile.es.js";
|
|
13
13
|
import { InsightOptionsMenu as $ } from "./InsightOptionsMenu.es.js";
|
|
14
14
|
import { ReactComponent as q } from "./shared/images/FeeDetected.es.js";
|
|
15
|
-
import
|
|
15
|
+
import D from "./StatusBadge.es.js";
|
|
16
16
|
import x from "@mui/material/Stack";
|
|
17
17
|
import { P as J, Text as C } from "@mxenabled/mxui";
|
|
18
18
|
import Q from "@mui/material/Button";
|
|
19
|
-
import { Icon as
|
|
19
|
+
import { Icon as y } from "@mxenabled/mx-icons";
|
|
20
20
|
import { Fragment as U, jsx as t, jsxs as d } from "react/jsx-runtime";
|
|
21
21
|
import e from "@mui/material/Box";
|
|
22
22
|
import Y from "@mui/material/Card";
|
|
@@ -25,7 +25,7 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
25
25
|
position: "absolute",
|
|
26
26
|
top: "50%",
|
|
27
27
|
transform: "translate(-50%, -50%)"
|
|
28
|
-
}, k = ({ logo: r }) => r ? /* @__PURE__ */ t(p, {
|
|
28
|
+
}, et = 54, ot = 75, k = ({ logo: r }) => r ? /* @__PURE__ */ t(p, {
|
|
29
29
|
logo: r,
|
|
30
30
|
size: c
|
|
31
31
|
}) : /* @__PURE__ */ t(e, {
|
|
@@ -38,22 +38,22 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
38
38
|
justifyContent: "center",
|
|
39
39
|
width: c
|
|
40
40
|
},
|
|
41
|
-
children: /* @__PURE__ */ t(
|
|
41
|
+
children: /* @__PURE__ */ t(y, {
|
|
42
42
|
color: "primary",
|
|
43
43
|
fill: !0,
|
|
44
44
|
name: "lightbulb",
|
|
45
45
|
size: 24
|
|
46
46
|
})
|
|
47
|
-
}), w = ({ logo: r }) => /* @__PURE__ */ t(
|
|
47
|
+
}), w = ({ logo: r }) => /* @__PURE__ */ t(v, {
|
|
48
48
|
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
49
49
|
size: c,
|
|
50
50
|
sx: { flexShrink: 0 }
|
|
51
|
-
}),
|
|
51
|
+
}), at = ({ logo: r }) => /* @__PURE__ */ t(v, {
|
|
52
52
|
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
53
53
|
size: c,
|
|
54
54
|
sx: { flexShrink: 0 },
|
|
55
|
-
topRight: /* @__PURE__ */ t(
|
|
56
|
-
}),
|
|
55
|
+
topRight: /* @__PURE__ */ t(D, { tone: "warning" })
|
|
56
|
+
}), nt = 24, st = ({ logo: r }) => /* @__PURE__ */ t(v, {
|
|
57
57
|
bottomLeft: r ? /* @__PURE__ */ t(e, {
|
|
58
58
|
"aria-hidden": !0,
|
|
59
59
|
sx: {
|
|
@@ -68,21 +68,21 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
68
68
|
...r,
|
|
69
69
|
alt: void 0
|
|
70
70
|
},
|
|
71
|
-
size:
|
|
71
|
+
size: nt
|
|
72
72
|
})
|
|
73
73
|
}) : void 0,
|
|
74
74
|
center: /* @__PURE__ */ t(k, { logo: r }),
|
|
75
75
|
size: c,
|
|
76
76
|
sx: { flexShrink: 0 },
|
|
77
|
-
topRight: /* @__PURE__ */ t(
|
|
78
|
-
}),
|
|
77
|
+
topRight: /* @__PURE__ */ t(D, { tone: "error" })
|
|
78
|
+
}), lt = () => /* @__PURE__ */ t(j, {
|
|
79
79
|
divProps: { style: {
|
|
80
80
|
flexShrink: 0,
|
|
81
81
|
lineHeight: 0,
|
|
82
82
|
width: "max-content"
|
|
83
83
|
} },
|
|
84
84
|
image: q
|
|
85
|
-
}),
|
|
85
|
+
}), _ = 24, dt = () => /* @__PURE__ */ t(e, {
|
|
86
86
|
"aria-hidden": !0,
|
|
87
87
|
"data-testid": "linked-logos-badge",
|
|
88
88
|
sx: {
|
|
@@ -97,12 +97,12 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
97
97
|
p: 2,
|
|
98
98
|
zIndex: 1
|
|
99
99
|
},
|
|
100
|
-
children: /* @__PURE__ */ t(
|
|
100
|
+
children: /* @__PURE__ */ t(y, {
|
|
101
101
|
name: "link",
|
|
102
102
|
size: 16,
|
|
103
103
|
sx: { color: "primary.contrastText" }
|
|
104
104
|
})
|
|
105
|
-
}),
|
|
105
|
+
}), ct = () => /* @__PURE__ */ t(e, {
|
|
106
106
|
"aria-hidden": !0,
|
|
107
107
|
"data-testid": "linked-logos-badge",
|
|
108
108
|
sx: {
|
|
@@ -111,22 +111,22 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
111
111
|
bgcolor: "primary.contrastText",
|
|
112
112
|
borderRadius: "50%",
|
|
113
113
|
display: "flex",
|
|
114
|
-
height:
|
|
114
|
+
height: _,
|
|
115
115
|
justifyContent: "center",
|
|
116
116
|
overflow: "hidden",
|
|
117
|
-
width:
|
|
117
|
+
width: _,
|
|
118
118
|
zIndex: 1
|
|
119
119
|
},
|
|
120
|
-
children: /* @__PURE__ */ t(
|
|
120
|
+
children: /* @__PURE__ */ t(y, {
|
|
121
121
|
name: "swap_vertical_circle",
|
|
122
|
-
size:
|
|
122
|
+
size: _ * 1.2,
|
|
123
123
|
sx: {
|
|
124
124
|
color: "primary.main",
|
|
125
125
|
flexShrink: 0,
|
|
126
126
|
transform: "rotate(-90deg)"
|
|
127
127
|
}
|
|
128
128
|
})
|
|
129
|
-
}),
|
|
129
|
+
}), pt = ({ data: r, template: o }) => {
|
|
130
130
|
const { from_logo: l, to_logo: a } = r ?? {}, i = o === "SwitchDirectDeposit";
|
|
131
131
|
return /* @__PURE__ */ d(e, {
|
|
132
132
|
sx: {
|
|
@@ -188,33 +188,35 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
188
188
|
size: I
|
|
189
189
|
})
|
|
190
190
|
}),
|
|
191
|
-
i ? /* @__PURE__ */ t(
|
|
191
|
+
i ? /* @__PURE__ */ t(ct, {}) : /* @__PURE__ */ t(dt, {})
|
|
192
192
|
]
|
|
193
193
|
});
|
|
194
|
-
},
|
|
195
|
-
const o =
|
|
194
|
+
}, gt = ({ data: r }) => {
|
|
195
|
+
const o = K(b(r, "series"));
|
|
196
196
|
if (!o.length) return null;
|
|
197
|
-
const l =
|
|
197
|
+
const l = b(r, "category_guid"), a = P(o, N).slice(-3);
|
|
198
198
|
return /* @__PURE__ */ t(e, {
|
|
199
199
|
"data-testid": "compact-insight-card-bar-chart",
|
|
200
200
|
sx: { flexShrink: 0 },
|
|
201
|
-
children: /* @__PURE__ */ t(
|
|
202
|
-
color: (i) => l ?
|
|
203
|
-
data: a
|
|
201
|
+
children: /* @__PURE__ */ t(W, {
|
|
202
|
+
color: (i) => l ? H(l, i) : i.palette.primary.main,
|
|
203
|
+
data: a,
|
|
204
|
+
height: et,
|
|
205
|
+
width: ot
|
|
204
206
|
})
|
|
205
207
|
});
|
|
206
|
-
},
|
|
208
|
+
}, mt = Z({
|
|
207
209
|
variants: {
|
|
208
|
-
category_color:
|
|
209
|
-
linked_logos:
|
|
210
|
+
category_color: gt,
|
|
211
|
+
linked_logos: pt,
|
|
210
212
|
minimal: w,
|
|
211
|
-
stacked_logos:
|
|
212
|
-
with_illustration:
|
|
213
|
-
with_warning_badge:
|
|
213
|
+
stacked_logos: st,
|
|
214
|
+
with_illustration: lt,
|
|
215
|
+
with_warning_badge: at
|
|
214
216
|
},
|
|
215
217
|
fallback: w,
|
|
216
218
|
name: "InsightVisual"
|
|
217
|
-
}),
|
|
219
|
+
}), ht = {
|
|
218
220
|
BillAmountNotStandard: {
|
|
219
221
|
key: "in_description_cta",
|
|
220
222
|
trigger: "inDescriptionCta"
|
|
@@ -228,22 +230,22 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
228
230
|
trigger: "inDescriptionCta"
|
|
229
231
|
},
|
|
230
232
|
SwitchDirectDeposit: { key: "in_description_cta" }
|
|
231
|
-
},
|
|
232
|
-
const
|
|
233
|
+
}, ft = (r) => r.stopPropagation(), Wt = ({ beat: r, isCtaDisabled: o = !1, onCtaClick: l, onTap: a, payload: i }) => {
|
|
234
|
+
const S = V(), { openActionDrawer: E } = G(), { description: B, instance_slot: m, primary_cta: h, title: R } = i, n = ht[i.template ?? ""], f = n ? i[n.key] : h, u = i.in_description_cta?.post_message_metadata, L = !n || !!n.trigger || !!r && !!u, A = M(b(m.data, "logo")), T = (s) => {
|
|
233
235
|
if (s.stopPropagation(), !(o || !f)) {
|
|
234
236
|
if (n) {
|
|
235
|
-
if (r && n.trigger)
|
|
237
|
+
if (r && n.trigger) E({
|
|
236
238
|
guid: r.guid,
|
|
237
239
|
trigger: n.trigger
|
|
238
240
|
});
|
|
239
241
|
else if (r && u) {
|
|
240
|
-
const { action:
|
|
241
|
-
|
|
242
|
+
const { action: z, ...O } = u;
|
|
243
|
+
F({
|
|
242
244
|
beat: r,
|
|
243
|
-
stores:
|
|
245
|
+
stores: S
|
|
244
246
|
}, {
|
|
245
|
-
action:
|
|
246
|
-
payload:
|
|
247
|
+
action: z,
|
|
248
|
+
payload: O
|
|
247
249
|
});
|
|
248
250
|
}
|
|
249
251
|
return;
|
|
@@ -281,9 +283,9 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
281
283
|
children: [/* @__PURE__ */ t(C, {
|
|
282
284
|
bold: !0,
|
|
283
285
|
variant: "body1",
|
|
284
|
-
children:
|
|
286
|
+
children: R ?? ""
|
|
285
287
|
}), /* @__PURE__ */ t(e, {
|
|
286
|
-
onClick:
|
|
288
|
+
onClick: ft,
|
|
287
289
|
sx: { display: "flex" },
|
|
288
290
|
children: /* @__PURE__ */ t($, {})
|
|
289
291
|
})]
|
|
@@ -314,9 +316,9 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
314
316
|
WebkitLineClamp: tt
|
|
315
317
|
},
|
|
316
318
|
variant: "subtitle2"
|
|
317
|
-
}), f?.label &&
|
|
319
|
+
}), f?.label && L && /* @__PURE__ */ t(Q, {
|
|
318
320
|
"aria-disabled": o,
|
|
319
|
-
onClick:
|
|
321
|
+
onClick: T,
|
|
320
322
|
size: "small",
|
|
321
323
|
sx: {
|
|
322
324
|
alignSelf: "flex-start",
|
|
@@ -335,7 +337,7 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
335
337
|
children: f.label
|
|
336
338
|
})
|
|
337
339
|
})]
|
|
338
|
-
}), /* @__PURE__ */ t(
|
|
340
|
+
}), /* @__PURE__ */ t(mt, {
|
|
339
341
|
data: m.data,
|
|
340
342
|
logo: A,
|
|
341
343
|
template: i.template,
|
|
@@ -345,7 +347,7 @@ var tt = 2, c = 44, I = 36, rt = 75, it = 74, g = {
|
|
|
345
347
|
}), r && /* @__PURE__ */ t(X, { beat: r })] });
|
|
346
348
|
};
|
|
347
349
|
export {
|
|
348
|
-
|
|
350
|
+
Wt as default
|
|
349
351
|
};
|
|
350
352
|
|
|
351
353
|
//# sourceMappingURL=CompactInsightCard.es.js.map
|
|
@@ -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 { asLogoRef } from '../blocks/slotReaders'\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 = asLogoRef(slot(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":";;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,KAAwB,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,EA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E,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 { asLogoRef } from '../blocks/slotReaders'\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\nconst EMBEDDED_BAR_CHART_HEIGHT = 54\nconst EMBEDDED_BAR_CHART_WIDTH = 75\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 height={EMBEDDED_BAR_CHART_HEIGHT}\n width={EMBEDDED_BAR_CHART_WIDTH}\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 = asLogoRef(slot(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":";;;;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,KAAwB,GAGxB,IAAY,IAYZ,IAAmB,IACnB,KAAmB,IACnB,KAAoB,IAEpB,IAAU;AAAA,EACd,MAAM;AAAA,EACN,UAAU;AAAA,EACV,KAAK;AAAA,EACL,WAAW;AACb,GAKM,KAA4B,IAC5B,KAA2B,IAG3B,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,gBAAA,EAAC,GAAD;AAAA,EACE,QAAQ,gBAAA,EAAC,GAAD,EAAsB,MAAA,EAAO,CAAA;AAAA,EACrC,MAAM;AAAA,EACN,IAAI,EAAE,YAAY,EAAE;AAAA,EACpB,UAAU,gBAAA,EAAC,GAAD,EAAa,MAAK,UAAW,CAAA;AACxC,CAAA,GAGG,KA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