@mx-cartographer/experiences 9.4.7 → 9.4.8

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 (52) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/core/stores/InsightsV2Store.es.js +12 -8
  3. package/dist/core/stores/InsightsV2Store.es.js.map +1 -1
  4. package/dist/core/types/Insights.d.ts +2 -0
  5. package/dist/core/types/InsightsInstanceSlotData.d.ts +19 -1
  6. package/dist/core/types/InsightsInstanceSlotData.es.js.map +1 -1
  7. package/dist/core/types/localization/InsightsFeedCopy.d.ts +19 -0
  8. package/dist/core/types/localization/index.d.ts +1 -1
  9. package/dist/insights-v2/{blocks/ComponentBlocks/ActionBlock → actionBlocks}/ActionBlockLayer.d.ts +1 -1
  10. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +35 -0
  11. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -0
  12. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/BalanceStepper.d.ts +12 -0
  13. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/BalanceStepper.es.js +58 -0
  14. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/BalanceStepper.es.js.map +1 -0
  15. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.d.ts +27 -0
  16. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js +228 -0
  17. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlock.es.js.map +1 -0
  18. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.d.ts +13 -0
  19. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js +26 -0
  20. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js.map +1 -0
  21. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.d.ts +11 -0
  22. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.es.js +77 -0
  23. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/SaveEnoughToLiveOnBottomSection.es.js.map +1 -0
  24. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/images/SaveEnoughToLiveOnBottom.es.js +21 -0
  25. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/images/SaveEnoughToLiveOnBottom.es.js.map +1 -0
  26. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/index.d.ts +1 -0
  27. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.d.ts +57 -0
  28. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +85 -0
  29. package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -0
  30. package/dist/insights-v2/{blocks/ComponentBlocks/ActionBlock → actionBlocks}/PlaceholderActionBlock.d.ts +1 -1
  31. package/dist/insights-v2/{blocks/ComponentBlocks/ActionBlock → actionBlocks}/PlaceholderActionBlock.es.js +1 -1
  32. package/dist/insights-v2/actionBlocks/PlaceholderActionBlock.es.js.map +1 -0
  33. package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.d.ts +4 -0
  34. package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js +18 -0
  35. package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js.map +1 -0
  36. package/dist/insights-v2/blocks/ComponentBlocks/SaveExtraBlock/index.d.ts +1 -0
  37. package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -0
  38. package/dist/insights-v2/components/BaseLayout.es.js +18 -18
  39. package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
  40. package/dist/insights-v2/components/SaveAnExtraCard.d.ts +3 -21
  41. package/dist/insights-v2/components/SaveAnExtraCard.es.js +55 -47
  42. package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
  43. package/dist/insights-v2/components/chartblocks/ThemedSVGImage.es.js +12 -12
  44. package/dist/insights-v2/components/chartblocks/ThemedSVGImage.es.js.map +1 -1
  45. package/dist/insights-v2/index.es.js +46 -44
  46. package/dist/insights-v2/mappings/blocks.d.ts +3 -2
  47. package/dist/insights-v2/mappings/blocks.es.js +48 -29
  48. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  49. package/package.json +1 -1
  50. package/dist/insights-v2/blocks/ComponentBlocks/ActionBlock/ActionBlockLayer.es.js +0 -41
  51. package/dist/insights-v2/blocks/ComponentBlocks/ActionBlock/ActionBlockLayer.es.js.map +0 -1
  52. package/dist/insights-v2/blocks/ComponentBlocks/ActionBlock/PlaceholderActionBlock.es.js.map +0 -1
@@ -2,17 +2,17 @@ import { useInsightsV2Store as u } from "../../common/context/hooks.es.js";
2
2
  import { blocks as g } from "../mappings/blocks.es.js";
3
3
  import y from "./Footer.es.js";
4
4
  import _ from "./Header.es.js";
5
- import { ActionBlockLayer as x } from "../blocks/ComponentBlocks/ActionBlock/ActionBlockLayer.es.js";
6
- import n from "@mui/material/Stack";
7
- import e from "@mui/material/Button";
8
- import { ChevronRight as k } from "@mxenabled/mx-icons";
5
+ import { ActionBlockLayer as k } from "../actionBlocks/ActionBlockLayer.es.js";
6
+ import l from "@mui/material/Stack";
7
+ import c from "@mui/material/Button";
8
+ import { ChevronRight as x } from "@mxenabled/mx-icons";
9
9
  import { jsx as r, jsxs as i } from "react/jsx-runtime";
10
10
  import C from "@mui/material/Card";
11
11
  var A = ({ beat: o }) => {
12
- const { openCtaDrawer: l } = u(), t = o.insights_payload;
12
+ const { openCtaDrawer: s } = u(), t = o.insights_payload;
13
13
  if (!t) return null;
14
- const { instance_slot: p, primary_cta: c, secondary_cta: s, subtitle: m, widget_type: h } = t, { block: f } = p, a = g[f], d = h === "mini";
15
- return /* @__PURE__ */ i(n, {
14
+ const { instance_slot: p, primary_cta: n, secondary_cta: e, subtitle: m, widget_type: h } = t, { block: f } = p, a = g[f], d = h === "mini";
15
+ return /* @__PURE__ */ i(l, {
16
16
  sx: { mb: 16 },
17
17
  children: [
18
18
  /* @__PURE__ */ i(C, { children: [
@@ -25,7 +25,7 @@ var A = ({ beat: o }) => {
25
25
  beatGuid: o.guid,
26
26
  payload: t
27
27
  }),
28
- /* @__PURE__ */ i(n, {
28
+ /* @__PURE__ */ i(l, {
29
29
  sx: {
30
30
  gap: 6,
31
31
  pb: 16,
@@ -36,8 +36,8 @@ var A = ({ beat: o }) => {
36
36
  children: [/* @__PURE__ */ r("div", {
37
37
  dangerouslySetInnerHTML: { __html: o.html_description },
38
38
  style: { paddingLeft: 4 }
39
- }), o?.in_description_cta && /* @__PURE__ */ r(e, {
40
- endIcon: /* @__PURE__ */ r(k, {}),
39
+ }), o?.in_description_cta && /* @__PURE__ */ r(c, {
40
+ endIcon: /* @__PURE__ */ r(x, {}),
41
41
  onClick: () => {
42
42
  },
43
43
  sx: {
@@ -48,24 +48,24 @@ var A = ({ beat: o }) => {
48
48
  children: o.in_description_cta
49
49
  })]
50
50
  }),
51
- !d && c?.label && /* @__PURE__ */ i(n, {
51
+ !d && n?.label && /* @__PURE__ */ i(l, {
52
52
  sx: {
53
53
  gap: 8,
54
54
  pb: 16,
55
55
  px: 16
56
56
  },
57
- children: [/* @__PURE__ */ r(e, {
58
- onClick: () => l(o.guid, "primaryCta"),
57
+ children: [/* @__PURE__ */ r(c, {
58
+ onClick: () => n.block && s(o.guid, "primaryCta"),
59
59
  variant: "outlined",
60
- children: c.label
61
- }), s?.label && /* @__PURE__ */ r(e, {
60
+ children: n.label
61
+ }), e?.label && /* @__PURE__ */ r(c, {
62
62
  color: "secondary",
63
- onClick: () => l(o.guid, "secondaryCta"),
64
- children: s.label
63
+ onClick: () => e.block && s(o.guid, "secondaryCta"),
64
+ children: e.label
65
65
  })]
66
66
  })
67
67
  ] }),
68
- /* @__PURE__ */ r(x, { beat: o }),
68
+ /* @__PURE__ */ r(k, { beat: o }),
69
69
  t.footer && /* @__PURE__ */ r(y, { footer: t.footer })
70
70
  ]
71
71
  });
@@ -1 +1 @@
1
- {"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\n\nimport { blocks } from '../mappings/blocks'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport { useInsightsV2Store } from '../../common'\nimport type { Beat } from '../../core'\nimport { ActionBlockLayer } from '../blocks/ComponentBlocks/ActionBlock/ActionBlockLayer'\n\ninterface BaseLayoutProps {\n beat: Beat\n}\n\nconst BaseLayout = ({ beat }: BaseLayoutProps) => {\n const { openCtaDrawer } = useInsightsV2Store()\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) {\n return null\n }\n\n const { instance_slot, primary_cta, secondary_cta, subtitle, widget_type } = insights_payload\n const { block } = instance_slot\n\n const Block = blocks[block as keyof typeof blocks]\n\n const isMini = widget_type === 'mini'\n\n return (\n <Stack sx={{ mb: 16 }}>\n <Card>\n {/* Header */}\n <Header isMini={isMini} subtitle={subtitle} title={beat.title} />\n\n {/* Instance Slot */}\n {Block && <Block beatGuid={beat.guid} payload={insights_payload} />}\n\n {/* Body */}\n <Stack sx={{ gap: 6, pb: 16, pl: 12, pr: 16, pt: 12 }}>\n <div\n dangerouslySetInnerHTML={{\n __html: beat.html_description as string,\n }}\n style={{ paddingLeft: 4 }}\n />\n {beat?.in_description_cta && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() => {}}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {beat.in_description_cta}\n </Button>\n )}\n </Stack>\n\n {/* CTA */}\n {!isMini && primary_cta?.label && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n <Button onClick={() => openCtaDrawer(beat.guid, 'primaryCta')} variant=\"outlined\">\n {primary_cta.label}\n </Button>\n {secondary_cta?.label && (\n <Button color=\"secondary\" onClick={() => openCtaDrawer(beat.guid, 'secondaryCta')}>\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n </Card>\n\n {/* Always mounted: the drawer's slide in/out animation only plays when\n MUI sees isOpen CHANGE on a mounted Drawer — conditionally mounting\n it here made it snap open and vanish on close. */}\n <ActionBlockLayer beat={beat} />\n\n {/* Footer */}\n {insights_payload.footer && <Footer footer={insights_payload.footer} />}\n </Stack>\n )\n}\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;AAkBA,IAAM,IAAA,CAAc,EAAE,MAAA,EAAA,MAA4B;AAChD,QAAM,EAAE,eAAA,EAAA,IAAkB,EAAmB,GAEvC,IAAmB,EAAK;AAE9B,MAAI,CAAC,EACH,QAAO;AAGT,QAAM,EAAE,eAAA,GAAe,aAAA,GAAa,eAAA,GAAe,UAAA,GAAU,aAAA,EAAA,IAAgB,GACvE,EAAE,OAAA,EAAA,IAAU,GAEZ,IAAQ,EAAO,CAAA,GAEf,IAAS,MAAgB;AAE/B,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,IAAI,GAAG;AAAA,IAApB,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD,EAAA,UAAA;AAAA,QAEE,gBAAA,EAAC,GAAD;AAAA,UAAgB,QAAA;AAAA,UAAkB,UAAA;AAAA,UAAU,OAAO,EAAK;AAAA,QAAQ,CAAA;AAAA,QAG/D,KAAS,gBAAA,EAAC,GAAD;AAAA,UAAO,UAAU,EAAK;AAAA,UAAM,SAAS;AAAA,QAAmB,CAAA;AAAA,QAGlE,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,IAAI;AAAA,YAAI,IAAI;AAAA,YAAI,IAAI;AAAA,YAAI,IAAI;AAAA,UAAG;AAAA,UAApD,UAAA,CACE,gBAAA,EAAC,OAAD;AAAA,YACE,yBAAyB,EACvB,QAAQ,EAAK,iBACf;AAAA,YACA,OAAO,EAAE,aAAa,EAAE;AAAA,UACzB,CAAA,GACA,GAAM,sBACL,gBAAA,EAAC,GAAD;AAAA,YACE,SAAS,gBAAA,EAAC,GAAD,CAAe,CAAA;AAAA,YACxB,SAAA,MAAe;AAAA,YAAC;AAAA,YAChB,IAAI;AAAA,cAAE,QAAQ;AAAA,cAAI,GAAG;AAAA,cAAG,OAAO;AAAA,YAAc;AAAA,YAE5C,UAAA,EAAK;AAAA,UACA,CAAA,CAEL;AAAA;QAGN,CAAC,KAAU,GAAa,SACvB,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,IAAI;AAAA,YAAI,IAAI;AAAA,UAAG;AAAA,UAApC,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,YAAQ,SAAA,MAAe,EAAc,EAAK,MAAM,YAAY;AAAA,YAAG,SAAQ;AAAA,YACpE,UAAA,EAAY;AAAA,UACP,CAAA,GACP,GAAe,SACd,gBAAA,EAAC,GAAD;AAAA,YAAQ,OAAM;AAAA,YAAY,SAAA,MAAe,EAAc,EAAK,MAAM,cAAc;AAAA,YAC7E,UAAA,EAAc;AAAA,UACT,CAAA,CAEL;AAAA;MAEL,EAAA,CAAA;AAAA,MAKN,gBAAA,EAAC,GAAD,EAAwB,MAAA,EAAO,CAAA;AAAA,MAG9B,EAAiB,UAAU,gBAAA,EAAC,GAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,IACjE;AAAA;AAEX"}
1
+ {"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\n\nimport { blocks } from '../mappings/blocks'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport { useInsightsV2Store } from '../../common'\nimport type { Beat } from '../../core'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\n\ninterface BaseLayoutProps {\n beat: Beat\n}\n\nconst BaseLayout = ({ beat }: BaseLayoutProps) => {\n const { openCtaDrawer } = useInsightsV2Store()\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) {\n return null\n }\n\n const { instance_slot, primary_cta, secondary_cta, subtitle, widget_type } = insights_payload\n const { block } = instance_slot\n\n const Block = blocks[block as keyof typeof blocks]\n\n const isMini = widget_type === 'mini'\n\n return (\n <Stack sx={{ mb: 16 }}>\n <Card>\n {/* Header */}\n <Header isMini={isMini} subtitle={subtitle} title={beat.title} />\n\n {/* Instance Slot */}\n {Block && <Block beatGuid={beat.guid} payload={insights_payload} />}\n\n {/* Body */}\n <Stack sx={{ gap: 6, pb: 16, pl: 12, pr: 16, pt: 12 }}>\n <div\n dangerouslySetInnerHTML={{\n __html: beat.html_description as string,\n }}\n style={{ paddingLeft: 4 }}\n />\n {beat?.in_description_cta && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() => {}}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {beat.in_description_cta}\n </Button>\n )}\n </Stack>\n\n {/* CTA. A CTA without a real `block` doesn't open a drawer (it may trigger\n a postMessage etc.) — restrict the drawer to CTAs that carry a block. */}\n {!isMini && primary_cta?.label && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n <Button\n onClick={() => primary_cta.block && openCtaDrawer(beat.guid, 'primaryCta')}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n {secondary_cta?.label && (\n <Button\n color=\"secondary\"\n onClick={() => secondary_cta.block && openCtaDrawer(beat.guid, 'secondaryCta')}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n </Card>\n\n {/* Always mounted: the drawer's slide in/out animation only plays when\n MUI sees isOpen CHANGE on a mounted Drawer — conditionally mounting\n it here made it snap open and vanish on close. */}\n <ActionBlockLayer beat={beat} />\n\n {/* Footer */}\n {insights_payload.footer && <Footer footer={insights_payload.footer} />}\n </Stack>\n )\n}\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;AAkBA,IAAM,IAAA,CAAc,EAAE,MAAA,EAAA,MAA4B;AAChD,QAAM,EAAE,eAAA,EAAA,IAAkB,EAAmB,GAEvC,IAAmB,EAAK;AAE9B,MAAI,CAAC,EACH,QAAO;AAGT,QAAM,EAAE,eAAA,GAAe,aAAA,GAAa,eAAA,GAAe,UAAA,GAAU,aAAA,EAAA,IAAgB,GACvE,EAAE,OAAA,EAAA,IAAU,GAEZ,IAAQ,EAAO,CAAA,GAEf,IAAS,MAAgB;AAE/B,SACE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI,EAAE,IAAI,GAAG;AAAA,IAApB,UAAA;AAAA,MACE,gBAAA,EAAC,GAAD,EAAA,UAAA;AAAA,QAEE,gBAAA,EAAC,GAAD;AAAA,UAAgB,QAAA;AAAA,UAAkB,UAAA;AAAA,UAAU,OAAO,EAAK;AAAA,QAAQ,CAAA;AAAA,QAG/D,KAAS,gBAAA,EAAC,GAAD;AAAA,UAAO,UAAU,EAAK;AAAA,UAAM,SAAS;AAAA,QAAmB,CAAA;AAAA,QAGlE,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,IAAI;AAAA,YAAI,IAAI;AAAA,YAAI,IAAI;AAAA,YAAI,IAAI;AAAA,UAAG;AAAA,UAApD,UAAA,CACE,gBAAA,EAAC,OAAD;AAAA,YACE,yBAAyB,EACvB,QAAQ,EAAK,iBACf;AAAA,YACA,OAAO,EAAE,aAAa,EAAE;AAAA,UACzB,CAAA,GACA,GAAM,sBACL,gBAAA,EAAC,GAAD;AAAA,YACE,SAAS,gBAAA,EAAC,GAAD,CAAe,CAAA;AAAA,YACxB,SAAA,MAAe;AAAA,YAAC;AAAA,YAChB,IAAI;AAAA,cAAE,QAAQ;AAAA,cAAI,GAAG;AAAA,cAAG,OAAO;AAAA,YAAc;AAAA,YAE5C,UAAA,EAAK;AAAA,UACA,CAAA,CAEL;AAAA;QAIN,CAAC,KAAU,GAAa,SACvB,gBAAA,EAAC,GAAD;AAAA,UAAO,IAAI;AAAA,YAAE,KAAK;AAAA,YAAG,IAAI;AAAA,YAAI,IAAI;AAAA,UAAG;AAAA,UAApC,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,YACE,SAAA,MAAe,EAAY,SAAS,EAAc,EAAK,MAAM,YAAY;AAAA,YACzE,SAAQ;AAAA,YAEP,UAAA,EAAY;AAAA,UACP,CAAA,GACP,GAAe,SACd,gBAAA,EAAC,GAAD;AAAA,YACE,OAAM;AAAA,YACN,SAAA,MAAe,EAAc,SAAS,EAAc,EAAK,MAAM,cAAc;AAAA,YAE5E,UAAA,EAAc;AAAA,UACT,CAAA,CAEL;AAAA;MAEL,EAAA,CAAA;AAAA,MAKN,gBAAA,EAAC,GAAD,EAAwB,MAAA,EAAO,CAAA;AAAA,MAG9B,EAAiB,UAAU,gBAAA,EAAC,GAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,IACjE;AAAA;AAEX"}
@@ -1,27 +1,9 @@
1
1
  import { SxProps, Theme } from '@mui/material/styles';
2
2
  interface SaveAnExtraCardProps {
3
- /** Subtitle label in the green header (e.g. "Save an extra"). */
4
- title: string;
5
- /** Large amount in the green header (e.g. "$100.00"). */
6
- amount: string;
7
- /** Small caption under the header amount (e.g. "to help your funds grow"). */
8
- description: string;
9
- /** Large amount in the white footer (e.g. "$3,320.00"). */
10
- footerAmount: string;
11
- /** Small caption under the footer amount (e.g. "After payday & projected expenses"). */
12
- footerDescription: string;
13
- /** Header surface color token. Default `success.main` (green). */
3
+ primaryText?: string[];
4
+ secondaryText?: string[];
14
5
  bgcolor?: string;
15
6
  sx?: SxProps<Theme>;
16
7
  }
17
- /**
18
- * Save an Extra content: a green header ("Save an extra" / amount / caption)
19
- * over a white footer (projected amount / caption), wrapped in a rounded,
20
- * green-outlined card. Mirrors the v1 `SaveAnExtra100` structure with
21
- * theme-aware tokens so it flips correctly in dark mode.
22
- *
23
- * Figma: Save an Extra $100 Content (Full variant). Scope is the Content
24
- * section only.
25
- */
26
- declare const SaveAnExtraCard: ({ title, amount, description, footerAmount, footerDescription, bgcolor, sx, }: SaveAnExtraCardProps) => import("react/jsx-runtime").JSX.Element;
8
+ declare const SaveAnExtraCard: ({ primaryText, secondaryText, bgcolor, sx, }: SaveAnExtraCardProps) => import("react/jsx-runtime").JSX.Element;
27
9
  export default SaveAnExtraCard;
@@ -1,57 +1,65 @@
1
- import { getLogoElevation as x } from "./logoShadow.es.js";
1
+ import { formatCurrency as i } from "../../core/utils/NumberFormatting.es.js";
2
+ import { getLogoElevation as h } from "./logoShadow.es.js";
2
3
  import { Text as r } from "@mxenabled/mxui";
3
- import { jsx as e, jsxs as o } from "react/jsx-runtime";
4
+ import { jsx as o, jsxs as e } from "react/jsx-runtime";
4
5
  import t from "@mui/material/Box";
5
- var u = ({ title: i, amount: n, description: a, footerAmount: c, footerDescription: s, bgcolor: d = "success.main", sx: l }) => /* @__PURE__ */ o(t, {
6
- sx: {
7
- border: "1px solid",
8
- borderColor: "success.main",
9
- borderRadius: 2,
10
- boxShadow: x,
11
- overflow: "hidden",
12
- ...l
13
- },
14
- children: [/* @__PURE__ */ o(t, {
6
+ var C = ({ primaryText: n = [], secondaryText: a = [], bgcolor: c = "success.main", sx: l }) => {
7
+ const [d, s, p] = n, [m, x] = a;
8
+ return /* @__PURE__ */ e(t, {
15
9
  sx: {
16
- bgcolor: d,
17
- color: "success.contrastText",
18
- p: 16,
19
- pt: 12,
20
- textAlign: "center"
10
+ border: "1px solid",
11
+ borderColor: "success.main",
12
+ borderRadius: 2,
13
+ boxShadow: h,
14
+ overflow: "hidden",
15
+ ...l
21
16
  },
22
- children: [
23
- /* @__PURE__ */ e(r, {
24
- variant: "subtitle1",
25
- children: i
26
- }),
27
- /* @__PURE__ */ e(r, {
28
- variant: "h1",
29
- children: n
30
- }),
31
- /* @__PURE__ */ e(r, {
17
+ children: [/* @__PURE__ */ e(t, {
18
+ sx: {
19
+ bgcolor: c,
20
+ color: "success.contrastText",
21
+ p: 16,
22
+ pt: 12,
23
+ textAlign: "center"
24
+ },
25
+ children: [
26
+ /* @__PURE__ */ o(r, {
27
+ color: "inherit",
28
+ variant: "subtitle1",
29
+ children: d
30
+ }),
31
+ /* @__PURE__ */ o(r, {
32
+ bold: !0,
33
+ color: "inherit",
34
+ variant: "h1",
35
+ children: i(Number(s ?? "0"), "0,0.00")
36
+ }),
37
+ /* @__PURE__ */ o(r, {
38
+ color: "inherit",
39
+ variant: "caption",
40
+ children: p
41
+ })
42
+ ]
43
+ }), /* @__PURE__ */ e(t, {
44
+ sx: {
45
+ bgcolor: "background.paper",
46
+ px: 16,
47
+ py: 12,
48
+ textAlign: "center"
49
+ },
50
+ children: [/* @__PURE__ */ o(r, {
51
+ variant: "h3",
52
+ children: i(Number(m ?? "0"), "0,0.00")
53
+ }), /* @__PURE__ */ o(r, {
54
+ color: "text.secondary",
32
55
  variant: "caption",
33
- children: a
34
- })
35
- ]
36
- }), /* @__PURE__ */ o(t, {
37
- sx: {
38
- bgcolor: "background.paper",
39
- px: 16,
40
- py: 12,
41
- textAlign: "center"
42
- },
43
- children: [/* @__PURE__ */ e(r, {
44
- variant: "h3",
45
- children: c
46
- }), /* @__PURE__ */ e(r, {
47
- color: "text.secondary",
48
- variant: "caption",
49
- children: s
56
+ children: x
57
+ })]
50
58
  })]
51
- })]
52
- });
59
+ });
60
+ };
53
61
  export {
54
- u as default
62
+ C as default
55
63
  };
56
64
 
57
65
  //# sourceMappingURL=SaveAnExtraCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SaveAnExtraCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SaveAnExtraCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { getLogoElevation } from './logoShadow'\n\ninterface SaveAnExtraCardProps {\n /** Subtitle label in the green header (e.g. \"Save an extra\"). */\n title: string\n /** Large amount in the green header (e.g. \"$100.00\"). */\n amount: string\n /** Small caption under the header amount (e.g. \"to help your funds grow\"). */\n description: string\n /** Large amount in the white footer (e.g. \"$3,320.00\"). */\n footerAmount: string\n /** Small caption under the footer amount (e.g. \"After payday & projected expenses\"). */\n footerDescription: string\n /** Header surface color token. Default `success.main` (green). */\n bgcolor?: string\n sx?: SxProps<Theme>\n}\n\n/**\n * Save an Extra content: a green header (\"Save an extra\" / amount / caption)\n * over a white footer (projected amount / caption), wrapped in a rounded,\n * green-outlined card. Mirrors the v1 `SaveAnExtra100` structure with\n * theme-aware tokens so it flips correctly in dark mode.\n *\n * Figma: Save an Extra $100 Content (Full variant). Scope is the Content\n * section only.\n */\nconst SaveAnExtraCard = ({\n title,\n amount,\n description,\n footerAmount,\n footerDescription,\n bgcolor = 'success.main',\n sx,\n}: SaveAnExtraCardProps) => {\n return (\n <Box\n sx={{\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: 2,\n boxShadow: getLogoElevation,\n overflow: 'hidden',\n ...sx,\n }}\n >\n {/* Green header */}\n <Box\n sx={{\n bgcolor,\n color: 'success.contrastText',\n p: 16,\n pt: 12,\n textAlign: 'center',\n }}\n >\n <Text variant=\"subtitle1\">{title}</Text>\n <Text variant=\"h1\">{amount}</Text>\n <Text variant=\"caption\">{description}</Text>\n </Box>\n\n {/* White footer with projected amount */}\n <Box sx={{ bgcolor: 'background.paper', px: 16, py: 12, textAlign: 'center' }}>\n <Text variant=\"h3\">{footerAmount}</Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {footerDescription}\n </Text>\n </Box>\n </Box>\n )\n}\n\nexport default SaveAnExtraCard\n"],"mappings":";;;;AAgCA,IAAM,IAAA,CAAmB,EACvB,OAAA,GACA,QAAA,GACA,aAAA,GACA,cAAA,GACA,mBAAA,GACA,SAAA,IAAU,gBACV,IAAA,EAAA,MAGE,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IACF,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,cAAc;AAAA,IACd,WAAW;AAAA,IACX,UAAU;AAAA,IACV,GAAG;AAAA,EACL;AAAA,EARF,UAAA,CAWE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,SAAA;AAAA,MACA,OAAO;AAAA,MACP,GAAG;AAAA,MACH,IAAI;AAAA,MACJ,WAAW;AAAA,IACb;AAAA,IAPF,UAAA;AAAA,MASE,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QAAa,UAAA;AAAA,MAAY,CAAA;AAAA,MACvC,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QAAM,UAAA;AAAA,MAAa,CAAA;AAAA,MACjC,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QAAW,UAAA;AAAA,MAAkB,CAAA;AAAA,IACxC;AAAA,EAGL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,IAAK,IAAI;AAAA,MAAE,SAAS;AAAA,MAAoB,IAAI;AAAA,MAAI,IAAI;AAAA,MAAI,WAAW;AAAA,IAAS;AAAA,IAA5E,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MAAM,SAAQ;AAAA,MAAM,UAAA;AAAA,IAAmB,CAAA,GACvC,gBAAA,EAAC,GAAD;AAAA,MAAM,OAAM;AAAA,MAAiB,SAAQ;AAAA,MAClC,UAAA;AAAA,IACG,CAAA,CACH;AAAA,EACF,CAAA,CAAA"}
1
+ {"version":3,"file":"SaveAnExtraCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SaveAnExtraCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\nimport { getLogoElevation } from './logoShadow'\n\ninterface SaveAnExtraCardProps {\n primaryText?: string[]\n secondaryText?: string[]\n bgcolor?: string\n sx?: SxProps<Theme>\n}\n\nconst SaveAnExtraCard = ({\n primaryText = [],\n secondaryText = [],\n bgcolor = 'success.main',\n sx,\n}: SaveAnExtraCardProps) => {\n const [leadIn, amount, trailingCopy] = primaryText\n const [projected, projectedCaption] = secondaryText\n\n return (\n <Box\n sx={{\n border: '1px solid',\n borderColor: 'success.main',\n borderRadius: 2,\n boxShadow: getLogoElevation,\n overflow: 'hidden',\n ...sx,\n }}\n >\n {/* Green header */}\n <Box\n sx={{\n bgcolor,\n color: 'success.contrastText',\n p: 16,\n pt: 12,\n textAlign: 'center',\n }}\n >\n <Text color=\"inherit\" variant=\"subtitle1\">\n {leadIn}\n </Text>\n <Text bold={true} color=\"inherit\" variant=\"h1\">\n {formatCurrency(Number(amount ?? '0'), '0,0.00')}\n </Text>\n <Text color=\"inherit\" variant=\"caption\">\n {trailingCopy}\n </Text>\n </Box>\n\n {/* White footer with projected amount */}\n <Box sx={{ bgcolor: 'background.paper', px: 16, py: 12, textAlign: 'center' }}>\n <Text variant=\"h3\">{formatCurrency(Number(projected ?? '0'), '0,0.00')}</Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {projectedCaption}\n </Text>\n </Box>\n </Box>\n )\n}\n\nexport default SaveAnExtraCard\n"],"mappings":";;;;;AAgBA,IAAM,IAAA,CAAmB,EACvB,aAAA,IAAc,CAAC,GACf,eAAA,IAAgB,CAAC,GACjB,SAAA,IAAU,gBACV,IAAA,EAAA,MAC0B;AAC1B,QAAM,CAAC,GAAQ,GAAQ,CAAA,IAAgB,GACjC,CAAC,GAAW,CAAA,IAAoB;AAEtC,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,QAAQ;AAAA,MACR,aAAa;AAAA,MACb,cAAc;AAAA,MACd,WAAW;AAAA,MACX,UAAU;AAAA,MACV,GAAG;AAAA,IACL;AAAA,IARF,UAAA,CAWE,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,SAAA;AAAA,QACA,OAAO;AAAA,QACP,GAAG;AAAA,QACH,IAAI;AAAA,QACJ,WAAW;AAAA,MACb;AAAA,MAPF,UAAA;AAAA,QASE,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAU,SAAQ;AAAA,UAC3B,UAAA;AAAA,QACG,CAAA;AAAA,QACN,gBAAA,EAAC,GAAD;AAAA,UAAM,MAAM;AAAA,UAAM,OAAM;AAAA,UAAU,SAAQ;AAAA,UACvC,UAAA,EAAe,OAAO,KAAU,GAAG,GAAG,QAAQ;AAAA,QAC3C,CAAA;AAAA,QACN,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAU,SAAQ;AAAA,UAC3B,UAAA;AAAA,QACG,CAAA;AAAA,MACH;AAAA,IAGL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MAAK,IAAI;AAAA,QAAE,SAAS;AAAA,QAAoB,IAAI;AAAA,QAAI,IAAI;AAAA,QAAI,WAAW;AAAA,MAAS;AAAA,MAA5E,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QAAM,UAAA,EAAe,OAAO,KAAa,GAAG,GAAG,QAAQ;AAAA,MAAQ,CAAA,GAC7E,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAiB,SAAQ;AAAA,QAClC,UAAA;AAAA,MACG,CAAA,CACH;AAAA,IACF,CAAA,CAAA;AAAA;AAET"}
@@ -13,16 +13,16 @@ var h = 200, v = 130, b = (r) => r || null, c = (r, o) => {
13
13
  }
14
14
  });
15
15
  }, E = ({ divProps: r, image: o, isMini: n = !1 }) => {
16
- const e = d(), t = u(null), l = {
17
- 100: e.palette.primary.lighter,
18
- 200: e.palette.primary.light,
19
- 300: e.palette.primary.main,
20
- 400: e.palette.primary.dark,
21
- 500: e.palette.primary.darker
22
- };
16
+ const e = d(), t = u(null);
23
17
  return y(() => {
24
18
  if (!t.current) return;
25
- const a = t.current, m = a.querySelectorAll(".Overlay");
19
+ const l = t.current, a = {
20
+ 100: e.palette.primary.lighter,
21
+ 200: e.palette.primary.light,
22
+ 300: e.palette.primary.main,
23
+ 400: e.palette.primary.dark,
24
+ 500: e.palette.primary.darker
25
+ }, m = l.querySelectorAll(".Overlay");
26
26
  [
27
27
  "brand100",
28
28
  "brand200",
@@ -30,10 +30,10 @@ var h = 200, v = 130, b = (r) => r || null, c = (r, o) => {
30
30
  "brand400",
31
31
  "brand500"
32
32
  ].forEach((i) => {
33
- const f = a.querySelectorAll(`.${i}`), p = i.replace("brand", "");
34
- c(f, l[p]);
35
- }), c(m, l[300]);
36
- }, [l]), /* @__PURE__ */ s("div", {
33
+ const f = l.querySelectorAll(`.${i}`), p = i.replace("brand", "");
34
+ c(f, a[p]);
35
+ }), c(m, a[300]);
36
+ }, [e]), /* @__PURE__ */ s("div", {
37
37
  style: {
38
38
  maxWidth: n ? v : h,
39
39
  width: "100%"
@@ -1 +1 @@
1
- {"version":3,"file":"ThemedSVGImage.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/ThemedSVGImage.tsx"],"sourcesContent":["/* eslint-disable react/jsx-pascal-case */\n\nimport { useEffect, useRef } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport type { ThemedSVGImageProps } from '../../../core'\n\nconst MAX_SVG_WIDTH = 200\nconst MINI_SVG_WIDTH = 130\n\n// Utility function to get an SVG element from a DOM node\nconst getSVGElement = (element: Element | null): SVGElement | null => {\n return element ? (element as SVGElement) : null\n}\n\n// Utility function to apply color to SVG elements\nconst applyColorToSVG = (elements: NodeListOf<Element>, color: string) => {\n elements.forEach((element) => {\n const svgElement = getSVGElement(element)\n if (svgElement) {\n const strokeAttr = svgElement.getAttribute('stroke')\n const fillAttr = svgElement.getAttribute('fill')\n\n if (strokeAttr && strokeAttr !== 'white') {\n svgElement.style.setProperty('stroke', color)\n }\n\n if (fillAttr) {\n const fillColor = fillAttr === 'white' ? 'white' : color\n svgElement.style.setProperty('fill', fillColor)\n }\n }\n })\n}\n\nexport const ThemedSVGImage = ({ divProps, image: SVG, isMini = false }: ThemedSVGImageProps) => {\n const theme = useTheme()\n const containerRef = useRef<SVGSVGElement | null>(null)\n\n const colors = {\n '100': (theme as any).palette.primary.lighter,\n '200': theme.palette.primary.light,\n '300': theme.palette.primary.main,\n '400': theme.palette.primary.dark,\n '500': (theme as any).palette.primary.darker,\n }\n\n // If the client does not have a color scheme aka widget brand color, set the colors to the primary kyper token colors\n // Apply color scheme to SVG elements when component mounts or colors change\n useEffect(() => {\n if (!containerRef.current) return\n\n const container = containerRef.current\n\n const overlayElements = container.querySelectorAll('.Overlay')\n const brandElements = ['brand100', 'brand200', 'brand300', 'brand400', 'brand500']\n\n brandElements.forEach((className) => {\n const elements = container.querySelectorAll(`.${className}`)\n const colorKey = className.replace('brand', '') as keyof typeof colors\n applyColorToSVG(elements, colors[colorKey])\n })\n\n // Apply the color for overlays separately (using the 300 color scheme)\n applyColorToSVG(overlayElements, colors['300'])\n }, [colors])\n\n return (\n <div\n style={{\n maxWidth: isMini ? MINI_SVG_WIDTH : MAX_SVG_WIDTH,\n width: '100%',\n }}\n {...divProps}\n >\n <SVG ref={containerRef} />\n </div>\n )\n}\n"],"mappings":";;;AAOA,IAAM,IAAgB,KAChB,IAAiB,KAGjB,IAAA,CAAiB,MACd,KAAoC,MAIvC,IAAA,CAAmB,GAA+B,MAAkB;AACxE,EAAA,EAAS,QAAA,CAAS,MAAY;AAC5B,UAAM,IAAa,EAAc,CAAO;AACxC,QAAI,GAAY;AACd,YAAM,IAAa,EAAW,aAAa,QAAQ,GAC7C,IAAW,EAAW,aAAa,MAAM;AAM/C,UAJI,KAAc,MAAe,WAC/B,EAAW,MAAM,YAAY,UAAU,CAAK,GAG1C,GAAU;AACZ,cAAM,IAAY,MAAa,UAAU,UAAU;AACnD,QAAA,EAAW,MAAM,YAAY,QAAQ,CAAS;AAAA,MAChD;AAAA,IACF;AAAA,EACF,CAAC;AACH,GAEa,IAAA,CAAkB,EAAE,UAAA,GAAU,OAAO,GAAK,QAAA,IAAS,GAAA,MAAiC;AAC/F,QAAM,IAAQ,EAAS,GACjB,IAAe,EAA6B,IAAI,GAEhD,IAAS;AAAA,IACb,KAAQ,EAAc,QAAQ,QAAQ;AAAA,IACtC,KAAO,EAAM,QAAQ,QAAQ;AAAA,IAC7B,KAAO,EAAM,QAAQ,QAAQ;AAAA,IAC7B,KAAO,EAAM,QAAQ,QAAQ;AAAA,IAC7B,KAAQ,EAAc,QAAQ,QAAQ;AAAA,EACxC;AAIA,SAAA,EAAA,MAAgB;AACd,QAAI,CAAC,EAAa,QAAS;AAE3B,UAAM,IAAY,EAAa,SAEzB,IAAkB,EAAU,iBAAiB,UAAU;AAG7D;AAAA,MAFuB;AAAA,MAAY;AAAA,MAAY;AAAA,MAAY;AAAA,MAAY;AAAA,IAEvE,EAAc,QAAA,CAAS,MAAc;AACnC,YAAM,IAAW,EAAU,iBAAiB,IAAI,CAAA,EAAW,GACrD,IAAW,EAAU,QAAQ,SAAS,EAAE;AAC9C,MAAA,EAAgB,GAAU,EAAO,CAAA,CAAS;AAAA,IAC5C,CAAC,GAGD,EAAgB,GAAiB,EAAO,GAAA,CAAM;AAAA,EAChD,GAAG,CAAC,CAAM,CAAC,GAGT,gBAAA,EAAC,OAAD;AAAA,IACE,OAAO;AAAA,MACL,UAAU,IAAS,IAAiB;AAAA,MACpC,OAAO;AAAA,IACT;AAAA,IACA,GAAI;AAAA,IAEJ,UAAA,gBAAA,EAAC,GAAD,EAAK,KAAK,EAAe,CAAA;AAAA,EACtB,CAAA;AAET"}
1
+ {"version":3,"file":"ThemedSVGImage.es.js","names":[],"sources":["../../../../src/insights-v2/components/chartblocks/ThemedSVGImage.tsx"],"sourcesContent":["/* eslint-disable react/jsx-pascal-case */\n\nimport { useEffect, useRef } from 'react'\n\nimport { useTheme } from '@mui/material/styles'\nimport type { ThemedSVGImageProps } from '../../../core'\n\nconst MAX_SVG_WIDTH = 200\nconst MINI_SVG_WIDTH = 130\n\n// Utility function to get an SVG element from a DOM node\nconst getSVGElement = (element: Element | null): SVGElement | null => {\n return element ? (element as SVGElement) : null\n}\n\n// Utility function to apply color to SVG elements\nconst applyColorToSVG = (elements: NodeListOf<Element>, color: string) => {\n elements.forEach((element) => {\n const svgElement = getSVGElement(element)\n if (svgElement) {\n const strokeAttr = svgElement.getAttribute('stroke')\n const fillAttr = svgElement.getAttribute('fill')\n\n if (strokeAttr && strokeAttr !== 'white') {\n svgElement.style.setProperty('stroke', color)\n }\n\n if (fillAttr) {\n const fillColor = fillAttr === 'white' ? 'white' : color\n svgElement.style.setProperty('fill', fillColor)\n }\n }\n })\n}\n\nexport const ThemedSVGImage = ({ divProps, image: SVG, isMini = false }: ThemedSVGImageProps) => {\n const theme = useTheme()\n const containerRef = useRef<SVGSVGElement | null>(null)\n\n // If the client does not have a color scheme aka widget brand color, set the colors to the primary kyper token colors\n // Apply color scheme to SVG elements when the component mounts or the theme changes.\n // `colors` is derived inside the effect so it isn't a new reference every render.\n useEffect(() => {\n if (!containerRef.current) return\n\n const container = containerRef.current\n\n const colors = {\n '100': (theme as any).palette.primary.lighter,\n '200': theme.palette.primary.light,\n '300': theme.palette.primary.main,\n '400': theme.palette.primary.dark,\n '500': (theme as any).palette.primary.darker,\n }\n\n const overlayElements = container.querySelectorAll('.Overlay')\n const brandElements = ['brand100', 'brand200', 'brand300', 'brand400', 'brand500']\n\n brandElements.forEach((className) => {\n const elements = container.querySelectorAll(`.${className}`)\n const colorKey = className.replace('brand', '') as keyof typeof colors\n applyColorToSVG(elements, colors[colorKey])\n })\n\n // Apply the color for overlays separately (using the 300 color scheme)\n applyColorToSVG(overlayElements, colors['300'])\n }, [theme])\n\n return (\n <div\n style={{\n maxWidth: isMini ? MINI_SVG_WIDTH : MAX_SVG_WIDTH,\n width: '100%',\n }}\n {...divProps}\n >\n <SVG ref={containerRef} />\n </div>\n )\n}\n"],"mappings":";;;AAOA,IAAM,IAAgB,KAChB,IAAiB,KAGjB,IAAA,CAAiB,MACd,KAAoC,MAIvC,IAAA,CAAmB,GAA+B,MAAkB;AACxE,EAAA,EAAS,QAAA,CAAS,MAAY;AAC5B,UAAM,IAAa,EAAc,CAAO;AACxC,QAAI,GAAY;AACd,YAAM,IAAa,EAAW,aAAa,QAAQ,GAC7C,IAAW,EAAW,aAAa,MAAM;AAM/C,UAJI,KAAc,MAAe,WAC/B,EAAW,MAAM,YAAY,UAAU,CAAK,GAG1C,GAAU;AACZ,cAAM,IAAY,MAAa,UAAU,UAAU;AACnD,QAAA,EAAW,MAAM,YAAY,QAAQ,CAAS;AAAA,MAChD;AAAA,IACF;AAAA,EACF,CAAC;AACH,GAEa,IAAA,CAAkB,EAAE,UAAA,GAAU,OAAO,GAAK,QAAA,IAAS,GAAA,MAAiC;AAC/F,QAAM,IAAQ,EAAS,GACjB,IAAe,EAA6B,IAAI;AAKtD,SAAA,EAAA,MAAgB;AACd,QAAI,CAAC,EAAa,QAAS;AAE3B,UAAM,IAAY,EAAa,SAEzB,IAAS;AAAA,MACb,KAAQ,EAAc,QAAQ,QAAQ;AAAA,MACtC,KAAO,EAAM,QAAQ,QAAQ;AAAA,MAC7B,KAAO,EAAM,QAAQ,QAAQ;AAAA,MAC7B,KAAO,EAAM,QAAQ,QAAQ;AAAA,MAC7B,KAAQ,EAAc,QAAQ,QAAQ;AAAA,IACxC,GAEM,IAAkB,EAAU,iBAAiB,UAAU;AAG7D;AAAA,MAFuB;AAAA,MAAY;AAAA,MAAY;AAAA,MAAY;AAAA,MAAY;AAAA,IAEvE,EAAc,QAAA,CAAS,MAAc;AACnC,YAAM,IAAW,EAAU,iBAAiB,IAAI,CAAA,EAAW,GACrD,IAAW,EAAU,QAAQ,SAAS,EAAE;AAC9C,MAAA,EAAgB,GAAU,EAAO,CAAA,CAAS;AAAA,IAC5C,CAAC,GAGD,EAAgB,GAAiB,EAAO,GAAA,CAAM;AAAA,EAChD,GAAG,CAAC,CAAK,CAAC,GAGR,gBAAA,EAAC,OAAD;AAAA,IACE,OAAO;AAAA,MACL,UAAU,IAAS,IAAiB;AAAA,MACpC,OAAO;AAAA,IACT;AAAA,IACA,GAAI;AAAA,IAEJ,UAAA,gBAAA,EAAC,GAAD,EAAK,KAAK,EAAe,CAAA;AAAA,EACtB,CAAA;AAET"}
@@ -1,57 +1,59 @@
1
- import { BAR_CHART_VARIANTS as o, barChartVariant as t, buildChartData as m, buildDataSeries as i } from "./blocks/ChartBlocks/BarchartBlock/utils.es.js";
1
+ import { BAR_CHART_VARIANTS as o, barChartVariant as t, buildChartData as m, buildDataSeries as a } from "./blocks/ChartBlocks/BarchartBlock/utils.es.js";
2
2
  import { BarchartBlock as p } from "./blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
3
3
  import { DoubleBarChartBlock as e } from "./blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js";
4
- import c from "./blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
4
+ import l from "./blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
5
5
  import s from "./blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlock.es.js";
6
6
  import g from "./blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js";
7
- import { BudgetBlock as B } from "./blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
8
- import S from "./components/InsightTransactionRow.es.js";
9
- import k from "./components/TransactionListCard.es.js";
10
- import { CategoryTransactionsBlock as T } from "./blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
11
- import { SVGImageBlock as D } from "./blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
12
- import P from "./components/AccountHeroCard.es.js";
13
- import H from "./components/AmountPill.es.js";
14
- import v from "./components/DesignateEmergencySavingsCard.es.js";
15
- import V from "./components/BaseLayout.es.js";
16
- import E from "./components/StatusMessageCard.es.js";
17
- import _ from "./components/LogoTile.es.js";
18
- import G from "./components/LogoClusterCard.es.js";
19
- import O from "./components/MerchantHighlightCard.es.js";
20
- import j from "./components/P2PLogoStack.es.js";
21
- import z from "./components/SaveAnExtraCard.es.js";
22
- import J from "./components/SavingsOpportunityCard.es.js";
23
- import Q from "./components/StatusPill.es.js";
24
- import X from "./components/SubscriptionHeroCard.es.js";
25
- import Z from "./components/TransferLogoCard.es.js";
26
- import rr from "./components/UpcomingBillCard.es.js";
7
+ import { BudgetBlock as u } from "./blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
8
+ import S from "./components/SaveAnExtraCard.es.js";
9
+ import h from "./blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js";
10
+ import T from "./components/InsightTransactionRow.es.js";
11
+ import D from "./components/TransactionListCard.es.js";
12
+ import { CategoryTransactionsBlock as P } from "./blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
13
+ import { SVGImageBlock as y } from "./blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
14
+ import R from "./components/AccountHeroCard.es.js";
15
+ import E from "./components/AmountPill.es.js";
16
+ import V from "./components/DesignateEmergencySavingsCard.es.js";
17
+ import _ from "./components/BaseLayout.es.js";
18
+ import G from "./components/StatusMessageCard.es.js";
19
+ import O from "./components/LogoTile.es.js";
20
+ import j from "./components/LogoClusterCard.es.js";
21
+ import z from "./components/MerchantHighlightCard.es.js";
22
+ import J from "./components/P2PLogoStack.es.js";
23
+ import Q from "./components/SavingsOpportunityCard.es.js";
24
+ import X from "./components/StatusPill.es.js";
25
+ import Z from "./components/SubscriptionHeroCard.es.js";
26
+ import rr from "./components/TransferLogoCard.es.js";
27
+ import tr from "./components/UpcomingBillCard.es.js";
27
28
  export {
28
29
  g as AccountBlock,
29
- P as AccountHeroCard,
30
- H as AmountPill,
30
+ R as AccountHeroCard,
31
+ E as AmountPill,
31
32
  o as BAR_CHART_VARIANTS,
32
33
  p as BarchartBlock,
33
- V as BaseLayout,
34
- B as BudgetBlock,
35
- T as CategoryTransactionsBlock,
36
- v as DesignateEmergencySavingsCard,
37
- c as DonutChartBlock,
34
+ _ as BaseLayout,
35
+ u as BudgetBlock,
36
+ P as CategoryTransactionsBlock,
37
+ V as DesignateEmergencySavingsCard,
38
+ l as DonutChartBlock,
38
39
  e as DoubleBarChartBlock,
39
40
  s as DoubleProgressBarBlock,
40
- S as InsightTransactionRow,
41
- G as LogoClusterCard,
42
- _ as LogoTile,
43
- O as MerchantHighlightCard,
44
- j as P2PLogoStack,
45
- D as SVGImageBlock,
46
- z as SaveAnExtraCard,
47
- J as SavingsOpportunityCard,
48
- E as StatusMessageCard,
49
- Q as StatusPill,
50
- X as SubscriptionHeroCard,
51
- k as TransactionListCard,
52
- Z as TransferLogoCard,
53
- rr as UpcomingBillCard,
41
+ T as InsightTransactionRow,
42
+ j as LogoClusterCard,
43
+ O as LogoTile,
44
+ z as MerchantHighlightCard,
45
+ J as P2PLogoStack,
46
+ y as SVGImageBlock,
47
+ S as SaveAnExtraCard,
48
+ h as SaveExtraBlock,
49
+ Q as SavingsOpportunityCard,
50
+ G as StatusMessageCard,
51
+ X as StatusPill,
52
+ Z as SubscriptionHeroCard,
53
+ D as TransactionListCard,
54
+ rr as TransferLogoCard,
55
+ tr as UpcomingBillCard,
54
56
  t as barChartVariant,
55
57
  m as buildChartData,
56
- i as buildDataSeries
58
+ a as buildDataSeries
57
59
  };
@@ -1,11 +1,12 @@
1
- import { Beat, InsightsPayload } from '../../core';
1
+ import { Beat, GlobalCopy, InsightsPayload } from '../../core';
2
2
  export interface ActionBlockProps {
3
3
  beat: Beat;
4
4
  }
5
+ export declare const hasDrawerBlock: (block?: string | null) => boolean;
5
6
  export interface ActionBlockEntry {
6
7
  Component: React.ComponentType<ActionBlockProps>;
7
8
  usePrepare: (props: ActionBlockProps) => void;
8
- title: string;
9
+ title?: (variant: string | null | undefined, copy: GlobalCopy) => string;
9
10
  }
10
11
  export declare const actionBlocks: Record<string, ActionBlockEntry>;
11
12
  export declare const blocks: Record<string, React.ComponentType<{
@@ -1,34 +1,53 @@
1
- import { BarchartBlock as o } from "../blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
2
- import { DoubleBarChartBlock as r } from "../blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js";
3
- import t from "../blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
4
- import c from "../blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlock.es.js";
5
- import l from "../blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js";
6
- import { BudgetBlock as m } from "../blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
7
- import { CategoryTransactionsBlock as a } from "../blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
8
- import B from "../blocks/ImageBlocks/ImageBlock.es.js";
9
- import { SVGImageBlock as e } from "../blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
10
- import i from "../blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js";
11
- import { PlaceholderActionBlock as k } from "../blocks/ComponentBlocks/ActionBlock/PlaceholderActionBlock.es.js";
12
- var p = (n) => {
13
- }, v = { PlaceholderActionBlock: {
14
- Component: k,
15
- usePrepare: p,
16
- title: "Action Block Layer Drilldown"
17
- } }, y = {
18
- AccountBlock: l,
19
- BarChartBlock: o,
20
- BudgetBlock: m,
21
- CategoryTransactionsBlock: a,
22
- DonutChartBlock: t,
23
- DoubleBarChartBlock: r,
24
- DoubleProgressBarBlock: c,
25
- ImageBlock: B,
26
- StepChartBlock: i,
27
- SVGImageBlock: e
1
+ import { BarchartBlock as e } from "../blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js";
2
+ import { DoubleBarChartBlock as a } from "../blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js";
3
+ import m from "../blocks/ChartBlocks/DonutChartBlock/DonutChartBlock.es.js";
4
+ import l from "../blocks/ChartBlocks/DoubleProgressBarBlock/DoubleProgressBarBlock.es.js";
5
+ import c from "../blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js";
6
+ import { BudgetBlock as i } from "../blocks/ComponentBlocks/BudgetBlock/BudgetBlock.es.js";
7
+ import n from "../blocks/ComponentBlocks/SaveExtraBlock/SaveExtraBlock.es.js";
8
+ import { CategoryTransactionsBlock as B } from "../blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js";
9
+ import k from "../blocks/ImageBlocks/ImageBlock.es.js";
10
+ import { SVGImageBlock as p } from "../blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js";
11
+ import f from "../blocks/ChartBlocks/StepChartBlock/StepChartBlock.es.js";
12
+ import { PlaceholderActionBlock as s } from "../actionBlocks/PlaceholderActionBlock.es.js";
13
+ import { getMakeTransferDrawerTitle as u } from "../actionBlocks/MakeTransferActionBlock/layout.es.js";
14
+ import { MakeTransferActionBlockLayer as h } from "../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer.es.js";
15
+ var t = (o) => {
16
+ }, C = /* @__PURE__ */ new Set([
17
+ "",
18
+ "null",
19
+ "undefined"
20
+ ]), E = (o) => {
21
+ const r = o?.trim().toLowerCase();
22
+ return !!r && !C.has(r);
23
+ }, I = {
24
+ PlaceholderActionBlock: {
25
+ Component: s,
26
+ usePrepare: t,
27
+ title: () => "Action Block Layer Drilldown"
28
+ },
29
+ make_transfer: {
30
+ Component: h,
31
+ usePrepare: t,
32
+ title: u
33
+ }
34
+ }, M = {
35
+ AccountBlock: c,
36
+ BarChartBlock: e,
37
+ BudgetBlock: i,
38
+ CategoryTransactionsBlock: B,
39
+ DonutChartBlock: m,
40
+ DoubleBarChartBlock: a,
41
+ DoubleProgressBarBlock: l,
42
+ ImageBlock: k,
43
+ save_extra_block: n,
44
+ StepChartBlock: f,
45
+ SVGImageBlock: p
28
46
  };
29
47
  export {
30
- v as actionBlocks,
31
- y as blocks
48
+ I as actionBlocks,
49
+ M as blocks,
50
+ E as hasDrawerBlock
32
51
  };
33
52
 
34
53
  //# sourceMappingURL=blocks.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"blocks.es.js","names":[],"sources":["../../../src/insights-v2/mappings/blocks.ts"],"sourcesContent":["import {\n AccountBlock,\n BarchartBlock,\n BudgetBlock,\n CategoryTransactionsBlock,\n DonutChartBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n SVGImageBlock,\n} from '../blocks'\nimport StepChartBlock from '../blocks/ChartBlocks/StepChartBlock'\nimport ImageBlock from '../blocks/ImageBlocks/ImageBlock'\n\nimport type { Beat, InsightsPayload } from '../../core'\nimport { PlaceholderActionBlock } from '../blocks/ComponentBlocks/ActionBlock/PlaceholderActionBlock'\n\n// Drilldown indexes are not passed down: action blocks read them from\n// InsightsV2Store (useInsightsV2Store().actionDrawer).\nexport interface ActionBlockProps {\n beat: Beat\n}\n\nconst noop = (_: ActionBlockProps) => {}\nexport interface ActionBlockEntry {\n Component: React.ComponentType<ActionBlockProps>\n usePrepare: (props: ActionBlockProps) => void // required; default to noop in each entry\n title: string\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends\n// on a beat's CTA. To add one: create a component taking ActionBlockProps,\n// read the clicked indexes from useInsightsV2Store().actionDrawer, and\n// register it here. Add\n// `usePrepare` when the block needs to load data before rendering.\nexport const actionBlocks = {\n PlaceholderActionBlock: {\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: 'Action Block Layer Drilldown',\n },\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n AccountBlock: AccountBlock,\n BarChartBlock: BarchartBlock,\n BudgetBlock: BudgetBlock,\n CategoryTransactionsBlock: CategoryTransactionsBlock,\n DonutChartBlock: DonutChartBlock,\n DoubleBarChartBlock: DoubleBarChartBlock,\n DoubleProgressBarBlock: DoubleProgressBarBlock,\n ImageBlock: ImageBlock,\n StepChartBlock: StepChartBlock,\n SVGImageBlock: SVGImageBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;AAsBA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GAY1B,IAAe,EAC1B,wBAAwB;AAAA,EACtB,WAAW;AAAA,EACX,YAAY;AAAA,EACZ,OAAO;AACT,EACF,GAEa,IAAS;AAAA,EACN,cAAA;AAAA,EACd,eAAe;AAAA,EACF,aAAA;AAAA,EACc,2BAAA;AAAA,EACV,iBAAA;AAAA,EACI,qBAAA;AAAA,EACG,wBAAA;AAAA,EACZ,YAAA;AAAA,EACI,gBAAA;AAAA,EACD,eAAA;AACjB"}
1
+ {"version":3,"file":"blocks.es.js","names":[],"sources":["../../../src/insights-v2/mappings/blocks.ts"],"sourcesContent":["import {\n AccountBlock,\n BarchartBlock,\n BudgetBlock,\n CategoryTransactionsBlock,\n DonutChartBlock,\n DoubleBarChartBlock,\n DoubleProgressBarBlock,\n SaveExtraBlock,\n SVGImageBlock,\n} from '../blocks'\nimport StepChartBlock from '../blocks/ChartBlocks/StepChartBlock'\nimport ImageBlock from '../blocks/ImageBlocks/ImageBlock'\n\nimport type { Beat, GlobalCopy, InsightsPayload } from '../../core'\nimport { PlaceholderActionBlock } from '../actionBlocks/PlaceholderActionBlock'\nimport { MakeTransferActionBlockLayer } from '../actionBlocks/MakeTransferActionBlock/MakeTransferActionBlockLayer'\nimport { getMakeTransferDrawerTitle } from '../actionBlocks/MakeTransferActionBlock/layout'\n\n// Drilldown indexes are not passed down: action blocks read them from\n// InsightsV2Store (useInsightsV2Store().actionDrawer).\nexport interface ActionBlockProps {\n beat: Beat\n}\n\nconst noop = (_: ActionBlockProps) => {}\n\n// A CTA opens a drawer only when it carries a real `block`. The backend may send\n// an empty/absent block (or the literal strings \"null\"/\"undefined\") for CTAs\n// that trigger something else (e.g. a postMessage) instead of a drilldown.\nconst NON_BLOCK_VALUES = new Set(['', 'null', 'undefined'])\nexport const hasDrawerBlock = (block?: string | null): boolean => {\n const normalized = block?.trim().toLowerCase()\n return !!normalized && !NON_BLOCK_VALUES.has(normalized)\n}\n\nexport interface ActionBlockEntry {\n Component: React.ComponentType<ActionBlockProps>\n usePrepare: (props: ActionBlockProps) => void // required; default to noop in each entry\n // Resolves the drawer title from the clicked CTA's variant + copy (e.g.\n // MakeTransfer reads its variant title from layout.ts). Falls back to the CTA label.\n title?: (variant: string | null | undefined, copy: GlobalCopy) => string\n}\n\n// Registry of drawer drilldowns, keyed by the `block` name the backend sends\n// on a beat's CTA. To add one: create a component taking ActionBlockProps,\n// read the clicked indexes from useInsightsV2Store().actionDrawer, and\n// register it here. Add\n// `usePrepare` when the block needs to load data before rendering.\nexport const actionBlocks = {\n PlaceholderActionBlock: {\n Component: PlaceholderActionBlock,\n usePrepare: noop,\n title: () => 'Action Block Layer Drilldown',\n },\n make_transfer: {\n Component: MakeTransferActionBlockLayer,\n usePrepare: noop,\n title: getMakeTransferDrawerTitle,\n },\n} as Record<string, ActionBlockEntry>\n\nexport const blocks = {\n AccountBlock: AccountBlock,\n BarChartBlock: BarchartBlock,\n BudgetBlock: BudgetBlock,\n CategoryTransactionsBlock: CategoryTransactionsBlock,\n DonutChartBlock: DonutChartBlock,\n DoubleBarChartBlock: DoubleBarChartBlock,\n DoubleProgressBarBlock: DoubleProgressBarBlock,\n ImageBlock: ImageBlock,\n save_extra_block: SaveExtraBlock,\n StepChartBlock: StepChartBlock,\n SVGImageBlock: SVGImageBlock,\n} as Record<string, React.ComponentType<{ payload: InsightsPayload; beatGuid?: string }>>\n"],"mappings":";;;;;;;;;;;;;;AAyBA,IAAM,IAAA,CAAQ,MAAwB;AAAC,GAKjC,IAAmB,oBAAI,IAAI;AAAA,EAAC;AAAA,EAAI;AAAA,EAAQ;AAAW,CAAC,GAC7C,IAAA,CAAkB,MAAmC;AAChE,QAAM,IAAa,GAAO,KAAK,EAAE,YAAY;AAC7C,SAAO,CAAC,CAAC,KAAc,CAAC,EAAiB,IAAI,CAAU;AACzD,GAea,IAAe;AAAA,EAC1B,wBAAwB;AAAA,IACtB,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAA,MAAa;AAAA,EACf;AAAA,EACA,eAAe;AAAA,IACb,WAAW;AAAA,IACX,YAAY;AAAA,IACZ,OAAO;AAAA,EACT;AACF,GAEa,IAAS;AAAA,EACN,cAAA;AAAA,EACd,eAAe;AAAA,EACF,aAAA;AAAA,EACc,2BAAA;AAAA,EACV,iBAAA;AAAA,EACI,qBAAA;AAAA,EACG,wBAAA;AAAA,EACZ,YAAA;AAAA,EACZ,kBAAkB;AAAA,EACF,gBAAA;AAAA,EACD,eAAA;AACjB"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "9.4.7",
3
+ "version": "9.4.8",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -1,41 +0,0 @@
1
- import { useGlobalCopyStore as d, useGlobalUiStore as f, useInsightsV2Store as C } from "../../../../common/context/hooks.es.js";
2
- import m from "../../../../common/components/drawer/Drawer.es.js";
3
- import y from "../../../../common/components/Loader.es.js";
4
- import { actionBlocks as g } from "../../../mappings/blocks.es.js";
5
- import { observer as h } from "mobx-react-lite";
6
- import _ from "@mui/material/Stack";
7
- import { Text as k } from "@mxenabled/mxui";
8
- import { jsx as o } from "react/jsx-runtime";
9
- var B = ({ actionBlock: c, ...r }) => {
10
- const { Component: e, usePrepare: t } = c;
11
- return t(r), /* @__PURE__ */ o(e, { ...r });
12
- }, v = h(function({ beat: r }) {
13
- const { common: e } = d(), { isCopyLoaded: t } = f(), { actionDrawer: n, closeActionDrawer: s } = C(), i = n.isDrawerOpen && n.guid === r.guid;
14
- if (!t) return i ? /* @__PURE__ */ o(y, {}) : null;
15
- if (!r.insights_payload) return null;
16
- const { primary_cta: p, secondary_cta: u } = r.insights_payload, l = n.trigger === "secondaryCta" ? u : p, a = g[l?.block];
17
- return a ? /* @__PURE__ */ o(m, {
18
- ariaLabelClose: e.close_aria,
19
- isOpen: i,
20
- onClose: s,
21
- title: a.title,
22
- children: /* @__PURE__ */ o(B, {
23
- actionBlock: a,
24
- beat: r
25
- }, l?.block)
26
- }) : /* @__PURE__ */ o(m, {
27
- ariaLabelClose: e.close_aria,
28
- isOpen: i,
29
- onClose: s,
30
- title: e.error_heading,
31
- children: /* @__PURE__ */ o(_, {
32
- sx: { p: 24 },
33
- children: /* @__PURE__ */ o(k, { children: e.error_message })
34
- })
35
- });
36
- });
37
- export {
38
- v as ActionBlockLayer
39
- };
40
-
41
- //# sourceMappingURL=ActionBlockLayer.es.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ActionBlockLayer.es.js","names":[],"sources":["../../../../../src/insights-v2/blocks/ComponentBlocks/ActionBlock/ActionBlockLayer.tsx"],"sourcesContent":["import Stack from '@mui/material/Stack'\n\nimport { Text } from '@mxenabled/mxui'\nimport { observer } from 'mobx-react-lite'\n\nimport {\n Drawer,\n Loader,\n useGlobalCopyStore,\n useGlobalUiStore,\n useInsightsV2Store,\n} from '../../../../common'\nimport { type Beat } from '../../../../core'\nimport {\n actionBlocks,\n type ActionBlockEntry,\n type ActionBlockProps,\n} from '../../../mappings/blocks'\n\ninterface ActionBlockLayerProps {\n beat: Beat\n}\n\n/**\n * Renders a registered action block. Callers MUST key this per block name — a\n * block with `usePrepare` and one without run a different number of hooks, so\n * reusing the same fiber across a block switch violates the rules of hooks.\n */\nconst ActionBlockRunner = ({\n actionBlock,\n ...blockProps\n}: ActionBlockProps & { actionBlock: ActionBlockEntry }) => {\n const { Component, usePrepare } = actionBlock\n\n usePrepare(blockProps)\n\n return <Component {...blockProps} />\n}\n\n// `observer` is required: this reads `isCopyLoaded` off GlobalUiStore and the\n// action drawer off InsightsV2Store. Without it the component never re-renders\n// and stays stuck on <Loader /> forever.\nexport const ActionBlockLayer = observer(function ActionBlockLayer({\n beat,\n}: ActionBlockLayerProps) {\n const { common: commonCopy } = useGlobalCopyStore()\n const { isCopyLoaded } = useGlobalUiStore()\n const { actionDrawer, closeActionDrawer } = useInsightsV2Store()\n\n // Every card in the feed renders its own layer against the shared store, so\n // this card's drawer only opens when its beat is the one that triggered it.\n const isCurrentBeatOpen = actionDrawer.isDrawerOpen && actionDrawer.guid === beat.guid\n\n if (!isCopyLoaded) return isCurrentBeatOpen ? <Loader /> : null\n\n // Mirrors BaseLayout's guard — the layer is exported, so callers are not\n // guaranteed to have narrowed this already.\n if (!beat.insights_payload) return null\n\n const { primary_cta, secondary_cta } = beat.insights_payload\n\n const currentCta = actionDrawer.trigger === 'secondaryCta' ? secondary_cta : primary_cta\n const actionBlock = actionBlocks[currentCta?.block as keyof typeof actionBlocks]\n\n if (!actionBlock) {\n return (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isCurrentBeatOpen}\n onClose={closeActionDrawer}\n title={commonCopy.error_heading}\n >\n <Stack sx={{ p: 24 }}>\n <Text>{commonCopy.error_message}</Text>\n </Stack>\n </Drawer>\n )\n }\n\n return (\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={isCurrentBeatOpen}\n onClose={closeActionDrawer}\n title={actionBlock.title}\n >\n <ActionBlockRunner actionBlock={actionBlock} beat={beat} key={currentCta?.block} />\n </Drawer>\n )\n})\n"],"mappings":";;;;;;;;AA4BA,IAAM,IAAA,CAAqB,EACzB,aAAA,GACA,GAAG,EAAA,MACuD;AAC1D,QAAM,EAAE,WAAA,GAAW,YAAA,EAAA,IAAe;AAElC,SAAA,EAAW,CAAU,GAEd,gBAAA,EAAC,GAAD,EAAW,GAAI,EAAa,CAAA;AACrC,GAKa,IAAmB,EAAS,SAA0B,EACjE,MAAA,EAAA,GACwB;AACxB,QAAM,EAAE,QAAQ,EAAA,IAAe,EAAmB,GAC5C,EAAE,cAAA,EAAA,IAAiB,EAAiB,GACpC,EAAE,cAAA,GAAc,mBAAA,EAAA,IAAsB,EAAmB,GAIzD,IAAoB,EAAa,gBAAgB,EAAa,SAAS,EAAK;AAElF,MAAI,CAAC,EAAc,QAAO,IAAoB,gBAAA,EAAC,GAAD,CAAS,CAAA,IAAI;AAI3D,MAAI,CAAC,EAAK,iBAAkB,QAAO;AAEnC,QAAM,EAAE,aAAA,GAAa,eAAA,EAAA,IAAkB,EAAK,kBAEtC,IAAa,EAAa,YAAY,iBAAiB,IAAgB,GACvE,IAAc,EAAa,GAAY,KAAA;AAE7C,SAAK,IAgBH,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,EAAW;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO,EAAY;AAAA,IAEnB,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAgC,aAAA;AAAA,MAAmB,MAAA;AAAA,IAA+B,GAApB,GAAY,KAAQ;AAAA,EAC5E,CAAA,IArBN,gBAAA,EAAC,GAAD;AAAA,IACE,gBAAgB,EAAW;AAAA,IAC3B,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,OAAO,EAAW;AAAA,IAElB,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI,EAAE,GAAG,GAAG;AAAA,MACjB,UAAA,gBAAA,EAAC,GAAD,EAAA,UAAO,EAAW,cAAoB,CAAA;AAAA,IACjC,CAAA;AAAA,EACD,CAAA;AAcd,CAAC"}