@mx-cartographer/experiences 9.7.198 → 9.7.199-alpha-moratorium

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 (83) hide show
  1. package/CHANGELOG.md +7 -1
  2. package/dist/core/types/Insights.d.ts +1 -1
  3. package/dist/core/types/Insights.es.js.map +1 -1
  4. package/dist/core/types/localization/InsightsFeedCopy.d.ts +2 -0
  5. package/dist/insights/components/insights/BillAmountNotStandard/BillAmountNotStandard.es.js +4 -4
  6. package/dist/insights/components/insights/BillAmountNotStandard/BillAmountNotStandardMUI.es.js +4 -4
  7. package/dist/insights/components/insights/MonthlySpendingComparisonV2/MonthlySpendingComparisonV2.es.js +4 -4
  8. package/dist/insights/components/insights/WeeklyNoSpendDays/WeeklyNoSpendDays.es.js +8 -8
  9. package/dist/insights/components/shared/Charts/EmptyBarChart.es.js +4 -4
  10. package/dist/insights/components/shared/ZeroState/LinedCardZeroState.es.js +4 -4
  11. package/dist/insights/index.es.js +84 -84
  12. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.es.js +17 -17
  13. package/dist/insights-v2/actionBlocks/EmergencySavingsBlock/EmergencySavingsV2.es.js.map +1 -1
  14. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.d.ts +1 -5
  15. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js +37 -36
  16. package/dist/insights-v2/actionBlocks/TopMerchantsBlock/TopMerchantsBlock.es.js.map +1 -1
  17. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.d.ts +9 -11
  18. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js +12 -6
  19. package/dist/insights-v2/actionBlocks/TransactionDetailsBlock/layout.es.js.map +1 -1
  20. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.d.ts +3 -1
  21. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js +12 -11
  22. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListHeaderIconTile.es.js.map +1 -1
  23. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.d.ts +2 -2
  24. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js +13 -13
  25. package/dist/insights-v2/actionBlocks/TransactionListBlock/TransactionListSummaryCard.es.js.map +1 -1
  26. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.d.ts +10 -4
  27. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js +78 -71
  28. package/dist/insights-v2/actionBlocks/TransactionListBlock/layout.es.js.map +1 -1
  29. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.d.ts +2 -4
  30. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.es.js +78 -82
  31. package/dist/insights-v2/blocks/ChartBlocks/StepChartBlock/variants/MilestoneProgress.es.js.map +1 -1
  32. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +30 -24
  33. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  34. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.d.ts +7 -0
  35. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.es.js +46 -0
  36. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/CompactDirectDepositBlock.es.js.map +1 -0
  37. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/index.d.ts +3 -0
  38. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.d.ts +10 -0
  39. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.es.js +17 -0
  40. package/dist/insights-v2/blocks/ComponentBlocks/CompactDirectDepositBlock/layout.es.js.map +1 -0
  41. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js +25 -25
  42. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/DetailedAccountBlock.es.js.map +1 -1
  43. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.d.ts +0 -2
  44. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js +17 -21
  45. package/dist/insights-v2/blocks/ComponentBlocks/DetailedAccountBlock/layout.es.js.map +1 -1
  46. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js +46 -63
  47. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/MerchantBlock.es.js.map +1 -1
  48. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.d.ts +3 -3
  49. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js +44 -53
  50. package/dist/insights-v2/blocks/ComponentBlocks/MerchantBlock/layout.es.js.map +1 -1
  51. package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.d.ts +1 -1
  52. package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js +30 -31
  53. package/dist/insights-v2/blocks/ComponentBlocks/QuizBlock/QuizBlock.es.js.map +1 -1
  54. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +54 -53
  55. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  56. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +5 -3
  57. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +11 -9
  58. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
  59. package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js +28 -27
  60. package/dist/insights-v2/blocks/ComponentBlocks/WeeklySmallPurchasesBlock/WeeklySmallPurchasesBlock.es.js.map +1 -1
  61. package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -0
  62. package/dist/insights-v2/components/AccountHeroCard.d.ts +3 -1
  63. package/dist/insights-v2/components/AccountHeroCard.es.js.map +1 -1
  64. package/dist/insights-v2/components/CompactDirectDepositCard.d.ts +26 -0
  65. package/dist/insights-v2/components/CompactDirectDepositCard.es.js +73 -0
  66. package/dist/insights-v2/components/CompactDirectDepositCard.es.js.map +1 -0
  67. package/dist/insights-v2/components/DirectDepositCard.d.ts +6 -1
  68. package/dist/insights-v2/components/DirectDepositCard.es.js +22 -20
  69. package/dist/insights-v2/components/DirectDepositCard.es.js.map +1 -1
  70. package/dist/insights-v2/components/LogoFromGuid.d.ts +1 -1
  71. package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
  72. package/dist/insights-v2/components/MerchantHighlightCard.es.js +4 -4
  73. package/dist/insights-v2/components/TransactionListCard.d.ts +3 -1
  74. package/dist/insights-v2/components/TransactionListCard.es.js +25 -25
  75. package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
  76. package/dist/insights-v2/components/TransferLogoCard.es.js +1 -0
  77. package/dist/insights-v2/components/TransferLogoCard.es.js.map +1 -1
  78. package/dist/insights-v2/index.es.js +120 -116
  79. package/dist/insights-v2/mappings/blocks.es.js +118 -116
  80. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  81. package/dist/microinsights/cards/InsightCard.es.js +53 -53
  82. package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
  83. package/package.json +1 -1
@@ -1,45 +1,45 @@
1
1
  import { GlobalDataContext as Z } from "../../common/context/GlobalDataProvider.es.js";
2
- import { slot as y } from "../../core/types/Insights.es.js";
2
+ import { slot as T } from "../../core/types/Insights.es.js";
3
3
  import { resolveInsightRender as b } from "../../insights-v2/resolveInsightRender.es.js";
4
- import { asLogoRef as F } from "../../insights-v2/blocks/slotReaders.es.js";
4
+ import { asLogoRef as L } from "../../insights-v2/blocks/slotReaders.es.js";
5
5
  import { hasDrawerBlock as ii } from "../../insights-v2/mappings/hasDrawerBlock.es.js";
6
6
  import ti, { isLogoGuid as ei } from "../../insights-v2/components/LogoFromGuid.es.js";
7
7
  import { statusIconAccentColor as oi, statusIconName as k, statusIconPalette as ri } from "../../insights-v2/components/statusIcon.es.js";
8
8
  import { ON_CLICK_EVENT as S, ON_VIEW_EVENT as ni, ON_VIEW_FIRST_TIME_EVENT as si } from "../constants/Analytics.es.js";
9
- import D from "../beaticons/BeatMaterialIcon.es.js";
9
+ import q from "../beaticons/BeatMaterialIcon.es.js";
10
10
  import { BeatIcon as ci } from "../beaticons/BeatIcon.es.js";
11
- import { useCopyStore as li, useEvent as mi, useInsightsMicroWidgetStore as ai } from "../context/hooks.es.js";
12
- import { microCardMinWidth as _i } from "../utils/cardWidth.es.js";
13
- import q from "../MicroCardTemplate.es.js";
14
- import pi from "./InlineActionBlock.es.js";
15
- import { MicroCtaStatusGate as di } from "./MicroCtaStatus.es.js";
11
+ import { useCopyStore as mi, useEvent as li, useInsightsMicroWidgetStore as ai } from "../context/hooks.es.js";
12
+ import { microCardMinWidth as pi } from "../utils/cardWidth.es.js";
13
+ import D from "../MicroCardTemplate.es.js";
14
+ import di from "./InlineActionBlock.es.js";
15
+ import { MicroCtaStatusGate as _i } from "./MicroCtaStatus.es.js";
16
16
  import ui from "../../insights-v2/components/InsightErrorCard.es.js";
17
17
  import gi, { useEffect as j, useState as fi } from "react";
18
18
  import { Fragment as hi, jsx as e, jsxs as Ii } from "react/jsx-runtime";
19
- import { alpha as K, useTheme as Ci } from "@mui/material/styles";
20
- import Ei from "@mui/material/Box";
21
- import { useInView as Ti } from "react-intersection-observer";
22
- var vi = "budget_block", yi = 0.25, zi = ({ ariaLabel: g, beat: i, elevation: N, inDescriptionCtaBehavior: Y = "external", index: s, isActiveCard: f, onCardClick: c, posthog: r, widthOverrides: h, variant: R, showIcon: x, heightOverrides: I }) => {
23
- const { ref: C, inView: l } = Ti({ threshold: 1 }), E = Ci(), { cardsCopy: z } = li(), { onEvent: m } = mi(), { updateBeat: H, updateOffer: $ } = ai(), a = "is_insights_v2" in i && i.is_insights_v2, _ = a ? { metadata: { is_insights_v2: !0 } } : void 0;
19
+ import { alpha as z, useTheme as Ci } from "@mui/material/styles";
20
+ import yi from "@mui/material/Box";
21
+ import { useInView as vi } from "react-intersection-observer";
22
+ var Ei = 0.25, Hi = ({ ariaLabel: g, beat: i, elevation: N, inDescriptionCtaBehavior: H = "external", index: s, isActiveCard: f, onCardClick: c, posthog: o, widthOverrides: h, variant: R, showIcon: x, heightOverrides: I }) => {
23
+ const { ref: C, inView: m } = vi({ threshold: 1 }), y = Ci(), { cardsCopy: K } = mi(), { onEvent: l } = li(), { updateBeat: Y, updateOffer: $ } = ai(), a = "is_insights_v2" in i && i.is_insights_v2, p = a ? { metadata: { is_insights_v2: !0 } } : void 0;
24
24
  j(() => {
25
- l && (i.has_been_displayed ? m(ni(i.template), _) : (i.guid.startsWith("OFR") ? $({
25
+ m && (i.has_been_displayed ? l(ni(i.template), p) : (i.guid.startsWith("OFR") ? $({
26
26
  ...i,
27
27
  has_been_displayed: !0
28
- }) : H({
28
+ }) : Y({
29
29
  ...i,
30
30
  has_been_displayed: !0
31
- }), m(si(i.template), _)));
32
- }, [l]), j(() => {
33
- if (l && i) if (i.template === "MarketingOffer") {
31
+ }), l(si(i.template), p)));
32
+ }, [m]), j(() => {
33
+ if (m && i) if (i.template === "MarketingOffer") {
34
34
  const t = i;
35
- r?.capture("viewed_messaging_insight", {
35
+ o?.capture("viewed_messaging_insight", {
36
36
  template: i.template,
37
37
  campaign_guid: t.campaign_guid,
38
38
  campaign_name: t.pulse_campaign_name,
39
39
  offer_guid: t.guid,
40
40
  user_guid: t.user_guid
41
41
  });
42
- } else r?.capture("viewed_insight", {
42
+ } else o?.capture("viewed_insight", {
43
43
  beat_guid: i.guid,
44
44
  template: i.template,
45
45
  position: s,
@@ -48,26 +48,26 @@ var vi = "budget_block", yi = 0.25, zi = ({ ariaLabel: g, beat: i, elevation: N,
48
48
  }, [
49
49
  i,
50
50
  s,
51
- l
51
+ m
52
52
  ]);
53
- const B = b(i), o = B === "v2" ? i.insights_payload : void 0, J = gi.useContext(Z) !== null, V = Y === "internal" && J && ii(o?.in_description_cta?.block), [M, Q] = fi(0), p = () => {
54
- if (V ? Q((t) => t + 1) : c && c(i), m(S(i.template), _), i.template === "MarketingOffer") {
53
+ const V = b(i), r = V === "v2" ? i.insights_payload : void 0, J = gi.useContext(Z) !== null, B = H === "internal" && J && ii(r?.in_description_cta?.block), [M, Q] = fi(0), d = () => {
54
+ if (B ? Q((t) => t + 1) : c && c(i), l(S(i.template), p), i.template === "MarketingOffer") {
55
55
  const t = i;
56
- r?.capture("clicked_messaging_insight", {
56
+ o?.capture("clicked_messaging_insight", {
57
57
  template: i.template,
58
58
  campaign_guid: t.campaign_guid,
59
59
  campaign_name: t.pulse_campaign_name,
60
60
  offer_guid: t.guid,
61
61
  user_guid: t.user_guid
62
62
  });
63
- } else r?.capture("clicked_insight", {
63
+ } else o?.capture("clicked_insight", {
64
64
  beat_guid: i.guid,
65
65
  template: i.template,
66
66
  position: s,
67
67
  ...a && { is_insights_v2: !0 }
68
68
  });
69
69
  };
70
- return B === "error" ? /* @__PURE__ */ e(Ei, {
70
+ return V === "error" ? /* @__PURE__ */ e(yi, {
71
71
  "aria-hidden": !f,
72
72
  "aria-label": g,
73
73
  "aria-roledescription": "slide",
@@ -75,57 +75,57 @@ var vi = "budget_block", yi = 0.25, zi = ({ ariaLabel: g, beat: i, elevation: N,
75
75
  role: "group",
76
76
  sx: {
77
77
  height: I ? "100%" : 120,
78
- minWidth: _i(h),
78
+ minWidth: pi(h),
79
79
  my: 1
80
80
  },
81
81
  children: /* @__PURE__ */ e(ui, { beat: i })
82
- }) : o ? /* @__PURE__ */ e(di, {
82
+ }) : r ? /* @__PURE__ */ e(_i, {
83
83
  beat: i,
84
- posthog: r,
84
+ posthog: o,
85
85
  children: ({ presentation: n }) => {
86
- const O = n?.kind === "status" ? n : void 0, { data: T } = o.instance_slot, d = F(y(T, "logo")), A = [O ? y(T, "reviewed_icon") : void 0, y(T, "icon")].map(F).find((X) => k(X?.guid)), v = k(d?.guid), G = v ? d?.color || "primary.main" : A?.color, L = v ?? k(A?.guid), w = ri(G), u = oi(E.palette, G), U = n ? O?.action?.label : o.primary_cta?.label || o.in_description_cta?.label || void 0, P = () => {
87
- c && c(i), m(S(i.template), _), r?.capture("clicked_insight", {
86
+ const w = n?.kind === "status" ? n : void 0, { data: v } = r.instance_slot, _ = L(T(v, "logo")), A = [w ? T(v, "reviewed_icon") : void 0, T(v, "icon")].map(L).find((X) => k(X?.guid)), E = k(_?.guid), G = E ? _?.color || "primary.main" : A?.color, O = E ?? k(A?.guid), P = ri(G), u = oi(y.palette, G), U = n ? w?.action?.label : r.primary_cta?.label || r.in_description_cta?.label || void 0, W = () => {
87
+ c && c(i), l(S(i.template), p), o?.capture("clicked_insight", {
88
88
  beat_guid: i.guid,
89
89
  template: i.template,
90
90
  position: s,
91
91
  ...a && { is_insights_v2: !0 }
92
92
  });
93
- }, W = /* @__PURE__ */ e(q, {
93
+ }, F = /* @__PURE__ */ e(D, {
94
94
  "aria-roledescription": "slide",
95
95
  ariaLabel: g,
96
- description: o.description.html_text,
96
+ description: r.description.html_text,
97
97
  elevation: N,
98
98
  heightOverrides: I,
99
- icon: x && (ei(d?.guid) && !v ? /* @__PURE__ */ e(ti, {
100
- categoryTint: o.instance_slot.block === vi ? yi : void 0,
101
- logo: d,
99
+ icon: x && (ei(_?.guid) && !E ? /* @__PURE__ */ e(ti, {
100
+ categoryTint: Ei,
101
+ logo: _,
102
102
  size: 32
103
- }) : L ? /* @__PURE__ */ e(D, {
104
- bgColor: K(u ?? E.palette[w].main, 0.15),
105
- iconColor: u ? "inherit" : w,
106
- name: L,
103
+ }) : O ? /* @__PURE__ */ e(q, {
104
+ bgColor: z(u ?? y.palette[P].main, 0.15),
105
+ iconColor: u ? "inherit" : P,
106
+ name: O,
107
107
  sx: u ? { color: u } : void 0
108
- }) : /* @__PURE__ */ e(D, {
109
- bgColor: K(E.palette.primary.main, 0.15),
108
+ }) : /* @__PURE__ */ e(q, {
109
+ bgColor: z(y.palette.primary.main, 0.15),
110
110
  name: "lightbulb"
111
111
  })),
112
112
  isActiveCard: f,
113
113
  isInsightsV2: !0,
114
- onCardClick: n ? P : p,
115
- onPrimaryAction: n ? P : p,
114
+ onCardClick: n ? W : d,
115
+ onPrimaryAction: n ? W : d,
116
116
  primaryActionText: U,
117
117
  ref: C,
118
- title: n?.title || o.title || "",
118
+ title: n?.title || r.title || "",
119
119
  variant: R,
120
120
  widthOverrides: h
121
121
  });
122
- return V ? /* @__PURE__ */ Ii(hi, { children: [W, M > 0 && /* @__PURE__ */ e(pi, {
122
+ return B ? /* @__PURE__ */ Ii(hi, { children: [F, M > 0 && /* @__PURE__ */ e(di, {
123
123
  beat: i,
124
124
  openRequest: M,
125
- posthog: r
126
- })] }) : W;
125
+ posthog: o
126
+ })] }) : F;
127
127
  }
128
- }) : /* @__PURE__ */ e(q, {
128
+ }) : /* @__PURE__ */ e(D, {
129
129
  "aria-roledescription": "slide",
130
130
  ariaLabel: g,
131
131
  description: i?.html_micro_description && i?.html_micro_description.length > 0 ? i.html_micro_description : i.html_description || "",
@@ -133,9 +133,9 @@ var vi = "budget_block", yi = 0.25, zi = ({ ariaLabel: g, beat: i, elevation: N,
133
133
  heightOverrides: I,
134
134
  icon: x && /* @__PURE__ */ e(ci, { beat: i }),
135
135
  isActiveCard: f,
136
- onCardClick: p,
137
- onPrimaryAction: p,
138
- primaryActionText: i.micro_call_to_action || z?.micro_card_cta,
136
+ onCardClick: d,
137
+ onPrimaryAction: d,
138
+ primaryActionText: i.micro_call_to_action || K?.micro_card_cta,
139
139
  ref: C,
140
140
  title: i.micro_title && i.micro_title.length > 0 ? i.micro_title : i.title,
141
141
  variant: R,
@@ -143,7 +143,7 @@ var vi = "budget_block", yi = 0.25, zi = ({ ariaLabel: g, beat: i, elevation: N,
143
143
  });
144
144
  };
145
145
  export {
146
- zi as InsightCard
146
+ Hi as InsightCard
147
147
  };
148
148
 
149
149
  //# sourceMappingURL=InsightCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InsightCard.es.js","names":[],"sources":["../../../src/microinsights/cards/InsightCard.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { BeatIcon } from '../beaticons'\nimport BeatMaterialIcon from '../beaticons/BeatMaterialIcon'\n\nimport { useCopyStore, useEvent, useInsightsMicroWidgetStore } from '../context/hooks'\n\nimport { ON_CLICK_EVENT, ON_VIEW_EVENT, ON_VIEW_FIRST_TIME_EVENT } from '../constants/Analytics'\nimport { ICON_SIZE, VIEW_THRESHOLD } from '../constants/App'\nimport { microCardMinWidth } from '../utils/cardWidth'\n\nimport type { BeatLikeOffer, MicroInsightCardProps } from '../interfaces'\nimport type { Beat } from '../../core/types/Beat'\n// Leaf imports, not the `core` barrel: that pulls GlobalStore and every feature store into the\n// micro bundle, and through `core/stores` it reintroduces a circular path this module avoids.\nimport { slot } from '../../core/types/Insights'\nimport MicroCardTemplate from '../MicroCardTemplate'\n// Leaf import, not the `common` barrel, which would pull the shared layer into the micro bundle.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\n// TODO: load this with `React.lazy` to keep the block registry and charts out of the micro bundle,\n// once it is verified in every host that embeds the micro widget.\nimport InlineActionBlock from './InlineActionBlock'\nimport MicroCtaStatusGate, { type MicroCtaStatus } from './MicroCtaStatus'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks` and its charts.\nimport { asLogoRef } from '../../insights-v2/blocks/slotReaders'\nimport InsightErrorCard from '../../insights-v2/components/InsightErrorCard'\nimport LogoFromGuid, { isLogoGuid } from '../../insights-v2/components/LogoFromGuid'\nimport {\n statusIconAccentColor,\n statusIconName,\n statusIconPalette,\n} from '../../insights-v2/components/statusIcon'\nimport { hasDrawerBlock } from '../../insights-v2/mappings/hasDrawerBlock'\nimport { resolveInsightRender } from '../../insights-v2/resolveInsightRender'\n\n/**\n * A `budget_block` slot's micro tile is the tinted category tile (Figma 156:35121, Micro | Category\n * Budget: the glyph on a 25% tint of the category colour, bordered in it) instead of mxui's solid tile.\n */\nconst TINTED_CATEGORY_TILE_BLOCK = 'budget_block'\nconst CATEGORY_TILE_TINT = 0.25\n\nexport interface InsightCardProps extends MicroInsightCardProps {\n beat: Beat | BeatLikeOffer\n index?: number\n}\n\nexport const InsightCard: React.FC<InsightCardProps> = ({\n ariaLabel,\n beat,\n elevation,\n inDescriptionCtaBehavior = 'external',\n index,\n isActiveCard,\n onCardClick,\n posthog,\n widthOverrides,\n variant,\n showIcon,\n heightOverrides,\n}) => {\n const { ref, inView } = useInView({\n threshold: VIEW_THRESHOLD,\n })\n\n const theme = useTheme()\n\n // *************** Context functions *********************\n const { cardsCopy } = useCopyStore()\n const { onEvent } = useEvent()\n const { updateBeat, updateOffer } = useInsightsMicroWidgetStore()\n\n const isV2 = 'is_insights_v2' in beat && beat.is_insights_v2\n const eventProps = isV2 ? { metadata: { is_insights_v2: true } } : undefined\n\n // ************** Use Effects Hooks **********************\n useEffect(() => {\n if (inView) {\n if (!beat.has_been_displayed) {\n if (beat.guid.startsWith('OFR')) {\n updateOffer({\n ...beat,\n has_been_displayed: true,\n })\n } else {\n updateBeat({\n ...beat,\n has_been_displayed: true,\n })\n }\n onEvent(ON_VIEW_FIRST_TIME_EVENT(beat.template), eventProps)\n } else {\n onEvent(ON_VIEW_EVENT(beat.template), eventProps)\n }\n }\n }, [inView])\n\n useEffect(() => {\n if (inView && beat) {\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('viewed_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('viewed_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n }, [beat, index, inView])\n\n const insightRender = resolveInsightRender(beat as Beat)\n const v2Payload = insightRender === 'v2' ? beat.insights_payload : undefined\n // Only a V2 beat whose `in_description_cta` names a drawer block opens in place; everything else\n // keeps the host's behavior. Micro sends its one action as `in_description_cta`.\n // It also needs the host's `GlobalDataProvider`; without one the tap goes to the host instead.\n const hasGlobalData = React.useContext(GlobalDataContext) !== null\n const opensInline =\n inDescriptionCtaBehavior === 'internal' &&\n hasGlobalData &&\n hasDrawerBlock(v2Payload?.in_description_cta?.block)\n\n // *************** Click handlers ************************\n // Taps that opened the beat's own action block.\n const [inlineOpenRequest, setInlineOpenRequest] = useState(0)\n\n const handleClick = () => {\n /* eslint-disable no-unused-expressions */\n // Internal opens the block here and skips the host's `onCardClick`; analytics are unchanged.\n if (opensInline) {\n setInlineOpenRequest((count) => count + 1)\n } else {\n onCardClick && onCardClick(beat)\n }\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('clicked_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n\n if (insightRender === 'error') {\n // Keeps the carousel's slot sizing; the error card does not know about it.\n return (\n <Box\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n aria-roledescription=\"slide\"\n ref={ref}\n role=\"group\"\n sx={{\n height: heightOverrides ? '100%' : 120,\n minWidth: microCardMinWidth(widthOverrides),\n my: 1,\n }}\n >\n <InsightErrorCard beat={beat} />\n </Box>\n )\n }\n\n if (v2Payload) {\n // Figma (Micro Widget | Large Transaction) is the legacy micro card's layout fed from the envelope:\n // the slot's logo on the left (merchant, or the category without one), title, description, and the\n // primary CTA as a link. The logo falls back to the insight glyph when the slot carries none.\n // ditto ≥ 1.4.3 words micro's action as in_description_cta instead of primary_cta; either way\n // the label stays the card's tap (`micro-carousel/cta`), never a drawer.\n // A block with no usable row logo may name a status icon instead (account_block `minimal`:\n // `ICO-error`), drawn in the legacy card's tinted tile (Figma Micro | Low Account Balance).\n // The status tile takes the palette the slot names (Payday's on-track check is `success.main`),\n // falling back to error. `||` on the label: the copy may send the primary label as \"\".\n // Answered (mirrors the full card): reviewed title, icon and the Undo label. Display only: the card\n // and its label tap go to the host, which opens the insight with its block; nothing runs here.\n const renderCard = ({ presentation }: MicroCtaStatus) => {\n const answered = presentation?.kind === 'status' ? presentation : undefined\n const { data } = v2Payload.instance_slot\n const rowLogo = asLogoRef(slot(data, 'logo'))\n // The reviewed icon once answered, else the icon: whichever names a status icon first.\n const statusIcon = [answered ? slot(data, 'reviewed_icon') : undefined, slot(data, 'icon')]\n .map(asLogoRef)\n .find((ref) => statusIconName(ref?.guid))\n // An `ICO-` row logo is an icon, not an entity logo: it takes the same tinted tile (Figma Micro\n // Card) and wins over the status icon, as a row logo always has. The no-colour defaults differ\n // on purpose: a row icon with none is decorative (primary), a status icon with none is an error.\n const rowIconName = statusIconName(rowLogo?.guid)\n const tileColor = rowIconName ? rowLogo?.color || 'primary.main' : statusIcon?.color\n const tileName = rowIconName ?? statusIconName(statusIcon?.guid)\n const tilePalette = statusIconPalette(tileColor)\n // A non-status icon (`primary.main`, `chart.*`) tints the tile in its own colour.\n const tileAccent = statusIconAccentColor(theme.palette, tileColor)\n const actionLabel = presentation\n ? answered?.action?.label\n : v2Payload.primary_cta?.label || v2Payload.in_description_cta?.label || undefined\n const handleHostClick = () => {\n onCardClick && onCardClick(beat)\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n\n const card = (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={v2Payload.description.html_text}\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={\n showIcon &&\n (isLogoGuid(rowLogo?.guid) && !rowIconName ? (\n <LogoFromGuid\n categoryTint={\n v2Payload.instance_slot.block === TINTED_CATEGORY_TILE_BLOCK\n ? CATEGORY_TILE_TINT\n : undefined\n }\n logo={rowLogo}\n size={ICON_SIZE}\n />\n ) : tileName ? (\n <BeatMaterialIcon\n bgColor={alpha(tileAccent ?? theme.palette[tilePalette].main, 0.15)}\n iconColor={tileAccent ? 'inherit' : tilePalette}\n name={tileName}\n sx={tileAccent ? { color: tileAccent } : undefined}\n />\n ) : (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette.primary.main, 0.15)}\n name=\"lightbulb\"\n />\n ))\n }\n isActiveCard={isActiveCard}\n isInsightsV2={true}\n onCardClick={presentation ? handleHostClick : handleClick}\n onPrimaryAction={presentation ? handleHostClick : handleClick}\n primaryActionText={actionLabel}\n ref={ref}\n title={presentation?.title || v2Payload.title || ''}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n\n if (!opensInline) return card\n\n return (\n <>\n {card}\n {/* Nothing renders until the first tap. */}\n {inlineOpenRequest > 0 && (\n <InlineActionBlock\n beat={beat as Beat}\n openRequest={inlineOpenRequest}\n posthog={posthog}\n />\n )}\n </>\n )\n }\n\n return (\n <MicroCtaStatusGate beat={beat as Beat} posthog={posthog}>\n {renderCard}\n </MicroCtaStatusGate>\n )\n }\n\n return (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={\n beat?.html_micro_description && beat?.html_micro_description.length > 0\n ? beat.html_micro_description\n : beat.html_description || ''\n }\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={showIcon && <BeatIcon beat={beat} />}\n isActiveCard={isActiveCard}\n onCardClick={handleClick}\n onPrimaryAction={handleClick}\n primaryActionText={beat.micro_call_to_action || cardsCopy?.micro_card_cta}\n ref={ref}\n title={beat.micro_title && beat.micro_title.length > 0 ? beat.micro_title : beat.title}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA2CA,IAAM,KAA6B,gBAC7B,KAAqB,MAOd,KAAA,CAA2C,EACtD,WAAA,GACA,MAAA,GACA,WAAA,GACA,0BAAA,IAA2B,YAC3B,OAAA,GACA,cAAA,GACA,aAAA,GACA,SAAA,GACA,gBAAA,GACA,SAAA,GACA,UAAA,GACA,iBAAA,EAAA,MACI;AACJ,QAAM,EAAE,KAAA,GAAK,QAAA,EAAA,IAAW,GAAU,EAChC,WAAA,EACF,CAAC,GAEK,IAAQ,GAAS,GAGjB,EAAE,WAAA,EAAA,IAAc,GAAa,GAC7B,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,YAAA,GAAY,aAAA,EAAA,IAAgB,GAA4B,GAE1D,IAAO,oBAAoB,KAAQ,EAAK,gBACxC,IAAa,IAAO,EAAE,UAAU,EAAE,gBAAgB,GAAK,EAAE,IAAI;AAGnE,EAAA,EAAA,MAAgB;AACd,IAAI,MACG,EAAK,qBAcR,EAAQ,GAAc,EAAK,QAAQ,GAAG,CAAU,KAb5C,EAAK,KAAK,WAAW,KAAK,IAC5B,EAAY;AAAA,MACV,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,IAED,EAAW;AAAA,MACT,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,GAEH,EAAQ,GAAyB,EAAK,QAAQ,GAAG,CAAU;AAAA,EAKjE,GAAG,CAAC,CAAM,CAAC,GAEX,EAAA,MAAgB;AACd,QAAI,KAAU,EACZ,KAAI,EAAK,aAAa,kBAAkB;AACtC,YAAM,IAAY;AA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AAY,gBAAA,EAAC,IAAD,EAAgB,MAAA,EAAO,CAAA;AAAA,IAC3B,cAAA;AAAA,IACd,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB,EAAK,wBAAwB,GAAW;AAAA,IACtD,KAAA;AAAA,IACL,OAAO,EAAK,eAAe,EAAK,YAAY,SAAS,IAAI,EAAK,cAAc,EAAK;AAAA,IACxE,SAAA;AAAA,IACO,gBAAA;AAAA,EACjB,CAAA;AAEL"}
1
+ {"version":3,"file":"InsightCard.es.js","names":[],"sources":["../../../src/microinsights/cards/InsightCard.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { BeatIcon } from '../beaticons'\nimport BeatMaterialIcon from '../beaticons/BeatMaterialIcon'\n\nimport { useCopyStore, useEvent, useInsightsMicroWidgetStore } from '../context/hooks'\n\nimport { ON_CLICK_EVENT, ON_VIEW_EVENT, ON_VIEW_FIRST_TIME_EVENT } from '../constants/Analytics'\nimport { ICON_SIZE, VIEW_THRESHOLD } from '../constants/App'\nimport { microCardMinWidth } from '../utils/cardWidth'\n\nimport type { BeatLikeOffer, MicroInsightCardProps } from '../interfaces'\nimport type { Beat } from '../../core/types/Beat'\n// Leaf imports, not the `core` barrel: that pulls GlobalStore and every feature store into the\n// micro bundle, and through `core/stores` it reintroduces a circular path this module avoids.\nimport { slot } from '../../core/types/Insights'\nimport MicroCardTemplate from '../MicroCardTemplate'\n// Leaf import, not the `common` barrel, which would pull the shared layer into the micro bundle.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\n// TODO: load this with `React.lazy` to keep the block registry and charts out of the micro bundle,\n// once it is verified in every host that embeds the micro widget.\nimport InlineActionBlock from './InlineActionBlock'\nimport MicroCtaStatusGate, { type MicroCtaStatus } from './MicroCtaStatus'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks` and its charts.\nimport { asLogoRef } from '../../insights-v2/blocks/slotReaders'\nimport InsightErrorCard from '../../insights-v2/components/InsightErrorCard'\nimport LogoFromGuid, { isLogoGuid } from '../../insights-v2/components/LogoFromGuid'\nimport {\n statusIconAccentColor,\n statusIconName,\n statusIconPalette,\n} from '../../insights-v2/components/statusIcon'\nimport { hasDrawerBlock } from '../../insights-v2/mappings/hasDrawerBlock'\nimport { resolveInsightRender } from '../../insights-v2/resolveInsightRender'\n\n/** A category logo's tile, whatever the block: a 25% tint, bordered in its colour (Figma Micro Card). */\nconst CATEGORY_TILE_TINT = 0.25\n\nexport interface InsightCardProps extends MicroInsightCardProps {\n beat: Beat | BeatLikeOffer\n index?: number\n}\n\nexport const InsightCard: React.FC<InsightCardProps> = ({\n ariaLabel,\n beat,\n elevation,\n inDescriptionCtaBehavior = 'external',\n index,\n isActiveCard,\n onCardClick,\n posthog,\n widthOverrides,\n variant,\n showIcon,\n heightOverrides,\n}) => {\n const { ref, inView } = useInView({\n threshold: VIEW_THRESHOLD,\n })\n\n const theme = useTheme()\n\n // *************** Context functions *********************\n const { cardsCopy } = useCopyStore()\n const { onEvent } = useEvent()\n const { updateBeat, updateOffer } = useInsightsMicroWidgetStore()\n\n const isV2 = 'is_insights_v2' in beat && beat.is_insights_v2\n const eventProps = isV2 ? { metadata: { is_insights_v2: true } } : undefined\n\n // ************** Use Effects Hooks **********************\n useEffect(() => {\n if (inView) {\n if (!beat.has_been_displayed) {\n if (beat.guid.startsWith('OFR')) {\n updateOffer({\n ...beat,\n has_been_displayed: true,\n })\n } else {\n updateBeat({\n ...beat,\n has_been_displayed: true,\n })\n }\n onEvent(ON_VIEW_FIRST_TIME_EVENT(beat.template), eventProps)\n } else {\n onEvent(ON_VIEW_EVENT(beat.template), eventProps)\n }\n }\n }, [inView])\n\n useEffect(() => {\n if (inView && beat) {\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('viewed_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('viewed_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n }, [beat, index, inView])\n\n const insightRender = resolveInsightRender(beat as Beat)\n const v2Payload = insightRender === 'v2' ? beat.insights_payload : undefined\n // Only a V2 beat whose `in_description_cta` names a drawer block opens in place; everything else\n // keeps the host's behavior. Micro sends its one action as `in_description_cta`.\n // It also needs the host's `GlobalDataProvider`; without one the tap goes to the host instead.\n const hasGlobalData = React.useContext(GlobalDataContext) !== null\n const opensInline =\n inDescriptionCtaBehavior === 'internal' &&\n hasGlobalData &&\n hasDrawerBlock(v2Payload?.in_description_cta?.block)\n\n // *************** Click handlers ************************\n // Taps that opened the beat's own action block.\n const [inlineOpenRequest, setInlineOpenRequest] = useState(0)\n\n const handleClick = () => {\n /* eslint-disable no-unused-expressions */\n // Internal opens the block here and skips the host's `onCardClick`; analytics are unchanged.\n if (opensInline) {\n setInlineOpenRequest((count) => count + 1)\n } else {\n onCardClick && onCardClick(beat)\n }\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('clicked_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n\n if (insightRender === 'error') {\n // Keeps the carousel's slot sizing; the error card does not know about it.\n return (\n <Box\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n aria-roledescription=\"slide\"\n ref={ref}\n role=\"group\"\n sx={{\n height: heightOverrides ? '100%' : 120,\n minWidth: microCardMinWidth(widthOverrides),\n my: 1,\n }}\n >\n <InsightErrorCard beat={beat} />\n </Box>\n )\n }\n\n if (v2Payload) {\n // Figma (Micro Widget | Large Transaction) is the legacy micro card's layout fed from the envelope:\n // the slot's logo on the left (merchant, or the category without one), title, description, and the\n // primary CTA as a link. The logo falls back to the insight glyph when the slot carries none.\n // ditto ≥ 1.4.3 words micro's action as in_description_cta instead of primary_cta; either way\n // the label stays the card's tap (`micro-carousel/cta`), never a drawer.\n // A block with no usable row logo may name a status icon instead (account_block `minimal`:\n // `ICO-error`), drawn in the legacy card's tinted tile (Figma Micro | Low Account Balance).\n // The status tile takes the palette the slot names (Payday's on-track check is `success.main`),\n // falling back to error. `||` on the label: the copy may send the primary label as \"\".\n // Answered (mirrors the full card): reviewed title, icon and the Undo label. Display only: the card\n // and its label tap go to the host, which opens the insight with its block; nothing runs here.\n const renderCard = ({ presentation }: MicroCtaStatus) => {\n const answered = presentation?.kind === 'status' ? presentation : undefined\n const { data } = v2Payload.instance_slot\n const rowLogo = asLogoRef(slot(data, 'logo'))\n // The reviewed icon once answered, else the icon: whichever names a status icon first.\n const statusIcon = [answered ? slot(data, 'reviewed_icon') : undefined, slot(data, 'icon')]\n .map(asLogoRef)\n .find((ref) => statusIconName(ref?.guid))\n // An `ICO-` row logo is an icon, not an entity logo: it takes the same tinted tile (Figma Micro\n // Card) and wins over the status icon, as a row logo always has. The no-colour defaults differ\n // on purpose: a row icon with none is decorative (primary), a status icon with none is an error.\n const rowIconName = statusIconName(rowLogo?.guid)\n const tileColor = rowIconName ? rowLogo?.color || 'primary.main' : statusIcon?.color\n const tileName = rowIconName ?? statusIconName(statusIcon?.guid)\n const tilePalette = statusIconPalette(tileColor)\n // A non-status icon (`primary.main`, `chart.*`) tints the tile in its own colour.\n const tileAccent = statusIconAccentColor(theme.palette, tileColor)\n const actionLabel = presentation\n ? answered?.action?.label\n : v2Payload.primary_cta?.label || v2Payload.in_description_cta?.label || undefined\n const handleHostClick = () => {\n onCardClick && onCardClick(beat)\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n\n const card = (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={v2Payload.description.html_text}\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={\n showIcon &&\n (isLogoGuid(rowLogo?.guid) && !rowIconName ? (\n <LogoFromGuid categoryTint={CATEGORY_TILE_TINT} logo={rowLogo} size={ICON_SIZE} />\n ) : tileName ? (\n <BeatMaterialIcon\n bgColor={alpha(tileAccent ?? theme.palette[tilePalette].main, 0.15)}\n iconColor={tileAccent ? 'inherit' : tilePalette}\n name={tileName}\n sx={tileAccent ? { color: tileAccent } : undefined}\n />\n ) : (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette.primary.main, 0.15)}\n name=\"lightbulb\"\n />\n ))\n }\n isActiveCard={isActiveCard}\n isInsightsV2={true}\n onCardClick={presentation ? handleHostClick : handleClick}\n onPrimaryAction={presentation ? handleHostClick : handleClick}\n primaryActionText={actionLabel}\n ref={ref}\n title={presentation?.title || v2Payload.title || ''}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n\n if (!opensInline) return card\n\n return (\n <>\n {card}\n {/* Nothing renders until the first tap. */}\n {inlineOpenRequest > 0 && (\n <InlineActionBlock\n beat={beat as Beat}\n openRequest={inlineOpenRequest}\n posthog={posthog}\n />\n )}\n </>\n )\n }\n\n return (\n <MicroCtaStatusGate beat={beat as Beat} posthog={posthog}>\n {renderCard}\n </MicroCtaStatusGate>\n )\n }\n\n return (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={\n beat?.html_micro_description && beat?.html_micro_description.length > 0\n ? beat.html_micro_description\n : beat.html_description || ''\n }\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={showIcon && <BeatIcon beat={beat} />}\n isActiveCard={isActiveCard}\n onCardClick={handleClick}\n onPrimaryAction={handleClick}\n primaryActionText={beat.micro_call_to_action || cardsCopy?.micro_card_cta}\n ref={ref}\n title={beat.micro_title && beat.micro_title.length > 0 ? beat.micro_title : beat.title}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwCA,IAAM,KAAqB,MAOd,KAAA,CAA2C,EACtD,WAAA,GACA,MAAA,GACA,WAAA,GACA,0BAAA,IAA2B,YAC3B,OAAA,GACA,cAAA,GACA,aAAA,GACA,SAAA,GACA,gBAAA,GACA,SAAA,GACA,UAAA,GACA,iBAAA,EAAA,MACI;AACJ,QAAM,EAAE,KAAA,GAAK,QAAA,EAAA,IAAW,GAAU,EAChC,WAAA,EACF,CAAC,GAEK,IAAQ,GAAS,GAGjB,EAAE,WAAA,EAAA,IAAc,GAAa,GAC7B,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,YAAA,GAAY,aAAA,EAAA,IAAgB,GAA4B,GAE1D,IAAO,oBAAoB,KAAQ,EAAK,gBACxC,IAAa,IAAO,EAAE,UAAU,EAAE,gBAAgB,GAAK,EAAE,IAAI;AAGnE,EAAA,EAAA,MAAgB;AACd,IAAI,MACG,EAAK,qBAcR,EAAQ,GAAc,EAAK,QAAQ,GAAG,CAAU,KAb5C,EAAK,KAAK,WAAW,KAAK,IAC5B,EAAY;AAAA,MACV,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,IAED,EAAW;AAAA,MACT,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,GAEH,EAAQ,GAAyB,EAAK,QAAQ,GAAG,CAAU;AAAA,EAKjE,GAAG,CAAC,CAAM,CAAC,GAEX,EAAA,MAAgB;AACd,QAAI,KAAU,EACZ,KAAI,EAAK,aAAa,kBAAkB;AACtC,YAAM,IAAY;AAClB,MAAA,GAAS,QAAQ,4BAA4B;AAAA,Q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3B,cAAA;AAAA,IACd,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB,EAAK,wBAAwB,GAAW;AAAA,IACtD,KAAA;AAAA,IACL,OAAO,EAAK,eAAe,EAAK,YAAY,SAAS,IAAI,EAAK,cAAc,EAAK;AAAA,IACxE,SAAA;AAAA,IACO,gBAAA;AAAA,EACjB,CAAA;AAEL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.198",
3
+ "version": "9.7.199-alpha-moratorium",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",