@mx-cartographer/experiences 9.7.189 → 9.7.191

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +31 -30
  3. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
  4. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +3 -1
  5. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +11 -9
  6. package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
  7. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.d.ts +5 -3
  8. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js +34 -31
  9. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js.map +1 -1
  10. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.d.ts +8 -0
  11. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.es.js +11 -0
  12. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/layout.es.js.map +1 -0
  13. package/dist/insights-v2/components/CategoryTile.es.js.map +1 -1
  14. package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.d.ts +3 -1
  15. package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.es.js +63 -51
  16. package/dist/insights-v2/components/ComponentBlocks/StatusIndicator.es.js.map +1 -1
  17. package/dist/insights-v2/components/LogoFromGuid.d.ts +3 -1
  18. package/dist/insights-v2/components/LogoFromGuid.es.js +12 -11
  19. package/dist/insights-v2/components/LogoFromGuid.es.js.map +1 -1
  20. package/dist/insights-v2/components/LogoMark.d.ts +3 -1
  21. package/dist/insights-v2/components/LogoMark.es.js +20 -19
  22. package/dist/insights-v2/components/LogoMark.es.js.map +1 -1
  23. package/dist/insights-v2/components/celebrationGradients.d.ts +5 -4
  24. package/dist/insights-v2/components/celebrationGradients.es.js.map +1 -1
  25. package/dist/microinsights/cards/InsightCard.es.js +56 -55
  26. package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
  27. package/package.json +1 -1
  28. package/dist/core/types/InsightsInstanceSlotData.es.js +0 -8
  29. package/dist/core/types/InsightsInstanceSlotData.es.js.map +0 -1
  30. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.d.ts +0 -7
  31. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.es.js +0 -12
  32. package/dist/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.es.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"InsightCard.es.js","names":[],"sources":["../../../src/microinsights/cards/InsightCard.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react'\nimport { useInView } from 'react-intersection-observer'\n\nimport Box from '@mui/material/Box'\nimport { alpha, useTheme } from '@mui/material/styles'\n\nimport { BeatIcon } from '../beaticons'\nimport BeatMaterialIcon from '../beaticons/BeatMaterialIcon'\n\nimport { useCopyStore, useEvent, useInsightsMicroWidgetStore } from '../context/hooks'\n\nimport { ON_CLICK_EVENT, ON_VIEW_EVENT, ON_VIEW_FIRST_TIME_EVENT } from '../constants/Analytics'\nimport { ICON_SIZE, VIEW_THRESHOLD } from '../constants/App'\nimport { microCardMinWidth } from '../utils/cardWidth'\n\nimport type { BeatLikeOffer, MicroInsightCardProps } from '../interfaces'\nimport type { Beat } from '../../core/types/Beat'\n// Leaf imports, not the `core` barrel: that pulls GlobalStore and every feature store into the\n// micro bundle, and through `core/stores` it reintroduces a circular path this module avoids.\nimport { slot } from '../../core/types/Insights'\nimport MicroCardTemplate from '../MicroCardTemplate'\n// Leaf import, not the `common` barrel, which would pull the shared layer into the micro bundle.\nimport { GlobalDataContext } from '../../common/context/GlobalDataProvider'\n// TODO: load this with `React.lazy` to keep the block registry and charts out of the micro bundle,\n// once it is verified in every host that embeds the micro widget.\nimport InlineActionBlock from './InlineActionBlock'\nimport MicroCtaStatusGate, { type MicroCtaStatus } from './MicroCtaStatus'\n// Leaf imports on purpose: the `insights-v2` barrel pulls in `mappings/blocks` and its charts.\nimport { asLogoRef } from '../../insights-v2/blocks/slotReaders'\nimport InsightErrorCard from '../../insights-v2/components/InsightErrorCard'\nimport LogoFromGuid, { isLogoGuid } from '../../insights-v2/components/LogoFromGuid'\nimport {\n statusIconAccentColor,\n statusIconName,\n statusIconPalette,\n} from '../../insights-v2/components/statusIcon'\nimport { hasDrawerBlock } from '../../insights-v2/mappings/hasDrawerBlock'\nimport { resolveInsightRender } from '../../insights-v2/resolveInsightRender'\n\nexport interface InsightCardProps extends MicroInsightCardProps {\n beat: Beat | BeatLikeOffer\n index?: number\n}\n\nexport const InsightCard: React.FC<InsightCardProps> = ({\n ariaLabel,\n beat,\n elevation,\n inDescriptionCtaBehavior = 'external',\n index,\n isActiveCard,\n onCardClick,\n posthog,\n widthOverrides,\n variant,\n showIcon,\n heightOverrides,\n}) => {\n const { ref, inView } = useInView({\n threshold: VIEW_THRESHOLD,\n })\n\n const theme = useTheme()\n\n // *************** Context functions *********************\n const { cardsCopy } = useCopyStore()\n const { onEvent } = useEvent()\n const { updateBeat, updateOffer } = useInsightsMicroWidgetStore()\n\n const isV2 = 'is_insights_v2' in beat && beat.is_insights_v2\n const eventProps = isV2 ? { metadata: { is_insights_v2: true } } : undefined\n\n // ************** Use Effects Hooks **********************\n useEffect(() => {\n if (inView) {\n if (!beat.has_been_displayed) {\n if (beat.guid.startsWith('OFR')) {\n updateOffer({\n ...beat,\n has_been_displayed: true,\n })\n } else {\n updateBeat({\n ...beat,\n has_been_displayed: true,\n })\n }\n onEvent(ON_VIEW_FIRST_TIME_EVENT(beat.template), eventProps)\n } else {\n onEvent(ON_VIEW_EVENT(beat.template), eventProps)\n }\n }\n }, [inView])\n\n useEffect(() => {\n if (inView && beat) {\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('viewed_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('viewed_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n }, [beat, index, inView])\n\n const insightRender = resolveInsightRender(beat as Beat)\n const v2Payload = insightRender === 'v2' ? beat.insights_payload : undefined\n // Only a V2 beat whose `in_description_cta` names a drawer block opens in place; everything else\n // keeps the host's behavior. Micro sends its one action as `in_description_cta`.\n // It also needs the host's `GlobalDataProvider`; without one the tap goes to the host instead.\n const hasGlobalData = React.useContext(GlobalDataContext) !== null\n const opensInline =\n inDescriptionCtaBehavior === 'internal' &&\n hasGlobalData &&\n hasDrawerBlock(v2Payload?.in_description_cta?.block)\n\n // *************** Click handlers ************************\n // Taps that opened the beat's own action block.\n const [inlineOpenRequest, setInlineOpenRequest] = useState(0)\n\n const handleClick = () => {\n /* eslint-disable no-unused-expressions */\n // Internal opens the block here and skips the host's `onCardClick`; analytics are unchanged.\n if (opensInline) {\n setInlineOpenRequest((count) => count + 1)\n } else {\n onCardClick && onCardClick(beat)\n }\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n\n if (beat.template === 'MarketingOffer') {\n const offerBeat = beat as BeatLikeOffer\n posthog?.capture('clicked_messaging_insight', {\n template: beat.template,\n campaign_guid: offerBeat.campaign_guid,\n campaign_name: offerBeat.pulse_campaign_name,\n offer_guid: offerBeat.guid,\n user_guid: offerBeat.user_guid,\n })\n } else {\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n }\n\n if (insightRender === 'error') {\n // Keeps the carousel's slot sizing; the error card does not know about it.\n return (\n <Box\n aria-hidden={!isActiveCard}\n aria-label={ariaLabel}\n aria-roledescription=\"slide\"\n ref={ref}\n role=\"group\"\n sx={{\n height: heightOverrides ? '100%' : 120,\n minWidth: microCardMinWidth(widthOverrides),\n my: 1,\n }}\n >\n <InsightErrorCard beat={beat} />\n </Box>\n )\n }\n\n if (v2Payload) {\n // Figma (Micro Widget | Large Transaction) is the legacy micro card's layout fed from the envelope:\n // the slot's logo on the left (merchant, or the category without one), title, description, and the\n // primary CTA as a link. The logo falls back to the insight glyph when the slot carries none.\n // ditto ≥ 1.4.3 words micro's action as in_description_cta instead of primary_cta; either way\n // the label stays the card's tap (`micro-carousel/cta`), never a drawer.\n // A block with no usable row logo may name a status icon instead (account_block `minimal`:\n // `ICO-error`), drawn in the legacy card's tinted tile (Figma Micro | Low Account Balance).\n // The status tile takes the palette the slot names (Payday's on-track check is `success.main`),\n // falling back to error. `||` on the label: the copy may send the primary label as \"\".\n // Answered (mirrors the full card): reviewed title, icon and the Undo label. Display only: the card\n // and its label tap go to the host, which opens the insight with its block; nothing runs here.\n const renderCard = ({ presentation }: MicroCtaStatus) => {\n const answered = presentation?.kind === 'status' ? presentation : undefined\n const { data } = v2Payload.instance_slot\n const rowLogo = asLogoRef(slot(data, 'logo'))\n // The reviewed icon once answered, else the icon: whichever names a status icon first.\n const statusIcon = [answered ? slot(data, 'reviewed_icon') : undefined, slot(data, 'icon')]\n .map(asLogoRef)\n .find((ref) => statusIconName(ref?.guid))\n // An `ICO-` row logo is an icon, not an entity logo: it takes the same tinted tile (Figma Micro\n // Card) and wins over the status icon, as a row logo always has. The no-colour defaults differ\n // on purpose: a row icon with none is decorative (primary), a status icon with none is an error.\n const rowIconName = statusIconName(rowLogo?.guid)\n const tileColor = rowIconName ? rowLogo?.color || 'primary.main' : statusIcon?.color\n const tileName = rowIconName ?? statusIconName(statusIcon?.guid)\n const tilePalette = statusIconPalette(tileColor)\n // A non-status icon (`primary.main`, `chart.*`) tints the tile in its own colour.\n const tileAccent = statusIconAccentColor(theme.palette, tileColor)\n const actionLabel = presentation\n ? answered?.action?.label\n : v2Payload.primary_cta?.label || v2Payload.in_description_cta?.label || undefined\n const handleHostClick = () => {\n onCardClick && onCardClick(beat)\n onEvent(ON_CLICK_EVENT(beat.template), eventProps)\n posthog?.capture('clicked_insight', {\n beat_guid: beat.guid,\n template: beat.template,\n position: index,\n ...(isV2 && { is_insights_v2: true }),\n })\n }\n\n const card = (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={v2Payload.description.html_text}\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={\n showIcon &&\n (isLogoGuid(rowLogo?.guid) && !rowIconName ? (\n <LogoFromGuid logo={rowLogo} size={ICON_SIZE} />\n ) : tileName ? (\n <BeatMaterialIcon\n bgColor={alpha(tileAccent ?? theme.palette[tilePalette].main, 0.15)}\n iconColor={tileAccent ? 'inherit' : tilePalette}\n name={tileName}\n sx={tileAccent ? { color: tileAccent } : undefined}\n />\n ) : (\n <BeatMaterialIcon\n bgColor={alpha(theme.palette.primary.main, 0.15)}\n name=\"lightbulb\"\n />\n ))\n }\n isActiveCard={isActiveCard}\n isInsightsV2={true}\n onCardClick={presentation ? handleHostClick : handleClick}\n onPrimaryAction={presentation ? handleHostClick : handleClick}\n primaryActionText={actionLabel}\n ref={ref}\n title={presentation?.title || v2Payload.title || ''}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n\n if (!opensInline) return card\n\n return (\n <>\n {card}\n {/* Nothing renders until the first tap. */}\n {inlineOpenRequest > 0 && (\n <InlineActionBlock\n beat={beat as Beat}\n openRequest={inlineOpenRequest}\n posthog={posthog}\n />\n )}\n </>\n )\n }\n\n return (\n <MicroCtaStatusGate beat={beat as Beat} posthog={posthog}>\n {renderCard}\n </MicroCtaStatusGate>\n )\n }\n\n return (\n <MicroCardTemplate\n aria-roledescription=\"slide\"\n ariaLabel={ariaLabel}\n description={\n beat?.html_micro_description && beat?.html_micro_description.length > 0\n ? beat.html_micro_description\n : beat.html_description || ''\n }\n elevation={elevation}\n heightOverrides={heightOverrides}\n icon={showIcon && <BeatIcon beat={beat} />}\n isActiveCard={isActiveCard}\n onCardClick={handleClick}\n onPrimaryAction={handleClick}\n primaryActionText={beat.micro_call_to_action || cardsCopy?.micro_card_cta}\n ref={ref}\n title={beat.micro_title && beat.micro_title.length > 0 ? beat.micro_title : beat.title}\n variant={variant}\n widthOverrides={widthOverrides}\n />\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA4CA,IAAa,KAAA,CAA2C,EACtD,WAAA,GACA,MAAA,GACA,WAAA,GACA,0BAAA,IAA2B,YAC3B,OAAA,GACA,cAAA,GACA,aAAA,GACA,SAAA,GACA,gBAAA,GACA,SAAA,GACA,UAAA,GACA,iBAAA,EAAA,MACI;AACJ,QAAM,EAAE,KAAA,GAAK,QAAA,EAAA,IAAW,GAAU,EAChC,WAAA,EACF,CAAC,GAEK,IAAQ,GAAS,GAGjB,EAAE,WAAA,EAAA,IAAc,GAAa,GAC7B,EAAE,SAAA,EAAA,IAAY,GAAS,GACvB,EAAE,YAAA,GAAY,aAAA,EAAA,IAAgB,GAA4B,GAE1D,IAAO,oBAAoB,KAAQ,EAAK,gBACxC,IAAa,IAAO,EAAE,UAAU,EAAE,gBAAgB,GAAK,EAAE,IAAI;AAGnE,EAAA,EAAA,MAAgB;AACd,IAAI,MACG,EAAK,qBAcR,EAAQ,GAAc,EAAK,QAAQ,GAAG,CAAU,KAb5C,EAAK,KAAK,WAAW,KAAK,IAC5B,EAAY;AAAA,MACV,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,IAED,EAAW;AAAA,MACT,GAAG;AAAA,MACH,oBAAoB;AAAA,IACtB,CAAC,GAEH,EAAQ,GAAyB,EAAK,QAAQ,GAAG,CAAU;AAAA,EAKjE,GAAG,CAAC,CAAM,CAAC,GAEX,EAAA,MAAgB;AACd,QAAI,KAAU,EACZ,KAAI,EAAK,aAAa,kBAAkB;AACtC,YAAM,IAAY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,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/**\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,C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M,uBAAuB,SAAS,IAClE,EAAK,yBACL,EAAK,oBAAoB;AAAA,IAEpB,WAAA;AAAA,IACM,iBAAA;AAAA,IACjB,MAAM,KAAY,gBAAA,EAAC,IAAD,EAAgB,MAAA,EAAO,CAAA;AAAA,IAC3B,cAAA;AAAA,IACd,aAAa;AAAA,IACb,iBAAiB;AAAA,IACjB,mBAAmB,EAAK,wBAAwB,GAAW;AAAA,IACtD,KAAA;AAAA,IACL,OAAO,EAAK,eAAe,EAAK,YAAY,SAAS,IAAI,EAAK,cAAc,EAAK;AAAA,IACxE,SAAA;AAAA,IACO,gBAAA;AAAA,EACjB,CAAA;AAEL"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.7.189",
3
+ "version": "9.7.191",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -1,8 +0,0 @@
1
- var _ = /* @__PURE__ */ (function(E) {
2
- return E.LOW_BUDGET_TIER = "LOW", E.MEDIUM_BUDGET_TIER = "MEDIUM", E.OFF_TRACK_BUDGET_TIER = "OFF_TRACK", E;
3
- })({});
4
- export {
5
- _ as BudgetTierType
6
- };
7
-
8
- //# sourceMappingURL=InsightsInstanceSlotData.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"InsightsInstanceSlotData.es.js","names":[],"sources":["../../../src/core/types/InsightsInstanceSlotData.ts"],"sourcesContent":["import type { DataSeries, Legends, LogoRef } from '../../core'\n\nexport interface InsightsInstanceSlotData\n extends\n Partial<BudgetBlockData>,\n Partial<DonutChartBlockData>,\n Partial<ImageBlockData>,\n Partial<AccountBlockData>,\n Partial<SaveExtraBlockData>,\n Partial<StepChartBlockData>,\n Partial<SVGImageBlockData>,\n Partial<AccountSwitchBlockData>,\n Partial<TransactionDetailsBlockData>,\n Partial<CreditUtilizationBlockData>,\n Partial<MerchantBlockData>,\n Partial<CommonProps> {}\n\n//when any of the type is used more than one times, we can use the common props\ninterface CommonProps {\n amount?: number\n ariaLabel?: string\n date?: string\n legends?: Legends[]\n category_guid?: string\n data_series?: DataSeries | DataSet[]\n transaction_guids?: string[]\n account_guids?: string[]\n primary_transaction_guid?: string\n}\n\n//BarChart Block: `instance_slot.data` (Insights 2.0)\nexport interface BarChartBlockData {\n series?: DataSeries\n category_guid?: string\n average_amount?: number\n /** [0] monthly amount, [1] trend. */\n additional_data?: Legends[]\n}\n\n//DonutChart Block: `instance_slot.data` (Insights 2.0) — the same shape V1 sent as `instance_slot_data`.\n/** The donut's centre: the total and its caption (\"$6,306\" / \"Total\"). */\nexport interface DonutChartMain {\n value: string | number\n value_type: string\n label: string\n /** The embedded donut's shorter caption (Credit Card Close to Limit: \"Remains\"). */\n compact_label?: string\n}\nexport interface DonutChartBlockData {\n main: DonutChartMain\n /** The category whose colour fills the primary slice (Cost of Living to Income: Housing). */\n category_guid?: string\n /** Legend rows beside the donut: a label, its amount and an optional share (\"$5,550.00 (88%)\"). */\n legends?: Legends[]\n}\n\n//DoubleBarChart Block\n// TODO : This has to be revisited again to update the below types based on API response once we have the final shape of the data_series for double bar chart from BE\nexport interface LegendProps extends Legends {\n amount: number\n formattedAmount: string\n label: string\n color?: string\n}\n\nexport interface DataSet extends DataSeries {\n ariaLabelComparison: string\n ariaLabelMain: string\n comparison: number\n // The comparison bar's transaction guids (data_series aggregated_guids), for the drawer filter.\n comparisonGuids?: string[]\n // The month's 'yyyy-MM-dd' date (the main row's).\n date?: string\n formattedComparison: string\n formattedMain: string\n label: string\n main: number\n // The main bar's transaction guids (data_series aggregated_guids), for the drawer filter.\n mainGuids?: string[]\n}\n\n//DoubleProgressBar Block\n\n//Image Block\nexport interface ImageBlockData {\n image: string\n}\n\n//Account Block\nexport interface AccountBlockData {\n sub_text: string\n institution_guid?: string\n institution_name?: string\n icon_name?: string\n /** Header bar text (standard card), or the colored category strip label (deposit cards). */\n header_text?: string\n // Deposit variants (Unified Deposit, Unified Deposit Emergency Fund, Savings Account Deposit)\n /** Merchant guid — renders a real merchant logo in the deposit card when present. */\n merchant_guid?: string\n /** Merchant display name — logo alt text and the payer line under the amount. */\n merchant_name?: string\n /** Secondary label beside the amount, e.g. `On {date}, you saved` or `Balance as of MM/DD/YY`. */\n label?: string\n}\n\nexport interface SaveExtraBlockData {\n /** Styled segments `[lead-in, amount digits, trailing copy]`, e.g. `['Save an extra', '100', 'to help your funds grow']`. */\n primary_text?: string[]\n /** Styled segments `[projected balance, caption]`, e.g. `['$8,313.87', 'After payday & projected expenses']`. */\n secondary_text?: string[]\n /** MakeTransfer drilldown: available balance (both variants). */\n available_balance?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: average monthly spend. */\n avg_monthly_spend?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: how long the balance lasts, overlaid on the timeline SVG (e.g. \"2 months, 11 days\"). */\n time_period?: string\n /** SAVE_AN_EXTRA_100: upcoming expenses (the \"Expenses\" figure). */\n upcoming_expenses?: number\n /** SAVE_AN_EXTRA_100: total remaining after expenses. */\n total_remaining?: number\n /** SAVE_ENOUGH_TO_LIVE_ON: date for the \"Your available balances as of {date}\" line. */\n date?: string\n}\n\n// AccountSwitch Block. State comes from `instance_slot.variant`, not a data flag.\nexport interface AccountSwitchBlockData {\n discovered_institution_guid: string\n discovered_institution_name: string\n held_institution_guid: string\n held_institution_name: string\n}\n\n// AccountSwitch Block: `instance_slot.data` (Insights 2.0). Discovered Accounts V2: `from_logo` the held\n// institution (absent when the user holds no FI-managed account), `to_logo` the discovered one.\n// Switch Direct Deposit: `from_logo` the external institution, `to_logo` the held one. `logo` is the\n// compact card's (micro, notification) institution.\nexport interface AccountSwitchBlockV2Data {\n from_logo?: LogoRef\n to_logo?: LogoRef\n logo?: LogoRef\n}\n\n// StepChart Block\nexport interface StepChartBlockData {\n completed_steps: number\n label_1: string\n label_2?: string\n}\n\n//Budgets Blocks\nexport enum BudgetTierType {\n LOW_BUDGET_TIER = 'LOW',\n MEDIUM_BUDGET_TIER = 'MEDIUM',\n OFF_TRACK_BUDGET_TIER = 'OFF_TRACK',\n}\n\nexport type BudgetTierValue = `${BudgetTierType}`\n\nexport interface BudgetLocalizedPayload {\n primary_text?: string\n amount_left_label?: string\n spent_label?: string\n budgeted_label?: string\n}\n\nexport interface BudgetBlockData {\n budget_percent: number\n budget_tier: BudgetTierValue\n category_guid?: string\n merchant_guid?: string\n spent_amount: number\n budgeted_amount: number\n localized_payload: BudgetLocalizedPayload\n}\n\nexport interface SVGImageBlockData {\n isCIBC?: boolean\n}\n\n// TransactionDetails Action Block\n// The drawer's subject is `InsightsPayload.primary_transaction_guid`; only action configuration\n// lives here.\nexport interface TransactionDetailsBlockData {\n /** `TopActions` member names, e.g. `['Category', 'Date', 'Memo']`. Omit for the defaults. */\n top_actions?: string[]\n /** `BottomActions` member names, e.g. `['MerchantBudget', 'HideTransaction']`. Omit for defaults. */\n bottom_actions?: string[]\n}\n\n// Credit Utilization action block. The per-card rows are the beat's `data_series` table\n// (`guid`, `label`, `amount`, `total_amount`, `percentage`), carried on `CommonProps.data_series`.\nexport interface CreditUtilizationBlockData {\n accounts_balance_sum?: number\n accounts_credit_limit_sum?: number\n credit_utilization_percentage?: number\n}\n\n// Merchant block `instance_slot.data`; `primary_text` is ditto's name.\nexport interface MerchantBlockData {\n merchant_name?: string\n logo?: LogoRef\n amount?: number\n /** Pre-localized eyebrow; ditto sends `header_text`. */\n date?: string\n header_text?: string\n status_text?: string\n logos?: LogoRef[]\n}\n"],"mappings":"AAsJA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,kBAAA,OACA,EAAA,qBAAA,UACA,EAAA,wBAAA;AACF,GAAA,CAAA,CAAA"}
@@ -1,7 +0,0 @@
1
- import { BudgetTierValue } from '../../../../core/types/InsightsInstanceSlotData';
2
- export declare const BUDGET_STATUS_COLORS_MAP: {
3
- LOW: string;
4
- MEDIUM: string;
5
- OFF_TRACK: string;
6
- };
7
- export declare const getColorByBudgetTier: (budgetTier: BudgetTierValue) => string;
@@ -1,12 +0,0 @@
1
- import { BudgetTierType as T } from "../../../../core/types/InsightsInstanceSlotData.es.js";
2
- var _ = {
3
- [T.LOW_BUDGET_TIER]: "success.main",
4
- [T.MEDIUM_BUDGET_TIER]: "warning.main",
5
- [T.OFF_TRACK_BUDGET_TIER]: "error.main"
6
- }, E = (r) => _[r];
7
- export {
8
- _ as BUDGET_STATUS_COLORS_MAP,
9
- E as getColorByBudgetTier
10
- };
11
-
12
- //# sourceMappingURL=util.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/BudgetBlock/util.ts"],"sourcesContent":["import {\n BudgetTierType,\n type BudgetTierValue,\n} from '../../../../core/types/InsightsInstanceSlotData'\n\nexport const BUDGET_STATUS_COLORS_MAP = {\n [BudgetTierType.LOW_BUDGET_TIER]: 'success.main',\n [BudgetTierType.MEDIUM_BUDGET_TIER]: 'warning.main',\n [BudgetTierType.OFF_TRACK_BUDGET_TIER]: 'error.main',\n}\n\nexport const getColorByBudgetTier = (budgetTier: BudgetTierValue) =>\n BUDGET_STATUS_COLORS_MAP[budgetTier]\n"],"mappings":";AAKA,IAAa,IAA2B;AAAA,EACrC,CAAA,EAAe,eAAA,GAAkB;AAAA,EACjC,CAAA,EAAe,kBAAA,GAAqB;AAAA,EACpC,CAAA,EAAe,qBAAA,GAAwB;AAC1C,GAEa,IAAA,CAAwB,MACnC,EAAyB,CAAA"}