@mx-cartographer/experiences 9.4.69 → 9.4.71
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 +14 -0
- package/dist/common/utils/PostMessage.d.ts +5 -1
- package/dist/common/utils/PostMessage.es.js +26 -24
- package/dist/common/utils/PostMessage.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +25 -0
- package/dist/core/types/index.d.ts +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/DirectDepositBlock.d.ts +16 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/DirectDepositBlock.es.js +24 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/DirectDepositBlock.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/index.d.ts +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/layout.d.ts +28 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/layout.es.js +63 -0
- package/dist/insights-v2/blocks/ComponentBlocks/DirectDepositBlock/layout.es.js.map +1 -0
- package/dist/insights-v2/blocks/ComponentBlocks/index.d.ts +1 -0
- package/dist/insights-v2/components/AccountHeroCard.d.ts +7 -1
- package/dist/insights-v2/components/AccountHeroCard.es.js +6 -7
- package/dist/insights-v2/components/AccountHeroCard.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/DirectDepositCard.d.ts +48 -0
- package/dist/insights-v2/components/DirectDepositCard.es.js +37 -0
- package/dist/insights-v2/components/DirectDepositCard.es.js.map +1 -0
- package/dist/insights-v2/components/TransferLogoCard.d.ts +5 -0
- package/dist/insights-v2/components/TransferLogoCard.es.js +37 -55
- package/dist/insights-v2/components/TransferLogoCard.es.js.map +1 -1
- package/dist/insights-v2/components/shared/ConfettiOverlay.d.ts +1 -0
- package/dist/insights-v2/components/shared/ConfettiOverlay.es.js +27 -0
- package/dist/insights-v2/components/shared/ConfettiOverlay.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/ctaConfig.d.ts +3 -2
- package/dist/insights-v2/ctaActions/ctaConfig.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/ctaPostMessages.d.ts +16 -0
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js +51 -0
- package/dist/insights-v2/ctaActions/ctaPostMessages.es.js.map +1 -0
- package/dist/insights-v2/ctaActions/index.d.ts +1 -0
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +5 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +54 -51
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/types.d.ts +1 -1
- package/dist/insights-v2/index.d.ts +1 -0
- package/dist/insights-v2/index.es.js +70 -66
- package/dist/insights-v2/mappings/blocks.es.js +34 -32
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import n from "./StatusPill.es.js";
|
|
2
|
+
import { ConfettiOverlay as b } from "./shared/ConfettiOverlay.es.js";
|
|
3
|
+
import f from "./AccountHeroCard.es.js";
|
|
4
|
+
import { NEUTRAL_PILL as s } from "../blocks/ComponentBlocks/DirectDepositBlock/layout.es.js";
|
|
5
|
+
import { Icon as C } from "@mxenabled/mx-icons";
|
|
6
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
+
var h = ({ backgroundImage: t, bgcolor: i = "primary.lighter", logo: a, name: d, nameVariant: m = "body2", pill: o = s, showConfetti: l = !1, statusLabel: e, subtitle: c }) => /* @__PURE__ */ r(f, {
|
|
8
|
+
backdrop: l ? /* @__PURE__ */ r(b, {}) : void 0,
|
|
9
|
+
backgroundImage: t,
|
|
10
|
+
bgcolor: i,
|
|
11
|
+
logo: a,
|
|
12
|
+
name: d,
|
|
13
|
+
nameVariant: m,
|
|
14
|
+
status: e ? /* @__PURE__ */ r(n, {
|
|
15
|
+
bgcolor: o.bgcolor,
|
|
16
|
+
borderColor: o.borderColor,
|
|
17
|
+
icon: o.icon ? /* @__PURE__ */ r(C, {
|
|
18
|
+
"aria-hidden": !0,
|
|
19
|
+
"data-testid": "pill-icon",
|
|
20
|
+
name: o.icon,
|
|
21
|
+
size: 16,
|
|
22
|
+
sx: { color: o.labelColor }
|
|
23
|
+
}) : void 0,
|
|
24
|
+
label: e,
|
|
25
|
+
labelColor: o.labelColor,
|
|
26
|
+
sx: {
|
|
27
|
+
border: "none",
|
|
28
|
+
px: 12
|
|
29
|
+
}
|
|
30
|
+
}) : void 0,
|
|
31
|
+
subtitle: c
|
|
32
|
+
});
|
|
33
|
+
export {
|
|
34
|
+
h as default
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//# sourceMappingURL=DirectDepositCard.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DirectDepositCard.es.js","names":[],"sources":["../../../src/insights-v2/components/DirectDepositCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport AccountHeroCard from './AccountHeroCard'\nimport StatusPill from './StatusPill'\n\nimport { ConfettiOverlay } from './shared/ConfettiOverlay'\nimport { NEUTRAL_PILL } from '../blocks/ComponentBlocks/DirectDepositBlock/layout'\n\nexport interface DirectDepositPillConfig {\n /** Pill background color token. */\n bgcolor: string\n /** Pill border color token. */\n borderColor: string\n /** Pill label color token. */\n labelColor: string\n /** Optional mx-icons glyph rendered before the label (e.g. `check_circle`). */\n icon?: string\n}\n\n/**\n * Style props for the card. Variant-specific values live in the Direct Deposit\n * block's `layout.ts` (`getLayoutConfig`) — the card itself is variant-agnostic.\n */\nexport interface DirectDepositCardStyleProps {\n /** Slot surface token behind the white hero card. Default `primary.lighter`. */\n bgcolor?: string\n /** Decorative wash layered over `bgcolor` (celebration/gradient slots). */\n backgroundImage?: string\n /** Confetti burst behind the hero card (complete states). */\n showConfetti?: boolean\n /** Hero name typography. Default `body2` (13/16); rate variants use `body1` (15/20). */\n nameVariant?: 'body1' | 'body2'\n /** Status pill color tokens + optional leading glyph. */\n pill?: DirectDepositPillConfig\n}\n\ninterface DirectDepositCardProps extends DirectDepositCardStyleProps {\n /** Institution/account logo, rendered overhanging the hero card's top edge. */\n logo: ReactNode\n /** Primary line, e.g. \"Epic Bank Checking, *1234\". */\n name: ReactNode\n /** Optional secondary line, e.g. \"Checking Account\" / \"Credit Card\". */\n subtitle?: ReactNode\n /** Optional status pill label, e.g. \"Direct Deposit Not Set Up\". */\n statusLabel?: ReactNode\n}\n\n/**\n * The basic Direct Deposit hero card: an overhanging logo above a white card\n * with a name, optional subtitle, and a status pill, over a tinted/gradient\n * slot with an optional confetti backdrop.\n *\n * Purely presentational — it knows nothing about beats or variants. The Direct\n * Deposit block resolves `instance_slot.variant` to these style props via its\n * `layout.ts` (`getLayoutConfig`).\n */\nconst DirectDepositCard = ({\n backgroundImage,\n bgcolor = 'primary.lighter',\n logo,\n name,\n nameVariant = 'body2',\n pill = NEUTRAL_PILL,\n showConfetti = false,\n statusLabel,\n subtitle,\n}: DirectDepositCardProps) => {\n return (\n <AccountHeroCard\n backdrop={showConfetti ? <ConfettiOverlay /> : undefined}\n backgroundImage={backgroundImage}\n bgcolor={bgcolor}\n logo={logo}\n name={name}\n nameVariant={nameVariant}\n status={\n statusLabel ? (\n <StatusPill\n bgcolor={pill.bgcolor}\n borderColor={pill.borderColor}\n icon={\n pill.icon ? (\n <Icon\n aria-hidden={true}\n data-testid=\"pill-icon\"\n name={pill.icon}\n size={16}\n sx={{ color: pill.labelColor }}\n />\n ) : undefined\n }\n label={statusLabel}\n labelColor={pill.labelColor}\n // Figma pill geometry: 24px tall, 12px side padding, no stroke\n // (StatusPill defaults draw a 1px border and 16px padding).\n sx={{ border: 'none', px: 12 }}\n />\n ) : undefined\n }\n subtitle={subtitle}\n />\n )\n}\n\nexport default DirectDepositCard\n"],"mappings":";;;;;;AA0DA,IAAM,IAAA,CAAqB,EACzB,iBAAA,GACA,SAAA,IAAU,mBACV,MAAA,GACA,MAAA,GACA,aAAA,IAAc,SACd,MAAA,IAAO,GACP,cAAA,IAAe,IACf,aAAA,GACA,UAAA,EAAA,MAGE,gBAAA,EAAC,GAAD;AAAA,EACE,UAAU,IAAe,gBAAA,EAAC,GAAD,CAAkB,CAAA,IAAI;AAAA,EAC9B,iBAAA;AAAA,EACR,SAAA;AAAA,EACH,MAAA;AAAA,EACA,MAAA;AAAA,EACO,aAAA;AAAA,EACb,QACE,IACE,gBAAA,EAAC,GAAD;AAAA,IACE,SAAS,EAAK;AAAA,IACd,aAAa,EAAK;AAAA,IAClB,MACE,EAAK,OACH,gBAAA,EAAC,GAAD;AAAA,MACE,eAAa;AAAA,MACb,eAAY;AAAA,MACZ,MAAM,EAAK;AAAA,MACX,MAAM;AAAA,MACN,IAAI,EAAE,OAAO,EAAK,WAAW;AAAA,IAC9B,CAAA,IACC;AAAA,IAEN,OAAO;AAAA,IACP,YAAY,EAAK;AAAA,IAGjB,IAAI;AAAA,MAAE,QAAQ;AAAA,MAAQ,IAAI;AAAA,IAAG;AAAA,EAC9B,CAAA,IACC;AAAA,EAEI,UAAA;AACX,CAAA"}
|
|
@@ -34,6 +34,11 @@ interface TransferLogoCardProps {
|
|
|
34
34
|
showConfetti?: boolean;
|
|
35
35
|
sx?: SxProps;
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Confetti overlay for the success state. Measures the container and fires the
|
|
39
|
+
* burst once dimensions arrive. Scoped to this component so the resize listener
|
|
40
|
+
* only mounts when confetti is shown.
|
|
41
|
+
*/
|
|
37
42
|
/**
|
|
38
43
|
* A from → to account transfer visual: two institution logos on a rounded track
|
|
39
44
|
* with a central arrow badge and connector dots between them.
|
|
@@ -1,118 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Confetti as v } from "./shared/Confetti.es.js";
|
|
3
|
-
import { useRef as I } from "react";
|
|
1
|
+
import { ConfettiOverlay as w } from "./shared/ConfettiOverlay.es.js";
|
|
4
2
|
import d from "@mui/material/Stack";
|
|
5
|
-
import { Icon as
|
|
6
|
-
import { jsx as r, jsxs as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
var
|
|
3
|
+
import { Icon as v } from "@mxenabled/mx-icons";
|
|
4
|
+
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
5
|
+
import e from "@mui/material/Box";
|
|
6
|
+
import I from "@mui/material/Card";
|
|
7
|
+
var b = 240, R = 40, T = 204, y = /* @__PURE__ */ r(v, {
|
|
10
8
|
"aria-hidden": !0,
|
|
11
9
|
name: "arrow_forward",
|
|
12
10
|
size: 20,
|
|
13
11
|
sx: { color: "neutral.lighter" }
|
|
14
|
-
}),
|
|
15
|
-
bgcolor:
|
|
12
|
+
}), a = ({ color: n = "neutral.darker", size: i = 4 }) => /* @__PURE__ */ r(e, { sx: {
|
|
13
|
+
bgcolor: n,
|
|
16
14
|
borderRadius: "4px",
|
|
17
|
-
height:
|
|
18
|
-
width:
|
|
19
|
-
} }),
|
|
20
|
-
const
|
|
21
|
-
return /* @__PURE__ */ r(i, {
|
|
22
|
-
"aria-hidden": !0,
|
|
23
|
-
ref: t,
|
|
24
|
-
sx: {
|
|
25
|
-
inset: 0,
|
|
26
|
-
position: "absolute",
|
|
27
|
-
zIndex: 0
|
|
28
|
-
},
|
|
29
|
-
children: /* @__PURE__ */ r(v, {
|
|
30
|
-
height: e,
|
|
31
|
-
shouldRun: e > 0,
|
|
32
|
-
width: o
|
|
33
|
-
})
|
|
34
|
-
});
|
|
35
|
-
}, O = ({ badgeBgColor: t = "neutral.darker", bgcolor: e = "primary.lighter", backgroundImage: o, dotColor: n = "neutral.darker", from: f, hasBigDots: x = !0, icon: u = D, showConfetti: m = !1, size: l = 64, to: p, sx: g }) => {
|
|
36
|
-
const h = x ? 6 : 4, c = {
|
|
15
|
+
height: i,
|
|
16
|
+
width: i
|
|
17
|
+
} }), S = ({ badgeBgColor: n = "neutral.darker", bgcolor: i = "primary.lighter", backgroundImage: s, dotColor: t = "neutral.darker", from: x, hasBigDots: f = !0, icon: p = y, showConfetti: g = !1, size: l = 64, to: m, sx: u }) => {
|
|
18
|
+
const h = f ? 6 : 4, c = {
|
|
37
19
|
borderRadius: "4px",
|
|
38
20
|
flexShrink: 0,
|
|
39
21
|
height: l,
|
|
40
22
|
overflow: "hidden",
|
|
41
23
|
width: l
|
|
42
24
|
};
|
|
43
|
-
return /* @__PURE__ */
|
|
25
|
+
return /* @__PURE__ */ o(e, {
|
|
44
26
|
sx: {
|
|
45
|
-
bgcolor:
|
|
46
|
-
...
|
|
27
|
+
bgcolor: i,
|
|
28
|
+
...s && { backgroundImage: s },
|
|
47
29
|
p: 16,
|
|
48
30
|
position: "relative",
|
|
49
31
|
width: "100%",
|
|
50
|
-
...
|
|
32
|
+
...u
|
|
51
33
|
},
|
|
52
|
-
children: [
|
|
34
|
+
children: [g && /* @__PURE__ */ r(w, {}), /* @__PURE__ */ r(I, {
|
|
53
35
|
sx: {
|
|
54
36
|
position: "relative",
|
|
55
37
|
py: 16,
|
|
56
38
|
zIndex: 1
|
|
57
39
|
},
|
|
58
|
-
children: /* @__PURE__ */
|
|
40
|
+
children: /* @__PURE__ */ o(e, {
|
|
59
41
|
sx: {
|
|
60
42
|
display: "grid",
|
|
61
43
|
placeItems: "center"
|
|
62
44
|
},
|
|
63
|
-
children: [/* @__PURE__ */ r(
|
|
45
|
+
children: [/* @__PURE__ */ r(e, { sx: {
|
|
64
46
|
bgcolor: "neutral.lighter",
|
|
65
47
|
borderRadius: "24px",
|
|
66
48
|
gridArea: "1 / 1",
|
|
67
|
-
height:
|
|
68
|
-
width:
|
|
69
|
-
} }), /* @__PURE__ */
|
|
49
|
+
height: R,
|
|
50
|
+
width: b
|
|
51
|
+
} }), /* @__PURE__ */ o(d, {
|
|
70
52
|
sx: {
|
|
71
53
|
alignItems: "center",
|
|
72
54
|
flexDirection: "row",
|
|
73
55
|
gridArea: "1 / 1",
|
|
74
56
|
height: l,
|
|
75
57
|
justifyContent: "space-between",
|
|
76
|
-
width:
|
|
58
|
+
width: T
|
|
77
59
|
},
|
|
78
60
|
children: [
|
|
79
|
-
/* @__PURE__ */ r(
|
|
61
|
+
/* @__PURE__ */ r(e, {
|
|
80
62
|
sx: c,
|
|
81
|
-
children:
|
|
63
|
+
children: x
|
|
82
64
|
}),
|
|
83
|
-
/* @__PURE__ */
|
|
65
|
+
/* @__PURE__ */ o(d, {
|
|
84
66
|
sx: {
|
|
85
67
|
alignItems: "center",
|
|
86
68
|
flexDirection: "row",
|
|
87
69
|
gap: 4
|
|
88
70
|
},
|
|
89
71
|
children: [
|
|
90
|
-
/* @__PURE__ */ r(
|
|
91
|
-
/* @__PURE__ */ r(
|
|
92
|
-
color:
|
|
72
|
+
/* @__PURE__ */ r(a, { color: t }),
|
|
73
|
+
/* @__PURE__ */ r(a, {
|
|
74
|
+
color: t,
|
|
93
75
|
size: h
|
|
94
76
|
}),
|
|
95
77
|
/* @__PURE__ */ r(d, {
|
|
96
78
|
sx: {
|
|
97
79
|
alignItems: "center",
|
|
98
|
-
bgcolor:
|
|
80
|
+
bgcolor: n,
|
|
99
81
|
borderRadius: "50%",
|
|
100
82
|
height: 28,
|
|
101
83
|
justifyContent: "center",
|
|
102
84
|
width: 28
|
|
103
85
|
},
|
|
104
|
-
children:
|
|
86
|
+
children: p
|
|
105
87
|
}),
|
|
106
|
-
/* @__PURE__ */ r(
|
|
107
|
-
color:
|
|
88
|
+
/* @__PURE__ */ r(a, {
|
|
89
|
+
color: t,
|
|
108
90
|
size: h
|
|
109
91
|
}),
|
|
110
|
-
/* @__PURE__ */ r(
|
|
92
|
+
/* @__PURE__ */ r(a, { color: t })
|
|
111
93
|
]
|
|
112
94
|
}),
|
|
113
|
-
/* @__PURE__ */ r(
|
|
95
|
+
/* @__PURE__ */ r(e, {
|
|
114
96
|
sx: c,
|
|
115
|
-
children:
|
|
97
|
+
children: m
|
|
116
98
|
})
|
|
117
99
|
]
|
|
118
100
|
})]
|
|
@@ -121,7 +103,7 @@ var y = 240, T = 40, C = 204, D = /* @__PURE__ */ r(R, {
|
|
|
121
103
|
});
|
|
122
104
|
};
|
|
123
105
|
export {
|
|
124
|
-
|
|
106
|
+
S as default
|
|
125
107
|
};
|
|
126
108
|
|
|
127
109
|
//# sourceMappingURL=TransferLogoCard.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransferLogoCard.es.js","names":[],"sources":["../../../src/insights-v2/components/TransferLogoCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\
|
|
1
|
+
{"version":3,"file":"TransferLogoCard.es.js","names":[],"sources":["../../../src/insights-v2/components/TransferLogoCard.tsx"],"sourcesContent":["import type { ReactNode } from 'react'\n\nimport Box from '@mui/material/Box'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { ConfettiOverlay } from './shared/ConfettiOverlay'\n\n// Figma track/row footprints (mirrors v1 `shared/ConnectionCard`): a 240×40\n// rounded track centered behind a 204×64 row of logos + center badge.\nconst TRACK_WIDTH = 240\nconst TRACK_HEIGHT = 40\nconst ROW_WIDTH = 204\n\ninterface TransferLogoCardProps {\n /** Source institution logo (left). */\n from: ReactNode\n /** Destination institution logo (right). */\n to: ReactNode\n /** Logo tile size in px (Figma: 64). */\n size?: number\n /** Arrow icon rendered in the center badge. Defaults to a right arrow. */\n icon?: ReactNode\n /**\n * Enlarge the inner connector dots (6px vs 4px), matching the Discovered\n * Accounts insight for cross-insight consistency. Default true.\n */\n hasBigDots?: boolean\n /** Connector-dot color token. Default `neutral.darker` (theme-aware). */\n dotColor?: string\n /** Center badge background color token. Default `neutral.darker` (dark circle\n * for Switch DD default; set to `success.main` for Discovered Accounts success). */\n badgeBgColor?: string\n /** Slot surface color token. Default `primary.lighter` (Figma's tinted slot,\n * theme-aware: light-blue in light mode, navy in dark). */\n bgcolor?: string\n /**\n * Optional background image (e.g., celebration gradient) for success states.\n * Layered over the `bgcolor` via `backgroundImage` (not `background` shorthand).\n */\n backgroundImage?: string\n /**\n * Show a confetti animation filling the slot (for success/celebration states).\n * Requires `useContainerDimensions` to measure the slot. Default false.\n */\n showConfetti?: boolean\n sx?: SxProps\n}\n\n// Default center-badge glyph. Hoisted to a stable reference so it isn't\n// re-created each render (`neutral.lighter` is the theme-aware inverse of the\n// badge fill: light glyph on dark badge, and vice-versa in dark).\nconst defaultTransferIcon = (\n <Icon aria-hidden={true} name=\"arrow_forward\" size={20} sx={{ color: 'neutral.lighter' }} />\n)\n\n// Connector dot: a small rounded square that reads as a dot at this size\n// (matches v1 `ConnectionCard`'s `Dot`). `neutral.darker` is theme-aware. The\n// inner pair is larger (`bigDots`, as Discovered Accounts uses) than the outer.\nconst Dot = ({ color = 'neutral.darker', size = 4 }: { color?: string; size?: number }) => (\n <Box sx={{ bgcolor: color, borderRadius: '4px', height: size, width: size }} />\n)\n\n/**\n * Confetti overlay for the success state. Measures the container and fires the\n * burst once dimensions arrive. Scoped to this component so the resize listener\n * only mounts when confetti is shown.\n */\n\n/**\n * A from → to account transfer visual: two institution logos on a rounded track\n * with a central arrow badge and connector dots between them.\n *\n * Figma: Switch Direct Deposit (default) Content. Structure ported from v1\n * `insights/components/shared/ConnectionCard` (grid-overlaid track + row).\n * Scope is the Content section only.\n */\nconst TransferLogoCard = ({\n badgeBgColor = 'neutral.darker',\n bgcolor = 'primary.lighter',\n backgroundImage,\n dotColor = 'neutral.darker',\n from,\n hasBigDots = true,\n icon = defaultTransferIcon,\n showConfetti = false,\n size = 64,\n to,\n sx,\n}: TransferLogoCardProps) => {\n const dotSize = hasBigDots ? 6 : 4\n const logoSx = {\n borderRadius: '4px',\n flexShrink: 0,\n height: size,\n overflow: 'hidden',\n width: size,\n } as const\n\n return (\n <Box\n sx={{\n bgcolor,\n ...(backgroundImage && { backgroundImage }),\n p: 16,\n // Positioned wrapper so the confetti overlay can fill the slot; the card\n // sits above it (zIndex). No `overflow: hidden` — that would clip the\n // burst's upper area (per the figma-to-code confetti guidance).\n position: 'relative',\n width: '100%',\n ...sx,\n }}\n >\n {showConfetti && <ConfettiOverlay />}\n <Card sx={{ position: 'relative', py: 16, zIndex: 1 }}>\n <Box sx={{ display: 'grid', placeItems: 'center' }}>\n {/* Grey track, centered behind the row via a shared grid cell. */}\n <Box\n sx={{\n bgcolor: 'neutral.lighter',\n borderRadius: '24px',\n gridArea: '1 / 1',\n height: TRACK_HEIGHT,\n width: TRACK_WIDTH,\n }}\n />\n <Stack\n sx={{\n alignItems: 'center',\n flexDirection: 'row',\n gridArea: '1 / 1',\n height: size,\n justifyContent: 'space-between',\n width: ROW_WIDTH,\n }}\n >\n <Box sx={logoSx}>{from}</Box>\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n <Dot color={dotColor} />\n <Dot color={dotColor} size={dotSize} />\n <Stack\n sx={{\n alignItems: 'center',\n bgcolor: badgeBgColor,\n borderRadius: '50%',\n height: 28,\n justifyContent: 'center',\n width: 28,\n }}\n >\n {icon}\n </Stack>\n <Dot color={dotColor} size={dotSize} />\n <Dot color={dotColor} />\n </Stack>\n <Box sx={logoSx}>{to}</Box>\n </Stack>\n </Box>\n </Card>\n </Box>\n )\n}\n\nexport default TransferLogoCard\n"],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ConfettiOverlay: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useContainerDimensions as i } from "../../hooks/useContainerDimensions.es.js";
|
|
2
|
+
import { Confetti as n } from "./Confetti.es.js";
|
|
3
|
+
import { useRef as s } from "react";
|
|
4
|
+
import { jsx as e } from "react/jsx-runtime";
|
|
5
|
+
import { Box as m } from "@mui/material";
|
|
6
|
+
var d = () => {
|
|
7
|
+
const o = s(null), { height: r, width: t } = i(o);
|
|
8
|
+
return /* @__PURE__ */ e(m, {
|
|
9
|
+
"aria-hidden": !0,
|
|
10
|
+
ref: o,
|
|
11
|
+
sx: {
|
|
12
|
+
inset: 0,
|
|
13
|
+
position: "absolute",
|
|
14
|
+
zIndex: 0
|
|
15
|
+
},
|
|
16
|
+
children: /* @__PURE__ */ e(n, {
|
|
17
|
+
height: r,
|
|
18
|
+
shouldRun: r > 0,
|
|
19
|
+
width: t
|
|
20
|
+
})
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
d as ConfettiOverlay
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
//# sourceMappingURL=ConfettiOverlay.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ConfettiOverlay.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/ConfettiOverlay.tsx"],"sourcesContent":["import { useRef } from 'react'\nimport { useContainerDimensions } from '../../hooks/useContainerDimensions'\nimport Confetti from './Confetti'\nimport { Box } from '@mui/material'\n\nexport const ConfettiOverlay = () => {\n const overlayRef = useRef<HTMLDivElement>(null)\n const { height, width } = useContainerDimensions(overlayRef)\n return (\n <Box aria-hidden={true} ref={overlayRef} sx={{ inset: 0, position: 'absolute', zIndex: 0 }}>\n <Confetti height={height} shouldRun={height > 0} width={width} />\n </Box>\n )\n}\n"],"mappings":";;;;;AAKA,IAAa,IAAA,MAAwB;AACnC,QAAM,IAAa,EAAuB,IAAI,GACxC,EAAE,QAAA,GAAQ,OAAA,EAAA,IAAU,EAAuB,CAAU;AAC3D,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,eAAa;AAAA,IAAM,KAAK;AAAA,IAAY,IAAI;AAAA,MAAE,OAAO;AAAA,MAAG,UAAU;AAAA,MAAY,QAAQ;AAAA,IAAE;AAAA,IACvF,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAkB,QAAA;AAAA,MAAQ,WAAW,IAAS;AAAA,MAAU,OAAA;AAAA,IAAQ,CAAA;AAAA,EAC7D,CAAA;AAET"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { CtaStep } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Steps keyed by the backend-named `cta.action_key` (ditto `*_cta_action`, via tupac). No key or
|
|
4
|
-
* an unknown key = default: open the CTA's block drawer,
|
|
5
|
-
*
|
|
4
|
+
* an unknown key = default: open the CTA's block drawer, if any. Its post message, when one
|
|
5
|
+
* resolves (`cta.metadata` / `ctaPostMessages`), is sent either way. A new key is registered in
|
|
6
|
+
* ditto and here in the same change; most CTAs need none. See README.md.
|
|
6
7
|
*/
|
|
7
8
|
export declare const ctaActions: Record<string, CtaStep>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { HOST_ACTIONS } from './hostActions'\nimport type { CtaStep } from './types'\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,
|
|
1
|
+
{"version":3,"file":"ctaConfig.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaConfig.ts"],"sourcesContent":["import { HOST_ACTIONS } from './hostActions'\nimport type { CtaStep } from './types'\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"],"mappings":";AASA,IAAa,IAAsC,EAEjD,cAAc;AAAA,EACZ,KAAK;AAAA,EACL,QAAQ,EAAE,YAAY,EAAa,YAAY;AACjD,EACF"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { CtaPostMessageMetadata } from '../../core';
|
|
2
|
+
import { CtaSlot, CtaStateContext } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Interim per-template post messages, carried over from the pulse beats, for CTAs the backend
|
|
5
|
+
* does not yet describe with `cta.metadata`. Each resolver returns the same shape the backend
|
|
6
|
+
* will send, or `null` for "no message" (the default then only opens the drawer for a block).
|
|
7
|
+
* Backend `metadata` always wins, so entries become dead the moment tupac ships the key for
|
|
8
|
+
* their template.
|
|
9
|
+
*
|
|
10
|
+
* Remove once every template here has `metadata` from the backend: delete this file, its test
|
|
11
|
+
* and README section, and the `resolveCtaMetadata` call in `runCtaAction.ts`.
|
|
12
|
+
*/
|
|
13
|
+
export type CtaPostMessageResolver = (ctx: CtaStateContext) => CtaPostMessageMetadata | null;
|
|
14
|
+
export declare const ctaPostMessages: Record<string, Partial<Record<CtaSlot, CtaPostMessageResolver>>>;
|
|
15
|
+
/** Backend `cta.metadata` first, else this template's interim resolver for the slot, else null. */
|
|
16
|
+
export declare const resolveCtaMetadata: (ctx: CtaStateContext) => CtaPostMessageMetadata | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { AccountType as u } from "../../core/types/Account.es.js";
|
|
2
|
+
import { BEAT_OPERATION_1 as o, BEAT_OPERATION_2 as s } from "../../common/utils/PostMessage.es.js";
|
|
3
|
+
var c = (a) => !a.is_hidden && !a.is_deleted && !a.is_closed, i = ({ beat: a, stores: t }) => a.primary_account ?? t.accountStore.accounts.find((n) => n.guid === a.primary_account_guid), l = ({ beat: a, stores: t }) => {
|
|
4
|
+
const n = new Set(a.account_guids);
|
|
5
|
+
return t.accountStore.accounts.filter((e) => n.has(e.guid) && c(e));
|
|
6
|
+
}, d = ({ stores: a }) => a.accountStore.accounts.filter((t) => t.account_type === u.SAVINGS && c(t)), _ = {
|
|
7
|
+
SaveAnExtra100Dollars: { primary: () => ({ action: o }) },
|
|
8
|
+
LowAccountBalance: { primary: (a) => {
|
|
9
|
+
const t = i(a);
|
|
10
|
+
return t ? {
|
|
11
|
+
action: o,
|
|
12
|
+
payload: { account_guid: t.external_guid }
|
|
13
|
+
} : null;
|
|
14
|
+
} },
|
|
15
|
+
MonthlyObligationsStatus: { primary: ({ beat: a }) => (a.payload?.total_remaining ?? 0) < 0 ? { action: o } : null },
|
|
16
|
+
DesignateEmergencySavingsAccount: { primary: ({ beat: a }) => !a.payload?.emergency_savings_account_guid && !a.account_guids.length ? { action: o } : null },
|
|
17
|
+
ReplenishSavings: { primary: (a) => ({
|
|
18
|
+
action: o,
|
|
19
|
+
payload: {
|
|
20
|
+
total_amount_withdrawn: a.beat.payload?.total_amount,
|
|
21
|
+
accounts: l(a).map((t) => ({
|
|
22
|
+
account_guid: t.external_guid,
|
|
23
|
+
account_name: a.beat.payload?.account_name?.default
|
|
24
|
+
}))
|
|
25
|
+
}
|
|
26
|
+
}) },
|
|
27
|
+
SavingsOpportunityV2: { primary: (a) => {
|
|
28
|
+
const t = i(a);
|
|
29
|
+
if (!t) return null;
|
|
30
|
+
const n = d(a), e = {
|
|
31
|
+
amount: a.beat.payload?.suggested_savings_amount,
|
|
32
|
+
source_account_id: t.external_guid
|
|
33
|
+
};
|
|
34
|
+
return n.length ? {
|
|
35
|
+
action: o,
|
|
36
|
+
payload: {
|
|
37
|
+
...e,
|
|
38
|
+
destination_account_ids: n.map((r) => r.external_guid)
|
|
39
|
+
}
|
|
40
|
+
} : {
|
|
41
|
+
action: s,
|
|
42
|
+
payload: e
|
|
43
|
+
};
|
|
44
|
+
} }
|
|
45
|
+
}, m = (a) => a.cta.metadata ?? _[a.beat.template]?.[a.slot]?.(a) ?? null;
|
|
46
|
+
export {
|
|
47
|
+
_ as ctaPostMessages,
|
|
48
|
+
m as resolveCtaMetadata
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
//# sourceMappingURL=ctaPostMessages.es.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ctaPostMessages.es.js","names":[],"sources":["../../../src/insights-v2/ctaActions/ctaPostMessages.ts"],"sourcesContent":["import { BEAT_OPERATION_1, BEAT_OPERATION_2 } from '../../common/utils/PostMessage'\nimport { AccountType, type Account, type CtaPostMessageMetadata } from '../../core'\nimport type { CtaSlot, CtaStateContext } from './types'\n\n/**\n * Interim per-template post messages, carried over from the pulse beats, for CTAs the backend\n * does not yet describe with `cta.metadata`. Each resolver returns the same shape the backend\n * will send, or `null` for \"no message\" (the default then only opens the drawer for a block).\n * Backend `metadata` always wins, so entries become dead the moment tupac ships the key for\n * their template.\n *\n * Remove once every template here has `metadata` from the backend: delete this file, its test\n * and README section, and the `resolveCtaMetadata` call in `runCtaAction.ts`.\n */\nexport type CtaPostMessageResolver = (ctx: CtaStateContext) => CtaPostMessageMetadata | null\n\ntype BeatContext = Pick<CtaStateContext, 'beat' | 'stores'>\n\nconst isUsable = (account: Account) =>\n !account.is_hidden && !account.is_deleted && !account.is_closed\n\n/** The beat's primary account: from the beat when the host attached it, else the account store. */\nconst primaryAccountOf = ({ beat, stores }: BeatContext): Account | undefined =>\n beat.primary_account ??\n stores.accountStore.accounts.find((account) => account.guid === beat.primary_account_guid)\n\n/** The accounts the beat points at (`account_guids`), as loaded in the account store. */\nconst beatAccountsOf = ({ beat, stores }: BeatContext): Account[] => {\n const guids = new Set<string>(beat.account_guids)\n\n return stores.accountStore.accounts.filter(\n (account) => guids.has(account.guid) && isUsable(account),\n )\n}\n\nconst savingsAccountsOf = ({ stores }: BeatContext): Account[] =>\n stores.accountStore.accounts.filter(\n (account) => account.account_type === AccountType.SAVINGS && isUsable(account),\n )\n\nexport const ctaPostMessages: Record<string, Partial<Record<CtaSlot, CtaPostMessageResolver>>> = {\n /** \"Make Transfer\": the base `beat/cta` op_1, nothing beat-specific. */\n SaveAnExtra100Dollars: {\n primary: () => ({ action: BEAT_OPERATION_1 }),\n },\n\n /** \"Transfer\": op_1 with the primary account's external id. No primary account → default. */\n LowAccountBalance: {\n primary: (ctx) => {\n const account = primaryAccountOf(ctx)\n\n return account\n ? { action: BEAT_OPERATION_1, payload: { account_guid: account.external_guid } }\n : null\n },\n },\n\n /** Posts only while off track (negative remaining); on track the CTA opens the drawer. */\n MonthlyObligationsStatus: {\n primary: ({ beat }) =>\n (beat.payload?.total_remaining ?? 0) < 0 ? { action: BEAT_OPERATION_1 } : null,\n },\n\n /**\n * \"Open savings account\": only when nothing is designated and there is no savings account to\n * pick from. The other states save the pick through an `action_key` (see `ctaConfig.ts`).\n */\n DesignateEmergencySavingsAccount: {\n primary: ({ beat }) =>\n !beat.payload?.emergency_savings_account_guid && !beat.account_guids.length\n ? { action: BEAT_OPERATION_1 }\n : null,\n },\n\n /** op_1 with the withdrawn total and the beat's accounts (external ids). */\n ReplenishSavings: {\n primary: (ctx) => ({\n action: BEAT_OPERATION_1,\n payload: {\n total_amount_withdrawn: ctx.beat.payload?.total_amount,\n accounts: beatAccountsOf(ctx).map((account) => ({\n account_guid: account.external_guid,\n account_name: ctx.beat.payload?.account_name?.default,\n })),\n },\n }),\n },\n\n /** op_1 = transfer into the user's savings accounts; op_2 = open one when there are none. */\n SavingsOpportunityV2: {\n primary: (ctx) => {\n const source = primaryAccountOf(ctx)\n\n if (!source) return null\n\n const savings = savingsAccountsOf(ctx)\n const payload = {\n amount: ctx.beat.payload?.suggested_savings_amount,\n source_account_id: source.external_guid,\n }\n\n return savings.length\n ? {\n action: BEAT_OPERATION_1,\n payload: {\n ...payload,\n destination_account_ids: savings.map((account) => account.external_guid),\n },\n }\n : { action: BEAT_OPERATION_2, payload }\n },\n },\n}\n\n/** Backend `cta.metadata` first, else this template's interim resolver for the slot, else null. */\nexport const resolveCtaMetadata = (ctx: CtaStateContext): CtaPostMessageMetadata | null =>\n ctx.cta.metadata ?? ctaPostMessages[ctx.beat.template]?.[ctx.slot]?.(ctx) ?? null\n"],"mappings":";;AAkBA,IAAM,IAAA,CAAY,MAChB,CAAC,EAAQ,aAAa,CAAC,EAAQ,cAAc,CAAC,EAAQ,WAGlD,IAAA,CAAoB,EAAE,MAAA,GAAM,QAAA,EAAA,MAChC,EAAK,mBACL,EAAO,aAAa,SAAS,KAAA,CAAM,MAAY,EAAQ,SAAS,EAAK,oBAAoB,GAGrF,IAAA,CAAkB,EAAE,MAAA,GAAM,QAAA,EAAA,MAAqC;AACnE,QAAM,IAAQ,IAAI,IAAY,EAAK,aAAa;AAEhD,SAAO,EAAO,aAAa,SAAS,OAAA,CACjC,MAAY,EAAM,IAAI,EAAQ,IAAI,KAAK,EAAS,CAAO,CAC1D;AACF,GAEM,IAAA,CAAqB,EAAE,QAAA,EAAA,MAC3B,EAAO,aAAa,SAAS,OAAA,CAC1B,MAAY,EAAQ,iBAAiB,EAAY,WAAW,EAAS,CAAO,CAC/E,GAEW,IAAoF;AAAA,EAE/F,uBAAuB,EACrB,SAAA,OAAgB,EAAE,QAAQ,EAAiB,GAC7C;AAAA,EAGA,mBAAmB,EACjB,SAAA,CAAU,MAAQ;AAChB,UAAM,IAAU,EAAiB,CAAG;AAEpC,WAAO,IACH;AAAA,MAAE,QAAQ;AAAA,MAAkB,SAAS,EAAE,cAAc,EAAQ,cAAc;AAAA,IAAE,IAC7E;AAAA,EACN,EACF;AAAA,EAGA,0BAA0B,EACxB,SAAA,CAAU,EAAE,MAAA,EAAA,OACT,EAAK,SAAS,mBAAmB,KAAK,IAAI,EAAE,QAAQ,EAAiB,IAAI,KAC9E;AAAA,EAMA,kCAAkC,EAChC,SAAA,CAAU,EAAE,MAAA,EAAA,MACV,CAAC,EAAK,SAAS,kCAAkC,CAAC,EAAK,cAAc,SACjE,EAAE,QAAQ,EAAiB,IAC3B,KACR;AAAA,EAGA,kBAAkB,EAChB,SAAA,CAAU,OAAS;AAAA,IACjB,QAAQ;AAAA,IACR,SAAS;AAAA,MACP,wBAAwB,EAAI,KAAK,SAAS;AAAA,MAC1C,UAAU,EAAe,CAAG,EAAE,IAAA,CAAK,OAAa;AAAA,QAC9C,cAAc,EAAQ;AAAA,QACtB,cAAc,EAAI,KAAK,SAAS,cAAc;AAAA,MAChD,EAAE;AAAA,IACJ;AAAA,EACF,GACF;AAAA,EAGA,sBAAsB,EACpB,SAAA,CAAU,MAAQ;AAChB,UAAM,IAAS,EAAiB,CAAG;AAEnC,QAAI,CAAC,EAAQ,QAAO;AAEpB,UAAM,IAAU,EAAkB,CAAG,GAC/B,IAAU;AAAA,MACd,QAAQ,EAAI,KAAK,SAAS;AAAA,MAC1B,mBAAmB,EAAO;AAAA,IAC5B;AAEA,WAAO,EAAQ,SACX;AAAA,MACE,QAAQ;AAAA,MACR,SAAS;AAAA,QACP,GAAG;AAAA,QACH,yBAAyB,EAAQ,IAAA,CAAK,MAAY,EAAQ,aAAa;AAAA,MACzE;AAAA,IACF,IACA;AAAA,MAAE,QAAQ;AAAA,MAAkB,SAAA;AAAA,IAAQ;AAAA,EAC1C,EACF;AACF,GAGa,IAAA,CAAsB,MACjC,EAAI,IAAI,YAAY,EAAgB,EAAI,KAAK,QAAA,IAAY,EAAI,IAAA,IAAQ,CAAG,KAAK"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { ctaActions } from './ctaConfig';
|
|
2
2
|
export { ctaHandlers, type CtaHandlerName } from './ctaHandlers';
|
|
3
|
+
export { ctaPostMessages, resolveCtaMetadata, type CtaPostMessageResolver } from './ctaPostMessages';
|
|
3
4
|
export { HOST_ACTIONS, type HostActionName } from './hostActions';
|
|
4
5
|
export { beatContextOf, resolveCtaState, resolveStep, runCtaAction, runCtaHandler, } from './runCtaAction';
|
|
5
6
|
export { useBeatCtaActions, useCtaHandler, type BeatCtaActions } from './useCtaAction';
|
|
@@ -6,7 +6,11 @@ export declare const beatContextOf: ({ beat, stores }: Pick<CtaStateContext, "be
|
|
|
6
6
|
export declare const resolveStep: ({ cta }: Pick<CtaStateContext, "cta">) => CtaStep;
|
|
7
7
|
/** Pending always disables; the step's `disabledWhen` may add to that. */
|
|
8
8
|
export declare const resolveCtaState: (ctx: CtaStateContext) => CtaState;
|
|
9
|
-
/**
|
|
9
|
+
/**
|
|
10
|
+
* Runs the CTA's step: `run` handler, `onSuccess` effects, the CTA's post message if one resolves
|
|
11
|
+
* (backend `cta.metadata` or the template's `ctaPostMessages` entry; skipped when the handler
|
|
12
|
+
* throws), then the `next` target. No resolved message = no post.
|
|
13
|
+
*/
|
|
10
14
|
export declare const runCtaAction: (ctx: CtaContext) => Promise<void>;
|
|
11
15
|
/** Runs a handler directly (drawer Save buttons): same bookkeeping as a card CTA. True on success. */
|
|
12
16
|
export declare const runCtaHandler: (ctx: CtaHandlerContext, handlerName: CtaHandlerName, { onSuccess }?: RunHandlerOptions) => Promise<boolean>;
|
|
@@ -1,79 +1,82 @@
|
|
|
1
1
|
import { sendBeatCta as l } from "../../common/utils/PostMessage.es.js";
|
|
2
|
-
import { hasDrawerBlock as
|
|
3
|
-
import { HOST_ACTIONS as
|
|
4
|
-
import { ctaActions as
|
|
5
|
-
import { ctaHandlers as
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
userGuid: e.insights_payload?.user_guid ?? e.user_guid
|
|
2
|
+
import { hasDrawerBlock as f } from "../mappings/blocks.es.js";
|
|
3
|
+
import { HOST_ACTIONS as m } from "./hostActions.es.js";
|
|
4
|
+
import { ctaActions as C } from "./ctaConfig.es.js";
|
|
5
|
+
import { ctaHandlers as v } from "./ctaHandlers.es.js";
|
|
6
|
+
import { resolveCtaMetadata as g } from "./ctaPostMessages.es.js";
|
|
7
|
+
var w = {}, o = ({ cta: t }) => t.action_key && C[t.action_key] || w, H = (t) => {
|
|
8
|
+
const a = o(t);
|
|
9
|
+
return { disabled: t.stores.insightsV2Store.ctaStatus[t.beat.guid] === "pending" || (a.disabledWhen?.(t) ?? !1) };
|
|
10
|
+
}, n = ({ beat: t, slot: a, stores: r }) => {
|
|
11
|
+
r.insightsV2Store.openCtaDrawer(t.guid, a === "primary" ? "primaryCta" : "secondaryCta");
|
|
12
|
+
}, h = ({ beat: t, stores: a }, r) => {
|
|
13
|
+
const { is_mobile_webview: e, clientConfig: s } = a.appDataStore.appConfig, { event: i, action: d, payload: p } = r;
|
|
14
|
+
l(t, {
|
|
15
|
+
event: i ?? void 0,
|
|
16
|
+
op: d ?? void 0,
|
|
17
|
+
extras: p ?? void 0,
|
|
18
|
+
isMobileWebview: e,
|
|
19
|
+
webviewScheme: s?.master?.ui_message_webview_url_scheme,
|
|
20
|
+
userGuid: t.insights_payload?.user_guid ?? t.user_guid
|
|
22
21
|
});
|
|
23
|
-
},
|
|
24
|
-
t
|
|
25
|
-
},
|
|
26
|
-
|
|
22
|
+
}, S = (t) => {
|
|
23
|
+
f(t.cta.block) && n(t);
|
|
24
|
+
}, _ = (t, { beat: a, stores: r }) => {
|
|
25
|
+
t === "refreshBeat" && r.emitUpdate({ staleBeatGuid: a.guid });
|
|
26
|
+
}, y = ({ beat: t, slot: a, hostActions: r }) => {
|
|
27
|
+
a !== "primary" || t.cta_clicked_at || Promise.resolve().then(() => r.onCtaAction?.({
|
|
27
28
|
beatGuid: t.guid,
|
|
28
|
-
name:
|
|
29
|
+
name: m.markCtaClicked
|
|
29
30
|
})).catch(() => {
|
|
30
31
|
});
|
|
31
|
-
}, c = async (t,
|
|
32
|
-
const
|
|
33
|
-
if (!
|
|
34
|
-
await
|
|
35
|
-
for (const s of
|
|
36
|
-
}, u = async ({ beat: t, stores:
|
|
37
|
-
const { insightsV2Store: s } =
|
|
32
|
+
}, c = async (t, a, r) => {
|
|
33
|
+
const e = v[a];
|
|
34
|
+
if (!e) throw new Error(`Unknown CTA handler "${a}"`);
|
|
35
|
+
await e(t);
|
|
36
|
+
for (const s of r) _(s, t);
|
|
37
|
+
}, u = async ({ beat: t, stores: a }, r, e = {}) => {
|
|
38
|
+
const { insightsV2Store: s } = a;
|
|
38
39
|
s.setCtaStatus(t.guid, "pending");
|
|
39
40
|
try {
|
|
40
|
-
return await
|
|
41
|
+
return await r(), s.setCtaStatus(t.guid, "done"), !0;
|
|
41
42
|
} catch (i) {
|
|
42
|
-
return s.setCtaStatus(t.guid, "error"),
|
|
43
|
+
return s.setCtaStatus(t.guid, "error"), a.captureException(i, {
|
|
43
44
|
store: "ctaActions",
|
|
44
45
|
template: t.template,
|
|
45
|
-
...
|
|
46
|
+
...e
|
|
46
47
|
}), !1;
|
|
47
48
|
}
|
|
48
|
-
},
|
|
49
|
-
const
|
|
49
|
+
}, G = async (t) => {
|
|
50
|
+
const a = o(t), r = typeof a.params == "function" ? a.params(t) : a.params, e = {
|
|
50
51
|
...t,
|
|
51
52
|
params: {
|
|
52
|
-
...
|
|
53
|
+
...r,
|
|
53
54
|
...t.params
|
|
54
55
|
}
|
|
55
56
|
};
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
const s =
|
|
59
|
-
s
|
|
57
|
+
a.skipCtaClicked || y(e), await u(e, async () => {
|
|
58
|
+
a.run && await c(e, a.run, a.onSuccess ?? []);
|
|
59
|
+
const s = g(e);
|
|
60
|
+
s && h(e, s);
|
|
61
|
+
const i = a.next ?? (a.run ? "none" : "default");
|
|
62
|
+
i === "default" ? S(e) : i === "drawer" && n(e);
|
|
60
63
|
});
|
|
61
|
-
},
|
|
64
|
+
}, k = {
|
|
62
65
|
label: "",
|
|
63
66
|
block: ""
|
|
64
|
-
},
|
|
65
|
-
const
|
|
67
|
+
}, M = (t, a, { onSuccess: r = [] } = {}) => {
|
|
68
|
+
const e = {
|
|
66
69
|
...t,
|
|
67
|
-
cta:
|
|
70
|
+
cta: k,
|
|
68
71
|
slot: "primary"
|
|
69
72
|
};
|
|
70
|
-
return u(
|
|
73
|
+
return u(e, () => c(e, a, r), { handler: a });
|
|
71
74
|
};
|
|
72
75
|
export {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
76
|
+
H as resolveCtaState,
|
|
77
|
+
o as resolveStep,
|
|
78
|
+
G as runCtaAction,
|
|
79
|
+
M as runCtaHandler
|
|
77
80
|
};
|
|
78
81
|
|
|
79
82
|
//# sourceMappingURL=runCtaAction.es.js.map
|