@mx-cartographer/experiences 9.7.112 → 9.7.114

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.
Files changed (28) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/insights/types/Charts/BarChart.d.ts +2 -0
  3. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +28 -26
  4. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
  5. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.d.ts +2 -0
  6. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.es.js +8 -4
  7. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.es.js.map +1 -1
  8. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.d.ts +6 -2
  9. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +31 -29
  10. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js.map +1 -1
  11. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +16 -16
  12. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  13. package/dist/insights-v2/components/chartblocks/BarchartV2.d.ts +1 -1
  14. package/dist/insights-v2/components/chartblocks/BarchartV2.es.js +58 -57
  15. package/dist/insights-v2/components/chartblocks/BarchartV2.es.js.map +1 -1
  16. package/dist/microinsights/MicroCardTemplate.d.ts +2 -0
  17. package/dist/microinsights/MicroCardTemplate.es.js +81 -59
  18. package/dist/microinsights/MicroCardTemplate.es.js.map +1 -1
  19. package/dist/microinsights/cards/InsightCard.es.js +61 -59
  20. package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
  21. package/dist/microinsights/carousel/MicroBeatCarousel.es.js +2 -2
  22. package/dist/microinsights/carousel/MicroBeatCarousel.es.js.map +1 -1
  23. package/dist/microinsights/constants/App.d.ts +4 -0
  24. package/dist/microinsights/constants/App.es.js.map +1 -1
  25. package/dist/microinsights/utils/cardWidth.d.ts +5 -0
  26. package/dist/microinsights/utils/cardWidth.es.js +9 -0
  27. package/dist/microinsights/utils/cardWidth.es.js.map +1 -0
  28. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [9.7.114] - 11-06-2026
2
+
3
+ - **FIXED** - The Weekly New Merchants "Others" row icon tile has the 4px corner radius of the row's other logo tiles (was 8px)
4
+ - **FIXED** - The Savings Account Balances Summary chart matches Figma: a 184px chart area (was 122px) and the months that aren't selected at 35% of the bar colour (was 50%). Only its `account_balance` bar chart variant changes; Monthly Spend Comparison keeps 122px and 50%
5
+
6
+ ## [9.7.113] - 11-05-2026
7
+
8
+ - **CHANGED** - The Insights 2.0 micro card keeps its title on one line, cut off with "…" when it does not fit, and draws its logo at a fixed 32×32 (WEC-2224)
9
+ - **CHANGED** - Micro cards, including the error card, are never narrower than 240px, and the carousel scrolls instead of shrinking them (WEC-2224):
10
+ - With `allowSingleCardPeeking`, containers 320px or narrower get 240px cards instead of 220px.
11
+ - With several visible cards, each card stays at 240px and the row scrolls once the container is too narrow for them.
12
+ - A `widthOverrides` below 240 on `MicroCardTemplate` is raised to 240; before the carousel measures its container, a card's minimum width is `max(100%, 240px)` instead of `100%`.
13
+ - In a container narrower than one card (about 272px with the default margin), the card is never fully in view, so its view events (`has_been_displayed`, `onInsightView*`, `viewed_insight`) do not fire.
14
+
1
15
  ## [9.7.112] - 11-05-2026
2
16
 
3
17
  - **CHANGED** - The Monthly Obligations Status drawer shows Available Funds, Planned Expenses and Total Remaining from the button that opened it, matching Figma. Ships after the ditto drilldown recipe and the new account list copy are live (WEC-2115)
@@ -40,6 +40,8 @@ export interface BarChartV2Props {
40
40
  selectedTabIndex?: number;
41
41
  showMonthlyAmount?: boolean;
42
42
  trendAmountLabel?: string;
43
+ /** Opacity (0–1) of the bars that aren't selected; omitted keeps the default 50%. */
44
+ unselectedOpacity?: number;
43
45
  }
44
46
  export interface DataSet {
45
47
  ariaLabelComparison: string;
@@ -1,50 +1,52 @@
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";
1
+ import { useGlobalUiStore as B, useInsightsV2Store as I } from "../../../../common/context/hooks.es.js";
2
+ import { formatCurrency as L } from "../../../../core/utils/NumberFormatting.es.js";
3
+ import T from "../../../../common/components/Loader.es.js";
4
+ import { BAR_ARIA_LABEL as v, barChartVariant as S, buildChartData as E, buildDataSeries as O } from "./utils.es.js";
5
+ import { BarChartV2 as R } from "../../../components/chartblocks/BarchartV2.es.js";
6
+ import { EmptyBarChart as N } from "../../../components/chartblocks/EmptyBarChart.es.js";
7
+ import { ANALYTICS_EVENTS_CONFIG as x } from "../../../analytics/analyticsEventsConfig.es.js";
8
+ import { useAnalyticsEvent as D } from "../../../analytics/useAnalyticsEvent.es.js";
9
+ import { actionBlocksKey as k } from "../../../mappings/actionBlocksKey.es.js";
10
+ import V from "react";
11
+ import { observer as w } from "mobx-react-lite";
12
12
  import { jsx as r } from "react/jsx-runtime";
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, {
13
+ import { useTheme as H } from "@mui/material/styles";
14
+ var X = w(({ payload: a, beatGuid: n = "" }) => {
15
+ const i = H(), { openActionDrawer: m } = I(), { isCopyLoaded: s } = B(), { instance_slot: o, widget_type: c } = a, { series: l, category_guid: h, average_amount: e = 0, additional_data: d = [] } = o.data ?? {}, [f, u] = d, t = E(O(l), v), [p] = V.useState(t.length - 1), { chartHeight: A, color: g, showMonthlyAmount: C, unselectedOpacity: _ } = S(o, h, i), b = D();
16
+ return s ? t.length ? /* @__PURE__ */ r(R, {
17
17
  amounts: {
18
18
  average: e,
19
- formattedAverage: y(e, "0,0")
19
+ formattedAverage: L(e, "0,0")
20
20
  },
21
- color: h,
21
+ color: g,
22
22
  data: t,
23
- monthlyAmountLabel: d?.label ?? "",
23
+ heightOverride: A,
24
+ monthlyAmountLabel: f?.label ?? "",
24
25
  margin: {
25
26
  bottom: 8,
26
27
  left: 16,
27
28
  right: 16,
28
29
  top: 24
29
30
  },
30
- onBarClick: (_) => {
31
+ onBarClick: (y) => {
31
32
  if (c !== "full") return !1;
32
- g(N.CHART_BAR_CLICKED), i({
33
+ b(x.CHART_BAR_CLICKED), m({
33
34
  guid: n,
34
35
  trigger: "chartBar",
35
36
  context: {
36
- chartBarIndex: _,
37
- block: D.TRANSCATION_HISTORY_ACTION_BLOCK
37
+ chartBarIndex: y,
38
+ block: k.TRANSCATION_HISTORY_ACTION_BLOCK
38
39
  }
39
40
  });
40
41
  },
41
- selectedTabIndex: A,
42
+ selectedTabIndex: p,
42
43
  showMonthlyAmount: C,
43
- trendAmountLabel: p?.label ?? ""
44
- }) : /* @__PURE__ */ r(R, {}) : /* @__PURE__ */ r(I, {});
44
+ trendAmountLabel: u?.label ?? "",
45
+ unselectedOpacity: _
46
+ }) : /* @__PURE__ */ r(N, {}) : /* @__PURE__ */ r(T, {});
45
47
  });
46
48
  export {
47
- Q as BarchartBlock
49
+ X as BarchartBlock
48
50
  };
49
51
 
50
52
  //# 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, 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,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,GAAO,mBAAA,EAAA,IAAsB,EAAgB,GAAe,GAAe,CAAK,GAClF,IAAqB,EAAkB;AAE7C,SAAK,IAIE,EAAU,SACf,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS;AAAA,MACP,SAAS;AAAA,MACT,kBAAkB,EAAe,GAAgB,KAAK;AAAA,IACxD;AAAA,IACO,OAAA;AAAA,IACP,MAAM;AAAA,IACN,oBAAoB,GAAe,SAAS;AAAA,IAC5C,QAAQ;AAAA,MACN,QAAQ;AAAA,MACR,MAAM;AAAA,MACN,OAAO;AAAA,MAEP,KAAK;AAAA,IACP;AAAA,IACA,YAAA,CAAa,MAAU;AACrB,UAAI,MAAgB,OAAQ,QAAO;AAEnC,MAAA,EAAmB,EAAwB,iBAAiB,GAE5D,EAAiB;AAAA,QACf,MAAM;AAAA,QACN,SAAS;AAAA,QACT,SAAS;AAAA,UACP,eAAe;AAAA,UACf,OAAO,EAAgB;AAAA,QACzB;AAAA,MACF,CAAC;AAAA,IACH;AAAA,IACkB,kBAAA;AAAA,IACC,mBAAA;AAAA,IACnB,kBAAkB,GAAO,SAAS;AAAA,EACnC,CAAA,IAED,gBAAA,EAAC,GAAD,CAAgB,CAAA,IAtCT,gBAAA,EAAC,GAAD,CAAS,CAAA;AAwCpB,CAAC"}
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 { chartHeight, color, showMonthlyAmount, unselectedOpacity } = barChartVariant(\n instance_slot,\n category_guid,\n theme,\n )\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 heightOverride={chartHeight}\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 unselectedOpacity={unselectedOpacity}\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,E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styles';
2
2
  export declare const getLayoutConfig: (theme: Theme) => {
3
3
  account_balance: {
4
4
  color: string;
5
+ chartHeight: number;
6
+ unselectedOpacity: number;
5
7
  };
6
8
  monthly_spend_comparison: {
7
9
  color: string | undefined;
@@ -1,12 +1,16 @@
1
- var t = (o) => ({
2
- account_balance: { color: o.palette.success.main },
1
+ var a = (t) => ({
2
+ account_balance: {
3
+ color: t.palette.success.main,
4
+ chartHeight: 184,
5
+ unselectedOpacity: 0.35
6
+ },
3
7
  monthly_spend_comparison: {
4
- color: o.palette.chart.chart2,
8
+ color: t.palette.chart.chart2,
5
9
  showMonthlyAmount: !1
6
10
  }
7
11
  });
8
12
  export {
9
- t as getLayoutConfig
13
+ a as getLayoutConfig
10
14
  };
11
15
 
12
16
  //# 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 // 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
+ {"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 // Figma (Savings Account Balances Summary): a 184px chart area above the legend, and the\n // months that aren't selected at 35% of the bar colour.\n chartHeight: 184,\n unselectedOpacity: 0.35,\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;AAAA,IACf,OAAO,EAAM,QAAQ,QAAQ;AAAA,IAG7B,aAAa;AAAA,IACb,mBAAmB;AAAA,EACrB;AAAA,EACA,0BAA0B;AAAA,IACxB,OAAO,EAAM,QAAQ,MAAM;AAAA,IAE3B,mBAAmB;AAAA,EACrB;AACF"}
@@ -25,7 +25,11 @@ export declare const buildChartData: (dataSeries: ChartDataSeriesItem[], ariaLab
25
25
  value: number;
26
26
  formattedAmount: string;
27
27
  }[];
28
- export declare const barChartVariant: (instanceSlot: InstanceSlot, categoryGuid: string | undefined, theme: Theme) => {
28
+ /** A bar chart variant's look: its layout entry, resolved with defaults. */
29
+ export interface BarChartVariantLayout {
30
+ chartHeight?: number;
29
31
  color: string;
30
32
  showMonthlyAmount: boolean;
31
- };
33
+ unselectedOpacity?: number;
34
+ }
35
+ export declare const barChartVariant: (instanceSlot: InstanceSlot, categoryGuid: string | undefined, theme: Theme) => BarChartVariantLayout;
@@ -1,45 +1,47 @@
1
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";
2
+ import { DATE_FORMATS_INTL as i, formatDate as c } from "../../../../core/constants/DateFormats.es.js";
3
3
  import { formatCurrency as m } from "../../../../core/utils/NumberFormatting.es.js";
4
- import { getCategoryColor as A } from "../../../../core/utils/CategoryUtil.es.js";
5
- import { getLayoutConfig as _ } from "./layout.es.js";
6
- import { parseISO as C } from "date-fns/parseISO";
7
- var c = {
4
+ import { getCategoryColor as l } from "../../../../core/utils/CategoryUtil.es.js";
5
+ import { getLayoutConfig as A } from "./layout.es.js";
6
+ import { parseISO as p } from "date-fns/parseISO";
7
+ var s = {
8
8
  CATEGORY_COLOR: "category_color",
9
9
  ACCOUNT_BALANCE: "account_balance",
10
10
  MONTHLY_SPEND_COMPARISON: "monthly_spend_comparison"
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;
11
+ }, h = "_1{month}: _2{amount}", T = (a) => a ? a.data ? a.data.map((n) => {
12
+ const e = {};
13
+ return a.names?.map((t, r) => {
14
+ e[t] = n[r];
15
+ }), e;
16
+ }) : [] : [], R = (a, n, e = i.MONTH_SHORT) => [...a].sort((t, r) => !t.date || !r.date ? 0 : new Date(t.date).getTime() - new Date(r.date).getTime()).map((t) => {
17
+ const r = t.date ? c(p(t.date), e) : t.label ?? "", o = t.amount ?? 0;
18
18
  return {
19
- ariaLabel: u(e, t, m(n, "0.00")),
20
- date: r.date ?? null,
21
- label: t,
22
- value: n,
23
- formattedAmount: m(n, "0,0")
19
+ ariaLabel: u(n, r, m(o, "0.00")),
20
+ date: t.date ?? null,
21
+ label: r,
22
+ value: o,
23
+ formattedAmount: m(o, "0,0")
24
24
  };
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),
25
+ }), L = (a, n, e) => {
26
+ const { variant: t } = a, r = A(e);
27
+ if (t === s.CATEGORY_COLOR && n) return {
28
+ color: l(n, e),
29
29
  showMonthlyAmount: !0
30
30
  };
31
- const n = t[r];
31
+ const o = r[t];
32
32
  return {
33
- color: n?.color ?? a.palette.primary.main,
34
- showMonthlyAmount: n?.showMonthlyAmount ?? !0
33
+ chartHeight: o?.chartHeight,
34
+ color: o?.color ?? e.palette.primary.main,
35
+ showMonthlyAmount: o?.showMonthlyAmount ?? !0,
36
+ unselectedOpacity: o?.unselectedOpacity
35
37
  };
36
38
  };
37
39
  export {
38
- R as BAR_ARIA_LABEL,
39
- c as BAR_CHART_VARIANTS,
40
- h as barChartVariant,
41
- L as buildChartData,
42
- d as buildDataSeries
40
+ h as BAR_ARIA_LABEL,
41
+ s as BAR_CHART_VARIANTS,
42
+ L as barChartVariant,
43
+ R as buildChartData,
44
+ T as buildDataSeries
43
45
  };
44
46
 
45
47
  //# 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), 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?.showMonthlyAmount ?? true,\n }\n}\n"],"mappings":";;;;;;AAWA,IAAa,IAAqB;AAAA,EAChC,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,0BAA0B;AAC5B,GAaa,IAAiB,yBAEjB,IAAA,CAAmB,MACzB,IAID,EAAK,OACA,EAAK,KAAK,IAAA,CAAK,MAAM;AAC1B,QAAM,IAAY,CAAC;AAEnB,SAAA,EAAK,OAAO,IAAA,CAAK,GAAM,MAAU;AAC/B,IAAA,EAAK,CAAA,IAAQ,EAAE,CAAA;AAAA,EACjB,CAAC,GACM;AACT,CAAC,IAEM,CAAC,IAbD,CAAC,GAiBC,IAAA,CACX,GACA,GACA,IAA+C,EAAkB,gBAEpD,CAAC,GAAG,CAAU,EACxB,KAAA,CAAM,GAAG,MACJ,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAa,IAExB,IAAI,KAAK,EAAE,IAAI,EAAE,QAAQ,IAAI,IAAI,KAAK,EAAE,IAAI,EAAE,QAAQ,CAC9D,EACA,IAAA,CAAK,MAAU;AACd,QAAM,IAAQ,EAAM,OAAO,EAAW,EAAS,EAAM,IAAI,GAAG,CAAU,IAAK,EAAM,SAAS,IACpF,IAAS,EAAM,UAAU;AAE/B,SAAO;AAAA,IACL,WAAW,EAAiB,GAAW,GAAO,EAAe,GAAQ,MAAM,CAAC;AAAA,IAC5E,MAAM,EAAM,QAAQ;AAAA,IACpB,OAAA;AAAA,IACA,OAAO;AAAA,IACP,iBAAiB,EAAe,GAAQ,KAAK;AAAA,EAC/C;AACF,CAEK,GAGI,IAAA,CACX,GACA,GACA,MACG;AACH,QAAM,EAAE,SAAA,EAAA,IAAY,GACd,IAAiB,EAAgB,CAAK;AAC5C,MAAI,MAAY,EAAmB,kBAAkB,EACnD,QAAO;AAAA,IAAE,OAAO,EAAiB,GAAc,CAAK;AAAA,IAAG,mBAAmB;AAAA,EAAK;AAEjF,QAAM,IACJ,EAAe,CAAA;AACjB,SAAO;AAAA,IACL,OAAO,GAAQ,SAAS,EAAM,QAAQ,QAAQ;AAAA,IAC9C,mBAAmB,GAAQ,qBAAqB;AAAA,EAClD;AACF"}
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\n/** A bar chart variant's look: its layout entry, resolved with defaults. */\nexport interface BarChartVariantLayout {\n chartHeight?: number\n color: string\n showMonthlyAmount: boolean\n unselectedOpacity?: number\n}\n\nexport const barChartVariant = (\n instanceSlot: InstanceSlot,\n categoryGuid: string | undefined,\n theme: Theme,\n): BarChartVariantLayout => {\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: Partial<BarChartVariantLayout> | undefined =\n barChartLayout[variant as keyof typeof barChartLayout]\n return {\n chartHeight: layout?.chartHeight,\n color: layout?.color ?? theme.palette.primary.main,\n showMonthlyAmount: layout?.showMonthlyAmount ?? true,\n unselectedOpacity: layout?.unselectedOpacity,\n }\n}\n"],"mappings":";;;;;;AAWA,IAAa,IAAqB;AAAA,EAChC,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,0BAA0B;AAC5B,GAaa,IAAiB,yBAEjB,IAAA,CAAmB,MACzB,IAID,EAAK,OACA,EAAK,KAAK,IAAA,CAAK,MAAM;AAC1B,QAAM,IAAY,CAAC;AAEnB,SAAA,EAAK,OAAO,IAAA,CAAK,GAAM,MAAU;AAC/B,IAAA,EAAK,CAAA,IAAQ,EAAE,CAAA;AAAA,EACjB,CAAC,GACM;AACT,CAAC,IAEM,CAAC,IAbD,CAAC,GAiBC,IAAA,CACX,GACA,GACA,IAA+C,EAAkB,gBAEpD,CAAC,GAAG,CAAU,EACxB,KAAA,CAAM,GAAG,MACJ,CAAC,EAAE,QAAQ,CAAC,EAAE,OAAa,IAExB,IAAI,KAAK,EAAE,IAAI,EAAE,QAAQ,IAAI,IAAI,KAAK,EAAE,IAAI,EAAE,QAAQ,CAC9D,EACA,IAAA,CAAK,MAAU;AACd,QAAM,IAAQ,EAAM,OAAO,EAAW,EAAS,EAAM,IAAI,GAAG,CAAU,IAAK,EAAM,SAAS,IACpF,IAAS,EAAM,UAAU;AAE/B,SAAO;AAAA,IACL,WAAW,EAAiB,GAAW,GAAO,EAAe,GAAQ,MAAM,CAAC;AAAA,IAC5E,MAAM,EAAM,QAAQ;AAAA,IACpB,OAAA;AAAA,IACA,OAAO;AAAA,IACP,iBAAiB,EAAe,GAAQ,KAAK;AAAA,EAC/C;AACF,CAEK,GAWI,IAAA,CACX,GACA,GACA,MAC0B;AAC1B,QAAM,EAAE,SAAA,EAAA,IAAY,GACd,IAAiB,EAAgB,CAAK;AAC5C,MAAI,MAAY,EAAmB,kBAAkB,EACnD,QAAO;AAAA,IAAE,OAAO,EAAiB,GAAc,CAAK;AAAA,IAAG,mBAAmB;AAAA,EAAK;AAEjF,QAAM,IACJ,EAAe,CAAA;AACjB,SAAO;AAAA,IACL,aAAa,GAAQ;AAAA,IACrB,OAAO,GAAQ,SAAS,EAAM,QAAQ,QAAQ;AAAA,IAC9C,mBAAmB,GAAQ,qBAAqB;AAAA,IAChD,mBAAmB,GAAQ;AAAA,EAC7B;AACF"}
@@ -1,5 +1,5 @@
1
1
  import { useCategoryStore as H, useGlobalCopyStore as P, useGlobalStore as V } from "../../../../common/context/hooks.es.js";
2
- import { slot as s } from "../../../../core/types/Insights.es.js";
2
+ import { slot as c } from "../../../../core/types/Insights.es.js";
3
3
  import { formatCurrency as C } from "../../../../core/utils/NumberFormatting.es.js";
4
4
  import { getCategoryColor as I } from "../../../../core/utils/CategoryUtil.es.js";
5
5
  import { useBeatActions as U } from "../../../beatActions.es.js";
@@ -40,11 +40,11 @@ var u = 32, mo = Math.round(u * 0.625), lo = 24, T = 32, go = 20, fo = ({ icon:
40
40
  sx: { color: `${S(a?.color)}.contrastText` }
41
41
  })
42
42
  }) : null;
43
- }, po = (a, n, c, m) => {
43
+ }, po = (a, n, s, m) => {
44
44
  const o = J(a.logo, a.primary_text);
45
45
  if (o) {
46
46
  if (o.logo_name) {
47
- const i = !!o.logo_fill, e = o.logo_color ?? c.palette.chart.chart2 ?? c.palette.primary.main;
47
+ const i = !!o.logo_fill, e = o.logo_color ?? s.palette.chart.chart2 ?? s.palette.primary.main;
48
48
  return /* @__PURE__ */ r(d, {
49
49
  sx: {
50
50
  alignItems: "center",
@@ -54,7 +54,7 @@ var u = 32, mo = Math.round(u * 0.625), lo = 24, T = 32, go = 20, fo = ({ icon:
54
54
  width: u,
55
55
  ...i && {
56
56
  bgcolor: G(e, 0.15),
57
- borderRadius: "8px"
57
+ borderRadius: `${s.shape.borderRadius}px`
58
58
  }
59
59
  },
60
60
  children: /* @__PURE__ */ r(E, {
@@ -77,8 +77,8 @@ var u = 32, mo = Math.round(u * 0.625), lo = 24, T = 32, go = 20, fo = ({ icon:
77
77
  });
78
78
  if (o.category_guid) {
79
79
  const i = n(o.category_guid), e = m ? {
80
- bgcolor: G(I(i, c), 0.15),
81
- border: `1px solid ${I(i, c)}`,
80
+ bgcolor: G(I(i, s), 0.15),
81
+ border: `1px solid ${I(i, s)}`,
82
82
  color: "text.primary"
83
83
  } : void 0;
84
84
  return /* @__PURE__ */ r(d, {
@@ -93,18 +93,18 @@ var u = 32, mo = Math.round(u * 0.625), lo = 24, T = 32, go = 20, fo = ({ icon:
93
93
  }
94
94
  }
95
95
  }, Fo = no(({ payload: a }) => {
96
- const n = uo(), { getTopLevelCategoryGuid: c } = H(), m = V(), { recurring: o } = P(), { beat: i } = U(), { data: e, variant: B } = a.instance_slot, { answeredBackground: p, background: l, cardVariant: L, creditAmounts: k, elevated: O, followsSubscription: g, headerColor: R, raised: A, showFooter: $, showFrequency: y, showHeader: z, statusMessage: F, sx: N, tintedCategoryLogo: M } = X(eo(n), B, io.NoHeader, "TransactionBlock"), _ = (y || g) && i ? Y({
96
+ const n = uo(), { getTopLevelCategoryGuid: s } = H(), m = V(), { recurring: o } = P(), { beat: i } = U(), { data: e, variant: B } = a.instance_slot, { answeredBackground: p, background: l, cardVariant: L, creditAmounts: R, elevated: k, followsSubscription: g, headerColor: O, raised: A, showFooter: $, showFrequency: y, showHeader: z, statusMessage: F, sx: N, tintedCategoryLogo: M } = X(eo(n), B, io.NoHeader, "TransactionBlock"), _ = (y || g) && i ? Y({
97
97
  beat: i,
98
98
  stores: m
99
99
  }) : void 0, h = !!g && _?.user_response === W.CONFIRMED;
100
100
  if (F) {
101
- const t = s(e, "message");
101
+ const t = c(e, "message");
102
102
  return typeof t != "string" || !t.trim() ? (console.warn("[TransactionBlock] status_message has no message — rendering nothing."), null) : /* @__PURE__ */ r(to, {
103
103
  icon: /* @__PURE__ */ r(d, {
104
104
  "aria-hidden": "true",
105
105
  sx: { display: "flex" },
106
106
  children: /* @__PURE__ */ r(K, {
107
- logo: s(e, "icon"),
107
+ logo: c(e, "icon"),
108
108
  size: lo
109
109
  })
110
110
  }),
@@ -115,19 +115,19 @@ var u = 32, mo = Math.round(u * 0.625), lo = 24, T = 32, go = 20, fo = ({ icon:
115
115
  } : void 0
116
116
  });
117
117
  }
118
- const f = s(e, "series"), x = s(e, "header_text");
118
+ const f = c(e, "series"), b = c(e, "header_text");
119
119
  if (!Array.isArray(f) || !f.length) return null;
120
- const Z = z && typeof x == "string" ? x : void 0, b = s(e, "footer_text"), w = s(e, "footer_amount"), j = $ && typeof b == "string" ? {
121
- label: b,
120
+ const Z = z && typeof b == "string" ? b : void 0, x = c(e, "footer_text"), w = c(e, "footer_amount"), j = $ && typeof x == "string" ? {
121
+ label: x,
122
122
  amount: C(w, "0,0.00")
123
- } : void 0, q = y ? ro(o, _) : void 0, D = g ? /* @__PURE__ */ r(fo, { icon: s(e, h ? "reviewed_icon" : "icon") }) : void 0, v = (t) => !!k && typeof t == "number" && t > 0;
123
+ } : void 0, q = y ? ro(o, _) : void 0, D = g ? /* @__PURE__ */ r(fo, { icon: c(e, h ? "reviewed_icon" : "icon") }) : void 0, v = (t) => !!R && typeof t == "number" && t > 0;
124
124
  return /* @__PURE__ */ r(oo, {
125
125
  background: h && p ? p : l,
126
126
  badge: D,
127
- elevated: O,
127
+ elevated: k,
128
128
  footer: j,
129
129
  header: Z,
130
- headerColor: R,
130
+ headerColor: O,
131
131
  raised: A,
132
132
  sx: N,
133
133
  variant: L,
@@ -135,7 +135,7 @@ var u = 32, mo = Math.round(u * 0.625), lo = 24, T = 32, go = 20, fo = ({ icon:
135
135
  amount: typeof t.amount == "number" ? `${v(t.amount) ? "+" : ""}${C(t.amount, "0,0.00")}` : "",
136
136
  amountColor: v(t.amount) ? "success.main" : void 0,
137
137
  amountCaption: q,
138
- leading: po(t, c, n, M ?? !1),
138
+ leading: po(t, s, n, M ?? !1),
139
139
  subtitle: t.secondary_text ?? "",
140
140
  title: t.primary_text ?? ""
141
141
  }))
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\nimport type { Theme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore, useGlobalCopyStore, useGlobalStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport { useBeatActions } from '../../../beatActions'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\nimport { statusIconName, statusIconPalette } from '../../../components/statusIcon'\nimport { subscriptionFrequency } from '../../../components/SubscriptionStatus/subscriptionFrequency'\nimport { repeatingTransactionOf, USER_RESPONSE } from '../../../ctaActions/subscriptionAnswer'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig, transactionBlockVariant } from './layout'\n\ninterface TransactionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n// Same glyph-to-tile ratio mxui's `CategoryIcon` uses, so a status icon sits like the other logos.\nconst ROW_ICON_SIZE = Math.round(ROW_LOGO_SIZE * 0.625)\nconst STATUS_ICON_SIZE = 24\n// Status badge: palette disc, contrastText glyph.\nconst BADGE_SIZE = 32\nconst BADGE_GLYPH_SIZE = 20\n\n/** Status disc from `data.icon` / `data.reviewed_icon`. */\nconst SubscriptionBadge = ({ icon }: { icon?: LogoRef }) => {\n const name = statusIconName(icon?.guid)\n\n if (!name) return null\n\n return (\n <Box\n aria-hidden={true}\n data-icon={name}\n data-testid=\"subscription-badge\"\n sx={{\n alignItems: 'center',\n bgcolor: `${statusIconPalette(icon?.color)}.main`,\n borderRadius: '50%',\n display: 'flex',\n height: BADGE_SIZE,\n justifyContent: 'center',\n width: BADGE_SIZE,\n }}\n >\n <Icon\n fill={true}\n name={name}\n size={BADGE_GLYPH_SIZE}\n sx={{ color: `${statusIconPalette(icon?.color)}.contrastText` }}\n />\n </Box>\n )\n}\n\n/**\n * Renders the row's leading logo from its `LogoRef`: a status icon, or an entity guid whose prefix\n * names the entity. An unrecognized prefix renders no logo rather than guessing.\n *\n * `resolveTopLevelCategory`: mxui's `CategoryIcon` only knows the top-level category guids and\n * silently falls back to the Uncategorized icon for a sub-category. The details drawer avoids\n * this by passing `transaction.top_level_category_guid`; the row only has the raw guid, so it is\n * walked up to its parent here (identity until categories load). That resolution applies both to a\n * `CAT-` row logo and to a merchant's `fallback_guid`. The tinted/bordered tile is opt-in per variant\n * (`tintedCategoryLogo`) and only styles the `CAT-` row branch; a merchant's `fallback_guid` is drawn\n * by `MerchantLogo`'s own untinted `CategoryIcon` fallback when the merchant image fails to load.\n */\nconst renderRowLogo = (\n row: InstanceSlotRow,\n resolveTopLevelCategory: (guid: string) => string,\n theme: Theme,\n tintedCategoryLogo: boolean,\n) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A `{ icon, color }` status logo (e.g. an overdraft warning) renders as a bare coloured glyph.\n // An ICO- fill logo (the Weekly New Merchants \"Others\" row - `logo_fill` is set for ICO- refs\n // only, in EntityLogo) renders as an accent tile: per the MX accent-icon pattern the background is\n // the tile colour at 15% opacity and the glyph is the full tile colour (Figma). The tile colour is\n // the logo's own colour when it carries one, else chart-2 - so tile and glyph always match.\n const accentTile = !!logo.logo_fill\n const tileColor = logo.logo_color ?? theme.palette.chart.chart2 ?? theme.palette.primary.main\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: ROW_LOGO_SIZE,\n justifyContent: 'center',\n width: ROW_LOGO_SIZE,\n ...(accentTile && {\n bgcolor: alpha(tileColor, 0.15),\n borderRadius: '8px',\n }),\n }}\n >\n <Icon\n name={logo.logo_name}\n size={ROW_ICON_SIZE}\n sx={{ color: accentTile ? tileColor : logo.logo_color }}\n />\n </Box>\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? resolveTopLevelCategory(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name ?? ''}\n institutionGuid={logo.institution_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.category_guid) {\n const topLevelGuid = resolveTopLevelCategory(logo.category_guid)\n // When the variant opts in (`tintedCategoryLogo`), the tile is the Budget-style accent: the\n // category colour at 15% opacity, a 1px category-colour border, and a `text.primary` glyph\n // (Figma - Replenish Savings' multi-account Transfer row). Otherwise mxui's default tile, so other\n // beats' category logos are unchanged.\n const tintSx = tintedCategoryLogo\n ? {\n bgcolor: alpha(getCategoryColor(topLevelGuid, theme), 0.15),\n border: `1px solid ${getCategoryColor(topLevelGuid, theme)}`,\n color: 'text.primary',\n }\n : undefined\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} sx={tintSx} />\n </Box>\n )\n }\n\n return undefined\n}\n\n/**\n * The `transaction_block`: rows the backend already localized, carried inline on\n * `instance_slot.data.series` (`logo`, `primary_text`, `secondary_text`, `amount`). Only the\n * amount is formatted here, because the contract sends it as a number. `instance_slot.variant`\n * picks the header and slot treatment from `./layout.ts`.\n *\n * This is the full/mini shape. The reduced widgets (micro, embedded) resolve to the row logo\n * alone, carried flat on `data.logo` with no `series`, and are drawn by `CompactInsightCard`.\n *\n * `status_message` draws no rows: `data.message` beside the `data.icon` logo, as a\n * `StatusMessageCard` banner (Uncategorized Transactions V2 `complete`).\n *\n * A header, when the variant shows one, comes from `instance_slot.data.header_text` (the\n * transaction date, or \"{count} transactions\"). It deliberately does *not* come from the first\n * row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here\n * rendered the category twice and dropped the date entirely.\n *\n * A footer/summary row (Replenish Savings' \"Remaining Balance\", Weekly New Merchants' \"Total\")\n * renders when the variant's `showFooter` config is set (`with_header_footer`, `with_footer`), from\n * `data.footer_text` with `data.footer_amount` beside it, formatted like the row amounts (the\n * contract sends it as a number).\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const stores = useGlobalStore()\n const { recurring: recurringCopy } = useGlobalCopyStore()\n const { beat } = useBeatActions()\n const { data, variant } = payload.instance_slot\n // The plain row is the safe default: it adds nothing a wrong variant could misstate.\n const {\n answeredBackground,\n background,\n cardVariant,\n creditAmounts,\n elevated,\n followsSubscription,\n headerColor,\n raised,\n showFooter,\n showFrequency,\n showHeader,\n statusMessage,\n sx,\n tintedCategoryLogo,\n } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n // The live repeating transaction (read-only), for the frequency and the badge / answered wash.\n const repeating =\n (showFrequency || followsSubscription) && beat\n ? repeatingTransactionOf({ beat, stores })\n : undefined\n const subscribed = !!followsSubscription && repeating?.user_response === USER_RESPONSE.CONFIRMED\n\n if (statusMessage) {\n const message = slot<string>(data, 'message')\n if (typeof message !== 'string' || !message.trim()) {\n console.warn('[TransactionBlock] status_message has no message — rendering nothing.')\n return null\n }\n\n // The icon only decorates the message, so it is hidden from the status announcement.\n return (\n <StatusMessageCard\n icon={\n <Box aria-hidden=\"true\" sx={{ display: 'flex' }}>\n <LogoFromGuid logo={slot<LogoRef>(data, 'icon')} size={STATUS_ICON_SIZE} />\n </Box>\n }\n message={message}\n // The 20% wash layers over paper, as Figma's slot does.\n sx={background ? { backgroundImage: background, bgcolor: 'background.paper' } : undefined}\n />\n )\n }\n\n const series = slot<InstanceSlotRow[]>(data, 'series')\n const headerText = slot<string>(data, 'header_text')\n\n if (!Array.isArray(series) || !series.length) return null\n\n const header = showHeader && typeof headerText === 'string' ? headerText : undefined\n\n const footerText = slot<string>(data, 'footer_text')\n const footerAmount = slot<number>(data, 'footer_amount')\n const footer =\n showFooter && typeof footerText === 'string'\n ? {\n label: footerText,\n amount: formatCurrency(footerAmount, '0,0.00'),\n }\n : undefined\n\n // Live, as pulse: the repeating transaction the CTA's `prepare` loads.\n const frequency = showFrequency ? subscriptionFrequency(recurringCopy, repeating) : undefined\n const badge = followsSubscription ? (\n <SubscriptionBadge icon={slot<LogoRef>(data, subscribed ? 'reviewed_icon' : 'icon')} />\n ) : undefined\n\n // Only a positive amount reads as a credit.\n const isCredit = (amount: unknown) => !!creditAmounts && typeof amount === 'number' && amount > 0\n\n return (\n <TransactionListCard\n background={subscribed && answeredBackground ? answeredBackground : background}\n badge={badge}\n elevated={elevated}\n footer={footer}\n header={header}\n headerColor={headerColor}\n raised={raised}\n sx={sx}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount:\n typeof row.amount === 'number'\n ? `${isCredit(row.amount) ? '+' : ''}${formatCurrency(row.amount, '0,0.00')}`\n : '',\n amountColor: isCredit(row.amount) ? 'success.main' : undefined,\n amountCaption: frequency,\n leading: renderRowLogo(row, getTopLevelCategoryGuid, theme, tintedCategoryLogo ?? false),\n subtitle: row.secondary_text ?? '',\n title: row.primary_text ?? '',\n }))}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,IAAM,IAAgB,IAEhB,KAAgB,KAAK,MAAM,IAAgB,KAAK,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EAAI,CAAA,IACpF,QAGE,IAAA,CAAY,MAAoB,CAAC,CAAC,KAAiB,OAAO,KAAW,YAAY,IAAS;AAEhG,SACE,gBAAA,EAAC,IAAD;AAAA,IACE,YAAY,KAAc,IAAqB,IAAqB;AAAA,IAC7D,OAAA;AAAA,IACG,UAAA;AAAA,IACF,QAAA;AAAA,IACA,QAAA;AAAA,IACK,aAAA;AAAA,IACL,QAAA;AAAA,IACJ,IAAA;AAAA,IACJ,SAAS;AAAA,IACT,MAAM,EAAO,IAAA,CAAK,OAAS;AAAA,MACzB,QACE,OAAO,EAAI,UAAW,WAClB,GAAG,EAAS,EAAI,MAAM,IAAI,MAAM,EAAA,GAAK,EAAe,EAAI,QAAQ,QAAQ,CAAA,KACxE;AAAA,MACN,aAAa,EAAS,EAAI,MAAM,IAAI,iBAAiB;AAAA,MACrD,eAAe;AAAA,MACf,SAAS,GAAc,GAAK,GAAyB,GAAO,KAAsB,EAAK;AAAA,MACvF,UAAU,EAAI,kBAAkB;AAAA,MAChC,OAAO,EAAI,gBAAgB;AAAA,IAC7B,EAAE;AAAA,EACH,CAAA;AAEL,CAAC"}
1
+ {"version":3,"file":"TransactionBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\nimport type { Theme } from '@mui/material/styles'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { useCategoryStore, useGlobalCopyStore, useGlobalStore } from '../../../../common'\nimport { slot } from '../../../../core'\nimport type { InsightsPayload, InstanceSlotRow, LogoRef } from '../../../../core'\nimport { getCategoryColor } from '../../../../core/utils/CategoryUtil'\nimport { formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport { useBeatActions } from '../../../beatActions'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport StatusMessageCard from '../../../components/StatusMessageCard'\nimport TransactionListCard from '../../../components/TransactionListCard'\nimport { logoFromRef } from '../../../components/shared/EntityLogo'\nimport { statusIconName, statusIconPalette } from '../../../components/statusIcon'\nimport { subscriptionFrequency } from '../../../components/SubscriptionStatus/subscriptionFrequency'\nimport { repeatingTransactionOf, USER_RESPONSE } from '../../../ctaActions/subscriptionAnswer'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { getLayoutConfig, transactionBlockVariant } from './layout'\n\ninterface TransactionBlockProps {\n payload: InsightsPayload\n beatGuid?: string\n}\n\nconst ROW_LOGO_SIZE = 32\n// Same glyph-to-tile ratio mxui's `CategoryIcon` uses, so a status icon sits like the other logos.\nconst ROW_ICON_SIZE = Math.round(ROW_LOGO_SIZE * 0.625)\nconst STATUS_ICON_SIZE = 24\n// Status badge: palette disc, contrastText glyph.\nconst BADGE_SIZE = 32\nconst BADGE_GLYPH_SIZE = 20\n\n/** Status disc from `data.icon` / `data.reviewed_icon`. */\nconst SubscriptionBadge = ({ icon }: { icon?: LogoRef }) => {\n const name = statusIconName(icon?.guid)\n\n if (!name) return null\n\n return (\n <Box\n aria-hidden={true}\n data-icon={name}\n data-testid=\"subscription-badge\"\n sx={{\n alignItems: 'center',\n bgcolor: `${statusIconPalette(icon?.color)}.main`,\n borderRadius: '50%',\n display: 'flex',\n height: BADGE_SIZE,\n justifyContent: 'center',\n width: BADGE_SIZE,\n }}\n >\n <Icon\n fill={true}\n name={name}\n size={BADGE_GLYPH_SIZE}\n sx={{ color: `${statusIconPalette(icon?.color)}.contrastText` }}\n />\n </Box>\n )\n}\n\n/**\n * Renders the row's leading logo from its `LogoRef`: a status icon, or an entity guid whose prefix\n * names the entity. An unrecognized prefix renders no logo rather than guessing.\n *\n * `resolveTopLevelCategory`: mxui's `CategoryIcon` only knows the top-level category guids and\n * silently falls back to the Uncategorized icon for a sub-category. The details drawer avoids\n * this by passing `transaction.top_level_category_guid`; the row only has the raw guid, so it is\n * walked up to its parent here (identity until categories load). That resolution applies both to a\n * `CAT-` row logo and to a merchant's `fallback_guid`. The tinted/bordered tile is opt-in per variant\n * (`tintedCategoryLogo`) and only styles the `CAT-` row branch; a merchant's `fallback_guid` is drawn\n * by `MerchantLogo`'s own untinted `CategoryIcon` fallback when the merchant image fails to load.\n */\nconst renderRowLogo = (\n row: InstanceSlotRow,\n resolveTopLevelCategory: (guid: string) => string,\n theme: Theme,\n tintedCategoryLogo: boolean,\n) => {\n const logo = logoFromRef(row.logo, row.primary_text)\n\n if (!logo) return undefined\n\n if (logo.logo_name) {\n // A `{ icon, color }` status logo (e.g. an overdraft warning) renders as a bare coloured glyph.\n // An ICO- fill logo (the Weekly New Merchants \"Others\" row - `logo_fill` is set for ICO- refs\n // only, in EntityLogo) renders as an accent tile: per the MX accent-icon pattern the background is\n // the tile colour at 15% opacity and the glyph is the full tile colour (Figma). The tile colour is\n // the logo's own colour when it carries one, else chart-2 - so tile and glyph always match.\n const accentTile = !!logo.logo_fill\n const tileColor = logo.logo_color ?? theme.palette.chart.chart2 ?? theme.palette.primary.main\n return (\n <Box\n sx={{\n alignItems: 'center',\n display: 'flex',\n height: ROW_LOGO_SIZE,\n justifyContent: 'center',\n width: ROW_LOGO_SIZE,\n ...(accentTile && {\n bgcolor: alpha(tileColor, 0.15),\n // Figma: match the row's other logo tiles.\n borderRadius: `${theme.shape.borderRadius}px`,\n }),\n }}\n >\n <Icon\n name={logo.logo_name}\n size={ROW_ICON_SIZE}\n sx={{ color: accentTile ? tileColor : logo.logo_color }}\n />\n </Box>\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? resolveTopLevelCategory(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name ?? ''}\n institutionGuid={logo.institution_guid}\n size={ROW_LOGO_SIZE}\n />\n )\n }\n\n if (logo.category_guid) {\n const topLevelGuid = resolveTopLevelCategory(logo.category_guid)\n // When the variant opts in (`tintedCategoryLogo`), the tile is the Budget-style accent: the\n // category colour at 15% opacity, a 1px category-colour border, and a `text.primary` glyph\n // (Figma - Replenish Savings' multi-account Transfer row). Otherwise mxui's default tile, so other\n // beats' category logos are unchanged.\n const tintSx = tintedCategoryLogo\n ? {\n bgcolor: alpha(getCategoryColor(topLevelGuid, theme), 0.15),\n border: `1px solid ${getCategoryColor(topLevelGuid, theme)}`,\n color: 'text.primary',\n }\n : undefined\n return (\n <Box data-testid={`category-icon-${topLevelGuid}`} sx={{ display: 'flex' }}>\n <CategoryIcon categoryGuid={topLevelGuid} size={ROW_LOGO_SIZE} sx={tintSx} />\n </Box>\n )\n }\n\n return undefined\n}\n\n/**\n * The `transaction_block`: rows the backend already localized, carried inline on\n * `instance_slot.data.series` (`logo`, `primary_text`, `secondary_text`, `amount`). Only the\n * amount is formatted here, because the contract sends it as a number. `instance_slot.variant`\n * picks the header and slot treatment from `./layout.ts`.\n *\n * This is the full/mini shape. The reduced widgets (micro, embedded) resolve to the row logo\n * alone, carried flat on `data.logo` with no `series`, and are drawn by `CompactInsightCard`.\n *\n * `status_message` draws no rows: `data.message` beside the `data.icon` logo, as a\n * `StatusMessageCard` banner (Uncategorized Transactions V2 `complete`).\n *\n * A header, when the variant shows one, comes from `instance_slot.data.header_text` (the\n * transaction date, or \"{count} transactions\"). It deliberately does *not* come from the first\n * row: on a `with_merchant` card a row's `secondary_text` is the category, so reading it here\n * rendered the category twice and dropped the date entirely.\n *\n * A footer/summary row (Replenish Savings' \"Remaining Balance\", Weekly New Merchants' \"Total\")\n * renders when the variant's `showFooter` config is set (`with_header_footer`, `with_footer`), from\n * `data.footer_text` with `data.footer_amount` beside it, formatted like the row amounts (the\n * contract sends it as a number).\n */\nexport const TransactionBlock = observer(({ payload }: TransactionBlockProps) => {\n const theme = useTheme()\n const { getTopLevelCategoryGuid } = useCategoryStore()\n const stores = useGlobalStore()\n const { recurring: recurringCopy } = useGlobalCopyStore()\n const { beat } = useBeatActions()\n const { data, variant } = payload.instance_slot\n // The plain row is the safe default: it adds nothing a wrong variant could misstate.\n const {\n answeredBackground,\n background,\n cardVariant,\n creditAmounts,\n elevated,\n followsSubscription,\n headerColor,\n raised,\n showFooter,\n showFrequency,\n showHeader,\n statusMessage,\n sx,\n tintedCategoryLogo,\n } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n transactionBlockVariant.NoHeader,\n 'TransactionBlock',\n )\n\n // The live repeating transaction (read-only), for the frequency and the badge / answered wash.\n const repeating =\n (showFrequency || followsSubscription) && beat\n ? repeatingTransactionOf({ beat, stores })\n : undefined\n const subscribed = !!followsSubscription && repeating?.user_response === USER_RESPONSE.CONFIRMED\n\n if (statusMessage) {\n const message = slot<string>(data, 'message')\n if (typeof message !== 'string' || !message.trim()) {\n console.warn('[TransactionBlock] status_message has no message — rendering nothing.')\n return null\n }\n\n // The icon only decorates the message, so it is hidden from the status announcement.\n return (\n <StatusMessageCard\n icon={\n <Box aria-hidden=\"true\" sx={{ display: 'flex' }}>\n <LogoFromGuid logo={slot<LogoRef>(data, 'icon')} size={STATUS_ICON_SIZE} />\n </Box>\n }\n message={message}\n // The 20% wash layers over paper, as Figma's slot does.\n sx={background ? { backgroundImage: background, bgcolor: 'background.paper' } : undefined}\n />\n )\n }\n\n const series = slot<InstanceSlotRow[]>(data, 'series')\n const headerText = slot<string>(data, 'header_text')\n\n if (!Array.isArray(series) || !series.length) return null\n\n const header = showHeader && typeof headerText === 'string' ? headerText : undefined\n\n const footerText = slot<string>(data, 'footer_text')\n const footerAmount = slot<number>(data, 'footer_amount')\n const footer =\n showFooter && typeof footerText === 'string'\n ? {\n label: footerText,\n amount: formatCurrency(footerAmount, '0,0.00'),\n }\n : undefined\n\n // Live, as pulse: the repeating transaction the CTA's `prepare` loads.\n const frequency = showFrequency ? subscriptionFrequency(recurringCopy, repeating) : undefined\n const badge = followsSubscription ? (\n <SubscriptionBadge icon={slot<LogoRef>(data, subscribed ? 'reviewed_icon' : 'icon')} />\n ) : undefined\n\n // Only a positive amount reads as a credit.\n const isCredit = (amount: unknown) => !!creditAmounts && typeof amount === 'number' && amount > 0\n\n return (\n <TransactionListCard\n background={subscribed && answeredBackground ? answeredBackground : background}\n badge={badge}\n elevated={elevated}\n footer={footer}\n header={header}\n headerColor={headerColor}\n raised={raised}\n sx={sx}\n variant={cardVariant}\n rows={series.map((row) => ({\n amount:\n typeof row.amount === 'number'\n ? `${isCredit(row.amount) ? '+' : ''}${formatCurrency(row.amount, '0,0.00')}`\n : '',\n amountColor: isCredit(row.amount) ? 'success.main' : undefined,\n amountCaption: frequency,\n leading: renderRowLogo(row, getTopLevelCategoryGuid, theme, tintedCategoryLogo ?? false),\n subtitle: row.secondary_text ?? '',\n title: row.primary_text ?? '',\n }))}\n />\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAgCA,IAAM,IAAgB,IAEhB,KAAgB,KAAK,MAAM,IAAgB,KAAK,GAChD,KAAmB,IAEnB,IAAa,IACb,KAAmB,IAGnB,KAAA,CAAqB,EAAE,MAAA,EAAA,MAA+B;AAC1D,QAAM,IAAO,EAAe,GAAM,IAAI;AAEtC,SAAK,IAGH,gBAAA,EAAC,GAAD;AAAA,IACE,eAAa;AAAA,IACb,aAAW;AAAA,IACX,eAAY;AAAA,IACZ,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,SAAS,GAAG,EAAkB,GAAM,KAAK,CAAA;AAAA,MACzC,cAAc;AAAA,MACd,SAAS;AAAA,MACT,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,OAAO;AAAA,IACT;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACA,MAAA;AAAA,MACN,MAAM;AAAA,MACN,IAAI,EAAE,OAAO,GAAG,EAAkB,GAAM,KAAK,CAAA,gBAAiB;AAAA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AAA,MACf,SAAS,GAAc,GAAK,GAAyB,GAAO,KAAsB,EAAK;AAAA,MACvF,UAAU,EAAI,kBAAkB;AAAA,MAChC,OAAO,EAAI,gBAAgB;AAAA,IAC7B,EAAE;AAAA,EACH,CAAA;AAEL,CAAC"}
@@ -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, showMonthlyAmount, 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, unselectedOpacity, }: BarChartV2Props) => import("react/jsx-runtime").JSX.Element;