@mx-cartographer/experiences 9.7.195 → 9.7.197

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 (46) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/common/components/Select.d.ts +1 -1
  3. package/dist/common/components/Select.es.js +27 -20
  4. package/dist/common/components/Select.es.js.map +1 -1
  5. package/dist/core/types/localization/InsightsFeedCopy.d.ts +16 -0
  6. package/dist/insights/components/shared/Charts/BarChart/CustomBarPlotV2.d.ts +3 -1
  7. package/dist/insights/components/shared/Charts/BarChart/CustomBarPlotV2.es.js +29 -21
  8. package/dist/insights/components/shared/Charts/BarChart/CustomBarPlotV2.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js +54 -37
  10. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsBlock.es.js.map +1 -1
  11. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.d.ts +23 -0
  12. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.es.js +352 -0
  13. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.es.js.map +1 -0
  14. package/dist/insights-v2/actionBlocks/QuizMerchantBlock/QuizMerchantBlock.es.js +4 -4
  15. package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +4 -4
  16. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js +4 -4
  17. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.d.ts +3 -1
  18. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js +68 -63
  19. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionDrillDown.es.js.map +1 -1
  20. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +94 -91
  21. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
  22. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -0
  23. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +7 -5
  24. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
  25. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/StepChartBlock.d.ts +1 -1
  26. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js +12 -7
  27. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js.map +1 -1
  28. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/index.d.ts +4 -0
  29. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/index.es.js +7 -5
  30. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/index.es.js.map +1 -1
  31. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.d.ts +19 -0
  32. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.es.js +126 -0
  33. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.es.js.map +1 -0
  34. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +59 -56
  35. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
  36. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.d.ts +1 -1
  37. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js +22 -11
  38. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js.map +1 -1
  39. package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js +10 -10
  40. package/dist/insights-v2/components/LogoClusterCard.es.js +9 -8
  41. package/dist/insights-v2/components/LogoClusterCard.es.js.map +1 -1
  42. package/dist/insights-v2/components/TransactionListCard.es.js +4 -4
  43. package/dist/insights-v2/components/chartblocks/BarchartV2.d.ts +9 -1
  44. package/dist/insights-v2/components/chartblocks/BarchartV2.es.js +109 -85
  45. package/dist/insights-v2/components/chartblocks/BarchartV2.es.js.map +1 -1
  46. package/package.json +1 -1
@@ -1,40 +1,40 @@
1
1
  import { slot as n } from "../../../../core/types/Insights.es.js";
2
- import { CURRENCY_FORMAT as O, formatCurrency as x } from "../../../../core/utils/NumberFormatting.es.js";
3
- import A from "../../../components/StatusPill.es.js";
4
- import { resolveVariantConfig as E } from "../../resolveVariantConfig.es.js";
5
- import { asLogoRef as R, asNumber as y, asText as i, slotOrFlat as d } from "../../slotReaders.es.js";
6
- import _, { isLogoGuid as z } from "../../../components/LogoFromGuid.es.js";
7
- import B from "../../../components/LogoClusterCard.es.js";
8
- import M from "../../../components/MerchantHighlightCard.es.js";
9
- import N from "../../../components/P2PLogoStack.es.js";
10
- import { MERCHANT_LAYOUT as P, merchantBlockVariant as T } from "./layout.es.js";
11
- import V from "@mui/material/Stack";
12
- import { Icon as C } from "@mxenabled/mx-icons";
2
+ import { CURRENCY_FORMAT as R, formatCurrency as E } from "../../../../core/utils/NumberFormatting.es.js";
3
+ import y from "../../../components/StatusPill.es.js";
4
+ import { resolveVariantConfig as N } from "../../resolveVariantConfig.es.js";
5
+ import { asLogoRef as P, asNumber as z, asText as i, slotOrFlat as g } from "../../slotReaders.es.js";
6
+ import C, { isLogoGuid as B } from "../../../components/LogoFromGuid.es.js";
7
+ import M from "../../../components/LogoClusterCard.es.js";
8
+ import T from "../../../components/MerchantHighlightCard.es.js";
9
+ import V from "../../../components/P2PLogoStack.es.js";
10
+ import { MERCHANT_LAYOUT as w, merchantBlockVariant as D } from "./layout.es.js";
11
+ import G from "@mui/material/Stack";
12
+ import { Icon as O } from "@mxenabled/mx-icons";
13
13
  import { jsx as e } from "react/jsx-runtime";
14
- var p = 64, b = 6, w = 72, F = 3, G = [
14
+ var k = 64, b = 6, I = 72, K = 3, F = 10, Z = [
15
+ 0,
15
16
  10,
16
- 20,
17
- 35
18
- ], I = 32, g = (a) => {
19
- const r = R(a);
20
- return r?.guid && z(r.guid) ? r : void 0;
21
- }, D = (a) => {
17
+ 25
18
+ ], j = (a) => a === 2 || a === 3 || a === 4, H = 32, u = (a) => {
19
+ const r = P(a);
20
+ return r?.guid && B(r.guid) ? r : void 0;
21
+ }, U = (a) => {
22
22
  if (!Array.isArray(a)) return [];
23
23
  const r = /* @__PURE__ */ new Map();
24
- for (const t of a.map(g)) t?.guid && !r.has(t.guid) && r.set(t.guid, t);
24
+ for (const t of a.map(u)) t?.guid && !r.has(t.guid) && r.set(t.guid, t);
25
25
  return [...r.values()];
26
- }, L = /* @__PURE__ */ e(C, {
26
+ }, L = /* @__PURE__ */ e(O, {
27
27
  "aria-hidden": !0,
28
28
  "data-icon": "storefront",
29
29
  name: "storefront",
30
- size: I,
30
+ size: H,
31
31
  sx: { color: "text.secondary" }
32
- }), k = (a, r) => a.length ? a.map((t) => /* @__PURE__ */ e(_, {
32
+ }), _ = (a, r) => a.length ? a.map((t) => /* @__PURE__ */ e(C, {
33
33
  logo: t,
34
34
  size: r
35
- }, t.guid)) : [L], ro = ({ payload: a }) => {
36
- const { instance_slot: r } = a, { data: t } = r, o = E(P, r.variant, T.SingleStandard, "MerchantBlock"), u = i(d(r, "status_text")), m = o.status && u ? /* @__PURE__ */ e(A, {
37
- icon: /* @__PURE__ */ e(C, {
35
+ }, t.guid)) : [L], io = ({ payload: a }) => {
36
+ const { instance_slot: r } = a, { data: t } = r, o = N(w, r.variant, D.SingleStandard, "MerchantBlock"), m = i(g(r, "status_text")), f = o.status && m ? /* @__PURE__ */ e(y, {
37
+ icon: /* @__PURE__ */ e(O, {
38
38
  "aria-hidden": !0,
39
39
  "data-icon": "check_circle",
40
40
  fill: !0,
@@ -42,73 +42,76 @@ var p = 64, b = 6, w = 72, F = 3, G = [
42
42
  size: 16,
43
43
  sx: { color: "success.700" }
44
44
  }),
45
- label: u,
45
+ label: m,
46
46
  sx: o.kind === "single" ? void 0 : {
47
47
  alignSelf: "stretch",
48
48
  justifyContent: "center"
49
49
  }
50
50
  }) : void 0;
51
51
  if (o.kind !== "single") {
52
- const c = D(n(t, "logos"));
53
- if (o.kind === "ranked" && c.length) return /* @__PURE__ */ e(B, {
54
- background: o.background,
55
- fullBleed: !0,
56
- logos: k(c.slice(0, F), w),
57
- overlap: b,
58
- rankOffsets: G,
59
- ranked: !0
60
- });
61
- const v = o.logo?.size ?? p;
62
- return /* @__PURE__ */ e(V, {
52
+ const c = U(n(t, "logos"));
53
+ if (o.kind === "ranked" && c.length) {
54
+ const d = c.slice(0, K), S = j(d.length) && o.cascade?.offsets?.[d.length] || Z;
55
+ return /* @__PURE__ */ e(M, {
56
+ background: o.background,
57
+ fullBleed: !0,
58
+ logos: _(d, I),
59
+ overlap: o.cascade?.overlap ?? b,
60
+ rankOffsets: S.map((x) => F + x),
61
+ ranked: !0
62
+ });
63
+ }
64
+ const p = o.logo?.size ?? k;
65
+ return /* @__PURE__ */ e(G, {
63
66
  sx: {
64
67
  background: o.background,
65
68
  bgcolor: o.background ? void 0 : o.bgcolor,
66
69
  p: 16,
67
70
  width: "100%"
68
71
  },
69
- children: /* @__PURE__ */ e(N, {
72
+ children: /* @__PURE__ */ e(V, {
70
73
  borderColor: o.logo?.borderColor ?? null,
71
- logos: k(c, v),
74
+ logos: _(c, p),
72
75
  offsets: o.cascade?.offsets,
73
76
  overlap: o.cascade?.overlap ?? b,
74
77
  shadow: "elevation",
75
- size: v,
76
- status: m
78
+ size: p,
79
+ status: f
77
80
  })
78
81
  });
79
82
  }
80
- const l = i(n(t, "primary_text")) || i(d(r, "merchant_name"));
81
- if (!l) return null;
82
- const s = y(d(r, "amount")), S = i(n(t, "header_text")) || i(n(t, "date")), f = g(n(t, "logo")) ?? g({
83
- alt: l,
83
+ const s = i(n(t, "primary_text")) || i(g(r, "merchant_name"));
84
+ if (!s) return null;
85
+ const l = z(g(r, "amount")), A = i(n(t, "header_text")) || i(n(t, "date")), h = u(n(t, "logo")) ?? u({
86
+ alt: s,
84
87
  fallback_guid: r.category_guid,
85
88
  guid: r.merchant_guid
86
- }), h = o.logo?.size ?? p;
87
- return /* @__PURE__ */ e(M, {
88
- amount: s !== void 0 && s !== 0 ? x(s, O.cents) : void 0,
89
+ }), v = o.logo?.size ?? k;
90
+ return /* @__PURE__ */ e(T, {
91
+ amount: l !== void 0 && l !== 0 ? E(l, R.cents) : void 0,
89
92
  amountPill: o.amountPill,
90
93
  amountVariant: o.amountVariant,
91
94
  background: o.background,
92
95
  bgcolor: o.bgcolor,
93
96
  borderColor: o.borderColor,
94
- eyebrow: o.hideDate ? void 0 : S,
97
+ eyebrow: o.hideDate ? void 0 : A,
95
98
  fullBleed: o.fullBleed,
96
99
  gap: o.gap,
97
- logo: f ? /* @__PURE__ */ e(_, {
98
- logo: f,
99
- size: h
100
+ logo: h ? /* @__PURE__ */ e(C, {
101
+ logo: h,
102
+ size: v
100
103
  }) : L,
101
104
  logoBorderColor: o.logo?.borderColor,
102
105
  logoRadius: o.logo?.radius,
103
106
  logoShadow: o.logo?.shadow,
104
- logoSize: h,
105
- name: l,
107
+ logoSize: v,
108
+ name: s,
106
109
  nameVariant: o.nameVariant,
107
- trailing: m
110
+ trailing: f
108
111
  });
109
112
  };
110
113
  export {
111
- ro as default
114
+ io as default
112
115
  };
113
116
 
114
117
  //# sourceMappingURL=MerchantBlock.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"MerchantBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport type { MerchantBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoClusterCard from '../../../components/LogoClusterCard'\nimport LogoFromGuid, { isLogoGuid } from '../../../components/LogoFromGuid'\nimport MerchantHighlightCard from '../../../components/MerchantHighlightCard'\nimport P2PLogoStack from '../../../components/P2PLogoStack'\nimport StatusPill from '../../../components/StatusPill'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText, slotOrFlat } from '../../slotReaders'\n\nimport { MERCHANT_LAYOUT, merchantBlockVariant } from './layout'\n\ninterface MerchantBlockProps {\n payload: InsightsPayload\n}\n\nconst LOGO_SIZE = 64\nconst LOGO_OVERLAP = 6\nconst RANKED_LOGO_SIZE = 72\nconst RANKED_MAX = 3\nconst RANKED_OFFSETS = [10, 20, 35] as const\nconst FALLBACK_ICON_SIZE = 32\n\n/** A logo ref naming a known logo guid, else undefined, so an unusable one falls through. */\nconst asMerchantLogo = (value: unknown): LogoRef | undefined => {\n const ref = asLogoRef(value)\n return ref?.guid && isLogoGuid(ref.guid) ? ref : undefined\n}\n\nconst uniqueLogos = (refs: unknown): LogoRef[] => {\n if (!Array.isArray(refs)) return []\n const byGuid = new Map<string, LogoRef>()\n for (const ref of refs.map(asMerchantLogo)) {\n if (ref?.guid && !byGuid.has(ref.guid)) byGuid.set(ref.guid, ref)\n }\n return [...byGuid.values()]\n}\n\nconst storefront = (\n <Icon\n aria-hidden={true}\n data-icon=\"storefront\"\n name=\"storefront\"\n size={FALLBACK_ICON_SIZE}\n sx={{ color: 'text.secondary' }}\n />\n)\n\nconst logoTiles = (refs: LogoRef[], size: number) =>\n refs.length\n ? refs.map((ref) => <LogoFromGuid key={ref.guid} logo={ref} size={size} />)\n : [storefront]\n\nconst MerchantBlock = ({ payload }: MerchantBlockProps) => {\n const { instance_slot } = payload\n const { data } = instance_slot\n const config = resolveVariantConfig(\n MERCHANT_LAYOUT,\n instance_slot.variant,\n merchantBlockVariant.SingleStandard,\n 'MerchantBlock',\n )\n const statusText = asText(slotOrFlat(instance_slot, 'status_text'))\n const statusPill =\n config.status && statusText ? (\n <StatusPill\n icon={\n <Icon\n aria-hidden={true}\n data-icon=\"check_circle\"\n fill={true}\n name=\"check_circle\"\n size={16}\n sx={{ color: 'success.700' }}\n />\n }\n label={statusText}\n sx={\n config.kind === 'single' ? undefined : { alignSelf: 'stretch', justifyContent: 'center' }\n }\n />\n ) : undefined\n\n if (config.kind !== 'single') {\n const logos = uniqueLogos(slot<MerchantBlockData['logos']>(data, 'logos'))\n\n if (config.kind === 'ranked' && logos.length) {\n return (\n <LogoClusterCard\n background={config.background}\n fullBleed={true}\n logos={logoTiles(logos.slice(0, RANKED_MAX), RANKED_LOGO_SIZE)}\n overlap={LOGO_OVERLAP}\n rankOffsets={RANKED_OFFSETS}\n ranked={true}\n />\n )\n }\n\n const cascadeSize = config.logo?.size ?? LOGO_SIZE\n\n return (\n <Stack\n sx={{\n background: config.background,\n bgcolor: config.background ? undefined : config.bgcolor,\n p: 16,\n width: '100%',\n }}\n >\n <P2PLogoStack\n borderColor={config.logo?.borderColor ?? null}\n logos={logoTiles(logos, cascadeSize)}\n offsets={config.cascade?.offsets}\n overlap={config.cascade?.overlap ?? LOGO_OVERLAP}\n shadow=\"elevation\"\n size={cascadeSize}\n status={statusPill}\n />\n </Stack>\n )\n }\n\n // ditto's slot names first.\n const merchantName =\n asText(slot(data, 'primary_text')) || asText(slotOrFlat(instance_slot, 'merchant_name'))\n if (!merchantName) return null\n\n const amount = asNumber(slotOrFlat(instance_slot, 'amount'))\n const date = asText(slot(data, 'header_text')) || asText(slot(data, 'date'))\n const logo =\n asMerchantLogo(slot<unknown>(data, 'logo')) ??\n asMerchantLogo({\n alt: merchantName,\n fallback_guid: instance_slot.category_guid,\n guid: instance_slot.merchant_guid,\n })\n const logoSize = config.logo?.size ?? LOGO_SIZE\n\n return (\n <MerchantHighlightCard\n amount={\n amount !== undefined && amount !== 0\n ? formatCurrency(amount, CURRENCY_FORMAT.cents)\n : undefined\n }\n amountPill={config.amountPill}\n amountVariant={config.amountVariant}\n background={config.background}\n bgcolor={config.bgcolor}\n borderColor={config.borderColor}\n eyebrow={config.hideDate ? undefined : date}\n fullBleed={config.fullBleed}\n gap={config.gap}\n logo={logo ? <LogoFromGuid logo={logo} size={logoSize} /> : storefront}\n logoBorderColor={config.logo?.borderColor}\n logoRadius={config.logo?.radius}\n logoShadow={config.logo?.shadow}\n logoSize={logoSize}\n name={merchantName}\n nameVariant={config.nameVariant}\n trailing={statusPill}\n />\n )\n}\n\nexport default MerchantBlock\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAM,IAAY,IACZ,IAAe,GACf,IAAmB,IACnB,IAAa,GACb,IAAiB;AAAA,EAAC;AAAA,EAAI;AAAA,EAAI;AAAE,GAC5B,IAAqB,IAGrB,IAAA,CAAkB,MAAwC;AAC9D,QAAM,IAAM,EAAU,CAAK;AAC3B,SAAO,GAAK,QAAQ,EAAW,EAAI,IAAI,IAAI,IAAM;AACnD,GAEM,IAAA,CAAe,MAA6B;AAChD,MAAI,CAAC,MAAM,QAAQ,CAAI,EAAG,QAAO,CAAC;AAClC,QAAM,IAAS,oBAAI,IAAqB;AACxC,aAAW,KAAO,EAAK,IAAI,CAAc,EACvC,CAAI,GAAK,QAAQ,CAAC,EAAO,IAAI,EAAI,IAAI,KAAG,EAAO,IAAI,EAAI,MAAM,CAAG;AAElE,SAAO,CAAC,GAAG,EAAO,OAAO,CAAC;AAC5B,GAEM,IACJ,gBAAA,EAAC,GAAD;AAAA,EACE,eAAa;AAAA,EACb,aAAU;AAAA,EACV,MAAK;AAAA,EACL,MAAM;AAAA,EACN,IAAI,EAAE,OAAO,iBAAiB;AAC/B,CAAA,GAGG,IAAA,CAAa,GAAiB,MAClC,EAAK,SACD,EAAK,IAAA,CAAK,MAAQ,gBAAA,EAAC,GAAD;AAAA,EAA6B,MAAM;AAAA,EAAW,MAAA;AAAO,GAAlC,EAAI,IAA8B,CAAC,IACxE,CAAC,CAAU,GAEX,KAAA,CAAiB,EAAE,SAAA,EAAA,MAAkC;AACzD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AM;AAAA,QACN,QAAQ;AAAA,MACT,CAAA;AAAA,IACI,CAAA;AAAA,EAEX;AAGA,QAAM,IACJ,EAAO,EAAK,GAAM,cAAc,CAAC,KAAK,EAAO,EAAW,GAAe,eAAe,CAAC;AACzF,MAAI,CAAC,EAAc,QAAO;AAE1B,QAAM,IAAS,EAAS,EAAW,GAAe,QAAQ,CAAC,GACrD,IAAO,EAAO,EAAK,GAAM,aAAa,CAAC,KAAK,EAAO,EAAK,GAAM,MAAM,CAAC,GACrE,IACJ,EAAe,EAAc,GAAM,MAAM,CAAC,KAC1C,EAAe;AAAA,IACb,KAAK;AAAA,IACL,eAAe,EAAc;AAAA,IAC7B,MAAM,EAAc;AAAA,EACtB,CAAC,GACG,IAAW,EAAO,MAAM,QAAQ;AAEtC,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,QACE,MAAW,UAAa,MAAW,IAC/B,EAAe,GAAQ,EAAgB,KAAK,IAC5C;AAAA,IAEN,YAAY,EAAO;AAAA,IACnB,eAAe,EAAO;AAAA,IACtB,YAAY,EAAO;AAAA,IACnB,SAAS,EAAO;AAAA,IAChB,aAAa,EAAO;AAAA,IACpB,SAAS,EAAO,WAAW,SAAY;AAAA,IACvC,WAAW,EAAO;AAAA,IAClB,KAAK,EAAO;AAAA,IACZ,MAAM,IAAO,gBAAA,EAAC,GAAD;AAAA,MAAoB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAW,CAAA,IAAI;AAAA,IAC5D,iBAAiB,EAAO,MAAM;AAAA,IAC9B,YAAY,EAAO,MAAM;AAAA,IACzB,YAAY,EAAO,MAAM;AAAA,IACf,UAAA;AAAA,IACV,MAAM;AAAA,IACN,aAAa,EAAO;AAAA,IACpB,UAAU;AAAA,EACX,CAAA;AAEL"}
1
+ {"version":3,"file":"MerchantBlock.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport { slot, type InsightsPayload, type LogoRef } from '../../../../core'\nimport type { MerchantBlockData } from '../../../../core/types/InsightsInstanceSlotData'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../../core/utils/NumberFormatting'\n\nimport LogoClusterCard from '../../../components/LogoClusterCard'\nimport LogoFromGuid, { isLogoGuid } from '../../../components/LogoFromGuid'\nimport MerchantHighlightCard from '../../../components/MerchantHighlightCard'\nimport P2PLogoStack, { type CascadeOffsets } from '../../../components/P2PLogoStack'\nimport StatusPill from '../../../components/StatusPill'\nimport { resolveVariantConfig } from '../../resolveVariantConfig'\nimport { asLogoRef, asNumber, asText, slotOrFlat } from '../../slotReaders'\n\nimport { MERCHANT_LAYOUT, merchantBlockVariant } from './layout'\n\ninterface MerchantBlockProps {\n payload: InsightsPayload\n}\n\nconst LOGO_SIZE = 64\nconst LOGO_OVERLAP = 6\nconst RANKED_LOGO_SIZE = 72\nconst RANKED_MAX = 3\n// The ranked row's room above the first tile for its badge overhang; the variant's drops start below it.\nconst RANKED_TOP = 10\n// Drops for a ranked variant that sets no `cascade.offsets` for its tile count.\nconst RANKED_DROPS = [0, 10, 25] as const\n// The tile counts `cascade.offsets` can name.\nconst hasCascadeOffsets = (count: number): count is keyof CascadeOffsets =>\n count === 2 || count === 3 || count === 4\nconst FALLBACK_ICON_SIZE = 32\n\n/** A logo ref naming a known logo guid, else undefined, so an unusable one falls through. */\nconst asMerchantLogo = (value: unknown): LogoRef | undefined => {\n const ref = asLogoRef(value)\n return ref?.guid && isLogoGuid(ref.guid) ? ref : undefined\n}\n\nconst uniqueLogos = (refs: unknown): LogoRef[] => {\n if (!Array.isArray(refs)) return []\n const byGuid = new Map<string, LogoRef>()\n for (const ref of refs.map(asMerchantLogo)) {\n if (ref?.guid && !byGuid.has(ref.guid)) byGuid.set(ref.guid, ref)\n }\n return [...byGuid.values()]\n}\n\nconst storefront = (\n <Icon\n aria-hidden={true}\n data-icon=\"storefront\"\n name=\"storefront\"\n size={FALLBACK_ICON_SIZE}\n sx={{ color: 'text.secondary' }}\n />\n)\n\nconst logoTiles = (refs: LogoRef[], size: number) =>\n refs.length\n ? refs.map((ref) => <LogoFromGuid key={ref.guid} logo={ref} size={size} />)\n : [storefront]\n\nconst MerchantBlock = ({ payload }: MerchantBlockProps) => {\n const { instance_slot } = payload\n const { data } = instance_slot\n const config = resolveVariantConfig(\n MERCHANT_LAYOUT,\n instance_slot.variant,\n merchantBlockVariant.SingleStandard,\n 'MerchantBlock',\n )\n const statusText = asText(slotOrFlat(instance_slot, 'status_text'))\n const statusPill =\n config.status && statusText ? (\n <StatusPill\n icon={\n <Icon\n aria-hidden={true}\n data-icon=\"check_circle\"\n fill={true}\n name=\"check_circle\"\n size={16}\n sx={{ color: 'success.700' }}\n />\n }\n label={statusText}\n sx={\n config.kind === 'single' ? undefined : { alignSelf: 'stretch', justifyContent: 'center' }\n }\n />\n ) : undefined\n\n if (config.kind !== 'single') {\n const logos = uniqueLogos(slot<MerchantBlockData['logos']>(data, 'logos'))\n\n if (config.kind === 'ranked' && logos.length) {\n const ranked = logos.slice(0, RANKED_MAX)\n const drops =\n (hasCascadeOffsets(ranked.length) && config.cascade?.offsets?.[ranked.length]) ||\n RANKED_DROPS\n\n return (\n <LogoClusterCard\n background={config.background}\n fullBleed={true}\n logos={logoTiles(ranked, RANKED_LOGO_SIZE)}\n overlap={config.cascade?.overlap ?? LOGO_OVERLAP}\n rankOffsets={drops.map((drop) => RANKED_TOP + drop)}\n ranked={true}\n />\n )\n }\n\n const cascadeSize = config.logo?.size ?? LOGO_SIZE\n\n return (\n <Stack\n sx={{\n background: config.background,\n bgcolor: config.background ? undefined : config.bgcolor,\n p: 16,\n width: '100%',\n }}\n >\n <P2PLogoStack\n borderColor={config.logo?.borderColor ?? null}\n logos={logoTiles(logos, cascadeSize)}\n offsets={config.cascade?.offsets}\n overlap={config.cascade?.overlap ?? LOGO_OVERLAP}\n shadow=\"elevation\"\n size={cascadeSize}\n status={statusPill}\n />\n </Stack>\n )\n }\n\n // ditto's slot names first.\n const merchantName =\n asText(slot(data, 'primary_text')) || asText(slotOrFlat(instance_slot, 'merchant_name'))\n if (!merchantName) return null\n\n const amount = asNumber(slotOrFlat(instance_slot, 'amount'))\n const date = asText(slot(data, 'header_text')) || asText(slot(data, 'date'))\n const logo =\n asMerchantLogo(slot<unknown>(data, 'logo')) ??\n asMerchantLogo({\n alt: merchantName,\n fallback_guid: instance_slot.category_guid,\n guid: instance_slot.merchant_guid,\n })\n const logoSize = config.logo?.size ?? LOGO_SIZE\n\n return (\n <MerchantHighlightCard\n amount={\n amount !== undefined && amount !== 0\n ? formatCurrency(amount, CURRENCY_FORMAT.cents)\n : undefined\n }\n amountPill={config.amountPill}\n amountVariant={config.amountVariant}\n background={config.background}\n bgcolor={config.bgcolor}\n borderColor={config.borderColor}\n eyebrow={config.hideDate ? undefined : date}\n fullBleed={config.fullBleed}\n gap={config.gap}\n logo={logo ? <LogoFromGuid logo={logo} size={logoSize} /> : storefront}\n logoBorderColor={config.logo?.borderColor}\n logoRadius={config.logo?.radius}\n logoShadow={config.logo?.shadow}\n logoSize={logoSize}\n name={merchantName}\n nameVariant={config.nameVariant}\n trailing={statusPill}\n />\n )\n}\n\nexport default MerchantBlock\n"],"mappings":";;;;;;;;;;;;;AAsBA,IAAM,IAAY,IACZ,IAAe,GACf,IAAmB,IACnB,IAAa,GAEb,IAAa,IAEb,IAAe;AAAA,EAAC;AAAA,EAAG;AAAA,EAAI;AAAE,GAEzB,IAAA,CAAqB,MACzB,MAAU,KAAK,MAAU,KAAK,MAAU,GACpC,IAAqB,IAGrB,IAAA,CAAkB,MAAwC;AAC9D,QAAM,IAAM,EAAU,CAAK;AAC3B,SAAO,GAAK,QAAQ,EAAW,EAAI,IAAI,IAAI,IAAM;AACnD,GAEM,IAAA,CAAe,MAA6B;AAChD,MAAI,CAAC,MAAM,QAAQ,CAAI,EAAG,QAAO,CAAC;AAClC,QAAM,IAAS,oBAAI,IAAqB;A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IACE,QACE,MAAW,UAAa,MAAW,IAC/B,EAAe,GAAQ,EAAgB,KAAK,IAC5C;AAAA,IAEN,YAAY,EAAO;AAAA,IACnB,eAAe,EAAO;AAAA,IACtB,YAAY,EAAO;AAAA,IACnB,SAAS,EAAO;AAAA,IAChB,aAAa,EAAO;AAAA,IACpB,SAAS,EAAO,WAAW,SAAY;AAAA,IACvC,WAAW,EAAO;AAAA,IAClB,KAAK,EAAO;AAAA,IACZ,MAAM,IAAO,gBAAA,EAAC,GAAD;AAAA,MAAoB,MAAA;AAAA,MAAM,MAAM;AAAA,IAAW,CAAA,IAAI;AAAA,IAC5D,iBAAiB,EAAO,MAAM;AAAA,IAC9B,YAAY,EAAO,MAAM;AAAA,IACzB,YAAY,EAAO,MAAM;AAAA,IACf,UAAA;AAAA,IACV,MAAM;AAAA,IACN,aAAa,EAAO;AAAA,IACpB,UAAU;AAAA,EACX,CAAA;AAEL"}
@@ -34,7 +34,7 @@ export interface MerchantBlockLayoutConfig {
34
34
  borderColor?: string;
35
35
  radius?: number;
36
36
  };
37
- /** Cascade only: px the tiles overlap, and each tile's drop from the top of the row per tile count. */
37
+ /** Cascade and ranked: px the tiles overlap, and each tile's drop from the top of the row per tile count. */
38
38
  cascade?: {
39
39
  overlap?: number;
40
40
  offsets?: CascadeOffsets;
@@ -1,5 +1,5 @@
1
- import { WARM_LIME_ACCENT_GRADIENT as r, celebrateGradient as e } from "../../../components/celebrationGradients.es.js";
2
- var s = {
1
+ import { WARM_LIME_ACCENT_GRADIENT as r, celebrateGradient as i } from "../../../components/celebrationGradients.es.js";
2
+ var t = {
3
3
  Highlight: "highlight",
4
4
  SingleStandard: "single_standard",
5
5
  SingleSuccess: "single_success",
@@ -11,7 +11,7 @@ var s = {
11
11
  }, l = { bgcolor: "secondary.lighter" }, a = {
12
12
  background: r,
13
13
  status: !0
14
- }, i = {
14
+ }, e = {
15
15
  kind: "single",
16
16
  amountVariant: "pill",
17
17
  fullBleed: !0,
@@ -30,23 +30,23 @@ var s = {
30
30
  borderColor: "warning.light"
31
31
  },
32
32
  single_standard: {
33
- ...i,
33
+ ...e,
34
34
  ...l
35
35
  },
36
36
  single_success: {
37
- ...i,
37
+ ...e,
38
38
  ...a
39
39
  },
40
40
  single_subscription: {
41
- ...i,
41
+ ...e,
42
42
  amountPill: {
43
43
  px: 10,
44
44
  fontWeight: 400
45
45
  },
46
- background: e(232.03),
46
+ background: i(232.03),
47
47
  gap: 12,
48
48
  logo: {
49
- ...i.logo,
49
+ ...e.logo,
50
50
  size: 64
51
51
  },
52
52
  nameVariant: "h3"
@@ -61,7 +61,7 @@ var s = {
61
61
  },
62
62
  multiple_subscription: {
63
63
  kind: "cascade",
64
- background: e(200.73),
64
+ background: i(200.73),
65
65
  cascade: {
66
66
  overlap: 8,
67
67
  offsets: {
@@ -86,12 +86,23 @@ var s = {
86
86
  },
87
87
  multiple_badged: {
88
88
  kind: "ranked",
89
- background: e(242.46)
89
+ background: i(242.46),
90
+ cascade: {
91
+ overlap: 8,
92
+ offsets: {
93
+ 2: [0, 34],
94
+ 3: [
95
+ 0,
96
+ 17,
97
+ 34
98
+ ]
99
+ }
100
+ }
90
101
  }
91
102
  };
92
103
  export {
93
104
  n as MERCHANT_LAYOUT,
94
- s as merchantBlockVariant
105
+ t as merchantBlockVariant
95
106
  };
96
107
 
97
108
  //# sourceMappingURL=layout.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.ts"],"sourcesContent":["import type { CascadeOffsets } from '../../../components/P2PLogoStack'\nimport {\n celebrateGradient,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\nimport type { AmountPillProps } from '../../../components/AmountPill'\n\n/** ditto declares only `highlight` today. */\nexport const merchantBlockVariant = {\n Highlight: 'highlight',\n SingleStandard: 'single_standard',\n SingleSuccess: 'single_success',\n SingleSubscription: 'single_subscription',\n MultipleStandard: 'multiple_standard',\n MultipleSuccess: 'multiple_success',\n MultipleSubscription: 'multiple_subscription',\n MultipleBadged: 'multiple_badged',\n} as const\n\nexport type MerchantBlockVariant = (typeof merchantBlockVariant)[keyof typeof merchantBlockVariant]\n\nexport interface MerchantBlockLayoutConfig {\n /** Merchant card, logo cascade, or ranked logos. */\n kind: 'single' | 'cascade' | 'ranked'\n amountVariant?: 'pill' | 'text'\n /** The amount pill's horizontal padding and text weight. */\n amountPill?: Pick<AmountPillProps, 'px' | 'fontWeight'>\n /** Gap between the logo and the text column. */\n gap?: number\n /** The merchant name's type; the card defaults to h2 beside a pill. */\n nameVariant?: 'h2' | 'h3'\n /** A wash; replaces `bgcolor`. */\n background?: string\n bgcolor?: string\n borderColor?: string\n fullBleed?: boolean\n hideDate?: boolean\n logo?: { size?: number; shadow?: 'offset' | 'elevation'; borderColor?: string; radius?: number }\n /** Cascade only: px the tiles overlap, and each tile's drop from the top of the row per tile count. */\n cascade?: { overlap?: number; offsets?: CascadeOffsets }\n /** Draw `status_text` in a success pill. */\n status?: boolean\n}\n\nconst STANDARD = { bgcolor: 'secondary.lighter' }\nconst SUCCESS = { background: WARM_LIME_ACCENT_GRADIENT, status: true }\n\n// Figma 14633:139111\nconst SINGLE: MerchantBlockLayoutConfig = {\n kind: 'single',\n amountVariant: 'pill',\n fullBleed: true,\n hideDate: true,\n logo: { size: 72, shadow: 'elevation', borderColor: 'divider', radius: 8 },\n}\n\nexport const MERCHANT_LAYOUT: Record<MerchantBlockVariant, MerchantBlockLayoutConfig> = {\n highlight: {\n kind: 'single',\n amountVariant: 'text',\n bgcolor: 'warning.lighter',\n borderColor: 'warning.light',\n },\n single_standard: { ...SINGLE, ...STANDARD },\n single_success: { ...SINGLE, ...SUCCESS },\n // Figma 1268:54330 (Single): 64 logo, 12 gap, h3 name, pill 2/10 at 400.\n single_subscription: {\n ...SINGLE,\n amountPill: { px: 10, fontWeight: 400 },\n background: celebrateGradient(232.03),\n gap: 12,\n logo: { ...SINGLE.logo, size: 64 },\n nameVariant: 'h3',\n },\n multiple_standard: { kind: 'cascade', ...STANDARD },\n multiple_success: { kind: 'cascade', ...SUCCESS },\n // Figma 1268:54330 `Logos`: 72px tiles with a divider border, 64px apart, top/centre/bottom of 106px.\n // The 2- and 4-tile staircases (not drawn in Figma) keep the shared shape over the same 34px drop.\n multiple_subscription: {\n kind: 'cascade',\n background: celebrateGradient(200.73),\n cascade: { overlap: 8, offsets: { 2: [0, 34], 3: [0, 17, 34], 4: [0, 11, 23, 34] } },\n logo: { size: 72, borderColor: 'divider' },\n },\n multiple_badged: { kind: 'ranked', background: celebrateGradient(242.46) },\n}\n"],"mappings":";AAQA,IAAa,IAAuB;AAAA,EAClC,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,gBAAgB;AAClB,GA2BM,IAAW,EAAE,SAAS,oBAAoB,GAC1C,IAAU;AAAA,EAAE,YAAY;AAAA,EAA2B,QAAQ;AAAK,GAGhE,IAAoC;AAAA,EACxC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AAAA,IAAE,MAAM;AAAA,IAAI,QAAQ;AAAA,IAAa,aAAa;AAAA,IAAW,QAAQ;AAAA,EAAE;AAC3E,GAEa,IAA2E;AAAA,EACtF,WAAW;AAAA,IACT,MAAM;AAAA,IACN,eAAe;AAAA,IACf,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EACA,iBAAiB;AAAA,IAAE,GAAG;AAAA,IAAQ,GAAG;AAAA,EAAS;AAAA,EAC1C,gBAAgB;AAAA,IAAE,GAAG;AAAA,IAAQ,GAAG;AAAA,EAAQ;AAAA,EAExC,qBAAqB;AAAA,IACnB,GAAG;AAAA,IACH,YAAY;AAAA,MAAE,IAAI;AAAA,MAAI,YAAY;AAAA,IAAI;AAAA,IACtC,YAAY,EAAkB,MAAM;AAAA,IACpC,KAAK;AAAA,IACL,MAAM;AAAA,MAAE,GAAG,EAAO;AAAA,MAAM,MAAM;AAAA,IAAG;AAAA,IACjC,aAAa;AAAA,EACf;AAAA,EACA,mBAAmB;AAAA,IAAE,MAAM;AAAA,IAAW,GAAG;AAAA,EAAS;AAAA,EAClD,kBAAkB;AAAA,IAAE,MAAM;AAAA,IAAW,GAAG;AAAA,EAAQ;AAAA,EAGhD,uBAAuB;AAAA,IACrB,MAAM;AAAA,IACN,YAAY,EAAkB,MAAM;AAAA,IACpC,SAAS;AAAA,MAAE,SAAS;AAAA,MAAG,SAAS;AAAA,QAAE,GAAG,CAAC,GAAG,EAAE;AAAA,QAAG,GAAG;AAAA,UAAC;AAAA,UAAG;AAAA,UAAI;AAAA,QAAE;AAAA,QAAG,GAAG;AAAA,UAAC;AAAA,UAAG;AAAA,UAAI;AAAA,UAAI;AAAA,QAAE;AAAA,MAAE;AAAA,IAAE;AAAA,IACnF,MAAM;AAAA,MAAE,MAAM;AAAA,MAAI,aAAa;AAAA,IAAU;AAAA,EAC3C;AAAA,EACA,iBAAiB;AAAA,IAAE,MAAM;AAAA,IAAU,YAAY,EAAkB,MAAM;AAAA,EAAE;AAC3E"}
1
+ {"version":3,"file":"layout.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.ts"],"sourcesContent":["import type { CascadeOffsets } from '../../../components/P2PLogoStack'\nimport {\n celebrateGradient,\n WARM_LIME_ACCENT_GRADIENT,\n} from '../../../components/celebrationGradients'\nimport type { AmountPillProps } from '../../../components/AmountPill'\n\n/** ditto declares only `highlight` today. */\nexport const merchantBlockVariant = {\n Highlight: 'highlight',\n SingleStandard: 'single_standard',\n SingleSuccess: 'single_success',\n SingleSubscription: 'single_subscription',\n MultipleStandard: 'multiple_standard',\n MultipleSuccess: 'multiple_success',\n MultipleSubscription: 'multiple_subscription',\n MultipleBadged: 'multiple_badged',\n} as const\n\nexport type MerchantBlockVariant = (typeof merchantBlockVariant)[keyof typeof merchantBlockVariant]\n\nexport interface MerchantBlockLayoutConfig {\n /** Merchant card, logo cascade, or ranked logos. */\n kind: 'single' | 'cascade' | 'ranked'\n amountVariant?: 'pill' | 'text'\n /** The amount pill's horizontal padding and text weight. */\n amountPill?: Pick<AmountPillProps, 'px' | 'fontWeight'>\n /** Gap between the logo and the text column. */\n gap?: number\n /** The merchant name's type; the card defaults to h2 beside a pill. */\n nameVariant?: 'h2' | 'h3'\n /** A wash; replaces `bgcolor`. */\n background?: string\n bgcolor?: string\n borderColor?: string\n fullBleed?: boolean\n hideDate?: boolean\n logo?: { size?: number; shadow?: 'offset' | 'elevation'; borderColor?: string; radius?: number }\n /** Cascade and ranked: px the tiles overlap, and each tile's drop from the top of the row per tile count. */\n cascade?: { overlap?: number; offsets?: CascadeOffsets }\n /** Draw `status_text` in a success pill. */\n status?: boolean\n}\n\nconst STANDARD = { bgcolor: 'secondary.lighter' }\nconst SUCCESS = { background: WARM_LIME_ACCENT_GRADIENT, status: true }\n\n// Figma 14633:139111\nconst SINGLE: MerchantBlockLayoutConfig = {\n kind: 'single',\n amountVariant: 'pill',\n fullBleed: true,\n hideDate: true,\n logo: { size: 72, shadow: 'elevation', borderColor: 'divider', radius: 8 },\n}\n\nexport const MERCHANT_LAYOUT: Record<MerchantBlockVariant, MerchantBlockLayoutConfig> = {\n highlight: {\n kind: 'single',\n amountVariant: 'text',\n bgcolor: 'warning.lighter',\n borderColor: 'warning.light',\n },\n single_standard: { ...SINGLE, ...STANDARD },\n single_success: { ...SINGLE, ...SUCCESS },\n // Figma 1268:54330 (Single): 64 logo, 12 gap, h3 name, pill 2/10 at 400.\n single_subscription: {\n ...SINGLE,\n amountPill: { px: 10, fontWeight: 400 },\n background: celebrateGradient(232.03),\n gap: 12,\n logo: { ...SINGLE.logo, size: 64 },\n nameVariant: 'h3',\n },\n multiple_standard: { kind: 'cascade', ...STANDARD },\n multiple_success: { kind: 'cascade', ...SUCCESS },\n // Figma 1268:54330 `Logos`: 72px tiles with a divider border, 64px apart, top/centre/bottom of 106px.\n // The 2- and 4-tile staircases (not drawn in Figma) keep the shared shape over the same 34px drop.\n multiple_subscription: {\n kind: 'cascade',\n background: celebrateGradient(200.73),\n cascade: { overlap: 8, offsets: { 2: [0, 34], 3: [0, 17, 34], 4: [0, 11, 23, 34] } },\n logo: { size: 72, borderColor: 'divider' },\n },\n // Figma 587:129812 `Logos` (Monthly Top Merchant Spending): 72px badged tiles overlapping 8px, top/centre/bottom\n // of 106px. Two tiles (not drawn in Figma) keep the same 34px drop, as multiple_subscription does.\n multiple_badged: {\n kind: 'ranked',\n background: celebrateGradient(242.46),\n cascade: { overlap: 8, offsets: { 2: [0, 34], 3: [0, 17, 34] } },\n },\n}\n"],"mappings":";AAQA,IAAa,IAAuB;AAAA,EAClC,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,eAAe;AAAA,EACf,oBAAoB;AAAA,EACpB,kBAAkB;AAAA,EAClB,iBAAiB;AAAA,EACjB,sBAAsB;AAAA,EACtB,gBAAgB;AAClB,GA2BM,IAAW,EAAE,SAAS,oBAAoB,GAC1C,IAAU;AAAA,EAAE,YAAY;AAAA,EAA2B,QAAQ;AAAK,GAGhE,IAAoC;AAAA,EACxC,MAAM;AAAA,EACN,eAAe;AAAA,EACf,WAAW;AAAA,EACX,UAAU;AAAA,EACV,MAAM;AAAA,IAAE,MAAM;AAAA,IAAI,QAAQ;AAAA,IAAa,aAAa;AAAA,IAAW,QAAQ;AAAA,EAAE;AAC3E,GAEa,IAA2E;AAAA,EACtF,WAAW;AAAA,IACT,MAAM;AAAA,IACN,eAAe;AAAA,IACf,SAAS;AAAA,IACT,aAAa;AAAA,EACf;AAAA,EACA,iBAAiB;AAAA,IAAE,GAAG;AAAA,IAAQ,GAAG;AAAA,EAAS;AAAA,EAC1C,gBAAgB;AAAA,IAAE,GAAG;AAAA,IAAQ,GAAG;AAAA,EAAQ;AAAA,EAExC,qBAAqB;AAAA,IACnB,GAAG;AAAA,IACH,YAAY;AAAA,MAAE,IAAI;AAAA,MAAI,YAAY;AAAA,IAAI;AAAA,IACtC,YAAY,EAAkB,MAAM;AAAA,IACpC,KAAK;AAAA,IACL,MAAM;AAAA,MAAE,GAAG,EAAO;AAAA,MAAM,MAAM;AAAA,IAAG;AAAA,IACjC,aAAa;AAAA,EACf;AAAA,EACA,mBAAmB;AAAA,IAAE,MAAM;AAAA,IAAW,GAAG;AAAA,EAAS;AAAA,EAClD,kBAAkB;AAAA,IAAE,MAAM;AAAA,IAAW,GAAG;AAAA,EAAQ;AAAA,EAGhD,uBAAuB;AAAA,IACrB,MAAM;AAAA,IACN,YAAY,EAAkB,MAAM;AAAA,IACpC,SAAS;AAAA,MAAE,SAAS;AAAA,MAAG,SAAS;AAAA,QAAE,GAAG,CAAC,GAAG,EAAE;AAAA,QAAG,GAAG;AAAA,UAAC;AAAA,UAAG;AAAA,UAAI;AAAA,QAAE;AAAA,QAAG,GAAG;AAAA,UAAC;AAAA,UAAG;AAAA,UAAI;AAAA,UAAI;AAAA,QAAE;AAAA,MAAE;AAAA,IAAE;AAAA,IACnF,MAAM;AAAA,MAAE,MAAM;AAAA,MAAI,aAAa;AAAA,IAAU;AAAA,EAC3C;AAAA,EAGA,iBAAiB;AAAA,IACf,MAAM;AAAA,IACN,YAAY,EAAkB,MAAM;AAAA,IACpC,SAAS;AAAA,MAAE,SAAS;AAAA,MAAG,SAAS;AAAA,QAAE,GAAG,CAAC,GAAG,EAAE;AAAA,QAAG,GAAG;AAAA,UAAC;AAAA,UAAG;AAAA,UAAI;AAAA,QAAE;AAAA,MAAE;AAAA,IAAE;AAAA,EACjE;AACF"}
@@ -2,11 +2,11 @@ import { buildDynamicCopy as L, buildPluralCopy as y } from "../../../../core/ut
2
2
  import { useGlobalCopyStore as B, useInsightsV2Store as M, useTransactionStore as D } from "../../../../common/context/hooks.es.js";
3
3
  import { QUIZ_CONTEXT as c, QUIZ_VARIANTS as O, isTopMerchant as K, merchantKey as S, quizMerchantLogo as q, rankQuizMerchants as Q, readQuizMerchants as W } from "./quiz.es.js";
4
4
  import { actionBlocksKey as F } from "../../../mappings/actionBlocksKey.es.js";
5
- import Z from "../../../components/LogoFromGuid.es.js";
6
- import { ConfettiOverlay as N } from "../../../components/shared/ConfettiOverlay.es.js";
7
- import U from "../../../components/LogoTile.es.js";
8
- import { LinedCardZeroState as V } from "../../../../insights/components/shared/ZeroState/LinedCardZeroState.es.js";
9
- import { SMALL_CARD_SHADOW as j } from "../../../components/shared/elevation.es.js";
5
+ import { SMALL_CARD_SHADOW as Z } from "../../../components/shared/elevation.es.js";
6
+ import N from "../../../components/LogoFromGuid.es.js";
7
+ import { ConfettiOverlay as U } from "../../../components/shared/ConfettiOverlay.es.js";
8
+ import V from "../../../components/LogoTile.es.js";
9
+ import { LinedCardZeroState as j } from "../../../../insights/components/shared/ZeroState/LinedCardZeroState.es.js";
10
10
  import { useEffect as E, useState as H } from "react";
11
11
  import { observer as A } from "mobx-react-lite";
12
12
  import a from "@mui/material/Stack";
@@ -33,7 +33,7 @@ var X = 3e3, z = 32, T = {
33
33
  ...q(o, e),
34
34
  alt: ""
35
35
  };
36
- return /* @__PURE__ */ r(U, {
36
+ return /* @__PURE__ */ r(V, {
37
37
  borderColor: null,
38
38
  borderRadius: 4,
39
39
  size: z,
@@ -41,7 +41,7 @@ var X = 3e3, z = 32, T = {
41
41
  position: "relative",
42
42
  textAlign: "left"
43
43
  },
44
- children: /* @__PURE__ */ r(Z, {
44
+ children: /* @__PURE__ */ r(N, {
45
45
  logo: t,
46
46
  size: z
47
47
  })
@@ -53,7 +53,7 @@ var X = 3e3, z = 32, T = {
53
53
  backdropFilter: o ? void 0 : "blur(6px)",
54
54
  bgcolor: (t) => o ? "success.main" : _(t.palette.common.black, 0.5),
55
55
  borderRadius: "8px",
56
- boxShadow: o ? j : void 0,
56
+ boxShadow: o ? Z : void 0,
57
57
  color: o ? "success.contrastText" : "common.white",
58
58
  gap: 18,
59
59
  inset: 16,
@@ -130,7 +130,7 @@ var X = 3e3, z = 32, T = {
130
130
  s
131
131
  ]), E(() => {
132
132
  t || console.warn("quiz_block: copy namespace missing; rendering without its labels");
133
- }, [t]), !m.length) return /* @__PURE__ */ r(V, {});
133
+ }, [t]), !m.length) return /* @__PURE__ */ r(j, {});
134
134
  if (k) {
135
135
  const n = (i) => f({
136
136
  guid: o,
@@ -161,7 +161,7 @@ var X = 3e3, z = 32, T = {
161
161
  position: "relative"
162
162
  },
163
163
  children: [
164
- s && C && /* @__PURE__ */ r(N, {}),
164
+ s && C && /* @__PURE__ */ r(U, {}),
165
165
  s && /* @__PURE__ */ r(J, {
166
166
  copy: t,
167
167
  correct: C
@@ -15,7 +15,7 @@ var T = (o) => `Rank ${o}`, p = [
15
15
  ], L = 122, i = {
16
16
  x: 10,
17
17
  y: 8
18
- }, N = { "& .MuiBadge-badge": {
18
+ }, H = { "& .MuiBadge-badge": {
19
19
  bgcolor: "common.black",
20
20
  border: "1px solid",
21
21
  borderColor: "common.white",
@@ -23,13 +23,14 @@ var T = (o) => `Rank ${o}`, p = [
23
23
  boxShadow: (o) => E(o),
24
24
  color: "common.white",
25
25
  fontSize: (o) => o.typography.body2.fontSize,
26
- fontWeight: (o) => o.typography.fontWeightRegular,
26
+ fontWeight: (o) => o.typography.fontWeightBold,
27
+ lineHeight: "16px",
27
28
  height: 24,
28
29
  minWidth: 24,
29
30
  padding: 0,
30
31
  transform: `translate(-${i.x}px, -${i.y}px)`
31
- } }, O = ({ background: o, footer: s, fullBleed: a = !1, logoSize: n = 72, logos: b, overlap: h, ranked: e = !1, rankLabel: v = T, rankOffsets: c = I, stagger: g = !0, sx: f }) => {
32
- const w = g ? (p.length - 1) * C : 0, R = e ? L : n + w, S = e ? a ? 24 : 16 : 32, l = e && h !== void 0;
32
+ } }, K = ({ background: o, footer: s, fullBleed: a = !1, logoSize: n = 72, logos: b, overlap: h, ranked: e = !1, rankLabel: v = T, rankOffsets: c = I, stagger: g = !0, sx: f }) => {
33
+ const w = g ? (p.length - 1) * C : 0, S = e ? L : n + w, R = e ? a ? 24 : 16 : 32, l = e && h !== void 0;
33
34
  return /* @__PURE__ */ t(d, {
34
35
  sx: {
35
36
  pt: a ? 0 : 8,
@@ -53,8 +54,8 @@ var T = (o) => `Rank ${o}`, p = [
53
54
  flexDirection: "row",
54
55
  justifyContent: l ? "center" : "space-between",
55
56
  isolation: l ? "isolate" : void 0,
56
- height: R,
57
- px: S,
57
+ height: S,
58
+ px: R,
58
59
  width: "100%"
59
60
  },
60
61
  children: b.map((u, r) => {
@@ -88,7 +89,7 @@ var T = (o) => `Rank ${o}`, p = [
88
89
  children: r + 1
89
90
  }),
90
91
  overlap: "rectangular",
91
- sx: N,
92
+ sx: H,
92
93
  children: x
93
94
  }) : x
94
95
  }, r);
@@ -104,7 +105,7 @@ var T = (o) => `Rank ${o}`, p = [
104
105
  });
105
106
  };
106
107
  export {
107
- O as default
108
+ K as default
108
109
  };
109
110
 
110
111
  //# sourceMappingURL=LogoClusterCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogoClusterCard.es.js","names":[],"sources":["../../../src/insights-v2/components/LogoClusterCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Badge from '@mui/material/Badge'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport LogoTile from './LogoTile'\nimport { getLogoElevation } from './logoShadow'\n\ninterface LogoClusterCardProps {\n /** Brand/merchant logo visuals, rendered as a row of tiles. */\n logos: ReactNode[]\n /** Tile size in px. */\n logoSize?: number\n /** Card surface color/background token or CSS background string. */\n background?: string\n /**\n * Stagger the tiles diagonally (Figma cycles each tile's vertical alignment\n * top -> center -> bottom). When false, all tiles are vertically centered.\n * Default true.\n */\n stagger?: boolean\n /**\n * Overlay a 1-based rank badge on the top-left of each tile (Figma: Monthly\n * Top Merchant Spending V3). Default false.\n */\n ranked?: boolean\n /**\n * Accessible label for each rank badge, given the 1-based rank. Lets the\n * consumer pass localized copy (e.g. from the copy store) and control word\n * order. Defaults to `Rank {n}` — callers in a localized context must supply a\n * copy-store-derived function, or they will ship the English default.\n */\n rankLabel?: (rank: number) => string\n /** Ranked tile top offsets, cycled. */\n rankOffsets?: readonly number[]\n /** Ranked tiles overlap by this many px, centred. */\n overlap?: number\n /** Edge to edge: no inset, square corners. */\n fullBleed?: boolean\n /**\n * Optional element rendered below the logo row (e.g. a `<StatusPill>`).\n * Figma: a status stacked beneath the logos on the slot.\n */\n footer?: ReactNode\n sx?: SxProps\n}\n\n// Default accessible label for a rank badge. Hoisted to a stable reference so\n// it isn't re-created each render (consumers override via the `rankLabel` prop,\n// e.g. with localized copy).\nconst defaultRankLabel = (rank: number) => `Rank ${rank}`\n\n// Non-ranked (MSA V2): tiles cascade via counter-axis alignment in a 112 zone\n// (tops 0/20/40).\nconst STAGGER_ALIGN = ['flex-start', 'center', 'flex-end'] as const\nconst STAGGER_STEP = 20\n// Ranked (Top Merchant V3): exact Figma logo top-offsets within the 122 `Logos`\n// content zone (logo2 bottom leaves ~7px). Not a uniform step, so use the\n// measured values rather than alignSelf.\nconst RANK_TILE_OFFSETS = [10, 25, 43] as const\nconst RANK_ROW_HEIGHT = 122\n// Figma: the rank badge overhangs the logo's top-left by 10px left / 8px up.\n// The row reserves the left overhang once (so the first badge stays inside the\n// card edge); the badge itself is offset by it via the MUI transform below.\nconst RANK_BADGE_OVERHANG = { x: 10, y: 8 } as const\n\n// Figma rank badge on MUI `Badge`: a 24px pure-black disc, 1px white border,\n// white `body2` number, soft elevation shadow. MUI centers the badge on the\n// logo's corner (`translate(-50%,-50%)`); override the transform so its top-left\n// lands exactly 10px left / 8px above the logo (Figma's overhang).\nconst rankBadgeSx: SxProps<Theme> = {\n '& .MuiBadge-badge': {\n // Intentional: `common.black`/`common.white` are mode-INDEPENDENT in\n // createMXTheme (unlike `text.primary`/`primary.contrastText`, which flip\n // per theme). A white-on-black disc plus the white border below keeps the\n // badge legible in BOTH light and dark mode — this is the dark-mode FIX, not\n // a bug. Do not \"theme-aware\"-ify these colors; it would break the Figma\n // look in light mode for no gain (the number sits on the always-black disc,\n // never on the surface).\n bgcolor: 'common.black',\n border: '1px solid',\n borderColor: 'common.white',\n borderRadius: '999px',\n boxShadow: (theme: Theme) => getLogoElevation(theme),\n color: 'common.white',\n // Figma number is `typography/body2` (13px / regular), not MUI's badge\n // default (12px / medium).\n fontSize: (theme: Theme) => theme.typography.body2.fontSize,\n fontWeight: (theme: Theme) => theme.typography.fontWeightRegular,\n height: 24,\n minWidth: 24,\n padding: 0,\n transform: `translate(-${RANK_BADGE_OVERHANG.x}px, -${RANK_BADGE_OVERHANG.y}px)`,\n },\n}\n\n/**\n * A row of rounded brand/logo tiles on a card surface, diagonally staggered\n * (top -> center -> bottom). Figma: Monthly Subscription Aggregate V2.\n */\nconst LogoClusterCard = ({\n background,\n footer,\n fullBleed = false,\n logoSize = 72,\n logos,\n overlap,\n ranked = false,\n rankLabel = defaultRankLabel,\n rankOffsets = RANK_TILE_OFFSETS,\n stagger = true,\n sx,\n}: LogoClusterCardProps) => {\n // Non-ranked cascades via alignSelf in a `logoSize + span` zone. Ranked uses\n // the exact Figma offsets in the 122 zone (its cascade isn't a uniform step).\n const staggerSpan = stagger ? (STAGGER_ALIGN.length - 1) * STAGGER_STEP : 0\n const rowHeight = ranked ? RANK_ROW_HEIGHT : logoSize + staggerSpan\n // Figma `Logos` frame side padding: 32 for MSA V2, 16 for the ranked cluster.\n const rowPaddingX = ranked ? (fullBleed ? 24 : 16) : 32\n const overlapping = ranked && overlap !== undefined\n\n return (\n <Stack sx={{ pt: fullBleed ? 0 : 8, px: fullBleed ? 0 : 16, width: '100%', ...sx }}>\n <Stack\n sx={{\n alignItems: 'center',\n background: background ?? undefined,\n bgcolor: background ? undefined : 'background.paper',\n borderRadius: fullBleed ? 0 : '8px',\n gap: 12,\n // Card (Figma `Wrapper`) has no horizontal padding of its own — the\n // logo row carries its side padding (`rowPaddingX`); only vertical.\n py: 16,\n width: '100%',\n }}\n >\n <Stack\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n // Both variants use Figma's SPACE_BETWEEN (fills the row). Ranked\n // items reserve the badge overhang (below), so this yields Figma's\n // 26/18 side insets and ~14px visible gaps; MSA yields ~3px gaps.\n justifyContent: overlapping ? 'center' : 'space-between',\n isolation: overlapping ? 'isolate' : undefined,\n height: rowHeight,\n px: rowPaddingX,\n width: '100%',\n }}\n >\n {logos.map((logo, index) => {\n const tile = (\n <LogoTile borderColor=\"divider\" shadow=\"elevation\" size={logoSize}>\n {logo}\n </LogoTile>\n )\n // Ranked: offset each tile to its exact Figma top and size the item\n // to Figma's badge-inclusive box (72 logo + 10 left overhang + 2\n // right = 84), with the logo pushed right by the overhang. Then\n // SPACE_BETWEEN reproduces the 26/18 side insets and 14px gaps.\n // Non-ranked: cascade via alignSelf in the stagger zone.\n const positionSx = ranked\n ? {\n boxSizing: 'border-box' as const,\n mt: rankOffsets[index % rankOffsets.length],\n pl: RANK_BADGE_OVERHANG.x,\n width: logoSize + RANK_BADGE_OVERHANG.x + 2,\n ...(overlapping && {\n ml: index ? `${-(RANK_BADGE_OVERHANG.x + 2 + overlap)}px` : 0,\n position: 'relative' as const,\n zIndex: index + 1,\n }),\n }\n : { alignSelf: stagger ? STAGGER_ALIGN[index % STAGGER_ALIGN.length] : 'center' }\n\n return (\n // Index key is fine: the caller-supplied list is static.\n <Box\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n sx={positionSx}\n >\n {ranked ? (\n <Badge\n anchorOrigin={{ horizontal: 'left', vertical: 'top' }}\n aria-label={rankLabel(index + 1)}\n // `role=\"img\"` gives the root span a role that supports an\n // accessible name, so aria-label is surfaced to AT (a bare\n // generic span's aria-label is not announced).\n role=\"img\"\n // Hide the visible number from AT so the badge is announced\n // once via aria-label (\"Rank 1\"), not twice (\"Rank 1 … 1\").\n badgeContent={<span aria-hidden={true}>{index + 1}</span>}\n overlap=\"rectangular\"\n sx={rankBadgeSx}\n >\n {tile}\n </Badge>\n ) : (\n tile\n )}\n </Box>\n )\n })}\n </Stack>\n {footer && <Box sx={{ px: 16, width: '100%' }}>{footer}</Box>}\n </Stack>\n </Stack>\n )\n}\n\nexport default LogoClusterCard\n"],"mappings":";;;;;;AAoDA,IAAM,IAAA,CAAoB,MAAiB,QAAQ,CAAA,IAI7C,IAAgB;AAAA,EAAC;AAAA,EAAc;AAAA,EAAU;AAAU,GACnD,IAAe,IAIf,IAAoB;AAAA,EAAC;AAAA,EAAI;AAAA,EAAI;AAAE,GAC/B,IAAkB,KAIlB,IAAsB;AAAA,EAAE,GAAG;AAAA,EAAI,GAAG;AAAE,GAMpC,IAA8B,EAClC,qBAAqB;AAAA,EAQnB,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,cAAc;AAAA,EACd,WAAA,CAAY,MAAiB,EAAiB,CAAK;AAAA,EACnD,OAAO;AAAA,EAGP,UAAA,CAAW,MAAiB,EAAM,WAAW,MAAM;AAAA,EACnD,YAAA,CAAa,MAAiB,EAAM,WAAW;AAAA,EAC/C,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,SAAS;AAAA,EACT,WAAW,cAAc,EAAoB,CAAA,QAAS,EAAoB,CAAA;AAC5E,EACF,GAMM,IAAA,CAAmB,EACvB,YAAA,GACA,QAAA,GACA,WAAA,IAAY,IACZ,UAAA,IAAW,IACX,OAAA,GACA,SAAA,GACA,QAAA,IAAS,IACT,WAAA,IAAY,GACZ,aAAA,IAAc,GACd,SAAA,IAAU,IACV,IAAA,EAAA,MAC0B;AAG1B,QAAM,IAAc,KAAW,EAAc,SAAS,KAAK,IAAe,GACpE,IAAY,IAAS,IAAkB,IAAW,GAElD,IAAc,IAAU,IAAY,KAAK,KAAM,IAC/C,IAAc,KAAU,MAAY;AAE1C,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,IAAI,IAAY,IAAI;AAAA,MA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EAAU,IAAQ,CAAC;AAAA,cAI/B,MAAK;AAAA,cAGL,cAAc,gBAAA,EAAC,QAAD;AAAA,gBAAM,eAAa;AAAA,gBAAO,UAAA,IAAQ;AAAA,cAAQ,CAAA;AAAA,cACxD,SAAQ;AAAA,cACR,IAAI;AAAA,cAEH,UAAA;AAAA,YACI,CAAA,IAEP;AAAA,UAEC,GAtBE,CAsBF;AAAA,QAET,CAAC;AAAA,MACI,CAAA,GACN,KAAU,gBAAA,EAAC,GAAD;AAAA,QAAK,IAAI;AAAA,UAAE,IAAI;AAAA,UAAI,OAAO;AAAA,QAAO;AAAA,QAAI,UAAA;AAAA,MAAY,CAAA,CACvD;AAAA;EACF,CAAA;AAEX"}
1
+ {"version":3,"file":"LogoClusterCard.es.js","names":[],"sources":["../../../src/insights-v2/components/LogoClusterCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Badge from '@mui/material/Badge'\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport LogoTile from './LogoTile'\nimport { getLogoElevation } from './logoShadow'\n\ninterface LogoClusterCardProps {\n /** Brand/merchant logo visuals, rendered as a row of tiles. */\n logos: ReactNode[]\n /** Tile size in px. */\n logoSize?: number\n /** Card surface color/background token or CSS background string. */\n background?: string\n /**\n * Stagger the tiles diagonally (Figma cycles each tile's vertical alignment\n * top -> center -> bottom). When false, all tiles are vertically centered.\n * Default true.\n */\n stagger?: boolean\n /**\n * Overlay a 1-based rank badge on the top-left of each tile (Figma: Monthly\n * Top Merchant Spending V3). Default false.\n */\n ranked?: boolean\n /**\n * Accessible label for each rank badge, given the 1-based rank. Lets the\n * consumer pass localized copy (e.g. from the copy store) and control word\n * order. Defaults to `Rank {n}` — callers in a localized context must supply a\n * copy-store-derived function, or they will ship the English default.\n */\n rankLabel?: (rank: number) => string\n /** Ranked tile top offsets, cycled. */\n rankOffsets?: readonly number[]\n /** Ranked tiles overlap by this many px, centred. */\n overlap?: number\n /** Edge to edge: no inset, square corners. */\n fullBleed?: boolean\n /**\n * Optional element rendered below the logo row (e.g. a `<StatusPill>`).\n * Figma: a status stacked beneath the logos on the slot.\n */\n footer?: ReactNode\n sx?: SxProps\n}\n\n// Default accessible label for a rank badge. Hoisted to a stable reference so\n// it isn't re-created each render (consumers override via the `rankLabel` prop,\n// e.g. with localized copy).\nconst defaultRankLabel = (rank: number) => `Rank ${rank}`\n\n// Non-ranked (MSA V2): tiles cascade via counter-axis alignment in a 112 zone\n// (tops 0/20/40).\nconst STAGGER_ALIGN = ['flex-start', 'center', 'flex-end'] as const\nconst STAGGER_STEP = 20\n// Ranked (Top Merchant V3): exact Figma logo top-offsets within the 122 `Logos`\n// content zone (logo2 bottom leaves ~7px). Not a uniform step, so use the\n// measured values rather than alignSelf.\nconst RANK_TILE_OFFSETS = [10, 25, 43] as const\nconst RANK_ROW_HEIGHT = 122\n// Figma: the rank badge overhangs the logo's top-left by 10px left / 8px up.\n// The row reserves the left overhang once (so the first badge stays inside the\n// card edge); the badge itself is offset by it via the MUI transform below.\nconst RANK_BADGE_OVERHANG = { x: 10, y: 8 } as const\n\n// Figma rank badge on MUI `Badge`: a 24px pure-black disc, 1px white border,\n// white bold 13/16 number, soft elevation shadow. MUI centers the badge on the\n// logo's corner (`translate(-50%,-50%)`); override the transform so its top-left\n// lands exactly 10px left / 8px above the logo (Figma's overhang).\nconst rankBadgeSx: SxProps<Theme> = {\n '& .MuiBadge-badge': {\n // Intentional: `common.black`/`common.white` are mode-INDEPENDENT in\n // createMXTheme (unlike `text.primary`/`primary.contrastText`, which flip\n // per theme). A white-on-black disc plus the white border below keeps the\n // badge legible in BOTH light and dark mode — this is the dark-mode FIX, not\n // a bug. Do not \"theme-aware\"-ify these colors; it would break the Figma\n // look in light mode for no gain (the number sits on the always-black disc,\n // never on the surface).\n bgcolor: 'common.black',\n border: '1px solid',\n borderColor: 'common.white',\n borderRadius: '999px',\n boxShadow: (theme: Theme) => getLogoElevation(theme),\n color: 'common.white',\n // Figma 587:129812: the number is Inter Bold 13/16, not MUI's badge\n // default (12px / medium).\n fontSize: (theme: Theme) => theme.typography.body2.fontSize,\n fontWeight: (theme: Theme) => theme.typography.fontWeightBold,\n lineHeight: '16px',\n height: 24,\n minWidth: 24,\n padding: 0,\n transform: `translate(-${RANK_BADGE_OVERHANG.x}px, -${RANK_BADGE_OVERHANG.y}px)`,\n },\n}\n\n/**\n * A row of rounded brand/logo tiles on a card surface, diagonally staggered\n * (top -> center -> bottom). Figma: Monthly Subscription Aggregate V2.\n */\nconst LogoClusterCard = ({\n background,\n footer,\n fullBleed = false,\n logoSize = 72,\n logos,\n overlap,\n ranked = false,\n rankLabel = defaultRankLabel,\n rankOffsets = RANK_TILE_OFFSETS,\n stagger = true,\n sx,\n}: LogoClusterCardProps) => {\n // Non-ranked cascades via alignSelf in a `logoSize + span` zone. Ranked uses\n // the exact Figma offsets in the 122 zone (its cascade isn't a uniform step).\n const staggerSpan = stagger ? (STAGGER_ALIGN.length - 1) * STAGGER_STEP : 0\n const rowHeight = ranked ? RANK_ROW_HEIGHT : logoSize + staggerSpan\n // Figma `Logos` frame side padding: 32 for MSA V2, 16 for the ranked cluster.\n const rowPaddingX = ranked ? (fullBleed ? 24 : 16) : 32\n const overlapping = ranked && overlap !== undefined\n\n return (\n <Stack sx={{ pt: fullBleed ? 0 : 8, px: fullBleed ? 0 : 16, width: '100%', ...sx }}>\n <Stack\n sx={{\n alignItems: 'center',\n background: background ?? undefined,\n bgcolor: background ? undefined : 'background.paper',\n borderRadius: fullBleed ? 0 : '8px',\n gap: 12,\n // Card (Figma `Wrapper`) has no horizontal padding of its own — the\n // logo row carries its side padding (`rowPaddingX`); only vertical.\n py: 16,\n width: '100%',\n }}\n >\n <Stack\n sx={{\n alignItems: 'flex-start',\n flexDirection: 'row',\n // Both variants use Figma's SPACE_BETWEEN (fills the row). Ranked\n // items reserve the badge overhang (below), so this yields Figma's\n // 26/18 side insets and ~14px visible gaps; MSA yields ~3px gaps.\n justifyContent: overlapping ? 'center' : 'space-between',\n isolation: overlapping ? 'isolate' : undefined,\n height: rowHeight,\n px: rowPaddingX,\n width: '100%',\n }}\n >\n {logos.map((logo, index) => {\n const tile = (\n <LogoTile borderColor=\"divider\" shadow=\"elevation\" size={logoSize}>\n {logo}\n </LogoTile>\n )\n // Ranked: offset each tile to its exact Figma top and size the item\n // to Figma's badge-inclusive box (72 logo + 10 left overhang + 2\n // right = 84), with the logo pushed right by the overhang. Then\n // SPACE_BETWEEN reproduces the 26/18 side insets and 14px gaps.\n // Non-ranked: cascade via alignSelf in the stagger zone.\n const positionSx = ranked\n ? {\n boxSizing: 'border-box' as const,\n mt: rankOffsets[index % rankOffsets.length],\n pl: RANK_BADGE_OVERHANG.x,\n width: logoSize + RANK_BADGE_OVERHANG.x + 2,\n ...(overlapping && {\n ml: index ? `${-(RANK_BADGE_OVERHANG.x + 2 + overlap)}px` : 0,\n position: 'relative' as const,\n zIndex: index + 1,\n }),\n }\n : { alignSelf: stagger ? STAGGER_ALIGN[index % STAGGER_ALIGN.length] : 'center' }\n\n return (\n // Index key is fine: the caller-supplied list is static.\n <Box\n // eslint-disable-next-line react/no-array-index-key\n key={index}\n sx={positionSx}\n >\n {ranked ? (\n <Badge\n anchorOrigin={{ horizontal: 'left', vertical: 'top' }}\n aria-label={rankLabel(index + 1)}\n // `role=\"img\"` gives the root span a role that supports an\n // accessible name, so aria-label is surfaced to AT (a bare\n // generic span's aria-label is not announced).\n role=\"img\"\n // Hide the visible number from AT so the badge is announced\n // once via aria-label (\"Rank 1\"), not twice (\"Rank 1 … 1\").\n badgeContent={<span aria-hidden={true}>{index + 1}</span>}\n overlap=\"rectangular\"\n sx={rankBadgeSx}\n >\n {tile}\n </Badge>\n ) : (\n tile\n )}\n </Box>\n )\n })}\n </Stack>\n {footer && <Box sx={{ px: 16, width: '100%' }}>{footer}</Box>}\n </Stack>\n </Stack>\n )\n}\n\nexport default LogoClusterCard\n"],"mappings":";;;;;;A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AAAA,cAEH,UAAA;AAAA,YACI,CAAA,IAEP;AAAA,UAEC,GAtBE,CAsBF;AAAA,QAET,CAAC;AAAA,MACI,CAAA,GACN,KAAU,gBAAA,EAAC,GAAD;AAAA,QAAK,IAAI;AAAA,UAAE,IAAI;AAAA,UAAI,OAAO;AAAA,QAAO;AAAA,QAAI,UAAA;AAAA,MAAY,CAAA,CACvD;AAAA;EACF,CAAA;AAEX"}
@@ -1,5 +1,5 @@
1
- import I from "./InsightTransactionRow.es.js";
2
- import { ELEVATION_SHADOW as S } from "./shared/elevation.es.js";
1
+ import { ELEVATION_SHADOW as I } from "./shared/elevation.es.js";
2
+ import S from "./InsightTransactionRow.es.js";
3
3
  import { Fragment as L } from "react";
4
4
  import d from "@mui/material/Stack";
5
5
  import { Text as m } from "@mxenabled/mxui";
@@ -69,7 +69,7 @@ var j = (n) => n === "primary" ? {
69
69
  sx: { width: "100%" },
70
70
  children: x.map((p, b) => /* @__PURE__ */ i(L, { children: [b > 0 && /* @__PURE__ */ r(u, { role: "presentation" }), /* @__PURE__ */ r(B, {
71
71
  role: "listitem",
72
- children: /* @__PURE__ */ r(I, { ...p })
72
+ children: /* @__PURE__ */ r(S, { ...p })
73
73
  })] }, b))
74
74
  });
75
75
  return /* @__PURE__ */ i(d, {
@@ -110,7 +110,7 @@ var j = (n) => n === "primary" ? {
110
110
  bgcolor: "background.paper",
111
111
  ...y && {
112
112
  backgroundImage: (p) => p.vars?.overlays?.[1] ?? "none",
113
- boxShadow: S[1]
113
+ boxShadow: I[1]
114
114
  },
115
115
  ...v && {
116
116
  border: "1px solid",
@@ -1,2 +1,10 @@
1
1
  import { BarChartV2Props } from '../../../insights/types/Charts/BarChart';
2
- export declare const BarChartV2: ({ amounts, color, data, heightOverride, margin, onBarClick, legendPosition, monthlyAmountLabel, removeSelectedTabColorChange, selectedTabIndex, showMonthlyAmount, trendAmountLabel, unselectedOpacity, }: BarChartV2Props) => import("react/jsx-runtime").JSX.Element;
2
+ type BarChartProps = BarChartV2Props & {
3
+ /**
4
+ * Each bar is a focusable button (Enter / Space call `onBarClick`), for a chart that is the only way
5
+ * to pick a bar, e.g. a drawer without month tabs. Absent: bars are mouse-only.
6
+ */
7
+ keyboardSelectable?: boolean;
8
+ };
9
+ export declare const BarChartV2: ({ amounts, color, data, heightOverride, keyboardSelectable, margin, onBarClick, legendPosition, monthlyAmountLabel, removeSelectedTabColorChange, selectedTabIndex, showMonthlyAmount, trendAmountLabel, unselectedOpacity, }: BarChartProps) => import("react/jsx-runtime").JSX.Element;
10
+ export {};