@mx-cartographer/experiences 9.7.190 → 9.7.191

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 (25) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.d.ts +5 -3
  3. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +34 -31
  4. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
  5. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.d.ts +8 -0
  6. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.es.js +11 -0
  7. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.es.js.map +1 -0
  8. package/dist/insights-v2/components/CategoryTile.es.js.map +1 -1
  9. package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.d.ts +3 -1
  10. package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.es.js +63 -51
  11. package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.es.js.map +1 -1
  12. package/dist/insights-v2/components/LogoFromGuid.d.ts +3 -1
  13. package/dist/insights-v2/components/LogoFromGuid.es.js +12 -11
  14. package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
  15. package/dist/insights-v2/components/LogoMark.d.ts +3 -1
  16. package/dist/insights-v2/components/LogoMark.es.js +20 -19
  17. package/dist/insights-v2/components/LogoMark.es.js.map +1 -1
  18. package/dist/microinsights/cards/InsightCard.es.js +56 -55
  19. package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
  20. package/package.json +1 -1
  21. package/dist/core/types/InsightsInstanceSlotData.es.js +0 -8
  22. package/dist/core/types/InsightsInstanceSlotData.es.js.map +0 -1
  23. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.d.ts +0 -7
  24. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.es.js +0 -12
  25. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.es.js.map +0 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [9.7.191] - 11-19-2026
2
+
3
+ - **ADDED** - Category Budget V2 card: `budget_block` renders the Insights 2.0 slots with the bar coloured by status (on track, near, off track) (WEC-2326)
4
+
1
5
  ## [9.7.190] - 11-19-2026
2
6
 
3
7
  - **FIXED** - Insights 2.0 Unified Deposit and the deposit templates: the tile's amount is bold, the payer line is a one-line caption in secondary text, and the wash matches Figma (WEC-2367)
@@ -1,3 +1,5 @@
1
- import { BudgetBlockData } from '../../../../core/types/InsightsInstanceSlotData';
2
- import { BlockProps } from '../../types';
3
- export declare const BudgetBlock: ({ payload }: BlockProps<BudgetBlockData>) => import("react/jsx-runtime").JSX.Element;
1
+ import { InsightsPayload } from '../../../../core';
2
+ /** The budget card, from the Insights 2.0 slots on `instance_slot.data` (ditto budget_block.yml). */
3
+ export declare const BudgetBlock: ({ payload }: {
4
+ payload: InsightsPayload;
5
+ }) => import("react/jsx-runtime").JSX.Element | null;
@@ -1,38 +1,41 @@
1
- import { buildDynamicCopy as l } from "../../../../core/utils/Localization.es.js";
2
- import { CURRENCY_FORMAT as e, formatCurrency as r } from "../../../../core/utils/NumberFormatting.es.js";
3
- import y from "../../../components/CategoryTile.es.js";
4
- import C from "../../../components/LogoMark.es.js";
5
- import x from "../../../components/ComponentBlocks/StatusIndicator.es.js";
6
- import { getColorByBudgetTier as h } from "./util.es.js";
7
- import { Text as T } from "@mxenabled/mxui";
8
- import { jsx as a } from "react/jsx-runtime";
9
- var j = ({ payload: i }) => {
10
- const { budget_percent: c, amount: n, budget_tier: m, category_guid: t, merchant_guid: s, spent_amount: u, budgeted_amount: d, localized_payload: o } = i.instance_slot_data, p = h(m), _ = t ? /* @__PURE__ */ a(y, {
11
- categoryGuid: t,
12
- size: 48,
13
- tint: 0.25
14
- }) : /* @__PURE__ */ a(C, {
15
- logo: { merchant_guid: s },
16
- size: 48
17
- }), g = l(o?.spent_label || "", r(u, e.cents)), b = l(o?.budgeted_label || "", r(d, e.cents)), f = /* @__PURE__ */ a(T, {
18
- bold: !0,
19
- variant: "h2",
20
- children: t && t !== null ? l(o?.amount_left_label || "", r(n, e.cents)) : r(n, e.cents)
21
- });
22
- return /* @__PURE__ */ a(x, {
23
- amount: f,
1
+ import { slot as o } from "../../../../core/types/Insights.es.js";
2
+ import { resolveVariantConfig as u } from "../../resolveVariantConfig.es.js";
3
+ import { asLogoRef as p, asNumber as c, asText as e } from "../../slotReaders.es.js";
4
+ import f from "../../../components/LogoFromGuid.es.js";
5
+ import d from "../../../components/ComponentBlocks/StatusIndicator.es.js";
6
+ import { BUDGET_BLOCK_FALLBACK_VARIANT as g, BUDGET_BLOCK_LAYOUT as _ } from "./layout.es.js";
7
+ import { H2 as x, P as T } from "@mxenabled/mxui";
8
+ import { jsx as r } from "react/jsx-runtime";
9
+ var b = 48, B = 0.25, G = ({ payload: l }) => {
10
+ const { data: t, variant: i } = l.instance_slot, n = e(o(t, "amount_text"));
11
+ if (!n) return null;
12
+ const { barColor: m } = u(_, i, g, "BudgetBlock"), s = Math.min(100, Math.max(0, c(o(t, "percent")) ?? 0)), a = e(o(t, "sub_text"));
13
+ return /* @__PURE__ */ r(d, {
14
+ amount: /* @__PURE__ */ r(x, { children: n }),
24
15
  borderRadius: "6px",
25
- completeColor: p,
26
- icon: _,
27
- label: o?.primary_text || "",
28
- leftLabel: g,
29
- percentComplete: c,
30
- rightLabel: b,
31
- sx: { "& .details-container": { gap: 12 } }
16
+ completeColor: m,
17
+ icon: /* @__PURE__ */ r(f, {
18
+ categoryTint: B,
19
+ logo: p(o(t, "logo")),
20
+ size: b
21
+ }),
22
+ label: a ? /* @__PURE__ */ r(T, {
23
+ dangerouslySetInnerHTML: { __html: a },
24
+ sx: { "& .bold-copy": {
25
+ fontFamily: "inherit",
26
+ fontWeight: "fontWeightBold"
27
+ } },
28
+ variant: "body2"
29
+ }) : null,
30
+ labelBelowAmount: !0,
31
+ leftLabel: e(o(t, "spent_text")),
32
+ percentComplete: s,
33
+ rightLabel: e(o(t, "budgeted_text")),
34
+ sx: { gap: 12 }
32
35
  });
33
36
  };
34
37
  export {
35
- j as BudgetBlock
38
+ G as BudgetBlock
36
39
  };
37
40
 
38
41
  //# sourceMappingURL=BudgetBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BudgetBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.tsx"],"sourcesContent":["import { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy } from '../../../../common'\nimport type { BudgetBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport CategoryTile from '../../../components/CategoryTile'\nimport StatusIndicator from '../../../components/ComponentBlocks/StatusIndicator'\nimport LogoMark from '../../../components/LogoMark'\n\nimport type { BlockProps } from '../../types'\n\nimport { getColorByBudgetTier } from './util'\n\nexport const BudgetBlock = ({ payload }: BlockProps<BudgetBlockData>) => {\n const {\n budget_percent,\n amount,\n budget_tier,\n category_guid,\n merchant_guid,\n spent_amount,\n budgeted_amount,\n localized_payload,\n } = payload.instance_slot_data\n\n const color = getColorByBudgetTier(budget_tier)\n\n // Precomputed as a JSX element (not a component defined during render) so it\n // isn't remounted on every re-render.\n const icon = category_guid ? (\n <CategoryTile categoryGuid={category_guid} size={48} tint={0.25} />\n ) : (\n <LogoMark logo={{ merchant_guid }} size={48} />\n )\n\n const block_left_footer = buildDynamicCopy(\n localized_payload?.spent_label || '',\n formatCurrency(spent_amount, CURRENCY_FORMAT.cents),\n ) as string\n\n const block_right_footer = buildDynamicCopy(\n localized_payload?.budgeted_label || '',\n formatCurrency(budgeted_amount, CURRENCY_FORMAT.cents),\n ) as string\n\n const amountToDisplay = (\n <Text bold={true} variant=\"h2\">\n {category_guid && category_guid !== null\n ? (buildDynamicCopy(\n localized_payload?.amount_left_label || '',\n formatCurrency(amount, CURRENCY_FORMAT.cents),\n ) as string)\n : formatCurrency(amount, CURRENCY_FORMAT.cents)}\n </Text>\n )\n\n return (\n <StatusIndicator\n amount={amountToDisplay}\n // Figma 4008:215163.\n borderRadius=\"6px\"\n completeColor={color}\n icon={icon}\n label={localized_payload?.primary_text || ''}\n leftLabel={block_left_footer}\n percentComplete={budget_percent}\n rightLabel={block_right_footer}\n sx={{ '& .details-container': { gap: 12 } }}\n />\n )\n}\n"],"mappings":";;;;;;;;AAcA,IAAa,IAAA,CAAe,EAAE,SAAA,EAAA,MAA2C;AACvE,QAAM,EACJ,gBAAA,GACA,QAAA,GACA,aAAA,GACA,eAAA,GACA,eAAA,GACA,cAAA,GACA,iBAAA,GACA,mBAAA,EAAA,IACE,EAAQ,oBAEN,IAAQ,EAAqB,CAAW,GAIxC,IAAO,IACX,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc;AAAA,IAAe,MAAM;AAAA,IAAI,MAAM;AAAA,EAAO,CAAA,IAElE,gBAAA,EAAC,GAAD;AAAA,IAAU,MAAM,EAAE,eAAA,EAAc;AAAA,IAAG,MAAM;AAAA,EAAK,CAAA,GAG1C,IAAoB,EACxB,GAAmB,eAAe,IAClC,EAAe,GAAc,EAAgB,KAAK,CACpD,GAEM,IAAqB,EACzB,GAAmB,kBAAkB,IACrC,EAAe,GAAiB,EAAgB,KAAK,CACvD,GAEM,IACJ,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAM,SAAQ;AAAA,IACvB,UAAA,KAAiB,MAAkB,OAC/B,EACC,GAAmB,qBAAqB,IACxC,EAAe,GAAQ,EAAgB,KAAK,CAC9C,IACA,EAAe,GAAQ,EAAgB,KAAK;AAAA,EAC5C,CAAA;AAGR,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QAAQ;AAAA,IAER,cAAa;AAAA,IACb,eAAe;AAAA,IACT,MAAA;AAAA,IACN,OAAO,GAAmB,gBAAgB;AAAA,IAC1C,WAAW;AAAA,IACX,iBAAiB;AAAA,IACjB,YAAY;AAAA,IACZ,IAAI,EAAE,wBAAwB,EAAE,KAAK,GAAG,EAAE;AAAA,EAC3C,CAAA;AAEL"}
1
+ {"version":3,"file":"BudgetBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.tsx"],"sourcesContent":["import { H2, P } from '@mxenabled/mxui'\n\nimport { slot, type InsightsPayload } from '../../../../core'\n\nimport StatusIndicator from '../../../components/ComponentBlocks/StatusIndicator'\nimport LogoFromGuid from '../../../components/LogoFromGuid'\n\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText } from '../../slotReaders'\n\nimport { BUDGET_BLOCK_FALLBACK_VARIANT, BUDGET_BLOCK_LAYOUT } from './layout'\n\nconst TILE_SIZE = 48\n\nconst CATEGORY_TINT = 0.25\n\n/** The budget card, from the Insights 2.0 slots on `instance_slot.data` (ditto budget_block.yml). */\nexport const BudgetBlock = ({ payload }: { payload: InsightsPayload }) => {\n const { data, variant } = payload.instance_slot\n const amountText = asText(slot(data, 'amount_text'))\n // Fail closed: without its amount the card says nothing true.\n if (!amountText) return null\n\n const { barColor } = resolveVariantConfig(\n BUDGET_BLOCK_LAYOUT,\n variant,\n BUDGET_BLOCK_FALLBACK_VARIANT,\n 'BudgetBlock',\n )\n const percent = Math.min(100, Math.max(0, asNumber(slot(data, 'percent')) ?? 0))\n const subText = asText(slot(data, 'sub_text'))\n\n // Figma 156:34790: 48px tile, h2 amount at 700 over its month line (\"to spend in **November**\",\n // body2 with the month bold), a 12px bar with 6px corners, 12px gaps.\n return (\n <StatusIndicator\n amount={<H2>{amountText}</H2>}\n borderRadius=\"6px\"\n completeColor={barColor}\n // A category's tile is tinted; a merchant's logo draws as itself.\n icon={\n <LogoFromGuid\n categoryTint={CATEGORY_TINT}\n logo={asLogoRef(slot(data, 'logo'))}\n size={TILE_SIZE}\n />\n }\n label={\n subText ? (\n // sub_text is mrs_content copy rendered server-side (its only markup the bold-copy span),\n // not user input; painted the same way the card paints description.html_text.\n <P\n dangerouslySetInnerHTML={{ __html: subText }}\n sx={{\n '& .bold-copy': {\n fontFamily: 'inherit',\n fontWeight: 'fontWeightBold',\n },\n }}\n variant=\"body2\"\n />\n ) : null\n }\n labelBelowAmount={true}\n leftLabel={asText(slot(data, 'spent_text'))}\n percentComplete={percent}\n rightLabel={asText(slot(data, 'budgeted_text'))}\n sx={{ gap: 12 }}\n />\n )\n}\n"],"mappings":";;;;;;;;AAYA,IAAM,IAAY,IAEZ,IAAgB,MAGT,IAAA,CAAe,EAAE,SAAA,EAAA,MAA4C;AACxE,QAAM,EAAE,MAAA,GAAM,SAAA,EAAA,IAAY,EAAQ,eAC5B,IAAa,EAAO,EAAK,GAAM,aAAa,CAAC;AAEnD,MAAI,CAAC,EAAY,QAAO;AAExB,QAAM,EAAE,UAAA,EAAA,IAAa,EACnB,GACA,GACA,GACA,aACF,GACM,IAAU,KAAK,IAAI,KAAK,KAAK,IAAI,GAAG,EAAS,EAAK,GAAM,SAAS,CAAC,KAAK,CAAC,CAAC,GACzE,IAAU,EAAO,EAAK,GAAM,UAAU,CAAC;AAI7C,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QAAQ,gBAAA,EAAC,GAAD,EAAA,UAAK,EAAe,CAAA;AAAA,IAC5B,cAAa;AAAA,IACb,eAAe;AAAA,IAEf,MACE,gBAAA,EAAC,GAAD;AAAA,MACE,cAAc;AAAA,MACd,MAAM,EAAU,EAAK,GAAM,MAAM,CAAC;AAAA,MAClC,MAAM;AAAA,IACP,CAAA;AAAA,IAEH,OACE,IAGE,gBAAA,EAAC,GAAD;AAAA,MACE,yBAAyB,EAAE,QAAQ,EAAQ;AAAA,MAC3C,IAAI,EACF,gBAAgB;AAAA,QACd,YAAY;AAAA,QACZ,YAAY;AAAA,MACd,EACF;AAAA,MACA,SAAQ;AAAA,IACT,CAAA,IACC;AAAA,IAEN,kBAAkB;AAAA,IAClB,WAAW,EAAO,EAAK,GAAM,YAAY,CAAC;AAAA,IAC1C,iBAAiB;AAAA,IACjB,YAAY,EAAO,EAAK,GAAM,eAAe,CAAC;AAAA,IAC9C,IAAI,EAAE,KAAK,GAAG;AAAA,EACf,CAAA;AAEL"}
@@ -0,0 +1,8 @@
1
+ /** Category Budget V2's bar colour per ditto layout variant (budget_block). */
2
+ export type BudgetBlockVariant = 'status_on_track' | 'status_near' | 'status_off_track';
3
+ export interface BudgetBlockLayoutConfig {
4
+ /** Theme colour path for the bar's fill. */
5
+ barColor: string;
6
+ }
7
+ export declare const BUDGET_BLOCK_LAYOUT: Record<BudgetBlockVariant, BudgetBlockLayoutConfig>;
8
+ export declare const BUDGET_BLOCK_FALLBACK_VARIANT: BudgetBlockVariant;
@@ -0,0 +1,11 @@
1
+ var a = {
2
+ status_on_track: { barColor: "success.main" },
3
+ status_near: { barColor: "warning.main" },
4
+ status_off_track: { barColor: "error.main" }
5
+ }, r = "status_on_track";
6
+ export {
7
+ r as BUDGET_BLOCK_FALLBACK_VARIANT,
8
+ a as BUDGET_BLOCK_LAYOUT
9
+ };
10
+
11
+ //# sourceMappingURL=layout.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.ts"],"sourcesContent":["/** Category Budget V2's bar colour per ditto layout variant (budget_block). */\nexport type BudgetBlockVariant = 'status_on_track' | 'status_near' | 'status_off_track'\n\nexport interface BudgetBlockLayoutConfig {\n /** Theme colour path for the bar's fill. */\n barColor: string\n}\n\nexport const BUDGET_BLOCK_LAYOUT: Record<BudgetBlockVariant, BudgetBlockLayoutConfig> = {\n status_on_track: { barColor: 'success.main' },\n status_near: { barColor: 'warning.main' },\n status_off_track: { barColor: 'error.main' },\n}\n\nexport const BUDGET_BLOCK_FALLBACK_VARIANT: BudgetBlockVariant = 'status_on_track'\n"],"mappings":"AAQA,IAAa,IAA2E;AAAA,EACtF,iBAAiB,EAAE,UAAU,eAAe;AAAA,EAC5C,aAAa,EAAE,UAAU,eAAe;AAAA,EACxC,kBAAkB,EAAE,UAAU,aAAa;AAC7C,GAEa,IAAoD"}
@@ -1 +1 @@
1
- {"version":3,"file":"CategoryTile.es.js","names":[],"sources":["../../../src/insights-v2/components/CategoryTile.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon } from '@mxenabled/mxui'\n\nimport { useCategoryStore } from '../../common'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\n\ninterface CategoryTileProps {\n categoryGuid: string\n size: number\n /** Opacity of the category colour behind the glyph, with a category-colour border; none = mxui's tile. */\n tint?: number\n}\n\n/**\n * A category's icon tile. The guid walks up to its top-level parent first: `CategoryIcon` and\n * `getCategoryColor` only know those, and draw a sub-category as Uncategorized.\n */\nconst CategoryTile = observer(({ categoryGuid, size, tint }: CategoryTileProps) => {\n const theme = useTheme()\n const guid = useCategoryStore().getTopLevelCategoryGuid(categoryGuid)\n const color = getCategoryColor(guid, theme)\n\n return (\n <Box data-testid={`category-icon-${guid}`} sx={{ display: 'flex' }}>\n <CategoryIcon\n categoryGuid={guid}\n size={size}\n sx={\n tint === undefined\n ? undefined\n : { bgcolor: alpha(color, tint), border: `1px solid ${color}`, color: 'text.primary' }\n }\n />\n </Box>\n )\n})\n\nexport default CategoryTile\n"],"mappings":";;;;;;;AAqBA,IAAM,IAAe,EAAA,CAAU,EAAE,cAAA,GAAc,MAAA,GAAM,MAAA,EAAA,MAA8B;AACjF,QAAM,IAAQ,EAAS,GACjB,IAAO,EAAiB,EAAE,wBAAwB,CAAY,GAC9D,IAAQ,EAAiB,GAAM,CAAK;AAE1C,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,eAAa,iBAAiB,CAAA;AAAA,IAAQ,IAAI,EAAE,SAAS,OAAO;AAAA,IAC/D,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,cAAc;AAAA,MACR,MAAA;AAAA,MACN,IACE,MAAS,SACL,SACA;AAAA,QAAE,SAAS,EAAM,GAAO,CAAI;AAAA,QAAG,QAAQ,aAAa,CAAA;AAAA,QAAS,OAAO;AAAA,MAAe;AAAA,IAE1F,CAAA;AAAA,EACE,CAAA;AAET,CAAC"}
1
+ {"version":3,"file":"CategoryTile.es.js","names":[],"sources":["../../../src/insights-v2/components/CategoryTile.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon } from '@mxenabled/mxui'\n\nimport { useCategoryStore } from '../../common/context/hooks'\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\n\ninterface CategoryTileProps {\n categoryGuid: string\n size: number\n /** Opacity of the category colour behind the glyph, with a category-colour border; none = mxui's tile. */\n tint?: number\n}\n\n/**\n * A category's icon tile. The guid walks up to its top-level parent first: `CategoryIcon` and\n * `getCategoryColor` only know those, and draw a sub-category as Uncategorized.\n */\nconst CategoryTile = observer(({ categoryGuid, size, tint }: CategoryTileProps) => {\n const theme = useTheme()\n const guid = useCategoryStore().getTopLevelCategoryGuid(categoryGuid)\n const color = getCategoryColor(guid, theme)\n\n return (\n <Box data-testid={`category-icon-${guid}`} sx={{ display: 'flex' }}>\n <CategoryIcon\n categoryGuid={guid}\n size={size}\n sx={\n tint === undefined\n ? undefined\n : { bgcolor: alpha(color, tint), border: `1px solid ${color}`, color: 'text.primary' }\n }\n />\n </Box>\n )\n})\n\nexport default CategoryTile\n"],"mappings":";;;;;;;AAqBA,IAAM,IAAe,EAAA,CAAU,EAAE,cAAA,GAAc,MAAA,GAAM,MAAA,EAAA,MAA8B;AACjF,QAAM,IAAQ,EAAS,GACjB,IAAO,EAAiB,EAAE,wBAAwB,CAAY,GAC9D,IAAQ,EAAiB,GAAM,CAAK;AAE1C,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,eAAa,iBAAiB,CAAA;AAAA,IAAQ,IAAI,EAAE,SAAS,OAAO;AAAA,IAC/D,UAAA,gBAAA,EAAC,GAAD;AAAA,MACE,cAAc;AAAA,MACR,MAAA;AAAA,MACN,IACE,MAAS,SACL,SACA;AAAA,QAAE,SAAS,EAAM,GAAO,CAAI;AAAA,QAAG,QAAQ,aAAa,CAAA;AAAA,QAAS,OAAO;AAAA,MAAe;AAAA,IAE1F,CAAA;AAAA,EACE,CAAA;AAET,CAAC"}
@@ -5,6 +5,8 @@ interface StatusIndicatorProps {
5
5
  completeColor?: string;
6
6
  icon: React.ReactNode;
7
7
  label: string | React.ReactNode;
8
+ /** Draw the label under the amount instead of above it. Default false. */
9
+ labelBelowAmount?: boolean;
8
10
  leftLabel?: string;
9
11
  /** Type of `leftLabel` / `rightLabel` under the bar (not `label`): caption on the card, body2 in the drawer. */
10
12
  labelVariant?: 'caption' | 'body2';
@@ -12,5 +14,5 @@ interface StatusIndicatorProps {
12
14
  rightLabel?: string;
13
15
  sx?: SxProps;
14
16
  }
15
- declare const StatusIndicator: ({ amount, borderRadius, completeColor, icon, label, leftLabel, labelVariant, percentComplete, rightLabel, sx, }: StatusIndicatorProps) => import("react/jsx-runtime").JSX.Element;
17
+ declare const StatusIndicator: ({ amount, borderRadius, completeColor, icon, label, labelBelowAmount, leftLabel, labelVariant, percentComplete, rightLabel, sx, }: StatusIndicatorProps) => import("react/jsx-runtime").JSX.Element;
16
18
  export default StatusIndicator;
@@ -1,65 +1,77 @@
1
- import r from "@mui/material/Stack";
2
- import { H2 as g, P as m, Text as c } from "@mxenabled/mxui";
3
- import { jsx as t, jsxs as i } from "react/jsx-runtime";
4
- import a from "@mui/material/Box";
5
- var j = ({ amount: e, borderRadius: o = "2px", completeColor: d = "success.main", icon: x, label: n, leftLabel: l, labelVariant: s = "caption", percentComplete: h = 0, rightLabel: p, sx: f }) => /* @__PURE__ */ i(r, {
6
- className: "details-container",
7
- sx: {
8
- px: 16,
9
- py: 8,
10
- width: "100%",
11
- gap: 16,
12
- ...f
13
- },
14
- children: [/* @__PURE__ */ i(r, {
1
+ import i from "@mui/material/Stack";
2
+ import { H2 as v, P as u, Text as h } from "@mxenabled/mxui";
3
+ import { jsx as r, jsxs as t } from "react/jsx-runtime";
4
+ import p from "@mui/material/Box";
5
+ var D = ({ amount: a, borderRadius: o = "2px", completeColor: f = "success.main", icon: m, label: e, labelBelowAmount: n = !1, leftLabel: s, labelVariant: c = "caption", percentComplete: d = 0, rightLabel: l, sx: g }) => {
6
+ const x = typeof e == "string" ? /* @__PURE__ */ r(u, {
7
+ dangerouslySetInnerHTML: { __html: e },
8
+ variant: "body2"
9
+ }) : e;
10
+ return /* @__PURE__ */ t(i, {
11
+ className: "details-container",
15
12
  sx: {
16
- alignItems: "center",
17
- flexDirection: "row",
18
- gap: 12
13
+ px: 16,
14
+ py: 8,
15
+ width: "100%",
16
+ gap: 16,
17
+ ...g
19
18
  },
20
- children: [/* @__PURE__ */ t(a, { children: x }), /* @__PURE__ */ i(r, { children: [typeof n == "string" ? /* @__PURE__ */ t(m, {
21
- dangerouslySetInnerHTML: { __html: n },
22
- variant: "body2"
23
- }) : n, typeof e == "string" ? /* @__PURE__ */ t(g, { children: e }) : e] })]
24
- }), /* @__PURE__ */ i(r, {
25
- sx: { gap: 4 },
26
- children: [/* @__PURE__ */ t(r, {
27
- "data-testid": "status-indicator-track",
19
+ children: [/* @__PURE__ */ t(i, {
28
20
  sx: {
29
- bgcolor: "divider",
30
- borderRadius: o,
21
+ alignItems: "center",
31
22
  flexDirection: "row",
32
- height: 12,
33
- width: "100%"
23
+ gap: 12
34
24
  },
35
- children: /* @__PURE__ */ t(a, {
36
- "data-testid": "status-indicator-fill",
25
+ children: [/* @__PURE__ */ r(p, { children: m }), /* @__PURE__ */ t(i, { children: [
26
+ !n && x,
27
+ typeof a == "string" ? /* @__PURE__ */ r(v, { children: a }) : a,
28
+ n && x
29
+ ] })]
30
+ }), /* @__PURE__ */ t(i, {
31
+ sx: { gap: 4 },
32
+ children: [/* @__PURE__ */ r(i, {
33
+ "aria-label": [s, l].filter(Boolean).join(", ") || void 0,
34
+ "aria-valuemax": 100,
35
+ "aria-valuemin": 0,
36
+ "aria-valuenow": Math.round(Math.min(100, Math.max(0, d))),
37
+ "data-testid": "status-indicator-track",
38
+ role: "progressbar",
37
39
  sx: {
38
- bgcolor: d,
40
+ bgcolor: "divider",
39
41
  borderRadius: o,
42
+ flexDirection: "row",
40
43
  height: 12,
41
- width: `${h}%`
42
- }
43
- })
44
- }), /* @__PURE__ */ i(r, {
45
- sx: {
46
- flexDirection: "row",
47
- justifyContent: "space-between"
48
- },
49
- children: [/* @__PURE__ */ t(c, {
50
- sx: { color: "text.secondary" },
51
- variant: s,
52
- children: l
53
- }), /* @__PURE__ */ t(c, {
54
- sx: { color: "text.secondary" },
55
- variant: s,
56
- children: p
44
+ width: "100%"
45
+ },
46
+ children: /* @__PURE__ */ r(p, {
47
+ "data-testid": "status-indicator-fill",
48
+ sx: {
49
+ bgcolor: f,
50
+ borderRadius: o,
51
+ height: 12,
52
+ width: `${d}%`
53
+ }
54
+ })
55
+ }), /* @__PURE__ */ t(i, {
56
+ sx: {
57
+ flexDirection: "row",
58
+ justifyContent: "space-between"
59
+ },
60
+ children: [/* @__PURE__ */ r(h, {
61
+ sx: { color: "text.secondary" },
62
+ variant: c,
63
+ children: s
64
+ }), /* @__PURE__ */ r(h, {
65
+ sx: { color: "text.secondary" },
66
+ variant: c,
67
+ children: l
68
+ })]
57
69
  })]
58
70
  })]
59
- })]
60
- });
71
+ });
72
+ };
61
73
  export {
62
- j as default
74
+ D as default
63
75
  };
64
76
 
65
77
  //# sourceMappingURL=StatusIndicator.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"StatusIndicator.es.js","names":[],"sources":["../../../../src/insights-v2/components/ComponentBlocks/StatusIndicator.tsx"],"sourcesContent":["import { H2, P, Text } from '@mxenabled/mxui'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\ninterface StatusIndicatorProps {\n amount: string | React.ReactNode\n borderRadius?: string\n completeColor?: string\n icon: React.ReactNode\n label: string | React.ReactNode\n leftLabel?: string\n /** Type of `leftLabel` / `rightLabel` under the bar (not `label`): caption on the card, body2 in the drawer. */\n labelVariant?: 'caption' | 'body2'\n percentComplete?: number\n rightLabel?: string\n sx?: SxProps\n}\n\nconst StatusIndicator = ({\n amount,\n borderRadius = '2px',\n completeColor = 'success.main',\n icon,\n label,\n leftLabel,\n labelVariant = 'caption',\n percentComplete = 0,\n rightLabel,\n sx,\n}: StatusIndicatorProps) => {\n return (\n <Stack className=\"details-container\" sx={{ px: 16, py: 8, width: '100%', gap: 16, ...sx }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box>{icon}</Box>\n <Stack>\n {typeof label === 'string' ? (\n <P dangerouslySetInnerHTML={{ __html: label }} variant={'body2'} />\n ) : (\n label\n )}\n {typeof amount === 'string' ? <H2>{amount}</H2> : amount}\n </Stack>\n </Stack>\n <Stack sx={{ gap: 4 }}>\n <Stack\n data-testid=\"status-indicator-track\"\n sx={{\n bgcolor: 'divider',\n borderRadius,\n flexDirection: 'row',\n height: 12,\n width: '100%',\n }}\n >\n <Box\n data-testid=\"status-indicator-fill\"\n sx={{\n bgcolor: completeColor,\n borderRadius,\n height: 12,\n width: `${percentComplete}%`,\n }}\n />\n </Stack>\n\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text sx={{ color: 'text.secondary' }} variant={labelVariant}>\n {leftLabel}\n </Text>\n <Text sx={{ color: 'text.secondary' }} variant={labelVariant}>\n {rightLabel}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default StatusIndicator\n"],"mappings":";;;;AAoBA,IAAM,IAAA,CAAmB,EACvB,QAAA,GACA,cAAA,IAAe,OACf,eAAA,IAAgB,gBAChB,MA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gBAAgB;AAAA,MAAgB;AAAA,MAAnE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,IAAI,EAAE,OAAO,iBAAiB;AAAA,QAAG,SAAS;AAAA,QAC7C,UAAA;AAAA,MACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,QAAM,IAAI,EAAE,OAAO,iBAAiB;AAAA,QAAG,SAAS;AAAA,QAC7C,UAAA;AAAA,MACG,CAAA,CACD;AAAA,IACF,CAAA,CAAA;AAAA,EACF,CAAA,CAAA"}
1
+ {"version":3,"file":"StatusIndicator.es.js","names":[],"sources":["../../../../src/insights-v2/components/ComponentBlocks/StatusIndicator.tsx"],"sourcesContent":["import { H2, P, Text } from '@mxenabled/mxui'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\ninterface StatusIndicatorProps {\n amount: string | React.ReactNode\n borderRadius?: string\n completeColor?: string\n icon: React.ReactNode\n label: string | React.ReactNode\n /** Draw the label under the amount instead of above it. Default false. */\n labelBelowAmount?: boolean\n leftLabel?: string\n /** Type of `leftLabel` / `rightLabel` under the bar (not `label`): caption on the card, body2 in the drawer. */\n labelVariant?: 'caption' | 'body2'\n percentComplete?: number\n rightLabel?: string\n sx?: SxProps\n}\n\nconst StatusIndicator = ({\n amount,\n borderRadius = '2px',\n completeColor = 'success.main',\n icon,\n label,\n labelBelowAmount = false,\n leftLabel,\n labelVariant = 'caption',\n percentComplete = 0,\n rightLabel,\n sx,\n}: StatusIndicatorProps) => {\n const labelNode =\n typeof label === 'string' ? (\n <P dangerouslySetInnerHTML={{ __html: label }} variant={'body2'} />\n ) : (\n label\n )\n\n return (\n <Stack className=\"details-container\" sx={{ px: 16, py: 8, width: '100%', gap: 16, ...sx }}>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 12 }}>\n <Box>{icon}</Box>\n <Stack>\n {!labelBelowAmount && labelNode}\n {typeof amount === 'string' ? <H2>{amount}</H2> : amount}\n {labelBelowAmount && labelNode}\n </Stack>\n </Stack>\n <Stack sx={{ gap: 4 }}>\n <Stack\n aria-label={[leftLabel, rightLabel].filter(Boolean).join(', ') || undefined}\n aria-valuemax={100}\n aria-valuemin={0}\n aria-valuenow={Math.round(Math.min(100, Math.max(0, percentComplete)))}\n data-testid=\"status-indicator-track\"\n role=\"progressbar\"\n sx={{\n bgcolor: 'divider',\n borderRadius,\n flexDirection: 'row',\n height: 12,\n width: '100%',\n }}\n >\n <Box\n data-testid=\"status-indicator-fill\"\n sx={{\n bgcolor: completeColor,\n borderRadius,\n height: 12,\n width: `${percentComplete}%`,\n }}\n />\n </Stack>\n\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text sx={{ color: 'text.secondary' }} variant={labelVariant}>\n {leftLabel}\n </Text>\n <Text sx={{ color: 'text.secondary' }} variant={labelVariant}>\n {rightLabel}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n )\n}\n\nexport default StatusIndicator\n"],"mappings":";;;;AAsBA,IAAM,IAAA,CAAmB,EACvB,QAAA,GACA,cAAA,IAAe,OACf,eAAA,IAAgB,gBAChB,MAAA,GACA,OAAA,GACA,kBAAA,IAAmB,IACnB,WAAA,GACA,cAAA,IAAe,WACf,iBAAA,IAAkB,GAClB,YAAA,GACA,IAAA,EAAA,MAC0B;AAC1B,QAAM,IACJ,OAAO,KAAU,WACf,gBAAA,EAAC,GAAD;AAAA,IAAG,yBAAyB,EAAE,QAAQ,EAAM;AAAA,IAAG,SAAS;AAAA,EAAU,CAAA,IAElE;AAGJ,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,WAAU;AAAA,IAAoB,IAAI;AAAA,MAAE,IAAI;AAAA,MAAI,IAAI;AAAA,MAAG,OAAO;AAAA,MAAQ,KAAK;AAAA,MAAI,GAAG;AAAA,IAAG;AAAA,IAAxF,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,YAAY;AAAA,QAAU,eAAe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,OAAO,iBAAiB;AAAA,UAAG,SAAS;AAAA,UAC7C,UAAA;AAAA,QACG,CAAA,CACD;AAAA,MACF,CAAA,CAAA;AAAA,IACF,CAAA,CAAA;AAAA;AAEX"}
@@ -6,11 +6,13 @@ export interface LogoFromGuidProps {
6
6
  /** Rendered square size in px (32 on rows, 40 on the compact card, 33 on the notification row). */
7
7
  size: number;
8
8
  className?: string;
9
+ /** A category tile's tint: its colour at this opacity behind the glyph, bordered in it (budget tiles). */
10
+ categoryTint?: number;
9
11
  }
10
12
  /**
11
13
  * One component for every V2 logo. The envelope sends a single `{ guid, fallback_guid?, alt? }`
12
14
  * object whose prefix says what it is; anything else (`PARENT-ENTITY`, an `ACT-`/`BGT-` guid, an
13
15
  * empty guid) renders nothing, never a guess. The asset → category tile → `alt` fallback is mxui's.
14
16
  */
15
- declare const LogoFromGuid: ({ className, logo, size }: LogoFromGuidProps) => import("react/jsx-runtime").JSX.Element | null;
17
+ declare const LogoFromGuid: ({ categoryTint, className, logo, size }: LogoFromGuidProps) => import("react/jsx-runtime").JSX.Element | null;
16
18
  export default LogoFromGuid;
@@ -1,17 +1,17 @@
1
- import l, { isKnownIcon as n } from "./LogoMark.es.js";
2
- import { logoFromRef as a } from "./shared/EntityLogo.es.js";
1
+ import n, { isKnownIcon as a } from "./LogoMark.es.js";
2
+ import { logoFromRef as u } from "./shared/EntityLogo.es.js";
3
3
  import { jsx as e } from "react/jsx-runtime";
4
- import u from "@mui/material/Box";
5
- var f = /^(MCH|CAT|INS)-|^ICO-[a-z0-9_-]+$/, d = (o) => !!o && f.test(o), _ = ({ className: o, logo: r, size: i }) => {
6
- if (!r || !d(r.guid)) return null;
7
- const t = a({
4
+ import f from "@mui/material/Box";
5
+ var d = /^(MCH|CAT|INS)-|^ICO-[a-z0-9_-]+$/, m = (o) => !!o && d.test(o), p = ({ categoryTint: o, className: l, logo: r, size: i }) => {
6
+ if (!r || !m(r.guid)) return null;
7
+ const t = u({
8
8
  alt: r.alt,
9
9
  color: r.color,
10
10
  fallback_guid: r.fallback_guid,
11
11
  guid: r.guid
12
12
  });
13
- return !t || t.logo_name && !n(t.logo_name) ? null : /* @__PURE__ */ e(u, {
14
- className: o,
13
+ return !t || t.logo_name && !a(t.logo_name) ? null : /* @__PURE__ */ e(f, {
14
+ className: l,
15
15
  "data-testid": "logo-from-guid",
16
16
  sx: {
17
17
  alignItems: "center",
@@ -21,15 +21,16 @@ var f = /^(MCH|CAT|INS)-|^ICO-[a-z0-9_-]+$/, d = (o) => !!o && f.test(o), _ = ({
21
21
  justifyContent: "center",
22
22
  width: i
23
23
  },
24
- children: /* @__PURE__ */ e(l, {
24
+ children: /* @__PURE__ */ e(n, {
25
+ categoryTint: o,
25
26
  logo: t,
26
27
  size: i
27
28
  })
28
29
  });
29
30
  };
30
31
  export {
31
- _ as default,
32
- d as isLogoGuid
32
+ p as default,
33
+ m as isLogoGuid
33
34
  };
34
35
 
35
36
  //# sourceMappingURL=LogoFromGuid.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogoFromGuid.es.js","names":[],"sources":["../../../src/insights-v2/components/LogoFromGuid.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\n\nimport type { LogoRef } from '../../core'\nimport LogoMark, { isKnownIcon } from './LogoMark'\nimport { logoFromRef } from './shared/EntityLogo'\n\n/**\n * The guid prefixes that name a logo entity. A prefix heuristic by design: the V2 envelope carries\n * the entity only in the guid, and the notification row relies on non-insight rows carrying account\n * or budget guids and legacy insight rows carrying the `\"PARENT-ENTITY\"` sentinel. Exported beside\n * the component so a caller's branch (`NotificationCard`) and the dispatch here cannot drift apart.\n */\nconst LOGO_GUID_PREFIX = /^(MCH|CAT|INS)-|^ICO-[a-z0-9_-]+$/\n\nexport const isLogoGuid = (guid?: string | null): guid is string =>\n !!guid && LOGO_GUID_PREFIX.test(guid)\n\nexport interface LogoFromGuidProps {\n /** The envelope's logo object: `{ guid, fallback_guid?, alt?, color? }` (`color` is read for `ICO-` icons). */\n logo?: Pick<LogoRef, 'alt' | 'color' | 'fallback_guid' | 'guid'> | null\n /** Rendered square size in px (32 on rows, 40 on the compact card, 33 on the notification row). */\n size: number\n className?: string\n}\n\n/**\n * One component for every V2 logo. The envelope sends a single `{ guid, fallback_guid?, alt? }`\n * object whose prefix says what it is; anything else (`PARENT-ENTITY`, an `ACT-`/`BGT-` guid, an\n * empty guid) renders nothing, never a guess. The asset → category tile → `alt` fallback is mxui's.\n */\nconst LogoFromGuid = ({ className, logo, size }: LogoFromGuidProps) => {\n if (!logo || !isLogoGuid(logo.guid)) return null\n\n // Guid-only on purpose: `logoFromRef` lets a status `icon` win over `guid`, which is right for a\n // row but would silently turn this component into an icon renderer.\n const resolved = logoFromRef({\n alt: logo.alt,\n color: logo.color,\n fallback_guid: logo.fallback_guid,\n guid: logo.guid,\n })\n\n if (!resolved) return null\n\n // Checked before the sized box, so an unknown icon leaves no empty gap.\n if (resolved.logo_name && !isKnownIcon(resolved.logo_name)) return null\n\n return (\n <Box\n className={className}\n data-testid=\"logo-from-guid\"\n sx={{\n alignItems: 'center',\n display: 'flex',\n flexShrink: 0,\n height: size,\n justifyContent: 'center',\n width: size,\n }}\n >\n <LogoMark logo={resolved} size={size} />\n </Box>\n )\n}\n\nexport default LogoFromGuid\n"],"mappings":";;;;AAYA,IAAM,IAAmB,qCAEZ,IAAA,CAAc,MACzB,CAAC,CAAC,KAAQ,EAAiB,KAAK,CAAI,GAehC,IAAA,CAAgB,EAAE,WAAA,GAAW,MAAA,GAAM,MAAA,EAAA,MAA8B;AACrE,MAAI,CAAC,KAAQ,CAAC,EAAW,EAAK,IAAI,EAAG,QAAO;AAI5C,QAAM,IAAW,EAAY;AAAA,IAC3B,KAAK,EAAK;AAAA,IACV,OAAO,EAAK;AAAA,IACZ,eAAe,EAAK;AAAA,IACpB,MAAM,EAAK;AAAA,EACb,CAAC;AAKD,SAHI,CAAC,KAGD,EAAS,aAAa,CAAC,EAAY,EAAS,SAAS,IAAU,OAGjE,gBAAA,EAAC,GAAD;AAAA,IACa,WAAA;AAAA,IACX,eAAY;AAAA,IACZ,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,OAAO;AAAA,IACT;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAU,MAAM;AAAA,MAAgB,MAAA;AAAA,IAAO,CAAA;AAAA,EACpC,CAAA;AAET"}
1
+ {"version":3,"file":"LogoFromGuid.es.js","names":[],"sources":["../../../src/insights-v2/components/LogoFromGuid.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\n\nimport type { LogoRef } from '../../core'\nimport LogoMark, { isKnownIcon } from './LogoMark'\nimport { logoFromRef } from './shared/EntityLogo'\n\n/**\n * The guid prefixes that name a logo entity. A prefix heuristic by design: the V2 envelope carries\n * the entity only in the guid, and the notification row relies on non-insight rows carrying account\n * or budget guids and legacy insight rows carrying the `\"PARENT-ENTITY\"` sentinel. Exported beside\n * the component so a caller's branch (`NotificationCard`) and the dispatch here cannot drift apart.\n */\nconst LOGO_GUID_PREFIX = /^(MCH|CAT|INS)-|^ICO-[a-z0-9_-]+$/\n\nexport const isLogoGuid = (guid?: string | null): guid is string =>\n !!guid && LOGO_GUID_PREFIX.test(guid)\n\nexport interface LogoFromGuidProps {\n /** The envelope's logo object: `{ guid, fallback_guid?, alt?, color? }` (`color` is read for `ICO-` icons). */\n logo?: Pick<LogoRef, 'alt' | 'color' | 'fallback_guid' | 'guid'> | null\n /** Rendered square size in px (32 on rows, 40 on the compact card, 33 on the notification row). */\n size: number\n className?: string\n /** A category tile's tint: its colour at this opacity behind the glyph, bordered in it (budget tiles). */\n categoryTint?: number\n}\n\n/**\n * One component for every V2 logo. The envelope sends a single `{ guid, fallback_guid?, alt? }`\n * object whose prefix says what it is; anything else (`PARENT-ENTITY`, an `ACT-`/`BGT-` guid, an\n * empty guid) renders nothing, never a guess. The asset → category tile → `alt` fallback is mxui's.\n */\nconst LogoFromGuid = ({ categoryTint, className, logo, size }: LogoFromGuidProps) => {\n if (!logo || !isLogoGuid(logo.guid)) return null\n\n // Guid-only on purpose: `logoFromRef` lets a status `icon` win over `guid`, which is right for a\n // row but would silently turn this component into an icon renderer.\n const resolved = logoFromRef({\n alt: logo.alt,\n color: logo.color,\n fallback_guid: logo.fallback_guid,\n guid: logo.guid,\n })\n\n if (!resolved) return null\n\n // Checked before the sized box, so an unknown icon leaves no empty gap.\n if (resolved.logo_name && !isKnownIcon(resolved.logo_name)) return null\n\n return (\n <Box\n className={className}\n data-testid=\"logo-from-guid\"\n sx={{\n alignItems: 'center',\n display: 'flex',\n flexShrink: 0,\n height: size,\n justifyContent: 'center',\n width: size,\n }}\n >\n <LogoMark categoryTint={categoryTint} logo={resolved} size={size} />\n </Box>\n )\n}\n\nexport default LogoFromGuid\n"],"mappings":";;;;AAYA,IAAM,IAAmB,qCAEZ,IAAA,CAAc,MACzB,CAAC,CAAC,KAAQ,EAAiB,KAAK,CAAI,GAiBhC,IAAA,CAAgB,EAAE,cAAA,GAAc,WAAA,GAAW,MAAA,GAAM,MAAA,EAAA,MAA8B;AACnF,MAAI,CAAC,KAAQ,CAAC,EAAW,EAAK,IAAI,EAAG,QAAO;AAI5C,QAAM,IAAW,EAAY;AAAA,IAC3B,KAAK,EAAK;AAAA,IACV,OAAO,EAAK;AAAA,IACZ,eAAe,EAAK;AAAA,IACpB,MAAM,EAAK;AAAA,EACb,CAAC;AAKD,SAHI,CAAC,KAGD,EAAS,aAAa,CAAC,EAAY,EAAS,SAAS,IAAU,OAGjE,gBAAA,EAAC,GAAD;AAAA,IACa,WAAA;AAAA,IACX,eAAY;AAAA,IACZ,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,SAAS;AAAA,MACT,YAAY;AAAA,MACZ,QAAQ;AAAA,MACR,gBAAgB;AAAA,MAChB,OAAO;AAAA,IACT;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAwB,cAAA;AAAA,MAAc,MAAM;AAAA,MAAgB,MAAA;AAAA,IAAO,CAAA;AAAA,EAChE,CAAA;AAET"}
@@ -2,6 +2,8 @@ import { Logo } from '../../core';
2
2
  interface LogoMarkProps {
3
3
  logo: Logo;
4
4
  size: number;
5
+ /** Passed to a category's `CategoryTile`; other logos ignore it. */
6
+ categoryTint?: number;
5
7
  }
6
8
  /**
7
9
  * Whether mx-icons draws `name` (own keys only, so `constructor` is rejected). An unknown name would
@@ -13,7 +15,7 @@ export declare const isKnownIcon: (name: string) => boolean;
13
15
  * parent as `CategoryTile` does, since mxui only knows those. Reads the category store, so it renders
14
16
  * inside the app's providers.
15
17
  */
16
- declare const LogoMark: (({ logo, size }: LogoMarkProps) => import("react/jsx-runtime").JSX.Element | null) & {
18
+ declare const LogoMark: (({ categoryTint, logo, size }: LogoMarkProps) => import("react/jsx-runtime").JSX.Element | null) & {
17
19
  displayName: string;
18
20
  };
19
21
  export default LogoMark;
@@ -1,33 +1,34 @@
1
- import { useCategoryStore as e } from "../../common/context/hooks.es.js";
2
- import o from "./CategoryTile.es.js";
3
- import { observer as a } from "mobx-react-lite";
4
- import { InstitutionLogo as u, MerchantLogo as m } from "@mxenabled/mxui";
5
- import { Icon as c, IconList as f } from "@mxenabled/mx-icons";
6
- import { jsx as n } from "react/jsx-runtime";
7
- var s = (r) => Object.hasOwn(f, r) ? !0 : (console.warn(`[LogoMark] "${r}" names no mx-icons icon — rendering nothing.`), !1), h = a(({ logo: r, size: t }) => {
8
- const { getTopLevelCategoryGuid: i } = e();
9
- return r.logo_name ? s(r.logo_name) ? /* @__PURE__ */ n(c, {
1
+ import { useCategoryStore as o } from "../../common/context/hooks.es.js";
2
+ import a from "./CategoryTile.es.js";
3
+ import { observer as u } from "mobx-react-lite";
4
+ import { InstitutionLogo as m, MerchantLogo as c } from "@mxenabled/mxui";
5
+ import { Icon as f, IconList as s } from "@mxenabled/mx-icons";
6
+ import { jsx as i } from "react/jsx-runtime";
7
+ var d = (t) => Object.hasOwn(s, t) ? !0 : (console.warn(`[LogoMark] "${t}" names no mx-icons icon — rendering nothing.`), !1), L = u(({ categoryTint: t, logo: r, size: n }) => {
8
+ const { getTopLevelCategoryGuid: e } = o();
9
+ return r.logo_name ? d(r.logo_name) ? /* @__PURE__ */ i(f, {
10
10
  fill: r.logo_fill,
11
11
  name: r.logo_name,
12
- size: t,
12
+ size: n,
13
13
  sx: { color: r.logo_color }
14
- }) : null : r.merchant_guid ? /* @__PURE__ */ n(m, {
14
+ }) : null : r.merchant_guid ? /* @__PURE__ */ i(c, {
15
15
  alt: r.merchant_name ?? "",
16
- categoryGuid: r.category_guid ? i(r.category_guid) : "",
16
+ categoryGuid: r.category_guid ? e(r.category_guid) : "",
17
17
  merchantGuid: r.merchant_guid,
18
- size: t
19
- }) : r.institution_guid ? /* @__PURE__ */ n(u, {
18
+ size: n
19
+ }) : r.institution_guid ? /* @__PURE__ */ i(m, {
20
20
  alt: r.institution_name ?? "",
21
21
  institutionGuid: r.institution_guid,
22
- size: t
23
- }) : r.category_guid ? /* @__PURE__ */ n(o, {
22
+ size: n
23
+ }) : r.category_guid ? /* @__PURE__ */ i(a, {
24
24
  categoryGuid: r.category_guid,
25
- size: t
25
+ size: n,
26
+ tint: t
26
27
  }) : null;
27
28
  });
28
29
  export {
29
- h as default,
30
- s as isKnownIcon
30
+ L as default,
31
+ d as isKnownIcon
31
32
  };
32
33
 
33
34
  //# sourceMappingURL=LogoMark.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogoMark.es.js","names":[],"sources":["../../../src/insights-v2/components/LogoMark.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { Icon, IconList } from '@mxenabled/mx-icons'\nimport { InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\n\nimport { useCategoryStore } from '../../common'\nimport type { Logo } from '../../core'\n\nimport CategoryTile from './CategoryTile'\n\ninterface LogoMarkProps {\n logo: Logo\n size: number\n}\n\n/**\n * Whether mx-icons draws `name` (own keys only, so `constructor` is rejected). An unknown name would\n * draw an empty box, so it is logged and the caller draws nothing.\n */\nexport const isKnownIcon = (name: string): boolean => {\n if (Object.hasOwn(IconList, name)) return true\n\n console.warn(`[LogoMark] \"${name}\" names no mx-icons icon — rendering nothing.`)\n return false\n}\n\n/**\n * A resolved `Logo` as its mxui component. A merchant's fallback category walks up to its top-level\n * parent as `CategoryTile` does, since mxui only knows those. Reads the category store, so it renders\n * inside the app's providers.\n */\nconst LogoMark = observer(({ logo, size }: LogoMarkProps) => {\n const { getTopLevelCategoryGuid } = useCategoryStore()\n\n if (logo.logo_name) {\n if (!isKnownIcon(logo.logo_name)) return null\n\n return (\n <Icon\n fill={logo.logo_fill}\n name={logo.logo_name}\n size={size}\n sx={{ color: logo.logo_color }}\n />\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? getTopLevelCategoryGuid(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={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={size}\n />\n )\n }\n\n if (logo.category_guid) {\n return <CategoryTile categoryGuid={logo.category_guid} size={size} />\n }\n\n return null\n})\n\nexport default LogoMark\n"],"mappings":";;;;;;AAmBA,IAAa,IAAA,CAAe,MACtB,OAAO,OAAO,GAAU,CAAI,IAAU,MAE1C,QAAQ,KAAK,eAAe,CAAA,+CAAmD,GACxE,KAQH,IAAW,EAAA,CAAU,EAAE,MAAA,GAAM,MAAA,EAAA,MAA0B;AAC3D,QAAM,EAAE,yBAAA,EAAA,IAA4B,EAAiB;AAErD,SAAI,EAAK,YACF,EAAY,EAAK,SAAS,IAG7B,gBAAA,EAAC,GAAD;AAAA,IACE,MAAM,EAAK;AAAA,IACX,MAAM,EAAK;AAAA,IACL,MAAA;AAAA,IACN,IAAI,EAAE,OAAO,EAAK,WAAW;AAAA,EAC9B,CAAA,IARsC,OAYvC,EAAK,gBAEL,gBAAA,EAAC,GAAD;AAAA,IACE,KAAK,EAAK,iBAAiB;AAAA,IAC3B,cAAc,EAAK,gBAAgB,EAAwB,EAAK,aAAa,IAAI;AAAA,IACjF,cAAc,EAAK;AAAA,IACb,MAAA;AAAA,EACP,CAAA,IAID,EAAK,mBAEL,gBAAA,EAAC,GAAD;AAAA,IACE,KAAK,EAAK,oBAAoB;AAAA,IAC9B,iBAAiB,EAAK;AAAA,IAChB,MAAA;AAAA,EACP,CAAA,IAID,EAAK,gBACA,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,EAAK;AAAA,IAAqB,MAAA;AAAA,EAAO,CAAA,IAG/D;AACT,CAAC"}
1
+ {"version":3,"file":"LogoMark.es.js","names":[],"sources":["../../../src/insights-v2/components/LogoMark.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport { Icon, IconList } from '@mxenabled/mx-icons'\nimport { InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\n\nimport { useCategoryStore } from '../../common'\nimport type { Logo } from '../../core'\n\nimport CategoryTile from './CategoryTile'\n\ninterface LogoMarkProps {\n logo: Logo\n size: number\n /** Passed to a category's `CategoryTile`; other logos ignore it. */\n categoryTint?: number\n}\n\n/**\n * Whether mx-icons draws `name` (own keys only, so `constructor` is rejected). An unknown name would\n * draw an empty box, so it is logged and the caller draws nothing.\n */\nexport const isKnownIcon = (name: string): boolean => {\n if (Object.hasOwn(IconList, name)) return true\n\n console.warn(`[LogoMark] \"${name}\" names no mx-icons icon — rendering nothing.`)\n return false\n}\n\n/**\n * A resolved `Logo` as its mxui component. A merchant's fallback category walks up to its top-level\n * parent as `CategoryTile` does, since mxui only knows those. Reads the category store, so it renders\n * inside the app's providers.\n */\nconst LogoMark = observer(({ categoryTint, logo, size }: LogoMarkProps) => {\n const { getTopLevelCategoryGuid } = useCategoryStore()\n\n if (logo.logo_name) {\n if (!isKnownIcon(logo.logo_name)) return null\n\n return (\n <Icon\n fill={logo.logo_fill}\n name={logo.logo_name}\n size={size}\n sx={{ color: logo.logo_color }}\n />\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name ?? ''}\n categoryGuid={logo.category_guid ? getTopLevelCategoryGuid(logo.category_guid) : ''}\n merchantGuid={logo.merchant_guid}\n size={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={size}\n />\n )\n }\n\n if (logo.category_guid) {\n return <CategoryTile categoryGuid={logo.category_guid} size={size} tint={categoryTint} />\n }\n\n return null\n})\n\nexport default LogoMark\n"],"mappings":";;;;;;AAqBA,IAAa,IAAA,CAAe,MACtB,OAAO,OAAO,GAAU,CAAI,IAAU,MAE1C,QAAQ,KAAK,eAAe,CAAA,+CAAmD,GACxE,KAQH,IAAW,EAAA,CAAU,EAAE,cAAA,GAAc,MAAA,GAAM,MAAA,EAAA,MAA0B;AACzE,QAAM,EAAE,yBAAA,EAAA,IAA4B,EAAiB;AAErD,SAAI,EAAK,YACF,EAAY,EAAK,SAAS,IAG7B,gBAAA,EAAC,GAAD;AAAA,IACE,MAAM,EAAK;AAAA,IACX,MAAM,EAAK;AAAA,IACL,MAAA;AAAA,IACN,IAAI,EAAE,OAAO,EAAK,WAAW;AAAA,EAC9B,CAAA,IARsC,OAYvC,EAAK,gBAEL,gBAAA,EAAC,GAAD;AAAA,IACE,KAAK,EAAK,iBAAiB;AAAA,IAC3B,cAAc,EAAK,gBAAgB,EAAwB,EAAK,aAAa,IAAI;AAAA,IACjF,cAAc,EAAK;AAAA,IACb,MAAA;AAAA,EACP,CAAA,IAID,EAAK,mBAEL,gBAAA,EAAC,GAAD;AAAA,IACE,KAAK,EAAK,oBAAoB;AAAA,IAC9B,iBAAiB,EAAK;AAAA,IAChB,MAAA;AAAA,EACP,CAAA,IAID,EAAK,gBACA,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,EAAK;AAAA,IAAqB,MAAA;AAAA,IAAM,MAAM;AAAA,EAAe,CAAA,IAGnF;AACT,CAAC"}
@@ -1,45 +1,45 @@
1
1
  import { GlobalDataContext as Z } from "../../common/context/GlobalDataProvider.es.js";
2
- import { slot as k } from "../../core/types/Insights.es.js";
2
+ import { slot as y } from "../../core/types/Insights.es.js";
3
3
  import { resolveInsightRender as b } from "../../insights-v2/resolveInsightRender.es.js";
4
- import { asLogoRef as S } from "../../insights-v2/blocks/slotReaders.es.js";
4
+ import { asLogoRef as F } from "../../insights-v2/blocks/slotReaders.es.js";
5
5
  import { hasDrawerBlock as ii } from "../../insights-v2/mappings/hasDrawerBlock.es.js";
6
6
  import ti, { isLogoGuid as ei } from "../../insights-v2/components/LogoFromGuid.es.js";
7
- import { statusIconAccentColor as oi, statusIconName as x, statusIconPalette as ri } from "../../insights-v2/components/statusIcon.es.js";
8
- import { ON_CLICK_EVENT as L, ON_VIEW_EVENT as ni, ON_VIEW_FIRST_TIME_EVENT as si } from "../constants/Analytics.es.js";
9
- import q from "../beaticons/BeatMaterialIcon.es.js";
7
+ import { statusIconAccentColor as oi, statusIconName as k, statusIconPalette as ri } from "../../insights-v2/components/statusIcon.es.js";
8
+ import { ON_CLICK_EVENT as S, ON_VIEW_EVENT as ni, ON_VIEW_FIRST_TIME_EVENT as si } from "../constants/Analytics.es.js";
9
+ import D from "../beaticons/BeatMaterialIcon.es.js";
10
10
  import { BeatIcon as ci } from "../beaticons/BeatIcon.es.js";
11
- import { useCopyStore as mi, useEvent as li, useInsightsMicroWidgetStore as ai } from "../context/hooks.es.js";
12
- import { microCardMinWidth as pi } from "../utils/cardWidth.es.js";
13
- import D from "../MicroCardTemplate.es.js";
14
- import di from "./InlineActionBlock.es.js";
15
- import { MicroCtaStatusGate as _i } from "./MicroCtaStatus.es.js";
11
+ import { useCopyStore as li, useEvent as mi, useInsightsMicroWidgetStore as ai } from "../context/hooks.es.js";
12
+ import { microCardMinWidth as _i } from "../utils/cardWidth.es.js";
13
+ import q from "../MicroCardTemplate.es.js";
14
+ import pi from "./InlineActionBlock.es.js";
15
+ import { MicroCtaStatusGate as di } from "./MicroCtaStatus.es.js";
16
16
  import ui from "../../insights-v2/components/InsightErrorCard.es.js";
17
17
  import gi, { useEffect as j, useState as fi } from "react";
18
18
  import { Fragment as hi, jsx as e, jsxs as Ii } from "react/jsx-runtime";
19
- import { alpha as z, useTheme as Ci } from "@mui/material/styles";
20
- import yi from "@mui/material/Box";
21
- import { useInView as vi } from "react-intersection-observer";
22
- var zi = ({ ariaLabel: g, beat: i, elevation: N, inDescriptionCtaBehavior: H = "external", index: s, isActiveCard: f, onCardClick: c, posthog: o, widthOverrides: h, variant: R, showIcon: T, heightOverrides: I }) => {
23
- const { ref: C, inView: m } = vi({ threshold: 1 }), y = Ci(), { cardsCopy: K } = mi(), { onEvent: l } = li(), { updateBeat: $, updateOffer: J } = ai(), a = "is_insights_v2" in i && i.is_insights_v2, p = a ? { metadata: { is_insights_v2: !0 } } : void 0;
19
+ import { alpha as K, useTheme as Ci } from "@mui/material/styles";
20
+ import Ei from "@mui/material/Box";
21
+ import { useInView as Ti } from "react-intersection-observer";
22
+ var vi = "budget_block", yi = 0.25, zi = ({ ariaLabel: g, beat: i, elevation: N, inDescriptionCtaBehavior: Y = "external", index: s, isActiveCard: f, onCardClick: c, posthog: r, widthOverrides: h, variant: R, showIcon: x, heightOverrides: I }) => {
23
+ const { ref: C, inView: l } = Ti({ threshold: 1 }), E = Ci(), { cardsCopy: z } = li(), { onEvent: m } = mi(), { updateBeat: H, updateOffer: $ } = ai(), a = "is_insights_v2" in i && i.is_insights_v2, _ = a ? { metadata: { is_insights_v2: !0 } } : void 0;
24
24
  j(() => {
25
- m && (i.has_been_displayed ? l(ni(i.template), p) : (i.guid.startsWith("OFR") ? J({
25
+ l && (i.has_been_displayed ? m(ni(i.template), _) : (i.guid.startsWith("OFR") ? $({
26
26
  ...i,
27
27
  has_been_displayed: !0
28
- }) : $({
28
+ }) : H({
29
29
  ...i,
30
30
  has_been_displayed: !0
31
- }), l(si(i.template), p)));
32
- }, [m]), j(() => {
33
- if (m && i) if (i.template === "MarketingOffer") {
31
+ }), m(si(i.template), _)));
32
+ }, [l]), j(() => {
33
+ if (l && i) if (i.template === "MarketingOffer") {
34
34
  const t = i;
35
- o?.capture("viewed_messaging_insight", {
35
+ r?.capture("viewed_messaging_insight", {
36
36
  template: i.template,
37
37
  campaign_guid: t.campaign_guid,
38
38
  campaign_name: t.pulse_campaign_name,
39
39
  offer_guid: t.guid,
40
40
  user_guid: t.user_guid
41
41
  });
42
- } else o?.capture("viewed_insight", {
42
+ } else r?.capture("viewed_insight", {
43
43
  beat_guid: i.guid,
44
44
  template: i.template,
45
45
  position: s,
@@ -48,26 +48,26 @@ var zi = ({ ariaLabel: g, beat: i, elevation: N, inDescriptionCtaBehavior: H = "
48
48
  }, [
49
49
  i,
50
50
  s,
51
- m
51
+ l
52
52
  ]);
53
- const V = b(i), r = V === "v2" ? i.insights_payload : void 0, Q = gi.useContext(Z) !== null, B = H === "internal" && Q && ii(r?.in_description_cta?.block), [M, U] = fi(0), d = () => {
54
- if (B ? U((t) => t + 1) : c && c(i), l(L(i.template), p), i.template === "MarketingOffer") {
53
+ const B = b(i), o = B === "v2" ? i.insights_payload : void 0, J = gi.useContext(Z) !== null, V = Y === "internal" && J && ii(o?.in_description_cta?.block), [M, Q] = fi(0), p = () => {
54
+ if (V ? Q((t) => t + 1) : c && c(i), m(S(i.template), _), i.template === "MarketingOffer") {
55
55
  const t = i;
56
- o?.capture("clicked_messaging_insight", {
56
+ r?.capture("clicked_messaging_insight", {
57
57
  template: i.template,
58
58
  campaign_guid: t.campaign_guid,
59
59
  campaign_name: t.pulse_campaign_name,
60
60
  offer_guid: t.guid,
61
61
  user_guid: t.user_guid
62
62
  });
63
- } else o?.capture("clicked_insight", {
63
+ } else r?.capture("clicked_insight", {
64
64
  beat_guid: i.guid,
65
65
  template: i.template,
66
66
  position: s,
67
67
  ...a && { is_insights_v2: !0 }
68
68
  });
69
69
  };
70
- return V === "error" ? /* @__PURE__ */ e(yi, {
70
+ return B === "error" ? /* @__PURE__ */ e(Ei, {
71
71
  "aria-hidden": !f,
72
72
  "aria-label": g,
73
73
  "aria-roledescription": "slide",
@@ -75,66 +75,67 @@ var zi = ({ ariaLabel: g, beat: i, elevation: N, inDescriptionCtaBehavior: H = "
75
75
  role: "group",
76
76
  sx: {
77
77
  height: I ? "100%" : 120,
78
- minWidth: pi(h),
78
+ minWidth: _i(h),
79
79
  my: 1
80
80
  },
81
81
  children: /* @__PURE__ */ e(ui, { beat: i })
82
- }) : r ? /* @__PURE__ */ e(_i, {
82
+ }) : o ? /* @__PURE__ */ e(di, {
83
83
  beat: i,
84
- posthog: o,
84
+ posthog: r,
85
85
  children: ({ presentation: n }) => {
86
- const w = n?.kind === "status" ? n : void 0, { data: v } = r.instance_slot, _ = S(k(v, "logo")), P = [w ? k(v, "reviewed_icon") : void 0, k(v, "icon")].map(S).find((Y) => x(Y?.guid)), E = x(_?.guid), W = E ? _?.color || "primary.main" : P?.color, A = E ?? x(P?.guid), F = ri(W), u = oi(y.palette, W), X = n ? w?.action?.label : r.primary_cta?.label || r.in_description_cta?.label || void 0, G = () => {
87
- c && c(i), l(L(i.template), p), o?.capture("clicked_insight", {
86
+ const O = n?.kind === "status" ? n : void 0, { data: T } = o.instance_slot, d = F(y(T, "logo")), A = [O ? y(T, "reviewed_icon") : void 0, y(T, "icon")].map(F).find((X) => k(X?.guid)), v = k(d?.guid), G = v ? d?.color || "primary.main" : A?.color, L = v ?? k(A?.guid), w = ri(G), u = oi(E.palette, G), U = n ? O?.action?.label : o.primary_cta?.label || o.in_description_cta?.label || void 0, P = () => {
87
+ c && c(i), m(S(i.template), _), r?.capture("clicked_insight", {
88
88
  beat_guid: i.guid,
89
89
  template: i.template,
90
90
  position: s,
91
91
  ...a && { is_insights_v2: !0 }
92
92
  });
93
- }, O = /* @__PURE__ */ e(D, {
93
+ }, W = /* @__PURE__ */ e(q, {
94
94
  "aria-roledescription": "slide",
95
95
  ariaLabel: g,
96
- description: r.description.html_text,
96
+ description: o.description.html_text,
97
97
  elevation: N,
98
98
  heightOverrides: I,
99
- icon: T && (ei(_?.guid) && !E ? /* @__PURE__ */ e(ti, {
100
- logo: _,
99
+ icon: x && (ei(d?.guid) && !v ? /* @__PURE__ */ e(ti, {
100
+ categoryTint: o.instance_slot.block === vi ? yi : void 0,
101
+ logo: d,
101
102
  size: 32
102
- }) : A ? /* @__PURE__ */ e(q, {
103
- bgColor: z(u ?? y.palette[F].main, 0.15),
104
- iconColor: u ? "inherit" : F,
105
- name: A,
103
+ }) : L ? /* @__PURE__ */ e(D, {
104
+ bgColor: K(u ?? E.palette[w].main, 0.15),
105
+ iconColor: u ? "inherit" : w,
106
+ name: L,
106
107
  sx: u ? { color: u } : void 0
107
- }) : /* @__PURE__ */ e(q, {
108
- bgColor: z(y.palette.primary.main, 0.15),
108
+ }) : /* @__PURE__ */ e(D, {
109
+ bgColor: K(E.palette.primary.main, 0.15),
109
110
  name: "lightbulb"
110
111
  })),
111
112
  isActiveCard: f,
112
113
  isInsightsV2: !0,
113
- onCardClick: n ? G : d,
114
- onPrimaryAction: n ? G : d,
115
- primaryActionText: X,
114
+ onCardClick: n ? P : p,
115
+ onPrimaryAction: n ? P : p,
116
+ primaryActionText: U,
116
117
  ref: C,
117
- title: n?.title || r.title || "",
118
+ title: n?.title || o.title || "",
118
119
  variant: R,
119
120
  widthOverrides: h
120
121
  });
121
- return B ? /* @__PURE__ */ Ii(hi, { children: [O, M > 0 && /* @__PURE__ */ e(di, {
122
+ return V ? /* @__PURE__ */ Ii(hi, { children: [W, M > 0 && /* @__PURE__ */ e(pi, {
122
123
  beat: i,
123
124
  openRequest: M,
124
- posthog: o
125
- })] }) : O;
125
+ posthog: r
126
+ })] }) : W;
126
127
  }
127
- }) : /* @__PURE__ */ e(D, {
128
+ }) : /* @__PURE__ */ e(q, {
128
129
  "aria-roledescription": "slide",
129
130
  ariaLabel: g,
130
131
  description: i?.html_micro_description && i?.html_micro_description.length > 0 ? i.html_micro_description : i.html_description || "",
131
132
  elevation: N,
132
133
  heightOverrides: I,
133
- icon: T && /* @__PURE__ */ e(ci, { beat: i }),
134
+ icon: x && /* @__PURE__ */ e(ci, { beat: i }),
134
135
  isActiveCard: f,
135
- onCardClick: d,
136
- onPrimaryAction: d,
137
- primaryActionText: i.micro_call_to_action || K?.micro_card_cta,
136
+ onCardClick: p,
137
+ onPrimaryAction: p,
138
+ primaryActionText: i.micro_call_to_action || z?.micro_card_cta,
138
139
  ref: C,
139
140
  title: i.micro_title && i.micro_title.length > 0 ? i.micro_title : i.title,
140
141
  variant: R,
@@ -1 +1 @@
1
- {"version":3,"file":"InsightCard.es.js","names":[],"sources":["../../../src/microinsights/cards/InsightCard.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { BeatIcon } from '../beaticons'\nimport BeatMaterialIcon from '../beaticons/BeatMaterialIcon'\n\nimport { useCopyStore, useEvent, useInsightsMicroWidgetStore } from '../context/hooks'\n\nimport { ON_CLICK_EVENT, ON_VIEW_EVENT, ON_VIEW_FIRST_TIME_EVENT } from '../constants/Analytics'\nimport { ICON_SIZE, VIEW_THRESHOLD } from '../constants/App'\nimport { microCardMinWidth } from '../utils/cardWidth'\n\nimport type { BeatLikeOffer, MicroInsightCardProps } from '../interfaces'\nimport type { Beat } from '../../core/types/Beat'\n// Leaf imports, not the `core` barrel: that pulls GlobalStore and every feature store into the\n// micro bundle, and through `core/stores` it reintroduces a circular path this module avoids.\nimport { slot } from '../../core/types/Insights'\nimport MicroCardTemplate from '../MicroCardTemplate'\n// Leaf import, not the `common` barrel, which would pull the shared layer into the micro bundle.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\n// TODO: load this with `React.lazy` to keep the block registry and charts out of the micro bundle,\n// once it is verified in every host that embeds the micro widget.\nimport InlineActionBlock from './InlineActionBlock'\nimport MicroCtaStatusGate, { type MicroCtaStatus } from './MicroCtaStatus'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks` and its charts.\nimport { asLogoRef } from '../../insights-v2/blocks/slotReaders'\nimport InsightErrorCard from '../../insights-v2/components/InsightErrorCard'\nimport LogoFromGuid, { isLogoGuid } from '../../insights-v2/components/LogoFromGuid'\nimport {\n statusIconAccentColor,\n statusIconName,\n statusIconPalette,\n} from '../../insights-v2/components/statusIcon'\nimport { hasDrawerBlock } from '../../insights-v2/mappings/hasDrawerBlock'\nimport { resolveInsightRender } from '../../insights-v2/resolveInsightRender'\n\nexport interface InsightCardProps extends MicroInsightCardProps {\n beat: Beat | BeatLikeOffer\n index?: number\n}\n\nexport const InsightCard: React.FC<InsightCardProps> = ({\n ariaLabel,\n beat,\n elevation,\n inDescriptionCtaBehavior = 'external',\n index,\n isActiveCard,\n onCardClick,\n posthog,\n widthOverrides,\n variant,\n showIcon,\n heightOverrides,\n}) => {\n const { ref, inView } = useInView({\n threshold: VIEW_THRESHOLD,\n })\n\n const theme = useTheme()\n\n // *************** Context functions *********************\n const { cardsCopy } = useCopyStore()\n const { onEvent } = useEvent()\n const { updateBeat, updateOffer } = useInsightsMicroWidgetStore()\n\n const isV2 = 'is_insights_v2' in beat && beat.is_insights_v2\n const eventProps = isV2 ? { metadata: { is_insights_v2: true } } : undefined\n\n // ************** Use Effects Hooks **********************\n useEffect(() => {\n if (inView) {\n if (!beat.has_been_displayed) {\n if (beat.guid.startsWith('OFR')) {\n updateOffer({\n ...beat,\n has_been_displayed: true,\n })\n } else {\n updateBeat({\n ...beat,\n has_been_displayed: true,\n })\n }\n onEvent(ON_VIEW_FIRST_TIME_EVENT(beat.template), eventProps)\n } else {\n onEvent(ON_VIEW_EVENT(beat.template), eventProps)\n }\n }\n }, [inView])\n\n useEffect(() => {\n if (inView && beat) {\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('viewed_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('viewed_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n }, [beat, index, inView])\n\n const insightRender = resolveInsightRender(beat as Beat)\n const v2Payload = insightRender === 'v2' ? beat.insights_payload : undefined\n // Only a V2 beat whose `in_description_cta` names a drawer block opens in place; everything else\n // keeps the host's behavior. Micro sends its one action as `in_description_cta`.\n // It also needs the host's `GlobalDataProvider`; without one the tap goes to the host instead.\n const hasGlobalData = React.useContext(GlobalDataContext) !== null\n const opensInline =\n inDescriptionCtaBehavior === 'internal' &&\n hasGlobalData &&\n hasDrawerBlock(v2Payload?.in_description_cta?.block)\n\n // *************** Click handlers ************************\n // Taps that opened the beat's own action block.\n const [inlineOpenRequest, setInlineOpenRequest] = useState(0)\n\n const handleClick = () => {\n /* eslint-disable no-unused-expressions */\n // Internal opens the block here and skips the host's `onCardClick`; analytics are unchanged.\n if (opensInline) {\n setInlineOpenRequest((count) => count + 1)\n } else {\n onCardClick && onCardClick(beat)\n }\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('clicked_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n\n if (insightRender === 'error') {\n // Keeps the carousel's slot sizing; the error card does not know about it.\n return (\n <Box\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n aria-roledescription=\"slide\"\n ref={ref}\n role=\"group\"\n sx={{\n height: heightOverrides ? '100%' : 120,\n minWidth: microCardMinWidth(widthOverrides),\n my: 1,\n }}\n >\n <InsightErrorCard beat={beat} />\n </Box>\n )\n }\n\n if (v2Payload) {\n // Figma (Micro Widget | Large Transaction) is the legacy micro card's layout fed from the envelope:\n // the slot's logo on the left (merchant, or the category without one), title, description, and the\n // primary CTA as a link. The logo falls back to the insight glyph when the slot carries none.\n // ditto ≥ 1.4.3 words micro's action as in_description_cta instead of primary_cta; either way\n // the label stays the card's tap (`micro-carousel/cta`), never a drawer.\n // A block with no usable row logo may name a status icon instead (account_block `minimal`:\n // `ICO-error`), drawn in the legacy card's tinted tile (Figma Micro | Low Account Balance).\n // The status tile takes the palette the slot names (Payday's on-track check is `success.main`),\n // falling back to error. `||` on the label: the copy may send the primary label as \"\".\n // Answered (mirrors the full card): reviewed title, icon and the Undo label. Display only: the card\n // and its label tap go to the host, which opens the insight with its block; nothing runs here.\n const renderCard = ({ presentation }: MicroCtaStatus) => {\n const answered = presentation?.kind === 'status' ? presentation : undefined\n const { data } = v2Payload.instance_slot\n const rowLogo = asLogoRef(slot(data, 'logo'))\n // The reviewed icon once answered, else the icon: whichever names a status icon first.\n const statusIcon = [answered ? slot(data, 'reviewed_icon') : undefined, slot(data, 'icon')]\n .map(asLogoRef)\n .find((ref) => statusIconName(ref?.guid))\n // An `ICO-` row logo is an icon, not an entity logo: it takes the same tinted tile (Figma Micro\n // Card) and wins over the status icon, as a row logo always has. The no-colour defaults differ\n // on purpose: a row icon with none is decorative (primary), a status icon with none is an error.\n const rowIconName = statusIconName(rowLogo?.guid)\n const tileColor = rowIconName ? rowLogo?.color || 'primary.main' : statusIcon?.color\n const tileName = rowIconName ?? statusIconName(statusIcon?.guid)\n const tilePalette = statusIconPalette(tileColor)\n // A non-status icon (`primary.main`, `chart.*`) tints the tile in its own colour.\n const tileAccent = statusIconAccentColor(theme.palette, tileColor)\n const actionLabel = presentation\n ? answered?.action?.label\n : v2Payload.primary_cta?.label || v2Payload.in_description_cta?.label || undefined\n const handleHostClick = () => {\n onCardClick && onCardClick(beat)\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n\n const card = (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={v2Payload.description.html_text}\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={\n showIcon &&\n (isLogoGuid(rowLogo?.guid) && !rowIconName ? (\n <LogoFromGuid logo={rowLogo} size={ICON_SIZE} />\n ) : tileName ? (\n <BeatMaterialIcon\n bgColor={alpha(tileAccent ?? theme.palette[tilePalette].main, 0.15)}\n iconColor={tileAccent ? 'inherit' : tilePalette}\n name={tileName}\n sx={tileAccent ? { color: tileAccent } : undefined}\n />\n ) : (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette.primary.main, 0.15)}\n name=\"lightbulb\"\n />\n ))\n }\n isActiveCard={isActiveCard}\n isInsightsV2={true}\n onCardClick={presentation ? handleHostClick : handleClick}\n onPrimaryAction={presentation ? handleHostClick : handleClick}\n primaryActionText={actionLabel}\n ref={ref}\n title={presentation?.title || v2Payload.title || ''}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n\n if (!opensInline) return card\n\n return (\n <>\n {card}\n {/* Nothing renders until the first tap. */}\n {inlineOpenRequest > 0 && (\n <InlineActionBlock\n beat={beat as Beat}\n openRequest={inlineOpenRequest}\n posthog={posthog}\n />\n )}\n </>\n )\n }\n\n return (\n <MicroCtaStatusGate beat={beat as Beat} posthog={posthog}>\n {renderCard}\n </MicroCtaStatusGate>\n )\n }\n\n return (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={\n beat?.html_micro_description && beat?.html_micro_description.length > 0\n ? beat.html_micro_description\n : beat.html_description || ''\n }\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={showIcon && <BeatIcon beat={beat} />}\n isActiveCard={isActiveCard}\n onCardClick={handleClick}\n onPrimaryAction={handleClick}\n primaryActionText={beat.micro_call_to_action || cardsCopy?.micro_card_cta}\n ref={ref}\n title={beat.micro_title && beat.micro_title.length > 0 ? beat.micro_title : beat.title}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,KAAA,CAA2C,EACtD,WAAA,GACA,MAAA,GACA,WAAA,GACA,0BAAA,IAA2B,YAC3B,OAAA,GACA,cAAA,GACA,aAAA,GACA,SAAA,GACA,gBAAA,GACA,SAAA,GACA,UAAA,GACA,iBAAA,EAAA,MACI;AACJ,QAAM,EAAE,KAAA,GAAK,QAAA,EAAA,IAAW,GAAU,EAChC,WAAA,EACF,CAAC,GAEK,IAAQ,GAAS,GAGjB,EAAE,WAAA,EAAA,IAAc,GAAa,GAC7B,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,YAAA,GAAY,aAAA,EAAA,IAAgB,GAA4B,GAE1D,IAAO,oBAAoB,KAAQ,EAAK,gBACxC,IAAa,IAAO,EAAE,UAAU,EAAE,gBAAgB,GAAK,EAAE,IAAI;AAGnE,EAAA,EAAA,MAAgB;AACd,IAAI,MACG,EAAK,qBAcR,EAAQ,GAAc,EAAK,QAAQ,GAAG,CAAU,KAb5C,EAAK,KAAK,WAAW,KAAK,IAC5B,EAAY;AAAA,MACV,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,IAED,EAAW;AAAA,MACT,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,GAEH,EAAQ,GAAyB,EAAK,QAAQ,GAAG,CAAU;AAAA,EAKjE,GAAG,CAAC,CAAM,CAAC,GAEX,EAAA,MAAgB;AACd,QAAI,KAAU,EACZ,KAAI,EAAK,aAAa,kBAAkB;AACtC,YAAM,IAAY;AAClB,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CAAA;AAAA,IAC3B,cAAA;AAAA,IACd,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB,EAAK,wBAAwB,GAAW;AAAA,IACtD,KAAA;AAAA,IACL,OAAO,EAAK,eAAe,EAAK,YAAY,SAAS,IAAI,EAAK,cAAc,EAAK;AAAA,IACxE,SAAA;AAAA,IACO,gBAAA;AAAA,EACjB,CAAA;AAEL"}
1
+ {"version":3,"file":"InsightCard.es.js","names":[],"sources":["../../../src/microinsights/cards/InsightCard.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { BeatIcon } from '../beaticons'\nimport BeatMaterialIcon from '../beaticons/BeatMaterialIcon'\n\nimport { useCopyStore, useEvent, useInsightsMicroWidgetStore } from '../context/hooks'\n\nimport { ON_CLICK_EVENT, ON_VIEW_EVENT, ON_VIEW_FIRST_TIME_EVENT } from '../constants/Analytics'\nimport { ICON_SIZE, VIEW_THRESHOLD } from '../constants/App'\nimport { microCardMinWidth } from '../utils/cardWidth'\n\nimport type { BeatLikeOffer, MicroInsightCardProps } from '../interfaces'\nimport type { Beat } from '../../core/types/Beat'\n// Leaf imports, not the `core` barrel: that pulls GlobalStore and every feature store into the\n// micro bundle, and through `core/stores` it reintroduces a circular path this module avoids.\nimport { slot } from '../../core/types/Insights'\nimport MicroCardTemplate from '../MicroCardTemplate'\n// Leaf import, not the `common` barrel, which would pull the shared layer into the micro bundle.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\n// TODO: load this with `React.lazy` to keep the block registry and charts out of the micro bundle,\n// once it is verified in every host that embeds the micro widget.\nimport InlineActionBlock from './InlineActionBlock'\nimport MicroCtaStatusGate, { type MicroCtaStatus } from './MicroCtaStatus'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks` and its charts.\nimport { asLogoRef } from '../../insights-v2/blocks/slotReaders'\nimport InsightErrorCard from '../../insights-v2/components/InsightErrorCard'\nimport LogoFromGuid, { isLogoGuid } from '../../insights-v2/components/LogoFromGuid'\nimport {\n statusIconAccentColor,\n statusIconName,\n statusIconPalette,\n} from '../../insights-v2/components/statusIcon'\nimport { hasDrawerBlock } from '../../insights-v2/mappings/hasDrawerBlock'\nimport { resolveInsightRender } from '../../insights-v2/resolveInsightRender'\n\n/**\n * A `budget_block` slot's micro tile is the tinted category tile (Figma 156:35121, Micro | Category\n * Budget: the glyph on a 25% tint of the category colour, bordered in it) instead of mxui's solid tile.\n */\nconst TINTED_CATEGORY_TILE_BLOCK = 'budget_block'\nconst CATEGORY_TILE_TINT = 0.25\n\nexport interface InsightCardProps extends MicroInsightCardProps {\n beat: Beat | BeatLikeOffer\n index?: number\n}\n\nexport const InsightCard: React.FC<InsightCardProps> = ({\n ariaLabel,\n beat,\n elevation,\n inDescriptionCtaBehavior = 'external',\n index,\n isActiveCard,\n onCardClick,\n posthog,\n widthOverrides,\n variant,\n showIcon,\n heightOverrides,\n}) => {\n const { ref, inView } = useInView({\n threshold: VIEW_THRESHOLD,\n })\n\n const theme = useTheme()\n\n // *************** Context functions *********************\n const { cardsCopy } = useCopyStore()\n const { onEvent } = useEvent()\n const { updateBeat, updateOffer } = useInsightsMicroWidgetStore()\n\n const isV2 = 'is_insights_v2' in beat && beat.is_insights_v2\n const eventProps = isV2 ? { metadata: { is_insights_v2: true } } : undefined\n\n // ************** Use Effects Hooks **********************\n useEffect(() => {\n if (inView) {\n if (!beat.has_been_displayed) {\n if (beat.guid.startsWith('OFR')) {\n updateOffer({\n ...beat,\n has_been_displayed: true,\n })\n } else {\n updateBeat({\n ...beat,\n has_been_displayed: true,\n })\n }\n onEvent(ON_VIEW_FIRST_TIME_EVENT(beat.template), eventProps)\n } else {\n onEvent(ON_VIEW_EVENT(beat.template), eventProps)\n }\n }\n }, [inView])\n\n useEffect(() => {\n if (inView && beat) {\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('viewed_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('viewed_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n }, [beat, index, inView])\n\n const insightRender = resolveInsightRender(beat as Beat)\n const v2Payload = insightRender === 'v2' ? beat.insights_payload : undefined\n // Only a V2 beat whose `in_description_cta` names a drawer block opens in place; everything else\n // keeps the host's behavior. Micro sends its one action as `in_description_cta`.\n // It also needs the host's `GlobalDataProvider`; without one the tap goes to the host instead.\n const hasGlobalData = React.useContext(GlobalDataContext) !== null\n const opensInline =\n inDescriptionCtaBehavior === 'internal' &&\n hasGlobalData &&\n hasDrawerBlock(v2Payload?.in_description_cta?.block)\n\n // *************** Click handlers ************************\n // Taps that opened the beat's own action block.\n const [inlineOpenRequest, setInlineOpenRequest] = useState(0)\n\n const handleClick = () => {\n /* eslint-disable no-unused-expressions */\n // Internal opens the block here and skips the host's `onCardClick`; analytics are unchanged.\n if (opensInline) {\n setInlineOpenRequest((count) => count + 1)\n } else {\n onCardClick && onCardClick(beat)\n }\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('clicked_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n\n if (insightRender === 'error') {\n // Keeps the carousel's slot sizing; the error card does not know about it.\n return (\n <Box\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n aria-roledescription=\"slide\"\n ref={ref}\n role=\"group\"\n sx={{\n height: heightOverrides ? '100%' : 120,\n minWidth: microCardMinWidth(widthOverrides),\n my: 1,\n }}\n >\n <InsightErrorCard beat={beat} />\n </Box>\n )\n }\n\n if (v2Payload) {\n // Figma (Micro Widget | Large Transaction) is the legacy micro card's layout fed from the envelope:\n // the slot's logo on the left (merchant, or the category without one), title, description, and the\n // primary CTA as a link. The logo falls back to the insight glyph when the slot carries none.\n // ditto ≥ 1.4.3 words micro's action as in_description_cta instead of primary_cta; either way\n // the label stays the card's tap (`micro-carousel/cta`), never a drawer.\n // A block with no usable row logo may name a status icon instead (account_block `minimal`:\n // `ICO-error`), drawn in the legacy card's tinted tile (Figma Micro | Low Account Balance).\n // The status tile takes the palette the slot names (Payday's on-track check is `success.main`),\n // falling back to error. `||` on the label: the copy may send the primary label as \"\".\n // Answered (mirrors the full card): reviewed title, icon and the Undo label. Display only: the card\n // and its label tap go to the host, which opens the insight with its block; nothing runs here.\n const renderCard = ({ presentation }: MicroCtaStatus) => {\n const answered = presentation?.kind === 'status' ? presentation : undefined\n const { data } = v2Payload.instance_slot\n const rowLogo = asLogoRef(slot(data, 'logo'))\n // The reviewed icon once answered, else the icon: whichever names a status icon first.\n const statusIcon = [answered ? slot(data, 'reviewed_icon') : undefined, slot(data, 'icon')]\n .map(asLogoRef)\n .find((ref) => statusIconName(ref?.guid))\n // An `ICO-` row logo is an icon, not an entity logo: it takes the same tinted tile (Figma Micro\n // Card) and wins over the status icon, as a row logo always has. The no-colour defaults differ\n // on purpose: a row icon with none is decorative (primary), a status icon with none is an error.\n const rowIconName = statusIconName(rowLogo?.guid)\n const tileColor = rowIconName ? rowLogo?.color || 'primary.main' : statusIcon?.color\n const tileName = rowIconName ?? statusIconName(statusIcon?.guid)\n const tilePalette = statusIconPalette(tileColor)\n // A non-status icon (`primary.main`, `chart.*`) tints the tile in its own colour.\n const tileAccent = statusIconAccentColor(theme.palette, tileColor)\n const actionLabel = presentation\n ? answered?.action?.label\n : v2Payload.primary_cta?.label || v2Payload.in_description_cta?.label || undefined\n const handleHostClick = () => {\n onCardClick && onCardClick(beat)\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n\n const card = (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={v2Payload.description.html_text}\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={\n showIcon &&\n (isLogoGuid(rowLogo?.guid) && !rowIconName ? (\n <LogoFromGuid\n categoryTint={\n v2Payload.instance_slot.block === TINTED_CATEGORY_TILE_BLOCK\n ? CATEGORY_TILE_TINT\n : undefined\n }\n logo={rowLogo}\n size={ICON_SIZE}\n />\n ) : tileName ? (\n <BeatMaterialIcon\n bgColor={alpha(tileAccent ?? theme.palette[tilePalette].main, 0.15)}\n iconColor={tileAccent ? 'inherit' : tilePalette}\n name={tileName}\n sx={tileAccent ? { color: tileAccent } : undefined}\n />\n ) : (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette.primary.main, 0.15)}\n name=\"lightbulb\"\n />\n ))\n }\n isActiveCard={isActiveCard}\n isInsightsV2={true}\n onCardClick={presentation ? handleHostClick : handleClick}\n onPrimaryAction={presentation ? handleHostClick : handleClick}\n primaryActionText={actionLabel}\n ref={ref}\n title={presentation?.title || v2Payload.title || ''}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n\n if (!opensInline) return card\n\n return (\n <>\n {card}\n {/* Nothing renders until the first tap. */}\n {inlineOpenRequest > 0 && (\n <InlineActionBlock\n beat={beat as Beat}\n openRequest={inlineOpenRequest}\n posthog={posthog}\n />\n )}\n </>\n )\n }\n\n return (\n <MicroCtaStatusGate beat={beat as Beat} posthog={posthog}>\n {renderCard}\n </MicroCtaStatusGate>\n )\n }\n\n return (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={\n beat?.html_micro_description && beat?.html_micro_description.length > 0\n ? beat.html_micro_description\n : beat.html_description || ''\n }\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={showIcon && <BeatIcon beat={beat} />}\n isActiveCard={isActiveCard}\n onCardClick={handleClick}\n onPrimaryAction={handleClick}\n primaryActionText={beat.micro_call_to_action || cardsCopy?.micro_card_cta}\n ref={ref}\n title={beat.micro_title && beat.micro_title.length > 0 ? beat.micro_title : beat.title}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CA,IAAM,KAA6B,gBAC7B,KAAqB,MAOd,KAAA,CAA2C,EACtD,WAAA,GACA,MAAA,GACA,WAAA,GACA,0BAAA,IAA2B,YAC3B,OAAA,GACA,cAAA,GACA,aAAA,GACA,SAAA,GACA,gBAAA,GACA,SAAA,GACA,UAAA,GACA,iBAAA,EAAA,MACI;AACJ,QAAM,EAAE,KAAA,GAAK,QAAA,EAAA,IAAW,GAAU,EAChC,WAAA,EACF,CAAC,GAEK,IAAQ,GAAS,GAGjB,EAAE,WAAA,EAAA,IAAc,GAAa,GAC7B,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,YAAA,GAAY,aAAA,EAAA,IAAgB,GAA4B,GAE1D,IAAO,oBAAoB,KAAQ,EAAK,gBACxC,IAAa,IAAO,EAAE,UAAU,EAAE,gBAAgB,GAAK,EAAE,IAAI;AAGnE,EAAA,EAAA,MAAgB;AACd,IAAI,MACG,EAAK,qBAcR,EAAQ,GAAc,EAAK,QAAQ,GAAG,CAAU,KAb5C,EAAK,KAAK,WAAW,KAAK,IAC5B,EAAY;AAAA,MACV,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,IAED,EAAW;AAAA,MACT,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,GAEH,EAAQ,GAAyB,EAAK,QAAQ,GAAG,CAAU;AAAA,EAKjE,GAAG,CAAC,CA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uB,SAAS,IAClE,EAAK,yBACL,EAAK,oBAAoB;AAAA,IAEpB,WAAA;AAAA,IACM,iBAAA;AAAA,IACjB,MAAM,KAAY,gBAAA,EAAC,IAAD,EAAgB,MAAA,EAAO,CAAA;AAAA,IAC3B,cAAA;AAAA,IACd,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB,EAAK,wBAAwB,GAAW;AAAA,IACtD,KAAA;AAAA,IACL,OAAO,EAAK,eAAe,EAAK,YAAY,SAAS,IAAI,EAAK,cAAc,EAAK;AAAA,IACxE,SAAA;AAAA,IACO,gBAAA;AAAA,EACjB,CAAA;AAEL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.190",
3
+ "version": "9.7.191",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -1,8 +0,0 @@
1
- var _ = /* @__PURE__ */ (function(E) {
2
- return E.LOW_BUDGET_TIER = "LOW", E.MEDIUM_BUDGET_TIER = "MEDIUM", E.OFF_TRACK_BUDGET_TIER = "OFF_TRACK", E;
3
- })({});
4
- export {
5
- _ as BudgetTierType
6
- };
7
-
8
- //# sourceMappingURL=InsightsInstanceSlotData.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InsightsInstanceSlotData.es.js","names":[],"sources":["../../../src/core/types/InsightsInstanceSlotData.ts"],"sourcesContent":["import type { DataSeries, Legends, LogoRef } from '../../core'\n\nexport interface InsightsInstanceSlotData\n extends\n Partial<BudgetBlockData>,\n Partial<DonutChartBlockData>,\n Partial<ImageBlockData>,\n Partial<AccountBlockData>,\n Partial<SaveExtraBlockData>,\n Partial<StepChartBlockData>,\n Partial<SVGImageBlockData>,\n Partial<AccountSwitchBlockData>,\n Partial<TransactionDetailsBlockData>,\n Partial<CreditUtilizationBlockData>,\n Partial<MerchantBlockData>,\n Partial<CommonProps> {}\n\n//when any of the type is used more than one times, we can use the common props\ninterface CommonProps {\n amount?: number\n ariaLabel?: string\n date?: string\n legends?: Legends[]\n category_guid?: string\n data_series?: DataSeries | DataSet[]\n transaction_guids?: string[]\n account_guids?: string[]\n primary_transaction_guid?: string\n}\n\n//BarChart Block: `instance_slot.data` (Insights 2.0)\nexport interface BarChartBlockData {\n series?: DataSeries\n category_guid?: string\n average_amount?: number\n /** [0] monthly amount, [1] trend. */\n additional_data?: Legends[]\n}\n\n//DonutChart Block: `instance_slot.data` (Insights 2.0) — the same shape V1 sent as `instance_slot_data`.\n/** The donut's centre: the total and its caption (\"$6,306\" / \"Total\"). */\nexport interface DonutChartMain {\n value: string | number\n value_type: string\n label: string\n /** The embedded donut's shorter caption (Credit Card Close to Limit: \"Remains\"). */\n compact_label?: string\n}\nexport interface DonutChartBlockData {\n main: DonutChartMain\n /** The category whose colour fills the primary slice (Cost of Living to Income: Housing). */\n category_guid?: string\n /** Legend rows beside the donut: a label, its amount and an optional share (\"$5,550.00 (88%)\"). */\n legends?: Legends[]\n}\n\n//DoubleBarChart Block\n// TODO : This has to be revisited again to update the below types based on API response once we have the final shape of the data_series for double bar chart from BE\nexport interface LegendProps extends Legends {\n amount: number\n formattedAmount: string\n label: string\n color?: string\n}\n\nexport interface DataSet extends DataSeries {\n ariaLabelComparison: string\n ariaLabelMain: string\n comparison: number\n // The comparison bar's transaction guids (data_series aggregated_guids), for the drawer filter.\n comparisonGuids?: string[]\n // The month's 'yyyy-MM-dd' date (the main row's).\n date?: string\n formattedComparison: string\n formattedMain: string\n label: string\n main: number\n // The main bar's transaction guids (data_series aggregated_guids), for the drawer filter.\n mainGuids?: string[]\n}\n\n//DoubleProgressBar Block\n\n//Image Block\nexport interface ImageBlockData {\n image: string\n}\n\n//Account Block\nexport interface AccountBlockData {\n sub_text: string\n institution_guid?: string\n institution_name?: string\n icon_name?: string\n /** Header bar text (standard card), or the colored category strip label (deposit cards). */\n header_text?: string\n // Deposit variants (Unified Deposit, Unified Deposit Emergency Fund, Savings Account Deposit)\n /** Merchant guid — renders a real merchant logo in the deposit card when present. */\n merchant_guid?: string\n /** Merchant display name — logo alt text and the payer line under the amount. */\n merchant_name?: string\n /** Secondary label beside the amount, e.g. `On {date}, you saved` or `Balance as of MM/DD/YY`. */\n label?: string\n}\n\nexport interface SaveExtraBlockData {\n /** Styled segments `[lead-in, amount digits, trailing copy]`, e.g. `['Save an extra', '100', 'to help your funds grow']`. */\n primary_text?: string[]\n /** Styled segments `[projected balance, caption]`, e.g. `['$8,313.87', 'After payday & projected expenses']`. */\n secondary_text?: string[]\n /** MakeTransfer drilldown: available balance (both variants). */\n available_balance?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: average monthly spend. */\n avg_monthly_spend?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: how long the balance lasts, overlaid on the timeline SVG (e.g. \"2 months, 11 days\"). */\n time_period?: string\n /** SAVE_AN_EXTRA_100: upcoming expenses (the \"Expenses\" figure). */\n upcoming_expenses?: number\n /** SAVE_AN_EXTRA_100: total remaining after expenses. */\n total_remaining?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: date for the \"Your available balances as of {date}\" line. */\n date?: string\n}\n\n// AccountSwitch Block. State comes from `instance_slot.variant`, not a data flag.\nexport interface AccountSwitchBlockData {\n discovered_institution_guid: string\n discovered_institution_name: string\n held_institution_guid: string\n held_institution_name: string\n}\n\n// AccountSwitch Block: `instance_slot.data` (Insights 2.0). Discovered Accounts V2: `from_logo` the held\n// institution (absent when the user holds no FI-managed account), `to_logo` the discovered one.\n// Switch Direct Deposit: `from_logo` the external institution, `to_logo` the held one. `logo` is the\n// compact card's (micro, notification) institution.\nexport interface AccountSwitchBlockV2Data {\n from_logo?: LogoRef\n to_logo?: LogoRef\n logo?: LogoRef\n}\n\n// StepChart Block\nexport interface StepChartBlockData {\n completed_steps: number\n label_1: string\n label_2?: string\n}\n\n//Budgets Blocks\nexport enum BudgetTierType {\n LOW_BUDGET_TIER = 'LOW',\n MEDIUM_BUDGET_TIER = 'MEDIUM',\n OFF_TRACK_BUDGET_TIER = 'OFF_TRACK',\n}\n\nexport type BudgetTierValue = `${BudgetTierType}`\n\nexport interface BudgetLocalizedPayload {\n primary_text?: string\n amount_left_label?: string\n spent_label?: string\n budgeted_label?: string\n}\n\nexport interface BudgetBlockData {\n budget_percent: number\n budget_tier: BudgetTierValue\n category_guid?: string\n merchant_guid?: string\n spent_amount: number\n budgeted_amount: number\n localized_payload: BudgetLocalizedPayload\n}\n\nexport interface SVGImageBlockData {\n isCIBC?: boolean\n}\n\n// TransactionDetails Action Block\n// The drawer's subject is `InsightsPayload.primary_transaction_guid`; only action configuration\n// lives here.\nexport interface TransactionDetailsBlockData {\n /** `TopActions` member names, e.g. `['Category', 'Date', 'Memo']`. Omit for the defaults. */\n top_actions?: string[]\n /** `BottomActions` member names, e.g. `['MerchantBudget', 'HideTransaction']`. Omit for defaults. */\n bottom_actions?: string[]\n}\n\n// Credit Utilization action block. The per-card rows are the beat's `data_series` table\n// (`guid`, `label`, `amount`, `total_amount`, `percentage`), carried on `CommonProps.data_series`.\nexport interface CreditUtilizationBlockData {\n accounts_balance_sum?: number\n accounts_credit_limit_sum?: number\n credit_utilization_percentage?: number\n}\n\n// Merchant block `instance_slot.data`; `primary_text` is ditto's name.\nexport interface MerchantBlockData {\n merchant_name?: string\n logo?: LogoRef\n amount?: number\n /** Pre-localized eyebrow; ditto sends `header_text`. */\n date?: string\n header_text?: string\n status_text?: string\n logos?: LogoRef[]\n}\n"],"mappings":"AAsJA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,kBAAA,OACA,EAAA,qBAAA,UACA,EAAA,wBAAA;AACF,GAAA,CAAA,CAAA"}
@@ -1,7 +0,0 @@
1
- import { BudgetTierValue } from '../../../../core/types/InsightsInstanceSlotData';
2
- export declare const BUDGET_STATUS_COLORS_MAP: {
3
- LOW: string;
4
- MEDIUM: string;
5
- OFF_TRACK: string;
6
- };
7
- export declare const getColorByBudgetTier: (budgetTier: BudgetTierValue) => string;
@@ -1,12 +0,0 @@
1
- import { BudgetTierType as T } from "../../../../core/types/InsightsInstanceSlotData.es.js";
2
- var _ = {
3
- [T.LOW_BUDGET_TIER]: "success.main",
4
- [T.MEDIUM_BUDGET_TIER]: "warning.main",
5
- [T.OFF_TRACK_BUDGET_TIER]: "error.main"
6
- }, E = (r) => _[r];
7
- export {
8
- _ as BUDGET_STATUS_COLORS_MAP,
9
- E as getColorByBudgetTier
10
- };
11
-
12
- //# sourceMappingURL=util.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.ts"],"sourcesContent":["import {\n BudgetTierType,\n type BudgetTierValue,\n} from '../../../../core/types/InsightsInstanceSlotData'\n\nexport const BUDGET_STATUS_COLORS_MAP = {\n [BudgetTierType.LOW_BUDGET_TIER]: 'success.main',\n [BudgetTierType.MEDIUM_BUDGET_TIER]: 'warning.main',\n [BudgetTierType.OFF_TRACK_BUDGET_TIER]: 'error.main',\n}\n\nexport const getColorByBudgetTier = (budgetTier: BudgetTierValue) =>\n BUDGET_STATUS_COLORS_MAP[budgetTier]\n"],"mappings":";AAKA,IAAa,IAA2B;AAAA,EACrC,CAAA,EAAe,eAAA,GAAkB;AAAA,EACjC,CAAA,EAAe,kBAAA,GAAqB;AAAA,EACpC,CAAA,EAAe,qBAAA,GAAwB;AAC1C,GAEa,IAAA,CAAwB,MACnC,EAAyB,CAAA"}