@mx-cartographer/experiences 9.7.41 → 9.7.43

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 (43) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/dist/core/types/InsightsInstanceSlotData.d.ts +9 -1
  3. package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
  4. package/dist/core/types/localization/InsightsFeedCopy.d.ts +3 -0
  5. package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.es.js +20 -14
  6. package/dist/insights-v2/actionBlocks/ConnectWidgetActionBlock.es.js.map +1 -1
  7. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +3 -1
  8. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +85 -75
  9. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  10. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +115 -93
  11. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  12. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +3 -1
  13. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +66 -44
  14. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  15. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.d.ts +1 -1
  16. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js +49 -44
  17. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/utils.es.js.map +1 -1
  18. package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +4 -0
  19. package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +4 -0
  20. package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -1
  21. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.d.ts +1 -1
  22. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js +19 -19
  23. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js.map +1 -1
  24. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.d.ts +8 -1
  25. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js +47 -31
  26. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/comparisonUtils.es.js.map +1 -1
  27. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.d.ts +1 -5
  28. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js +10 -6
  29. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.es.js.map +1 -1
  30. package/dist/insights-v2/blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.d.ts +5 -2
  31. package/dist/insights-v2/blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js +21 -23
  32. package/dist/insights-v2/blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.es.js.map +1 -1
  33. package/dist/insights-v2/components/CompactInsightCard.es.js +148 -82
  34. package/dist/insights-v2/components/CompactInsightCard.es.js.map +1 -1
  35. package/dist/insights-v2/components/SubTabs.d.ts +22 -0
  36. package/dist/insights-v2/components/SubTabs.es.js +38 -0
  37. package/dist/insights-v2/components/SubTabs.es.js.map +1 -0
  38. package/dist/insights-v2/components/chartblocks/ChartLegend.es.js +14 -18
  39. package/dist/insights-v2/components/chartblocks/ChartLegend.es.js.map +1 -1
  40. package/dist/insights-v2/components/chartblocks/DoubleBarChart.d.ts +5 -3
  41. package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js +108 -104
  42. package/dist/insights-v2/components/chartblocks/DoubleBarChart.es.js.map +1 -1
  43. package/package.json +1 -1
@@ -1,10 +1,14 @@
1
- var a = (t, o) => ({
2
- SpendToIncome: { color: [t.palette.categories.billsUtilities, t.palette.chart.chart1] },
3
- DebtToIncome: { color: [t.palette.chart.chart5, t.palette.chart.chart1] },
4
- SavingsToIncome: { color: [t.palette.chartMono.chartMono5, t.palette.chartMono.chartMono3] }
5
- })[o];
1
+ var a = (o) => ({ color: [o.palette.categories.billsUtilities, o.palette.chart.chart1] }), r = (o, t) => {
2
+ const c = {
3
+ SpendToIncome: a(o),
4
+ spend_to_income: a(o),
5
+ DebtToIncome: { color: [o.palette.chart.chart5, o.palette.chart.chart1] },
6
+ SavingsToIncome: { color: [o.palette.chartMono.chartMono5, o.palette.chartMono.chartMono3] }
7
+ };
8
+ return t && Object.hasOwn(c, t) ? c[t] : void 0;
9
+ };
6
10
  export {
7
- a as getLayoutConfig
11
+ r as getLayoutConfig
8
12
  };
9
13
 
10
14
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\nexport const getLayoutConfig = (theme: Theme, variant?: string | null) => {\n const config = {\n SpendToIncome: {\n color: [theme.palette.categories.billsUtilities, theme.palette.chart.chart1] as string[],\n },\n DebtToIncome: {\n color: [theme.palette.chart.chart5, theme.palette.chart.chart1] as string[],\n },\n SavingsToIncome: {\n color: [theme.palette.chartMono.chartMono5, theme.palette.chartMono.chartMono3] as string[],\n },\n }\n return config[variant as keyof typeof config]\n}\n"],"mappings":"AAEA,IAAa,IAAA,CAAmB,GAAc,OAYrC;AAAA,EAVL,eAAe,EACb,OAAO,CAAC,EAAM,QAAQ,WAAW,gBAAgB,EAAM,QAAQ,MAAM,MAAM,EAC7E;AAAA,EACA,cAAc,EACZ,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM,EAChE;AAAA,EACA,iBAAiB,EACf,OAAO,CAAC,EAAM,QAAQ,UAAU,YAAY,EAAM,QAAQ,UAAU,UAAU,EAChF;AAEK,GAAO,CAAA"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/layout.ts"],"sourcesContent":["import type { Theme } from '@mui/material/styles'\n\n// One palette per comparison; ditto's snake_case variant shares the legacy PascalCase entry's palette.\nconst spendToIncome = (theme: Theme) => ({\n color: [theme.palette.categories.billsUtilities, theme.palette.chart.chart1] as string[],\n})\n\nexport const getLayoutConfig = (theme: Theme, variant?: string | null) => {\n const config = {\n SpendToIncome: spendToIncome(theme),\n // Insights 2.0: ditto's layout variant for Monthly Spend to Income Comparison.\n spend_to_income: spendToIncome(theme),\n DebtToIncome: {\n color: [theme.palette.chart.chart5, theme.palette.chart.chart1] as string[],\n },\n SavingsToIncome: {\n color: [theme.palette.chartMono.chartMono5, theme.palette.chartMono.chartMono3] as string[],\n },\n }\n // Object.hasOwn: the variant is backend-controlled, and an inherited name like `constructor`\n // would otherwise return a truthy non-config.\n return variant && Object.hasOwn(config, variant)\n ? config[variant as keyof typeof config]\n : undefined\n}\n"],"mappings":"AAGA,IAAM,IAAA,CAAiB,OAAkB,EACvC,OAAO,CAAC,EAAM,QAAQ,WAAW,gBAAgB,EAAM,QAAQ,MAAM,MAAM,EAC7E,IAEa,IAAA,CAAmB,GAAc,MAA4B;AACxE,QAAM,IAAS;AAAA,IACb,eAAe,EAAc,CAAK;AAAA,IAElC,iBAAiB,EAAc,CAAK;AAAA,IACpC,cAAc,EACZ,OAAO,CAAC,EAAM,QAAQ,MAAM,QAAQ,EAAM,QAAQ,MAAM,MAAM,EAChE;AAAA,IACA,iBAAiB,EACf,OAAO,CAAC,EAAM,QAAQ,UAAU,YAAY,EAAM,QAAQ,UAAU,UAAU,EAChF;AAAA,EACF;AAGA,SAAO,KAAW,OAAO,OAAO,GAAQ,CAAO,IAC3C,EAAO,CAAA,IACP;AACN"}
@@ -1,8 +1,11 @@
1
- import { AccountSwitchBlockData } from '../../../../core/types/InsightsInstanceSlotData';
2
1
  import { BlockProps } from '../../types';
3
2
  /**
4
3
  * Two institution logos on a transfer track, shared by Discovered Accounts and Switch
5
4
  * Direct Deposit. `instance_slot.variant` picks the design branch from `./layout.ts`.
5
+ *
6
+ * The logos are the `from_logo` / `to_logo` slots on `instance_slot.data`; `LogoFromGuid` draws
7
+ * nothing for a missing slot or a guid that is not a logo guid (tupac omits `to_logo` when the user
8
+ * holds no FI-managed account).
6
9
  */
7
- declare const AccountSwitchBlock: ({ payload }: BlockProps<AccountSwitchBlockData>) => import("react/jsx-runtime").JSX.Element;
10
+ declare const AccountSwitchBlock: ({ payload }: BlockProps) => import("react/jsx-runtime").JSX.Element;
8
11
  export default AccountSwitchBlock;
@@ -1,34 +1,32 @@
1
- import { resolveVariantConfig as _ } from "../../resolveVariantConfig.es.js";
2
- import l from "../../../components/TransferLogoCard.es.js";
3
- import { accountSwitchVariant as g, getLayoutConfig as h } from "./layout.es.js";
4
- import { InstitutionLogo as i } from "@mxenabled/mxui";
5
- import { Icon as p } from "@mxenabled/mx-icons";
6
- import { jsx as t } from "react/jsx-runtime";
7
- import { useTheme as v } from "@mui/material/styles";
8
- var n = 64, A = ({ payload: o }) => {
9
- const r = v(), { variant: e } = o.instance_slot, { discovered_institution_guid: c, discovered_institution_name: s, held_institution_guid: a, held_institution_name: m } = o.instance_slot_data, { badgeIcon: u, badgeIconColor: d, ...f } = _(h(r), e, g.AccountConnect, "AccountSwitchBlock");
10
- return /* @__PURE__ */ t(l, {
11
- ...f,
12
- from: /* @__PURE__ */ t(i, {
13
- alt: s,
14
- institutionGuid: c,
15
- size: n
1
+ import r from "../../../components/LogoFromGuid.es.js";
2
+ import { resolveVariantConfig as l } from "../../resolveVariantConfig.es.js";
3
+ import u from "../../../components/TransferLogoCard.es.js";
4
+ import { accountSwitchVariant as d, getLayoutConfig as p } from "./layout.es.js";
5
+ import { Icon as h } from "@mxenabled/mx-icons";
6
+ import { jsx as o } from "react/jsx-runtime";
7
+ import { useTheme as C } from "@mui/material/styles";
8
+ var t = 64, z = ({ payload: c }) => {
9
+ const n = C(), { data: a, variant: i } = c.instance_slot, { from_logo: e, to_logo: m } = a ?? {}, { badgeIcon: s, badgeIconColor: f, ...g } = l(p(n), i, d.AccountConnect, "AccountSwitchBlock");
10
+ return /* @__PURE__ */ o(u, {
11
+ ...g,
12
+ from: /* @__PURE__ */ o(r, {
13
+ logo: e,
14
+ size: t
16
15
  }),
17
- icon: /* @__PURE__ */ t(p, {
16
+ icon: /* @__PURE__ */ o(h, {
18
17
  "aria-hidden": !0,
19
- name: u,
18
+ name: s,
20
19
  size: 20,
21
- sx: { color: d }
20
+ sx: { color: f }
22
21
  }),
23
- to: /* @__PURE__ */ t(i, {
24
- alt: m,
25
- institutionGuid: a,
26
- size: n
22
+ to: /* @__PURE__ */ o(r, {
23
+ logo: m,
24
+ size: t
27
25
  })
28
26
  });
29
27
  };
30
28
  export {
31
- A as default
29
+ z as default
32
30
  };
33
31
 
34
32
  //# sourceMappingURL=AccountSwitchBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"AccountSwitchBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.tsx"],"sourcesContent":["import { useTheme } from '@mui/material/styles'\nimport { InstitutionLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport type { AccountSwitchBlockData } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport TransferLogoCard from '../../../components/TransferLogoCard'\n\nimport type { BlockProps } from '../../types'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { accountSwitchVariant, getLayoutConfig } from './layout'\n\nconst LOGO_SIZE = 64\n\n/**\n * Two institution logos on a transfer track, shared by Discovered Accounts and Switch\n * Direct Deposit. `instance_slot.variant` picks the design branch from `./layout.ts`.\n */\nconst AccountSwitchBlock = ({ payload }: BlockProps<AccountSwitchBlockData>) => {\n const theme = useTheme()\n const { variant } = payload.instance_slot\n const {\n discovered_institution_guid,\n discovered_institution_name,\n held_institution_guid,\n held_institution_name,\n } = payload.instance_slot_data\n\n // Pending connect is the safe default: it promises nothing (no success badge, no confetti).\n const { badgeIcon, badgeIconColor, ...cardProps } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n accountSwitchVariant.AccountConnect,\n 'AccountSwitchBlock',\n )\n\n return (\n <TransferLogoCard\n {...cardProps}\n from={\n <InstitutionLogo\n alt={discovered_institution_name}\n institutionGuid={discovered_institution_guid}\n size={LOGO_SIZE}\n />\n }\n icon={<Icon aria-hidden={true} name={badgeIcon} size={20} sx={{ color: badgeIconColor }} />}\n to={\n <InstitutionLogo\n alt={held_institution_name}\n institutionGuid={held_institution_guid}\n size={LOGO_SIZE}\n />\n }\n />\n )\n}\n\nexport default AccountSwitchBlock\n"],"mappings":";;;;;;;AAYA,IAAM,IAAY,IAMZ,IAAA,CAAsB,EAAE,SAAA,EAAA,MAAkD;AAC9E,QAAM,IAAQ,EAAS,GACjB,EAAE,SAAA,EAAA,IAAY,EAAQ,eACtB,EACJ,6BAAA,GACA,6BAAA,GACA,uBAAA,GACA,uBAAA,EAAA,IACE,EAAQ,oBAGN,EAAE,WAAA,GAAW,gBAAA,GAAgB,GAAG,EAAA,IAAc,EAClD,EAAgB,CAAK,GACrB,GACA,EAAqB,gBACrB,oBACF;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,MACE,gBAAA,EAAC,GAAD;AAAA,MACE,KAAK;AAAA,MACL,iBAAiB;AAAA,MACjB,MAAM;AAAA,IACP,CAAA;AAAA,IAEH,MAAM,gBAAA,EAAC,GAAD;AAAA,MAAM,eAAa;AAAA,MAAM,MAAM;AAAA,MAAW,MAAM;AAAA,MAAI,IAAI,EAAE,OAAO,EAAe;AAAA,IAAI,CAAA;AAAA,IAC1F,IACE,gBAAA,EAAC,GAAD;AAAA,MACE,KAAK;AAAA,MACL,iBAAiB;AAAA,MACjB,MAAM;AAAA,IACP,CAAA;AAAA,EAEJ,CAAA;AAEL"}
1
+ {"version":3,"file":"AccountSwitchBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/AccountSwitchBlock/AccountSwitchBlock.tsx"],"sourcesContent":["import { useTheme } from '@mui/material/styles'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport type { AccountSwitchBlockV2Data } from '../../../../core/types/InsightsInstanceSlotData'\n\nimport LogoFromGuid from '../../../components/LogoFromGuid'\nimport TransferLogoCard from '../../../components/TransferLogoCard'\n\nimport type { BlockProps } from '../../types'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { accountSwitchVariant, getLayoutConfig } from './layout'\n\nconst LOGO_SIZE = 64\n\n/**\n * Two institution logos on a transfer track, shared by Discovered Accounts and Switch\n * Direct Deposit. `instance_slot.variant` picks the design branch from `./layout.ts`.\n *\n * The logos are the `from_logo` / `to_logo` slots on `instance_slot.data`; `LogoFromGuid` draws\n * nothing for a missing slot or a guid that is not a logo guid (tupac omits `to_logo` when the user\n * holds no FI-managed account).\n */\nconst AccountSwitchBlock = ({ payload }: BlockProps) => {\n const theme = useTheme()\n const { data, variant } = payload.instance_slot\n const { from_logo, to_logo } = (data ?? {}) as AccountSwitchBlockV2Data\n\n // Pending connect is the safe default: it promises nothing (no success badge, no confetti).\n const { badgeIcon, badgeIconColor, ...cardProps } = resolveVariantConfig(\n getLayoutConfig(theme),\n variant,\n accountSwitchVariant.AccountConnect,\n 'AccountSwitchBlock',\n )\n\n return (\n <TransferLogoCard\n {...cardProps}\n from={<LogoFromGuid logo={from_logo} size={LOGO_SIZE} />}\n icon={<Icon aria-hidden={true} name={badgeIcon} size={20} sx={{ color: badgeIconColor }} />}\n to={<LogoFromGuid logo={to_logo} size={LOGO_SIZE} />}\n />\n )\n}\n\nexport default AccountSwitchBlock\n"],"mappings":";;;;;;;AAYA,IAAM,IAAY,IAUZ,IAAA,CAAsB,EAAE,SAAA,EAAA,MAA0B;AACtD,QAAM,IAAQ,EAAS,GACjB,EAAE,MAAA,GAAM,SAAA,EAAA,IAAY,EAAQ,eAC5B,EAAE,WAAA,GAAW,SAAA,EAAA,IAAa,KAAQ,CAAC,GAGnC,EAAE,WAAA,GAAW,gBAAA,GAAgB,GAAG,EAAA,IAAc,EAClD,EAAgB,CAAK,GACrB,GACA,EAAqB,gBACrB,oBACF;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,GAAI;AAAA,IACJ,MAAM,gBAAA,EAAC,GAAD;AAAA,MAAc,MAAM;AAAA,MAAW,MAAM;AAAA,IAAY,CAAA;AAAA,IACvD,MAAM,gBAAA,EAAC,GAAD;AAAA,MAAM,eAAa;AAAA,MAAM,MAAM;AAAA,MAAW,MAAM;AAAA,MAAI,IAAI,EAAE,OAAO,EAAe;AAAA,IAAI,CAAA;AAAA,IAC1F,IAAI,gBAAA,EAAC,GAAD;AAAA,MAAc,MAAM;AAAA,MAAS,MAAM;AAAA,IAAY,CAAA;AAAA,EACpD,CAAA;AAEL"}
@@ -1,101 +1,167 @@
1
- import { useInsightsV2Store as w } from "../../common/context/hooks.es.js";
1
+ import { useInsightsV2Store as B } from "../../common/context/hooks.es.js";
2
2
  import { slot as f } from "../../core/types/Insights.es.js";
3
- import { getCategoryColor as v } from "../../core/utils/CategoryUtil.es.js";
4
- import { TinyBarChart as B } from "../../common/components/TinyBarChart.es.js";
5
- import { BAR_ARIA_LABEL as S, buildChartData as A, buildDataSeries as V } from "../blocks/ChartBlocks/BarchartBlock/utils.es.js";
6
- import { ThemedSVGImage as D } from "./chartblocks/ThemedSVGImage.es.js";
7
- import L from "./LogoFromGuid.es.js";
8
- import { createVariantBlock as P } from "../blocks/createVariantBlock.es.js";
9
- import { ActionBlockLayer as z } from "../actionBlocks/ActionBlockLayer.es.js";
10
- import x from "./BadgedTile.es.js";
11
- import { InsightOptionsMenu as F } from "./InsightOptionsMenu.es.js";
12
- import { ReactComponent as R } from "./shared/images/FeeDetected.es.js";
13
- import T from "./StatusBadge.es.js";
14
- import g from "@mui/material/Stack";
15
- import { P as j, Text as E } from "@mxenabled/mxui";
16
- import G from "@mui/material/Button";
17
- import { Icon as O } from "@mxenabled/mx-icons";
18
- import { Fragment as K, jsx as t, jsxs as n } from "react/jsx-runtime";
19
- import h from "@mui/material/Box";
20
- import N from "@mui/material/Card";
21
- var l = 44, y = ({ logo: r }) => r ? /* @__PURE__ */ t(L, {
3
+ import { getCategoryColor as D } from "../../core/utils/CategoryUtil.es.js";
4
+ import { TinyBarChart as L } from "../../common/components/TinyBarChart.es.js";
5
+ import { BAR_ARIA_LABEL as V, buildChartData as A, buildDataSeries as z } from "../blocks/ChartBlocks/BarchartBlock/utils.es.js";
6
+ import { ThemedSVGImage as R } from "./chartblocks/ThemedSVGImage.es.js";
7
+ import u from "./LogoFromGuid.es.js";
8
+ import { createVariantBlock as E } from "../blocks/createVariantBlock.es.js";
9
+ import { ActionBlockLayer as O } from "../actionBlocks/ActionBlockLayer.es.js";
10
+ import b from "./BadgedTile.es.js";
11
+ import { InsightOptionsMenu as P } from "./InsightOptionsMenu.es.js";
12
+ import { ReactComponent as T } from "./shared/images/FeeDetected.es.js";
13
+ import j from "./StatusBadge.es.js";
14
+ import h from "@mui/material/Stack";
15
+ import { P as F, Text as G } from "@mxenabled/mxui";
16
+ import K from "@mui/material/Button";
17
+ import { Icon as _ } from "@mxenabled/mx-icons";
18
+ import { Fragment as N, jsx as t, jsxs as s } from "react/jsx-runtime";
19
+ import o from "@mui/material/Box";
20
+ import W from "@mui/material/Card";
21
+ var c = 44, x = 32, k = ({ logo: r }) => r ? /* @__PURE__ */ t(u, {
22
22
  logo: r,
23
- size: l
24
- }) : /* @__PURE__ */ t(h, {
23
+ size: c
24
+ }) : /* @__PURE__ */ t(o, {
25
25
  "data-testid": "compact-insight-card-fallback-icon",
26
26
  sx: {
27
27
  alignItems: "center",
28
28
  bgcolor: "primary.lighter",
29
29
  display: "flex",
30
- height: l,
30
+ height: c,
31
31
  justifyContent: "center",
32
- width: l
32
+ width: c
33
33
  },
34
- children: /* @__PURE__ */ t(O, {
34
+ children: /* @__PURE__ */ t(_, {
35
35
  color: "primary",
36
36
  fill: !0,
37
37
  name: "lightbulb",
38
38
  size: 24
39
39
  })
40
- }), u = ({ logo: r }) => /* @__PURE__ */ t(x, {
41
- center: /* @__PURE__ */ t(y, { logo: r }),
42
- size: l,
40
+ }), y = ({ logo: r }) => /* @__PURE__ */ t(b, {
41
+ center: /* @__PURE__ */ t(k, { logo: r }),
42
+ size: c,
43
43
  sx: { flexShrink: 0 }
44
- }), W = ({ logo: r }) => /* @__PURE__ */ t(x, {
45
- center: /* @__PURE__ */ t(y, { logo: r }),
46
- size: l,
44
+ }), H = ({ logo: r }) => /* @__PURE__ */ t(b, {
45
+ center: /* @__PURE__ */ t(k, { logo: r }),
46
+ size: c,
47
47
  sx: { flexShrink: 0 },
48
- topRight: /* @__PURE__ */ t(T, { tone: "warning" })
49
- }), H = () => /* @__PURE__ */ t(D, {
48
+ topRight: /* @__PURE__ */ t(j, { tone: "warning" })
49
+ }), M = () => /* @__PURE__ */ t(R, {
50
50
  divProps: { style: {
51
51
  flexShrink: 0,
52
52
  lineHeight: 0,
53
53
  width: "max-content"
54
54
  } },
55
- image: R
56
- }), M = ({ data: r }) => {
57
- const a = V(f(r, "series"));
58
- if (!a.length) return null;
59
- const s = f(r, "category_guid"), e = A(a, S).slice(-3);
60
- return /* @__PURE__ */ t(h, {
55
+ image: T
56
+ }), Z = ({ data: r }) => {
57
+ const { from_logo: i, to_logo: a } = r ?? {};
58
+ return /* @__PURE__ */ s(o, {
59
+ sx: {
60
+ flexShrink: 0,
61
+ height: 64,
62
+ position: "relative",
63
+ width: 64
64
+ },
65
+ children: [
66
+ /* @__PURE__ */ t(o, {
67
+ sx: {
68
+ borderRadius: "6px",
69
+ left: 0,
70
+ overflow: "hidden",
71
+ position: "absolute",
72
+ top: 0
73
+ },
74
+ children: /* @__PURE__ */ t(u, {
75
+ logo: i,
76
+ size: x
77
+ })
78
+ }),
79
+ /* @__PURE__ */ t(o, {
80
+ "aria-hidden": !0,
81
+ sx: {
82
+ alignItems: "center",
83
+ bgcolor: "text.secondary",
84
+ borderRadius: "50%",
85
+ display: "flex",
86
+ height: 20,
87
+ justifyContent: "center",
88
+ left: 22,
89
+ position: "absolute",
90
+ top: 22,
91
+ width: 20,
92
+ zIndex: 1
93
+ },
94
+ children: /* @__PURE__ */ t(_, {
95
+ name: "link",
96
+ size: 14,
97
+ sx: { color: "primary.contrastText" }
98
+ })
99
+ }),
100
+ /* @__PURE__ */ t(o, {
101
+ sx: {
102
+ borderRadius: "6px",
103
+ bottom: 0,
104
+ overflow: "hidden",
105
+ position: "absolute",
106
+ right: 0
107
+ },
108
+ children: /* @__PURE__ */ t(u, {
109
+ logo: a,
110
+ size: x
111
+ })
112
+ })
113
+ ]
114
+ });
115
+ }, $ = ({ data: r }) => {
116
+ const i = z(f(r, "series"));
117
+ if (!i.length) return null;
118
+ const a = f(r, "category_guid"), n = A(i, V).slice(-3);
119
+ return /* @__PURE__ */ t(o, {
61
120
  "data-testid": "compact-insight-card-bar-chart",
62
121
  sx: { flexShrink: 0 },
63
- children: /* @__PURE__ */ t(B, {
64
- color: (o) => s ? v(s, o) : o.palette.primary.main,
65
- data: e
122
+ children: /* @__PURE__ */ t(L, {
123
+ color: (l) => a ? D(a, l) : l.palette.primary.main,
124
+ data: n
66
125
  })
67
126
  });
68
- }, Z = P({
127
+ }, q = E({
69
128
  variants: {
70
- category_color: M,
71
- minimal: u,
72
- with_illustration: H,
73
- with_warning_badge: W
129
+ category_color: $,
130
+ linked_logos: Z,
131
+ minimal: y,
132
+ with_illustration: M,
133
+ with_warning_badge: H
74
134
  },
75
- fallback: u,
135
+ fallback: y,
76
136
  name: "InsightVisual"
77
- }), $ = { BillAmountNotStandard: {
78
- key: "in_description_cta",
79
- trigger: "inDescriptionCta"
80
- } }, q = (r) => r.stopPropagation(), ut = ({ beat: r, isCtaDisabled: a = !1, onCtaClick: s, onTap: e, payload: o }) => {
81
- const { openActionDrawer: C } = w(), { description: b, instance_slot: m, primary_cta: d, title: k } = o, c = $[o.template ?? ""], p = c ? o[c.key] : d, I = f(m.data, "logo"), _ = (i) => {
82
- if (i.stopPropagation(), !(a || !p)) {
83
- if (c) {
137
+ }), J = {
138
+ BillAmountNotStandard: {
139
+ key: "in_description_cta",
140
+ trigger: "inDescriptionCta"
141
+ },
142
+ ConnectDiscoveredAccountsV2: {
143
+ key: "in_description_cta",
144
+ trigger: "inDescriptionCta"
145
+ }
146
+ }, Q = (r) => r.stopPropagation(), yt = ({ beat: r, isCtaDisabled: i = !1, onCtaClick: a, onTap: n, payload: l }) => {
147
+ const { openActionDrawer: C } = B(), { description: I, instance_slot: m, primary_cta: p, title: v } = l, d = J[l.template ?? ""], g = d ? l[d.key] : p, w = f(m.data, "logo"), S = (e) => {
148
+ if (e.stopPropagation(), !(i || !g)) {
149
+ if (d) {
84
150
  r && C({
85
151
  guid: r.guid,
86
- trigger: c.trigger
152
+ trigger: d.trigger
87
153
  });
88
154
  return;
89
155
  }
90
- d && s?.(d);
156
+ p && a?.(p);
91
157
  }
92
158
  };
93
- return /* @__PURE__ */ n(K, { children: [/* @__PURE__ */ n(N, {
159
+ return /* @__PURE__ */ s(N, { children: [/* @__PURE__ */ s(W, {
94
160
  "data-testid": "compact-insight-card",
95
- ...e ? {
96
- onClick: e,
97
- onKeyDown: (i) => {
98
- i.target === i.currentTarget && (i.key === "Enter" || i.key === " ") && (i.preventDefault(), e?.());
161
+ ...n ? {
162
+ onClick: n,
163
+ onKeyDown: (e) => {
164
+ e.target === e.currentTarget && (e.key === "Enter" || e.key === " ") && (e.preventDefault(), n?.());
99
165
  },
100
166
  role: "button",
101
167
  tabIndex: 0
@@ -106,9 +172,9 @@ var l = 44, y = ({ logo: r }) => r ? /* @__PURE__ */ t(L, {
106
172
  pl: 8,
107
173
  pr: 16,
108
174
  pt: 8,
109
- ...e && { cursor: "pointer" }
175
+ ...n && { cursor: "pointer" }
110
176
  },
111
- children: [/* @__PURE__ */ n(g, {
177
+ children: [/* @__PURE__ */ s(h, {
112
178
  sx: {
113
179
  alignItems: "center",
114
180
  flexDirection: "row",
@@ -117,59 +183,59 @@ var l = 44, y = ({ logo: r }) => r ? /* @__PURE__ */ t(L, {
117
183
  pl: 8,
118
184
  pt: 4
119
185
  },
120
- children: [/* @__PURE__ */ t(E, {
186
+ children: [/* @__PURE__ */ t(G, {
121
187
  bold: !0,
122
188
  variant: "body1",
123
- children: k ?? ""
124
- }), /* @__PURE__ */ t(h, {
125
- onClick: q,
189
+ children: v ?? ""
190
+ }), /* @__PURE__ */ t(o, {
191
+ onClick: Q,
126
192
  sx: { display: "flex" },
127
- children: /* @__PURE__ */ t(F, {})
193
+ children: /* @__PURE__ */ t(P, {})
128
194
  })]
129
- }), /* @__PURE__ */ n(g, {
195
+ }), /* @__PURE__ */ s(h, {
130
196
  sx: {
131
197
  flexDirection: "row",
132
198
  gap: 16,
133
199
  pl: 8,
134
200
  pt: 4
135
201
  },
136
- children: [/* @__PURE__ */ n(g, {
202
+ children: [/* @__PURE__ */ s(h, {
137
203
  sx: {
138
204
  flex: 1,
139
205
  gap: 8,
140
206
  minWidth: 0
141
207
  },
142
- children: [/* @__PURE__ */ t(j, {
143
- dangerouslySetInnerHTML: { __html: b.html_text },
208
+ children: [/* @__PURE__ */ t(F, {
209
+ dangerouslySetInnerHTML: { __html: I.html_text },
144
210
  "data-testid": "compact-insight-card-description",
145
211
  variant: "subtitle2"
146
- }), p?.label && /* @__PURE__ */ t(G, {
147
- "aria-disabled": a,
148
- onClick: _,
212
+ }), g?.label && /* @__PURE__ */ t(K, {
213
+ "aria-disabled": i,
214
+ onClick: S,
149
215
  size: "small",
150
216
  sx: {
151
217
  alignSelf: "flex-start",
152
218
  mt: 5,
153
219
  ml: -8,
154
220
  px: 8,
155
- ...a && {
221
+ ...i && {
156
222
  color: "text.disabled",
157
223
  cursor: "default"
158
224
  }
159
225
  },
160
226
  variant: "text",
161
- children: p.label
227
+ children: g.label
162
228
  })]
163
- }), /* @__PURE__ */ t(Z, {
229
+ }), /* @__PURE__ */ t(q, {
164
230
  data: m.data,
165
- logo: I,
231
+ logo: w,
166
232
  variant: m.variant
167
233
  })]
168
234
  })]
169
- }), r && /* @__PURE__ */ t(z, { beat: r })] });
235
+ }), r && /* @__PURE__ */ t(O, { beat: r })] });
170
236
  };
171
237
  export {
172
- ut as default
238
+ yt as default
173
239
  };
174
240
 
175
241
  //# sourceMappingURL=CompactInsightCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CompactInsightCard.es.js","names":[],"sources":["../../../src/insights-v2/components/CompactInsightCard.tsx"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { useInsightsV2Store } from '../../common'\nimport { TinyBarChart } from '../../common/components/TinyBarChart'\nimport { slot } from '../../core'\nimport type {\n Beat,\n DataSeries,\n InsightsPayload,\n InstanceSlotData,\n LogoRef,\n PrimaryCTA,\n} from '../../core'\nimport type { ActionDrawerTrigger } from '../../core/stores'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport {\n BAR_ARIA_LABEL,\n buildChartData,\n buildDataSeries,\n} from '../blocks/ChartBlocks/BarchartBlock/utils'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport BadgedTile from './BadgedTile'\nimport InsightOptionsMenu from './InsightOptionsMenu'\nimport LogoFromGuid from './LogoFromGuid'\nimport { ReactComponent as FeeDetectedIllustration } from './shared/images/FeeDetected.svg'\nimport { ThemedSVGImage } from './chartblocks/ThemedSVGImage'\nimport StatusBadge from './StatusBadge'\n\n/** Figma 1941:111897: the tile the logo fills is 44px (rows are 32, the notification row 33). */\nconst ICON_SIZE = 44\n\ninterface InsightVisualProps {\n /** The slot's `logo`, when ditto's variant declares and fills one. */\n logo?: LogoRef | null\n /** The slot's `data`, for a visual drawn from more than the logo (`category_color`'s bars). */\n data?: InstanceSlotData\n}\n\n/** Figma 222:33404 (Embedded | Bill Amount Not Standard) shows the latest three bars. */\nconst BAR_CHART_BAR_COUNT = 3\n\n/** The slot's logo, or the neutral insight glyph when the slot carries none. */\nconst LogoOrFallback = ({ logo }: InsightVisualProps) =>\n logo ? (\n <LogoFromGuid logo={logo} size={ICON_SIZE} />\n ) : (\n <Box\n data-testid=\"compact-insight-card-fallback-icon\"\n sx={{\n alignItems: 'center',\n bgcolor: 'primary.lighter',\n display: 'flex',\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n }}\n >\n <Icon color=\"primary\" fill={true} name=\"lightbulb\" size={24} />\n </Box>\n )\n\n/** Micro, and any variant not registered below: the logo alone. */\nconst PlainVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile center={<LogoOrFallback logo={logo} />} size={ICON_SIZE} sx={{ flexShrink: 0 }} />\n)\n\n/** ditto `with_warning_badge`: the logo badged with a status glyph (Figma 1941:111897). */\nconst WarningBadgeVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"warning\" />}\n />\n)\n\n/**\n * ditto `with_illustration`: artwork in place of the logo tile (Fee Detected's search illustration).\n * A single SVG themed at runtime by `ThemedSVGImage`: its `brand300` elements are recolored to the\n * theme's `primary.main` (so it follows dark mode), while `fill=\"white\"` areas stay white. The\n * slot's `logo` is deliberately unused: the illustration replaces the tile.\n */\nconst IllustrationVisual = () => {\n return (\n <ThemedSVGImage\n divProps={{ style: { flexShrink: 0, lineHeight: 0, width: 'max-content' } }}\n image={FeeDetectedIllustration}\n />\n )\n}\n\n/**\n * ditto `category_color`: a tiny bar chart of the latest bars in place of the logo tile, tinted by\n * the slot's category, the newest bar solid (Figma 222:33404). Draws nothing without a series.\n */\nconst BarChartVisual = ({ data }: InsightVisualProps) => {\n const series = buildDataSeries(slot<DataSeries>(data, 'series'))\n if (!series.length) return null\n\n const categoryGuid = slot<string>(data, 'category_guid')\n const bars = buildChartData(series, BAR_ARIA_LABEL).slice(-BAR_CHART_BAR_COUNT)\n\n return (\n <Box data-testid=\"compact-insight-card-bar-chart\" sx={{ flexShrink: 0 }}>\n <TinyBarChart\n color={(theme) =>\n categoryGuid ? getCategoryColor(categoryGuid, theme) : theme.palette.primary.main\n }\n data={bars}\n />\n </Box>\n )\n}\n\n/**\n * The card's right-hand visual, one component per ditto layout variant.\n *\n * A variant names a rendering *shape*, not an insight or a surface — `with_header` already serves\n * both Large Transaction and Fee Detected — so an insight wanting the badged logo reuses\n * `with_warning_badge`. Only a genuinely different visual registers a new entry, and existing ones\n * are never touched.\n *\n * `minimal` draws the plain logo and is registered explicitly even though it matches the fallback:\n * micro and notification resolve it on every render, and an unregistered variant warns. The\n * fallback is for variants we genuinely do not know.\n */\nconst InsightVisual = createVariantBlock<InsightVisualProps>({\n variants: {\n category_color: BarChartVisual,\n minimal: PlainVisual,\n with_illustration: IllustrationVisual,\n with_warning_badge: WarningBadgeVisual,\n },\n fallback: PlainVisual,\n name: 'InsightVisual',\n})\n\n/**\n * Beats whose embedded CTA the card reads from its own envelope key and opens in this card's\n * `ActionBlockLayer`, as a bar click does on the full card. The trigger names that key, so the layer\n * resolves the same CTA. Every other beat keeps `primary_cta` and hands it to the host's `onCtaClick`\n * (e.g. `contact_support_block`). A new beat adds its template here.\n */\nconst BEAT_CTA_CONFIG: Record<\n string,\n { key: 'primary_cta' | 'in_description_cta'; trigger: ActionDrawerTrigger }\n> = {\n BillAmountNotStandard: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n}\n\nexport interface CompactInsightCardProps {\n /** A `micro` or `embedded` envelope. */\n payload: InsightsPayload\n /** The envelope's beat; when given, the card mounts its `ActionBlockLayer` for CTA drawers. */\n beat?: Beat\n /**\n * Makes the whole card the tap target. What a tap does is the host's decision (post to the\n * host app, open a drawer, …); the card never opens anything itself. Omit for a static card.\n */\n onTap?: () => void\n /** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */\n onCtaClick?: (cta: PrimaryCTA) => void\n /**\n * Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot\n * honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).\n */\n isCtaDisabled?: boolean\n}\n\nconst stopPropagation = (event: MouseEvent) => event.stopPropagation()\n\n/**\n * The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).\n *\n * Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML\n * description with the primary CTA under it, and on the right the slot's `logo` in a\n * `<BadgedTile>`. Under ditto's `with_warning_badge` variant the tile takes a status badge; under\n * `minimal` it draws the logo alone. The card lays out from the envelope alone and never reads\n * `widget_type`.\n *\n * The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot\n * carries no logo. The `pill` on the same envelope is the transaction row's, not the card's.\n */\nconst CompactInsightCard = ({\n beat,\n isCtaDisabled = false,\n onCtaClick,\n onTap,\n payload,\n}: CompactInsightCardProps) => {\n const { openActionDrawer } = useInsightsV2Store()\n const { description, instance_slot, primary_cta, title } = payload\n const beatCta = BEAT_CTA_CONFIG[payload.template ?? '']\n const cta = beatCta ? payload[beatCta.key] : primary_cta\n // Reduced variants (`minimal`, `with_warning_badge`) declare a bare `logo` slot.\n const rowLogo = slot<LogoRef>(instance_slot.data, 'logo')\n\n const handleCtaClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (isCtaDisabled || !cta) return\n\n if (beatCta) {\n if (beat) openActionDrawer({ guid: beat.guid, trigger: beatCta.trigger })\n return\n }\n if (primary_cta) onCtaClick?.(primary_cta)\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n // Only the card itself: Enter on the CTA button is the button's own click.\n if (event.target !== event.currentTarget) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onTap?.()\n }\n }\n\n const interactiveProps = onTap\n ? { onClick: onTap, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 }\n : {}\n\n return (\n <>\n <Card\n data-testid=\"compact-insight-card\"\n {...interactiveProps}\n sx={{\n minWidth: 288,\n pb: 12,\n pl: 8,\n pr: 16,\n pt: 8,\n ...(onTap && { cursor: 'pointer' }),\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 8,\n justifyContent: 'space-between',\n pl: 8,\n pt: 4,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {title ?? ''}\n </Text>\n {/* The menu renders only when the host wired `onMenuAction` (BeatActionsProvider). */}\n <Box onClick={stopPropagation} sx={{ display: 'flex' }}>\n <InsightOptionsMenu />\n </Box>\n </Stack>\n\n <Stack sx={{ flexDirection: 'row', gap: 16, pl: 8, pt: 4 }}>\n <Stack sx={{ flex: 1, gap: 8, minWidth: 0 }}>\n {/* `html_text` is rendered server-side by mrs_content from the ditto copy template (bold\n amount / merchant), not user-authored input; painted the same way `BaseLayout` paints\n the full card's description. */}\n <P\n dangerouslySetInnerHTML={{ __html: description.html_text }}\n data-testid=\"compact-insight-card-description\"\n variant=\"subtitle2\"\n />\n {cta?.label && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // Figma 1941:111897 lines the CTA label up with the description's left edge. The\n // column already pads 8, so the button's own 8 is pulled back out — padding kept so\n // the tap target does not shrink.\n mt: 5,\n ml: -8,\n px: 8,\n ...(isCtaDisabled && {\n color: 'text.disabled',\n cursor: 'default',\n }),\n }}\n variant=\"text\"\n >\n {cta.label}\n </Button>\n )}\n </Stack>\n\n <InsightVisual data={instance_slot.data} logo={rowLogo} variant={instance_slot.variant} />\n </Stack>\n </Card>\n {/* Outside the Card: the drawer is a portal, and its clicks would otherwise bubble to `onTap`. */}\n {beat && <ActionBlockLayer beat={beat} />}\n </>\n )\n}\n\nexport default CompactInsightCard\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAsCA,IAAM,IAAY,IAaZ,IAAA,CAAkB,EAAE,MAAA,EAAA,MACxB,IACE,gBAAA,EAAC,GAAD;AAAA,EAAoB,MAAA;AAAA,EAAM,MAAM;AAAY,CAAA,IAE5C,gBAAA,EAAC,GAAD;AAAA,EACE,eAAY;AAAA,EACZ,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,OAAO;AAAA,EACT;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAU,MAAM;AAAA,IAAM,MAAK;AAAA,IAAY,MAAM;AAAA,EAAK,CAAA;AAC3D,CAAA,GAIH,IAAA,CAAe,EAAE,MAAA,EAAA,MACrB,gBAAA,EAAC,GAAD;AAAA,EAAY,QAAQ,gBAAA,EAAC,GAAD,EAAsB,MAAA,EAAO,CAAA;AAAA,EAAG,MAAM;AAAA,EAAW,IAAI,EAAE,YAAY,EAAE;AAAI,CAAA,GAIzF,IAAA,CAAsB,EAAE,MAAA,EAAA,MAC5B,gBAAA,EAAC,GAAD;AAAA,EACE,QAAQ,gBAAA,EAAC,GAAD,EAAsB,MAAA,EAAO,CAAA;AAAA,EACrC,MAAM;AAAA,EACN,IAAI,EAAE,YAAY,EAAE;AAAA,EACpB,UAAU,gBAAA,EAAC,GAAD,EAAa,MAAK,UAAW,CAAA;AACxC,CAAA,GASG,IAAA,MAEF,gBAAA,EAAC,GAAD;AAAA,EACE,UAAU,EAAE,OAAO;AAAA,IAAE,YAAY;AAAA,IAAG,YAAY;AAAA,IAAG,OAAO;AAAA,EA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QAAI,IAAI;AAAA,QAAG,IAAI;AAAA,MAAE;AAAA,MAAzD,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAO,IAAI;AAAA,UAAE,MAAM;AAAA,UAAG,KAAK;AAAA,UAAG,UAAU;AAAA,QAAE;AAAA,QAA1C,UAAA,CAIE,gBAAA,EAAC,GAAD;AAAA,UACE,yBAAyB,EAAE,QAAQ,EAAY,UAAU;AAAA,UACzD,eAAY;AAAA,UACZ,SAAQ;AAAA,QACT,CAAA,GACA,GAAK,SACJ,gBAAA,EAAC,GAAD;AAAA,UACE,iBAAe;AAAA,UACf,SAAS;AAAA,UACT,MAAK;AAAA,UACL,IAAI;AAAA,YACF,WAAW;AAAA,YAIX,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,IAAI;AAAA,YACJ,GAAI,KAAiB;AAAA,cACnB,OAAO;AAAA,cACP,QAAQ;AAAA,YACV;AAAA,UACF;AAAA,UACA,SAAQ;AAAA,UAEP,UAAA,EAAI;AAAA,QACC,CAAA,CAEL;AAAA,MAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,QAAe,MAAM,EAAc;AAAA,QAAM,MAAM;AAAA,QAAS,SAAS,EAAc;AAAA,MAAU,CAAA,CACpF;AAAA,IACH,CAAA,CAAA;AAAA,EAEL,CAAA,GAAA,KAAQ,gBAAA,EAAC,GAAD,EAAwB,MAAA,EAAO,CAAA,CACxC,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"CompactInsightCard.es.js","names":[],"sources":["../../../src/insights-v2/components/CompactInsightCard.tsx"],"sourcesContent":["import type { KeyboardEvent, MouseEvent } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { P, Text } from '@mxenabled/mxui'\n\nimport { useInsightsV2Store } from '../../common'\nimport { TinyBarChart } from '../../common/components/TinyBarChart'\nimport { slot } from '../../core'\nimport type {\n Beat,\n DataSeries,\n InsightsPayload,\n InstanceSlotData,\n LogoRef,\n PrimaryCTA,\n} from '../../core'\nimport type { ActionDrawerTrigger } from '../../core/stores'\nimport type { AccountSwitchBlockV2Data } from '../../core/types/InsightsInstanceSlotData'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport {\n BAR_ARIA_LABEL,\n buildChartData,\n buildDataSeries,\n} from '../blocks/ChartBlocks/BarchartBlock/utils'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { createVariantBlock } from '../blocks/createVariantBlock'\nimport BadgedTile from './BadgedTile'\nimport InsightOptionsMenu from './InsightOptionsMenu'\nimport LogoFromGuid from './LogoFromGuid'\nimport { ReactComponent as FeeDetectedIllustration } from './shared/images/FeeDetected.svg'\nimport { ThemedSVGImage } from './chartblocks/ThemedSVGImage'\nimport StatusBadge from './StatusBadge'\n\n/** Figma 1941:111897: the tile the logo fills is 44px (rows are 32, the notification row 33). */\nconst ICON_SIZE = 44\n\ninterface InsightVisualProps {\n /** The slot's `logo`, when ditto's variant declares and fills one. */\n logo?: LogoRef | null\n /** The slot's whole `data`, for a visual drawn from more than the logo (`category_color`, `linked_logos`). */\n data?: InstanceSlotData\n}\n\nconst LINKED_LOGO_SIZE = 32\n\n/** Figma 222:33404 (Embedded | Bill Amount Not Standard) shows the latest three bars. */\nconst BAR_CHART_BAR_COUNT = 3\n\n/** The slot's logo, or the neutral insight glyph when the slot carries none. */\nconst LogoOrFallback = ({ logo }: InsightVisualProps) =>\n logo ? (\n <LogoFromGuid logo={logo} size={ICON_SIZE} />\n ) : (\n <Box\n data-testid=\"compact-insight-card-fallback-icon\"\n sx={{\n alignItems: 'center',\n bgcolor: 'primary.lighter',\n display: 'flex',\n height: ICON_SIZE,\n justifyContent: 'center',\n width: ICON_SIZE,\n }}\n >\n <Icon color=\"primary\" fill={true} name=\"lightbulb\" size={24} />\n </Box>\n )\n\n/** Micro, and any variant not registered below: the logo alone. */\nconst PlainVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile center={<LogoOrFallback logo={logo} />} size={ICON_SIZE} sx={{ flexShrink: 0 }} />\n)\n\n/** ditto `with_warning_badge`: the logo badged with a status glyph (Figma 1941:111897). */\nconst WarningBadgeVisual = ({ logo }: InsightVisualProps) => (\n <BadgedTile\n center={<LogoOrFallback logo={logo} />}\n size={ICON_SIZE}\n sx={{ flexShrink: 0 }}\n topRight={<StatusBadge tone=\"warning\" />}\n />\n)\n\n/**\n * ditto `with_illustration`: artwork in place of the logo tile (Fee Detected's search illustration).\n * A single SVG themed at runtime by `ThemedSVGImage`: its `brand300` elements are recolored to the\n * theme's `primary.main` (so it follows dark mode), while `fill=\"white\"` areas stay white. The\n * slot's `logo` is deliberately unused: the illustration replaces the tile.\n */\nconst IllustrationVisual = () => {\n return (\n <ThemedSVGImage\n divProps={{ style: { flexShrink: 0, lineHeight: 0, width: 'max-content' } }}\n image={FeeDetectedIllustration}\n />\n )\n}\n\n/**\n * ditto `linked_logos` (Figma 1943:219166, Embedded | Discovered Accounts): the two institutions\n * overlapping on a diagonal — `from_logo` top-left, `to_logo` bottom-right — with a link badge where\n * they meet. The badge is decorative (`aria-hidden`); each logo's accessible name is its `alt`.\n */\nconst LinkedLogosVisual = ({ data }: InsightVisualProps) => {\n const { from_logo, to_logo } = (data ?? {}) as AccountSwitchBlockV2Data\n\n return (\n <Box sx={{ flexShrink: 0, height: 64, position: 'relative', width: 64 }}>\n <Box sx={{ borderRadius: '6px', left: 0, overflow: 'hidden', position: 'absolute', top: 0 }}>\n <LogoFromGuid logo={from_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n <Box\n aria-hidden={true}\n sx={{\n alignItems: 'center',\n bgcolor: 'text.secondary',\n borderRadius: '50%',\n display: 'flex',\n height: 20,\n justifyContent: 'center',\n left: 22,\n position: 'absolute',\n top: 22,\n width: 20,\n zIndex: 1,\n }}\n >\n <Icon name=\"link\" size={14} sx={{ color: 'primary.contrastText' }} />\n </Box>\n <Box\n sx={{ borderRadius: '6px', bottom: 0, overflow: 'hidden', position: 'absolute', right: 0 }}\n >\n <LogoFromGuid logo={to_logo} size={LINKED_LOGO_SIZE} />\n </Box>\n </Box>\n )\n}\n\n/**\n * ditto `category_color`: a tiny bar chart of the latest bars in place of the logo tile, tinted by\n * the slot's category, the newest bar solid (Figma 222:33404). Draws nothing without a series.\n */\nconst BarChartVisual = ({ data }: InsightVisualProps) => {\n const series = buildDataSeries(slot<DataSeries>(data, 'series'))\n if (!series.length) return null\n\n const categoryGuid = slot<string>(data, 'category_guid')\n const bars = buildChartData(series, BAR_ARIA_LABEL).slice(-BAR_CHART_BAR_COUNT)\n\n return (\n <Box data-testid=\"compact-insight-card-bar-chart\" sx={{ flexShrink: 0 }}>\n <TinyBarChart\n color={(theme) =>\n categoryGuid ? getCategoryColor(categoryGuid, theme) : theme.palette.primary.main\n }\n data={bars}\n />\n </Box>\n )\n}\n\n/**\n * The card's right-hand visual, one component per ditto layout variant.\n *\n * A variant names a rendering *shape*, not an insight or a surface — `with_header` already serves\n * both Large Transaction and Fee Detected — so an insight wanting the badged logo reuses\n * `with_warning_badge`. Only a genuinely different visual registers a new entry, and existing ones\n * are never touched.\n *\n * `minimal` draws the plain logo and is registered explicitly even though it matches the fallback:\n * micro and notification resolve it on every render, and an unregistered variant warns. The\n * fallback is for variants we genuinely do not know.\n */\nconst InsightVisual = createVariantBlock<InsightVisualProps>({\n variants: {\n category_color: BarChartVisual,\n linked_logos: LinkedLogosVisual,\n minimal: PlainVisual,\n with_illustration: IllustrationVisual,\n with_warning_badge: WarningBadgeVisual,\n },\n fallback: PlainVisual,\n name: 'InsightVisual',\n})\n\n/**\n * Beats whose embedded CTA the card reads from its own envelope key and opens in this card's\n * `ActionBlockLayer`, as a bar click does on the full card. The trigger names that key, so the layer\n * resolves the same CTA. Every other beat keeps `primary_cta` and hands it to the host's `onCtaClick`\n * (e.g. `contact_support_block`). A new beat adds its template here.\n */\nconst BEAT_CTA_CONFIG: Record<\n string,\n { key: 'primary_cta' | 'in_description_cta'; trigger: ActionDrawerTrigger }\n> = {\n BillAmountNotStandard: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n ConnectDiscoveredAccountsV2: { key: 'in_description_cta', trigger: 'inDescriptionCta' },\n}\n\nexport interface CompactInsightCardProps {\n /** A `micro` or `embedded` envelope. */\n payload: InsightsPayload\n /** The envelope's beat; when given, the card mounts its `ActionBlockLayer` for CTA drawers. */\n beat?: Beat\n /**\n * Makes the whole card the tap target. What a tap does is the host's decision (post to the\n * host app, open a drawer, …); the card never opens anything itself. Omit for a static card.\n */\n onTap?: () => void\n /** Receives the primary CTA when tapped. The card does not resolve the CTA's block itself. */\n onCtaClick?: (cta: PrimaryCTA) => void\n /**\n * Renders the CTA disabled — label shown, `aria-disabled`, not tappable — for a host that cannot\n * honour it (e.g. `contact_support_block` when the client's `enable_support_requests` is off).\n */\n isCtaDisabled?: boolean\n}\n\nconst stopPropagation = (event: MouseEvent) => event.stopPropagation()\n\n/**\n * The one compact renderer the micro and embedded envelopes share (`insights_v2.2.md` §8.3).\n *\n * Figma 1941:111897 (Embedded | Large Transaction): a title row with the overflow slot, the HTML\n * description with the primary CTA under it, and on the right the slot's `logo` in a\n * `<BadgedTile>`. Under ditto's `with_warning_badge` variant the tile takes a status badge; under\n * `minimal` it draws the logo alone. The card lays out from the envelope alone and never reads\n * `widget_type`.\n *\n * The icon falls back to the neutral insight glyph **here**, not in `LogoFromGuid`, when the slot\n * carries no logo. The `pill` on the same envelope is the transaction row's, not the card's.\n */\nconst CompactInsightCard = ({\n beat,\n isCtaDisabled = false,\n onCtaClick,\n onTap,\n payload,\n}: CompactInsightCardProps) => {\n const { openActionDrawer } = useInsightsV2Store()\n const { description, instance_slot, primary_cta, title } = payload\n const beatCta = BEAT_CTA_CONFIG[payload.template ?? '']\n const cta = beatCta ? payload[beatCta.key] : primary_cta\n // Reduced variants (`minimal`, `with_warning_badge`) declare a bare `logo` slot.\n const rowLogo = slot<LogoRef>(instance_slot.data, 'logo')\n\n const handleCtaClick = (event: MouseEvent<HTMLButtonElement>) => {\n event.stopPropagation()\n if (isCtaDisabled || !cta) return\n\n if (beatCta) {\n if (beat) openActionDrawer({ guid: beat.guid, trigger: beatCta.trigger })\n return\n }\n if (primary_cta) onCtaClick?.(primary_cta)\n }\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n // Only the card itself: Enter on the CTA button is the button's own click.\n if (event.target !== event.currentTarget) return\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault()\n onTap?.()\n }\n }\n\n const interactiveProps = onTap\n ? { onClick: onTap, onKeyDown: handleKeyDown, role: 'button', tabIndex: 0 }\n : {}\n\n return (\n <>\n <Card\n data-testid=\"compact-insight-card\"\n {...interactiveProps}\n sx={{\n minWidth: 288,\n pb: 12,\n pl: 8,\n pr: 16,\n pt: 8,\n ...(onTap && { cursor: 'pointer' }),\n }}\n >\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gap: 8,\n justifyContent: 'space-between',\n pl: 8,\n pt: 4,\n }}\n >\n <Text bold={true} variant=\"body1\">\n {title ?? ''}\n </Text>\n {/* The menu renders only when the host wired `onMenuAction` (BeatActionsProvider). */}\n <Box onClick={stopPropagation} sx={{ display: 'flex' }}>\n <InsightOptionsMenu />\n </Box>\n </Stack>\n\n <Stack sx={{ flexDirection: 'row', gap: 16, pl: 8, pt: 4 }}>\n <Stack sx={{ flex: 1, gap: 8, minWidth: 0 }}>\n {/* `html_text` is rendered server-side by mrs_content from the ditto copy template (bold\n amount / merchant), not user-authored input; painted the same way `BaseLayout` paints\n the full card's description. */}\n <P\n dangerouslySetInnerHTML={{ __html: description.html_text }}\n data-testid=\"compact-insight-card-description\"\n variant=\"subtitle2\"\n />\n {cta?.label && (\n <Button\n aria-disabled={isCtaDisabled}\n onClick={handleCtaClick}\n size=\"small\"\n sx={{\n alignSelf: 'flex-start',\n // Figma 1941:111897 lines the CTA label up with the description's left edge. The\n // column already pads 8, so the button's own 8 is pulled back out — padding kept so\n // the tap target does not shrink.\n mt: 5,\n ml: -8,\n px: 8,\n ...(isCtaDisabled && {\n color: 'text.disabled',\n cursor: 'default',\n }),\n }}\n variant=\"text\"\n >\n {cta.label}\n </Button>\n )}\n </Stack>\n\n <InsightVisual data={instance_slot.data} logo={rowLogo} variant={instance_slot.variant} />\n </Stack>\n </Card>\n {/* Outside the Card: the drawer is a portal, and its clicks would otherwise bubble to `onTap`. */}\n {beat && <ActionBlockLayer beat={beat} />}\n </>\n )\n}\n\nexport default CompactInsightCard\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAuCA,IAAM,IAAY,IASZ,IAAmB,IAMnB,IAAA,CAAkB,EAAE,MAAA,EAAA,MACxB,IACE,gBAAA,EAAC,GAAD;AAAA,EAAoB,MAAA;AAAA,EAAM,MAAM;AAAY,CAAA,IAE5C,gBAAA,EAAC,GAAD;AAAA,EACE,eAAY;AAAA,EACZ,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,OAAO;AAAA,EACT;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAU,MAAM;AAAA,IAAM,MAAK;AAAA,IAAY,MAAM;AAAA,EAAK,CAAA;AAC3D,CAAA,GAIH,IAAA,CAAe,EAAE,MAAA,EAAA,MACrB,gBAAA,EAAC,GAAD;AAAA,EAAY,QAAQ,gBAAA,EAAC,GAAD,EAAsB,MAAA,EAAO,CAAA;AAAA,EAAG,MAAM;AAAA,EAAW,IAAI,EAAE,YAAY,EAAE;AAAI,CAAA,GAIzF,IAAA,CAAsB,EAAE,MAAA,EAAA,MAC5B,gBAAA,EAAC,GAAD;AAAA,EACE,QAAQ,gBAAA,EAAC,GAAD,EAAsB,MAAA,EAAO,CAAA;AAAA,EACrC,MAAM;AAAA,EACN,IAAI,EAAE,YAAY,EAAE;A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
+ ariaLabel?: string;
4
+ }
5
+ export interface SubTabsProps {
6
+ id: string;
7
+ tabs: SubTabItem[];
8
+ selectedIndex: number;
9
+ onChange: (index: number) => void;
10
+ ariaLabel?: string;
11
+ }
12
+ /** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */
13
+ export declare const subTabPanelProps: (id: string, selectedIndex: number) => {
14
+ 'aria-labelledby': string;
15
+ id: string;
16
+ role: "tabpanel";
17
+ };
18
+ /**
19
+ * The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's
20
+ * "Transactions Filtered By Type" on a change, so every drawer that uses it keeps legacy analytics.
21
+ */
22
+ export declare const SubTabs: ({ id, tabs, selectedIndex, onChange, ariaLabel }: SubTabsProps) => import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,38 @@
1
+ import { ANALYTICS_EVENTS_CONFIG as u } from "../analytics/analyticsEventsConfig.es.js";
2
+ import { useAnalyticsEvent as T } from "../analytics/useAnalyticsEvent.es.js";
3
+ import { jsx as n } from "react/jsx-runtime";
4
+ import v from "@mui/material/Tab";
5
+ import E from "@mui/material/Tabs";
6
+ var i = (a, l) => `${a}-tab-${l}`, o = (a) => `${a}-panel`, I = (a, l) => ({
7
+ "aria-labelledby": i(a, l),
8
+ id: o(a),
9
+ role: "tabpanel"
10
+ }), _ = ({ id: a, tabs: l, selectedIndex: t, onChange: b, ariaLabel: m }) => {
11
+ const p = T();
12
+ if (!l.length) return null;
13
+ const s = (r, e) => {
14
+ p(u.TYPE_FILTER_SELECTED), b(e);
15
+ };
16
+ return /* @__PURE__ */ n(E, {
17
+ "aria-label": m ?? l.map((r) => r.label).join(" / "),
18
+ onChange: s,
19
+ value: t,
20
+ variant: "fullWidth",
21
+ children: l.map((r, e) => /* @__PURE__ */ n(v, {
22
+ "aria-controls": o(a),
23
+ "aria-label": r.ariaLabel,
24
+ id: i(a, e),
25
+ label: r.label,
26
+ sx: {
27
+ minWidth: "auto",
28
+ px: 0
29
+ }
30
+ }, r.label))
31
+ });
32
+ };
33
+ export {
34
+ _ as SubTabs,
35
+ I as subTabPanelProps
36
+ };
37
+
38
+ //# sourceMappingURL=SubTabs.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SubTabs.es.js","names":[],"sources":["../../../src/insights-v2/components/SubTabs.tsx"],"sourcesContent":["import type React from 'react'\n\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { ANALYTICS_EVENTS_CONFIG, useAnalyticsEvent } from '../analytics'\n\nexport interface SubTabItem {\n label: string\n // Screen-reader name when it differs from the visible label (legacy pulse: \"Spend transactions\").\n ariaLabel?: string\n}\n\nexport interface SubTabsProps {\n // Base id: tab N is `${id}-tab-N` and controls `${id}-panel`; render that panel with subTabPanelProps.\n id: string\n tabs: SubTabItem[]\n selectedIndex: number\n onChange: (index: number) => void\n // Tablist name; defaults to the visible labels joined (\"Spend / Income\").\n ariaLabel?: string\n}\n\nconst subTabId = (id: string, index: number) => `${id}-tab-${index}`\nconst subPanelId = (id: string) => `${id}-panel`\n\n/** The tabpanel attributes for the content the sub-tabs control, labelled by the selected tab. */\nexport const subTabPanelProps = (id: string, selectedIndex: number) => ({\n 'aria-labelledby': subTabId(id, selectedIndex),\n id: subPanelId(id),\n role: 'tabpanel' as const,\n})\n\n/**\n * The drill-down drawers' second tab row (e.g. Spend / Income). Fires pulse's\n * \"Transactions Filtered By Type\" on a change, so every drawer that uses it keeps legacy analytics.\n */\nexport const SubTabs = ({ id, tabs, selectedIndex, onChange, ariaLabel }: SubTabsProps) => {\n const fireAnalyticsEvent = useAnalyticsEvent()\n\n if (!tabs.length) return null\n\n // MUI only calls onChange for a different tab, never on mount (legacy parity).\n const handleChange = (_event: React.SyntheticEvent, index: number) => {\n fireAnalyticsEvent(ANALYTICS_EVENTS_CONFIG.TYPE_FILTER_SELECTED)\n onChange(index)\n }\n\n return (\n <Tabs\n aria-label={ariaLabel ?? tabs.map((tab) => tab.label).join(' / ')}\n onChange={handleChange}\n value={selectedIndex}\n variant=\"fullWidth\"\n >\n {tabs.map((tab, index) => (\n <Tab\n aria-controls={subPanelId(id)}\n aria-label={tab.ariaLabel}\n id={subTabId(id, index)}\n key={tab.label}\n label={tab.label}\n sx={{ minWidth: 'auto', px: 0 }}\n />\n ))}\n </Tabs>\n )\n}\n"],"mappings":";;;;;AAuBA,IAAM,IAAA,CAAY,GAAY,MAAkB,GAAG,CAAA,QAAU,CAAA,IACvD,IAAA,CAAc,MAAe,GAAG,CAAA,UAGzB,IAAA,CAAoB,GAAY,OAA2B;AAAA,EACtE,mBAAmB,EAAS,GAAI,CAAa;AAAA,EAC7C,IAAI,EAAW,CAAE;AAAA,EACjB,MAAM;AACR,IAMa,IAAA,CAAW,EAAE,IAAA,GAAI,MAAA,GAAM,eAAA,GAAe,UAAA,GAAU,WAAA,EAAA,MAA8B;AACzF,QAAM,IAAqB,EAAkB;AAE7C,MAAI,CAAC,EAAK,OAAQ,QAAO;AAGzB,QAAM,IAAA,CAAgB,GAA8B,MAAkB;AACpE,IAAA,EAAmB,EAAwB,oBAAoB,GAC/D,EAAS,CAAK;AAAA,EAChB;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,cAAY,KAAa,EAAK,IAAA,CAAK,MAAQ,EAAI,KAAK,EAAE,KAAK,KAAK;AAAA,IAChE,UAAU;AAAA,IACV,OAAO;AAAA,IACP,SAAQ;AAAA,IAEP,UAAA,EAAK,IAAA,CAAK,GAAK,MACd,gBAAA,EAAC,GAAD;AAAA,MACE,iBAAe,EAAW,CAAE;AAAA,MAC5B,cAAY,EAAI;AAAA,MAChB,IAAI,EAAS,GAAI,CAAK;AAAA,MAEtB,OAAO,EAAI;AAAA,MACX,IAAI;AAAA,QAAE,UAAU;AAAA,QAAQ,IAAI;AAAA,MAAE;AAAA,IAC/B,GAHM,EAAI,KAGV,CACF;AAAA,EACG,CAAA;AAEV"}