@mx-cartographer/experiences 9.7.126 → 9.7.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [9.7.127] - 11-10-2026
2
+
3
+ - **FIXED** - An Insights V2 card's subtitle shows a sub-category as its top-level category icon instead of the Uncategorized glyph, and draws nothing instead of an empty box for an icon name mx-icons does not define (WEC-2259)
4
+
1
5
  ## [9.7.126] - 11-10-2026
2
6
 
3
7
  - **CHANGED** - Insights V2 cards drop a slot value of the wrong kind (for example a number where text is expected) instead of passing it through; valid slots render the same (WEC-2259)
@@ -1,22 +1,11 @@
1
1
  interface DepositLogoProps {
2
- /** Category guid, required alongside `merchantGuid` for the merchant logo lookup. */
3
- categoryGuid?: string;
4
- /** Fallback mx-icons ligature glyph for the generic tile when no guid is present. */
2
+ /** mx-icons glyph for the generic tile when no institution guid is sent. */
5
3
  iconName?: string;
6
- /** Institution guid — renders an `InstitutionLogo` when present and no merchant guid. */
4
+ /** Renders the institution's logo when present. */
7
5
  institutionGuid?: string;
8
- /** Institution display name, used as the logo's alt text. */
6
+ /** The institution's name, used as the logo's alt text. */
9
7
  institutionName?: string;
10
- /** Merchant guid — renders a `MerchantLogo` when present (highest priority). */
11
- merchantGuid?: string;
12
- /** Merchant display name, used as the logo's alt text. */
13
- merchantName?: string;
14
8
  }
15
- /**
16
- * Logo shown in a deposit callout. Mirrors the spec's per-variant sourcing: a real
17
- * merchant logo when a `merchantGuid` is sent (Payroll, Merchant Credit, Payroll Advance),
18
- * an institution logo for institution-sourced deposits (Check, Large Deposit), and a themed
19
- * generic tile otherwise (Government, Tax).
20
- */
21
- export declare const DepositLogo: ({ categoryGuid, iconName, institutionGuid, institutionName, merchantGuid, merchantName, }: DepositLogoProps) => import("react/jsx-runtime").JSX.Element;
9
+ /** Logo shown in a deposit callout: the institution's logo, or a themed generic tile without one. */
10
+ export declare const DepositLogo: ({ iconName, institutionGuid, institutionName, }: DepositLogoProps) => import("react/jsx-runtime").JSX.Element;
22
11
  export default DepositLogo;
@@ -1,8 +1,8 @@
1
- import c from "@mui/material/Stack";
2
- import { InstitutionLogo as m, MerchantLogo as f } from "@mxenabled/mxui";
3
- import { Icon as g } from "@mxenabled/mx-icons";
1
+ import s from "../LogoMark.es.js";
2
+ import i from "@mui/material/Stack";
3
+ import { Icon as n } from "@mxenabled/mx-icons";
4
4
  import { jsx as o } from "react/jsx-runtime";
5
- var s = 48, l = ({ iconName: t }) => /* @__PURE__ */ o(c, {
5
+ var a = 48, m = ({ iconName: t }) => /* @__PURE__ */ o(i, {
6
6
  sx: {
7
7
  alignItems: "center",
8
8
  bgcolor: "success.main",
@@ -10,24 +10,21 @@ var s = 48, l = ({ iconName: t }) => /* @__PURE__ */ o(c, {
10
10
  justifyContent: "center",
11
11
  width: "100%"
12
12
  },
13
- children: /* @__PURE__ */ o(g, {
13
+ children: /* @__PURE__ */ o(n, {
14
14
  name: t,
15
15
  size: 24,
16
16
  sx: { color: "success.contrastText" }
17
17
  })
18
- }), h = ({ categoryGuid: t, iconName: i = "payments", institutionGuid: e, institutionName: a, merchantGuid: r, merchantName: n }) => r ? /* @__PURE__ */ o(f, {
19
- alt: n ?? "",
20
- categoryGuid: t ?? "",
21
- merchantGuid: r,
22
- size: s
23
- }) : e ? /* @__PURE__ */ o(m, {
24
- alt: a ?? "",
25
- institutionGuid: e,
26
- size: s
27
- }) : /* @__PURE__ */ o(l, { iconName: i });
18
+ }), f = ({ iconName: t = "payments", institutionGuid: e, institutionName: r }) => e ? /* @__PURE__ */ o(s, {
19
+ logo: {
20
+ institution_guid: e,
21
+ institution_name: r
22
+ },
23
+ size: a
24
+ }) : /* @__PURE__ */ o(m, { iconName: t });
28
25
  export {
29
- h as DepositLogo,
30
- h as default
26
+ f as DepositLogo,
27
+ f as default
31
28
  };
32
29
 
33
30
  //# sourceMappingURL=DepositLogo.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"DepositLogo.es.js","names":[],"sources":["../../../../src/insights-v2/components/ComponentBlocks/DepositLogo.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\ninterface DepositLogoProps {\n /** Category guid, required alongside `merchantGuid` for the merchant logo lookup. */\n categoryGuid?: string\n /** Fallback mx-icons ligature glyph for the generic tile when no guid is present. */\n iconName?: string\n /** Institution guid — renders an `InstitutionLogo` when present and no merchant guid. */\n institutionGuid?: string\n /** Institution display name, used as the logo's alt text. */\n institutionName?: string\n /** Merchant guid — renders a `MerchantLogo` when present (highest priority). */\n merchantGuid?: string\n /** Merchant display name, used as the logo's alt text. */\n merchantName?: string\n}\n\nconst SIZE = 48\n\n/**\n * Square themed tile standing in for a merchant/institution logo when no guid is sent.\n * Drawn with theme colors so it stays correct in dark mode.\n */\nconst DepositLogoTile = ({ iconName }: { iconName: string }) => (\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon name={iconName} size={24} sx={{ color: 'success.contrastText' }} />\n </Stack>\n)\n\n/**\n * Logo shown in a deposit callout. Mirrors the spec's per-variant sourcing: a real\n * merchant logo when a `merchantGuid` is sent (Payroll, Merchant Credit, Payroll Advance),\n * an institution logo for institution-sourced deposits (Check, Large Deposit), and a themed\n * generic tile otherwise (Government, Tax).\n */\nexport const DepositLogo = ({\n categoryGuid,\n iconName = 'payments',\n institutionGuid,\n institutionName,\n merchantGuid,\n merchantName,\n}: DepositLogoProps) => {\n if (merchantGuid) {\n return (\n <MerchantLogo\n alt={merchantName ?? ''}\n categoryGuid={categoryGuid ?? ''}\n merchantGuid={merchantGuid}\n size={SIZE}\n />\n )\n }\n\n if (institutionGuid) {\n return (\n <InstitutionLogo alt={institutionName ?? ''} institutionGuid={institutionGuid} size={SIZE} />\n )\n }\n\n return <DepositLogoTile iconName={iconName} />\n}\n\nexport default DepositLogo\n"],"mappings":";;;;AAoBA,IAAM,IAAO,IAMP,IAAA,CAAmB,EAAE,UAAA,EAAA,MACzB,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,OAAO;AAAA,EACT;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAU,MAAM;AAAA,IAAI,IAAI,EAAE,OAAO,uBAAuB;AAAA,EAAI,CAAA;AACnE,CAAA,GASI,IAAA,CAAe,EAC1B,cAAA,GACA,UAAA,IAAW,YACX,iBAAA,GACA,iBAAA,GACA,cAAA,GACA,cAAA,EAAA,MAEI,IAEA,gBAAA,EAAC,GAAD;AAAA,EACE,KAAK,KAAgB;AAAA,EACrB,cAAc,KAAgB;AAAA,EAChB,cAAA;AAAA,EACd,MAAM;AACP,CAAA,IAID,IAEA,gBAAA,EAAC,GAAD;AAAA,EAAiB,KAAK,KAAmB;AAAA,EAAqB,iBAAA;AAAA,EAAiB,MAAM;AAAO,CAAA,IAIzF,gBAAA,EAAC,GAAD,EAA2B,UAAA,EAAW,CAAA"}
1
+ {"version":3,"file":"DepositLogo.es.js","names":[],"sources":["../../../../src/insights-v2/components/ComponentBlocks/DepositLogo.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport LogoMark from '../LogoMark'\n\ninterface DepositLogoProps {\n /** mx-icons glyph for the generic tile when no institution guid is sent. */\n iconName?: string\n /** Renders the institution's logo when present. */\n institutionGuid?: string\n /** The institution's name, used as the logo's alt text. */\n institutionName?: string\n}\n\nconst SIZE = 48\n\n/** Themed tile standing in for the logo when no guid is sent; theme colors keep it right in dark mode. */\nconst DepositLogoTile = ({ iconName }: { iconName: string }) => (\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: 'success.main',\n height: '100%',\n justifyContent: 'center',\n width: '100%',\n }}\n >\n <Icon name={iconName} size={24} sx={{ color: 'success.contrastText' }} />\n </Stack>\n)\n\n/** Logo shown in a deposit callout: the institution's logo, or a themed generic tile without one. */\nexport const DepositLogo = ({\n iconName = 'payments',\n institutionGuid,\n institutionName,\n}: DepositLogoProps) =>\n institutionGuid ? (\n <LogoMark\n logo={{ institution_guid: institutionGuid, institution_name: institutionName }}\n size={SIZE}\n />\n ) : (\n <DepositLogoTile iconName={iconName} />\n )\n\nexport default DepositLogo\n"],"mappings":";;;;AAeA,IAAM,IAAO,IAGP,IAAA,CAAmB,EAAE,UAAA,EAAA,MACzB,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,QAAQ;AAAA,IACR,gBAAgB;AAAA,IAChB,OAAO;AAAA,EACT;AAAA,EAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,IAAM,MAAM;AAAA,IAAU,MAAM;AAAA,IAAI,IAAI,EAAE,OAAO,uBAAuB;AAAA,EAAI,CAAA;AACnE,CAAA,GAII,IAAA,CAAe,EAC1B,UAAA,IAAW,YACX,iBAAA,GACA,iBAAA,EAAA,MAEA,IACE,gBAAA,EAAC,GAAD;AAAA,EACE,MAAM;AAAA,IAAE,kBAAkB;AAAA,IAAiB,kBAAkB;AAAA,EAAgB;AAAA,EAC7E,MAAM;AACP,CAAA,IAED,gBAAA,EAAC,GAAD,EAA2B,UAAA,EAAW,CAAA"}
@@ -9,18 +9,8 @@ export interface LogoFromGuidProps {
9
9
  }
10
10
  /**
11
11
  * One component for every V2 logo. The envelope sends a single `{ guid, fallback_guid?, alt? }`
12
- * object whose prefix says what it is; this maps it onto the mxui component's props and renders
13
- * nothing — never a guess — for anything else (`PARENT-ENTITY`, an `ACT-`/`BGT-` guid, an empty guid).
14
- *
15
- * The fallback chain is mxui's, not ours: asset for `guid` → category tile for `fallback_guid`
16
- * (`MerchantLogo`'s `categoryGuid`, applied only when it is a `CAT-` guid because a category tile is
17
- * the only fallback `MerchantLogo` has) → `alt`. Nothing here probes whether an asset exists.
18
- *
19
- * Categories are walked up to their top-level parent before reaching mxui: `CategoryIcon` only knows
20
- * the top-level guids and silently shows the Uncategorized glyph for a sub-category (identity until
21
- * categories load). That applies to a `CAT-` logo and to a merchant's `fallback_guid` alike.
12
+ * object whose prefix says what it is; anything else (`PARENT-ENTITY`, an `ACT-`/`BGT-` guid, an
13
+ * empty guid) renders nothing, never a guess. The asset → category tile → `alt` fallback is mxui's.
22
14
  */
23
- declare const LogoFromGuid: (({ className, logo, size }: LogoFromGuidProps) => import("react/jsx-runtime").JSX.Element | null) & {
24
- displayName: string;
25
- };
15
+ declare const LogoFromGuid: ({ className, logo, size }: LogoFromGuidProps) => import("react/jsx-runtime").JSX.Element | null;
26
16
  export default LogoFromGuid;
@@ -1,45 +1,17 @@
1
- import { useCategoryStore as l } from "../../common/context/hooks.es.js";
2
- import { logoFromRef as u } from "./shared/EntityLogo.es.js";
3
- import { observer as g } from "mobx-react-lite";
4
- import { CategoryIcon as m, InstitutionLogo as c, MerchantLogo as d } from "@mxenabled/mxui";
5
- import { Icon as f, IconList as s } from "@mxenabled/mx-icons";
6
- import { jsx as n } from "react/jsx-runtime";
7
- import _ from "@mui/material/Box";
8
- var h = /^(MCH|CAT|INS)-|^ICO-[a-z0-9_-]+$/, y = (e) => !!e && h.test(e), F = g(({ className: e, logo: t, size: i }) => {
9
- const { getTopLevelCategoryGuid: a } = l();
10
- if (!t || !y(t.guid)) return null;
11
- const o = u({
12
- alt: t.alt,
13
- color: t.color,
14
- fallback_guid: t.fallback_guid,
15
- guid: t.guid
1
+ import l, { isKnownIcon as n } from "./LogoMark.es.js";
2
+ import { logoFromRef as a } from "./shared/EntityLogo.es.js";
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({
8
+ alt: r.alt,
9
+ color: r.color,
10
+ fallback_guid: r.fallback_guid,
11
+ guid: r.guid
16
12
  });
17
- if (!o) return null;
18
- let r = null;
19
- if (o.logo_name) {
20
- if (!(o.logo_name in s))
21
- return console.warn(`[LogoFromGuid] "${t.guid}" names no mx-icons icon — rendering nothing.`), null;
22
- r = /* @__PURE__ */ n(f, {
23
- fill: o.logo_fill,
24
- name: o.logo_name,
25
- size: i,
26
- sx: { color: o.logo_color }
27
- });
28
- } else o.merchant_guid ? r = /* @__PURE__ */ n(d, {
29
- alt: o.merchant_name ?? "",
30
- categoryGuid: o.category_guid ? a(o.category_guid) : "",
31
- merchantGuid: o.merchant_guid,
32
- size: i
33
- }) : o.institution_guid ? r = /* @__PURE__ */ n(c, {
34
- alt: o.institution_name ?? "",
35
- institutionGuid: o.institution_guid,
36
- size: i
37
- }) : o.category_guid && (r = /* @__PURE__ */ n(m, {
38
- categoryGuid: a(o.category_guid),
39
- size: i
40
- }));
41
- return r ? /* @__PURE__ */ n(_, {
42
- className: e,
13
+ return !t || t.logo_name && !n(t.logo_name) ? null : /* @__PURE__ */ e(u, {
14
+ className: o,
43
15
  "data-testid": "logo-from-guid",
44
16
  sx: {
45
17
  alignItems: "center",
@@ -49,12 +21,15 @@ var h = /^(MCH|CAT|INS)-|^ICO-[a-z0-9_-]+$/, y = (e) => !!e && h.test(e), F = g(
49
21
  justifyContent: "center",
50
22
  width: i
51
23
  },
52
- children: r
53
- }) : null;
54
- });
24
+ children: /* @__PURE__ */ e(l, {
25
+ logo: t,
26
+ size: i
27
+ })
28
+ });
29
+ };
55
30
  export {
56
- F as default,
57
- y as isLogoGuid
31
+ _ as default,
32
+ d as isLogoGuid
58
33
  };
59
34
 
60
35
  //# sourceMappingURL=LogoFromGuid.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogoFromGuid.es.js","names":[],"sources":["../../../src/insights-v2/components/LogoFromGuid.tsx"],"sourcesContent":["import { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\n\nimport { Icon, IconList } from '@mxenabled/mx-icons'\nimport { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\n\nimport { useCategoryStore } from '../../common'\nimport type { LogoRef } from '../../core'\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; this maps it onto the mxui component's props and renders\n * nothing — never a guess — for anything else (`PARENT-ENTITY`, an `ACT-`/`BGT-` guid, an empty guid).\n *\n * The fallback chain is mxui's, not ours: asset for `guid` → category tile for `fallback_guid`\n * (`MerchantLogo`'s `categoryGuid`, applied only when it is a `CAT-` guid because a category tile is\n * the only fallback `MerchantLogo` has) → `alt`. Nothing here probes whether an asset exists.\n *\n * Categories are walked up to their top-level parent before reaching mxui: `CategoryIcon` only knows\n * the top-level guids and silently shows the Uncategorized glyph for a sub-category (identity until\n * categories load). That applies to a `CAT-` logo and to a merchant's `fallback_guid` alike.\n */\nconst LogoFromGuid = observer(({ className, logo, size }: LogoFromGuidProps) => {\n const { getTopLevelCategoryGuid } = useCategoryStore()\n\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 let content: React.ReactNode = null\n\n if (resolved.logo_name) {\n // An unmapped name would draw an empty box; say so and draw nothing instead.\n if (!(resolved.logo_name in IconList)) {\n console.warn(`[LogoFromGuid] \"${logo.guid}\" names no mx-icons icon — rendering nothing.`)\n return null\n }\n content = (\n <Icon\n fill={resolved.logo_fill}\n name={resolved.logo_name}\n size={size}\n sx={{ color: resolved.logo_color }}\n />\n )\n } else if (resolved.merchant_guid) {\n content = (\n <MerchantLogo\n alt={resolved.merchant_name ?? ''}\n categoryGuid={resolved.category_guid ? getTopLevelCategoryGuid(resolved.category_guid) : ''}\n merchantGuid={resolved.merchant_guid}\n size={size}\n />\n )\n } else if (resolved.institution_guid) {\n content = (\n <InstitutionLogo\n alt={resolved.institution_name ?? ''}\n institutionGuid={resolved.institution_guid}\n size={size}\n />\n )\n } else if (resolved.category_guid) {\n content = (\n <CategoryIcon categoryGuid={getTopLevelCategoryGuid(resolved.category_guid)} size={size} />\n )\n }\n\n if (!content) 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 {content}\n </Box>\n )\n})\n\nexport default LogoFromGuid\n"],"mappings":";;;;;;;AAiBA,IAAM,IAAmB,qCAEZ,IAAA,CAAc,MACzB,CAAC,CAAC,KAAQ,EAAiB,KAAK,CAAI,GAuBhC,IAAe,EAAA,CAAU,EAAE,WAAA,GAAW,MAAA,GAAM,MAAA,EAAA,MAA8B;AAC9E,QAAM,EAAE,yBAAA,EAAA,IAA4B,EAAiB;AAErD,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;AAED,MAAI,CAAC,EAAU,QAAO;AAEtB,MAAI,IAA2B;AAE/B,MAAI,EAAS,WAAW;AAEtB,QAAI,EAAE,EAAS,aAAa;AAC1B,qBAAQ,KAAK,mBAAmB,EAAK,IAAA,+CAAmD,GACjF;AAET,IAAA,IACE,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM,EAAS;AAAA,MACf,MAAM,EAAS;AAAA,MACT,MAAA;AAAA,MACN,IAAI,EAAE,OAAO,EAAS,WAAW;AAAA,IAClC,CAAA;AAAA,EAEL,MAAO,CAAI,EAAS,gBAClB,IACE,gBAAA,EAAC,GAAD;AAAA,IACE,KAAK,EAAS,iBAAiB;AAAA,IAC/B,cAAc,EAAS,gBAAgB,EAAwB,EAAS,aAAa,IAAI;AAAA,IACzF,cAAc,EAAS;AAAA,IACjB,MAAA;AAAA,EACP,CAAA,IAEM,EAAS,mBAClB,IACE,gBAAA,EAAC,GAAD;AAAA,IACE,KAAK,EAAS,oBAAoB;AAAA,IAClC,iBAAiB,EAAS;AAAA,IACpB,MAAA;AAAA,EACP,CAAA,IAEM,EAAS,kBAClB,IACE,gBAAA,EAAC,GAAD;AAAA,IAAc,cAAc,EAAwB,EAAS,aAAa;AAAA,IAAS,MAAA;AAAA,EAAO,CAAA;AAI9F,SAAK,IAGH,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,IAEC,UAAA;AAAA,EACE,CAAA,IAhBc;AAkBvB,CAAC"}
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"}
@@ -0,0 +1,19 @@
1
+ import { Logo } from '../../core';
2
+ interface LogoMarkProps {
3
+ logo: Logo;
4
+ size: number;
5
+ }
6
+ /**
7
+ * Whether mx-icons draws `name` (own keys only, so `constructor` is rejected). An unknown name would
8
+ * draw an empty box, so it is logged and the caller draws nothing.
9
+ */
10
+ export declare const isKnownIcon: (name: string) => boolean;
11
+ /**
12
+ * A resolved `Logo` as its mxui component. Categories walk up to their top-level parent first:
13
+ * `CategoryIcon` only knows those and shows the Uncategorized glyph for a sub-category. Reads the
14
+ * category store, so it renders inside the app's providers.
15
+ */
16
+ declare const LogoMark: (({ logo, size }: LogoMarkProps) => import("react/jsx-runtime").JSX.Element | null) & {
17
+ displayName: string;
18
+ };
19
+ export default LogoMark;
@@ -0,0 +1,32 @@
1
+ import { useCategoryStore as e } from "../../common/context/hooks.es.js";
2
+ import { observer as o } from "mobx-react-lite";
3
+ import { CategoryIcon as a, InstitutionLogo as u, MerchantLogo as c } from "@mxenabled/mxui";
4
+ import { Icon as m, IconList as s } from "@mxenabled/mx-icons";
5
+ import { jsx as n } from "react/jsx-runtime";
6
+ var d = (r) => Object.hasOwn(s, r) ? !0 : (console.warn(`[LogoMark] "${r}" names no mx-icons icon — rendering nothing.`), !1), l = o(({ logo: r, size: t }) => {
7
+ const { getTopLevelCategoryGuid: i } = e();
8
+ return r.logo_name ? d(r.logo_name) ? /* @__PURE__ */ n(m, {
9
+ fill: r.logo_fill,
10
+ name: r.logo_name,
11
+ size: t,
12
+ sx: { color: r.logo_color }
13
+ }) : null : r.merchant_guid ? /* @__PURE__ */ n(c, {
14
+ alt: r.merchant_name ?? "",
15
+ categoryGuid: r.category_guid ? i(r.category_guid) : "",
16
+ merchantGuid: r.merchant_guid,
17
+ size: t
18
+ }) : r.institution_guid ? /* @__PURE__ */ n(u, {
19
+ alt: r.institution_name ?? "",
20
+ institutionGuid: r.institution_guid,
21
+ size: t
22
+ }) : r.category_guid ? /* @__PURE__ */ n(a, {
23
+ categoryGuid: i(r.category_guid),
24
+ size: t
25
+ }) : null;
26
+ });
27
+ export {
28
+ l as default,
29
+ d as isKnownIcon
30
+ };
31
+
32
+ //# sourceMappingURL=LogoMark.es.js.map
@@ -0,0 +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 { CategoryIcon, InstitutionLogo, MerchantLogo } from '@mxenabled/mxui'\n\nimport { useCategoryStore } from '../../common'\nimport type { Logo } from '../../core'\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. Categories walk up to their top-level parent first:\n * `CategoryIcon` only knows those and shows the Uncategorized glyph for a sub-category. Reads the\n * category store, so it renders 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 <CategoryIcon categoryGuid={getTopLevelCategoryGuid(logo.category_guid)} size={size} />\n }\n\n return null\n})\n\nexport default LogoMark\n"],"mappings":";;;;;AAiBA,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,EAAwB,EAAK,aAAa;AAAA,IAAS,MAAA;AAAA,EAAO,CAAA,IAGxF;AACT,CAAC"}
@@ -1,43 +1,29 @@
1
- import n from "@mui/material/Stack";
2
- import { CategoryIcon as a, InstitutionLogo as u, MerchantLogo as c, Text as o } from "@mxenabled/mxui";
3
- import { Icon as s } from "@mxenabled/mx-icons";
4
- import { jsx as r, jsxs as d } from "react/jsx-runtime";
5
- var m = (t) => t ? t.logo_name ? /* @__PURE__ */ r(s, {
6
- fill: t.logo_fill,
7
- name: t.logo_name,
8
- size: 16,
9
- sx: { color: t.logo_color }
10
- }) : t.merchant_guid ? /* @__PURE__ */ r(c, {
11
- alt: t.merchant_name,
12
- categoryGuid: t.category_guid,
13
- merchantGuid: t.merchant_guid,
14
- size: 16
15
- }) : t.institution_guid ? /* @__PURE__ */ r(u, {
16
- alt: t.institution_name,
17
- institutionGuid: t.institution_guid,
18
- size: 16
19
- }) : t.category_guid ? /* @__PURE__ */ r(a, {
20
- categoryGuid: t.category_guid,
21
- size: 16
22
- }) : null : null, x = ({ subtitle: t }) => {
23
- const { logo: e, text: i } = t;
24
- return /* @__PURE__ */ d(n, {
1
+ import a from "./LogoMark.es.js";
2
+ import i from "@mui/material/Stack";
3
+ import { Text as s } from "@mxenabled/mxui";
4
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
5
+ var l = ({ subtitle: t }) => {
6
+ const { logo: r, text: o } = t;
7
+ return /* @__PURE__ */ c(i, {
25
8
  sx: {
26
9
  alignItems: "center",
27
10
  flexDirection: "row",
28
11
  gap: 8
29
12
  },
30
- children: [m(e), /* @__PURE__ */ r(o, {
13
+ children: [r && /* @__PURE__ */ e(a, {
14
+ logo: r,
15
+ size: 16
16
+ }), /* @__PURE__ */ e(s, {
31
17
  color: "text.secondary",
32
18
  sx: { letterSpacing: "0.52px" },
33
19
  uppercase: !0,
34
20
  variant: "body2",
35
- children: i
21
+ children: o
36
22
  })]
37
23
  });
38
24
  };
39
25
  export {
40
- x as default
26
+ l as default
41
27
  };
42
28
 
43
29
  //# sourceMappingURL=SubHeader.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubHeader.es.js","names":[],"sources":["../../../src/insights-v2/components/SubHeader.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { CategoryIcon, InstitutionLogo, MerchantLogo, Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\nimport type { Logo, Subtitle } from '../../core'\n\ninterface SubHeaderProps {\n subtitle: Subtitle\n}\n\n// TODO: Ask backend to send the correct guid (institution_guid, merchant_guid, or category_guid)\n// per beat's logo, matching what that beat's subtitle is actually about.\nconst renderLogo = (logo: Logo | undefined) => {\n if (!logo) return null\n\n if (logo.logo_name) {\n return (\n <Icon fill={logo.logo_fill} name={logo.logo_name} size={16} sx={{ color: logo.logo_color }} />\n )\n }\n\n if (logo.merchant_guid) {\n return (\n <MerchantLogo\n alt={logo.merchant_name as string}\n categoryGuid={logo.category_guid as string}\n merchantGuid={logo.merchant_guid}\n size={16}\n />\n )\n }\n\n if (logo.institution_guid) {\n return (\n <InstitutionLogo\n alt={logo.institution_name as string}\n institutionGuid={logo.institution_guid}\n size={16}\n />\n )\n }\n\n if (logo.category_guid) {\n return <CategoryIcon categoryGuid={logo.category_guid} size={16} />\n }\n\n return null\n}\n\nconst SubHeader = ({ subtitle }: SubHeaderProps) => {\n const { logo, text } = subtitle\n\n return (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {renderLogo(logo)}\n {/* Figma `typography/body2 (upper)`: uppercased with 0.52px tracking. */}\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.52px' }}\n uppercase={true}\n variant=\"body2\"\n >\n {text}\n </Text>\n </Stack>\n )\n}\n\nexport default SubHeader\n"],"mappings":";;;;AAYA,IAAM,IAAA,CAAc,MACb,IAED,EAAK,YAEL,gBAAA,EAAC,GAAD;AAAA,EAAM,MAAM,EAAK;AAAA,EAAW,MAAM,EAAK;AAAA,EAAW,MAAM;AAAA,EAAI,IAAI,EAAE,OAAO,EAAK,WAAW;AAAI,CAAA,IAI7F,EAAK,gBAEL,gBAAA,EAAC,GAAD;AAAA,EACE,KAAK,EAAK;AAAA,EACV,cAAc,EAAK;AAAA,EACnB,cAAc,EAAK;AAAA,EACnB,MAAM;AACP,CAAA,IAID,EAAK,mBAEL,gBAAA,EAAC,GAAD;AAAA,EACE,KAAK,EAAK;AAAA,EACV,iBAAiB,EAAK;AAAA,EACtB,MAAM;AACP,CAAA,IAID,EAAK,gBACA,gBAAA,EAAC,GAAD;AAAA,EAAc,cAAc,EAAK;AAAA,EAAe,MAAM;AAAK,CAAA,IAG7D,OAjCW,MAoCd,IAAA,CAAa,EAAE,UAAA,EAAA,MAA+B;AAClD,QAAM,EAAE,MAAA,GAAM,MAAA,EAAA,IAAS;AAEvB,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,KAAK;AAAA,IAAE;AAAA,IAAhE,UAAA,CACG,EAAW,CAAI,GAEhB,gBAAA,EAAC,GAAD;AAAA,MACE,OAAM;AAAA,MACN,IAAI,EAAE,eAAe,SAAS;AAAA,MAC9B,WAAW;AAAA,MACX,SAAQ;AAAA,MAEP,UAAA;AAAA,IACG,CAAA,CACD;AAAA;AAEX"}
1
+ {"version":3,"file":"SubHeader.es.js","names":[],"sources":["../../../src/insights-v2/components/SubHeader.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport type { Subtitle } from '../../core'\n\nimport LogoMark from './LogoMark'\n\ninterface SubHeaderProps {\n subtitle: Subtitle\n}\n\nconst SubHeader = ({ subtitle }: SubHeaderProps) => {\n const { logo, text } = subtitle\n\n return (\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 8 }}>\n {logo && <LogoMark logo={logo} size={16} />}\n {/* Figma `typography/body2 (upper)`: uppercased with 0.52px tracking. */}\n <Text\n color=\"text.secondary\"\n sx={{ letterSpacing: '0.52px' }}\n uppercase={true}\n variant=\"body2\"\n >\n {text}\n </Text>\n </Stack>\n )\n}\n\nexport default SubHeader\n"],"mappings":";;;;AAYA,IAAM,IAAA,CAAa,EAAE,UAAA,EAAA,MAA+B;AAClD,QAAM,EAAE,MAAA,GAAM,MAAA,EAAA,IAAS;AAEvB,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,KAAK;AAAA,IAAE;AAAA,IAAhE,UAAA,CACG,KAAQ,gBAAA,EAAC,GAAD;AAAA,MAAgB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAK,CAAA,GAE1C,gBAAA,EAAC,GAAD;AAAA,MACE,OAAM;AAAA,MACN,IAAI,EAAE,eAAe,SAAS;AAAA,MAC9B,WAAW;AAAA,MACX,SAAQ;AAAA,MAEP,UAAA;AAAA,IACG,CAAA,CACD;AAAA;AAEX"}
@@ -3,7 +3,7 @@ import { Logo, LogoRef } from '../../../core';
3
3
  * The V2 beat envelope (LargeTransactionV2 onward) sends an entity logo as an opaque guid instead
4
4
  * of V1's named `institution_guid` / `merchant_guid` / `category_guid` fields. The entity is
5
5
  * carried only by the guid's prefix, so this maps a guid back onto the named `Logo` shape the
6
- * existing renderers (`SubHeader`, mxui logo components) already understand.
6
+ * existing renderer (`LogoMark`) already understands.
7
7
  *
8
8
  * An unrecognized prefix returns `undefined` rather than guessing: rendering a merchant logo for
9
9
  * an institution guid would silently show the wrong image.
@@ -14,7 +14,7 @@ export declare const logoFromEntityGuid: (guid?: string, alt?: string) => Logo |
14
14
  * header and the rows go through, so the two can never disagree about precedence:
15
15
  *
16
16
  * - `icon` becomes V1's `logo_name` / `logo_color` and wins over `guid`, as `logo_name` does in
17
- * `SubHeader`.
17
+ * `LogoMark`.
18
18
  * - Otherwise `guid` resolves by prefix (`logoFromEntityGuid`). For an `MCH-` guid, a `CAT-`
19
19
  * `fallback_guid` becomes the merchant's `category_guid`: `MerchantLogo` draws that category as a
20
20
  * tile when the merchant image fails to load, and without it the tile is the Uncategorized icon.
@@ -1 +1 @@
1
- {"version":3,"file":"EntityLogo.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/EntityLogo.tsx"],"sourcesContent":["import type { Logo, LogoRef } from '../../../core'\n\n/**\n * The V2 beat envelope (LargeTransactionV2 onward) sends an entity logo as an opaque guid instead\n * of V1's named `institution_guid` / `merchant_guid` / `category_guid` fields. The entity is\n * carried only by the guid's prefix, so this maps a guid back onto the named `Logo` shape the\n * existing renderers (`SubHeader`, mxui logo components) already understand.\n *\n * An unrecognized prefix returns `undefined` rather than guessing: rendering a merchant logo for\n * an institution guid would silently show the wrong image.\n */\nexport const logoFromEntityGuid = (guid?: string, alt?: string): Logo | undefined => {\n if (!guid) return undefined\n\n if (guid.startsWith('INS-')) {\n return { institution_guid: guid, institution_name: alt }\n }\n\n if (guid.startsWith('MCH-')) {\n return { merchant_guid: guid, merchant_name: alt }\n }\n\n if (guid.startsWith('CAT-')) {\n return { category_guid: guid, category_name: alt }\n }\n\n // MXUI defines no `ICO-` prefix: `ICO-<name>` is our own contract for a filled mx-icons icon.\n // Unlike the entity prefixes above, the name (not the whole guid) becomes `logo_name`, and it must\n // be a non-empty icon slug, so the prefix is stripped and the remainder validated.\n if (guid.startsWith('ICO-')) {\n const icon = guid.slice(4)\n\n return /^[a-z0-9_-]+$/.test(icon) ? { logo_fill: true, logo_name: icon } : undefined\n }\n return undefined\n}\n\n/**\n * Resolves a V2 `LogoRef` (header or row) onto the named `Logo` shape. The one mapping both the\n * header and the rows go through, so the two can never disagree about precedence:\n *\n * - `icon` becomes V1's `logo_name` / `logo_color` and wins over `guid`, as `logo_name` does in\n * `SubHeader`.\n * - Otherwise `guid` resolves by prefix (`logoFromEntityGuid`). For an `MCH-` guid, a `CAT-`\n * `fallback_guid` becomes the merchant's `category_guid`: `MerchantLogo` draws that category as a\n * tile when the merchant image fails to load, and without it the tile is the Uncategorized icon.\n * Only a category fallback is applied, because a category tile is the only fallback\n * `MerchantLogo` has.\n *\n * `fallbackAlt` names the logo when the ref carries no `alt` (rows pass their `primary_text`).\n */\nexport const logoFromRef = (ref?: LogoRef, fallbackAlt?: string): Logo | undefined => {\n if (!ref) return undefined\n\n if (ref.icon) {\n return { logo_color: ref.color, logo_name: ref.icon }\n }\n\n const logo = logoFromEntityGuid(ref.guid, ref.alt ?? fallbackAlt)\n if (logo?.logo_name) {\n return ref.color ? { ...logo, logo_color: ref.color } : logo\n }\n\n if (logo?.merchant_guid && ref.fallback_guid?.startsWith('CAT-')) {\n return { ...logo, category_guid: ref.fallback_guid }\n }\n\n return logo\n}\n"],"mappings":"AAWA,IAAa,IAAA,CAAsB,GAAe,MAAmC;AACnF,MAAK,GAEL;AAAA,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,kBAAkB;AAAA,MAAM,kBAAkB;AAAA,IAAI;AAGzD,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,eAAe;AAAA,MAAM,eAAe;AAAA,IAAI;AAGnD,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,eAAe;AAAA,MAAM,eAAe;AAAA,IAAI;AAMnD,QAAI,EAAK,WAAW,MAAM,GAAG;AAC3B,YAAM,IAAO,EAAK,MAAM,CAAC;AAEzB,aAAO,gBAAgB,KAAK,CAAI,IAAI;AAAA,QAAE,WAAW;AAAA,QAAM,WAAW;AAAA,MAAK,IAAI;AAAA,IAC7E;AAAA;AAEF,GAgBa,IAAA,CAAe,GAAe,MAA2C;AACpF,MAAI,CAAC,EAAK;AAEV,MAAI,EAAI,KACN,QAAO;AAAA,IAAE,YAAY,EAAI;AAAA,IAAO,WAAW,EAAI;AAAA,EAAK;AAGtD,QAAM,IAAO,EAAmB,EAAI,MAAM,EAAI,OAAO,CAAW;AAChE,SAAI,GAAM,YACD,EAAI,QAAQ;AAAA,IAAE,GAAG;AAAA,IAAM,YAAY,EAAI;AAAA,EAAM,IAAI,IAGtD,GAAM,iBAAiB,EAAI,eAAe,WAAW,MAAM,IACtD;AAAA,IAAE,GAAG;AAAA,IAAM,eAAe,EAAI;AAAA,EAAc,IAG9C;AACT"}
1
+ {"version":3,"file":"EntityLogo.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/EntityLogo.tsx"],"sourcesContent":["import type { Logo, LogoRef } from '../../../core'\n\n/**\n * The V2 beat envelope (LargeTransactionV2 onward) sends an entity logo as an opaque guid instead\n * of V1's named `institution_guid` / `merchant_guid` / `category_guid` fields. The entity is\n * carried only by the guid's prefix, so this maps a guid back onto the named `Logo` shape the\n * existing renderer (`LogoMark`) already understands.\n *\n * An unrecognized prefix returns `undefined` rather than guessing: rendering a merchant logo for\n * an institution guid would silently show the wrong image.\n */\nexport const logoFromEntityGuid = (guid?: string, alt?: string): Logo | undefined => {\n if (!guid) return undefined\n\n if (guid.startsWith('INS-')) {\n return { institution_guid: guid, institution_name: alt }\n }\n\n if (guid.startsWith('MCH-')) {\n return { merchant_guid: guid, merchant_name: alt }\n }\n\n if (guid.startsWith('CAT-')) {\n return { category_guid: guid, category_name: alt }\n }\n\n // MXUI defines no `ICO-` prefix: `ICO-<name>` is our own contract for a filled mx-icons icon.\n // Unlike the entity prefixes above, the name (not the whole guid) becomes `logo_name`, and it must\n // be a non-empty icon slug, so the prefix is stripped and the remainder validated.\n if (guid.startsWith('ICO-')) {\n const icon = guid.slice(4)\n\n return /^[a-z0-9_-]+$/.test(icon) ? { logo_fill: true, logo_name: icon } : undefined\n }\n return undefined\n}\n\n/**\n * Resolves a V2 `LogoRef` (header or row) onto the named `Logo` shape. The one mapping both the\n * header and the rows go through, so the two can never disagree about precedence:\n *\n * - `icon` becomes V1's `logo_name` / `logo_color` and wins over `guid`, as `logo_name` does in\n * `LogoMark`.\n * - Otherwise `guid` resolves by prefix (`logoFromEntityGuid`). For an `MCH-` guid, a `CAT-`\n * `fallback_guid` becomes the merchant's `category_guid`: `MerchantLogo` draws that category as a\n * tile when the merchant image fails to load, and without it the tile is the Uncategorized icon.\n * Only a category fallback is applied, because a category tile is the only fallback\n * `MerchantLogo` has.\n *\n * `fallbackAlt` names the logo when the ref carries no `alt` (rows pass their `primary_text`).\n */\nexport const logoFromRef = (ref?: LogoRef, fallbackAlt?: string): Logo | undefined => {\n if (!ref) return undefined\n\n if (ref.icon) {\n return { logo_color: ref.color, logo_name: ref.icon }\n }\n\n const logo = logoFromEntityGuid(ref.guid, ref.alt ?? fallbackAlt)\n if (logo?.logo_name) {\n return ref.color ? { ...logo, logo_color: ref.color } : logo\n }\n\n if (logo?.merchant_guid && ref.fallback_guid?.startsWith('CAT-')) {\n return { ...logo, category_guid: ref.fallback_guid }\n }\n\n return logo\n}\n"],"mappings":"AAWA,IAAa,IAAA,CAAsB,GAAe,MAAmC;AACnF,MAAK,GAEL;AAAA,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,kBAAkB;AAAA,MAAM,kBAAkB;AAAA,IAAI;AAGzD,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,eAAe;AAAA,MAAM,eAAe;AAAA,IAAI;AAGnD,QAAI,EAAK,WAAW,MAAM,EACxB,QAAO;AAAA,MAAE,eAAe;AAAA,MAAM,eAAe;AAAA,IAAI;AAMnD,QAAI,EAAK,WAAW,MAAM,GAAG;AAC3B,YAAM,IAAO,EAAK,MAAM,CAAC;AAEzB,aAAO,gBAAgB,KAAK,CAAI,IAAI;AAAA,QAAE,WAAW;AAAA,QAAM,WAAW;AAAA,MAAK,IAAI;AAAA,IAC7E;AAAA;AAEF,GAgBa,IAAA,CAAe,GAAe,MAA2C;AACpF,MAAI,CAAC,EAAK;AAEV,MAAI,EAAI,KACN,QAAO;AAAA,IAAE,YAAY,EAAI;AAAA,IAAO,WAAW,EAAI;AAAA,EAAK;AAGtD,QAAM,IAAO,EAAmB,EAAI,MAAM,EAAI,OAAO,CAAW;AAChE,SAAI,GAAM,YACD,EAAI,QAAQ;AAAA,IAAE,GAAG;AAAA,IAAM,YAAY,EAAI;AAAA,EAAM,IAAI,IAGtD,GAAM,iBAAiB,EAAI,eAAe,WAAW,MAAM,IACtD;AAAA,IAAE,GAAG;AAAA,IAAM,eAAe,EAAI;AAAA,EAAc,IAG9C;AACT"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.126",
3
+ "version": "9.7.127",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",