@mx-cartographer/experiences 9.7.67 → 9.7.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +32 -31
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +2 -0
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +44 -43
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CompactInsightCard.es.js +74 -69
- package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
- package/dist/microinsights/MicroCardTemplate.es.js +38 -37
- package/dist/microinsights/MicroCardTemplate.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [9.7.69] - 10-30-2026
|
|
2
|
+
|
|
3
|
+
- **FIXED** - The embedded insight card's call-to-action label now matches Figma's size and weight (WEC-2157)
|
|
4
|
+
|
|
5
|
+
## [9.7.68] - 10-30-2026
|
|
6
|
+
|
|
7
|
+
- **FIXED** - The deposit card shadow and the description weight on Insights 2.0 and micro cards now match Figma (WEC-2181)
|
|
8
|
+
|
|
1
9
|
## [9.7.67] - 10-30-2026
|
|
2
10
|
|
|
3
11
|
- **FIXED** - Discovered Accounts and Switch Direct Deposit account-switch graphic, embedded linked logos and Direct Deposit status pill now match Figma (WEC-2157)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { slot as d } from "../../../../core/types/Insights.es.js";
|
|
2
|
-
import { formatCurrency as
|
|
2
|
+
import { formatCurrency as I } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
3
|
import { useContainerDimensions as P } from "../../../hooks/useContainerDimensions.es.js";
|
|
4
4
|
import H from "../../../components/LogoFromGuid.es.js";
|
|
5
5
|
import { Confetti as N } from "../../../components/shared/Confetti.es.js";
|
|
@@ -18,14 +18,14 @@ import { Text as l } from "@mxenabled/mxui";
|
|
|
18
18
|
import { Icon as z } from "@mxenabled/mx-icons";
|
|
19
19
|
import { jsx as o, jsxs as r } from "react/jsx-runtime";
|
|
20
20
|
import { useTheme as X } from "@mui/material/styles";
|
|
21
|
-
import
|
|
22
|
-
var
|
|
23
|
-
const
|
|
24
|
-
if (q(
|
|
25
|
-
const { data: i } = n, m = i !== void 0,
|
|
21
|
+
import a from "@mui/material/Box";
|
|
22
|
+
var yo = ({ payload: g }) => {
|
|
23
|
+
const p = X(), b = U(null), { height: w, width: y } = P(b), { instance_slot: n } = g, { variant: h, institution_guid: D, institution_name: A, icon_name: B, merchant_name: F } = n;
|
|
24
|
+
if (q(h)) return /* @__PURE__ */ o(J, { payload: g });
|
|
25
|
+
const { data: i } = n, m = i !== void 0, f = d(i, "amount"), u = m ? typeof f == "number" && Number.isFinite(f) ? f : void 0 : n.amount, v = d(i, "sub_text"), R = typeof v == "string" ? v : void 0, T = m ? R : n.sub_text, L = m ? R : n.label, _ = d(i, "header_text"), s = m ? typeof _ == "string" ? _ : void 0 : n.header_text, c = d(i, "logo"), t = W(M(p), h, "default", "AccountBlock");
|
|
26
26
|
if (t?.isConfetti) {
|
|
27
|
-
const
|
|
28
|
-
paidOffCard: /* @__PURE__ */ o(
|
|
27
|
+
const x = O(c?.guid), V = {
|
|
28
|
+
paidOffCard: /* @__PURE__ */ o(a, {
|
|
29
29
|
sx: {
|
|
30
30
|
flexShrink: 0,
|
|
31
31
|
height: 32,
|
|
@@ -48,7 +48,7 @@ var vo = ({ payload: x }) => {
|
|
|
48
48
|
role: "presentation",
|
|
49
49
|
width: 55
|
|
50
50
|
}),
|
|
51
|
-
logo: /* @__PURE__ */ o(
|
|
51
|
+
logo: /* @__PURE__ */ o(a, {
|
|
52
52
|
sx: {
|
|
53
53
|
borderRadius: "4px",
|
|
54
54
|
flexShrink: 0,
|
|
@@ -56,8 +56,8 @@ var vo = ({ payload: x }) => {
|
|
|
56
56
|
overflow: "hidden",
|
|
57
57
|
width: 48
|
|
58
58
|
},
|
|
59
|
-
children:
|
|
60
|
-
"data-icon":
|
|
59
|
+
children: x ? /* @__PURE__ */ o(e, {
|
|
60
|
+
"data-icon": x,
|
|
61
61
|
sx: {
|
|
62
62
|
alignItems: "center",
|
|
63
63
|
bgcolor: "success.main",
|
|
@@ -67,7 +67,7 @@ var vo = ({ payload: x }) => {
|
|
|
67
67
|
},
|
|
68
68
|
children: /* @__PURE__ */ o(z, {
|
|
69
69
|
"aria-hidden": !0,
|
|
70
|
-
name:
|
|
70
|
+
name: x,
|
|
71
71
|
size: t.logo_icon_size ?? 24,
|
|
72
72
|
sx: { color: "success.contrastText" }
|
|
73
73
|
})
|
|
@@ -76,17 +76,17 @@ var vo = ({ payload: x }) => {
|
|
|
76
76
|
size: 48
|
|
77
77
|
}) : null
|
|
78
78
|
})
|
|
79
|
-
}[t.graphic ?? "logo"], C = d(i, "secondary_text"), $ = typeof C == "string" && C || (F ?? A),
|
|
79
|
+
}[t.graphic ?? "logo"], C = d(i, "secondary_text"), $ = typeof C == "string" && C || (F ?? A), S = t.secondarySource === "merchant" ? $ : L, k = S ? /* @__PURE__ */ o(l, {
|
|
80
80
|
color: t.secondaryColor,
|
|
81
81
|
variant: t.secondaryVariant,
|
|
82
|
-
children:
|
|
82
|
+
children: S
|
|
83
83
|
}) : null, j = u != null ? /* @__PURE__ */ o(l, {
|
|
84
84
|
bold: !0,
|
|
85
85
|
color: "success.dark",
|
|
86
86
|
variant: t.amountVariant,
|
|
87
|
-
children: `${t.amountPrefix ?? ""}${
|
|
87
|
+
children: `${t.amountPrefix ?? ""}${I(u, "0,0.00")}`
|
|
88
88
|
}) : null;
|
|
89
|
-
return /* @__PURE__ */ r(
|
|
89
|
+
return /* @__PURE__ */ r(a, {
|
|
90
90
|
ref: b,
|
|
91
91
|
sx: {
|
|
92
92
|
backgroundImage: t.gradient,
|
|
@@ -96,7 +96,7 @@ var vo = ({ payload: x }) => {
|
|
|
96
96
|
p: 16,
|
|
97
97
|
width: "100%"
|
|
98
98
|
},
|
|
99
|
-
children: [/* @__PURE__ */ o(
|
|
99
|
+
children: [/* @__PURE__ */ o(a, {
|
|
100
100
|
sx: {
|
|
101
101
|
inset: 0,
|
|
102
102
|
pointerEvents: "none",
|
|
@@ -104,19 +104,20 @@ var vo = ({ payload: x }) => {
|
|
|
104
104
|
zIndex: 1
|
|
105
105
|
},
|
|
106
106
|
children: /* @__PURE__ */ o(N, {
|
|
107
|
-
height:
|
|
108
|
-
shouldRun:
|
|
109
|
-
width:
|
|
107
|
+
height: w,
|
|
108
|
+
shouldRun: w > 0 && y > 0,
|
|
109
|
+
width: y
|
|
110
110
|
})
|
|
111
111
|
}), /* @__PURE__ */ r(e, {
|
|
112
112
|
sx: {
|
|
113
113
|
borderRadius: "8px",
|
|
114
|
+
...t.cardShadow && { boxShadow: p.shadows[1] },
|
|
114
115
|
overflow: "hidden",
|
|
115
116
|
position: "relative",
|
|
116
117
|
width: "100%",
|
|
117
118
|
zIndex: 2
|
|
118
119
|
},
|
|
119
|
-
children: [t.categoryStrip &&
|
|
120
|
+
children: [t.categoryStrip && s && /* @__PURE__ */ o(a, {
|
|
120
121
|
sx: {
|
|
121
122
|
bgcolor: "success.main",
|
|
122
123
|
px: 12,
|
|
@@ -125,7 +126,7 @@ var vo = ({ payload: x }) => {
|
|
|
125
126
|
children: /* @__PURE__ */ o(l, {
|
|
126
127
|
color: "success.contrastText",
|
|
127
128
|
variant: "caption",
|
|
128
|
-
children:
|
|
129
|
+
children: s
|
|
129
130
|
})
|
|
130
131
|
}), /* @__PURE__ */ r(e, {
|
|
131
132
|
sx: {
|
|
@@ -142,7 +143,7 @@ var vo = ({ payload: x }) => {
|
|
|
142
143
|
flexDirection: "row",
|
|
143
144
|
...t.rowSx
|
|
144
145
|
},
|
|
145
|
-
children: [/* @__PURE__ */ o(
|
|
146
|
+
children: [/* @__PURE__ */ o(a, {
|
|
146
147
|
sx: {
|
|
147
148
|
display: "flex",
|
|
148
149
|
flexShrink: 0
|
|
@@ -154,9 +155,9 @@ var vo = ({ payload: x }) => {
|
|
|
154
155
|
minWidth: 0
|
|
155
156
|
},
|
|
156
157
|
children: [
|
|
157
|
-
t.secondaryPosition === "above" &&
|
|
158
|
+
t.secondaryPosition === "above" && k,
|
|
158
159
|
j,
|
|
159
|
-
t.secondaryPosition === "below" &&
|
|
160
|
+
t.secondaryPosition === "below" && k
|
|
160
161
|
]
|
|
161
162
|
})]
|
|
162
163
|
})]
|
|
@@ -171,10 +172,10 @@ var vo = ({ payload: x }) => {
|
|
|
171
172
|
children: /* @__PURE__ */ r(e, {
|
|
172
173
|
sx: {
|
|
173
174
|
borderRadius: "8px",
|
|
174
|
-
boxShadow:
|
|
175
|
+
boxShadow: p.shadows[1],
|
|
175
176
|
width: "100%"
|
|
176
177
|
},
|
|
177
|
-
children: [
|
|
178
|
+
children: [s && /* @__PURE__ */ o(K, { headerText: s }), /* @__PURE__ */ r(e, {
|
|
178
179
|
sx: {
|
|
179
180
|
alignItems: "center",
|
|
180
181
|
bgcolor: "background.paper",
|
|
@@ -183,7 +184,7 @@ var vo = ({ payload: x }) => {
|
|
|
183
184
|
px: 16,
|
|
184
185
|
py: 12,
|
|
185
186
|
width: "100%",
|
|
186
|
-
...
|
|
187
|
+
...s && {
|
|
187
188
|
borderTopLeftRadius: "0",
|
|
188
189
|
borderTopRightRadius: "0"
|
|
189
190
|
},
|
|
@@ -192,10 +193,10 @@ var vo = ({ payload: x }) => {
|
|
|
192
193
|
children: [/* @__PURE__ */ o(Q, {
|
|
193
194
|
logo: c,
|
|
194
195
|
slot: n,
|
|
195
|
-
variant:
|
|
196
|
+
variant: h
|
|
196
197
|
}), /* @__PURE__ */ r(e, { children: [u != null && /* @__PURE__ */ o(l, {
|
|
197
198
|
variant: "h2",
|
|
198
|
-
children:
|
|
199
|
+
children: I(u, "0,0.00")
|
|
199
200
|
}), /* @__PURE__ */ r(e, {
|
|
200
201
|
sx: {
|
|
201
202
|
gap: 8,
|
|
@@ -218,7 +219,7 @@ var vo = ({ payload: x }) => {
|
|
|
218
219
|
});
|
|
219
220
|
};
|
|
220
221
|
export {
|
|
221
|
-
|
|
222
|
+
yo as default
|
|
222
223
|
};
|
|
223
224
|
|
|
224
225
|
//# sourceMappingURL=AccountBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V2 variants fill `instance_slot.data` (ditto's account_block slots) and it is then the whole\n // truth: a slot it leaves empty, or sends with the wrong kind, draws nothing rather than falling\n // back to the stale flat field it supersedes. Beats not yet migrated send no `data` and keep the\n // flat fields.\n const { data } = instance_slot\n const v2 = data !== undefined\n const dataAmount = slot<unknown>(data, 'amount')\n const amount = v2\n ? typeof dataAmount === 'number' && Number.isFinite(dataAmount)\n ? dataAmount\n : undefined\n : instance_slot.amount\n // One V2 slot feeds the line under the amount on both tiles. V1 called it `sub_text` on the\n // standard tile and `label` on the confetti tile, so each keeps its own flat field.\n const dataSubText = slot<unknown>(data, 'sub_text')\n const v2SubText = typeof dataSubText === 'string' ? dataSubText : undefined\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const dataHeaderText = slot<unknown>(data, 'header_text')\n const header_text = v2\n ? typeof dataHeaderText === 'string'\n ? dataHeaderText\n : undefined\n : instance_slot.header_text\n const logo = slot<LogoRef>(data, 'logo')\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n // Confetti-backed celebration variants (deposits, payoff, savings) — a success-tinted card\n // on a gradient + confetti wash. Everything variant-specific is flat on `layoutConfig`.\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // SVG is 58x46 but the card sits at (0,14) with the check badge overflowing top-right.\n // Box it to the card's real 44x32 footprint and shift the SVG up so it aligns with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 44 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // Deposit cards show the payer name — a merchant when we have one, otherwise the institution.\n // V2 sends it resolved as `data.secondary_text`; the flat fields remain the fallback.\n const dataSecondaryText = slot<unknown>(data, 'secondary_text')\n const payer =\n (typeof dataSecondaryText === 'string' && dataSecondaryText) ||\n (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, '0,0.00')}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n px: 16,\n py: 12,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && <Text variant=\"h2\">{formatCurrency(amount, '0,0.00')}</Text>}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,GAAD,EAA+B,SAAA,EAAU,CAAA;AAMvF,QAAM,EAAE,MAAA,EAAA,IAAS,GACX,IAAK,MAAS,QACd,IAAa,EAAc,GAAM,QAAQ,GACzC,IAAS,IACX,OAAO,KAAe,YAAY,OAAO,SAAS,CAAU,IAC1D,IACA,SACF,EAAc,QAGZ,IAAc,EAAc,GAAM,UAAU,GAC5C,IAAY,OAAO,KAAgB,WAAW,IAAc,QAC5D,IAAW,IAAK,IAAY,EAAc,UAC1C,IAAQ,IAAK,IAAY,EAAc,OACvC,IAAiB,EAAc,GAAM,aAAa,GAClD,IAAc,IAChB,OAAO,KAAmB,WACxB,IACA,SACF,EAAc,aACZ,IAAO,EAAc,GAAM,MAAM,GACjC,IAAe,EACnB,EAAgB,CAAK,GACrB,GACA,WACA,cACF;AAIA,MAAI,GAAc,YAAY;AAC5B,UAAM,IAAe,EAAe,GAAM,IAAI,GAmDxC,IAAU;AAAA,MAjDd,aAGE,gBAAA,EAAC,GAAD;AAAA,QAAK,IAAI;AAAA,UAAE,YAAY;AAAA,UAAG,QAAQ;AAAA,UAAI,UAA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,CAkBE,gBAAA,EAAC,GAAD;AAAA,UAAqB,MAAA;AAAA,UAAM,MAAM;AAAA,UAAwB,SAAA;AAAA,QAAU,CAAA,GAEnE,gBAAA,EAAC,GAAD,EAAA,UAAA,CACG,KAAU,QAAQ,gBAAA,EAAC,GAAD;AAAA,UAAM,SAAQ;AAAA,UAAM,UAAA,EAAe,GAAQ,QAAQ;AAAA,QAAQ,CAAA,GAC9E,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,eAAe;AAAA,YAAO,YAAY;AAAA,UAAS;AAAA,UAAhE,UAAA,CACG,EAAa,YACZ,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAU,MAAM;AAAA,YAAM,MAAM,EAAa;AAAA,YAAU,MAAM;AAAA,UAAK,CAAA,GAE3E,KACC,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,CAEH;AAAA,QACF,CAAA,CAAA,EAAA,CAAA,CACF;AAAA,MACF,CAAA,CAAA;AAAA;EACF,CAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"AccountBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { useRef } from 'react'\nimport { useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport { Confetti } from '../../../components/shared/Confetti'\nimport { ReactComponent as PaidOffCardGraphic } from '../../../components/shared/images/PaidOffCard.svg'\nimport { ReactComponent as SavingsGraphic } from '../../../components/shared/images/SavingsAccountDeposit.svg'\nimport { statusIconName } from '../../../components/statusIcon'\nimport { useContainerDimensions } from '../../../hooks/useContainerDimensions'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { DetailedAccountBlock, isDetailedAccountVariant } from '../DetailedAccountBlock'\n\nimport { HeaderComponent } from './HeaderComponent'\nimport { IconComponent } from './IconComponent'\nimport { getLayoutConfig } from './layout'\n\nconst AccountBlock = ({ payload }: { payload: InsightsPayload; beatGuid?: string }) => {\n const theme = useTheme()\n const containerRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const { instance_slot } = payload\n const { variant, institution_guid, institution_name, icon_name, merchant_name } = instance_slot\n\n if (isDetailedAccountVariant(variant)) return <DetailedAccountBlock payload={payload} />\n\n // V2 variants fill `instance_slot.data` (ditto's account_block slots) and it is then the whole\n // truth: a slot it leaves empty, or sends with the wrong kind, draws nothing rather than falling\n // back to the stale flat field it supersedes. Beats not yet migrated send no `data` and keep the\n // flat fields.\n const { data } = instance_slot\n const v2 = data !== undefined\n const dataAmount = slot<unknown>(data, 'amount')\n const amount = v2\n ? typeof dataAmount === 'number' && Number.isFinite(dataAmount)\n ? dataAmount\n : undefined\n : instance_slot.amount\n // One V2 slot feeds the line under the amount on both tiles. V1 called it `sub_text` on the\n // standard tile and `label` on the confetti tile, so each keeps its own flat field.\n const dataSubText = slot<unknown>(data, 'sub_text')\n const v2SubText = typeof dataSubText === 'string' ? dataSubText : undefined\n const sub_text = v2 ? v2SubText : instance_slot.sub_text\n const label = v2 ? v2SubText : instance_slot.label\n const dataHeaderText = slot<unknown>(data, 'header_text')\n const header_text = v2\n ? typeof dataHeaderText === 'string'\n ? dataHeaderText\n : undefined\n : instance_slot.header_text\n const logo = slot<LogoRef>(data, 'logo')\n const layoutConfig = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n 'default',\n 'AccountBlock',\n )\n\n // Confetti-backed celebration variants (deposits, payoff, savings) — a success-tinted card\n // on a gradient + confetti wash. Everything variant-specific is flat on `layoutConfig`.\n if (layoutConfig?.isConfetti) {\n const confettiIcon = statusIconName(logo?.guid)\n const graphics: Record<string, React.ReactNode> = {\n paidOffCard: (\n // SVG is 58x46 but the card sits at (0,14) with the check badge overflowing top-right.\n // Box it to the card's real 44x32 footprint and shift the SVG up so it aligns with the text.\n <Box sx={{ flexShrink: 0, height: 32, position: 'relative', width: 44 }}>\n <PaidOffCardGraphic\n aria-hidden={true}\n role=\"presentation\"\n style={{ left: 0, position: 'absolute', top: -14 }}\n />\n </Box>\n ),\n savings: <SavingsGraphic aria-hidden={true} height={55} role=\"presentation\" width={55} />,\n logo: (\n <Box\n sx={{\n borderRadius: '4px',\n flexShrink: 0,\n height: 48,\n overflow: 'hidden',\n width: 48,\n }}\n >\n {/* An ICO- icon keeps the tile's look: an outlined glyph in success.contrastText on\n the success.main square. It is drawn with Icon, as IconComponent does, because\n LogoFromGuid fills every ICO- glyph. Any other guid renders via LogoFromGuid. */}\n {confettiIcon ? (\n <Stack\n data-icon={confettiIcon}\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon\n aria-hidden={true}\n name={confettiIcon}\n size={layoutConfig.logo_icon_size ?? 24}\n sx={{ color: 'success.contrastText' }}\n />\n </Stack>\n ) : logo?.guid ? (\n <LogoFromGuid logo={logo} size={48} />\n ) : null}\n </Box>\n ),\n }\n const graphic = graphics[layoutConfig.graphic ?? 'logo']\n\n // Deposit cards show the payer name — a merchant when we have one, otherwise the institution.\n // V2 sends it resolved as `data.secondary_text`; the flat fields remain the fallback.\n const dataSecondaryText = slot<unknown>(data, 'secondary_text')\n const payer =\n (typeof dataSecondaryText === 'string' && dataSecondaryText) ||\n (merchant_name ?? institution_name)\n const secondaryText = layoutConfig.secondarySource === 'merchant' ? payer : label\n const secondary = secondaryText ? (\n <Text color={layoutConfig.secondaryColor} variant={layoutConfig.secondaryVariant}>\n {secondaryText}\n </Text>\n ) : null\n // No figure for a missing amount: `formatCurrency` would print a confident `$0.00`.\n const amountText =\n amount != null ? (\n <Text bold={true} color=\"success.dark\" variant={layoutConfig.amountVariant}>\n {`${layoutConfig.amountPrefix ?? ''}${formatCurrency(amount, '0,0.00')}`}\n </Text>\n ) : null\n\n return (\n <Box\n ref={containerRef}\n sx={{\n backgroundImage: layoutConfig.gradient,\n bgcolor: 'background.paper',\n overflow: 'hidden',\n position: 'relative',\n p: 16,\n width: '100%',\n }}\n >\n <Box\n sx={{\n inset: 0,\n pointerEvents: 'none',\n position: 'absolute',\n zIndex: 1,\n }}\n >\n <Confetti height={height} shouldRun={height > 0 && width > 0} width={width} />\n </Box>\n\n <Stack\n sx={{\n borderRadius: '8px',\n ...(layoutConfig.cardShadow && { boxShadow: theme.shadows[1] }),\n overflow: 'hidden',\n position: 'relative',\n width: '100%',\n zIndex: 2,\n }}\n >\n {layoutConfig.categoryStrip && header_text && (\n <Box sx={{ bgcolor: 'success.main', px: 12, py: 4 }}>\n <Text color=\"success.contrastText\" variant=\"caption\">\n {header_text}\n </Text>\n </Box>\n )}\n\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.lighter',\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: '8px',\n // With a strip above, the body's top corners tuck under it (no double border line).\n ...(layoutConfig.categoryStrip && {\n borderTopLeftRadius: 0,\n borderTopRightRadius: 0,\n borderTop: 0,\n }),\n flexDirection: 'row',\n ...layoutConfig.rowSx,\n }}\n >\n <Box sx={{ display: 'flex', flexShrink: 0 }}>{graphic}</Box>\n\n <Stack sx={{ flex: '1 0 0', minWidth: 0 }}>\n {layoutConfig.secondaryPosition === 'above' && secondary}\n {amountText}\n {layoutConfig.secondaryPosition === 'below' && secondary}\n </Stack>\n </Stack>\n </Stack>\n </Box>\n )\n }\n\n return (\n <Stack\n sx={{\n background: layoutConfig.background,\n p: 16,\n }}\n >\n <Stack\n sx={{\n borderRadius: '8px',\n boxShadow: theme.shadows[1],\n width: '100%',\n }}\n >\n {header_text && <HeaderComponent headerText={header_text} />}\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n gap: 16,\n px: 16,\n py: 12,\n width: '100%',\n ...(header_text && {\n borderTopLeftRadius: '0',\n borderTopRightRadius: '0',\n }),\n ...((institution_guid || icon_name || logo?.guid) && {\n flexDirection: 'row',\n }),\n }}\n >\n <IconComponent logo={logo} slot={instance_slot} variant={variant} />\n\n <Stack>\n {amount != null && <Text variant=\"h2\">{formatCurrency(amount, '0,0.00')}</Text>}\n <Stack sx={{ gap: 8, flexDirection: 'row', alignItems: 'center' }}>\n {layoutConfig.sub_logo && (\n <Icon color=\"warning\" fill={true} name={layoutConfig.sub_logo} size={20} />\n )}\n {sub_text && (\n <Text color=\"text.secondary\" variant=\"caption\">\n {sub_text}\n </Text>\n )}\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default AccountBlock\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwBA,IAAM,KAAA,CAAgB,EAAE,SAAA,EAAA,MAA+D;AACrF,QAAM,IAAQ,EAAS,GACjB,IAAe,EAAuB,IAAI,GAC1C,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,EAAE,eAAA,EAAA,IAAkB,GACpB,EAAE,SAAA,GAAS,kBAAA,GAAkB,kBAAA,GAAkB,WAAA,GAAW,eAAA,EAAA,IAAkB;AAElF,MAAI,EAAyB,CAAO,EAAG,QAAO,gBAAA,EAAC,GAAD,EAA+B,SAAA,EAAU,CAAA;AAMvF,QAAM,EAAE,MAAA,EAAA,IAAS,GACX,IAAK,MAAS,QACd,IAAa,EAAc,GAAM,QAAQ,GACzC,IAAS,IACX,OAAO,KAAe,YAAY,OAAO,SAAS,CAAU,IAC1D,IACA,SACF,EAAc,QAGZ,IAAc,EAAc,GAAM,UAAU,GAC5C,IAAY,OAAO,KAAgB,WAAW,IAAc,QAC5D,IAAW,IAAK,IAAY,EAAc,UAC1C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|
|
26
26
|
/** Render the colored category strip (`header_text`) at the top of the card. */
|
|
27
27
|
categoryStrip?: boolean;
|
|
28
|
+
/** Raise the strip and body together with elevation/1. */
|
|
29
|
+
cardShadow?: boolean;
|
|
28
30
|
/** Layout overrides for the graphic+text row (padding, gap). */
|
|
29
31
|
rowSx?: SxProps;
|
|
30
32
|
/** Which payload field feeds the secondary line beside the amount. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { alpha, type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n ERROR_WASH_GRADIENT,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\n\nexport interface BlockLayoutConfig {\n background?: string\n logo_color?: string\n logo_bGcolor?: string\n logo_border_color?: string\n /** Corner radius of the icon tile (`icon_name` or an `ICO-` logo). Defaults to 6px. */\n logo_border_radius?: string\n /** Glyph size in px for an `ICO-` logo on AccountBlock's confetti tile; nothing else reads it.\n * Defaults to 24. */\n logo_icon_size?: number\n /** mx-icons glyph shown before `sub_text` (e.g. a warning icon on overdraft_warning). */\n sub_logo?: string\n /** mx-icons glyph badged on the logo's corner (e.g. `error` on Low Account Balance's V2 tile). */\n badge?: string\n /** When true, AccountBlock renders the confetti-backed celebration card using the fields below. */\n isConfetti?: boolean\n /** Gradient wash layered over `background.paper` for the confetti card. */\n gradient?: string\n /** Which illustration sits left of the text. `logo` is the data-driven merchant/institution logo. */\n graphic?: 'paidOffCard' | 'savings' | 'logo'\n /** Amount typography variant — `h2` for milestones, `h3` for deposits. */\n amountVariant?: 'h2' | 'h3'\n /** Prefix prepended to the formatted amount, e.g. `+` for deposits. */\n amountPrefix?: string\n /** Render the colored category strip (`header_text`) at the top of the card. */\n categoryStrip?: boolean\n /** Layout overrides for the graphic+text row (padding, gap). */\n rowSx?: SxProps\n /** Which payload field feeds the secondary line beside the amount. */\n secondarySource?: 'merchant' | 'label'\n /** Whether the secondary line sits above or below the amount. */\n secondaryPosition?: 'above' | 'below'\n /** Typography variant for the secondary line. */\n secondaryVariant?: 'body2' | 'caption'\n /** Theme color path for the secondary line. */\n secondaryColor?: string\n}\n\n/** Glyph size in px on the standard icon tile (IconComponent). */\nexport const TILE_ICON_SIZE = 30\n\n// Low Account Balance's red tile, shared by its legacy (`low_balance_alert`) and V2 (`low_balance`)\n// variant names.\nconst LOW_BALANCE_TILE: BlockLayoutConfig = {\n background: ERROR_WASH_GRADIENT,\n}\n\nexport const getLayoutConfig = (theme: Theme): Record<string, BlockLayoutConfig> => {\n return {\n overdraft_warning: {\n background: theme.palette.warning.light,\n sub_logo: 'error',\n },\n low_balance_alert: LOW_BALANCE_TILE,\n // V2 name for the same tile: content from `instance_slot.data`, the logo badged with `badge`.\n low_balance: { ...LOW_BALANCE_TILE, badge: 'error' },\n // Shared on/off-track status pair — used by Monthly Obligations Status and\n // Payday Cash Left Over Status (identical designs, different copy).\n status_off_track: {\n logo_color: 'background.paper',\n logo_bGcolor: 'error.main',\n // Figma 9936:39145: the money icon's tile has 4px corners.\n logo_border_radius: '4px',\n background: ERROR_WASH_GRADIENT,\n },\n interest_charges_summary: {\n logo_color: 'text.primary',\n logo_bGcolor: alpha(theme.palette.categories?.feesCharges || '', 0.25),\n logo_border_color: 'categories.feesCharges',\n background:\n 'linear-gradient(256.82deg, rgba(227, 39, 39, 0.2) 1.86%, rgba(255, 123, 0, 0.2) 101.54%)',\n },\n // Shared deposit-celebration card — used by both the standard deposit and the emergency-fund\n // deposit beats (identical design, different copy), so one design-named variant serves both.\n deposit_received: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n amountVariant: 'h3',\n amountPrefix: '+',\n categoryStrip: true,\n rowSx: { gap: 12, p: 12 },\n secondarySource: 'merchant',\n secondaryPosition: 'below',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n status_on_track: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n logo_icon_size: TILE_ICON_SIZE,\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n payoff_celebration: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'paidOffCard',\n amountVariant: 'h2',\n rowSx: { gap: 24, px: 24, py: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n savings_deposit: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'savings',\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'above',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n // Neutral fallback for an unknown/unmatched variant: renders the plain standard card (no\n // confetti, no special background). `resolveVariantConfig` warns before falling back here.\n default: {},\n }\n}\n"],"mappings":";;
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.ts"],"sourcesContent":["import { alpha, type SxProps, type Theme } from '@mui/material/styles'\n\nimport {\n CELEBRATION_GRADIENT,\n ERROR_WASH_GRADIENT,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\n\nexport interface BlockLayoutConfig {\n background?: string\n logo_color?: string\n logo_bGcolor?: string\n logo_border_color?: string\n /** Corner radius of the icon tile (`icon_name` or an `ICO-` logo). Defaults to 6px. */\n logo_border_radius?: string\n /** Glyph size in px for an `ICO-` logo on AccountBlock's confetti tile; nothing else reads it.\n * Defaults to 24. */\n logo_icon_size?: number\n /** mx-icons glyph shown before `sub_text` (e.g. a warning icon on overdraft_warning). */\n sub_logo?: string\n /** mx-icons glyph badged on the logo's corner (e.g. `error` on Low Account Balance's V2 tile). */\n badge?: string\n /** When true, AccountBlock renders the confetti-backed celebration card using the fields below. */\n isConfetti?: boolean\n /** Gradient wash layered over `background.paper` for the confetti card. */\n gradient?: string\n /** Which illustration sits left of the text. `logo` is the data-driven merchant/institution logo. */\n graphic?: 'paidOffCard' | 'savings' | 'logo'\n /** Amount typography variant — `h2` for milestones, `h3` for deposits. */\n amountVariant?: 'h2' | 'h3'\n /** Prefix prepended to the formatted amount, e.g. `+` for deposits. */\n amountPrefix?: string\n /** Render the colored category strip (`header_text`) at the top of the card. */\n categoryStrip?: boolean\n /** Raise the strip and body together with elevation/1. */\n cardShadow?: boolean\n /** Layout overrides for the graphic+text row (padding, gap). */\n rowSx?: SxProps\n /** Which payload field feeds the secondary line beside the amount. */\n secondarySource?: 'merchant' | 'label'\n /** Whether the secondary line sits above or below the amount. */\n secondaryPosition?: 'above' | 'below'\n /** Typography variant for the secondary line. */\n secondaryVariant?: 'body2' | 'caption'\n /** Theme color path for the secondary line. */\n secondaryColor?: string\n}\n\n/** Glyph size in px on the standard icon tile (IconComponent). */\nexport const TILE_ICON_SIZE = 30\n\n// Low Account Balance's red tile, shared by its legacy (`low_balance_alert`) and V2 (`low_balance`)\n// variant names.\nconst LOW_BALANCE_TILE: BlockLayoutConfig = {\n background: ERROR_WASH_GRADIENT,\n}\n\nexport const getLayoutConfig = (theme: Theme): Record<string, BlockLayoutConfig> => {\n return {\n overdraft_warning: {\n background: theme.palette.warning.light,\n sub_logo: 'error',\n },\n low_balance_alert: LOW_BALANCE_TILE,\n // V2 name for the same tile: content from `instance_slot.data`, the logo badged with `badge`.\n low_balance: { ...LOW_BALANCE_TILE, badge: 'error' },\n // Shared on/off-track status pair — used by Monthly Obligations Status and\n // Payday Cash Left Over Status (identical designs, different copy).\n status_off_track: {\n logo_color: 'background.paper',\n logo_bGcolor: 'error.main',\n // Figma 9936:39145: the money icon's tile has 4px corners.\n logo_border_radius: '4px',\n background: ERROR_WASH_GRADIENT,\n },\n interest_charges_summary: {\n logo_color: 'text.primary',\n logo_bGcolor: alpha(theme.palette.categories?.feesCharges || '', 0.25),\n logo_border_color: 'categories.feesCharges',\n background:\n 'linear-gradient(256.82deg, rgba(227, 39, 39, 0.2) 1.86%, rgba(255, 123, 0, 0.2) 101.54%)',\n },\n // Shared deposit-celebration card — used by both the standard deposit and the emergency-fund\n // deposit beats (identical design, different copy), so one design-named variant serves both.\n deposit_received: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n amountVariant: 'h3',\n amountPrefix: '+',\n categoryStrip: true,\n cardShadow: true,\n rowSx: { gap: 12, p: 12 },\n secondarySource: 'merchant',\n secondaryPosition: 'below',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n status_on_track: {\n isConfetti: true,\n gradient: WARM_LIME_ACCENT_GRADIENT,\n graphic: 'logo',\n logo_icon_size: TILE_ICON_SIZE,\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n payoff_celebration: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'paidOffCard',\n amountVariant: 'h2',\n rowSx: { gap: 24, px: 24, py: 16 },\n secondarySource: 'label',\n secondaryPosition: 'below',\n secondaryVariant: 'caption',\n secondaryColor: 'text.secondary',\n },\n savings_deposit: {\n isConfetti: true,\n gradient: CELEBRATION_GRADIENT,\n graphic: 'savings',\n amountVariant: 'h2',\n rowSx: { gap: 16, p: 16 },\n secondarySource: 'label',\n secondaryPosition: 'above',\n secondaryVariant: 'body2',\n secondaryColor: 'text.primary',\n },\n // Neutral fallback for an unknown/unmatched variant: renders the plain standard card (no\n // confetti, no special background). `resolveVariantConfig` warns before falling back here.\n default: {},\n }\n}\n"],"mappings":";;AAqDA,IAAM,IAAsC,EAC1C,YAAY,EACd,GAEa,IAAA,CAAmB,OACvB;AAAA,EACL,mBAAmB;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AAAA,EAClB;AAAA,EACA,iBAAiB;AAAA,IACf,YAAY;AAAA,IACZ,UAAU;AAAA,IACV,SAAS;AAAA,IACT,eAAe;AAAA,IACf,OAAO;AAAA,MAAE,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IACxB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,EAClB;AAAA,EAGA,SAAS,CAAC;AACZ"}
|
|
@@ -3,8 +3,8 @@ import { sendClientConfiguredCta as J } from "../../common/utils/PostMessage.es.
|
|
|
3
3
|
import { BeatActionsProvider as Q } from "../beatActions.es.js";
|
|
4
4
|
import { isContactSupportCtaDisabled as Z } from "../actionBlocks/ContactSupportActionBlock.es.js";
|
|
5
5
|
import { reportCtaClick as oo } from "../ctaActions/runCtaAction.es.js";
|
|
6
|
-
import { useBeatCtaActions as
|
|
7
|
-
import { actionBlocksKey as
|
|
6
|
+
import { useBeatCtaActions as eo } from "../ctaActions/useCtaAction.es.js";
|
|
7
|
+
import { actionBlocksKey as io } from "../mappings/actionBlocksKey.es.js";
|
|
8
8
|
import { logoFromRef as to } from "./shared/EntityLogo.es.js";
|
|
9
9
|
import { CtaStatus as ro } from "./CtaStatus.es.js";
|
|
10
10
|
import no from "./FeedbackDialog.es.js";
|
|
@@ -25,7 +25,7 @@ import x from "@mui/material/Stack";
|
|
|
25
25
|
import { P as _o } from "@mxenabled/mxui";
|
|
26
26
|
import p from "@mui/material/Button";
|
|
27
27
|
import { ChevronRight as A } from "@mxenabled/mx-icons";
|
|
28
|
-
import { Fragment as ko, jsx as
|
|
28
|
+
import { Fragment as ko, jsx as e, jsxs as u } from "react/jsx-runtime";
|
|
29
29
|
import xo from "@mui/material/Box";
|
|
30
30
|
import vo from "@mui/material/Card";
|
|
31
31
|
var So = {}, wo = {
|
|
@@ -51,48 +51,48 @@ var So = {}, wo = {
|
|
|
51
51
|
fontWeight: 600,
|
|
52
52
|
lineHeight: "16px",
|
|
53
53
|
"&.Mui-disabled": { color: "text.disabled" }
|
|
54
|
-
},
|
|
55
|
-
const F = Y(),
|
|
54
|
+
}, re = yo(({ beat: i, beatActions: l = So, obsolete: C, isLoading: O = !1, isError: I = !1 }) => {
|
|
55
|
+
const F = Y(), R = q(), { config: E } = K(), o = ho(i, l), v = $(), { runCta: M, primary: h, secondary: S } = eo(i, l, i.insights_payload?.primary_cta, i.insights_payload?.secondary_cta), f = i.insights_payload?.widget_type === "mini", N = go(() => ({
|
|
56
56
|
...o.wrappedActions,
|
|
57
|
-
beat:
|
|
58
|
-
}), [o.wrappedActions,
|
|
59
|
-
if (I) return /* @__PURE__ */
|
|
60
|
-
const t =
|
|
57
|
+
beat: i
|
|
58
|
+
}), [o.wrappedActions, i]);
|
|
59
|
+
if (I) return /* @__PURE__ */ e(so, {});
|
|
60
|
+
const t = i.insights_payload;
|
|
61
61
|
if (!t || o.cardState === "dismissed") return null;
|
|
62
|
-
const { instance_slot: H, primary_cta: n, secondary_cta: s, sub_title: P, title:
|
|
62
|
+
const { instance_slot: H, primary_cta: n, secondary_cta: s, sub_title: P, title: W, guid: w, dismissed_at: G } = t, { block: V } = H, z = P ?? (t.subtitle ? {
|
|
63
63
|
logo: to(t.logo),
|
|
64
64
|
text: t.subtitle
|
|
65
|
-
} : void 0), c = (a) => Z(a,
|
|
65
|
+
} : void 0), c = (a) => Z(a, E, l.onContactSupport), D = async (a, m) => {
|
|
66
66
|
if (!c(m.block)) {
|
|
67
|
-
if (m.block ===
|
|
67
|
+
if (m.block === io.CONTACT_SUPPORT_ACTION_BLOCK) {
|
|
68
68
|
oo({
|
|
69
|
-
beat:
|
|
69
|
+
beat: i,
|
|
70
70
|
stores: v,
|
|
71
71
|
hostActions: l,
|
|
72
72
|
slot: a
|
|
73
73
|
}), l.onContactSupport?.();
|
|
74
74
|
return;
|
|
75
75
|
}
|
|
76
|
-
await
|
|
76
|
+
await M(a, m);
|
|
77
77
|
}
|
|
78
|
-
}, B = ao[
|
|
78
|
+
}, B = ao[V], d = t.in_description_cta, g = !f && d?.label && d.block ? d : void 0, y = n?.label || (g ? void 0 : d?.label) || void 0, b = !f && !!n?.label, L = i.in_description_cta || i.html_in_description_cta, U = () => {
|
|
79
79
|
const { is_mobile_webview: a, clientConfig: m } = v.appDataStore.appConfig;
|
|
80
|
-
J(
|
|
80
|
+
J(i.template, {
|
|
81
81
|
isMobileWebview: a,
|
|
82
82
|
webviewScheme: m?.master?.ui_message_webview_url_scheme,
|
|
83
|
-
userGuid: t.user_guid ??
|
|
83
|
+
userGuid: t.user_guid ?? i.user_guid
|
|
84
84
|
});
|
|
85
|
-
}, r = b ? h.presentation : void 0, X = r?.kind === "hidden" && !!r.hideAll, T = !f && !!s?.label && !X, j = !!y && r?.kind !== "hidden" || T, _ = F.insights_feed?.general, k = C?.state === "not_refreshable" && !
|
|
86
|
-
return /* @__PURE__ */
|
|
85
|
+
}, r = b ? h.presentation : void 0, X = r?.kind === "hidden" && !!r.hideAll, T = !f && !!s?.label && !X, j = !!y && r?.kind !== "hidden" || T, _ = F.insights_feed?.general, k = C?.state === "not_refreshable" && !G && !!_;
|
|
86
|
+
return /* @__PURE__ */ e(Q, {
|
|
87
87
|
value: N,
|
|
88
88
|
children: /* @__PURE__ */ u(x, {
|
|
89
89
|
sx: { mb: 16 },
|
|
90
90
|
children: [
|
|
91
|
-
o.cardState === "confirming" ? /* @__PURE__ */
|
|
91
|
+
o.cardState === "confirming" ? /* @__PURE__ */ e(fo, {
|
|
92
92
|
onClose: o.collapseConfirmation,
|
|
93
93
|
onLeaveFeedback: o.openHideSurvey,
|
|
94
94
|
onUndo: o.undoDismiss
|
|
95
|
-
}) : /* @__PURE__ */ u(ko, { children: [C && _ && /* @__PURE__ */
|
|
95
|
+
}) : /* @__PURE__ */ u(ko, { children: [C && _ && /* @__PURE__ */ e(Co, {
|
|
96
96
|
...C,
|
|
97
97
|
copy: _
|
|
98
98
|
}), /* @__PURE__ */ u(vo, {
|
|
@@ -103,13 +103,13 @@ var So = {}, wo = {
|
|
|
103
103
|
pointerEvents: "none"
|
|
104
104
|
} },
|
|
105
105
|
children: [
|
|
106
|
-
k && /* @__PURE__ */
|
|
107
|
-
/* @__PURE__ */
|
|
106
|
+
k && /* @__PURE__ */ e(xo, { sx: wo }),
|
|
107
|
+
/* @__PURE__ */ e(mo, {
|
|
108
108
|
isMini: f,
|
|
109
|
-
subtitle:
|
|
110
|
-
title:
|
|
109
|
+
subtitle: z,
|
|
110
|
+
title: W ?? ""
|
|
111
111
|
}),
|
|
112
|
-
O ? /* @__PURE__ */
|
|
112
|
+
O ? /* @__PURE__ */ e(bo, {}) : B && /* @__PURE__ */ e(B, {
|
|
113
113
|
beatGuid: w,
|
|
114
114
|
payload: t
|
|
115
115
|
}),
|
|
@@ -121,13 +121,14 @@ var So = {}, wo = {
|
|
|
121
121
|
px: 16
|
|
122
122
|
},
|
|
123
123
|
children: [
|
|
124
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ e(_o, {
|
|
125
125
|
dangerouslySetInnerHTML: { __html: t.description.html_text },
|
|
126
|
+
sx: { fontWeight: "fontWeightRegular" },
|
|
126
127
|
variant: "subtitle2"
|
|
127
128
|
}),
|
|
128
|
-
g && /* @__PURE__ */
|
|
129
|
-
endIcon: /* @__PURE__ */
|
|
130
|
-
onClick: () =>
|
|
129
|
+
g && /* @__PURE__ */ e(p, {
|
|
130
|
+
endIcon: /* @__PURE__ */ e(A, {}),
|
|
131
|
+
onClick: () => R.openActionDrawer({
|
|
131
132
|
guid: w,
|
|
132
133
|
trigger: "inDescriptionCta"
|
|
133
134
|
}),
|
|
@@ -138,9 +139,9 @@ var So = {}, wo = {
|
|
|
138
139
|
},
|
|
139
140
|
children: g.label
|
|
140
141
|
}),
|
|
141
|
-
!d?.label && L && /* @__PURE__ */
|
|
142
|
-
endIcon: /* @__PURE__ */
|
|
143
|
-
onClick:
|
|
142
|
+
!d?.label && L && /* @__PURE__ */ e(p, {
|
|
143
|
+
endIcon: /* @__PURE__ */ e(A, {}),
|
|
144
|
+
onClick: U,
|
|
144
145
|
sx: {
|
|
145
146
|
height: 24,
|
|
146
147
|
p: 4,
|
|
@@ -157,18 +158,18 @@ var So = {}, wo = {
|
|
|
157
158
|
px: 16
|
|
158
159
|
},
|
|
159
160
|
children: [
|
|
160
|
-
y && !b && /* @__PURE__ */
|
|
161
|
+
y && !b && /* @__PURE__ */ e(p, {
|
|
161
162
|
sx: Do,
|
|
162
163
|
variant: "text",
|
|
163
164
|
children: y
|
|
164
165
|
}),
|
|
165
|
-
b && n && r?.kind === "status" && /* @__PURE__ */
|
|
166
|
+
b && n && r?.kind === "status" && /* @__PURE__ */ e(ro, {
|
|
166
167
|
action: r.action,
|
|
167
168
|
icon: r.icon,
|
|
168
169
|
label: r.label,
|
|
169
170
|
tone: r.tone
|
|
170
171
|
}),
|
|
171
|
-
b && n && !r && /* @__PURE__ */
|
|
172
|
+
b && n && !r && /* @__PURE__ */ e(p, {
|
|
172
173
|
"aria-disabled": c(n.block) || h.disabled,
|
|
173
174
|
disabled: h.disabled,
|
|
174
175
|
onClick: () => D("primary", n),
|
|
@@ -176,7 +177,7 @@ var So = {}, wo = {
|
|
|
176
177
|
variant: "outlined",
|
|
177
178
|
children: n.label
|
|
178
179
|
}),
|
|
179
|
-
T && s && /* @__PURE__ */
|
|
180
|
+
T && s && /* @__PURE__ */ e(p, {
|
|
180
181
|
"aria-disabled": c(s.block) || S.disabled,
|
|
181
182
|
color: "inherit",
|
|
182
183
|
disabled: S.disabled,
|
|
@@ -189,19 +190,19 @@ var So = {}, wo = {
|
|
|
189
190
|
})
|
|
190
191
|
]
|
|
191
192
|
}),
|
|
192
|
-
/* @__PURE__ */
|
|
193
|
+
/* @__PURE__ */ e(po, {
|
|
193
194
|
onTellUsMore: o.openRatingSurvey,
|
|
194
195
|
show: o.isFeedbackBarShown
|
|
195
196
|
})
|
|
196
197
|
]
|
|
197
198
|
})] }),
|
|
198
|
-
/* @__PURE__ */
|
|
199
|
-
/* @__PURE__ */
|
|
199
|
+
/* @__PURE__ */ e(lo, { beat: i }),
|
|
200
|
+
/* @__PURE__ */ e(uo, {
|
|
200
201
|
isOpen: o.isDismissOpen,
|
|
201
202
|
onClose: o.closeDismissDialog,
|
|
202
203
|
onDismiss: o.confirmDismiss
|
|
203
204
|
}),
|
|
204
|
-
o.isSurveyOpen && /* @__PURE__ */
|
|
205
|
+
o.isSurveyOpen && /* @__PURE__ */ e(no, {
|
|
205
206
|
characterLimitLabel: o.survey.characterLimitLabel,
|
|
206
207
|
closeAriaLabel: o.survey.closeAriaLabel,
|
|
207
208
|
isOpen: !0,
|
|
@@ -214,13 +215,13 @@ var So = {}, wo = {
|
|
|
214
215
|
secondaryText: o.survey.backText,
|
|
215
216
|
title: o.survey.title
|
|
216
217
|
}),
|
|
217
|
-
o.cardState === "visible" && t.footer && /* @__PURE__ */
|
|
218
|
+
o.cardState === "visible" && t.footer && /* @__PURE__ */ e(co, { footer: t.footer })
|
|
218
219
|
]
|
|
219
220
|
})
|
|
220
221
|
});
|
|
221
222
|
});
|
|
222
223
|
export {
|
|
223
|
-
|
|
224
|
+
re as default
|
|
224
225
|
};
|
|
225
226
|
|
|
226
227
|
//# sourceMappingURL=BaseLayout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\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 { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { CtaStatus } from './CtaStatus'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Mini CTA label styled like a Button.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontWeight: 600,\n height: 44,\n px: 2,\n textTransform: 'none',\n} as const\n\n// Full card's secondary CTA (e.g. Fee Detected's Contact Support): a quiet text button, 13/16\n// semibold in text.secondary. `color=\"inherit\"` keeps hover, ripple and focus off the primary palette.\n// An unavailable CTA (contact_support_block with no host handler) is dimmed at the call site, as the\n// primary CTA is, because it is only aria-disabled and so never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n lineHeight: '16px',\n '&.Mui-disabled': { color: 'text.disabled' },\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n // The primary step's presenter may draw a status or nothing instead of the button (full card only).\n const primaryPresentation = isCtaButton ? primaryCtaState.presentation : undefined\n const hidesAllCtas = primaryPresentation?.kind === 'hidden' && !!primaryPresentation.hideAll\n const showSecondaryCta = !isMini && !!secondary_cta?.label && !hidesAllCtas\n const showCtaRow = (!!ctaLabel && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {ctaLabel &&\n !isCtaButton && (\n // The card's action when it has no primary CTA button (mini always; a full card whose\n // only link names no block). What the tap does is the host's decision (Pulse posts\n // `carousel/cta`, the same redirect a V1 mini card sends), never the action drawer the\n // full card's CTA opens. It is a real (blue, focusable) button for that tap, but has no\n // handler of its own and does not stop the click, so it reaches the host's card handler\n // exactly as a tap on the card does.\n <Button sx={MINI_CTA_SX} variant=\"text\">\n {ctaLabel}\n </Button>\n )}\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n icon={primaryPresentation.icon}\n label={primaryPresentation.label}\n tone={primaryPresentation.tone}\n />\n )}\n {isCtaButton && primary_cta && !primaryPresentation && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"inherit\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n sx={{\n ...SECONDARY_CTA_SX,\n ...(isCtaDisabled(secondary_cta.block) && { color: 'text.disabled' }),\n }}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EAET,QAAQ;AACV,GAGM,KAAc;AAAA,EAClB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,eAAe;AACjB,GAMM,KAAmB;AAAA,EACvB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,kBAAkB,EAAE,OAAO,gBAAgB;AAC7C,GAEM,KAAa,GAAA,CAChB,EACC,MAAA,GACA,aAAA,IAAc,IACd,UAAA,GACA,WAAA,IAAY,IACZ,SAAA,IAAU,GAAA,MACW;AACrB,QAAM,IAAO,EAAmB,GAC1B,IAAkB,EAAmB,GACrC,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,IAAO,GAAoB,GAAM,CAAW,GAE5C,IAAS,EAAe,GACxB,EACJ,QAAQ,GACR,SAAS,GACT,WAAW,EAAA,IACT,GACF,GACA,GACA,EAAK,kBAAkB,aACvB,EAAK,kBAAkB,aACzB,GAGM,IAAS,EAAK,kBAAkB,gBAAgB,QAIhD,IAAmB,GAAA,OAChB;AAAA,IAAE,GAAG,EAAK;AAAA,IAAgB,MAAA;AAAA,EAAK,IACtC,CAAC,EAAK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UACd,UAAU,EAAK;AAAA,UACf,kBAAkB,EAAK,wBAAwB;AAAA,UAC/C,SAAS,EAAK,OAAO;AAAA,UACrB,aAAa,EAAK,OAAO;AAAA,UACzB,eAAe,EAAK,OAAO;AAAA,UAC3B,OAAO,EAAK,OAAO;AAAA,QACpB,CAAA;AAAA,QAGF,EAAK,cAAc,aAAa,EAAiB,UAChD,gBAAA,EAAC,IAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
1
|
+
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\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 { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { CtaStatus } from './CtaStatus'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Mini CTA label styled like a Button.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontWeight: 600,\n height: 44,\n px: 2,\n textTransform: 'none',\n} as const\n\n// Full card's secondary CTA (e.g. Fee Detected's Contact Support): a quiet text button, 13/16\n// semibold in text.secondary. `color=\"inherit\"` keeps hover, ripple and focus off the primary palette.\n// An unavailable CTA (contact_support_block with no host handler) is dimmed at the call site, as the\n// primary CTA is, because it is only aria-disabled and so never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n lineHeight: '16px',\n '&.Mui-disabled': { color: 'text.disabled' },\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n // The primary step's presenter may draw a status or nothing instead of the button (full card only).\n const primaryPresentation = isCtaButton ? primaryCtaState.presentation : undefined\n const hidesAllCtas = primaryPresentation?.kind === 'hidden' && !!primaryPresentation.hideAll\n const showSecondaryCta = !isMini && !!secondary_cta?.label && !hidesAllCtas\n const showCtaRow = (!!ctaLabel && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n sx={{ fontWeight: 'fontWeightRegular' }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {ctaLabel &&\n !isCtaButton && (\n // The card's action when it has no primary CTA button (mini always; a full card whose\n // only link names no block). What the tap does is the host's decision (Pulse posts\n // `carousel/cta`, the same redirect a V1 mini card sends), never the action drawer the\n // full card's CTA opens. It is a real (blue, focusable) button for that tap, but has no\n // handler of its own and does not stop the click, so it reaches the host's card handler\n // exactly as a tap on the card does.\n <Button sx={MINI_CTA_SX} variant=\"text\">\n {ctaLabel}\n </Button>\n )}\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n icon={primaryPresentation.icon}\n label={primaryPresentation.label}\n tone={primaryPresentation.tone}\n />\n )}\n {isCtaButton && primary_cta && !primaryPresentation && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"inherit\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n sx={{\n ...SECONDARY_CTA_SX,\n ...(isCtaDisabled(secondary_cta.block) && { color: 'text.disabled' }),\n }}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAi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
|
+
import { useInsightsV2Store as L } from "../../common/context/hooks.es.js";
|
|
2
2
|
import { slot as u } from "../../core/types/Insights.es.js";
|
|
3
|
-
import { getCategoryColor as
|
|
3
|
+
import { getCategoryColor as R } from "../../core/utils/CategoryUtil.es.js";
|
|
4
4
|
import { TinyBarChart as E } from "../../common/components/TinyBarChart.es.js";
|
|
5
|
-
import { BAR_ARIA_LABEL as
|
|
6
|
-
import { ThemedSVGImage as
|
|
5
|
+
import { BAR_ARIA_LABEL as V, buildChartData as A, buildDataSeries as T } from "../blocks/ChartBlocks/BarchartBlock/utils.es.js";
|
|
6
|
+
import { ThemedSVGImage as z } from "./chartblocks/ThemedSVGImage.es.js";
|
|
7
7
|
import x from "./LogoFromGuid.es.js";
|
|
8
|
-
import { createVariantBlock as
|
|
9
|
-
import { ActionBlockLayer as
|
|
10
|
-
import
|
|
11
|
-
import { InsightOptionsMenu as
|
|
12
|
-
import { ReactComponent as
|
|
13
|
-
import
|
|
8
|
+
import { createVariantBlock as O } from "../blocks/createVariantBlock.es.js";
|
|
9
|
+
import { ActionBlockLayer as N } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
10
|
+
import k from "./BadgedTile.es.js";
|
|
11
|
+
import { InsightOptionsMenu as G } from "./InsightOptionsMenu.es.js";
|
|
12
|
+
import { ReactComponent as K } from "./shared/images/FeeDetected.es.js";
|
|
13
|
+
import P from "./StatusBadge.es.js";
|
|
14
14
|
import h from "@mui/material/Stack";
|
|
15
|
-
import { P, Text as
|
|
16
|
-
import
|
|
17
|
-
import { Icon as
|
|
18
|
-
import { Fragment as
|
|
15
|
+
import { P as W, Text as b } from "@mxenabled/mxui";
|
|
16
|
+
import j from "@mui/material/Button";
|
|
17
|
+
import { Icon as v } from "@mxenabled/mx-icons";
|
|
18
|
+
import { Fragment as F, jsx as t, jsxs as s } from "react/jsx-runtime";
|
|
19
19
|
import i from "@mui/material/Box";
|
|
20
|
-
import
|
|
21
|
-
var d = 44,
|
|
20
|
+
import H from "@mui/material/Card";
|
|
21
|
+
var d = 44, y = 36, M = 75, X = 74, f = {
|
|
22
22
|
left: "50%",
|
|
23
23
|
position: "absolute",
|
|
24
24
|
top: "50%",
|
|
25
25
|
transform: "translate(-50%, -50%)"
|
|
26
|
-
}, C = ({ logo:
|
|
27
|
-
logo:
|
|
26
|
+
}, C = ({ logo: r }) => r ? /* @__PURE__ */ t(x, {
|
|
27
|
+
logo: r,
|
|
28
28
|
size: d
|
|
29
|
-
}) : /* @__PURE__ */
|
|
29
|
+
}) : /* @__PURE__ */ t(i, {
|
|
30
30
|
"data-testid": "compact-insight-card-fallback-icon",
|
|
31
31
|
sx: {
|
|
32
32
|
alignItems: "center",
|
|
@@ -36,30 +36,30 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
36
36
|
justifyContent: "center",
|
|
37
37
|
width: d
|
|
38
38
|
},
|
|
39
|
-
children: /* @__PURE__ */
|
|
39
|
+
children: /* @__PURE__ */ t(v, {
|
|
40
40
|
color: "primary",
|
|
41
41
|
fill: !0,
|
|
42
42
|
name: "lightbulb",
|
|
43
43
|
size: 24
|
|
44
44
|
})
|
|
45
|
-
}),
|
|
46
|
-
center: /* @__PURE__ */
|
|
45
|
+
}), _ = ({ logo: r }) => /* @__PURE__ */ t(k, {
|
|
46
|
+
center: /* @__PURE__ */ t(C, { logo: r }),
|
|
47
47
|
size: d,
|
|
48
48
|
sx: { flexShrink: 0 }
|
|
49
|
-
}), Z = ({ logo:
|
|
50
|
-
center: /* @__PURE__ */
|
|
49
|
+
}), Z = ({ logo: r }) => /* @__PURE__ */ t(k, {
|
|
50
|
+
center: /* @__PURE__ */ t(C, { logo: r }),
|
|
51
51
|
size: d,
|
|
52
52
|
sx: { flexShrink: 0 },
|
|
53
|
-
topRight: /* @__PURE__ */
|
|
54
|
-
}), $ = () => /* @__PURE__ */
|
|
53
|
+
topRight: /* @__PURE__ */ t(P, { tone: "warning" })
|
|
54
|
+
}), $ = () => /* @__PURE__ */ t(z, {
|
|
55
55
|
divProps: { style: {
|
|
56
56
|
flexShrink: 0,
|
|
57
57
|
lineHeight: 0,
|
|
58
58
|
width: "max-content"
|
|
59
59
|
} },
|
|
60
|
-
image:
|
|
61
|
-
}), q = ({ data:
|
|
62
|
-
const { from_logo: o, to_logo: a } =
|
|
60
|
+
image: K
|
|
61
|
+
}), q = ({ data: r }) => {
|
|
62
|
+
const { from_logo: o, to_logo: a } = r ?? {};
|
|
63
63
|
return /* @__PURE__ */ s(i, {
|
|
64
64
|
sx: {
|
|
65
65
|
flexShrink: 0,
|
|
@@ -68,7 +68,7 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
68
68
|
width: M
|
|
69
69
|
},
|
|
70
70
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
71
|
+
/* @__PURE__ */ t(i, {
|
|
72
72
|
"aria-hidden": !0,
|
|
73
73
|
"data-testid": "linked-logos-ring",
|
|
74
74
|
sx: {
|
|
@@ -79,7 +79,7 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
79
79
|
width: 36
|
|
80
80
|
}
|
|
81
81
|
}),
|
|
82
|
-
/* @__PURE__ */
|
|
82
|
+
/* @__PURE__ */ t(i, {
|
|
83
83
|
"aria-hidden": !0,
|
|
84
84
|
"data-testid": "linked-logos-ring",
|
|
85
85
|
sx: {
|
|
@@ -91,7 +91,7 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
91
91
|
width: 48
|
|
92
92
|
}
|
|
93
93
|
}),
|
|
94
|
-
/* @__PURE__ */
|
|
94
|
+
/* @__PURE__ */ t(i, {
|
|
95
95
|
sx: {
|
|
96
96
|
borderRadius: "4px",
|
|
97
97
|
left: 0,
|
|
@@ -99,12 +99,12 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
99
99
|
position: "absolute",
|
|
100
100
|
top: 0
|
|
101
101
|
},
|
|
102
|
-
children: /* @__PURE__ */
|
|
102
|
+
children: /* @__PURE__ */ t(x, {
|
|
103
103
|
logo: o,
|
|
104
|
-
size:
|
|
104
|
+
size: y
|
|
105
105
|
})
|
|
106
106
|
}),
|
|
107
|
-
/* @__PURE__ */
|
|
107
|
+
/* @__PURE__ */ t(i, {
|
|
108
108
|
sx: {
|
|
109
109
|
borderRadius: "4px",
|
|
110
110
|
bottom: 0,
|
|
@@ -112,12 +112,12 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
112
112
|
position: "absolute",
|
|
113
113
|
right: 0
|
|
114
114
|
},
|
|
115
|
-
children: /* @__PURE__ */
|
|
115
|
+
children: /* @__PURE__ */ t(x, {
|
|
116
116
|
logo: a,
|
|
117
|
-
size:
|
|
117
|
+
size: y
|
|
118
118
|
})
|
|
119
119
|
}),
|
|
120
|
-
/* @__PURE__ */
|
|
120
|
+
/* @__PURE__ */ t(i, {
|
|
121
121
|
"aria-hidden": !0,
|
|
122
122
|
"data-testid": "linked-logos-badge",
|
|
123
123
|
sx: {
|
|
@@ -132,7 +132,7 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
132
132
|
p: 2,
|
|
133
133
|
zIndex: 1
|
|
134
134
|
},
|
|
135
|
-
children: /* @__PURE__ */
|
|
135
|
+
children: /* @__PURE__ */ t(v, {
|
|
136
136
|
name: "link",
|
|
137
137
|
size: 16,
|
|
138
138
|
sx: { color: "primary.contrastText" }
|
|
@@ -140,27 +140,27 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
140
140
|
})
|
|
141
141
|
]
|
|
142
142
|
});
|
|
143
|
-
}, J = ({ data:
|
|
144
|
-
const o =
|
|
143
|
+
}, J = ({ data: r }) => {
|
|
144
|
+
const o = T(u(r, "series"));
|
|
145
145
|
if (!o.length) return null;
|
|
146
|
-
const a = u(
|
|
147
|
-
return /* @__PURE__ */
|
|
146
|
+
const a = u(r, "category_guid"), n = A(o, V).slice(-3);
|
|
147
|
+
return /* @__PURE__ */ t(i, {
|
|
148
148
|
"data-testid": "compact-insight-card-bar-chart",
|
|
149
149
|
sx: { flexShrink: 0 },
|
|
150
|
-
children: /* @__PURE__ */
|
|
151
|
-
color: (l) => a ?
|
|
150
|
+
children: /* @__PURE__ */ t(E, {
|
|
151
|
+
color: (l) => a ? R(a, l) : l.palette.primary.main,
|
|
152
152
|
data: n
|
|
153
153
|
})
|
|
154
154
|
});
|
|
155
|
-
}, Q =
|
|
155
|
+
}, Q = O({
|
|
156
156
|
variants: {
|
|
157
157
|
category_color: J,
|
|
158
158
|
linked_logos: q,
|
|
159
|
-
minimal:
|
|
159
|
+
minimal: _,
|
|
160
160
|
with_illustration: $,
|
|
161
161
|
with_warning_badge: Z
|
|
162
162
|
},
|
|
163
|
-
fallback:
|
|
163
|
+
fallback: _,
|
|
164
164
|
name: "InsightVisual"
|
|
165
165
|
}), U = {
|
|
166
166
|
BillAmountNotStandard: {
|
|
@@ -171,20 +171,20 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
171
171
|
key: "in_description_cta",
|
|
172
172
|
trigger: "inDescriptionCta"
|
|
173
173
|
}
|
|
174
|
-
}, Y = (
|
|
175
|
-
const { openActionDrawer: I } =
|
|
174
|
+
}, Y = (r) => r.stopPropagation(), kt = ({ beat: r, isCtaDisabled: o = !1, onCtaClick: a, onTap: n, payload: l }) => {
|
|
175
|
+
const { openActionDrawer: I } = L(), { description: w, instance_slot: g, primary_cta: m, title: B } = l, c = U[l.template ?? ""], p = c ? l[c.key] : m, D = u(g.data, "logo"), S = (e) => {
|
|
176
176
|
if (e.stopPropagation(), !(o || !p)) {
|
|
177
177
|
if (c) {
|
|
178
|
-
|
|
179
|
-
guid:
|
|
178
|
+
r && I({
|
|
179
|
+
guid: r.guid,
|
|
180
180
|
trigger: c.trigger
|
|
181
181
|
});
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
|
-
|
|
184
|
+
m && a?.(m);
|
|
185
185
|
}
|
|
186
186
|
};
|
|
187
|
-
return /* @__PURE__ */ s(
|
|
187
|
+
return /* @__PURE__ */ s(F, { children: [/* @__PURE__ */ s(H, {
|
|
188
188
|
"data-testid": "compact-insight-card",
|
|
189
189
|
...n ? {
|
|
190
190
|
onClick: n,
|
|
@@ -211,14 +211,14 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
211
211
|
pl: 8,
|
|
212
212
|
pt: 4
|
|
213
213
|
},
|
|
214
|
-
children: [/* @__PURE__ */
|
|
214
|
+
children: [/* @__PURE__ */ t(b, {
|
|
215
215
|
bold: !0,
|
|
216
216
|
variant: "body1",
|
|
217
|
-
children:
|
|
218
|
-
}), /* @__PURE__ */
|
|
217
|
+
children: B ?? ""
|
|
218
|
+
}), /* @__PURE__ */ t(i, {
|
|
219
219
|
onClick: Y,
|
|
220
220
|
sx: { display: "flex" },
|
|
221
|
-
children: /* @__PURE__ */
|
|
221
|
+
children: /* @__PURE__ */ t(G, {})
|
|
222
222
|
})]
|
|
223
223
|
}), /* @__PURE__ */ s(h, {
|
|
224
224
|
sx: {
|
|
@@ -233,13 +233,14 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
233
233
|
gap: 8,
|
|
234
234
|
minWidth: 0
|
|
235
235
|
},
|
|
236
|
-
children: [/* @__PURE__ */
|
|
237
|
-
dangerouslySetInnerHTML: { __html:
|
|
236
|
+
children: [/* @__PURE__ */ t(W, {
|
|
237
|
+
dangerouslySetInnerHTML: { __html: w.html_text },
|
|
238
238
|
"data-testid": "compact-insight-card-description",
|
|
239
|
+
sx: { fontWeight: "fontWeightRegular" },
|
|
239
240
|
variant: "subtitle2"
|
|
240
|
-
}), p?.label && /* @__PURE__ */
|
|
241
|
+
}), p?.label && /* @__PURE__ */ t(j, {
|
|
241
242
|
"aria-disabled": o,
|
|
242
|
-
onClick:
|
|
243
|
+
onClick: S,
|
|
243
244
|
size: "small",
|
|
244
245
|
sx: {
|
|
245
246
|
alignSelf: "flex-start",
|
|
@@ -252,18 +253,22 @@ var d = 44, b = 36, M = 75, X = 74, f = {
|
|
|
252
253
|
}
|
|
253
254
|
},
|
|
254
255
|
variant: "text",
|
|
255
|
-
children:
|
|
256
|
+
children: /* @__PURE__ */ t(b, {
|
|
257
|
+
bold: !0,
|
|
258
|
+
variant: "body2",
|
|
259
|
+
children: p.label
|
|
260
|
+
})
|
|
256
261
|
})]
|
|
257
|
-
}), /* @__PURE__ */
|
|
258
|
-
data:
|
|
259
|
-
logo:
|
|
260
|
-
variant:
|
|
262
|
+
}), /* @__PURE__ */ t(Q, {
|
|
263
|
+
data: g.data,
|
|
264
|
+
logo: D,
|
|
265
|
+
variant: g.variant
|
|
261
266
|
})]
|
|
262
267
|
})]
|
|
263
|
-
}),
|
|
268
|
+
}), r && /* @__PURE__ */ t(N, { beat: r })] });
|
|
264
269
|
};
|
|
265
270
|
export {
|
|
266
|
-
|
|
271
|
+
kt as default
|
|
267
272
|
};
|
|
268
273
|
|
|
269
274
|
//# 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 { 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 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\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}\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\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 link badge over two rings at the centre. The rings and badge are decorative (`aria-hidden`); each\n * logo's accessible name is its `alt`.\n */\nconst LinkedLogosVisual = ({ data }: InsightVisualProps) => {\n const { from_logo, to_logo } = (data ?? {}) as AccountSwitchBlockV2Data\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={{ ...CENTRED, bgcolor: 'primary.light', borderRadius: '50%', height: 36, width: 36 }}\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 <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 </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. Every other beat keeps `primary_cta` and hands it to the host's `onCtaClick`\n * (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}\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 { 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 // 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) openActionDrawer({ guid: beat.guid, trigger: beatCta.trigger })\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={{ flexDirection: 'row', gap: 16, pl: 8, pt: 4 }}>\n <Stack sx={{ flex: 1, gap: 8, minWidth: 0 }}>\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 variant=\"subtitle2\"\n />\n {cta?.label && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // Figma 1941:111897 lines the CTA label up with the description's left edge. The\n // column already pads 8, so the button's own 8 is pulled back out — padding kept so\n // the tap target does not shrink.\n mt: 5,\n ml: -8,\n px: 8,\n ...(isCtaDisabled && {\n color: 'text.disabled',\n cursor: 'default',\n }),\n }}\n variant=\"text\"\n >\n {cta.label}\n </Button>\n )}\n </Stack>\n\n <InsightVisual data={instance_slot.data} logo={rowLogo} variant={instance_slot.variant} />\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,IAAY,IAUZ,IAAmB,IACnB,IAAmB,IACnB,IAAoB,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,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BAAyB,EAAE,QAAQ,EAAY,UAAU;AAAA,UACzD,eAAY;AAAA,UACZ,SAAQ;AAAA,QACT,CAAA,GACA,GAAK,SACJ,gBAAA,EAAC,GAAD;AAAA,UACE,iBAAe;AAAA,UACf,SAAS;AAAA,UACT,MAAK;AAAA,UACL,IAAI;AAAA,YACF,WAAW;AAAA,YAIX,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,UAEP,UAAA,EAAI;AAAA,QACC,CAAA,CAEL;AAAA,MAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,QAAe,MAAM,EAAc;AAAA,QAAM,MAAM;AAAA,QAAS,SAAS,EAAc;AAAA,MAAU,CAAA,CACpF;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 { 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 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\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}\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\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 link badge over two rings at the centre. The rings and badge are decorative (`aria-hidden`); each\n * logo's accessible name is its `alt`.\n */\nconst LinkedLogosVisual = ({ data }: InsightVisualProps) => {\n const { from_logo, to_logo } = (data ?? {}) as AccountSwitchBlockV2Data\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={{ ...CENTRED, bgcolor: 'primary.light', borderRadius: '50%', height: 36, width: 36 }}\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 <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 </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. Every other beat keeps `primary_cta` and hands it to the host's `onCtaClick`\n * (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}\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 { 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 // 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) openActionDrawer({ guid: beat.guid, trigger: beatCta.trigger })\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={{ flexDirection: 'row', gap: 16, pl: 8, pt: 4 }}>\n <Stack sx={{ flex: 1, gap: 8, minWidth: 0 }}>\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={{ fontWeight: 'fontWeightRegular' }}\n variant=\"subtitle2\"\n />\n {cta?.label && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // Figma 1941:111897 lines the CTA label up with the description's left edge. The\n // column already pads 8, so the button's own 8 is pulled back out — padding kept so\n // the tap target does not shrink.\n mt: 5,\n ml: -8,\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 data={instance_slot.data} logo={rowLogo} variant={instance_slot.variant} />\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,IAAY,IAUZ,IAAmB,IACnB,IAAmB,IACnB,IAAoB,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,I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ACE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,MAAM;AAAA,UAAG,KAAK;AAAA,UAAG,UAAU;AAAA,QAAE;AAAA,QAA1C,UAAA,CAIE,gBAAA,EAAC,GAAD;AAAA,UACE,yBAAyB,EAAE,QAAQ,EAAY,UAAU;AAAA,UACzD,eAAY;AAAA,UACZ,IAAI,EAAE,YAAY,oBAAoB;AAAA,UACtC,SAAQ;AAAA,QACT,CAAA,GACA,GAAK,SACJ,gBAAA,EAAC,GAAD;AAAA,UACE,iBAAe;AAAA,UACf,SAAS;AAAA,UACT,MAAK;AAAA,UACL,IAAI;AAAA,YACF,WAAW;AAAA,YAIX,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,GAAD;AAAA,QAAe,MAAM,EAAc;AAAA,QAAM,MAAM;AAAA,QAAS,SAAS,EAAc;AAAA,MAAU,CAAA,CACpF;AAAA,IACH,CAAA,CAAA;AAAA,EAEL,CAAA,GAAA,KAAQ,gBAAA,EAAC,GAAD,EAAwB,MAAA,EAAO,CAAA,CACxC,EAAA,CAAA;AAEN"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import
|
|
1
|
+
import D from "react";
|
|
2
2
|
import { P as b, Text as m } from "@mxenabled/mxui";
|
|
3
|
-
import { Close as
|
|
4
|
-
import { Fragment as
|
|
5
|
-
import { Box as j, Button as u, Card as I, CardActionArea as
|
|
6
|
-
var O =
|
|
7
|
-
const a = !!(s && d), g = /* @__PURE__ */ e(
|
|
3
|
+
import { Close as M } from "@mxenabled/mx-icons";
|
|
4
|
+
import { Fragment as T, jsx as o, jsxs as e } from "react/jsx-runtime";
|
|
5
|
+
import { Box as j, Button as u, Card as I, CardActionArea as R, IconButton as S, Stack as i } from "@mui/material";
|
|
6
|
+
var O = D.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v, elevation: P, icon: r, isActiveCard: l, heightOverrides: k, onClose: p, onCardClick: n, onPrimaryAction: s, onSecondaryAction: h, primaryActionText: d, secondaryActionText: c, title: y, variant: C, widthOverrides: x, ...W }, B) {
|
|
7
|
+
const a = !!(s && d), g = /* @__PURE__ */ e(T, { children: [p && /* @__PURE__ */ o(S, {
|
|
8
8
|
"aria-label": w,
|
|
9
|
-
onClick: (
|
|
10
|
-
|
|
9
|
+
onClick: (t) => {
|
|
10
|
+
t.stopPropagation(), p?.();
|
|
11
11
|
},
|
|
12
|
-
onMouseDown: (
|
|
13
|
-
|
|
12
|
+
onMouseDown: (t) => {
|
|
13
|
+
t.stopPropagation();
|
|
14
14
|
},
|
|
15
|
-
onTouchStart: (
|
|
16
|
-
|
|
15
|
+
onTouchStart: (t) => {
|
|
16
|
+
t.stopPropagation();
|
|
17
17
|
},
|
|
18
18
|
sx: {
|
|
19
19
|
minHeight: 40,
|
|
@@ -22,7 +22,7 @@ var O = M.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
22
22
|
right: 4,
|
|
23
23
|
top: 4
|
|
24
24
|
},
|
|
25
|
-
children: /* @__PURE__ */
|
|
25
|
+
children: /* @__PURE__ */ o(M, {})
|
|
26
26
|
}), /* @__PURE__ */ e(i, {
|
|
27
27
|
sx: {
|
|
28
28
|
gap: 6,
|
|
@@ -36,21 +36,22 @@ var O = M.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
36
36
|
},
|
|
37
37
|
children: [r, /* @__PURE__ */ e(i, {
|
|
38
38
|
sx: { gap: 6 },
|
|
39
|
-
children: [/* @__PURE__ */
|
|
39
|
+
children: [/* @__PURE__ */ o(i, {
|
|
40
40
|
sx: {
|
|
41
41
|
flexDirection: "row",
|
|
42
42
|
justifyContent: "space-between"
|
|
43
43
|
},
|
|
44
|
-
children: /* @__PURE__ */
|
|
44
|
+
children: /* @__PURE__ */ o(b, {
|
|
45
45
|
bold: !0,
|
|
46
46
|
sx: { lineHeight: "16px" },
|
|
47
47
|
variant: "body1",
|
|
48
48
|
children: y
|
|
49
49
|
})
|
|
50
|
-
}), /* @__PURE__ */
|
|
50
|
+
}), /* @__PURE__ */ o(b, {
|
|
51
51
|
dangerouslySetInnerHTML: { __html: v },
|
|
52
52
|
sx: {
|
|
53
53
|
display: "-webkit-box",
|
|
54
|
+
fontWeight: "fontWeightRegular",
|
|
54
55
|
overflow: "hidden",
|
|
55
56
|
textOverflow: "ellipsis",
|
|
56
57
|
WebkitBoxOrient: "vertical",
|
|
@@ -71,15 +72,15 @@ var O = M.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
71
72
|
pb: 4,
|
|
72
73
|
pl: r ? 36 : 0
|
|
73
74
|
},
|
|
74
|
-
children: [a && /* @__PURE__ */
|
|
75
|
-
onClick: (
|
|
76
|
-
|
|
75
|
+
children: [a && /* @__PURE__ */ o(u, {
|
|
76
|
+
onClick: (t) => {
|
|
77
|
+
t.stopPropagation(), s?.();
|
|
77
78
|
},
|
|
78
|
-
onMouseDown: (
|
|
79
|
-
|
|
79
|
+
onMouseDown: (t) => {
|
|
80
|
+
t.stopPropagation();
|
|
80
81
|
},
|
|
81
|
-
onTouchStart: (
|
|
82
|
-
|
|
82
|
+
onTouchStart: (t) => {
|
|
83
|
+
t.stopPropagation();
|
|
83
84
|
},
|
|
84
85
|
size: "small",
|
|
85
86
|
sx: {
|
|
@@ -87,25 +88,25 @@ var O = M.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
87
88
|
ml: r ? 0 : -8
|
|
88
89
|
},
|
|
89
90
|
variant: "text",
|
|
90
|
-
children: /* @__PURE__ */
|
|
91
|
+
children: /* @__PURE__ */ o(m, {
|
|
91
92
|
bold: !0,
|
|
92
93
|
variant: "body2",
|
|
93
94
|
children: d
|
|
94
95
|
})
|
|
95
|
-
}), !!(h && c) && /* @__PURE__ */
|
|
96
|
-
onClick: (
|
|
97
|
-
|
|
96
|
+
}), !!(h && c) && /* @__PURE__ */ o(u, {
|
|
97
|
+
onClick: (t) => {
|
|
98
|
+
t.stopPropagation(), h?.();
|
|
98
99
|
},
|
|
99
|
-
onMouseDown: (
|
|
100
|
-
|
|
100
|
+
onMouseDown: (t) => {
|
|
101
|
+
t.stopPropagation();
|
|
101
102
|
},
|
|
102
|
-
onTouchStart: (
|
|
103
|
-
|
|
103
|
+
onTouchStart: (t) => {
|
|
104
|
+
t.stopPropagation();
|
|
104
105
|
},
|
|
105
106
|
size: "small",
|
|
106
107
|
sx: { px: 8 },
|
|
107
108
|
variant: "text",
|
|
108
|
-
children: /* @__PURE__ */
|
|
109
|
+
children: /* @__PURE__ */ o(m, {
|
|
109
110
|
bold: !0,
|
|
110
111
|
sx: { color: "text.secondary" },
|
|
111
112
|
variant: "body2",
|
|
@@ -114,11 +115,11 @@ var O = M.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
114
115
|
})]
|
|
115
116
|
})]
|
|
116
117
|
})] });
|
|
117
|
-
return /* @__PURE__ */
|
|
118
|
+
return /* @__PURE__ */ o(I, {
|
|
118
119
|
"aria-hidden": !l,
|
|
119
120
|
"aria-label": f,
|
|
120
121
|
elevation: P,
|
|
121
|
-
ref:
|
|
122
|
+
ref: B,
|
|
122
123
|
role: "group",
|
|
123
124
|
sx: {
|
|
124
125
|
backgroundColor: "background.paper",
|
|
@@ -130,8 +131,8 @@ var O = M.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
130
131
|
},
|
|
131
132
|
tabIndex: n || !l ? -1 : 0,
|
|
132
133
|
variant: C,
|
|
133
|
-
...
|
|
134
|
-
children: n ? /* @__PURE__ */
|
|
134
|
+
...W,
|
|
135
|
+
children: n ? /* @__PURE__ */ o(R, {
|
|
135
136
|
component: "div",
|
|
136
137
|
onClick: n,
|
|
137
138
|
sx: {
|
|
@@ -141,7 +142,7 @@ var O = M.forwardRef(function({ ariaLabel: f, closeAriaLabel: w, description: v,
|
|
|
141
142
|
height: "100%"
|
|
142
143
|
},
|
|
143
144
|
children: g
|
|
144
|
-
}) : /* @__PURE__ */
|
|
145
|
+
}) : /* @__PURE__ */ o(j, {
|
|
145
146
|
sx: {
|
|
146
147
|
pb: 8,
|
|
147
148
|
pt: 16,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MicroCardTemplate.es.js","names":[],"sources":["../../src/microinsights/MicroCardTemplate.tsx"],"sourcesContent":["import React from 'react'\nimport { Box, Button, Card, CardActionArea, IconButton, Stack } from '@mui/material'\n\nimport { P, Text } from '@mxenabled/mxui'\nimport { Close } from '@mxenabled/mx-icons'\n\ninterface MicroCardTemplateProps {\n ariaLabel?: string\n closeAriaLabel?: string\n description: string\n elevation?: number\n icon?: React.ReactNode\n isActiveCard?: boolean\n heightOverrides?: string | number\n onClose?: () => void\n onCardClick?: () => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryActionText?: string\n secondaryActionText?: string\n title: string\n variant?: 'outlined' | 'elevation' | undefined\n widthOverrides?: string | number\n}\n\nconst MicroCardTemplate = React.forwardRef<HTMLDivElement, MicroCardTemplateProps>(\n function MicroCardTemplate(\n {\n ariaLabel,\n closeAriaLabel,\n description,\n elevation,\n icon,\n isActiveCard,\n heightOverrides,\n onClose,\n onCardClick,\n onPrimaryAction,\n onSecondaryAction,\n primaryActionText,\n secondaryActionText,\n title,\n variant,\n widthOverrides,\n ...restProps\n },\n inViewRef,\n ) {\n const hasPrimaryAction = Boolean(onPrimaryAction && primaryActionText)\n const hasSecondaryAction = Boolean(onSecondaryAction && secondaryActionText)\n\n const innerContent = (\n <>\n {onClose && (\n <IconButton\n aria-label={closeAriaLabel}\n onClick={(e) => {\n e.stopPropagation()\n onClose?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n sx={{ minHeight: 40, minWidth: 40, position: 'absolute', right: 4, top: 4 }}\n >\n <Close />\n </IconButton>\n )}\n <Stack sx={{ gap: 6, height: '100%', justifyContent: 'space-between' }}>\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n {icon}\n <Stack sx={{ gap: 6 }}>\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <P bold={true} sx={{ lineHeight: '16px' }} variant=\"body1\">\n {title}\n </P>\n </Stack>\n <P\n dangerouslySetInnerHTML={{ __html: description }}\n sx={{\n display: '-webkit-box',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: hasPrimaryAction ? 2 : 3,\n '& .bold-copy': {\n fontWeight: 'bold',\n fontFamily: 'inherit',\n },\n }}\n variant=\"subtitle2\"\n />\n </Stack>\n </Stack>\n\n {hasPrimaryAction && (\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n height: 28,\n pb: 4,\n pl: icon ? 36 : 0,\n }}\n >\n {hasPrimaryAction && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onPrimaryAction?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n size=\"small\"\n sx={{ px: 8, ml: icon ? 0 : -8 }}\n variant=\"text\"\n >\n <Text bold={true} variant=\"body2\">\n {primaryActionText}\n </Text>\n </Button>\n )}\n\n {hasSecondaryAction && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onSecondaryAction?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n size=\"small\"\n sx={{ px: 8 }}\n variant=\"text\"\n >\n <Text bold={true} sx={{ color: 'text.secondary' }} variant=\"body2\">\n {secondaryActionText}\n </Text>\n </Button>\n )}\n </Stack>\n )}\n </Stack>\n </>\n )\n\n return (\n <Card\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n elevation={elevation}\n ref={inViewRef}\n role=\"group\"\n sx={{\n backgroundColor: 'background.paper',\n height: heightOverrides ? '100%' : 120,\n minWidth: widthOverrides ? `${widthOverrides}px` : '100%',\n position: 'relative',\n my: 1,\n borderRadius: 2,\n }}\n tabIndex={onCardClick || !isActiveCard ? -1 : 0}\n variant={variant}\n {...restProps}\n >\n {onCardClick ? (\n <CardActionArea\n component=\"div\"\n onClick={onCardClick}\n sx={{\n pb: 8,\n pt: 16,\n px: 16,\n height: '100%',\n }}\n >\n {innerContent}\n </CardActionArea>\n ) : (\n <Box sx={{ pb: 8, pt: 16, px: 16, height: '100%' }}>{innerContent}</Box>\n )}\n </Card>\n )\n },\n)\n\nexport default MicroCardTemplate\n"],"mappings":";;;;;AAyBA,IAAM,IAAoB,EAAM,WAC9B,SACE,EACE,WAAA,GACA,gBAAA,GACA,aAAA,GACA,WAAA,GACA,MAAA,GACA,cAAA,GACA,iBAAA,GACA,SAAA,GACA,aAAA,GACA,iBAAA,GACA,mBAAA,GACA,mBAAA,GACA,qBAAA,GACA,OAAA,GACA,SAAA,GACA,gBAAA,GACA,GAAG,EAAA,GAEL,GACA;AACA,QAAM,IAAmB,GAAQ,KAAmB,IAG9C,IACJ,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY;AAAA,IACZ,SAAA,CAAU,MAAM;AACd,MAAA,EAAE,gBAAgB,GAClB,IAAU;AAAA,IACZ;AAAA,IACA,aAAA,CAAc,MAAM;AAClB,MAAA,EAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,cAAA,CAAe,MAAM;AACnB,MAAA,EAAE,gBAAgB;AAAA,IACpB;AAAA,IACA,IAAI;AAAA,MAAE,WAAW;AAAA,MAAI,UAAU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UAAA,CASG,KACC,gBAAA,EAAC,GAAD;AAAA,QACE,SAAA,CAAU,MAAM;AACd,UAAA,EAAE,gBAAgB,GAClB,IAAkB;AAAA,QACpB;AAAA,QACA,aAAA,CAAc,MAAM;AAClB,UAAA,EAAE,gBAAgB;AAAA,QACpB;AAAA,QACA,cAAA,CAAe,MAAM;AACnB,UAAA,EAAE,gBAAgB;AAAA,QACpB;AAAA,QACA,MAAK;AAAA,QACL,IAAI;AAAA,UAAE,IAAI;AAAA,UAAG,IAAI,IAAO,IAAI;AAAA,QAAG;AAAA,QAC/B,SAAQ;AAAA,QAER,UAAA,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,SAAQ;AAAA,UACvB,UAAA;AAAA,QACG,CAAA;AAAA,MACA,CAAA,
|
|
1
|
+
{"version":3,"file":"MicroCardTemplate.es.js","names":[],"sources":["../../src/microinsights/MicroCardTemplate.tsx"],"sourcesContent":["import React from 'react'\nimport { Box, Button, Card, CardActionArea, IconButton, Stack } from '@mui/material'\n\nimport { P, Text } from '@mxenabled/mxui'\nimport { Close } from '@mxenabled/mx-icons'\n\ninterface MicroCardTemplateProps {\n ariaLabel?: string\n closeAriaLabel?: string\n description: string\n elevation?: number\n icon?: React.ReactNode\n isActiveCard?: boolean\n heightOverrides?: string | number\n onClose?: () => void\n onCardClick?: () => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryActionText?: string\n secondaryActionText?: string\n title: string\n variant?: 'outlined' | 'elevation' | undefined\n widthOverrides?: string | number\n}\n\nconst MicroCardTemplate = React.forwardRef<HTMLDivElement, MicroCardTemplateProps>(\n function MicroCardTemplate(\n {\n ariaLabel,\n closeAriaLabel,\n description,\n elevation,\n icon,\n isActiveCard,\n heightOverrides,\n onClose,\n onCardClick,\n onPrimaryAction,\n onSecondaryAction,\n primaryActionText,\n secondaryActionText,\n title,\n variant,\n widthOverrides,\n ...restProps\n },\n inViewRef,\n ) {\n const hasPrimaryAction = Boolean(onPrimaryAction && primaryActionText)\n const hasSecondaryAction = Boolean(onSecondaryAction && secondaryActionText)\n\n const innerContent = (\n <>\n {onClose && (\n <IconButton\n aria-label={closeAriaLabel}\n onClick={(e) => {\n e.stopPropagation()\n onClose?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n sx={{ minHeight: 40, minWidth: 40, position: 'absolute', right: 4, top: 4 }}\n >\n <Close />\n </IconButton>\n )}\n <Stack sx={{ gap: 6, height: '100%', justifyContent: 'space-between' }}>\n <Stack sx={{ flexDirection: 'row', gap: 12 }}>\n {icon}\n <Stack sx={{ gap: 6 }}>\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <P bold={true} sx={{ lineHeight: '16px' }} variant=\"body1\">\n {title}\n </P>\n </Stack>\n <P\n dangerouslySetInnerHTML={{ __html: description }}\n sx={{\n display: '-webkit-box',\n fontWeight: 'fontWeightRegular',\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n WebkitBoxOrient: 'vertical',\n WebkitLineClamp: hasPrimaryAction ? 2 : 3,\n '& .bold-copy': {\n fontWeight: 'bold',\n fontFamily: 'inherit',\n },\n }}\n variant=\"subtitle2\"\n />\n </Stack>\n </Stack>\n\n {hasPrimaryAction && (\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n height: 28,\n pb: 4,\n pl: icon ? 36 : 0,\n }}\n >\n {hasPrimaryAction && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onPrimaryAction?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n size=\"small\"\n sx={{ px: 8, ml: icon ? 0 : -8 }}\n variant=\"text\"\n >\n <Text bold={true} variant=\"body2\">\n {primaryActionText}\n </Text>\n </Button>\n )}\n\n {hasSecondaryAction && (\n <Button\n onClick={(e) => {\n e.stopPropagation()\n onSecondaryAction?.()\n }}\n onMouseDown={(e) => {\n e.stopPropagation()\n }}\n onTouchStart={(e) => {\n e.stopPropagation()\n }}\n size=\"small\"\n sx={{ px: 8 }}\n variant=\"text\"\n >\n <Text bold={true} sx={{ color: 'text.secondary' }} variant=\"body2\">\n {secondaryActionText}\n </Text>\n </Button>\n )}\n </Stack>\n )}\n </Stack>\n </>\n )\n\n return (\n <Card\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n elevation={elevation}\n ref={inViewRef}\n role=\"group\"\n sx={{\n backgroundColor: 'background.paper',\n height: heightOverrides ? '100%' : 120,\n minWidth: widthOverrides ? `${widthOverrides}px` : '100%',\n position: 'relative',\n my: 1,\n borderRadius: 2,\n }}\n tabIndex={onCardClick || !isActiveCard ? -1 : 0}\n variant={variant}\n {...restProps}\n >\n {onCardClick ? (\n <CardActionArea\n component=\"div\"\n onClick={onCardClick}\n sx={{\n pb: 8,\n pt: 16,\n px: 16,\n height: '100%',\n }}\n >\n {innerContent}\n </CardActionArea>\n ) : (\n <Box sx={{ pb: 8, pt: 16, px: 16, height: '100%' }}>{innerContent}</Box>\n )}\n </Card>\n )\n },\n)\n\nexport default MicroCardTemplate\n"],"mappings":";;;;;AAyBA,IAAM,IAAoB,EAAM,WAC9B,SACE,EACE,WAAA,GACA,gBAAA,GACA,aAAA,GACA,WAAA,GACA,MAAA,GACA,cAAA,GACA,iBAAA,GACA,SAAA,GACA,aAAA,GACA,iBAAA,GACA,mBAAA,GACA,mBAAA,GACA,qBAAA,GACA,OAAA,GACA,SAAA,GACA,gBAAA,GACA,GAAG,EAAA,GAEL,GACA;AACA,QAAM,IAAmB,GAAQ,KAAmB,IAG9C,IACJ,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,KACC,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY;AAAA,IACZ,SAAA,CAAU,MAAM;AACd,MAAA,EAAE,gBAAgB,GAClB,IAAU;AAAA,IACZ;AAAA,IACA,aAAA,CAAc,MAAM;AAClB,MAAA,EAAE,gBAAgB;AAAA,IACp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