@mx-cartographer/experiences 9.7.74 → 9.7.76

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 (65) hide show
  1. package/CHANGELOG.md +12 -0
  2. package/dist/core/types/Insights.d.ts +2 -7
  3. package/dist/core/types/Insights.es.js.map +1 -1
  4. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +37 -37
  5. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
  6. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +10 -0
  7. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +12 -7
  8. package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
  9. package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js +28 -20
  10. package/dist/insights-v2/actionBlocks/SurveyModalActionBlock.es.js.map +1 -1
  11. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +11 -11
  12. package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/useTransactionHistoryPrepare.es.js +3 -3
  13. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.d.ts +7 -14
  14. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +11 -27
  15. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
  16. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +75 -68
  17. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
  18. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +4 -1
  19. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +2 -1
  20. package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
  21. package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +4 -4
  22. package/dist/insights-v2/components/BaseLayout.es.js +40 -40
  23. package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
  24. package/dist/insights-v2/components/CtaStatus.d.ts +2 -2
  25. package/dist/insights-v2/components/CtaStatus.es.js +23 -14
  26. package/dist/insights-v2/components/CtaStatus.es.js.map +1 -1
  27. package/dist/insights-v2/components/FeedbackDialog.d.ts +3 -1
  28. package/dist/insights-v2/components/FeedbackDialog.es.js +28 -28
  29. package/dist/insights-v2/components/FeedbackDialog.es.js.map +1 -1
  30. package/dist/insights-v2/components/FeedbackModal.d.ts +3 -1
  31. package/dist/insights-v2/components/FeedbackModal.es.js +17 -16
  32. package/dist/insights-v2/components/FeedbackModal.es.js.map +1 -1
  33. package/dist/insights-v2/components/InsightTransactionRow.d.ts +3 -1
  34. package/dist/insights-v2/components/InsightTransactionRow.es.js +36 -19
  35. package/dist/insights-v2/components/InsightTransactionRow.es.js.map +1 -1
  36. package/dist/insights-v2/components/SavingsOpportunityCard.es.js +6 -4
  37. package/dist/insights-v2/components/SavingsOpportunityCard.es.js.map +1 -1
  38. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.d.ts +4 -0
  39. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js +11 -0
  40. package/dist/insights-v2/components/SubscriptionStatus/subscriptionFrequency.es.js.map +1 -0
  41. package/dist/insights-v2/components/SurveyModal.d.ts +5 -1
  42. package/dist/insights-v2/components/SurveyModal.es.js +46 -38
  43. package/dist/insights-v2/components/SurveyModal.es.js.map +1 -1
  44. package/dist/insights-v2/ctaActions/ctaConfig.es.js +19 -11
  45. package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
  46. package/dist/insights-v2/ctaActions/index.d.ts +1 -1
  47. package/dist/insights-v2/ctaActions/runCtaAction.d.ts +5 -1
  48. package/dist/insights-v2/ctaActions/runCtaAction.es.js +4 -4
  49. package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
  50. package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +4 -2
  51. package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +136 -0
  52. package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +1 -0
  53. package/dist/insights-v2/ctaActions/types.d.ts +12 -0
  54. package/dist/insights-v2/ctaActions/useCtaAction.d.ts +4 -1
  55. package/dist/insights-v2/ctaActions/useCtaAction.es.js +33 -33
  56. package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
  57. package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
  58. package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
  59. package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
  60. package/dist/insights-v2/mappings/blocks.es.js +69 -64
  61. package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
  62. package/package.json +1 -1
  63. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.d.ts +0 -18
  64. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js +0 -13
  65. package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js.map +0 -1
@@ -1,8 +1,8 @@
1
1
  import t from "@mui/material/Stack";
2
- import { Text as i } from "@mxenabled/mxui";
3
- import { jsx as r, jsxs as e } from "react/jsx-runtime";
2
+ import { Text as e } from "@mxenabled/mxui";
3
+ import { jsx as r, jsxs as i } from "react/jsx-runtime";
4
4
  import m from "@mui/material/Box";
5
- var f = ({ amount: o, amountColor: a = "text.primary", leading: n, subtitle: l, title: x, sx: c }) => /* @__PURE__ */ e(t, {
5
+ var g = ({ amount: o, amountCaption: n, amountColor: l = "text.primary", leading: a, subtitle: c, title: x, sx: s }) => /* @__PURE__ */ i(t, {
6
6
  sx: {
7
7
  alignItems: "flex-start",
8
8
  flexDirection: "row",
@@ -10,9 +10,9 @@ var f = ({ amount: o, amountColor: a = "text.primary", leading: n, subtitle: l,
10
10
  px: 16,
11
11
  py: 14,
12
12
  width: "100%",
13
- ...c
13
+ ...s
14
14
  },
15
- children: [/* @__PURE__ */ e(t, {
15
+ children: [/* @__PURE__ */ i(t, {
16
16
  sx: {
17
17
  alignItems: "center",
18
18
  flexDirection: "row",
@@ -20,37 +20,54 @@ var f = ({ amount: o, amountColor: a = "text.primary", leading: n, subtitle: l,
20
20
  gap: 12,
21
21
  minWidth: 0
22
22
  },
23
- children: [n && /* @__PURE__ */ r(m, {
23
+ children: [a && /* @__PURE__ */ r(m, {
24
24
  sx: { flexShrink: 0 },
25
- children: n
26
- }), /* @__PURE__ */ e(t, {
25
+ children: a
26
+ }), /* @__PURE__ */ i(t, {
27
27
  sx: { minWidth: 0 },
28
- children: [/* @__PURE__ */ r(i, {
28
+ children: [/* @__PURE__ */ r(e, {
29
29
  bold: !0,
30
30
  truncate: !0,
31
31
  variant: "body1",
32
32
  children: x
33
- }), /* @__PURE__ */ r(i, {
33
+ }), /* @__PURE__ */ r(e, {
34
34
  color: "text.primary",
35
35
  truncate: !0,
36
36
  variant: "caption",
37
- children: l
37
+ children: c
38
38
  })]
39
39
  })]
40
- }), /* @__PURE__ */ r(i, {
41
- bold: !0,
42
- color: a,
40
+ }), /* @__PURE__ */ i(t, {
43
41
  sx: {
42
+ alignItems: "flex-end",
44
43
  flexShrink: 0,
45
- fontVariantNumeric: "lining-nums tabular-nums",
46
- letterSpacing: "-0.15px"
44
+ gap: 4
47
45
  },
48
- variant: "body1",
49
- children: o
46
+ children: [/* @__PURE__ */ r(e, {
47
+ bold: !0,
48
+ color: l,
49
+ sx: {
50
+ fontVariantNumeric: "lining-nums tabular-nums",
51
+ letterSpacing: "-0.15px"
52
+ },
53
+ variant: "body1",
54
+ children: o
55
+ }), n && /* @__PURE__ */ r(e, {
56
+ color: "text.secondary",
57
+ sx: {
58
+ fontSize: 9,
59
+ fontWeight: 700,
60
+ letterSpacing: "0.03em",
61
+ lineHeight: "12px",
62
+ textTransform: "uppercase"
63
+ },
64
+ variant: "caption",
65
+ children: n
66
+ })]
50
67
  })]
51
68
  });
52
69
  export {
53
- f as default
70
+ g as default
54
71
  };
55
72
 
56
73
  //# sourceMappingURL=InsightTransactionRow.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InsightTransactionRow.es.js","names":[],"sources":["../../../src/insights-v2/components/InsightTransactionRow.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nexport interface InsightTransactionRowProps {\n /** Leading visual: merchant/institution logo, category icon, or date badge. */\n leading?: ReactNode\n /** Primary line (e.g. merchant, payee, transaction name). */\n title: ReactNode\n /** Secondary line beneath the title (e.g. category). */\n subtitle: ReactNode\n /** Trailing amount, pre-formatted by the caller. */\n amount: ReactNode\n /** Theme token for the amount text (e.g. 'success.main' for credits). */\n amountColor?: string\n sx?: SxProps\n}\n\n/**\n * A single transaction/list row for the insights-v2 transaction-list family:\n * leading visual + title/subtitle on the left, amount on the right. Named\n * `InsightTransactionRow` to avoid colliding with the transactions widget's\n * public `TransactionRow` export.\n */\nconst InsightTransactionRow = ({\n amount,\n amountColor = 'text.primary',\n leading,\n subtitle,\n title,\n sx,\n}: InsightTransactionRowProps) => (\n <Stack\n sx={{\n // The amount shares the title's top line while the subtitle sits below, so\n // the row is top-aligned and the inner left group is centered.\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 16,\n px: 16,\n py: 14,\n width: '100%',\n ...sx,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n {leading && <Box sx={{ flexShrink: 0 }}>{leading}</Box>}\n <Stack sx={{ minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {title}\n </Text>\n <Text color=\"text.primary\" truncate={true} variant=\"caption\">\n {subtitle}\n </Text>\n </Stack>\n </Stack>\n {/* Figma `typography/body1 (bold tabular)`: tabular figures so amounts align column-wise. */}\n <Text\n bold={true}\n color={amountColor}\n sx={{\n flexShrink: 0,\n fontVariantNumeric: 'lining-nums tabular-nums',\n letterSpacing: '-0.15px',\n }}\n variant=\"body1\"\n >\n {amount}\n </Text>\n </Stack>\n)\n\nexport default InsightTransactionRow\n"],"mappings":";;;;AA4BA,IAAM,IAAA,CAAyB,EAC7B,QAAA,GACA,aAAA,IAAc,gBACd,SAAA,GACA,UAAA,GACA,OAAA,GACA,IAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IAGF,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AAAA,EAXF,UAAA,CAaE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,UAAU;AAAA,MAAG,KAAK;AAAA,MAAI,UAAU;AAAA,IAAE;AAAA,IAA3F,UAAA,CACG,KAAW,gBAAA,EAAC,GAAD;AAAA,MAAK,IAAI,EAAE,YAAY,EAAE;AAAA,MAAI,UAAA;AAAA,IAAa,CAAA,GACtD,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI,EAAE,UAAU,EAAE;AAAA,MAAzB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAM,UAAU;AAAA,QAAM,SAAQ;AAAA,QACvC,UAAA;AAAA,MACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAe,UAAU;AAAA,QAAM,SAAQ;AAAA,QAChD,UAAA;AAAA,MACG,CAAA,CACD;AAAA,IACF,CAAA,CAAA;AAAA,EAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,IACE,MAAM;AAAA,IACN,OAAO;AAAA,IACP,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,oBAAoB;AAAA,MACpB,eAAe;AAAA,IACjB;AAAA,IACA,SAAQ;AAAA,IAEP,UAAA;AAAA,EACG,CAAA,CACD"}
1
+ {"version":3,"file":"InsightTransactionRow.es.js","names":[],"sources":["../../../src/insights-v2/components/InsightTransactionRow.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nexport interface InsightTransactionRowProps {\n /** Leading visual: merchant/institution logo, category icon, or date badge. */\n leading?: ReactNode\n /** Primary line (e.g. merchant, payee, transaction name). */\n title: ReactNode\n /** Secondary line beneath the title (e.g. category). */\n subtitle: ReactNode\n /** Trailing amount, pre-formatted by the caller. */\n amount: ReactNode\n /** Theme token for the amount text (e.g. 'success.main' for credits). */\n amountColor?: string\n /** Caption under the amount (e.g. a frequency). */\n amountCaption?: ReactNode\n sx?: SxProps\n}\n\n/**\n * A single transaction/list row for the insights-v2 transaction-list family:\n * leading visual + title/subtitle on the left, amount on the right. Named\n * `InsightTransactionRow` to avoid colliding with the transactions widget's\n * public `TransactionRow` export.\n */\nconst InsightTransactionRow = ({\n amount,\n amountCaption,\n amountColor = 'text.primary',\n leading,\n subtitle,\n title,\n sx,\n}: InsightTransactionRowProps) => (\n <Stack\n sx={{\n // The amount shares the title's top line while the subtitle sits below, so\n // the row is top-aligned and the inner left group is centered.\n alignItems: 'flex-start',\n flexDirection: 'row',\n gap: 16,\n px: 16,\n py: 14,\n width: '100%',\n ...sx,\n }}\n >\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', flexGrow: 1, gap: 12, minWidth: 0 }}>\n {leading && <Box sx={{ flexShrink: 0 }}>{leading}</Box>}\n <Stack sx={{ minWidth: 0 }}>\n <Text bold={true} truncate={true} variant=\"body1\">\n {title}\n </Text>\n <Text color=\"text.primary\" truncate={true} variant=\"caption\">\n {subtitle}\n </Text>\n </Stack>\n </Stack>\n {/* Figma `typography/body1 (bold tabular)`: tabular figures so amounts align column-wise. */}\n <Stack sx={{ alignItems: 'flex-end', flexShrink: 0, gap: 4 }}>\n <Text\n bold={true}\n color={amountColor}\n sx={{\n fontVariantNumeric: 'lining-nums tabular-nums',\n letterSpacing: '-0.15px',\n }}\n variant=\"body1\"\n >\n {amount}\n </Text>\n {amountCaption && (\n <Text\n color=\"text.secondary\"\n sx={{\n fontSize: 9,\n fontWeight: 700,\n letterSpacing: '0.03em',\n lineHeight: '12px',\n textTransform: 'uppercase',\n }}\n variant=\"caption\"\n >\n {amountCaption}\n </Text>\n )}\n </Stack>\n </Stack>\n)\n\nexport default InsightTransactionRow\n"],"mappings":";;;;AA8BA,IAAM,IAAA,CAAyB,EAC7B,QAAA,GACA,eAAA,GACA,aAAA,IAAc,gBACd,SAAA,GACA,UAAA,GACA,OAAA,GACA,IAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EACE,IAAI;AAAA,IAGF,YAAY;AAAA,IACZ,eAAe;AAAA,IACf,KAAK;AAAA,IACL,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,GAAG;AAAA,EACL;AAAA,EAXF,UAAA,CAaE,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAU,eAAe;AAAA,MAAO,UAAU;AAAA,MAAG,KAAK;AAAA,MAAI,UAAU;AAAA,IAAE;AAAA,IAA3F,UAAA,CACG,KAAW,gBAAA,EAAC,GAAD;AAAA,MAAK,IAAI,EAAE,YAAY,EAAE;AAAA,MAAI,UAAA;AAAA,IAAa,CAAA,GACtD,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI,EAAE,UAAU,EAAE;AAAA,MAAzB,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,QAAM,MAAM;AAAA,QAAM,UAAU;AAAA,QAAM,SAAQ;AAAA,QACvC,UAAA;AAAA,MACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAe,UAAU;AAAA,QAAM,SAAQ;AAAA,QAChD,UAAA;AAAA,MACG,CAAA,CACD;AAAA,IACF,CAAA,CAAA;AAAA,EAEP,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,IAAO,IAAI;AAAA,MAAE,YAAY;AAAA,MAAY,YAAY;AAAA,MAAG,KAAK;AAAA,IAAE;AAAA,IAA3D,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,MACN,OAAO;AAAA,MACP,IAAI;AAAA,QACF,oBAAoB;AAAA,QACpB,eAAe;AAAA,MACjB;AAAA,MACA,SAAQ;AAAA,MAEP,UAAA;AAAA,IACG,CAAA,GACL,KACC,gBAAA,EAAC,GAAD;AAAA,MACE,OAAM;AAAA,MACN,IAAI;AAAA,QACF,UAAU;AAAA,QACV,YAAY;AAAA,QACZ,eAAe;AAAA,QACf,YAAY;AAAA,QACZ,eAAe;AAAA,MACjB;AAAA,MACA,SAAQ;AAAA,MAEP,UAAA;AAAA,IACG,CAAA,CAEH;AAAA,EACF,CAAA,CAAA"}
@@ -6,7 +6,7 @@ import { Text as i } from "@mxenabled/mxui";
6
6
  import { jsx as r, jsxs as n } from "react/jsx-runtime";
7
7
  import { alpha as o, useTheme as f } from "@mui/material/styles";
8
8
  import g from "@mui/material/Box";
9
- var p = 0.75, j = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
9
+ var p = 0.75, y = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
10
10
  const e = f(), l = `linear-gradient(90deg, ${o(e.palette.success.main, p)}, ${o(e.palette.success.light, p)})`;
11
11
  return /* @__PURE__ */ r(g, {
12
12
  sx: {
@@ -44,8 +44,8 @@ var p = 0.75, j = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
44
44
  /* @__PURE__ */ n(t, {
45
45
  sx: {
46
46
  bgcolor: "background.paper",
47
- borderBottomRightRadius: "12px",
48
- borderTopRightRadius: "12px",
47
+ borderBottomRightRadius: "8px",
48
+ borderTopRightRadius: "8px",
49
49
  height: 74,
50
50
  justifyContent: "center",
51
51
  px: 12,
@@ -53,9 +53,11 @@ var p = 0.75, j = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
53
53
  },
54
54
  children: [/* @__PURE__ */ r(i, {
55
55
  color: "text.secondary",
56
+ sx: { fontWeight: 400 },
56
57
  variant: "caption",
57
58
  children: c
58
59
  }), /* @__PURE__ */ r(i, {
60
+ color: "text.primary",
59
61
  variant: "h1",
60
62
  children: d
61
63
  })]
@@ -65,7 +67,7 @@ var p = 0.75, j = ({ amount: d, label: c, slot: a = !0, sx: s }) => {
65
67
  });
66
68
  };
67
69
  export {
68
- j as default
70
+ y as default
69
71
  };
70
72
 
71
73
  //# sourceMappingURL=SavingsOpportunityCard.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SavingsOpportunityCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SavingsOpportunityCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha, type SxProps, type Theme, useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { ReactComponent as Left } from './shared/images/SavingsOpportunityLeft.svg'\nimport { ReactComponent as LeftDark } from './shared/images/SavingsOpportunityLeftDark.svg'\nimport { ReactComponent as Perforation } from './shared/images/SavingsOpportunityPerforation.svg'\n\n/**\n * Figma slot: a white base layered with a `success.main → success.light` linear\n * gradient at 75% opacity (a green wash left-to-right). Both tokens are\n * theme-aware so the tint flips for dark mode. Matches the \"backgroundImage over\n * bgcolor\" pattern used across the insights-v2 Content components.\n */\nconst SLOT_GRADIENT_OPACITY = 0.75\n\ninterface SavingsOpportunityCardProps {\n amount: string\n label: string\n /** Whether to render the green gradient slot behind the coupon. Default true. */\n slot?: boolean\n sx?: SxProps<Theme>\n}\n\n/**\n * Savings Opportunity V2 content: a coupon (green wallet tile + perforation +\n * amount) on a green gradient slot. Ported from the v1 `Coupon` component\n * (`src/insights/components/shared/Coupon.tsx`) and adapted to the v2 theme.\n *\n * Figma: Savings Opportunity V2 Content (Full variant, coupon-style).\n * Scope is the Content section only.\n */\nconst SavingsOpportunityCard = ({\n amount,\n label,\n slot = true,\n sx,\n}: SavingsOpportunityCardProps) => {\n const theme = useTheme()\n const slotBackground = `linear-gradient(90deg, ${alpha(\n theme.palette.success.main,\n SLOT_GRADIENT_OPACITY,\n )}, ${alpha(theme.palette.success.light, SLOT_GRADIENT_OPACITY)})`\n\n return (\n <Box\n sx={{\n backgroundImage: slot ? slotBackground : undefined,\n bgcolor: slot ? 'background.paper' : 'transparent',\n p: 16,\n ...sx,\n }}\n >\n <Stack sx={{ flexDirection: 'row', justifyContent: 'center' }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderBottomLeftRadius: '8px',\n borderTopLeftRadius: '8px',\n p: 4,\n pr: 2,\n }}\n >\n {theme.palette.mode === 'dark' ? (\n <LeftDark aria-hidden={true} />\n ) : (\n <Left aria-hidden={true} />\n )}\n </Stack>\n <Stack\n sx={{\n svg: {\n path: {\n '&:not([stroke])': {\n fill: theme.palette.background.paper,\n },\n '&[stroke]': {\n stroke: alpha(theme.palette.divider, 0.24),\n },\n },\n rect: {\n fill: theme.palette.background.paper,\n },\n },\n }}\n >\n <Perforation aria-hidden={true} />\n </Stack>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderBottomRightRadius: '12px',\n borderTopRightRadius: '12px',\n height: 74,\n justifyContent: 'center',\n px: 12,\n width: 216,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {label}\n </Text>\n <Text variant=\"h1\">{amount}</Text>\n </Stack>\n </Stack>\n </Box>\n )\n}\n\nexport default SavingsOpportunityCard\n"],"mappings":";;;;;;;;AAgBA,IAAM,IAAwB,MAkBxB,IAA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AAA,YACT,yBAAyB;AAAA,YACzB,sBAAsB;AAAA,YACtB,QAAQ;AAAA,YACR,gBAAgB;AAAA,YAChB,IAAI;AAAA,YACJ,OAAO;AAAA,UACT;AAAA,UATF,UAAA,CAWE,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,SAAQ;AAAA,YAClC,UAAA;AAAA,UACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,YAAM,SAAQ;AAAA,YAAM,UAAA;AAAA,UAAa,CAAA,CAC5B;AAAA;MACF;AAAA;EACJ,CAAA;AAET"}
1
+ {"version":3,"file":"SavingsOpportunityCard.es.js","names":[],"sources":["../../../src/insights-v2/components/SavingsOpportunityCard.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\nimport { alpha, type SxProps, type Theme, useTheme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { ReactComponent as Left } from './shared/images/SavingsOpportunityLeft.svg'\nimport { ReactComponent as LeftDark } from './shared/images/SavingsOpportunityLeftDark.svg'\nimport { ReactComponent as Perforation } from './shared/images/SavingsOpportunityPerforation.svg'\n\n/**\n * Figma slot: a white base layered with a `success.main → success.light` linear\n * gradient at 75% opacity (a green wash left-to-right). Both tokens are\n * theme-aware so the tint flips for dark mode. Matches the \"backgroundImage over\n * bgcolor\" pattern used across the insights-v2 Content components.\n */\nconst SLOT_GRADIENT_OPACITY = 0.75\n\ninterface SavingsOpportunityCardProps {\n amount: string\n label: string\n /** Whether to render the green gradient slot behind the coupon. Default true. */\n slot?: boolean\n sx?: SxProps<Theme>\n}\n\n/**\n * Savings Opportunity V2 content: a coupon (green wallet tile + perforation +\n * amount) on a green gradient slot. Ported from the v1 `Coupon` component\n * (`src/insights/components/shared/Coupon.tsx`) and adapted to the v2 theme.\n *\n * Figma: Savings Opportunity V2 Content (Full variant, coupon-style).\n * Scope is the Content section only.\n */\nconst SavingsOpportunityCard = ({\n amount,\n label,\n slot = true,\n sx,\n}: SavingsOpportunityCardProps) => {\n const theme = useTheme()\n const slotBackground = `linear-gradient(90deg, ${alpha(\n theme.palette.success.main,\n SLOT_GRADIENT_OPACITY,\n )}, ${alpha(theme.palette.success.light, SLOT_GRADIENT_OPACITY)})`\n\n return (\n <Box\n sx={{\n backgroundImage: slot ? slotBackground : undefined,\n bgcolor: slot ? 'background.paper' : 'transparent',\n p: 16,\n ...sx,\n }}\n >\n <Stack sx={{ flexDirection: 'row', justifyContent: 'center' }}>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderBottomLeftRadius: '8px',\n borderTopLeftRadius: '8px',\n p: 4,\n pr: 2,\n }}\n >\n {theme.palette.mode === 'dark' ? (\n <LeftDark aria-hidden={true} />\n ) : (\n <Left aria-hidden={true} />\n )}\n </Stack>\n <Stack\n sx={{\n svg: {\n path: {\n '&:not([stroke])': {\n fill: theme.palette.background.paper,\n },\n '&[stroke]': {\n stroke: alpha(theme.palette.divider, 0.24),\n },\n },\n rect: {\n fill: theme.palette.background.paper,\n },\n },\n }}\n >\n <Perforation aria-hidden={true} />\n </Stack>\n <Stack\n sx={{\n bgcolor: 'background.paper',\n borderBottomRightRadius: '8px',\n borderTopRightRadius: '8px',\n height: 74,\n justifyContent: 'center',\n px: 12,\n width: 216,\n }}\n >\n {/* Figma: \"Save an extra\" caption is 11px/400 at text.secondary (black\n @0.6). MXUI's `caption` variant renders 700, so set fontWeight\n explicitly (same pattern as AccountHeroCard/AmountBreakdownCard). */}\n <Text color=\"text.secondary\" sx={{ fontWeight: 400 }} variant=\"caption\">\n {label}\n </Text>\n {/* Figma: amount is 31px/700 at text.primary (black @0.87). */}\n <Text color=\"text.primary\" variant=\"h1\">\n {amount}\n </Text>\n </Stack>\n </Stack>\n </Box>\n )\n}\n\nexport default SavingsOpportunityCard\n"],"mappings":";;;;;;;;AAgBA,IAAM,IAAwB,MAkBxB,IAAA,CAA0B,EAC9B,QAAA,GACA,OAAA,GACA,MAAA,IAAO,IACP,IAAA,E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,YACR,gBAAgB;AAAA,YAChB,IAAI;AAAA,YACJ,OAAO;AAAA,UACT;AAAA,UATF,UAAA,CAcE,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAiB,IAAI,EAAE,YAAY,IAAI;AAAA,YAAG,SAAQ;AAAA,YAC3D,UAAA;AAAA,UACG,CAAA,GAEN,gBAAA,EAAC,GAAD;AAAA,YAAM,OAAM;AAAA,YAAe,SAAQ;AAAA,YAChC,UAAA;AAAA,UACG,CAAA,CACD;AAAA;MACF;AAAA;EACJ,CAAA;AAET"}
@@ -0,0 +1,4 @@
1
+ import { RepeatingTransaction } from '../../../core/types/RepeatingTransaction';
2
+ import { RecurringCopy } from '../../../core/types/localization/RecurringCopy';
3
+ /** Frequency word from `recurrence_type` (e.g. "Yearly"); unknown or unmapped → undefined. */
4
+ export declare const subscriptionFrequency: (copy: RecurringCopy | undefined, repeating: RepeatingTransaction | undefined) => string | undefined;
@@ -0,0 +1,11 @@
1
+ import { RECURRENCE_COPY as n } from "../../../common/constants/ScheduledPayment.es.js";
2
+ var p = (r, t) => {
3
+ const e = t?.recurrence_type, o = e ? n.find(({ id: i }) => i === e)?.copy : void 0;
4
+ if (!(!r || !o))
5
+ return r[o] || void 0;
6
+ };
7
+ export {
8
+ p as subscriptionFrequency
9
+ };
10
+
11
+ //# sourceMappingURL=subscriptionFrequency.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscriptionFrequency.es.js","names":[],"sources":["../../../../src/insights-v2/components/SubscriptionStatus/subscriptionFrequency.ts"],"sourcesContent":["import { RECURRENCE_COPY } from '../../../common/constants'\nimport type { RepeatingTransaction } from '../../../core/types/RepeatingTransaction'\nimport type { RecurringCopy } from '../../../core/types/localization/RecurringCopy'\n\n/** Frequency word from `recurrence_type` (e.g. \"Yearly\"); unknown or unmapped → undefined. */\nexport const subscriptionFrequency = (\n copy: RecurringCopy | undefined,\n repeating: RepeatingTransaction | undefined,\n): string | undefined => {\n const type: number | undefined = repeating?.recurrence_type\n // Same numbers as `Frequency`; 0 (unknown) has no word.\n const key = type ? RECURRENCE_COPY.find(({ id }) => id === type)?.copy : undefined\n\n if (!copy || !key) return undefined\n\n return copy[key as keyof RecurringCopy] || undefined\n}\n"],"mappings":";AAKA,IAAa,IAAA,CACX,GACA,MACuB;AACvB,QAAM,IAA2B,GAAW,iBAEtC,IAAM,IAAO,EAAgB,KAAA,CAAM,EAAE,IAAA,EAAA,MAAS,MAAO,CAAI,GAAG,OAAO;AAEzE,MAAI,GAAC,KAAQ,CAAC;AAEd,WAAO,EAAK,CAAA,KAA+B;AAC7C"}
@@ -47,6 +47,10 @@ interface SurveyModalProps {
47
47
  onSubmit: (option: string, detail?: string) => void | Promise<void>;
48
48
  /** Fired when the whole flow ends (dialogs dismissed or a snackbar closed). */
49
49
  onClose: () => void;
50
+ /** Fired when the negative row opens the reasons dialog (analytics). */
51
+ onReasonsOpen?: () => void;
52
+ /** Default true. When false the last reason is a plain choice, with no free-text field. */
53
+ showDetailField?: boolean;
50
54
  }
51
55
  /**
52
56
  * The confirmation survey drilldown (Figma `1941:212640`, Upcoming
@@ -61,5 +65,5 @@ interface SurveyModalProps {
61
65
  * `survey_modal_block` action block wires it to the copy store, the beat
62
66
  * actions, and the action-drawer session.
63
67
  */
64
- declare const SurveyModal: ({ copy, isOpen, onClose, onSubmit }: SurveyModalProps) => import("react/jsx-runtime").JSX.Element;
68
+ declare const SurveyModal: ({ copy, isOpen, onClose, onReasonsOpen, onSubmit, showDetailField, }: SurveyModalProps) => import("react/jsx-runtime").JSX.Element;
65
69
  export default SurveyModal;
@@ -1,14 +1,14 @@
1
- import T from "../../common/components/dialog/Dialog.es.js";
2
- import C from "./shared/StatusSnackbar.es.js";
3
- import L from "./FeedbackModal.es.js";
4
- import { useEffect as k, useRef as d, useState as M } from "react";
1
+ import k from "../../common/components/dialog/Dialog.es.js";
2
+ import M from "./shared/StatusSnackbar.es.js";
3
+ import p from "./FeedbackModal.es.js";
4
+ import { useEffect as S, useRef as h, useState as y } from "react";
5
5
  import m from "@mui/material/Stack";
6
- import { Text as h } from "@mxenabled/mxui";
7
- import { Icon as b } from "@mxenabled/mx-icons";
8
- import { Fragment as p, jsx as t, jsxs as l } from "react/jsx-runtime";
9
- import y from "@mui/material/Divider";
10
- import S from "@mui/material/ButtonBase";
11
- var w = {
6
+ import { Text as b } from "@mxenabled/mxui";
7
+ import { Icon as g } from "@mxenabled/mx-icons";
8
+ import { Fragment as w, jsx as t, jsxs as l } from "react/jsx-runtime";
9
+ import B from "@mui/material/Divider";
10
+ import I from "@mui/material/ButtonBase";
11
+ var _ = {
12
12
  positive: {
13
13
  color: "success.main",
14
14
  name: "check_circle"
@@ -17,9 +17,9 @@ var w = {
17
17
  color: "error.main",
18
18
  name: "cancel"
19
19
  }
20
- }, W = ({ copy: e, isOpen: a, onClose: c, onSubmit: f }) => {
21
- const [s, o] = M("survey"), u = d(!1), n = d(null);
22
- k(() => {
20
+ }, P = ({ copy: e, isOpen: a, onClose: c, onReasonsOpen: v, onSubmit: f, showDetailField: A = !0 }) => {
21
+ const [s, o] = y("survey"), u = h(!1), n = h(null);
22
+ S(() => {
23
23
  a && (o("survey"), u.current = !1, n.current = null);
24
24
  }, [a]);
25
25
  const x = async (r, i) => {
@@ -32,24 +32,24 @@ var w = {
32
32
  } catch {
33
33
  o("error");
34
34
  }
35
- }, g = () => {
35
+ }, T = () => {
36
36
  n.current && x(n.current.option, n.current.detail);
37
- }, v = (r) => {
38
- r.tone === "positive" ? x(r.label) : o("reasons");
39
- }, A = () => {
37
+ }, C = (r) => {
38
+ r.tone === "positive" ? x(r.label) : (v?.(), o("reasons"));
39
+ }, L = () => {
40
40
  u.current || c();
41
41
  };
42
- return /* @__PURE__ */ l(p, { children: [
43
- /* @__PURE__ */ t(T, {
42
+ return /* @__PURE__ */ l(w, { children: [
43
+ /* @__PURE__ */ t(k, {
44
44
  copy: {
45
45
  title: e.title,
46
46
  close_aria: e.closeAriaLabel
47
47
  },
48
48
  isOpen: a && s === "survey",
49
- onClose: A,
49
+ onClose: L,
50
50
  showActions: !1,
51
51
  sx: {
52
- "& .MuiDialogContent-root": { py: 0 },
52
+ "& .MuiDialogContent-root": { p: 0 },
53
53
  "& .MuiButton-outlined": {
54
54
  border: "none",
55
55
  "&:hover": {
@@ -58,51 +58,58 @@ var w = {
58
58
  }
59
59
  }
60
60
  },
61
- children: /* @__PURE__ */ t(m, { children: e.options.map((r) => {
62
- const i = w[r.tone];
63
- return /* @__PURE__ */ l(m, { children: [/* @__PURE__ */ t(y, {}), /* @__PURE__ */ l(S, {
64
- onClick: () => v(r),
61
+ children: /* @__PURE__ */ t(m, { children: e.options.map((r, i) => {
62
+ const d = _[r.tone];
63
+ return /* @__PURE__ */ l(m, { children: [i > 0 && /* @__PURE__ */ t(B, {}), /* @__PURE__ */ l(I, {
64
+ onClick: () => C(r),
65
65
  sx: {
66
66
  alignItems: "center",
67
67
  display: "flex",
68
68
  gap: 12,
69
69
  justifyContent: "flex-start",
70
- px: 4,
70
+ px: 24,
71
71
  py: 14,
72
72
  textAlign: "left",
73
73
  width: "100%"
74
74
  },
75
75
  children: [
76
- /* @__PURE__ */ t(b, {
77
- name: i.name,
76
+ /* @__PURE__ */ t(g, {
77
+ fill: !0,
78
+ name: d.name,
78
79
  size: 24,
79
- sx: { color: i.color }
80
+ sx: {
81
+ color: d.color,
82
+ mx: 4
83
+ }
80
84
  }),
81
85
  /* @__PURE__ */ l(m, {
82
86
  sx: {
83
87
  flex: 1,
84
88
  minWidth: 0
85
89
  },
86
- children: [/* @__PURE__ */ t(h, {
90
+ children: [/* @__PURE__ */ t(b, {
87
91
  color: "text.primary",
88
92
  variant: "caption",
89
93
  children: r.overline
90
- }), /* @__PURE__ */ t(h, {
94
+ }), /* @__PURE__ */ t(b, {
91
95
  sx: { fontWeight: 600 },
92
96
  variant: "body1",
93
97
  children: r.label
94
98
  })]
95
99
  }),
96
- /* @__PURE__ */ t(b, {
100
+ /* @__PURE__ */ t(g, {
97
101
  name: "chevron_right",
98
102
  size: 20,
99
- sx: { color: "text.primary" }
103
+ sx: {
104
+ color: "text.primary",
105
+ ml: 4
106
+ }
100
107
  })
101
108
  ]
102
109
  })] }, r.label);
103
110
  }) })
104
111
  }),
105
- /* @__PURE__ */ t(L, {
112
+ /* @__PURE__ */ t(p, {
106
113
  copy: {
107
114
  title: e.reasonsTitle,
108
115
  options: e.reasonOptions,
@@ -118,13 +125,14 @@ var w = {
118
125
  isOpen: a && s === "reasons",
119
126
  onBack: () => o("survey"),
120
127
  onClose: () => c(),
121
- onSubmit: f
128
+ onSubmit: f,
129
+ showDetailField: A
122
130
  }),
123
- /* @__PURE__ */ t(C, {
131
+ /* @__PURE__ */ t(M, {
124
132
  actionText: s === "error" ? e.tryAgainText : void 0,
125
133
  closeAriaLabel: e.toastCloseAriaLabel,
126
134
  message: s === "error" ? e.errorMessage : e.successMessage,
127
- onActionClick: g,
135
+ onActionClick: T,
128
136
  onClose: () => c(),
129
137
  open: a && (s === "success" || s === "error"),
130
138
  severity: s === "error" ? "error" : "success"
@@ -132,7 +140,7 @@ var w = {
132
140
  ] });
133
141
  };
134
142
  export {
135
- W as default
143
+ P as default
136
144
  };
137
145
 
138
146
  //# sourceMappingURL=SurveyModal.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SurveyModal.es.js","names":[],"sources":["../../../src/insights-v2/components/SurveyModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog } from '../../common'\n\nimport FeedbackModal from './FeedbackModal'\nimport StatusSnackbar from './shared/StatusSnackbar'\n\n/** One survey row (Figma `<UtilityRow>`). Rows act immediately on click. */\nexport interface SurveyModalOption {\n /** Overline above the row label, e.g. \"Yes,\" / \"No,\". */\n overline: string\n /** Row label, e.g. \"This looks correct.\" */\n label: string\n /**\n * Row behavior + glyph: `positive` (green check_circle) submits the label\n * right away; `negative` (red cancel) opens the reasons dialog.\n */\n tone: 'positive' | 'negative'\n}\n\n/** Localized strings the modal renders — resolved by the caller (see SurveyModalActionBlock). */\nexport interface SurveyModalContent {\n /** Survey dialog title, e.g. \"Does this look right?\". */\n title: string\n options: SurveyModalOption[]\n /** Reasons dialog primary (Submit) button label. */\n submitText: string\n /** ARIA label for the dialog close buttons. */\n closeAriaLabel: string\n /** Reasons dialog title (negative path), e.g. \"This looks wrong\". */\n reasonsTitle: string\n /** Reasons dialog options; the last one reveals the detail text field. */\n reasonOptions: string[]\n /** Reasons dialog secondary (Back) label. */\n backText: string\n /** Helper text under the reasons detail field. */\n characterLimitLabel?: string\n /** Success snackbar message (Figma 1941:212643). */\n successMessage: string\n /** Error snackbar message (Figma 1941:212644). */\n errorMessage: string\n /** Error snackbar retry label, e.g. \"Try Again\". */\n tryAgainText: string\n /** ARIA label for the snackbar close button. */\n toastCloseAriaLabel: string\n}\n\ninterface SurveyModalProps {\n isOpen: boolean\n copy: SurveyModalContent\n /**\n * Fired when an answer is submitted — the positive row's label, or a\n * reasons-dialog selection (with optional detail). May return a promise: a\n * rejection switches to the error snackbar, whose Try Again re-submits.\n */\n onSubmit: (option: string, detail?: string) => void | Promise<void>\n /** Fired when the whole flow ends (dialogs dismissed or a snackbar closed). */\n onClose: () => void\n}\n\ntype Phase = 'survey' | 'reasons' | 'success' | 'error'\n\nconst TONE_ICON: Record<SurveyModalOption['tone'], { color: string; name: string }> = {\n positive: { color: 'success.main', name: 'check_circle' },\n negative: { color: 'error.main', name: 'cancel' },\n}\n\n/**\n * The confirmation survey drilldown (Figma `1941:212640`, Upcoming\n * Subscriptions \"Does this look right?\"):\n *\n * - the POSITIVE row submits immediately and shows the success snackbar\n * (`1941:212643`) — or the error snackbar with Try Again (`1941:212644`);\n * - the NEGATIVE row opens the reasons dialog (`1941:212642`, a FeedbackDialog:\n * radios + Back/Submit), whose submission feeds the same snackbars.\n *\n * Purely presentational — copy arrives resolved via `SurveyModalContent`; the\n * `survey_modal_block` action block wires it to the copy store, the beat\n * actions, and the action-drawer session.\n */\nconst SurveyModal = ({ copy, isOpen, onClose, onSubmit }: SurveyModalProps) => {\n const [phase, setPhase] = useState<Phase>('survey')\n // Guards the survey Dialog's trailing `onClose` after a row acted — the row\n // click hands over to the snackbar / reasons dialog, not a flow end.\n const actionTaken = useRef(false)\n // Kept for the error snackbar's Try Again, which re-submits the selection.\n const lastSubmission = useRef<{ option: string; detail?: string } | null>(null)\n\n // A fresh session starts from the survey.\n useEffect(() => {\n if (isOpen) {\n setPhase('survey')\n actionTaken.current = false\n lastSubmission.current = null\n }\n }, [isOpen])\n\n const submit = async (option: string, detail?: string) => {\n actionTaken.current = true\n lastSubmission.current = { option, detail }\n try {\n await onSubmit(option, detail)\n setPhase('success')\n } catch {\n setPhase('error')\n }\n }\n\n const retry = () => {\n if (lastSubmission.current) {\n void submit(lastSubmission.current.option, lastSubmission.current.detail)\n }\n }\n\n const handleRowClick = (option: SurveyModalOption) => {\n if (option.tone === 'positive') {\n void submit(option.label)\n } else {\n setPhase('reasons')\n }\n }\n\n const handleSurveyClose = () => {\n if (actionTaken.current) return\n onClose()\n }\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: copy.closeAriaLabel }}\n isOpen={isOpen && phase === 'survey'}\n onClose={handleSurveyClose}\n // Figma 1941:212640: the DialogActions row is hidden — the utility\n // rows are the only actions; the flow closes via X or a row.\n showActions={false}\n sx={{\n '& .MuiDialogContent-root': { py: 0 },\n '& .MuiButton-outlined': {\n border: 'none',\n '&:hover': { bgcolor: 'transparent', border: 'none' },\n },\n }}\n >\n <Stack>\n {copy.options.map((option) => {\n const icon = TONE_ICON[option.tone]\n\n return (\n <Stack key={option.label}>\n <Divider />\n <ButtonBase\n onClick={() => handleRowClick(option)}\n sx={{\n alignItems: 'center',\n display: 'flex',\n gap: 12,\n justifyContent: 'flex-start',\n px: 4,\n py: 14,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Icon name={icon.name} size={24} sx={{ color: icon.color }} />\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Text color=\"text.primary\" variant=\"caption\">\n {option.overline}\n </Text>\n <Text sx={{ fontWeight: 600 }} variant=\"body1\">\n {option.label}\n </Text>\n </Stack>\n <Icon name=\"chevron_right\" size={20} sx={{ color: 'text.primary' }} />\n </ButtonBase>\n </Stack>\n )\n })}\n </Stack>\n </Dialog>\n\n {/* Negative path: the whole FeedbackModal — reasons dialog + its own\n success/error snackbars with Try Again. Back returns to the survey;\n its onClose fires only when the sub-flow truly ends. */}\n <FeedbackModal\n copy={{\n title: copy.reasonsTitle,\n options: copy.reasonOptions,\n submitText: copy.submitText,\n cancelText: copy.backText,\n closeAriaLabel: copy.closeAriaLabel,\n characterLimitLabel: copy.characterLimitLabel,\n successMessage: copy.successMessage,\n errorMessage: copy.errorMessage,\n tryAgainText: copy.tryAgainText,\n toastCloseAriaLabel: copy.toastCloseAriaLabel,\n }}\n isOpen={isOpen && phase === 'reasons'}\n onBack={() => setPhase('survey')}\n onClose={() => onClose()}\n onSubmit={onSubmit}\n />\n\n <StatusSnackbar\n actionText={phase === 'error' ? copy.tryAgainText : undefined}\n closeAriaLabel={copy.toastCloseAriaLabel}\n message={phase === 'error' ? copy.errorMessage : copy.successMessage}\n onActionClick={retry}\n onClose={() => onClose()}\n open={isOpen && (phase === 'success' || phase === 'error')}\n severity={phase === 'error' ? 'error' : 'success'}\n />\n </>\n )\n}\n\nexport default SurveyModal\n"],"mappings":";;;;;;;;;;AAqEA,IAAM,IAAgF;AAAA,EACpF,UAAU;AAAA,IAAE,OAAO;AAAA,IAAgB,MAAM;AAAA,EAAe;AAAA,EACxD,UAAU;AAAA,IAAE,OAAO;AAAA,IAAc,MAAM;AAAA,EAAS;AAClD,GAeM,IAAA,CAAe,EAAE,MAAA,GAAM,QAAA,GAAQ,SAAA,GAAS,UAAA,E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,QACjB,YAAY,EAAK;AAAA,QACjB,gBAAgB,EAAK;AAAA,QACrB,qBAAqB,EAAK;AAAA,QAC1B,gBAAgB,EAAK;AAAA,QACrB,cAAc,EAAK;AAAA,QACnB,cAAc,EAAK;AAAA,QACnB,qBAAqB,EAAK;AAAA,MAC5B;AAAA,MACA,QAAQ,KAAU,MAAU;AAAA,MAC5B,QAAA,MAAc,EAAS,QAAQ;AAAA,MAC/B,SAAA,MAAe,EAAQ;AAAA,MACb,UAAA;AAAA,IACX,CAAA;AAAA,IAED,gBAAA,EAAC,GAAD;AAAA,MACE,YAAY,MAAU,UAAU,EAAK,eAAe;AAAA,MACpD,gBAAgB,EAAK;AAAA,MACrB,SAAS,MAAU,UAAU,EAAK,eAAe,EAAK;AAAA,MACtD,eAAe;AAAA,MACf,SAAA,MAAe,EAAQ;AAAA,MACvB,MAAM,MAAW,MAAU,aAAa,MAAU;AAAA,MAClD,UAAU,MAAU,UAAU,UAAU;AAAA,IACzC,CAAA;AAAA,EACD,EAAA,CAAA;AAEN"}
1
+ {"version":3,"file":"SurveyModal.es.js","names":[],"sources":["../../../src/insights-v2/components/SurveyModal.tsx"],"sourcesContent":["import { useEffect, useRef, useState } from 'react'\n\nimport ButtonBase from '@mui/material/ButtonBase'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { Dialog } from '../../common'\n\nimport FeedbackModal from './FeedbackModal'\nimport StatusSnackbar from './shared/StatusSnackbar'\n\n/** One survey row (Figma `<UtilityRow>`). Rows act immediately on click. */\nexport interface SurveyModalOption {\n /** Overline above the row label, e.g. \"Yes,\" / \"No,\". */\n overline: string\n /** Row label, e.g. \"This looks correct.\" */\n label: string\n /**\n * Row behavior + glyph: `positive` (green check_circle) submits the label\n * right away; `negative` (red cancel) opens the reasons dialog.\n */\n tone: 'positive' | 'negative'\n}\n\n/** Localized strings the modal renders — resolved by the caller (see SurveyModalActionBlock). */\nexport interface SurveyModalContent {\n /** Survey dialog title, e.g. \"Does this look right?\". */\n title: string\n options: SurveyModalOption[]\n /** Reasons dialog primary (Submit) button label. */\n submitText: string\n /** ARIA label for the dialog close buttons. */\n closeAriaLabel: string\n /** Reasons dialog title (negative path), e.g. \"This looks wrong\". */\n reasonsTitle: string\n /** Reasons dialog options; the last one reveals the detail text field. */\n reasonOptions: string[]\n /** Reasons dialog secondary (Back) label. */\n backText: string\n /** Helper text under the reasons detail field. */\n characterLimitLabel?: string\n /** Success snackbar message (Figma 1941:212643). */\n successMessage: string\n /** Error snackbar message (Figma 1941:212644). */\n errorMessage: string\n /** Error snackbar retry label, e.g. \"Try Again\". */\n tryAgainText: string\n /** ARIA label for the snackbar close button. */\n toastCloseAriaLabel: string\n}\n\ninterface SurveyModalProps {\n isOpen: boolean\n copy: SurveyModalContent\n /**\n * Fired when an answer is submitted — the positive row's label, or a\n * reasons-dialog selection (with optional detail). May return a promise: a\n * rejection switches to the error snackbar, whose Try Again re-submits.\n */\n onSubmit: (option: string, detail?: string) => void | Promise<void>\n /** Fired when the whole flow ends (dialogs dismissed or a snackbar closed). */\n onClose: () => void\n /** Fired when the negative row opens the reasons dialog (analytics). */\n onReasonsOpen?: () => void\n /** Default true. When false the last reason is a plain choice, with no free-text field. */\n showDetailField?: boolean\n}\n\ntype Phase = 'survey' | 'reasons' | 'success' | 'error'\n\nconst TONE_ICON: Record<SurveyModalOption['tone'], { color: string; name: string }> = {\n positive: { color: 'success.main', name: 'check_circle' },\n negative: { color: 'error.main', name: 'cancel' },\n}\n\n/**\n * The confirmation survey drilldown (Figma `1941:212640`, Upcoming\n * Subscriptions \"Does this look right?\"):\n *\n * - the POSITIVE row submits immediately and shows the success snackbar\n * (`1941:212643`) — or the error snackbar with Try Again (`1941:212644`);\n * - the NEGATIVE row opens the reasons dialog (`1941:212642`, a FeedbackDialog:\n * radios + Back/Submit), whose submission feeds the same snackbars.\n *\n * Purely presentational — copy arrives resolved via `SurveyModalContent`; the\n * `survey_modal_block` action block wires it to the copy store, the beat\n * actions, and the action-drawer session.\n */\nconst SurveyModal = ({\n copy,\n isOpen,\n onClose,\n onReasonsOpen,\n onSubmit,\n showDetailField = true,\n}: SurveyModalProps) => {\n const [phase, setPhase] = useState<Phase>('survey')\n // Guards the survey Dialog's trailing `onClose` after a row acted — the row\n // click hands over to the snackbar / reasons dialog, not a flow end.\n const actionTaken = useRef(false)\n // Kept for the error snackbar's Try Again, which re-submits the selection.\n const lastSubmission = useRef<{ option: string; detail?: string } | null>(null)\n\n // A fresh session starts from the survey.\n useEffect(() => {\n if (isOpen) {\n setPhase('survey')\n actionTaken.current = false\n lastSubmission.current = null\n }\n }, [isOpen])\n\n const submit = async (option: string, detail?: string) => {\n actionTaken.current = true\n lastSubmission.current = { option, detail }\n try {\n await onSubmit(option, detail)\n setPhase('success')\n } catch {\n setPhase('error')\n }\n }\n\n const retry = () => {\n if (lastSubmission.current) {\n void submit(lastSubmission.current.option, lastSubmission.current.detail)\n }\n }\n\n const handleRowClick = (option: SurveyModalOption) => {\n if (option.tone === 'positive') {\n void submit(option.label)\n } else {\n onReasonsOpen?.()\n setPhase('reasons')\n }\n }\n\n const handleSurveyClose = () => {\n if (actionTaken.current) return\n onClose()\n }\n\n return (\n <>\n <Dialog\n copy={{ title: copy.title, close_aria: copy.closeAriaLabel }}\n isOpen={isOpen && phase === 'survey'}\n onClose={handleSurveyClose}\n // Figma 1941:212640: the DialogActions row is hidden — the utility\n // rows are the only actions; the flow closes via X or a row.\n showActions={false}\n sx={{\n '& .MuiDialogContent-root': { p: 0 },\n '& .MuiButton-outlined': {\n border: 'none',\n '&:hover': { bgcolor: 'transparent', border: 'none' },\n },\n }}\n >\n <Stack>\n {copy.options.map((option, index) => {\n const icon = TONE_ICON[option.tone]\n\n return (\n <Stack key={option.label}>\n {index > 0 && <Divider />}\n <ButtonBase\n onClick={() => handleRowClick(option)}\n sx={{\n alignItems: 'center',\n display: 'flex',\n gap: 12,\n justifyContent: 'flex-start',\n px: 24,\n py: 14,\n textAlign: 'left',\n width: '100%',\n }}\n >\n <Icon fill={true} name={icon.name} size={24} sx={{ color: icon.color, mx: 4 }} />\n <Stack sx={{ flex: 1, minWidth: 0 }}>\n <Text color=\"text.primary\" variant=\"caption\">\n {option.overline}\n </Text>\n <Text sx={{ fontWeight: 600 }} variant=\"body1\">\n {option.label}\n </Text>\n </Stack>\n <Icon name=\"chevron_right\" size={20} sx={{ color: 'text.primary', ml: 4 }} />\n </ButtonBase>\n </Stack>\n )\n })}\n </Stack>\n </Dialog>\n\n {/* Negative path: the whole FeedbackModal — reasons dialog + its own\n success/error snackbars with Try Again. Back returns to the survey;\n its onClose fires only when the sub-flow truly ends. */}\n <FeedbackModal\n copy={{\n title: copy.reasonsTitle,\n options: copy.reasonOptions,\n submitText: copy.submitText,\n cancelText: copy.backText,\n closeAriaLabel: copy.closeAriaLabel,\n characterLimitLabel: copy.characterLimitLabel,\n successMessage: copy.successMessage,\n errorMessage: copy.errorMessage,\n tryAgainText: copy.tryAgainText,\n toastCloseAriaLabel: copy.toastCloseAriaLabel,\n }}\n isOpen={isOpen && phase === 'reasons'}\n onBack={() => setPhase('survey')}\n onClose={() => onClose()}\n onSubmit={onSubmit}\n showDetailField={showDetailField}\n />\n\n <StatusSnackbar\n actionText={phase === 'error' ? copy.tryAgainText : undefined}\n closeAriaLabel={copy.toastCloseAriaLabel}\n message={phase === 'error' ? copy.errorMessage : copy.successMessage}\n onActionClick={retry}\n onClose={() => onClose()}\n open={isOpen && (phase === 'success' || phase === 'error')}\n severity={phase === 'error' ? 'error' : 'success'}\n />\n </>\n )\n}\n\nexport default SurveyModal\n"],"mappings":";;;;;;;;;;AAyEA,IAAM,IAAgF;AAAA,EACpF,UAAU;AAAA,IAAE,OAAO;AAAA,IAAgB,MAAM;AAAA,EAAe;AAAA,EACxD,UAAU;AAAA,IAAE,OAAO;AAAA,IAAc,MAAM;AAAA,EAAS;AAClD,GAeM,IAAA,CAA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A1BK,EAAO,KA0BZ;AAAA,MAEX,CAAC,EACI,CAAA;AAAA,IACD,CAAA;AAAA,IAKR,gBAAA,EAAC,GAAD;AAAA,MACE,MAAM;AAAA,QACJ,OAAO,EAAK;AAAA,QACZ,SAAS,EAAK;AAAA,QACd,YAAY,EAAK;AAAA,QACjB,YAAY,EAAK;AAAA,QACjB,gBAAgB,EAAK;AAAA,QACrB,qBAAqB,EAAK;AAAA,QAC1B,gBAAgB,EAAK;AAAA,QACrB,cAAc,EAAK;AAAA,QACnB,cAAc,EAAK;AAAA,QACnB,qBAAqB,EAAK;AAAA,MAC5B;AAAA,MACA,QAAQ,KAAU,MAAU;AAAA,MAC5B,QAAA,MAAc,EAAS,QAAQ;AAAA,MAC/B,SAAA,MAAe,EAAQ;AAAA,MACb,UAAA;AAAA,MACO,iBAAA;AAAA,IAClB,CAAA;AAAA,IAED,gBAAA,EAAC,GAAD;AAAA,MACE,YAAY,MAAU,UAAU,EAAK,eAAe;AAAA,MACpD,gBAAgB,EAAK;AAAA,MACrB,SAAS,MAAU,UAAU,EAAK,eAAe,EAAK;AAAA,MACtD,eAAe;AAAA,MACf,SAAA,MAAe,EAAQ;AAAA,MACvB,MAAM,MAAW,MAAU,aAAa,MAAU;AAAA,MAClD,UAAU,MAAU,UAAU,UAAU;AAAA,IACzC,CAAA;AAAA,EACD,EAAA,CAAA;AAEN"}
@@ -1,29 +1,37 @@
1
- import { ANALYTICS_EVENTS_CONFIG as a } from "../analytics/analyticsEventsConfig.es.js";
2
- import { HOST_ACTIONS as o } from "./hostActions.es.js";
3
- var n = ({ beat: e, stores: i }) => {
1
+ import { ANALYTICS_EVENTS_CONFIG as o } from "../analytics/analyticsEventsConfig.es.js";
2
+ import { HOST_ACTIONS as n } from "./hostActions.es.js";
3
+ import { subscriptionEntryStep as a, subscriptionSurvey as c } from "./subscriptionAnswer.es.js";
4
+ var r = ({ beat: e, stores: i }) => {
4
5
  const s = i.insightsV2Store.beatContext[e.guid]?.selected_account_guid;
5
6
  if (typeof s == "string")
6
7
  return i.accountStore.visibleSavingsAccounts.some((t) => t.guid === s && !t.is_closed && !t.is_deleted) ? s : void 0;
7
- }, _ = {
8
+ }, m = {
8
9
  dismiss_beat: {
9
10
  run: "delegateToHost",
10
- params: { hostAction: o.dismissBeat }
11
+ params: { hostAction: n.dismissBeat }
11
12
  },
12
13
  select_savings_account: {
13
14
  run: "updateUserInsightProfile",
14
- params: (e) => ({ fields: { emergency_savings_account_guid: n(e) } }),
15
- disabledWhen: (e) => !n(e),
15
+ params: (e) => ({ fields: { emergency_savings_account_guid: r(e) } }),
16
+ disabledWhen: (e) => !r(e),
16
17
  onSuccess: ["refreshBeat"],
17
- analytics: a.EMERGENCY_SAVINGS_ACCT_SAVED
18
+ analytics: o.EMERGENCY_SAVINGS_ACCT_SAVED
18
19
  },
19
- open_savings_account: { analytics: a.EMERGENCY_SAVINGS_ACCT_CREATED },
20
+ open_savings_account: { analytics: o.EMERGENCY_SAVINGS_ACCT_CREATED },
20
21
  atomic_flow: {
21
22
  run: "delegateToHost",
22
- params: { hostAction: o.atomicTransact }
23
+ params: { hostAction: n.atomicTransact }
24
+ },
25
+ confirm_subscription_detected: {
26
+ ...a({ statusLabels: {
27
+ positive: "confirmed",
28
+ negative: "incorrect"
29
+ } }),
30
+ surveyAnswer: c
23
31
  }
24
32
  };
25
33
  export {
26
- _ as ctaActions
34
+ m as ctaActions
27
35
  };
28
36
 
29
37
  //# sourceMappingURL=ctaConfig.es.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { HOST_ACTIONS } from './hostActions'\nimport type { CtaStateContext, CtaStep } from './types'\n\n/**\n * The account the svg_image_block picker wrote into this beat's context, and only while it is\n * still one the user can save into (visible, open, not deleted) — a pick that went stale between\n * pick and Save never reaches the API.\n */\nconst pickedSavingsAccountGuid = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) => {\n const picked = stores.insightsV2Store.beatContext[beat.guid]?.selected_account_guid\n\n if (typeof picked !== 'string') return undefined\n\n const usable = stores.accountStore.visibleSavingsAccounts.some(\n (account) => account.guid === picked && !account.is_closed && !account.is_deleted,\n )\n\n return usable ? picked : undefined\n}\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n\n /**\n * Designate Emergency Savings Account \"Save\": designates the account picked in the\n * svg_image_block picker (kept in the per-beat context), then refreshes the beat. The beat is\n * sampled, so the refresh re-reads its sample, which the backend rebuilds as the saved card\n * (change_account: \"Account Saved!\", no CTA). Disabled until a pick is made.\n */\n select_savings_account: {\n run: 'updateUserInsightProfile',\n params: (ctx) => ({\n fields: { emergency_savings_account_guid: pickedSavingsAccountGuid(ctx) },\n }),\n disabledWhen: (ctx) => !pickedSavingsAccountGuid(ctx),\n onSuccess: ['refreshBeat'],\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SAVED,\n },\n\n /**\n * Designate Emergency Savings Account \"Open a Savings Account\": no handler. The op_1 post\n * message comes from `ctaPostMessages`; this step adds the Created event.\n */\n open_savings_account: {\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_CREATED,\n },\n\n /**\n * SetUpDirectDeposit `not_set_up`: hand the press to the host, which owns the Atomic SDK and its\n * lifecycle. No drawer, no `refreshBeat`, and no interim post message is registered for the\n * template (a backend-supplied `cta.metadata` would still post).\n */\n atomic_flow: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.atomicTransact },\n },\n}\n"],"mappings":";;AASA,IAAM,IAAA,CAA4B,EAAE,MAAA,GAAM,QAAA,EAAA,MAAuD;AAC/F,QAAM,IAAS,EAAO,gBAAgB,YAAY,EAAK,IAAA,GAAO;AAE9D,MAAI,OAAO,KAAW;AAMtB,WAJe,EAAO,aAAa,uBAAuB,KAAA,CACvD,MAAY,EAAQ,SAAS,KAAU,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAGlE,IAAS,IAAS;AAC3B,GAQa,IAAsC;AAAA,EAEjD,cAAc;AAAA,IACZ,KAAK;AAAA,IACL,QAAQ,EAAE,YAAY,EAAa,YAAY;AAAA,EACjD;AAAA,EAQA,wBAAwB;AAAA,IACtB,KAAK;AAAA,IACL,QAAA,CAAS,OAAS,EAChB,QAAQ,EAAE,gCAAgC,EAAyB,CAAG,EAAE,EAC1E;AAAA,IACA,cAAA,CAAe,MAAQ,CAAC,EAAyB,CAAG;AAAA,IACpD,WAAW,CAAC,aAAa;AAAA,IACzB,WAAW,EAAwB;AAAA,EACrC;AAAA,EAMA,sBAAsB,EACpB,WAAW,EAAwB,+BACrC;AAAA,EAOA,aAAa;AAAA,IACX,KAAK;AAAA,IACL,QAAQ,EAAE,YAAY,EAAa,eAAe;AAAA,EACpD;AACF"}
1
+ {"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { HOST_ACTIONS } from './hostActions'\nimport { subscriptionEntryStep, subscriptionSurvey } from './subscriptionAnswer'\nimport type { CtaStateContext, CtaStep } from './types'\n\n/**\n * The account the svg_image_block picker wrote into this beat's context, and only while it is\n * still one the user can save into (visible, open, not deleted) — a pick that went stale between\n * pick and Save never reaches the API.\n */\nconst pickedSavingsAccountGuid = ({ beat, stores }: Pick<CtaStateContext, 'beat' | 'stores'>) => {\n const picked = stores.insightsV2Store.beatContext[beat.guid]?.selected_account_guid\n\n if (typeof picked !== 'string') return undefined\n\n const usable = stores.accountStore.visibleSavingsAccounts.some(\n (account) => account.guid === picked && !account.is_closed && !account.is_deleted,\n )\n\n return usable ? picked : undefined\n}\n\n/**\n * Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or\n * an unknown key = default: open the CTA's block drawer, if any. Its post message, when one\n * resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in\n * ditto and here in the same change; most CTAs need none. See README.md.\n */\nexport const ctaActions: Record<string, CtaStep> = {\n /** ConnectDiscoveredAccounts \"I don't have any\": dismiss through the host, then stop. */\n dismiss_beat: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.dismissBeat },\n },\n\n /**\n * Designate Emergency Savings Account \"Save\": designates the account picked in the\n * svg_image_block picker (kept in the per-beat context), then refreshes the beat. The beat is\n * sampled, so the refresh re-reads its sample, which the backend rebuilds as the saved card\n * (change_account: \"Account Saved!\", no CTA). Disabled until a pick is made.\n */\n select_savings_account: {\n run: 'updateUserInsightProfile',\n params: (ctx) => ({\n fields: { emergency_savings_account_guid: pickedSavingsAccountGuid(ctx) },\n }),\n disabledWhen: (ctx) => !pickedSavingsAccountGuid(ctx),\n onSuccess: ['refreshBeat'],\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_SAVED,\n },\n\n /**\n * Designate Emergency Savings Account \"Open a Savings Account\": no handler. The op_1 post\n * message comes from `ctaPostMessages`; this step adds the Created event.\n */\n open_savings_account: {\n analytics: ANALYTICS_EVENTS_CONFIG.EMERGENCY_SAVINGS_ACCT_CREATED,\n },\n\n /**\n * SetUpDirectDeposit `not_set_up`: hand the press to the host, which owns the Atomic SDK and its\n * lifecycle. No drawer, no `refreshBeat`, and no interim post message is registered for the\n * template (a backend-supplied `cta.metadata` would still post).\n */\n atomic_flow: {\n run: 'delegateToHost',\n params: { hostAction: HOST_ACTIONS.atomicTransact },\n },\n\n /**\n * SubscriptionDetected \"Does this look right?\": the shared subscription status CTA (every answer\n * counts, as pulse), answered through the survey.\n */\n confirm_subscription_detected: {\n ...subscriptionEntryStep({ statusLabels: { positive: 'confirmed', negative: 'incorrect' } }),\n surveyAnswer: subscriptionSurvey,\n },\n}\n"],"mappings":";;;AAUA,IAAM,IAAA,CAA4B,EAAE,MAAA,GAAM,QAAA,EAAA,MAAuD;AAC/F,QAAM,IAAS,EAAO,gBAAgB,YAAY,EAAK,IAAA,GAAO;AAE9D,MAAI,OAAO,KAAW;AAMtB,WAJe,EAAO,aAAa,uBAAuB,KAAA,CACvD,MAAY,EAAQ,SAAS,KAAU,CAAC,EAAQ,aAAa,CAAC,EAAQ,UAGlE,IAAS,IAAS;AAC3B,GAQa,IAAsC;AAAA,EAEjD,cAAc;AAAA,IACZ,KAAK;AAAA,IACL,QAAQ,EAAE,YAAY,EAAa,YAAY;AAAA,EACjD;AAAA,EAQA,wBAAwB;AAAA,IACtB,KAAK;AAAA,IACL,QAAA,CAAS,OAAS,EAChB,QAAQ,EAAE,gCAAgC,EAAyB,CAAG,EAAE,EAC1E;AAAA,IACA,cAAA,CAAe,MAAQ,CAAC,EAAyB,CAAG;AAAA,IACpD,WAAW,CAAC,aAAa;AAAA,IACzB,WAAW,EAAwB;AAAA,EACrC;AAAA,EAMA,sBAAsB,EACpB,WAAW,EAAwB,+BACrC;AAAA,EAOA,aAAa;AAAA,IACX,KAAK;AAAA,IACL,QAAQ,EAAE,YAAY,EAAa,eAAe;AAAA,EACpD;AAAA,EAMA,+BAA+B;AAAA,IAC7B,GAAG,EAAsB,EAAE,cAAc;AAAA,MAAE,UAAU;AAAA,MAAa,UAAU;AAAA,IAAY,EAAE,CAAC;AAAA,IAC3F,cAAc;AAAA,EAChB;AACF"}
@@ -4,4 +4,4 @@ export { ctaPostMessages, resolveCtaMetadata, type CtaPostMessageResolver } from
4
4
  export { HOST_ACTIONS, type HostActionName } from './hostActions';
5
5
  export { beatContextOf, reportCtaClick, resolveCtaState, resolveStep, runCtaAction, runCtaHandler, sendCtaAnalytics, } from './runCtaAction';
6
6
  export { useBeatCtaActions, useCtaHandler, type BeatCtaActions } from './useCtaAction';
7
- export type { CtaContext, CtaEffect, CtaHandler, CtaHandlerContext, CtaParams, CtaPresentation, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, } from './types';
7
+ export type { CtaContext, CtaEffect, CtaHandler, CtaHandlerContext, CtaParams, CtaPresentation, CtaSurveyAnswer, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, } from './types';
@@ -4,7 +4,11 @@ import { CtaContext, CtaHandlerContext, CtaState, CtaStateContext, CtaStep, RunH
4
4
  /** The beat's own context (input a block collected for it), `{}` until something is written. */
5
5
  export declare const beatContextOf: ({ beat, stores }: Pick<CtaStateContext, "beat" | "stores">) => Record<string, unknown>;
6
6
  /** The step named by the CTA's `action_key`, or the empty default (no key / unknown key). */
7
- export declare const resolveStep: ({ cta }: Pick<CtaStateContext, "cta">) => CtaStep;
7
+ export declare const resolveStep: ({ cta }: {
8
+ cta: {
9
+ action_key?: string | null;
10
+ };
11
+ }) => CtaStep;
8
12
  /** Pending always disables, as may the step's `disabledWhen`; its `presenter` may replace the button. */
9
13
  export declare const resolveCtaState: (ctx: CtaStateContext) => CtaState;
10
14
  type AnalyticsCtx = Pick<CtaContext, 'beat' | 'stores' | 'hostActions'>;
@@ -2,11 +2,11 @@ import { sendBeatCta as m } from "../../common/utils/PostMessage.es.js";
2
2
  import { ANALYTICS_EVENTS_CONFIG as n } from "../analytics/analyticsEventsConfig.es.js";
3
3
  import { resolveAnalyticsEvent as f } from "../analytics/resolveAnalyticsEvent.es.js";
4
4
  import { HOST_ACTIONS as v } from "./hostActions.es.js";
5
- import { ctaActions as _ } from "./ctaConfig.es.js";
6
- import { ctaHandlers as A } from "./ctaHandlers.es.js";
5
+ import { ctaHandlers as _ } from "./ctaHandlers.es.js";
6
+ import { ctaActions as A } from "./ctaConfig.es.js";
7
7
  import { resolveCtaMetadata as E } from "./ctaPostMessages.es.js";
8
8
  import { hasDrawerBlock as S } from "../mappings/hasDrawerBlock.es.js";
9
- var y = {}, c = ({ cta: t }) => t.action_key && _[t.action_key] || y, B = (t) => {
9
+ var y = {}, c = ({ cta: t }) => t.action_key && A[t.action_key] || y, B = (t) => {
10
10
  const a = c(t), r = t.stores.insightsV2Store.ctaStatus[t.beat.guid] === "pending", e = a.presenter?.(t);
11
11
  return {
12
12
  disabled: r || (a.disabledWhen?.(t) ?? !1),
@@ -51,7 +51,7 @@ var y = {}, c = ({ cta: t }) => t.action_key && _[t.action_key] || y, B = (t) =>
51
51
  }, T = (t, { skipCtaClicked: a = !1 } = {}) => {
52
52
  o(t, t.slot === "primary" ? n.PRIMARY_ACTION_SELECTED : n.SECONDARY_ACTION_SELECTED), a || k(t);
53
53
  }, p = async (t, a, r) => {
54
- const e = A[a];
54
+ const e = _[a];
55
55
  if (!e) throw new Error(`Unknown CTA handler "${a}"`);
56
56
  await e(t);
57
57
  for (const s of r) w(s, t);