@mx-cartographer/experiences 9.7.77 → 9.7.79
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.
- package/CHANGELOG.md +17 -0
- package/dist/core/stores/GlobalCopyStore.d.ts +6 -0
- package/dist/core/stores/GlobalCopyStore.es.js +14 -8
- package/dist/core/stores/GlobalCopyStore.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +24 -0
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js +1 -1
- package/dist/insights-v2/actionBlocks/RemainingCashBlock/RemainingCashContent.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.d.ts +6 -0
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js +161 -0
- package/dist/insights-v2/actionBlocks/SubscriptionStatusModalBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js +20 -20
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +2 -2
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js +89 -60
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/TransactionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +7 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +11 -6
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ImageBlocks/SVGImageBlock/SVGImageBlock.es.js +5 -5
- package/dist/insights-v2/components/BaseLayout.es.js +106 -105
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/CtaStatus.d.ts +5 -1
- package/dist/insights-v2/components/CtaStatus.es.js +25 -22
- package/dist/insights-v2/components/CtaStatus.es.js.map +1 -1
- package/dist/insights-v2/components/SaveAnExtraCard.es.js +5 -4
- package/dist/insights-v2/components/SaveAnExtraCard.es.js.map +1 -1
- package/dist/insights-v2/components/StatusMessageCard.d.ts +8 -3
- package/dist/insights-v2/components/StatusMessageCard.es.js +16 -15
- package/dist/insights-v2/components/StatusMessageCard.es.js.map +1 -1
- package/dist/insights-v2/components/TransactionListCard.d.ts +5 -1
- package/dist/insights-v2/components/TransactionListCard.es.js +61 -45
- package/dist/insights-v2/components/TransactionListCard.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaConfig.es.js +35 -14
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +9 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js +62 -57
- package/dist/insights-v2/ctaActions/subscriptionAnswer.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/types.d.ts +10 -2
- package/dist/insights-v2/ctaActions/useCtaAction.d.ts +5 -2
- package/dist/insights-v2/ctaActions/useCtaAction.es.js +45 -37
- package/dist/insights-v2/ctaActions/useCtaAction.es.js.map +1 -1
- package/dist/insights-v2/mappings/actionBlocksKey.d.ts +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js +1 -0
- package/dist/insights-v2/mappings/actionBlocksKey.es.js.map +1 -1
- package/dist/insights-v2/mappings/blocks.es.js +82 -76
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/dist/microinsights/cards/InsightCard.es.js +92 -83
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/dist/microinsights/cards/MicroCtaStatus.d.ts +18 -0
- package/dist/microinsights/cards/MicroCtaStatus.es.js +50 -0
- package/dist/microinsights/cards/MicroCtaStatus.es.js.map +1 -0
- package/dist/microinsights/stores/CopyStore.d.ts +10 -1
- package/dist/microinsights/stores/CopyStore.es.js +20 -11
- package/dist/microinsights/stores/CopyStore.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -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 { P, Text } from '@mxenabled/mxui'\n\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\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\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 <P color=\"inherit\" variant=\"subtitle1\">\n {leadIn}\n </P>\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. The projected balance arrives\n pre-formatted from the backend (e.g. \"$3,320\"), so render it as-is. */}\n <Box\n sx={{\n bgcolor: 'background.paper',\n px: 16,\n py: 12,\n textAlign: 'center',\n }}\n >\n <Text variant=\"h3\">{projected}</Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {projectedCaption}\n </Text>\n </Box>\n </Box>\n )\n}\n\nexport default SaveAnExtraCard\n"],"mappings":";;;;AAcA,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,MAEd,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,UAAG,OAAM;AAAA,UAAU,SAAQ;AAAA,UACxB,UAAA;AAAA,QACA,CAAA;AAAA,QACH,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,
|
|
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 { P, Text } from '@mxenabled/mxui'\n\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\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\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 <P color=\"inherit\" variant=\"subtitle1\">\n {leadIn}\n </P>\n <Text bold={true} color=\"inherit\" variant=\"h1\">\n {formatCurrency(Number(amount ?? '0'), '0,0.00')}\n </Text>\n {/* A block, as in Figma: inline, the caption sat on a text line 5px below the amount. */}\n <Text color=\"inherit\" sx={{ display: 'block' }} variant=\"caption\">\n {trailingCopy}\n </Text>\n </Box>\n\n {/* White footer with projected amount. The projected balance arrives\n pre-formatted from the backend (e.g. \"$3,320\"), so render it as-is. */}\n <Box\n sx={{\n bgcolor: 'background.paper',\n px: 16,\n py: 12,\n textAlign: 'center',\n }}\n >\n <Text variant=\"h3\">{projected}</Text>\n <Text color=\"text.secondary\" variant=\"caption\">\n {projectedCaption}\n </Text>\n </Box>\n </Box>\n )\n}\n\nexport default SaveAnExtraCard\n"],"mappings":";;;;AAcA,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,MAEd,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,UAAG,OAAM;AAAA,UAAU,SAAQ;AAAA,UACxB,UAAA;AAAA,QACA,CAAA;AAAA,QACH,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,QAEN,gBAAA,EAAC,GAAD;AAAA,UAAM,OAAM;AAAA,UAAU,IAAI,EAAE,SAAS,QAAQ;AAAA,UAAG,SAAQ;AAAA,UACrD,UAAA;AAAA,QACG,CAAA;AAAA,MACH;AAAA,IAIL,CAAA,GAAA,gBAAA,EAAC,GAAD;AAAA,MACE,IAAI;AAAA,QACF,SAAS;AAAA,QACT,IAAI;AAAA,QACJ,IAAI;AAAA,QACJ,WAAW;AAAA,MACb;AAAA,MANF,UAAA,CAQE,gBAAA,EAAC,GAAD;AAAA,QAAM,SAAQ;AAAA,QAAM,UAAA;AAAA,MAAgB,CAAA,GACpC,gBAAA,EAAC,GAAD;AAAA,QAAM,OAAM;AAAA,QAAiB,SAAQ;AAAA,QAClC,UAAA;AAAA,MACG,CAAA,CACH;AAAA,IACF,CAAA,CAAA;AAAA;AAET"}
|
|
@@ -11,6 +11,7 @@ interface StatusMessageCardProps {
|
|
|
11
11
|
borderColor?: string;
|
|
12
12
|
/** Message text color token. */
|
|
13
13
|
messageColor?: string;
|
|
14
|
+
/** Styles for the slot around the banner (e.g. a gradient wash). */
|
|
14
15
|
sx?: SxProps;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
@@ -18,9 +19,13 @@ interface StatusMessageCardProps {
|
|
|
18
19
|
* a colored, bordered surface.
|
|
19
20
|
*
|
|
20
21
|
* Figma: the `All Categorized!` success state of Uncategorized Transactions V2
|
|
21
|
-
* (`Card / Content / Slot`) — green card (`success.
|
|
22
|
-
* border, radius 8), check-circle icon + bold message. Reusable
|
|
23
|
-
* icon + message status/empty state.
|
|
22
|
+
* (`Card / Content / Slot`) — green card (`success.lighter` bg, `success.main`
|
|
23
|
+
* border, radius 8), check-circle icon + bold `text.primary` message. Reusable
|
|
24
|
+
* for any icon + message status/empty state.
|
|
25
|
+
*
|
|
26
|
+
* Its own fill and message colours, not `STATUS_SUCCESS_TOKENS`: Figma's banner
|
|
27
|
+
* uses Success Lighter and text/primary, which flip to dark green and white in
|
|
28
|
+
* dark mode, where `success.100` stays mint and `success.darker` turns mint.
|
|
24
29
|
*
|
|
25
30
|
* Scope is the Content section only; Header/Description are out of scope.
|
|
26
31
|
*/
|
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { STATUS_SUCCESS_TOKENS as
|
|
2
|
-
import
|
|
3
|
-
import { Text as
|
|
4
|
-
import { jsx as
|
|
5
|
-
var f = ({ bgcolor:
|
|
1
|
+
import { STATUS_SUCCESS_TOKENS as p } from "./statusTokens.es.js";
|
|
2
|
+
import r from "@mui/material/Stack";
|
|
3
|
+
import { Text as l } from "@mxenabled/mxui";
|
|
4
|
+
import { jsx as o, jsxs as c } from "react/jsx-runtime";
|
|
5
|
+
var f = ({ bgcolor: e = "success.lighter", borderColor: t = p.borderColor, icon: s, message: i, messageColor: d = "text.primary", sx: a }) => /* @__PURE__ */ o(r, {
|
|
6
6
|
sx: {
|
|
7
7
|
px: 16,
|
|
8
8
|
py: 16,
|
|
9
9
|
width: "100%",
|
|
10
|
-
...
|
|
10
|
+
...a
|
|
11
11
|
},
|
|
12
|
-
children: /* @__PURE__ */
|
|
12
|
+
children: /* @__PURE__ */ c(r, {
|
|
13
13
|
role: "status",
|
|
14
14
|
sx: {
|
|
15
15
|
alignItems: "center",
|
|
16
|
-
bgcolor:
|
|
16
|
+
bgcolor: e,
|
|
17
17
|
border: "1px solid",
|
|
18
|
-
borderColor:
|
|
18
|
+
borderColor: t,
|
|
19
19
|
borderRadius: "8px",
|
|
20
|
+
boxShadow: (x) => x.shadows[1],
|
|
20
21
|
flexDirection: "row",
|
|
21
22
|
gap: 4,
|
|
22
23
|
px: 16,
|
|
23
|
-
py:
|
|
24
|
+
py: 13,
|
|
24
25
|
width: "100%"
|
|
25
26
|
},
|
|
26
|
-
children: [/* @__PURE__ */
|
|
27
|
+
children: [/* @__PURE__ */ o(r, {
|
|
27
28
|
sx: {
|
|
28
29
|
flexShrink: 0,
|
|
29
30
|
px: 4,
|
|
30
31
|
py: 6
|
|
31
32
|
},
|
|
32
|
-
children:
|
|
33
|
-
}), /* @__PURE__ */
|
|
33
|
+
children: s
|
|
34
|
+
}), /* @__PURE__ */ o(l, {
|
|
34
35
|
bold: !0,
|
|
35
|
-
color:
|
|
36
|
+
color: d,
|
|
36
37
|
variant: "body1",
|
|
37
|
-
children:
|
|
38
|
+
children: i
|
|
38
39
|
})]
|
|
39
40
|
})
|
|
40
41
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StatusMessageCard.es.js","names":[],"sources":["../../../src/insights-v2/components/StatusMessageCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { STATUS_SUCCESS_TOKENS } from './statusTokens'\n\ninterface StatusMessageCardProps {\n /** Leading status icon (e.g. a check-circle). */\n icon: ReactNode\n /** Status message. */\n message: ReactNode\n /** Card surface color token. */\n bgcolor?: string\n /** Card border color token. */\n borderColor?: string\n /** Message text color token. */\n messageColor?: string\n sx?: SxProps\n}\n\n/**\n * Single-line status/success message card: a leading icon and a bold message on\n * a colored, bordered surface.\n *\n * Figma: the `All Categorized!` success state of Uncategorized Transactions V2\n * (`Card / Content / Slot`) — green card (`success.
|
|
1
|
+
{"version":3,"file":"StatusMessageCard.es.js","names":[],"sources":["../../../src/insights-v2/components/StatusMessageCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport type { SxProps, Theme } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport { STATUS_SUCCESS_TOKENS } from './statusTokens'\n\ninterface StatusMessageCardProps {\n /** Leading status icon (e.g. a check-circle). */\n icon: ReactNode\n /** Status message. */\n message: ReactNode\n /** Card surface color token. */\n bgcolor?: string\n /** Card border color token. */\n borderColor?: string\n /** Message text color token. */\n messageColor?: string\n /** Styles for the slot around the banner (e.g. a gradient wash). */\n sx?: SxProps\n}\n\n/**\n * Single-line status/success message card: a leading icon and a bold message on\n * a colored, bordered surface.\n *\n * Figma: the `All Categorized!` success state of Uncategorized Transactions V2\n * (`Card / Content / Slot`) — green card (`success.lighter` bg, `success.main`\n * border, radius 8), check-circle icon + bold `text.primary` message. Reusable\n * for any icon + message status/empty state.\n *\n * Its own fill and message colours, not `STATUS_SUCCESS_TOKENS`: Figma's banner\n * uses Success Lighter and text/primary, which flip to dark green and white in\n * dark mode, where `success.100` stays mint and `success.darker` turns mint.\n *\n * Scope is the Content section only; Header/Description are out of scope.\n */\nconst StatusMessageCard = ({\n bgcolor = 'success.lighter',\n borderColor = STATUS_SUCCESS_TOKENS.borderColor,\n icon,\n message,\n messageColor = 'text.primary',\n sx,\n}: StatusMessageCardProps) => (\n <Stack sx={{ px: 16, py: 16, width: '100%', ...sx }}>\n <Stack\n role=\"status\"\n sx={{\n alignItems: 'center',\n bgcolor,\n border: '1px solid',\n borderColor,\n borderRadius: '8px',\n // Raised with elevation/1, as in Figma's only status banner (Uncategorized Transactions V2).\n boxShadow: (theme: Theme) => theme.shadows[1],\n flexDirection: 'row',\n gap: 4,\n px: 16,\n // Figma draws the 1px border inside its 14px padding; here it adds to the box, so 13px keeps\n // the banner 64px tall.\n py: 13,\n width: '100%',\n }}\n >\n <Stack sx={{ flexShrink: 0, px: 4, py: 6 }}>{icon}</Stack>\n <Text bold={true} color={messageColor} variant=\"body1\">\n {message}\n </Text>\n </Stack>\n </Stack>\n)\n\nexport default StatusMessageCard\n"],"mappings":";;;;AAuCA,IAAM,IAAA,CAAqB,EACzB,SAAA,IAAU,mBACV,aAAA,IAAc,EAAsB,aACpC,MAAA,GACA,SAAA,GACA,cAAA,IAAe,gBACf,IAAA,EAAA,MAEA,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,IAAI;AAAA,IAAI,IAAI;AAAA,IAAI,OAAO;AAAA,IAAQ,GAAG;AAAA,EAAG;AAAA,EAChD,UAAA,gBAAA,EAAC,GAAD;AAAA,IACE,MAAK;AAAA,IACL,IAAI;AAAA,MACF,YAAY;AAAA,MACZ,SAAA;AAAA,MACA,QAAQ;AAAA,MACR,aAAA;AAAA,MACA,cAAc;AAAA,MAEd,WAAA,CAAY,MAAiB,EAAM,QAAQ,CAAA;AAAA,MAC3C,eAAe;AAAA,MACf,KAAK;AAAA,MACL,IAAI;AAAA,MAGJ,IAAI;AAAA,MACJ,OAAO;AAAA,IACT;AAAA,IAjBF,UAAA,CAmBE,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,YAAY;AAAA,QAAG,IAAI;AAAA,QAAG,IAAI;AAAA,MAAE;AAAA,MAAI,UAAA;AAAA,IAAY,CAAA,GACzD,gBAAA,EAAC,GAAD;AAAA,MAAM,MAAM;AAAA,MAAM,OAAO;AAAA,MAAc,SAAQ;AAAA,MAC5C,UAAA;AAAA,IACG,CAAA,CACD;AAAA;AACF,CAAA"}
|
|
@@ -32,6 +32,10 @@ interface TransactionListCardProps {
|
|
|
32
32
|
* on a white surface inside the padded Slot (Figma HSA Deposit).
|
|
33
33
|
*/
|
|
34
34
|
background?: string;
|
|
35
|
+
/** Status disc over the card's corner (needs `background`). */
|
|
36
|
+
badge?: ReactNode;
|
|
37
|
+
/** Card shadow on the wash. */
|
|
38
|
+
elevated?: boolean;
|
|
35
39
|
sx?: SxProps;
|
|
36
40
|
}
|
|
37
41
|
/**
|
|
@@ -41,5 +45,5 @@ interface TransactionListCardProps {
|
|
|
41
45
|
*
|
|
42
46
|
* Scope is the Content section only; Header/Description are out of scope.
|
|
43
47
|
*/
|
|
44
|
-
declare const TransactionListCard: ({ background, footer, header, rows, variant, sx, }: TransactionListCardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
48
|
+
declare const TransactionListCard: ({ background, badge, elevated, footer, header, rows, variant, sx, }: TransactionListCardProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
45
49
|
export default TransactionListCard;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { Fragment as
|
|
3
|
-
import
|
|
1
|
+
import R from "./InsightTransactionRow.es.js";
|
|
2
|
+
import { Fragment as k } from "react";
|
|
3
|
+
import i from "@mui/material/Stack";
|
|
4
4
|
import { Text as h } from "@mxenabled/mxui";
|
|
5
|
-
import { Fragment as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
var
|
|
5
|
+
import { Fragment as b, jsx as r, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import f from "@mui/material/Box";
|
|
7
|
+
import m from "@mui/material/Divider";
|
|
8
|
+
var T = (n) => n === "primary" ? {
|
|
9
9
|
radius: "8px",
|
|
10
10
|
borderColor: "primary.main",
|
|
11
11
|
headerBg: "primary.main",
|
|
@@ -29,9 +29,9 @@ var w = (n) => n === "primary" ? {
|
|
|
29
29
|
px: 16,
|
|
30
30
|
py: 2
|
|
31
31
|
}
|
|
32
|
-
},
|
|
33
|
-
if (
|
|
34
|
-
const e =
|
|
32
|
+
}, z = ({ background: n, badge: c, elevated: g = !1, footer: l, header: d, rows: u, variant: B = "default", sx: y }) => {
|
|
33
|
+
if (u.length === 0) return null;
|
|
34
|
+
const e = T(B), o = !!n, t = o ? "8px" : e.radius, s = !!d && !o && e.headerInsideBorder, p = d ? /* @__PURE__ */ r(i, {
|
|
35
35
|
sx: {
|
|
36
36
|
bgcolor: e.headerBg,
|
|
37
37
|
justifyContent: "center",
|
|
@@ -43,10 +43,10 @@ var w = (n) => n === "primary" ? {
|
|
|
43
43
|
variant: "caption",
|
|
44
44
|
children: d
|
|
45
45
|
})
|
|
46
|
-
}) : null,
|
|
46
|
+
}) : null, C = l ? /* @__PURE__ */ a(b, { children: [/* @__PURE__ */ r(m, {}), /* @__PURE__ */ a(i, {
|
|
47
47
|
sx: {
|
|
48
48
|
alignItems: "center",
|
|
49
|
-
bgcolor:
|
|
49
|
+
bgcolor: o ? "background.paper" : "background.default",
|
|
50
50
|
flexDirection: "row",
|
|
51
51
|
justifyContent: "space-between",
|
|
52
52
|
minHeight: 40,
|
|
@@ -63,57 +63,73 @@ var w = (n) => n === "primary" ? {
|
|
|
63
63
|
variant: "body2",
|
|
64
64
|
children: l.amount
|
|
65
65
|
})]
|
|
66
|
-
})] }) : null,
|
|
66
|
+
})] }) : null, v = /* @__PURE__ */ r(i, {
|
|
67
67
|
role: "list",
|
|
68
68
|
sx: { width: "100%" },
|
|
69
|
-
children:
|
|
69
|
+
children: u.map((w, x) => /* @__PURE__ */ a(k, { children: [x > 0 && /* @__PURE__ */ r(m, { role: "presentation" }), /* @__PURE__ */ r(f, {
|
|
70
70
|
role: "listitem",
|
|
71
|
-
children: /* @__PURE__ */ r(
|
|
72
|
-
})] },
|
|
71
|
+
children: /* @__PURE__ */ r(R, { ...w })
|
|
72
|
+
})] }, x))
|
|
73
73
|
});
|
|
74
|
-
return /* @__PURE__ */ a(
|
|
74
|
+
return /* @__PURE__ */ a(i, {
|
|
75
75
|
"data-testid": "transaction-list-card",
|
|
76
76
|
sx: {
|
|
77
|
-
...
|
|
77
|
+
...o ? {
|
|
78
78
|
background: n,
|
|
79
79
|
p: 16
|
|
80
80
|
} : {
|
|
81
81
|
pt: 8,
|
|
82
82
|
px: 16
|
|
83
83
|
},
|
|
84
|
+
...o && c ? { position: "relative" } : {},
|
|
84
85
|
width: "100%",
|
|
85
|
-
...
|
|
86
|
+
...y
|
|
86
87
|
},
|
|
87
|
-
children: [
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
}), /* @__PURE__ */ a(t, {
|
|
95
|
-
sx: {
|
|
96
|
-
...i ? { bgcolor: "background.paper" } : {
|
|
97
|
-
border: "1px solid",
|
|
98
|
-
borderColor: e.borderColor
|
|
88
|
+
children: [
|
|
89
|
+
o && c && /* @__PURE__ */ r(f, {
|
|
90
|
+
sx: {
|
|
91
|
+
left: 16,
|
|
92
|
+
position: "absolute",
|
|
93
|
+
top: 12,
|
|
94
|
+
zIndex: 1
|
|
99
95
|
},
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
96
|
+
children: c
|
|
97
|
+
}),
|
|
98
|
+
!s && p && /* @__PURE__ */ r(i, {
|
|
99
|
+
sx: {
|
|
100
|
+
borderTopLeftRadius: t,
|
|
101
|
+
borderTopRightRadius: t,
|
|
102
|
+
overflow: "hidden"
|
|
103
|
+
},
|
|
104
|
+
children: p
|
|
105
|
+
}),
|
|
106
|
+
/* @__PURE__ */ a(i, {
|
|
107
|
+
sx: {
|
|
108
|
+
...o ? {
|
|
109
|
+
bgcolor: "background.paper",
|
|
110
|
+
...g && { boxShadow: "0px 2px 8px rgba(0, 0, 0, 0.12)" }
|
|
111
|
+
} : {
|
|
112
|
+
border: "1px solid",
|
|
113
|
+
borderColor: e.borderColor
|
|
114
|
+
},
|
|
115
|
+
borderBottomLeftRadius: t,
|
|
116
|
+
borderBottomRightRadius: t,
|
|
117
|
+
borderTopLeftRadius: s || !d ? t : 0,
|
|
118
|
+
borderTopRightRadius: s || !d ? t : 0,
|
|
119
|
+
overflow: "hidden",
|
|
120
|
+
width: "100%"
|
|
121
|
+
},
|
|
122
|
+
children: [
|
|
123
|
+
s && /* @__PURE__ */ a(b, { children: [p, /* @__PURE__ */ r(m, {})] }),
|
|
124
|
+
v,
|
|
125
|
+
C
|
|
126
|
+
]
|
|
127
|
+
})
|
|
128
|
+
]
|
|
113
129
|
});
|
|
114
130
|
};
|
|
115
131
|
export {
|
|
116
|
-
|
|
132
|
+
z as default
|
|
117
133
|
};
|
|
118
134
|
|
|
119
135
|
//# sourceMappingURL=TransactionListCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransactionListCard.es.js","names":[],"sources":["../../../src/insights-v2/components/TransactionListCard.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport InsightTransactionRow, { type InsightTransactionRowProps } from './InsightTransactionRow'\n\nexport interface FooterRow {\n label: ReactNode\n amount: ReactNode\n amountColor?: string\n}\n\ntype TransactionListCardVariant = 'default' | 'primary'\n\ninterface TransactionListCardProps {\n /** Optional header label above the rows (e.g. \"{Date}\", \"3 transactions\"). */\n header?: ReactNode\n /** One or more transaction rows. */\n rows: InsightTransactionRowProps[]\n /** Optional summary/total row rendered beneath a divider. */\n footer?: FooterRow\n /**\n * Card style:\n * - `default` — grey utility header, hairline border, radius 4.\n * - `primary` — filled `primary.main` header with white text and a matching\n * border, radius 8 (Figma \"Multi\" variant).\n *\n * In both cases the header is borderless; the border wraps the content block\n * below it.\n */\n variant?: TransactionListCardVariant\n /**\n * Optional background applied to the Slot behind the card. Must be a valid CSS\n * background string (gradient or color in CSS format); MUI theme tokens are\n * not resolved here (this is the CSS `background` shorthand, not `bgcolor`), so\n * use a CSS color literal instead. When set, the inner card renders borderless\n * on a white surface inside the padded Slot (Figma HSA Deposit).\n */\n background?: string\n sx?: SxProps\n}\n\nconst getVariantStyles = (variant: TransactionListCardVariant) => {\n switch (variant) {\n case 'primary':\n // Borderless filled header on top of the bordered rows block.\n return {\n radius: '8px',\n borderColor: 'primary.main',\n headerBg: 'primary.main',\n headerColor: 'primary.contrastText',\n headerBold: false,\n headerInsideBorder: false,\n headerSx: { minHeight: 24, px: 12, py: 4 } as const,\n }\n default:\n // A single border wraps the card; the grey header sits inside it.\n return {\n radius: '8px',\n borderColor: 'divider',\n headerBg: 'background.default',\n headerColor: 'text.primary',\n headerBold: true,\n headerInsideBorder: true,\n headerSx: { minHeight: 36, px: 16, py: 2 } as const,\n }\n }\n}\n\n/**\n * List card composing an optional header label, one or more\n * `InsightTransactionRow`s (divided), and an optional footer/total row.\n * `variant` supplies the Figma design defaults for the two card styles.\n *\n * Scope is the Content section only; Header/Description are out of scope.\n */\nconst TransactionListCard = ({\n background,\n footer,\n header,\n rows,\n variant = 'default',\n sx,\n}: TransactionListCardProps) => {\n // rows usually comes from mapped API data, so an empty array is reachable and\n // would render a broken border shell; render nothing instead.\n if (rows.length === 0) return null\n\n const styles = getVariantStyles(variant)\n const hasBackground = Boolean(background)\n const radius = hasBackground ? '8px' : styles.radius\n // The header sits inside the border only for the bordered `default` variant;\n // for `primary`/backgrounded cards it sits above a separately-bordered body.\n const headerInsideBorder = Boolean(header) && !hasBackground && styles.headerInsideBorder\n\n const headerBlock = header ? (\n <Stack sx={{ bgcolor: styles.headerBg, justifyContent: 'center', ...styles.headerSx }}>\n <Text bold={styles.headerBold} color={styles.headerColor} variant=\"caption\">\n {header}\n </Text>\n </Stack>\n ) : null\n\n const footerBlock = footer ? (\n <>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: hasBackground ? 'background.paper' : 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {footer.label}\n </Text>\n <Text bold={true} color={footer.amountColor ?? 'text.primary'} variant=\"body2\">\n {footer.amount}\n </Text>\n </Stack>\n </>\n ) : null\n\n const rowsBlock = (\n <Stack role=\"list\" sx={{ width: '100%' }}>\n {rows.map((row, index) => (\n // Static, caller-ordered list that may contain identical rows, so the\n // array index is the correct key (a content-based key would collide).\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={index}>\n {index > 0 && <Divider role=\"presentation\" />}\n <Box role=\"listitem\">\n <InsightTransactionRow {...row} />\n </Box>\n </Fragment>\n ))}\n </Stack>\n )\n\n return (\n <Stack\n data-testid=\"transaction-list-card\"\n sx={{\n ...(hasBackground ? { background, p: 16 } : { pt: 8, px: 16 }),\n width: '100%',\n ...sx,\n }}\n >\n {/* Header above the border for `primary`/backgrounded cards; top-rounded. */}\n {!headerInsideBorder && headerBlock && (\n <Stack\n sx={{\n borderTopLeftRadius: radius,\n borderTopRightRadius: radius,\n overflow: 'hidden',\n }}\n >\n {headerBlock}\n </Stack>\n )}\n\n <Stack\n sx={{\n ...(hasBackground\n ? {
|
|
1
|
+
{"version":3,"file":"TransactionListCard.es.js","names":[],"sources":["../../../src/insights-v2/components/TransactionListCard.tsx"],"sourcesContent":["import { Fragment, type ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Text } from '@mxenabled/mxui'\n\nimport InsightTransactionRow, { type InsightTransactionRowProps } from './InsightTransactionRow'\n\nexport interface FooterRow {\n label: ReactNode\n amount: ReactNode\n amountColor?: string\n}\n\ntype TransactionListCardVariant = 'default' | 'primary'\n\ninterface TransactionListCardProps {\n /** Optional header label above the rows (e.g. \"{Date}\", \"3 transactions\"). */\n header?: ReactNode\n /** One or more transaction rows. */\n rows: InsightTransactionRowProps[]\n /** Optional summary/total row rendered beneath a divider. */\n footer?: FooterRow\n /**\n * Card style:\n * - `default` — grey utility header, hairline border, radius 4.\n * - `primary` — filled `primary.main` header with white text and a matching\n * border, radius 8 (Figma \"Multi\" variant).\n *\n * In both cases the header is borderless; the border wraps the content block\n * below it.\n */\n variant?: TransactionListCardVariant\n /**\n * Optional background applied to the Slot behind the card. Must be a valid CSS\n * background string (gradient or color in CSS format); MUI theme tokens are\n * not resolved here (this is the CSS `background` shorthand, not `bgcolor`), so\n * use a CSS color literal instead. When set, the inner card renders borderless\n * on a white surface inside the padded Slot (Figma HSA Deposit).\n */\n background?: string\n /** Status disc over the card's corner (needs `background`). */\n badge?: ReactNode\n /** Card shadow on the wash. */\n elevated?: boolean\n sx?: SxProps\n}\n\nconst getVariantStyles = (variant: TransactionListCardVariant) => {\n switch (variant) {\n case 'primary':\n // Borderless filled header on top of the bordered rows block.\n return {\n radius: '8px',\n borderColor: 'primary.main',\n headerBg: 'primary.main',\n headerColor: 'primary.contrastText',\n headerBold: false,\n headerInsideBorder: false,\n headerSx: { minHeight: 24, px: 12, py: 4 } as const,\n }\n default:\n // A single border wraps the card; the grey header sits inside it.\n return {\n radius: '8px',\n borderColor: 'divider',\n headerBg: 'background.default',\n headerColor: 'text.primary',\n headerBold: true,\n headerInsideBorder: true,\n headerSx: { minHeight: 36, px: 16, py: 2 } as const,\n }\n }\n}\n\n/**\n * List card composing an optional header label, one or more\n * `InsightTransactionRow`s (divided), and an optional footer/total row.\n * `variant` supplies the Figma design defaults for the two card styles.\n *\n * Scope is the Content section only; Header/Description are out of scope.\n */\nconst TransactionListCard = ({\n background,\n badge,\n elevated = false,\n footer,\n header,\n rows,\n variant = 'default',\n sx,\n}: TransactionListCardProps) => {\n // rows usually comes from mapped API data, so an empty array is reachable and\n // would render a broken border shell; render nothing instead.\n if (rows.length === 0) return null\n\n const styles = getVariantStyles(variant)\n const hasBackground = Boolean(background)\n const radius = hasBackground ? '8px' : styles.radius\n // The header sits inside the border only for the bordered `default` variant;\n // for `primary`/backgrounded cards it sits above a separately-bordered body.\n const headerInsideBorder = Boolean(header) && !hasBackground && styles.headerInsideBorder\n\n const headerBlock = header ? (\n <Stack sx={{ bgcolor: styles.headerBg, justifyContent: 'center', ...styles.headerSx }}>\n <Text bold={styles.headerBold} color={styles.headerColor} variant=\"caption\">\n {header}\n </Text>\n </Stack>\n ) : null\n\n const footerBlock = footer ? (\n <>\n <Divider />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: hasBackground ? 'background.paper' : 'background.default',\n flexDirection: 'row',\n justifyContent: 'space-between',\n minHeight: 40,\n px: 16,\n py: 2,\n }}\n >\n <Text color=\"text.secondary\" variant=\"caption\">\n {footer.label}\n </Text>\n <Text bold={true} color={footer.amountColor ?? 'text.primary'} variant=\"body2\">\n {footer.amount}\n </Text>\n </Stack>\n </>\n ) : null\n\n const rowsBlock = (\n <Stack role=\"list\" sx={{ width: '100%' }}>\n {rows.map((row, index) => (\n // Static, caller-ordered list that may contain identical rows, so the\n // array index is the correct key (a content-based key would collide).\n // eslint-disable-next-line react/no-array-index-key\n <Fragment key={index}>\n {index > 0 && <Divider role=\"presentation\" />}\n <Box role=\"listitem\">\n <InsightTransactionRow {...row} />\n </Box>\n </Fragment>\n ))}\n </Stack>\n )\n\n return (\n <Stack\n data-testid=\"transaction-list-card\"\n sx={{\n ...(hasBackground ? { background, p: 16 } : { pt: 8, px: 16 }),\n ...(hasBackground && badge ? { position: 'relative' } : {}),\n width: '100%',\n ...sx,\n }}\n >\n {hasBackground &&\n badge && (\n // Centred on the card's top-left corner.\n <Box sx={{ left: 16, position: 'absolute', top: 12, zIndex: 1 }}>{badge}</Box>\n )}\n {/* Header above the border for `primary`/backgrounded cards; top-rounded. */}\n {!headerInsideBorder && headerBlock && (\n <Stack\n sx={{\n borderTopLeftRadius: radius,\n borderTopRightRadius: radius,\n overflow: 'hidden',\n }}\n >\n {headerBlock}\n </Stack>\n )}\n\n <Stack\n sx={{\n ...(hasBackground\n ? {\n bgcolor: 'background.paper',\n ...(elevated && { boxShadow: '0px 2px 8px rgba(0, 0, 0, 0.12)' }),\n }\n : { border: '1px solid', borderColor: styles.borderColor }),\n borderBottomLeftRadius: radius,\n borderBottomRightRadius: radius,\n borderTopLeftRadius: headerInsideBorder || !header ? radius : 0,\n borderTopRightRadius: headerInsideBorder || !header ? radius : 0,\n overflow: 'hidden',\n width: '100%',\n }}\n >\n {/* Header inside the border for the `default` table variant. */}\n {headerInsideBor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AAA,MASG,KACC,KAEE,gBAAA,EAAC,GAAD;AAAA,QAAK,IAAI;AAAA,UAAE,MAAM;AAAA,UAAI,UAAU;AAAA,UAAY,KAAK;AAAA,UAAI,QAAQ;AAAA,QAAE;AAAA,QAAI,UAAA;AAAA,MAAW,CAAA;AAAA,MAGhF,CAAC,KAAsB,KACtB,gBAAA,EAAC,GAAD;AAAA,QACE,IAAI;AAAA,UACF,qBAAqB;AAAA,UACrB,sBAAsB;AAAA,UACtB,UAAU;AAAA,QACZ;AAAA,QAEC,UAAA;AAAA,MACI,CAAA;AAAA,MAGT,gBAAA,EAAC,GAAD;AAAA,QACE,IAAI;AAAA,UACF,GAAI,IACA;AAAA,YACE,SAAS;AAAA,YACT,GAAI,KAAY,EAAE,WAAW,kCAAkC;AAAA,UACjE,IACA;AAAA,YAAE,QAAQ;AAAA,YAAa,aAAa,EAAO;AAAA,UAAY;AAAA,UAC3D,wBAAwB;AAAA,UACxB,yBAAyB;AAAA,UACzB,qBAAqB,KAAsB,CAAC,IAAS,IAAS;AAAA,UAC9D,sBAAsB,KAAsB,CAAC,IAAS,IAAS;AAAA,UAC/D,UAAU;AAAA,UACV,OAAO;AAAA,QACT;AAAA,QAdF,UAAA;AAAA,UAiBG,KACC,gBAAA,EAAA,GAAA,EAAA,UAAA,CACG,GACD,gBAAA,EAAC,GAAD,CAAU,CAAA,CACV,EAAA,CAAA;AAAA,UAEH;AAAA,UACA;AAAA,QACI;AAAA;IACF;AAAA;AAEX"}
|
|
@@ -1,37 +1,58 @@
|
|
|
1
1
|
import { ANALYTICS_EVENTS_CONFIG as o } from "../analytics/analyticsEventsConfig.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
2
|
+
import { CTA_STATUS_CONTENT_CLASS as r } from "../components/CtaStatus.es.js";
|
|
3
|
+
import { HOST_ACTIONS as a } from "./hostActions.es.js";
|
|
4
|
+
import { subscriptionEntryStep as n, subscriptionSurvey as _ } from "./subscriptionAnswer.es.js";
|
|
5
|
+
import { alpha as c } from "@mui/material/styles";
|
|
6
|
+
var u = ({ beat: t, stores: i }) => {
|
|
7
|
+
const e = i.insightsV2Store.beatContext[t.guid]?.selected_account_guid;
|
|
8
|
+
if (typeof e == "string")
|
|
9
|
+
return i.accountStore.visibleSavingsAccounts.some((s) => s.guid === e && !s.is_closed && !s.is_deleted) ? e : void 0;
|
|
10
|
+
}, S = {
|
|
9
11
|
dismiss_beat: {
|
|
10
12
|
run: "delegateToHost",
|
|
11
|
-
params: { hostAction:
|
|
13
|
+
params: { hostAction: a.dismissBeat }
|
|
12
14
|
},
|
|
13
15
|
select_savings_account: {
|
|
14
16
|
run: "updateUserInsightProfile",
|
|
15
|
-
params: (
|
|
16
|
-
disabledWhen: (
|
|
17
|
+
params: (t) => ({ fields: { emergency_savings_account_guid: u(t) } }),
|
|
18
|
+
disabledWhen: (t) => !u(t),
|
|
17
19
|
onSuccess: ["refreshBeat"],
|
|
18
20
|
analytics: o.EMERGENCY_SAVINGS_ACCT_SAVED
|
|
19
21
|
},
|
|
20
22
|
open_savings_account: { analytics: o.EMERGENCY_SAVINGS_ACCT_CREATED },
|
|
21
23
|
atomic_flow: {
|
|
22
24
|
run: "delegateToHost",
|
|
23
|
-
params: { hostAction:
|
|
25
|
+
params: { hostAction: a.atomicTransact }
|
|
24
26
|
},
|
|
25
27
|
confirm_subscription_detected: {
|
|
26
|
-
...
|
|
28
|
+
...n({ statusLabels: {
|
|
27
29
|
positive: "confirmed",
|
|
28
30
|
negative: "incorrect"
|
|
29
31
|
} }),
|
|
30
|
-
surveyAnswer:
|
|
32
|
+
surveyAnswer: _
|
|
33
|
+
},
|
|
34
|
+
confirm_subscription_status: {
|
|
35
|
+
...n({
|
|
36
|
+
statusLabels: {
|
|
37
|
+
positive: "subscribed",
|
|
38
|
+
negative: "not_subscribed"
|
|
39
|
+
},
|
|
40
|
+
sx: {
|
|
41
|
+
minHeight: 56,
|
|
42
|
+
[`& .${r}`]: { gap: 10 }
|
|
43
|
+
},
|
|
44
|
+
negativeSx: {
|
|
45
|
+
bgcolor: "background.paper",
|
|
46
|
+
borderColor: (t) => c(t.palette.common.black, 0.5),
|
|
47
|
+
[`& .${r} .MuiSvgIcon-root`]: { color: (t) => c(t.palette.common.black, 0.7) }
|
|
48
|
+
},
|
|
49
|
+
answeredTitle: (t) => t.insights_feed?.subscription_status_modal?.reviewed_title
|
|
50
|
+
}),
|
|
51
|
+
compactStatus: !0
|
|
31
52
|
}
|
|
32
53
|
};
|
|
33
54
|
export {
|
|
34
|
-
|
|
55
|
+
S as ctaActions
|
|
35
56
|
};
|
|
36
57
|
|
|
37
58
|
//# 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 { 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":"
|
|
1
|
+
{"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { alpha, type Theme } from '@mui/material/styles'\n\nimport { ANALYTICS_EVENTS_CONFIG } from '../analytics/analyticsEventsConfig'\nimport { CTA_STATUS_CONTENT_CLASS } from '../components/CtaStatus'\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 /**\n * Unexpected Subscription Payment: the shared subscription status CTA, answered through its\n * Subscription Status modal. Its Figma: a 56px bar, and a white \"Not subscribed\" bar with a 50%\n * black border and 70% black icon. Mini and micro mirror the status (`compactStatus`).\n */\n confirm_subscription_status: {\n ...subscriptionEntryStep({\n statusLabels: { positive: 'subscribed', negative: 'not_subscribed' },\n sx: { minHeight: 56, [`& .${CTA_STATUS_CONTENT_CLASS}`]: { gap: 10 } },\n negativeSx: {\n bgcolor: 'background.paper',\n borderColor: (theme: Theme) => alpha(theme.palette.common.black, 0.5),\n [`& .${CTA_STATUS_CONTENT_CLASS} .MuiSvgIcon-root`]: {\n color: (theme: Theme) => alpha(theme.palette.common.black, 0.7),\n },\n },\n answeredTitle: (copy) => copy.insights_feed?.subscription_status_modal?.reviewed_title,\n }),\n compactStatus: true,\n },\n}\n"],"mappings":";;;;;AAaA,IAAM,IAAA,CAA4B,EAAE,MAAA,GAAM,QAAA,EAAA,MAAuD;AAC/F,QAAM,IAAS,EAAO,gBAAgB,YAAY,EAAK,IAAA,GAAO;AAE9D,MAAI,OA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eAAA,CAAgB,MAAS,EAAK,eAAe,2BAA2B;AAAA,IAC1E,CAAC;AAAA,IACD,eAAe;AAAA,EACjB;AACF"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { SxProps, Theme } from '@mui/material/styles';
|
|
2
|
+
import { GlobalCopy } from '../../core/types/GlobalCopy';
|
|
1
3
|
import { InsightsFeedCopy, SurveyModalCopy } from '../../core/types/localization/InsightsFeedCopy';
|
|
2
4
|
import { RepeatingTransaction } from '../../core/types/RepeatingTransaction';
|
|
3
5
|
import { BeatActions } from '../beatActions';
|
|
@@ -37,12 +39,18 @@ export interface SubscriptionEntryOptions {
|
|
|
37
39
|
};
|
|
38
40
|
/** Whether the stored answer applies to this beat (default: every answer counts). */
|
|
39
41
|
answerCounts?: (ctx: CtaStateContext, repeating: RepeatingTransaction) => boolean;
|
|
42
|
+
/** Status bar overrides for this step (e.g. a taller bar). */
|
|
43
|
+
sx?: SxProps<Theme>;
|
|
44
|
+
/** Extra overrides for a negative answer's bar (on top of `sx`), e.g. its own neutral look. */
|
|
45
|
+
negativeSx?: SxProps<Theme>;
|
|
46
|
+
/** The card's title once answered, from copy (mini and micro retitle; full keeps its title). */
|
|
47
|
+
answeredTitle?: (copy: GlobalCopy) => string | undefined;
|
|
40
48
|
}
|
|
41
49
|
/**
|
|
42
50
|
* The step a beat's `action_key` names: the button until answered, then the status with Undo. No
|
|
43
51
|
* repeating transaction or transaction: no CTAs, as pulse. A missing word draws nothing.
|
|
44
52
|
*/
|
|
45
|
-
export declare const subscriptionEntryStep: ({ statusLabels, answerCounts, }: SubscriptionEntryOptions) => CtaStep;
|
|
53
|
+
export declare const subscriptionEntryStep: ({ statusLabels, sx, negativeSx, answeredTitle, answerCounts, }: SubscriptionEntryOptions) => CtaStep;
|
|
46
54
|
/** A subscription entry's `surveyAnswer`: Yes writes CONFIRMED, a reason its value. */
|
|
47
55
|
export declare const subscriptionSurvey: (ctx: WriteCtx, copy: SurveyModalCopy) => CtaSurveyAnswer;
|
|
48
56
|
export {};
|