@mx-cartographer/experiences 9.7.95 → 9.7.97
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +9 -0
- package/dist/insights/components/shared/Charts/BarChart/ChartLegendV2.es.js +20 -24
- package/dist/insights/components/shared/Charts/BarChart/ChartLegendV2.es.js.map +1 -1
- package/dist/insights/types/Charts/BarChart.d.ts +1 -0
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +25 -24
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.d.ts +1 -0
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.es.js +7 -4
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.d.ts +1 -0
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +29 -21
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +13 -13
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/chartblocks/BarchartV2.d.ts +1 -1
- package/dist/insights-v2/components/chartblocks/BarchartV2.es.js +24 -24
- package/dist/insights-v2/components/chartblocks/BarchartV2.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [9.7.97] - 11-03-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - HSA Deposit beat on Insights 2.0: the `with_header_footer` transaction card whose CTA opens Transaction Details for one deposit and the Transaction List for several (WEC-2214)
|
|
4
|
+
- **FIXED** - `BaseLayout` no longer throws on a `null` primary or secondary CTA (WEC-2214)
|
|
5
|
+
|
|
6
|
+
## [9.7.96] - 11-03-2026
|
|
7
|
+
|
|
8
|
+
- **FIXED** - Monthly Spend legend drops amount (MEW2-3428)
|
|
9
|
+
|
|
1
10
|
## [9.7.95] - 11-03-2026
|
|
2
11
|
|
|
3
12
|
- **FIXED** - 20px Transaction Details category icon (MEW2-3427)
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Text as
|
|
3
|
-
import { jsx as
|
|
4
|
-
import { useTheme as
|
|
5
|
-
var
|
|
6
|
-
const
|
|
7
|
-
return /* @__PURE__ */
|
|
1
|
+
import t from "@mui/material/Stack";
|
|
2
|
+
import { Text as h } from "@mxenabled/mxui";
|
|
3
|
+
import { jsx as e, jsxs as r } from "react/jsx-runtime";
|
|
4
|
+
import { useTheme as o } from "@mui/material/styles";
|
|
5
|
+
var w = ({ color: n, legendStyle: c = {}, monthlyAmount: a, monthlyAmountLabel: i, trendAmount: d, trendAmountLabel: l }) => {
|
|
6
|
+
const g = o();
|
|
7
|
+
return /* @__PURE__ */ r(t, {
|
|
8
8
|
sx: {
|
|
9
9
|
alignItems: "center",
|
|
10
10
|
flexDirection: "row",
|
|
@@ -12,60 +12,56 @@ var m = ({ color: n, legendStyle: h = {}, monthlyAmount: c, monthlyAmountLabel:
|
|
|
12
12
|
justifyContent: "flex-start",
|
|
13
13
|
py: 4,
|
|
14
14
|
width: "100%",
|
|
15
|
-
...
|
|
15
|
+
...c
|
|
16
16
|
},
|
|
17
|
-
children: [
|
|
17
|
+
children: [i && /* @__PURE__ */ r(t, {
|
|
18
18
|
sx: {
|
|
19
19
|
alignItems: "center",
|
|
20
20
|
flexDirection: "row",
|
|
21
21
|
gap: 8
|
|
22
22
|
},
|
|
23
|
-
children: [/* @__PURE__ */
|
|
23
|
+
children: [/* @__PURE__ */ e("svg", {
|
|
24
24
|
"aria-hidden": "true",
|
|
25
25
|
"aria-labelledby": "chartLegendLabel",
|
|
26
26
|
fill: "none",
|
|
27
27
|
height: "12",
|
|
28
28
|
role: "figure",
|
|
29
29
|
width: "12",
|
|
30
|
-
children: /* @__PURE__ */
|
|
30
|
+
children: /* @__PURE__ */ e("rect", {
|
|
31
31
|
fill: n,
|
|
32
32
|
height: "12",
|
|
33
33
|
rx: "2",
|
|
34
34
|
width: "12"
|
|
35
35
|
})
|
|
36
|
-
}), /* @__PURE__ */ e(
|
|
36
|
+
}), /* @__PURE__ */ e(h, {
|
|
37
37
|
id: "chartLegendLabel",
|
|
38
38
|
variant: "caption",
|
|
39
|
-
children:
|
|
40
|
-
t,
|
|
41
|
-
": ",
|
|
42
|
-
c
|
|
43
|
-
]
|
|
39
|
+
children: a ? `${i}: ${a}` : i
|
|
44
40
|
})]
|
|
45
|
-
}),
|
|
41
|
+
}), l && /* @__PURE__ */ r(t, {
|
|
46
42
|
sx: {
|
|
47
43
|
alignItems: "center",
|
|
48
44
|
flexDirection: "row",
|
|
49
45
|
gap: 8
|
|
50
46
|
},
|
|
51
|
-
children: [/* @__PURE__ */
|
|
47
|
+
children: [/* @__PURE__ */ e("svg", {
|
|
52
48
|
"aria-hidden": "true",
|
|
53
49
|
"aria-labelledby": "chartLegendLabel",
|
|
54
50
|
fill: "none",
|
|
55
51
|
height: "12",
|
|
56
52
|
role: "figure",
|
|
57
53
|
width: "12",
|
|
58
|
-
children: /* @__PURE__ */
|
|
59
|
-
fill:
|
|
54
|
+
children: /* @__PURE__ */ e("rect", {
|
|
55
|
+
fill: g.palette.chart.chart7,
|
|
60
56
|
height: "12",
|
|
61
57
|
rx: "2",
|
|
62
58
|
width: "12"
|
|
63
59
|
})
|
|
64
|
-
}), /* @__PURE__ */
|
|
60
|
+
}), /* @__PURE__ */ r(h, {
|
|
65
61
|
id: "chartLegendLabel",
|
|
66
62
|
variant: "caption",
|
|
67
63
|
children: [
|
|
68
|
-
|
|
64
|
+
l,
|
|
69
65
|
": ",
|
|
70
66
|
d
|
|
71
67
|
]
|
|
@@ -74,7 +70,7 @@ var m = ({ color: n, legendStyle: h = {}, monthlyAmount: c, monthlyAmountLabel:
|
|
|
74
70
|
});
|
|
75
71
|
};
|
|
76
72
|
export {
|
|
77
|
-
|
|
73
|
+
w as LegendV2
|
|
78
74
|
};
|
|
79
75
|
|
|
80
76
|
//# sourceMappingURL=ChartLegendV2.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ChartLegendV2.es.js","names":[],"sources":["../../../../../../src/insights/components/shared/Charts/BarChart/ChartLegendV2.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\nimport { type SxProps } from '@mui/material/styles'\n\nexport interface LegendV2Props {\n color: string\n legendStyle?: SxProps\n monthlyAmount?: string\n monthlyAmountLabel?: string\n trendAmount?: string\n trendAmountLabel?: string\n}\n\nexport const LegendV2 = ({\n color,\n legendStyle = {},\n monthlyAmount,\n monthlyAmountLabel,\n trendAmount,\n trendAmountLabel,\n}: LegendV2Props) => {\n const theme = useTheme()\n\n return (\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 24,\n justifyContent: 'flex-start',\n py: 4,\n width: '100%',\n ...legendStyle,\n }}\n >\n {monthlyAmountLabel && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <svg\n aria-hidden=\"true\"\n aria-labelledby=\"chartLegendLabel\"\n fill=\"none\"\n height=\"12\"\n role=\"figure\"\n width=\"12\"\n >\n <rect fill={color} height=\"12\" rx=\"2\" width=\"12\" />\n </svg>\n <Text id=\"chartLegendLabel\" variant=\"caption\">\n {monthlyAmountLabel}: {monthlyAmount}\n </Text>\n </Stack>\n )}\n\n {trendAmountLabel && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <svg\n aria-hidden=\"true\"\n aria-labelledby=\"chartLegendLabel\"\n fill=\"none\"\n height=\"12\"\n role=\"figure\"\n width=\"12\"\n >\n <rect fill={theme.palette.chart.chart7} height=\"12\" rx=\"2\" width=\"12\" />\n </svg>\n <Text id=\"chartLegendLabel\" variant=\"caption\">\n {trendAmountLabel}: {trendAmount}\n </Text>\n </Stack>\n )}\n </Stack>\n )\n}\n"],"mappings":";;;;AAeA,IAAa,IAAA,CAAY,EACvB,OAAA,GACA,aAAA,IAAc,CAAC,GACf,eAAA,GACA,oBAAA,GACA,aAAA,GACA,kBAAA,EAAA,MACmB;AACnB,QAAM,IAAQ,EAAS;AAEvB,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,KAAK;AAAA,MACL,gBAAgB;AAAA,MAChB,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,GAAG;AAAA,IACL;AAAA,IATF,UAAA,CAWG,KACC,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,YAAY;AAAA,QAAU,eAAe;AAAA,QAAO,KAAK;AAAA,MAAE;AAAA,MAAhE,UAAA,CACE,gBAAA,EAAC,OAAD;AAAA,QACE,eAAY;AAAA,QACZ,mBAAgB;AAAA,QAChB,MAAK;AAAA,QACL,QAAO;AAAA,QACP,MAAK;AAAA,QACL,OAAM;AAAA,QAEN,UAAA,gBAAA,EAAC,QAAD;AAAA,UAAM,MAAM;AAAA,UAAO,QAAO;AAAA,UAAK,IAAG;AAAA,UAAI,OAAM;AAAA,QAAM,CAAA;AAAA,MAC/C,CAAA,GACL,gBAAA,EAAC,GAAD;AAAA,QAAM,IAAG;AAAA,QAAmB,SAAQ;AAAA,
|
|
1
|
+
{"version":3,"file":"ChartLegendV2.es.js","names":[],"sources":["../../../../../../src/insights/components/shared/Charts/BarChart/ChartLegendV2.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\nimport { type SxProps } from '@mui/material/styles'\n\nexport interface LegendV2Props {\n color: string\n legendStyle?: SxProps\n monthlyAmount?: string\n monthlyAmountLabel?: string\n trendAmount?: string\n trendAmountLabel?: string\n}\n\nexport const LegendV2 = ({\n color,\n legendStyle = {},\n monthlyAmount,\n monthlyAmountLabel,\n trendAmount,\n trendAmountLabel,\n}: LegendV2Props) => {\n const theme = useTheme()\n\n return (\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 24,\n justifyContent: 'flex-start',\n py: 4,\n width: '100%',\n ...legendStyle,\n }}\n >\n {monthlyAmountLabel && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <svg\n aria-hidden=\"true\"\n aria-labelledby=\"chartLegendLabel\"\n fill=\"none\"\n height=\"12\"\n role=\"figure\"\n width=\"12\"\n >\n <rect fill={color} height=\"12\" rx=\"2\" width=\"12\" />\n </svg>\n <Text id=\"chartLegendLabel\" variant=\"caption\">\n {monthlyAmount ? `${monthlyAmountLabel}: ${monthlyAmount}` : monthlyAmountLabel}\n </Text>\n </Stack>\n )}\n\n {trendAmountLabel && (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n <svg\n aria-hidden=\"true\"\n aria-labelledby=\"chartLegendLabel\"\n fill=\"none\"\n height=\"12\"\n role=\"figure\"\n width=\"12\"\n >\n <rect fill={theme.palette.chart.chart7} height=\"12\" rx=\"2\" width=\"12\" />\n </svg>\n <Text id=\"chartLegendLabel\" variant=\"caption\">\n {trendAmountLabel}: {trendAmount}\n </Text>\n </Stack>\n )}\n </Stack>\n )\n}\n"],"mappings":";;;;AAeA,IAAa,IAAA,CAAY,EACvB,OAAA,GACA,aAAA,IAAc,CAAC,GACf,eAAA,GACA,oBAAA,GACA,aAAA,GACA,kBAAA,EAAA,MACmB;AACnB,QAAM,IAAQ,EAAS;AAEvB,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,KAAK;AAAA,MACL,gBAAgB;AAAA,MAChB,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,GAAG;AAAA,IACL;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
|
|
|
1
|
-
import { useGlobalUiStore as
|
|
2
|
-
import { formatCurrency as
|
|
3
|
-
import
|
|
4
|
-
import { BAR_ARIA_LABEL as
|
|
5
|
-
import { BarChartV2 as
|
|
6
|
-
import { EmptyBarChart as
|
|
7
|
-
import { ANALYTICS_EVENTS_CONFIG as
|
|
8
|
-
import { useAnalyticsEvent as
|
|
9
|
-
import { actionBlocksKey as
|
|
10
|
-
import
|
|
11
|
-
import { observer as
|
|
1
|
+
import { useGlobalUiStore as b, useInsightsV2Store as B } from "../../../../common/context/hooks.es.js";
|
|
2
|
+
import { formatCurrency as y } from "../../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import I from "../../../../common/components/Loader.es.js";
|
|
4
|
+
import { BAR_ARIA_LABEL as L, barChartVariant as T, buildChartData as S, buildDataSeries as v } from "./utils.es.js";
|
|
5
|
+
import { BarChartV2 as E } from "../../../components/chartblocks/BarchartV2.es.js";
|
|
6
|
+
import { EmptyBarChart as R } from "../../../components/chartblocks/EmptyBarChart.es.js";
|
|
7
|
+
import { ANALYTICS_EVENTS_CONFIG as N } from "../../../analytics/analyticsEventsConfig.es.js";
|
|
8
|
+
import { useAnalyticsEvent as x } from "../../../analytics/useAnalyticsEvent.es.js";
|
|
9
|
+
import { actionBlocksKey as D } from "../../../mappings/actionBlocksKey.es.js";
|
|
10
|
+
import O from "react";
|
|
11
|
+
import { observer as k } from "mobx-react-lite";
|
|
12
12
|
import { jsx as r } from "react/jsx-runtime";
|
|
13
|
-
import { useTheme as
|
|
14
|
-
var
|
|
15
|
-
const m =
|
|
16
|
-
return s ? t.length ? /* @__PURE__ */ r(
|
|
13
|
+
import { useTheme as V } from "@mui/material/styles";
|
|
14
|
+
var Q = k(({ payload: a, beatGuid: n = "" }) => {
|
|
15
|
+
const m = V(), { openActionDrawer: i } = B(), { isCopyLoaded: s } = b(), { instance_slot: o, widget_type: c } = a, { series: l, category_guid: f, average_amount: e = 0, additional_data: u = [] } = o.data ?? {}, [d, p] = u, t = S(v(l), L), [A] = O.useState(t.length - 1), { color: h, showMonthlyAmount: C } = T(o, f, m), g = x();
|
|
16
|
+
return s ? t.length ? /* @__PURE__ */ r(E, {
|
|
17
17
|
amounts: {
|
|
18
18
|
average: e,
|
|
19
|
-
formattedAverage:
|
|
19
|
+
formattedAverage: y(e, "0,0")
|
|
20
20
|
},
|
|
21
21
|
color: h,
|
|
22
22
|
data: t,
|
|
23
|
-
monthlyAmountLabel:
|
|
23
|
+
monthlyAmountLabel: d?.label ?? "",
|
|
24
24
|
margin: {
|
|
25
25
|
bottom: 8,
|
|
26
26
|
left: 16,
|
|
27
27
|
right: 16,
|
|
28
28
|
top: 24
|
|
29
29
|
},
|
|
30
|
-
onBarClick: (
|
|
30
|
+
onBarClick: (_) => {
|
|
31
31
|
if (c !== "full") return !1;
|
|
32
|
-
|
|
32
|
+
g(N.CHART_BAR_CLICKED), i({
|
|
33
33
|
guid: n,
|
|
34
34
|
trigger: "chartBar",
|
|
35
35
|
context: {
|
|
36
|
-
chartBarIndex:
|
|
37
|
-
block:
|
|
36
|
+
chartBarIndex: _,
|
|
37
|
+
block: D.TRANSCATION_HISTORY_ACTION_BLOCK
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
},
|
|
41
41
|
selectedTabIndex: A,
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
showMonthlyAmount: C,
|
|
43
|
+
trendAmountLabel: p?.label ?? ""
|
|
44
|
+
}) : /* @__PURE__ */ r(R, {}) : /* @__PURE__ */ r(I, {});
|
|
44
45
|
});
|
|
45
46
|
export {
|
|
46
|
-
|
|
47
|
+
Q as BarchartBlock
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
//# sourceMappingURL=BarchartBlock.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarchartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport { formatCurrency, Loader, useGlobalUiStore, useInsightsV2Store } from '../../../../common'\nimport type { DrilldownPayload, InsightsPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { BarChartV2 } from '../../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../../components/chartblocks/EmptyBarChart'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../../analytics'\n\nimport { BAR_ARIA_LABEL, barChartVariant, buildChartData, buildDataSeries } from './utils'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\ninterface BarchartBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nexport const BarchartBlock = observer(({ payload, beatGuid = '' }: BarchartBlockProps) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const { isCopyLoaded } = useGlobalUiStore()\n const { instance_slot, widget_type } = payload\n const {\n series,\n category_guid,\n average_amount = 0,\n additional_data = [],\n } = (instance_slot.data ?? {}) as BarChartBlockData\n const [monthlyAmount, trend] = additional_data\n const chartData = buildChartData(buildDataSeries(series), BAR_ARIA_LABEL)\n const [selectedTabIndex] = React.useState(chartData.length - 1)\n const { color } = barChartVariant(instance_slot, category_guid, theme)\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n return chartData.length ? (\n <BarChartV2\n amounts={{\n average: average_amount,\n formattedAverage: formatCurrency(average_amount, '0,0'),\n }}\n color={color}\n data={chartData}\n monthlyAmountLabel={monthlyAmount?.label ?? ''}\n margin={{\n bottom: 8,\n left: 16,\n right: 16,\n // Room for the tallest bar's value label, drawn 8px above the bar and about 14px tall.\n top: 24,\n }}\n onBarClick={(index) => {\n if (widget_type !== 'full') return false\n\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.CHART_BAR_CLICKED)\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: index,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n selectedTabIndex={selectedTabIndex}\n trendAmountLabel={trend?.label ?? ''}\n />\n ) : (\n <EmptyBarChart />\n )\n})\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAa,IAAgB,EAAA,CAAU,EAAE,SAAA,GAAS,UAAA,IAAW,GAAA,MAA6B;AACxF,QAAM,IAAQ,EAAS,GACjB,EAAE,kBAAA,EAAA,IAAqB,EAAmB,GAC1C,EAAE,cAAA,EAAA,IAAiB,EAAiB,GACpC,EAAE,eAAA,GAAe,aAAA,EAAA,IAAgB,GACjC,EACJ,QAAA,GACA,eAAA,GACA,gBAAA,IAAiB,GACjB,iBAAA,IAAkB,CAAC,EAAA,IAChB,EAAc,QAAQ,CAAC,GACtB,CAAC,GAAe,CAAA,IAAS,GACzB,IAAY,EAAe,EAAgB,CAAM,GAAG,CAAc,GAClE,CAAC,CAAA,IAAoB,EAAM,SAAS,EAAU,SAAS,CAAC,GACxD,EAAE,OAAA,EAAA,
|
|
1
|
+
{"version":3,"file":"BarchartBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.tsx"],"sourcesContent":["import React from 'react'\nimport { useTheme } from '@mui/material/styles'\nimport { observer } from 'mobx-react-lite'\n\nimport { formatCurrency, Loader, useGlobalUiStore, useInsightsV2Store } from '../../../../common'\nimport type { DrilldownPayload, InsightsPayload } from '../../../../core'\nimport type { BarChartBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport { BarChartV2 } from '../../../components/chartblocks/BarchartV2'\nimport { EmptyBarChart } from '../../../components/chartblocks/EmptyBarChart'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../../../analytics'\n\nimport { BAR_ARIA_LABEL, barChartVariant, buildChartData, buildDataSeries } from './utils'\nimport { actionBlocksKey } from '../../../mappings/actionBlocksKey'\n\ninterface BarchartBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nexport const BarchartBlock = observer(({ payload, beatGuid = '' }: BarchartBlockProps) => {\n const theme = useTheme()\n const { openActionDrawer } = useInsightsV2Store()\n const { isCopyLoaded } = useGlobalUiStore()\n const { instance_slot, widget_type } = payload\n const {\n series,\n category_guid,\n average_amount = 0,\n additional_data = [],\n } = (instance_slot.data ?? {}) as BarChartBlockData\n const [monthlyAmount, trend] = additional_data\n const chartData = buildChartData(buildDataSeries(series), BAR_ARIA_LABEL)\n const [selectedTabIndex] = React.useState(chartData.length - 1)\n const { color, showMonthlyAmount } = barChartVariant(instance_slot, category_guid, theme)\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!isCopyLoaded) {\n return <Loader />\n }\n\n return chartData.length ? (\n <BarChartV2\n amounts={{\n average: average_amount,\n formattedAverage: formatCurrency(average_amount, '0,0'),\n }}\n color={color}\n data={chartData}\n monthlyAmountLabel={monthlyAmount?.label ?? ''}\n margin={{\n bottom: 8,\n left: 16,\n right: 16,\n // Room for the tallest bar's value label, drawn 8px above the bar and about 14px tall.\n top: 24,\n }}\n onBarClick={(index) => {\n if (widget_type !== 'full') return false\n\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.CHART_BAR_CLICKED)\n\n openActionDrawer({\n guid: beatGuid,\n trigger: 'chartBar',\n context: {\n chartBarIndex: index,\n block: actionBlocksKey.TRANSCATION_HISTORY_ACTION_BLOCK,\n } satisfies DrilldownPayload,\n })\n }}\n selectedTabIndex={selectedTabIndex}\n showMonthlyAmount={showMonthlyAmount}\n trendAmountLabel={trend?.label ?? ''}\n />\n ) : (\n <EmptyBarChart />\n )\n})\n"],"mappings":";;;;;;;;;;;;;AAqBA,IAAa,IAAgB,EAAA,CAAU,EAAE,SAAA,GAAS,UAAA,IAAW,GAAA,MAA6B;AACxF,QAAM,IAAQ,EAAS,GACjB,EAAE,kBAAA,EAAA,IAAqB,EAAm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|
+
var t = (o) => ({
|
|
2
|
+
account_balance: { color: o.palette.success.main },
|
|
3
|
+
monthly_spend_comparison: {
|
|
4
|
+
color: o.palette.chart.chart2,
|
|
5
|
+
showMonthlyAmount: !1
|
|
6
|
+
}
|
|
4
7
|
});
|
|
5
8
|
export {
|
|
6
|
-
|
|
9
|
+
t as getLayoutConfig
|
|
7
10
|
};
|
|
8
11
|
|
|
9
12
|
//# sourceMappingURL=layout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.ts"],"sourcesContent":["import { type Theme } from '@mui/material/styles'\nexport const getLayoutConfig = (theme: Theme) => {\n return {\n account_balance: {\n color: theme.palette.success.main,\n },\n monthly_spend_comparison: {\n color: theme.palette.chart.chart2,\n },\n }\n}\n"],"mappings":"AACA,IAAa,IAAA,CAAmB,OACvB;AAAA,EACL,iBAAiB,EACf,OAAO,EAAM,QAAQ,QAAQ,KAC/B;AAAA,EACA,0BAA0B,
|
|
1
|
+
{"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.ts"],"sourcesContent":["import { type Theme } from '@mui/material/styles'\nexport const getLayoutConfig = (theme: Theme) => {\n return {\n account_balance: {\n color: theme.palette.success.main,\n },\n monthly_spend_comparison: {\n color: theme.palette.chart.chart2,\n // Figma labels the selected bar's legend without its amount.\n showMonthlyAmount: false,\n },\n }\n}\n"],"mappings":"AACA,IAAa,IAAA,CAAmB,OACvB;AAAA,EACL,iBAAiB,EACf,OAAO,EAAM,QAAQ,QAAQ,KAC/B;AAAA,EACA,0BAA0B;AAAA,IACxB,OAAO,EAAM,QAAQ,MAAM;AAAA,IAE3B,mBAAmB;AAAA,EACrB;AACF"}
|
|
@@ -1,37 +1,45 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { DATE_FORMATS_INTL as
|
|
1
|
+
import { buildDynamicCopy as u } from "../../../../core/utils/Localization.es.js";
|
|
2
|
+
import { DATE_FORMATS_INTL as i, formatDate as l } from "../../../../core/constants/DateFormats.es.js";
|
|
3
3
|
import { formatCurrency as m } from "../../../../core/utils/NumberFormatting.es.js";
|
|
4
4
|
import { getCategoryColor as A } from "../../../../core/utils/CategoryUtil.es.js";
|
|
5
|
-
import { getLayoutConfig as
|
|
6
|
-
import { parseISO as
|
|
7
|
-
var
|
|
5
|
+
import { getLayoutConfig as _ } from "./layout.es.js";
|
|
6
|
+
import { parseISO as C } from "date-fns/parseISO";
|
|
7
|
+
var c = {
|
|
8
8
|
CATEGORY_COLOR: "category_color",
|
|
9
9
|
ACCOUNT_BALANCE: "account_balance",
|
|
10
10
|
MONTHLY_SPEND_COMPARISON: "monthly_spend_comparison"
|
|
11
|
-
},
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
}),
|
|
16
|
-
}) : [] : [],
|
|
17
|
-
const t = r.date ?
|
|
11
|
+
}, R = "_1{month}: _2{amount}", d = (o) => o ? o.data ? o.data.map((e) => {
|
|
12
|
+
const a = {};
|
|
13
|
+
return o.names?.map((r, t) => {
|
|
14
|
+
a[r] = e[t];
|
|
15
|
+
}), a;
|
|
16
|
+
}) : [] : [], L = (o, e, a = i.MONTH_SHORT) => [...o].sort((r, t) => !r.date || !t.date ? 0 : new Date(r.date).getTime() - new Date(t.date).getTime()).map((r) => {
|
|
17
|
+
const t = r.date ? l(C(r.date), a) : r.label ?? "", n = r.amount ?? 0;
|
|
18
18
|
return {
|
|
19
|
-
ariaLabel:
|
|
19
|
+
ariaLabel: u(e, t, m(n, "0.00")),
|
|
20
20
|
date: r.date ?? null,
|
|
21
21
|
label: t,
|
|
22
22
|
value: n,
|
|
23
23
|
formattedAmount: m(n, "0,0")
|
|
24
24
|
};
|
|
25
|
-
}),
|
|
26
|
-
const { variant: r } =
|
|
27
|
-
|
|
25
|
+
}), h = (o, e, a) => {
|
|
26
|
+
const { variant: r } = o, t = _(a);
|
|
27
|
+
if (r === c.CATEGORY_COLOR && e) return {
|
|
28
|
+
color: A(e, a),
|
|
29
|
+
showMonthlyAmount: !0
|
|
30
|
+
};
|
|
31
|
+
const n = t[r];
|
|
32
|
+
return {
|
|
33
|
+
color: n?.color ?? a.palette.primary.main,
|
|
34
|
+
showMonthlyAmount: n?.showMonthlyAmount ?? !0
|
|
35
|
+
};
|
|
28
36
|
};
|
|
29
37
|
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
38
|
+
R as BAR_ARIA_LABEL,
|
|
39
|
+
c as BAR_CHART_VARIANTS,
|
|
40
|
+
h as barChartVariant,
|
|
41
|
+
L as buildChartData,
|
|
42
|
+
d as buildDataSeries
|
|
35
43
|
};
|
|
36
44
|
|
|
37
45
|
//# sourceMappingURL=utils.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.ts"],"sourcesContent":["import { type Theme } from '@mui/material/styles'\n\nimport { parseISO } from 'date-fns/parseISO'\n\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DataSeries, InstanceSlot } from '../../../../core'\nimport { getLayoutConfig } from './layout'\n\nexport const BAR_CHART_VARIANTS = {\n CATEGORY_COLOR: 'category_color',\n ACCOUNT_BALANCE: 'account_balance',\n MONTHLY_SPEND_COMPARISON: 'monthly_spend_comparison',\n}\n\nexport interface ChartDataSeriesItem {\n date?: string\n amount?: number\n guid?: string\n label?: string\n aggregated_guids?: string[]\n localized_label?: string\n category_guid?: string\n}\n\n/** Per-bar aria label, built in the frontend: \"{month}: {amount}\" (buildDynamicCopy placeholders). */\nexport const BAR_ARIA_LABEL = '_1{month}: _2{amount}'\n\nexport const buildDataSeries = (data: DataSeries | undefined): ChartDataSeriesItem[] => {\n if (!data) {\n return []\n }\n\n if (data.data) {\n return data.data.map((d) => {\n const item: any = {}\n\n data.names?.map((name, index) => {\n item[name] = d[index]\n })\n return item\n })\n } else {\n return []\n }\n}\n\nexport const buildChartData = (\n dataSeries: ChartDataSeriesItem[],\n ariaLabel: string,\n dateFormat: Parameters<typeof formatDate>[1] = DATE_FORMATS_INTL.MONTH_SHORT,\n) => {\n const data = [...dataSeries]\n .sort((a, b) => {\n if (!a.date || !b.date) return 0\n\n return new Date(a.date).getTime() - new Date(b.date).getTime()\n })\n .map((total) => {\n const label = total.date ? formatDate(parseISO(total.date), dateFormat) : (total.label ?? '')\n const amount = total.amount ?? 0\n\n return {\n ariaLabel: buildDynamicCopy(ariaLabel, label, formatCurrency(amount, '0.00')) as string,\n date: total.date ?? null,\n label,\n value: amount,\n formattedAmount: formatCurrency(amount, '0,0'),\n }\n })\n\n return data\n}\n\nexport const barChartVariant = (\n instanceSlot: InstanceSlot,\n categoryGuid: string | undefined,\n theme: Theme,\n) => {\n const { variant } = instanceSlot\n const barChartLayout = getLayoutConfig(theme)\n if (variant === BAR_CHART_VARIANTS.CATEGORY_COLOR && categoryGuid) {\n return { color: getCategoryColor(categoryGuid, theme) }\n }\n
|
|
1
|
+
{"version":3,"file":"utils.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.ts"],"sourcesContent":["import { type Theme } from '@mui/material/styles'\n\nimport { parseISO } from 'date-fns/parseISO'\n\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\nimport { DATE_FORMATS_INTL, formatDate } from '../../../../core/constants'\nimport type { DataSeries, InstanceSlot } from '../../../../core'\nimport { getLayoutConfig } from './layout'\n\nexport const BAR_CHART_VARIANTS = {\n CATEGORY_COLOR: 'category_color',\n ACCOUNT_BALANCE: 'account_balance',\n MONTHLY_SPEND_COMPARISON: 'monthly_spend_comparison',\n}\n\nexport interface ChartDataSeriesItem {\n date?: string\n amount?: number\n guid?: string\n label?: string\n aggregated_guids?: string[]\n localized_label?: string\n category_guid?: string\n}\n\n/** Per-bar aria label, built in the frontend: \"{month}: {amount}\" (buildDynamicCopy placeholders). */\nexport const BAR_ARIA_LABEL = '_1{month}: _2{amount}'\n\nexport const buildDataSeries = (data: DataSeries | undefined): ChartDataSeriesItem[] => {\n if (!data) {\n return []\n }\n\n if (data.data) {\n return data.data.map((d) => {\n const item: any = {}\n\n data.names?.map((name, index) => {\n item[name] = d[index]\n })\n return item\n })\n } else {\n return []\n }\n}\n\nexport const buildChartData = (\n dataSeries: ChartDataSeriesItem[],\n ariaLabel: string,\n dateFormat: Parameters<typeof formatDate>[1] = DATE_FORMATS_INTL.MONTH_SHORT,\n) => {\n const data = [...dataSeries]\n .sort((a, b) => {\n if (!a.date || !b.date) return 0\n\n return new Date(a.date).getTime() - new Date(b.date).getTime()\n })\n .map((total) => {\n const label = total.date ? formatDate(parseISO(total.date), dateFormat) : (total.label ?? '')\n const amount = total.amount ?? 0\n\n return {\n ariaLabel: buildDynamicCopy(ariaLabel, label, formatCurrency(amount, '0.00')) as string,\n date: total.date ?? null,\n label,\n value: amount,\n formattedAmount: formatCurrency(amount, '0,0'),\n }\n })\n\n return data\n}\n\nexport const barChartVariant = (\n instanceSlot: InstanceSlot,\n categoryGuid: string | undefined,\n theme: Theme,\n) => {\n const { variant } = instanceSlot\n const barChartLayout = getLayoutConfig(theme)\n if (variant === BAR_CHART_VARIANTS.CATEGORY_COLOR && categoryGuid) {\n return { color: getCategoryColor(categoryGuid, theme), showMonthlyAmount: true }\n }\n const layout: { color?: string; showMonthlyAmount?: boolean } | undefined =\n barChartLayout[variant as keyof typeof barChartLayout]\n return {\n color: layout?.color ?? theme.palette.primary.main,\n showMonthlyAmount: layout?.showMonthlyAm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AAM,QAAQ,QAAQ;AAAA,IAC9C,mBAAmB,GAAQ,qBAAqB;AAAA,EAClD;AACF"}
|
|
@@ -14,15 +14,15 @@ import { blocks as bo } from "../mappings/blocks.es.js";
|
|
|
14
14
|
import { ActionBlockLayer as _o } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
15
15
|
import ko from "./Footer.es.js";
|
|
16
16
|
import yo from "./Header.es.js";
|
|
17
|
-
import { FeedbackBar as
|
|
18
|
-
import { DismissInsightDialog as
|
|
17
|
+
import { FeedbackBar as vo } from "./FeedbackBar.es.js";
|
|
18
|
+
import { DismissInsightDialog as xo } from "./DismissInsightDialog.es.js";
|
|
19
19
|
import { HiddenConfirmationCard as So } from "./HiddenConfirmationCard.es.js";
|
|
20
20
|
import { LoadingCard as To } from "./LoadingCard.es.js";
|
|
21
21
|
import { ObsolesceBanner as Lo } from "./ObsolesceBanner.es.js";
|
|
22
22
|
import { useBeatFeedbackFlow as wo } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
23
23
|
import { useMemo as Ao } from "react";
|
|
24
24
|
import { observer as Bo } from "mobx-react-lite";
|
|
25
|
-
import
|
|
25
|
+
import x from "@mui/material/Stack";
|
|
26
26
|
import { P as Do } from "@mxenabled/mxui";
|
|
27
27
|
import f from "@mui/material/Button";
|
|
28
28
|
import { ChevronRight as I } from "@mxenabled/mx-icons";
|
|
@@ -66,7 +66,7 @@ var Eo = {}, Ho = {
|
|
|
66
66
|
py: 12,
|
|
67
67
|
"&.Mui-disabled": { color: "text.disabled" }
|
|
68
68
|
}, Ci = Bo(({ beat: t, beatActions: l = Eo, obsolete: g, isLoading: F = !1, isError: E = !1 }) => {
|
|
69
|
-
const H = eo(), P = ro(), { config: M } = to(), o = wo(t, l), b = no(), { runCta: N, primary: _, secondary: T, linkPresentation: R } = uo(t, l, t.insights_payload?.primary_cta, t.insights_payload?.secondary_cta, t.insights_payload?.in_description_cta), c = t.insights_payload?.widget_type === "mini", W = Ao(() => ({
|
|
69
|
+
const H = eo(), P = ro(), { config: M } = to(), o = wo(t, l), b = no(), { runCta: N, primary: _, secondary: T, linkPresentation: R } = uo(t, l, t.insights_payload?.primary_cta ?? void 0, t.insights_payload?.secondary_cta ?? void 0, t.insights_payload?.in_description_cta ?? void 0), c = t.insights_payload?.widget_type === "mini", W = Ao(() => ({
|
|
70
70
|
...o.wrappedActions,
|
|
71
71
|
beat: t
|
|
72
72
|
}), [o.wrappedActions, t]);
|
|
@@ -106,10 +106,10 @@ var Eo = {}, Ho = {
|
|
|
106
106
|
template: t.template,
|
|
107
107
|
handler: "cardClick"
|
|
108
108
|
})));
|
|
109
|
-
}, y = H.insights_feed?.general,
|
|
109
|
+
}, y = H.insights_feed?.general, v = g?.state === "not_refreshable" && !V && !!y;
|
|
110
110
|
return /* @__PURE__ */ i(ao, {
|
|
111
111
|
value: W,
|
|
112
|
-
children: /* @__PURE__ */ C(
|
|
112
|
+
children: /* @__PURE__ */ C(x, {
|
|
113
113
|
sx: { mb: 16 },
|
|
114
114
|
children: [
|
|
115
115
|
o.cardState === "confirming" ? /* @__PURE__ */ i(So, {
|
|
@@ -120,14 +120,14 @@ var Eo = {}, Ho = {
|
|
|
120
120
|
...g,
|
|
121
121
|
copy: y
|
|
122
122
|
}), /* @__PURE__ */ C(Fo, {
|
|
123
|
-
inert:
|
|
124
|
-
sx: { ...
|
|
123
|
+
inert: v,
|
|
124
|
+
sx: { ...v && {
|
|
125
125
|
position: "relative",
|
|
126
126
|
zIndex: 2,
|
|
127
127
|
pointerEvents: "none"
|
|
128
128
|
} },
|
|
129
129
|
children: [
|
|
130
|
-
|
|
130
|
+
v && /* @__PURE__ */ i(Io, { sx: Ho }),
|
|
131
131
|
/* @__PURE__ */ i(yo, {
|
|
132
132
|
isMini: c,
|
|
133
133
|
subtitle: K,
|
|
@@ -137,7 +137,7 @@ var Eo = {}, Ho = {
|
|
|
137
137
|
beatGuid: L,
|
|
138
138
|
payload: e
|
|
139
139
|
}),
|
|
140
|
-
/* @__PURE__ */ C(
|
|
140
|
+
/* @__PURE__ */ C(x, {
|
|
141
141
|
sx: {
|
|
142
142
|
gap: 6,
|
|
143
143
|
pb: 16,
|
|
@@ -173,7 +173,7 @@ var Eo = {}, Ho = {
|
|
|
173
173
|
})
|
|
174
174
|
]
|
|
175
175
|
}),
|
|
176
|
-
Z && /* @__PURE__ */ C(
|
|
176
|
+
Z && /* @__PURE__ */ C(x, {
|
|
177
177
|
sx: {
|
|
178
178
|
gap: 8,
|
|
179
179
|
pb: 16,
|
|
@@ -208,14 +208,14 @@ var Eo = {}, Ho = {
|
|
|
208
208
|
})
|
|
209
209
|
]
|
|
210
210
|
}),
|
|
211
|
-
/* @__PURE__ */ i(
|
|
211
|
+
/* @__PURE__ */ i(vo, {
|
|
212
212
|
onTellUsMore: o.openRatingSurvey,
|
|
213
213
|
show: o.isFeedbackBarShown
|
|
214
214
|
})
|
|
215
215
|
]
|
|
216
216
|
})] }),
|
|
217
217
|
/* @__PURE__ */ i(_o, { beat: t }),
|
|
218
|
-
/* @__PURE__ */ i(
|
|
218
|
+
/* @__PURE__ */ i(xo, {
|
|
219
219
|
isOpen: o.isDismissOpen,
|
|
220
220
|
onClose: o.closeDismissDialog,
|
|
221
221
|
onDismiss: o.confirmDismiss
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { type MouseEvent, 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 { HOST_ACTIONS, 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// Figma's 24px text link: 13/16 semibold, 16px line plus 4px above and below, its text starting at the\n// card's 16px inset. A minimum height, not the theme's fixed 44px Button height, so a long or translated\n// label wraps instead of overflowing; MUI's 64px minimum width and centring are undone for the same inset.\n// The in-description links use it as is, with the Button's 20px chevron, so they are 28px tall, as in\n// Figma's Low Account Balance full card (node 438:27877); the 24px is the mini CTA's, which has no icon.\nconst TEXT_LINK_SX = {\n alignSelf: 'flex-start',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n justifyContent: 'flex-start',\n lineHeight: '16px',\n minHeight: 24,\n minWidth: 0,\n px: 0,\n py: 4,\n textAlign: 'left',\n} as const\n\n// Mini CTA label, which fits Pulse's 312px mini slide as a text link.\nconst MINI_CTA_SX = {\n ...TEXT_LINK_SX,\n alignItems: 'center',\n display: 'flex',\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, at least 40px tall with 12/16 padding, as in Figma. `color=\"inherit\"` keeps\n// hover, ripple and focus off the primary palette. An unavailable CTA (contact_support_block with no host\n// handler) is dimmed at the call site, as the primary CTA is, because it is only aria-disabled and so\n// never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n lineHeight: '16px',\n minHeight: 40,\n px: 16,\n py: 12,\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 linkPresentation,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n beat.insights_payload?.in_description_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 // Mini: the card's action (in_description_cta) mirrors the full card's state, as a label only.\n // Answered → the status's action word (Undo) and its answered title; hidden → no label. The tap\n // stays the host's (it opens the insight with its block), so nothing runs from mini itself.\n const miniPresentation = isMini ? linkPresentation : undefined\n const miniStatus = miniPresentation?.kind === 'status' ? miniPresentation : undefined\n const actionLabel = miniPresentation ? miniStatus?.action?.label : ctaLabel\n const cardTitle = miniPresentation?.title || title || ''\n const showActionLink = !!actionLabel && !isCtaButton\n const showCtaRow = (isCtaButton && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const handleMiniActionClick = (event: MouseEvent) => {\n const { onCtaAction } = beatActions\n if (!onCtaAction) return\n event.stopPropagation()\n Promise.resolve()\n .then(() => onCtaAction({ beatGuid: beat.guid, name: HOST_ACTIONS.cardClick }))\n .catch((error) =>\n stores.captureException(error, {\n store: 'BaseLayout',\n template: beat.template,\n handler: 'cardClick',\n }),\n )\n }\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={cardTitle} />\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={TEXT_LINK_SX}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* The card's action with no primary CTA button, never a drawer: mini hands its tap to\n the host (`cardClick`); a full card's block-less link bubbles to the host's card handler. */}\n {showActionLink && (\n <Button\n onClick={isMini ? handleMiniActionClick : undefined}\n sx={MINI_CTA_SX}\n variant=\"text\"\n >\n {actionLabel}\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={TEXT_LINK_SX}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n sx={primaryPresentation.sx}\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":";;;;;;;;;;;;;;;;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K;AAAA,YAAqB,CAAA;AAAA,UAC9E;AAAA,QACN,CAAA,CAAA,EAAA,CAAA;AAAA,QAGJ,gBAAA,EAAC,IAAD,EAAwB,MAAA,EAAO,CAAA;AAAA,QAE/B,gBAAA,EAAC,IAAD;AAAA,UACE,QAAQ,EAAK;AAAA,UACb,SAAS,EAAK;AAAA,UACd,WAAW,EAAK;AAAA,QACjB,CAAA;AAAA,QAEA,EAAK,gBACJ,gBAAA,EAAC,IAAD;AAAA,UACE,qBAAqB,EAAK,OAAO;AAAA,UACjC,gBAAgB,EAAK,OAAO;AAAA,UAC5B,QAAQ;AAAA,UACR,aAAa,EAAK,wBAAwB;AAAA,UAC1C,SAAS,EAAK;AAAA,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 { type MouseEvent, 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 { HOST_ACTIONS, 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// Figma's 24px text link: 13/16 semibold, 16px line plus 4px above and below, its text starting at the\n// card's 16px inset. A minimum height, not the theme's fixed 44px Button height, so a long or translated\n// label wraps instead of overflowing; MUI's 64px minimum width and centring are undone for the same inset.\n// The in-description links use it as is, with the Button's 20px chevron, so they are 28px tall, as in\n// Figma's Low Account Balance full card (node 438:27877); the 24px is the mini CTA's, which has no icon.\nconst TEXT_LINK_SX = {\n alignSelf: 'flex-start',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n justifyContent: 'flex-start',\n lineHeight: '16px',\n minHeight: 24,\n minWidth: 0,\n px: 0,\n py: 4,\n textAlign: 'left',\n} as const\n\n// Mini CTA label, which fits Pulse's 312px mini slide as a text link.\nconst MINI_CTA_SX = {\n ...TEXT_LINK_SX,\n alignItems: 'center',\n display: 'flex',\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, at least 40px tall with 12/16 padding, as in Figma. `color=\"inherit\"` keeps\n// hover, ripple and focus off the primary palette. An unavailable CTA (contact_support_block with no host\n// handler) is dimmed at the call site, as the primary CTA is, because it is only aria-disabled and so\n// never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n height: 'auto',\n lineHeight: '16px',\n minHeight: 40,\n px: 16,\n py: 12,\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 linkPresentation,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta ?? undefined,\n beat.insights_payload?.secondary_cta ?? undefined,\n beat.insights_payload?.in_description_cta ?? undefined,\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 // Mini: the card's action (in_description_cta) mirrors the full card's state, as a label only.\n // Answered → the status's action word (Undo) and its answered title; hidden → no label. The tap\n // stays the host's (it opens the insight with its block), so nothing runs from mini itself.\n const miniPresentation = isMini ? linkPresentation : undefined\n const miniStatus = miniPresentation?.kind === 'status' ? miniPresentation : undefined\n const actionLabel = miniPresentation ? miniStatus?.action?.label : ctaLabel\n const cardTitle = miniPresentation?.title || title || ''\n const showActionLink = !!actionLabel && !isCtaButton\n const showCtaRow = (isCtaButton && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const handleMiniActionClick = (event: MouseEvent) => {\n const { onCtaAction } = beatActions\n if (!onCtaAction) return\n event.stopPropagation()\n Promise.resolve()\n .then(() => onCtaAction({ beatGuid: beat.guid, name: HOST_ACTIONS.cardClick }))\n .catch((error) =>\n stores.captureException(error, {\n store: 'BaseLayout',\n template: beat.template,\n handler: 'cardClick',\n }),\n )\n }\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={cardTitle} />\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={TEXT_LINK_SX}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* The card's action with no primary CTA button, never a drawer: mini hands its tap to\n the host (`cardClick`); a full card's block-less link bubbles to the host's card handler. */}\n {showActionLink && (\n <Button\n onClick={isMini ? handleMiniActionClick : undefined}\n sx={MINI_CTA_SX}\n variant=\"text\"\n >\n {actionLabel}\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={TEXT_LINK_SX}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n sx={primaryPresentation.sx}\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":";;;;;;;;;;;;;;;;;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AAA,cAAkB,MAAM,EAAK;AAAA,YAAqB,CAAA;AAAA,UAC9E;AAAA,QACN,CAAA,CAAA,EAAA,CAAA;AAAA,QAGJ,gBAAA,EAAC,IAAD,EAAwB,MAAA,EAAO,CAAA;AAAA,QAE/B,gBAAA,EAAC,IAAD;AAAA,UACE,QAAQ,EAAK;AAAA,UACb,SAAS,EAAK;AAAA,UACd,WAAW,EAAK;AAAA,QACjB,CAAA;AAAA,QAEA,EAAK,gBACJ,gBAAA,EAAC,IAAD;AAAA,UACE,qBAAqB,EAAK,OAAO;AAAA,UACjC,gBAAgB,EAAK,OAAO;AAAA,UAC5B,QAAQ;AAAA,UACR,aAAa,EAAK,wBAAwB;AAAA,UAC1C,SAAS,EAAK;AAAA,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,2 +1,2 @@
|
|
|
1
1
|
import { BarChartV2Props } from '../../../insights/types/Charts/BarChart';
|
|
2
|
-
export declare const BarChartV2: ({ amounts, color, data, heightOverride, margin, onBarClick, legendPosition, monthlyAmountLabel, removeSelectedTabColorChange, selectedTabIndex, trendAmountLabel, }: BarChartV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
export declare const BarChartV2: ({ amounts, color, data, heightOverride, margin, onBarClick, legendPosition, monthlyAmountLabel, removeSelectedTabColorChange, selectedTabIndex, showMonthlyAmount, trendAmountLabel, }: BarChartV2Props) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { useContainerDimensions as
|
|
2
|
-
import { LegendV2 as
|
|
3
|
-
import { CustomBarPlotV2 as
|
|
1
|
+
import { useContainerDimensions as D } from "../../../insights/hooks/useContainerDimensions.es.js";
|
|
2
|
+
import { LegendV2 as _ } from "../../../insights/components/shared/Charts/BarChart/ChartLegendV2.es.js";
|
|
3
|
+
import { CustomBarPlotV2 as j } from "../../../insights/components/shared/Charts/BarChart/CustomBarPlotV2.es.js";
|
|
4
4
|
import m from "react";
|
|
5
|
-
import
|
|
5
|
+
import W from "@mui/material/Stack";
|
|
6
6
|
import { jsx as n, jsxs as M } from "react/jsx-runtime";
|
|
7
|
-
import { useTheme as
|
|
8
|
-
import
|
|
9
|
-
import { BarPlot as
|
|
10
|
-
var
|
|
7
|
+
import { useTheme as z } from "@mui/material/styles";
|
|
8
|
+
import G from "@mui/material/Box";
|
|
9
|
+
import { BarPlot as N, ChartContainer as X, ChartsReferenceLine as b, ChartsXAxis as Y } from "@mui/x-charts";
|
|
10
|
+
var U = ({ amounts: c, color: s, data: e, heightOverride: p, margin: l = {
|
|
11
11
|
bottom: 30,
|
|
12
12
|
left: 16,
|
|
13
13
|
right: 16,
|
|
14
14
|
top: 20
|
|
15
|
-
}, onBarClick:
|
|
16
|
-
const g = m.useRef(null), { height:
|
|
15
|
+
}, onBarClick: d, legendPosition: h = "bottom", monthlyAmountLabel: x, removeSelectedTabColorChange: u, selectedTabIndex: o, showMonthlyAmount: S = !0, trendAmountLabel: y }) => {
|
|
16
|
+
const g = m.useRef(null), { height: v, width: R } = D(g), A = z(), k = m.useMemo(() => {
|
|
17
17
|
const t = e.map(({ value: a }) => a), r = Math.min(...t), i = Math.max(...t);
|
|
18
18
|
return {
|
|
19
19
|
series: [{
|
|
@@ -31,29 +31,29 @@ var Q = ({ amounts: c, color: s, data: e, heightOverride: p, margin: l = {
|
|
|
31
31
|
max: i > 0 ? i : 0
|
|
32
32
|
}]
|
|
33
33
|
};
|
|
34
|
-
}, [e]),
|
|
34
|
+
}, [e]), B = m.useMemo(() => {
|
|
35
35
|
const t = `${s}80`;
|
|
36
36
|
return u ? e.map(() => s) : o == null ? [...new Array(e.length - 1).fill(t), s] : e.map((r, i) => i === o ? s : t);
|
|
37
37
|
}, [
|
|
38
38
|
s,
|
|
39
39
|
e,
|
|
40
40
|
o
|
|
41
|
-
]),
|
|
41
|
+
]), L = m.useMemo(() => e[o ?? e.length - 1], [e, o]), f = e.reduce((t, r) => Math.min(t, r.value), 1 / 0) < 0, C = /* @__PURE__ */ n(_, {
|
|
42
42
|
color: s,
|
|
43
43
|
legendStyle: { pl: l.left },
|
|
44
|
-
monthlyAmount:
|
|
44
|
+
monthlyAmount: S ? L.formattedAmount : void 0,
|
|
45
45
|
monthlyAmountLabel: x,
|
|
46
46
|
trendAmount: c?.formattedAverage,
|
|
47
47
|
trendAmountLabel: y
|
|
48
|
-
}), w = x || y,
|
|
49
|
-
return /* @__PURE__ */ M(
|
|
48
|
+
}), w = x || y, V = (t, { dataIndex: r }) => d?.(r);
|
|
49
|
+
return /* @__PURE__ */ M(W, {
|
|
50
50
|
sx: {
|
|
51
51
|
alignItems: "center",
|
|
52
52
|
width: "100%"
|
|
53
53
|
},
|
|
54
54
|
children: [
|
|
55
55
|
w && h === "top" && C,
|
|
56
|
-
/* @__PURE__ */ n(
|
|
56
|
+
/* @__PURE__ */ n(G, {
|
|
57
57
|
ref: g,
|
|
58
58
|
sx: {
|
|
59
59
|
height: p || 122,
|
|
@@ -66,8 +66,8 @@ var Q = ({ amounts: c, color: s, data: e, heightOverride: p, margin: l = {
|
|
|
66
66
|
userSelect: "none"
|
|
67
67
|
}
|
|
68
68
|
},
|
|
69
|
-
children: /* @__PURE__ */ M(
|
|
70
|
-
height:
|
|
69
|
+
children: /* @__PURE__ */ M(X, {
|
|
70
|
+
height: v,
|
|
71
71
|
margin: {
|
|
72
72
|
bottom: l.bottom,
|
|
73
73
|
left: l.left,
|
|
@@ -94,7 +94,7 @@ var Q = ({ amounts: c, color: s, data: e, heightOverride: p, margin: l = {
|
|
|
94
94
|
lineStyle: { stroke: A.palette.chart.chart7 },
|
|
95
95
|
y: 0
|
|
96
96
|
}),
|
|
97
|
-
/* @__PURE__ */ n(
|
|
97
|
+
/* @__PURE__ */ n(Y, {
|
|
98
98
|
slots: { axisTickLabel: ({ text: t, ownerState: r, ...i }) => {
|
|
99
99
|
const a = e[o ?? e.length - 1]?.label;
|
|
100
100
|
return /* @__PURE__ */ n("text", {
|
|
@@ -113,13 +113,13 @@ var Q = ({ amounts: c, color: s, data: e, heightOverride: p, margin: l = {
|
|
|
113
113
|
}),
|
|
114
114
|
tickLabelStyle: { fontSize: 11 }
|
|
115
115
|
}),
|
|
116
|
-
/* @__PURE__ */ n(
|
|
117
|
-
onItemClick:
|
|
116
|
+
/* @__PURE__ */ n(N, {
|
|
117
|
+
onItemClick: V,
|
|
118
118
|
slots: { bar: (t) => {
|
|
119
119
|
const { ownerState: r, ...i } = t;
|
|
120
|
-
return /* @__PURE__ */ n(
|
|
120
|
+
return /* @__PURE__ */ n(j, {
|
|
121
121
|
...i,
|
|
122
|
-
colorRange:
|
|
122
|
+
colorRange: B,
|
|
123
123
|
data: e,
|
|
124
124
|
dataIndex: r.dataIndex,
|
|
125
125
|
removeSelectedTabColorChange: u,
|
|
@@ -141,7 +141,7 @@ var Q = ({ amounts: c, color: s, data: e, heightOverride: p, margin: l = {
|
|
|
141
141
|
});
|
|
142
142
|
};
|
|
143
143
|
export {
|
|
144
|
-
|
|
144
|
+
U as BarChartV2
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
//# sourceMappingURL=BarchartV2.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BarchartV2.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/BarchartV2.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { type Theme, useTheme } from '@mui/material/styles'\nimport {\n BarPlot,\n type BarSeriesType,\n ChartContainer as ResponsiveChartContainer,\n ChartsReferenceLine,\n ChartsXAxis,\n} from '@mui/x-charts'\n\nimport { useContainerDimensions } from '../../../insights/hooks/useContainerDimensions'\nimport type { BarChartV2Props } from '../../../insights/types/Charts/BarChart'\nimport { LegendV2 } from '../../../insights/components/shared/Charts/BarChart/ChartLegendV2'\nimport { CustomBarPlotV2 } from '../../../insights/components/shared/Charts/BarChart/CustomBarPlotV2'\n\nexport const BarChartV2 = ({\n amounts,\n color,\n data,\n heightOverride,\n margin = {\n bottom: 30,\n left: 16,\n right: 16,\n top: 20,\n },\n onBarClick,\n legendPosition = 'bottom',\n monthlyAmountLabel,\n removeSelectedTabColorChange,\n selectedTabIndex,\n trendAmountLabel,\n}: BarChartV2Props) => {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const theme = useTheme()\n\n const chartData = React.useMemo(() => {\n const values = data.map(({ value }) => value)\n const minValue = Math.min(...values)\n const maxValue = Math.max(...values)\n\n return {\n series: [\n {\n data: values,\n type: 'bar',\n },\n ] as BarSeriesType[],\n xAxis: [\n {\n data: data.map(({ label }) => label),\n scaleType: 'band' as const,\n categoryGapRatio: 0.45,\n },\n ],\n yAxis: [\n {\n scaleType: 'linear' as const,\n min: minValue < 0 ? minValue * 1.2 : 0,\n max: maxValue > 0 ? maxValue : 0,\n },\n ],\n }\n }, [data])\n\n const colorRange = React.useMemo(() => {\n const defaultColor = `${color}80`\n if (removeSelectedTabColorChange) return data.map(() => color)\n\n if (selectedTabIndex == null) {\n return [...new Array(data.length - 1).fill(defaultColor), color]\n }\n return data.map((_, index) => (index === selectedTabIndex ? color : defaultColor))\n }, [color, data, selectedTabIndex])\n\n const selectedData = React.useMemo(\n () => data[selectedTabIndex ?? data.length - 1],\n [data, selectedTabIndex],\n )\n\n const lowestValue = data.reduce((min, item) => Math.min(min, item.value), Infinity)\n const isNegative = lowestValue < 0\n\n const legendComponent = (\n <LegendV2\n color={color}\n legendStyle={{ pl: margin.left }}\n monthlyAmount={selectedData.formattedAmount}\n monthlyAmountLabel={monthlyAmountLabel}\n trendAmount={amounts?.formattedAverage}\n trendAmountLabel={trendAmountLabel}\n />\n )\n\n const shouldShowLegend = monthlyAmountLabel || trendAmountLabel\n\n const handleBarClick = (\n _: React.MouseEvent<SVGElement, MouseEvent>,\n { dataIndex }: { dataIndex: number },\n ) => onBarClick?.(dataIndex)\n\n return (\n <Stack sx={{ alignItems: 'center', width: '100%' }}>\n {shouldShowLegend && legendPosition === 'top' && legendComponent}\n <Box\n ref={containerRef}\n sx={{\n height: heightOverride ? heightOverride : 122,\n mb: legendPosition === 'top' ? 0 : 4,\n mt: legendPosition === 'top' ? 4 : 0,\n touchAction: 'pan-y',\n width: '100%',\n '& svg': {\n touchAction: 'pan-y',\n userSelect: 'none',\n },\n }}\n >\n <ResponsiveChartContainer\n height={height}\n margin={{\n bottom: margin.bottom,\n left: margin.left,\n right: margin.right,\n top: margin.top || 45,\n }}\n series={chartData.series}\n width={width}\n xAxis={chartData.xAxis}\n yAxis={[{ width: 0 }]}\n >\n {amounts?.average && (\n <ChartsReferenceLine\n labelAlign=\"middle\"\n lineStyle={{\n stroke: theme.palette.chart.chart7,\n strokeDasharray: '4',\n strokeLinecap: 'round',\n strokeWidth: 1,\n }}\n y={amounts?.average}\n />\n )}\n\n {isNegative && (\n <ChartsReferenceLine\n labelAlign=\"middle\"\n lineStyle={{\n stroke: theme.palette.chart.chart7,\n }}\n y={0}\n />\n )}\n\n <ChartsXAxis\n slots={{\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n axisTickLabel: ({ text, ownerState: _, ...restProps }) => {\n const label = data[selectedTabIndex ?? data.length - 1]?.label\n return (\n <text\n {...restProps}\n style={\n {\n ...restProps.style,\n fontWeight: !removeSelectedTabColorChange && label === text ? 'bold' : 400,\n } as React.CSSProperties\n }\n >\n {text}\n </text>\n )\n },\n }}\n sx={(theme) => ({\n '& .MuiChartsAxis-line': {\n stroke: !isNegative ? (theme as Theme).palette.text?.primary : 'none',\n },\n '& .MuiChartsAxis-tickContainer:first-of-type .MuiChartsAxis-tick': {\n display: 'none',\n },\n '& .MuiChartsAxis-tickLabel': {\n transform: isNegative ? 'translateY(15px)' : {},\n },\n })}\n tickLabelStyle={{\n fontSize: 11,\n }}\n />\n <BarPlot\n onItemClick={handleBarClick}\n slots={{\n bar: (props) => {\n const { ownerState, ...defaultProps } = props\n return (\n <CustomBarPlotV2\n {...defaultProps}\n colorRange={colorRange}\n data={data}\n dataIndex={ownerState.dataIndex}\n removeSelectedTabColorChange={removeSelectedTabColorChange}\n selectedTabIndex={selectedTabIndex ?? data.length - 1}\n style={{\n height: props.height,\n x: props.x,\n y: props.y,\n width: props.width,\n }}\n />\n )\n },\n }}\n />\n </ResponsiveChartContainer>\n </Box>\n {shouldShowLegend && legendPosition === 'bottom' && legendComponent}\n </Stack>\n )\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAa,IAAA,CAAc,EACzB,SAAA,GACA,OAAA,GACA,MAAA,GACA,gBAAA,GACA,QAAA,IAAS;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AACP,GACA,YAAA,GACA,gBAAA,IAAiB,UACjB,oBAAA,GACA,8BAAA,GACA,kBAAA,GACA,kBAAA,EAAA,MACqB;AACrB,QAAM,IAAe,EAAM,OAAuB,IAAI,GAChD,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,IAAQ,EAAS,GAEjB,IAAY,EAAM,QAAA,MAAc;AACpC,UAAM,IAAS,EAAK,IAAA,CAAK,EAAE,OAAA,EAAA,MAAY,CAAK,GACtC,IAAW,KAAK,IAAI,GAAG,CAAM,GAC7B,IAAW,KAAK,IAAI,GAAG,CAAM;AAEnC,WAAO;AAAA,MACL,QAAQ,CACN;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR,CACF;AAAA,MACA,OAAO,CACL;AAAA,QACE,MAAM,EAAK,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AgC,MAAU,IAAO,SAAS;AAAA,kBACzE;AAAA,kBAGD,UAAA;AAAA,gBACG,CAAA;AAAA,cAEV,EACF;AAAA,cACA,IAAA,CAAK,OAAW;AAAA,gBACd,yBAAyB,EACvB,QAAS,IAAsD,SAAxC,EAAgB,QAAQ,MAAM,QACvD;AAAA,gBACA,oEAAoE,EAClE,SAAS,OACX;AAAA,gBACA,8BAA8B,EAC5B,WAAW,IAAa,qBAAqB,CAAC,EAChD;AAAA,cACF;AAAA,cACA,gBAAgB,EACd,UAAU,GACZ;AAAA,YACD,CAAA;AAAA,YACD,gBAAA,EAAC,GAAD;AAAA,cACE,aAAa;AAAA,cACb,OAAO,EACL,KAAA,CAAM,MAAU;AACd,sBAAM,EAAE,YAAA,GAAY,GAAG,EAAA,IAAiB;AACxC,uBACE,gBAAA,EAAC,GAAD;AAAA,kBACE,GAAI;AAAA,kBACQ,YAAA;AAAA,kBACN,MAAA;AAAA,kBACN,WAAW,EAAW;AAAA,kBACQ,8BAAA;AAAA,kBAC9B,kBAAkB,KAAoB,EAAK,SAAS;AAAA,kBACpD,OAAO;AAAA,oBACL,QAAQ,EAAM;AAAA,oBACd,GAAG,EAAM;AAAA,oBACT,GAAG,EAAM;AAAA,oBACT,OAAO,EAAM;AAAA,kBACf;AAAA,gBACD,CAAA;AAAA,cAEL,EACF;AAAA,YACD,CAAA;AAAA,UACuB;AAAA;MACvB,CAAA;AAAA,MACJ,KAAoB,MAAmB,YAAY;AAAA,IAC/C;AAAA;AAEX"}
|
|
1
|
+
{"version":3,"file":"BarchartV2.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/BarchartV2.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { type Theme, useTheme } from '@mui/material/styles'\nimport {\n BarPlot,\n type BarSeriesType,\n ChartContainer as ResponsiveChartContainer,\n ChartsReferenceLine,\n ChartsXAxis,\n} from '@mui/x-charts'\n\nimport { useContainerDimensions } from '../../../insights/hooks/useContainerDimensions'\nimport type { BarChartV2Props } from '../../../insights/types/Charts/BarChart'\nimport { LegendV2 } from '../../../insights/components/shared/Charts/BarChart/ChartLegendV2'\nimport { CustomBarPlotV2 } from '../../../insights/components/shared/Charts/BarChart/CustomBarPlotV2'\n\nexport const BarChartV2 = ({\n amounts,\n color,\n data,\n heightOverride,\n margin = {\n bottom: 30,\n left: 16,\n right: 16,\n top: 20,\n },\n onBarClick,\n legendPosition = 'bottom',\n monthlyAmountLabel,\n removeSelectedTabColorChange,\n selectedTabIndex,\n showMonthlyAmount = true,\n trendAmountLabel,\n}: BarChartV2Props) => {\n const containerRef = React.useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(containerRef)\n const theme = useTheme()\n\n const chartData = React.useMemo(() => {\n const values = data.map(({ value }) => value)\n const minValue = Math.min(...values)\n const maxValue = Math.max(...values)\n\n return {\n series: [\n {\n data: values,\n type: 'bar',\n },\n ] as BarSeriesType[],\n xAxis: [\n {\n data: data.map(({ label }) => label),\n scaleType: 'band' as const,\n categoryGapRatio: 0.45,\n },\n ],\n yAxis: [\n {\n scaleType: 'linear' as const,\n min: minValue < 0 ? minValue * 1.2 : 0,\n max: maxValue > 0 ? maxValue : 0,\n },\n ],\n }\n }, [data])\n\n const colorRange = React.useMemo(() => {\n const defaultColor = `${color}80`\n if (removeSelectedTabColorChange) return data.map(() => color)\n\n if (selectedTabIndex == null) {\n return [...new Array(data.length - 1).fill(defaultColor), color]\n }\n return data.map((_, index) => (index === selectedTabIndex ? color : defaultColor))\n }, [color, data, selectedTabIndex])\n\n const selectedData = React.useMemo(\n () => data[selectedTabIndex ?? data.length - 1],\n [data, selectedTabIndex],\n )\n\n const lowestValue = data.reduce((min, item) => Math.min(min, item.value), Infinity)\n const isNegative = lowestValue < 0\n\n const legendComponent = (\n <LegendV2\n color={color}\n legendStyle={{ pl: margin.left }}\n monthlyAmount={showMonthlyAmount ? selectedData.formattedAmount : undefined}\n monthlyAmountLabel={monthlyAmountLabel}\n trendAmount={amounts?.formattedAverage}\n trendAmountLabel={trendAmountLabel}\n />\n )\n\n const shouldShowLegend = monthlyAmountLabel || trendAmountLabel\n\n const handleBarClick = (\n _: React.MouseEvent<SVGElement, MouseEvent>,\n { dataIndex }: { dataIndex: number },\n ) => onBarClick?.(dataIndex)\n\n return (\n <Stack sx={{ alignItems: 'center', width: '100%' }}>\n {shouldShowLegend && legendPosition === 'top' && legendComponent}\n <Box\n ref={containerRef}\n sx={{\n height: heightOverride ? heightOverride : 122,\n mb: legendPosition === 'top' ? 0 : 4,\n mt: legendPosition === 'top' ? 4 : 0,\n touchAction: 'pan-y',\n width: '100%',\n '& svg': {\n touchAction: 'pan-y',\n userSelect: 'none',\n },\n }}\n >\n <ResponsiveChartContainer\n height={height}\n margin={{\n bottom: margin.bottom,\n left: margin.left,\n right: margin.right,\n top: margin.top || 45,\n }}\n series={chartData.series}\n width={width}\n xAxis={chartData.xAxis}\n yAxis={[{ width: 0 }]}\n >\n {amounts?.average && (\n <ChartsReferenceLine\n labelAlign=\"middle\"\n lineStyle={{\n stroke: theme.palette.chart.chart7,\n strokeDasharray: '4',\n strokeLinecap: 'round',\n strokeWidth: 1,\n }}\n y={amounts?.average}\n />\n )}\n\n {isNegative && (\n <ChartsReferenceLine\n labelAlign=\"middle\"\n lineStyle={{\n stroke: theme.palette.chart.chart7,\n }}\n y={0}\n />\n )}\n\n <ChartsXAxis\n slots={{\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n axisTickLabel: ({ text, ownerState: _, ...restProps }) => {\n const label = data[selectedTabIndex ?? data.length - 1]?.label\n return (\n <text\n {...restProps}\n style={\n {\n ...restProps.style,\n fontWeight: !removeSelectedTabColorChange && label === text ? 'bold' : 400,\n } as React.CSSProperties\n }\n >\n {text}\n </text>\n )\n },\n }}\n sx={(theme) => ({\n '& .MuiChartsAxis-line': {\n stroke: !isNegative ? (theme as Theme).palette.text?.primary : 'none',\n },\n '& .MuiChartsAxis-tickContainer:first-of-type .MuiChartsAxis-tick': {\n display: 'none',\n },\n '& .MuiChartsAxis-tickLabel': {\n transform: isNegative ? 'translateY(15px)' : {},\n },\n })}\n tickLabelStyle={{\n fontSize: 11,\n }}\n />\n <BarPlot\n onItemClick={handleBarClick}\n slots={{\n bar: (props) => {\n const { ownerState, ...defaultProps } = props\n return (\n <CustomBarPlotV2\n {...defaultProps}\n colorRange={colorRange}\n data={data}\n dataIndex={ownerState.dataIndex}\n removeSelectedTabColorChange={removeSelectedTabColorChange}\n selectedTabIndex={selectedTabIndex ?? data.length - 1}\n style={{\n height: props.height,\n x: props.x,\n y: props.y,\n width: props.width,\n }}\n />\n )\n },\n }}\n />\n </ResponsiveChartContainer>\n </Box>\n {shouldShowLegend && legendPosition === 'bottom' && legendComponent}\n </Stack>\n )\n}\n"],"mappings":";;;;;;;;;AAkBA,IAAa,IAAA,CAAc,EACzB,SAAA,GACA,OAAA,GACA,MAAA,GACA,gBAAA,GACA,QAAA,IAAS;AAAA,EACP,QAAQ;AAAA,EACR,MAAM;AAAA,EACN,OAAO;AAAA,EACP,KAAK;AACP,GACA,YAAA,GACA,gBAAA,IAAiB,UACjB,oBAAA,GACA,8BAAA,GACA,kBAAA,GACA,mBAAA,IAAoB,IACpB,kBAAA,EAAA,MACqB;AACrB,QAAM,IAAe,EAAM,OAAuB,IAAI,GAChD,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAY,GACvD,IAAQ,EAAS,GAEjB,IAAY,EAAM,QAAA,MAAc;AACpC,UAAM,IAAS,EAAK,IAAA,CAAK,EAAE,OAAA,EAAA,MAAY,CAAK,GACtC,IAAW,KAAK,IAAI,GAAG,CAAM,GAC7B,IAAW,KAAK,IAAI,GAAG,CAAM;AAEnC,WAAO;AAAA,MACL,QAAQ,CACN;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,MACR,CACF;AAAA,MACA,OAAO,CACL;AAAA,QACE,MAAM,EAAK,IAAA,CAAK,EAAE,OAAA,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