@mx-cartographer/experiences 9.7.65 → 9.7.66-alpha-harini-sov2-2
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/README.md +1 -1
- package/dist/core/stores/RecurringTransactionsStore.es.js +27 -22
- package/dist/core/stores/RecurringTransactionsStore.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +2 -7
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +6 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js +37 -37
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/AmountInputModalBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.d.ts +10 -0
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js +12 -7
- package/dist/insights-v2/actionBlocks/AmountInputModalBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/analytics/analyticsEventsConfig.d.ts +29 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js +28 -0
- package/dist/insights-v2/analytics/analyticsEventsConfig.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.d.ts +7 -14
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js +11 -27
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/SavingsOpportunityBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +4 -4
- package/dist/insights-v2/components/BaseLayout.es.js +113 -106
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/SavingsOpportunityCard.es.js +6 -5
- package/dist/insights-v2/components/SavingsOpportunityCard.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/index.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.d.ts +1 -1
- package/dist/insights-v2/ctaActions/runCtaAction.es.js +9 -6
- package/dist/insights-v2/ctaActions/runCtaAction.es.js.map +1 -1
- package/dist/insights-v2/ctaActions/subscriptionAnswer.d.ts +46 -0
- package/dist/insights-v2/ctaActions/types.d.ts +16 -2
- package/dist/insights-v2/ctaActions/useCtaAction.es.js +42 -30
- 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 +69 -64
- package/dist/insights-v2/mappings/blocks.es.js.map +1 -1
- package/package.json +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.d.ts +0 -18
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js +0 -13
- package/dist/insights-v2/blocks/ComponentBlocks/SavingsOpportunityBlock/layout.es.js.map +0 -1
|
@@ -1,33 +1,34 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
2
|
-
import { sendClientConfiguredCta as
|
|
3
|
-
import { BeatActionsProvider as
|
|
4
|
-
import { isContactSupportCtaDisabled as
|
|
5
|
-
import { reportCtaClick as
|
|
6
|
-
import { useBeatCtaActions as
|
|
7
|
-
import { actionBlocksKey as
|
|
8
|
-
import { logoFromRef as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
22
|
-
import {
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
27
|
-
import {
|
|
28
|
-
import
|
|
29
|
-
import
|
|
30
|
-
|
|
1
|
+
import { useAppConfig as K, useGlobalCopyStore as Y, useGlobalStore as $, useInsightsV2Store as q } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { sendClientConfiguredCta as J } from "../../common/utils/PostMessage.es.js";
|
|
3
|
+
import { BeatActionsProvider as Q } from "../beatActions.es.js";
|
|
4
|
+
import { isContactSupportCtaDisabled as Z } from "../actionBlocks/ContactSupportActionBlock.es.js";
|
|
5
|
+
import { reportCtaClick as oo } from "../ctaActions/runCtaAction.es.js";
|
|
6
|
+
import { useBeatCtaActions as io } from "../ctaActions/useCtaAction.es.js";
|
|
7
|
+
import { actionBlocksKey as eo } from "../mappings/actionBlocksKey.es.js";
|
|
8
|
+
import { logoFromRef as to } from "./shared/EntityLogo.es.js";
|
|
9
|
+
import { CtaStatus as ro } from "./CtaStatus.es.js";
|
|
10
|
+
import no from "./FeedbackDialog.es.js";
|
|
11
|
+
import { ErrorCard as so } from "./ErrorCard.es.js";
|
|
12
|
+
import { blocks as ao } from "../mappings/blocks.es.js";
|
|
13
|
+
import { ActionBlockLayer as lo } from "../actionBlocks/ActionBlockLayer.es.js";
|
|
14
|
+
import co from "./Footer.es.js";
|
|
15
|
+
import mo from "./Header.es.js";
|
|
16
|
+
import { FeedbackBar as po } from "./FeedbackBar.es.js";
|
|
17
|
+
import { DismissInsightDialog as uo } from "./DismissInsightDialog.es.js";
|
|
18
|
+
import { HiddenConfirmationCard as fo } from "./HiddenConfirmationCard.es.js";
|
|
19
|
+
import { LoadingCard as bo } from "./LoadingCard.es.js";
|
|
20
|
+
import { ObsolesceBanner as Co } from "./ObsolesceBanner.es.js";
|
|
21
|
+
import { useBeatFeedbackFlow as ho } from "../hooks/useBeatFeedbackFlow.es.js";
|
|
22
|
+
import { useMemo as go } from "react";
|
|
23
|
+
import { observer as yo } from "mobx-react-lite";
|
|
24
|
+
import x from "@mui/material/Stack";
|
|
25
|
+
import { P as _o } from "@mxenabled/mxui";
|
|
26
|
+
import p from "@mui/material/Button";
|
|
27
|
+
import { ChevronRight as A } from "@mxenabled/mx-icons";
|
|
28
|
+
import { Fragment as ko, jsx as i, jsxs as u } from "react/jsx-runtime";
|
|
29
|
+
import xo from "@mui/material/Box";
|
|
30
|
+
import vo from "@mui/material/Card";
|
|
31
|
+
var So = {}, wo = {
|
|
31
32
|
position: "absolute",
|
|
32
33
|
top: 0,
|
|
33
34
|
left: 0,
|
|
@@ -36,7 +37,7 @@ var yo = {}, ko = {
|
|
|
36
37
|
backgroundColor: "background.default",
|
|
37
38
|
opacity: 0.7,
|
|
38
39
|
zIndex: 3
|
|
39
|
-
},
|
|
40
|
+
}, Do = {
|
|
40
41
|
alignItems: "center",
|
|
41
42
|
alignSelf: "flex-start",
|
|
42
43
|
display: "flex",
|
|
@@ -44,75 +45,75 @@ var yo = {}, ko = {
|
|
|
44
45
|
height: 44,
|
|
45
46
|
px: 2,
|
|
46
47
|
textTransform: "none"
|
|
47
|
-
},
|
|
48
|
+
}, Bo = {
|
|
48
49
|
color: "text.secondary",
|
|
49
50
|
fontSize: 13,
|
|
50
51
|
fontWeight: 600,
|
|
51
52
|
lineHeight: "16px",
|
|
52
53
|
"&.Mui-disabled": { color: "text.disabled" }
|
|
53
|
-
},
|
|
54
|
-
const
|
|
54
|
+
}, ri = yo(({ beat: e, beatActions: l = So, obsolete: C, isLoading: O = !1, isError: I = !1 }) => {
|
|
55
|
+
const F = Y(), E = q(), { config: M } = K(), o = ho(e, l), v = $(), { runCta: R, primary: h, secondary: S } = io(e, l, e.insights_payload?.primary_cta, e.insights_payload?.secondary_cta), f = e.insights_payload?.widget_type === "mini", N = go(() => ({
|
|
55
56
|
...o.wrappedActions,
|
|
56
|
-
beat:
|
|
57
|
-
}), [o.wrappedActions,
|
|
58
|
-
if (
|
|
59
|
-
const t =
|
|
57
|
+
beat: e
|
|
58
|
+
}), [o.wrappedActions, e]);
|
|
59
|
+
if (I) return /* @__PURE__ */ i(so, {});
|
|
60
|
+
const t = e.insights_payload;
|
|
60
61
|
if (!t || o.cardState === "dismissed") return null;
|
|
61
|
-
const { instance_slot:
|
|
62
|
-
logo:
|
|
62
|
+
const { instance_slot: H, primary_cta: n, secondary_cta: s, sub_title: P, title: G, guid: w, dismissed_at: V } = t, { block: z } = H, U = P ?? (t.subtitle ? {
|
|
63
|
+
logo: to(t.logo),
|
|
63
64
|
text: t.subtitle
|
|
64
|
-
} : void 0),
|
|
65
|
-
if (!
|
|
66
|
-
if (
|
|
67
|
-
|
|
68
|
-
beat:
|
|
69
|
-
stores:
|
|
70
|
-
hostActions:
|
|
71
|
-
slot:
|
|
72
|
-
}),
|
|
65
|
+
} : void 0), c = (a) => Z(a, M, l.onContactSupport), D = async (a, m) => {
|
|
66
|
+
if (!c(m.block)) {
|
|
67
|
+
if (m.block === eo.CONTACT_SUPPORT_ACTION_BLOCK) {
|
|
68
|
+
oo({
|
|
69
|
+
beat: e,
|
|
70
|
+
stores: v,
|
|
71
|
+
hostActions: l,
|
|
72
|
+
slot: a
|
|
73
|
+
}), l.onContactSupport?.();
|
|
73
74
|
return;
|
|
74
75
|
}
|
|
75
|
-
await
|
|
76
|
+
await R(a, m);
|
|
76
77
|
}
|
|
77
|
-
},
|
|
78
|
-
const { is_mobile_webview:
|
|
79
|
-
|
|
80
|
-
isMobileWebview:
|
|
81
|
-
webviewScheme:
|
|
82
|
-
userGuid: t.user_guid ??
|
|
78
|
+
}, B = ao[z], d = t.in_description_cta, g = !f && d?.label && d.block ? d : void 0, y = n?.label || (g ? void 0 : d?.label) || void 0, b = !f && !!n?.label, L = e.in_description_cta || e.html_in_description_cta, W = () => {
|
|
79
|
+
const { is_mobile_webview: a, clientConfig: m } = v.appDataStore.appConfig;
|
|
80
|
+
J(e.template, {
|
|
81
|
+
isMobileWebview: a,
|
|
82
|
+
webviewScheme: m?.master?.ui_message_webview_url_scheme,
|
|
83
|
+
userGuid: t.user_guid ?? e.user_guid
|
|
83
84
|
});
|
|
84
|
-
},
|
|
85
|
-
return /* @__PURE__ */
|
|
85
|
+
}, r = b ? h.presentation : void 0, X = r?.kind === "hidden" && !!r.hideAll, T = !f && !!s?.label && !X, j = !!y && r?.kind !== "hidden" || T, _ = F.insights_feed?.general, k = C?.state === "not_refreshable" && !V && !!_;
|
|
86
|
+
return /* @__PURE__ */ i(Q, {
|
|
86
87
|
value: N,
|
|
87
|
-
children: /* @__PURE__ */
|
|
88
|
+
children: /* @__PURE__ */ u(x, {
|
|
88
89
|
sx: { mb: 16 },
|
|
89
90
|
children: [
|
|
90
|
-
o.cardState === "confirming" ? /* @__PURE__ */
|
|
91
|
+
o.cardState === "confirming" ? /* @__PURE__ */ i(fo, {
|
|
91
92
|
onClose: o.collapseConfirmation,
|
|
92
93
|
onLeaveFeedback: o.openHideSurvey,
|
|
93
94
|
onUndo: o.undoDismiss
|
|
94
|
-
}) : /* @__PURE__ */
|
|
95
|
-
...
|
|
96
|
-
copy:
|
|
97
|
-
}), /* @__PURE__ */
|
|
98
|
-
inert:
|
|
99
|
-
sx: { ...
|
|
95
|
+
}) : /* @__PURE__ */ u(ko, { children: [C && _ && /* @__PURE__ */ i(Co, {
|
|
96
|
+
...C,
|
|
97
|
+
copy: _
|
|
98
|
+
}), /* @__PURE__ */ u(vo, {
|
|
99
|
+
inert: k,
|
|
100
|
+
sx: { ...k && {
|
|
100
101
|
position: "relative",
|
|
101
102
|
zIndex: 2,
|
|
102
103
|
pointerEvents: "none"
|
|
103
104
|
} },
|
|
104
105
|
children: [
|
|
105
|
-
|
|
106
|
-
/* @__PURE__ */
|
|
107
|
-
isMini:
|
|
108
|
-
subtitle:
|
|
106
|
+
k && /* @__PURE__ */ i(xo, { sx: wo }),
|
|
107
|
+
/* @__PURE__ */ i(mo, {
|
|
108
|
+
isMini: f,
|
|
109
|
+
subtitle: U,
|
|
109
110
|
title: G ?? ""
|
|
110
111
|
}),
|
|
111
|
-
O ? /* @__PURE__ */
|
|
112
|
-
beatGuid:
|
|
112
|
+
O ? /* @__PURE__ */ i(bo, {}) : B && /* @__PURE__ */ i(B, {
|
|
113
|
+
beatGuid: w,
|
|
113
114
|
payload: t
|
|
114
115
|
}),
|
|
115
|
-
/* @__PURE__ */
|
|
116
|
+
/* @__PURE__ */ u(x, {
|
|
116
117
|
sx: {
|
|
117
118
|
gap: 6,
|
|
118
119
|
pb: 16,
|
|
@@ -120,14 +121,14 @@ var yo = {}, ko = {
|
|
|
120
121
|
px: 16
|
|
121
122
|
},
|
|
122
123
|
children: [
|
|
123
|
-
/* @__PURE__ */
|
|
124
|
+
/* @__PURE__ */ i(_o, {
|
|
124
125
|
dangerouslySetInnerHTML: { __html: t.description.html_text },
|
|
125
126
|
variant: "subtitle2"
|
|
126
127
|
}),
|
|
127
|
-
|
|
128
|
-
endIcon: /* @__PURE__ */
|
|
129
|
-
onClick: () =>
|
|
130
|
-
guid:
|
|
128
|
+
g && /* @__PURE__ */ i(p, {
|
|
129
|
+
endIcon: /* @__PURE__ */ i(A, {}),
|
|
130
|
+
onClick: () => E.openActionDrawer({
|
|
131
|
+
guid: w,
|
|
131
132
|
trigger: "inDescriptionCta"
|
|
132
133
|
}),
|
|
133
134
|
sx: {
|
|
@@ -135,66 +136,72 @@ var yo = {}, ko = {
|
|
|
135
136
|
p: 4,
|
|
136
137
|
width: "max-content"
|
|
137
138
|
},
|
|
138
|
-
children:
|
|
139
|
+
children: g.label
|
|
139
140
|
}),
|
|
140
|
-
!
|
|
141
|
-
endIcon: /* @__PURE__ */
|
|
142
|
-
onClick:
|
|
141
|
+
!d?.label && L && /* @__PURE__ */ i(p, {
|
|
142
|
+
endIcon: /* @__PURE__ */ i(A, {}),
|
|
143
|
+
onClick: W,
|
|
143
144
|
sx: {
|
|
144
145
|
height: 24,
|
|
145
146
|
p: 4,
|
|
146
147
|
width: "max-content"
|
|
147
148
|
},
|
|
148
|
-
children:
|
|
149
|
+
children: L
|
|
149
150
|
})
|
|
150
151
|
]
|
|
151
152
|
}),
|
|
152
|
-
|
|
153
|
+
j && /* @__PURE__ */ u(x, {
|
|
153
154
|
sx: {
|
|
154
155
|
gap: 8,
|
|
155
156
|
pb: 16,
|
|
156
157
|
px: 16
|
|
157
158
|
},
|
|
158
159
|
children: [
|
|
159
|
-
|
|
160
|
-
sx:
|
|
160
|
+
y && !b && /* @__PURE__ */ i(p, {
|
|
161
|
+
sx: Do,
|
|
161
162
|
variant: "text",
|
|
162
|
-
children:
|
|
163
|
+
children: y
|
|
163
164
|
}),
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
165
|
+
b && n && r?.kind === "status" && /* @__PURE__ */ i(ro, {
|
|
166
|
+
action: r.action,
|
|
167
|
+
icon: r.icon,
|
|
168
|
+
label: r.label,
|
|
169
|
+
tone: r.tone
|
|
170
|
+
}),
|
|
171
|
+
b && n && !r && /* @__PURE__ */ i(p, {
|
|
172
|
+
"aria-disabled": c(n.block) || h.disabled,
|
|
173
|
+
disabled: h.disabled,
|
|
174
|
+
onClick: () => D("primary", n),
|
|
175
|
+
sx: { ...c(n.block) && { color: "text.disabled" } },
|
|
169
176
|
variant: "outlined",
|
|
170
|
-
children:
|
|
177
|
+
children: n.label
|
|
171
178
|
}),
|
|
172
|
-
|
|
173
|
-
"aria-disabled":
|
|
179
|
+
T && s && /* @__PURE__ */ i(p, {
|
|
180
|
+
"aria-disabled": c(s.block) || S.disabled,
|
|
174
181
|
color: "inherit",
|
|
175
|
-
disabled:
|
|
176
|
-
onClick: () =>
|
|
182
|
+
disabled: S.disabled,
|
|
183
|
+
onClick: () => D("secondary", s),
|
|
177
184
|
sx: {
|
|
178
|
-
...
|
|
179
|
-
...
|
|
185
|
+
...Bo,
|
|
186
|
+
...c(s.block) && { color: "text.disabled" }
|
|
180
187
|
},
|
|
181
|
-
children:
|
|
188
|
+
children: s.label
|
|
182
189
|
})
|
|
183
190
|
]
|
|
184
191
|
}),
|
|
185
|
-
/* @__PURE__ */
|
|
192
|
+
/* @__PURE__ */ i(po, {
|
|
186
193
|
onTellUsMore: o.openRatingSurvey,
|
|
187
194
|
show: o.isFeedbackBarShown
|
|
188
195
|
})
|
|
189
196
|
]
|
|
190
197
|
})] }),
|
|
191
|
-
/* @__PURE__ */
|
|
192
|
-
/* @__PURE__ */
|
|
198
|
+
/* @__PURE__ */ i(lo, { beat: e }),
|
|
199
|
+
/* @__PURE__ */ i(uo, {
|
|
193
200
|
isOpen: o.isDismissOpen,
|
|
194
201
|
onClose: o.closeDismissDialog,
|
|
195
202
|
onDismiss: o.confirmDismiss
|
|
196
203
|
}),
|
|
197
|
-
o.isSurveyOpen && /* @__PURE__ */
|
|
204
|
+
o.isSurveyOpen && /* @__PURE__ */ i(no, {
|
|
198
205
|
characterLimitLabel: o.survey.characterLimitLabel,
|
|
199
206
|
closeAriaLabel: o.survey.closeAriaLabel,
|
|
200
207
|
isOpen: !0,
|
|
@@ -207,13 +214,13 @@ var yo = {}, ko = {
|
|
|
207
214
|
secondaryText: o.survey.backText,
|
|
208
215
|
title: o.survey.title
|
|
209
216
|
}),
|
|
210
|
-
o.cardState === "visible" && t.footer && /* @__PURE__ */
|
|
217
|
+
o.cardState === "visible" && t.footer && /* @__PURE__ */ i(co, { footer: t.footer })
|
|
211
218
|
]
|
|
212
219
|
})
|
|
213
220
|
});
|
|
214
221
|
});
|
|
215
222
|
export {
|
|
216
|
-
|
|
223
|
+
ri as default
|
|
217
224
|
};
|
|
218
225
|
|
|
219
226
|
//# sourceMappingURL=BaseLayout.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Mini CTA label styled like a Button.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontWeight: 600,\n height: 44,\n px: 2,\n textTransform: 'none',\n} as const\n\n// Full card's secondary CTA (e.g. Fee Detected's Contact Support): a quiet text button, 13/16\n// semibold in text.secondary. `color=\"inherit\"` keeps hover, ripple and focus off the primary palette.\n// An unavailable CTA (contact_support_block with no host handler) is dimmed at the call site, as the\n// primary CTA is, because it is only aria-disabled and so never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n lineHeight: '16px',\n '&.Mui-disabled': { color: 'text.disabled' },\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n const showSecondaryCta = !isMini && !!secondary_cta?.label\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {(ctaLabel || showSecondaryCta) && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {ctaLabel &&\n !isCtaButton && (\n // The card's action when it has no primary CTA button (mini always; a full card whose\n // only link names no block). What the tap does is the host's decision (Pulse posts\n // `carousel/cta`, the same redirect a V1 mini card sends), never the action drawer the\n // full card's CTA opens. It is a real (blue, focusable) button for that tap, but has no\n // handler of its own and does not stop the click, so it reaches the host's card handler\n // exactly as a tap on the card does.\n <Button sx={MINI_CTA_SX} variant=\"text\">\n {ctaLabel}\n </Button>\n )}\n {isCtaButton && primary_cta && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"inherit\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n sx={{\n ...SECONDARY_CTA_SX,\n ...(isCtaDisabled(secondary_cta.block) && { color: 'text.disabled' }),\n }}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </Beat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BACpD,IAAI;AAAA,oBACF,GAAG;AAAA,oBACH,GAAI,EAAc,EAAc,KAAK,KAAK,EAAE,OAAO,gBAAgB;AAAA,kBACrE;AAAA,kBAEC,UAAA,EAAc;AAAA,gBACT,CAAA;AAAA,cAEL;AAAA;YAGT,gBAAA,EAAC,IAAD;AAAA,cAAa,cAAc,EAAK;AAAA,cAAkB,MAAM,EAAK;AAAA,YAAqB,CAAA;AAAA,UAC9E;AAAA,QACN,CAAA,CAAA,EAAA,CAAA;AAAA,QAGJ,gBAAA,EAAC,IAAD,EAAwB,MAAA,EAAO,CAAA;AAAA,QAE/B,gBAAA,EAAC,IAAD;AAAA,UACE,QAAQ,EAAK;AAAA,UACb,SAAS,EAAK;AAAA,UACd,WAAW,EAAK;AAAA,QACjB,CAAA;AAAA,QAEA,EAAK,gBACJ,gBAAA,EAAC,IAAD;AAAA,UACE,qBAAqB,EAAK,OAAO;AAAA,UACjC,gBAAgB,EAAK,OAAO;AAAA,UAC5B,QAAQ;AAAA,UACR,aAAa,EAAK,wBAAwB;AAAA,UAC1C,SAAS,EAAK;AAAA,UACd,UAAU,EAAK;AAAA,UACf,kBAAkB,EAAK,wBAAwB;AAAA,UAC/C,SAAS,EAAK,OAAO;AAAA,UACrB,aAAa,EAAK,OAAO;AAAA,UACzB,eAAe,EAAK,OAAO;AAAA,UAC3B,OAAO,EAAK,OAAO;AAAA,QACpB,CAAA;AAAA,QAGF,EAAK,cAAc,aAAa,EAAiB,UAChD,gBAAA,EAAC,IAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
1
|
+
{"version":3,"file":"BaseLayout.es.js","names":[],"sources":["../../../src/insights-v2/components/BaseLayout.tsx"],"sourcesContent":["import { useMemo } from 'react'\n\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Card from '@mui/material/Card'\nimport Stack from '@mui/material/Stack'\n\nimport { ChevronRight } from '@mxenabled/mx-icons'\nimport { P } from '@mxenabled/mxui'\n\nimport { blocks } from '../mappings/blocks'\nimport { actionBlocksKey } from '../mappings/actionBlocksKey'\nimport { isContactSupportCtaDisabled } from '../actionBlocks/ContactSupportActionBlock'\nimport { logoFromRef } from './shared/EntityLogo'\n\nimport Footer from './Footer'\nimport Header from './Header'\nimport FeedbackBar from './FeedbackBar'\nimport FeedbackDialog from './FeedbackDialog'\nimport DismissInsightDialog from './DismissInsightDialog'\nimport HiddenConfirmationCard from './HiddenConfirmationCard'\nimport ErrorCard from './ErrorCard'\nimport LoadingCard from './LoadingCard'\nimport { ObsolesceBanner, type ObsolesceBannerState } from './ObsolesceBanner'\nimport { useAppConfig, useGlobalCopyStore, useGlobalStore, useInsightsV2Store } from '../../common'\nimport { sendClientConfiguredCta } from '../../common/utils/PostMessage'\nimport type { Beat, PrimaryCTA, SecondaryCTA } from '../../core'\nimport { BeatActionsProvider, type BeatActions } from '../beatActions'\nimport { ActionBlockLayer } from '../actionBlocks/ActionBlockLayer'\nimport { reportCtaClick, useBeatCtaActions } from '../ctaActions'\nimport { CtaStatus } from './CtaStatus'\nimport { useBeatFeedbackFlow } from '../hooks/useBeatFeedbackFlow'\n\nexport interface ObsoleteState {\n state: ObsolesceBannerState\n onRefresh: () => void\n onDismiss: () => void\n}\n\ninterface BaseLayoutProps {\n beat: Beat\n beatActions?: BeatActions\n obsolete?: ObsoleteState\n /** Swap only the block slot for a LoadingCard (e.g. while a sampled beat loads). */\n isLoading?: boolean\n /** Replace the entire card with an ErrorCard (e.g. when the sample fails to load). */\n isError?: boolean\n}\n\nconst NO_BEAT_ACTIONS: BeatActions = {}\n\nconst OBSOLETE_OVERLAY_SX = {\n position: 'absolute',\n top: 0,\n left: 0,\n width: '100%',\n height: '100%',\n backgroundColor: 'background.default',\n opacity: 0.7,\n // Above every block's own z-index (hero card 1, AccountBlock 2), or that section shows through.\n zIndex: 3,\n} as const\n\n// Mini CTA label styled like a Button.\nconst MINI_CTA_SX = {\n alignItems: 'center',\n alignSelf: 'flex-start',\n display: 'flex',\n fontWeight: 600,\n height: 44,\n px: 2,\n textTransform: 'none',\n} as const\n\n// Full card's secondary CTA (e.g. Fee Detected's Contact Support): a quiet text button, 13/16\n// semibold in text.secondary. `color=\"inherit\"` keeps hover, ripple and focus off the primary palette.\n// An unavailable CTA (contact_support_block with no host handler) is dimmed at the call site, as the\n// primary CTA is, because it is only aria-disabled and so never matches `.Mui-disabled`.\nconst SECONDARY_CTA_SX = {\n color: 'text.secondary',\n fontSize: 13,\n fontWeight: 600,\n lineHeight: '16px',\n '&.Mui-disabled': { color: 'text.disabled' },\n} as const\n\nconst BaseLayout = observer(\n ({\n beat,\n beatActions = NO_BEAT_ACTIONS,\n obsolete,\n isLoading = false,\n isError = false,\n }: BaseLayoutProps) => {\n const copy = useGlobalCopyStore()\n const insightsV2Store = useInsightsV2Store()\n const { config } = useAppConfig()\n const flow = useBeatFeedbackFlow(beat, beatActions)\n\n const stores = useGlobalStore()\n const {\n runCta: handleCtaClick,\n primary: primaryCtaState,\n secondary: secondaryCtaState,\n } = useBeatCtaActions(\n beat,\n beatActions,\n beat.insights_payload?.primary_cta,\n beat.insights_payload?.secondary_cta,\n )\n\n // Guard: payload may not be loaded yet (isLoading/isError states).\n const isMini = beat.insights_payload?.widget_type === 'mini'\n\n // Memoized: an inline object here would change identity every render, making every\n // useAnalyticsEvent() consumer's callback (and its effect deps) unstable too.\n const beatActionsValue = useMemo(\n () => ({ ...flow.wrappedActions, beat }),\n [flow.wrappedActions, beat],\n )\n\n // Error replaces the entire card; loading only swaps the block slot (below).\n if (isError) return <ErrorCard />\n\n const insights_payload = beat.insights_payload\n\n if (!insights_payload) return null\n if (flow.cardState === 'dismissed') return null\n\n const { instance_slot, primary_cta, secondary_cta, sub_title, title, guid, dismissed_at } =\n insights_payload\n const { block } = instance_slot\n\n // Rebuild V1 subtitle shape; sub_title wins if present.\n const subtitle =\n sub_title ??\n (insights_payload.subtitle\n ? {\n logo: logoFromRef(insights_payload.logo),\n text: insights_payload.subtitle,\n }\n : undefined)\n\n // CTAs run via ctaActions; contact_support_block bypasses it.\n const isCtaDisabled = (ctaBlock: string | null | undefined) =>\n isContactSupportCtaDisabled(ctaBlock, config, beatActions.onContactSupport)\n\n const onCtaClick = async (slot: 'primary' | 'secondary', cta: PrimaryCTA | SecondaryCTA) => {\n if (isCtaDisabled(cta.block)) return\n\n if (cta.block === actionBlocksKey.CONTACT_SUPPORT_ACTION_BLOCK) {\n // Bypasses the runner, but still reports the press like any other CTA: the generic\n // press event, and (on a first primary press) FIRST_TIME_PRIMARY_ACTION_SELECTED +\n // cta_clicked_at.\n reportCtaClick({ beat, stores, hostActions: beatActions, slot })\n beatActions.onContactSupport?.()\n return\n }\n\n await handleCtaClick(slot, cta)\n }\n\n const Block = blocks[block as keyof typeof blocks]\n\n const inDescriptionCta = insights_payload.in_description_cta\n // Full card: the envelope's link opens the drawer its block names. A link with no block (mini's\n // \"Make a Transfer\") is the card's action, drawn as the mini label below, never a dead link.\n const envelopeLink =\n !isMini && inDescriptionCta?.label && inDescriptionCta.block ? inDescriptionCta : undefined\n // The card's action label: the primary CTA's, else a block-less envelope link's (ditto ≥ 1.4.3\n // sends mini's action as in_description_cta). `||`, not `??`: the copy may send the primary label\n // as \"\" rather than omit it, and an empty string must fall through. It is a button only on a full\n // card with a primary CTA; otherwise a label, so a tap reaches the host's card handler.\n const ctaLabel =\n primary_cta?.label || (envelopeLink ? undefined : inDescriptionCta?.label) || undefined\n const isCtaButton = !isMini && !!primary_cta?.label\n const clientConfiguredLabel = beat.in_description_cta || beat.html_in_description_cta\n const onClientConfiguredLinkClick = () => {\n const { is_mobile_webview, clientConfig } = stores.appDataStore.appConfig\n\n sendClientConfiguredCta(beat.template, {\n isMobileWebview: is_mobile_webview,\n webviewScheme: clientConfig?.master?.ui_message_webview_url_scheme,\n userGuid: insights_payload.user_guid ?? beat.user_guid,\n })\n }\n // The primary step's presenter may draw a status or nothing instead of the button (full card only).\n const primaryPresentation = isCtaButton ? primaryCtaState.presentation : undefined\n const hidesAllCtas = primaryPresentation?.kind === 'hidden' && !!primaryPresentation.hideAll\n const showSecondaryCta = !isMini && !!secondary_cta?.label && !hidesAllCtas\n const showCtaRow = (!!ctaLabel && primaryPresentation?.kind !== 'hidden') || showSecondaryCta\n const obsoleteCopy = copy.insights_feed?.general\n const isObsoleteDimmed =\n obsolete?.state === 'not_refreshable' && !dismissed_at && !!obsoleteCopy\n\n return (\n <BeatActionsProvider value={beatActionsValue}>\n <Stack sx={{ mb: 16 }}>\n {flow.cardState === 'confirming' ? (\n <HiddenConfirmationCard\n onClose={flow.collapseConfirmation}\n onLeaveFeedback={flow.openHideSurvey}\n onUndo={flow.undoDismiss}\n />\n ) : (\n <>\n {obsolete && obsoleteCopy && <ObsolesceBanner {...obsolete} copy={obsoleteCopy} />}\n <Card\n inert={isObsoleteDimmed}\n sx={{\n ...(isObsoleteDimmed && {\n position: 'relative',\n zIndex: 2,\n pointerEvents: 'none',\n }),\n }}\n >\n {isObsoleteDimmed && <Box sx={OBSOLETE_OVERLAY_SX} />}\n <Header isMini={isMini} subtitle={subtitle} title={title ?? ''} />\n {isLoading ? (\n <LoadingCard />\n ) : (\n Block && <Block beatGuid={guid} payload={insights_payload} />\n )}\n\n <Stack sx={{ gap: 6, pb: 16, pt: 12, px: 16 }}>\n <P\n dangerouslySetInnerHTML={{\n __html: insights_payload.description.html_text,\n }}\n variant=\"subtitle2\"\n />\n {/* V2: the envelope's link opens the action block it names. */}\n {envelopeLink && (\n <Button\n endIcon={<ChevronRight />}\n onClick={() =>\n insightsV2Store.openActionDrawer({ guid, trigger: 'inDescriptionCta' })\n }\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {envelopeLink.label}\n </Button>\n )}\n {/* Custom-copy link when the envelope sends none; legacy mini shows it too, so no mini guard. */}\n {!inDescriptionCta?.label && clientConfiguredLabel && (\n <Button\n endIcon={<ChevronRight />}\n onClick={onClientConfiguredLinkClick}\n sx={{ height: 24, p: 4, width: 'max-content' }}\n >\n {clientConfiguredLabel}\n </Button>\n )}\n </Stack>\n\n {showCtaRow && (\n <Stack sx={{ gap: 8, pb: 16, px: 16 }}>\n {ctaLabel &&\n !isCtaButton && (\n // The card's action when it has no primary CTA button (mini always; a full card whose\n // only link names no block). What the tap does is the host's decision (Pulse posts\n // `carousel/cta`, the same redirect a V1 mini card sends), never the action drawer the\n // full card's CTA opens. It is a real (blue, focusable) button for that tap, but has no\n // handler of its own and does not stop the click, so it reaches the host's card handler\n // exactly as a tap on the card does.\n <Button sx={MINI_CTA_SX} variant=\"text\">\n {ctaLabel}\n </Button>\n )}\n {isCtaButton && primary_cta && primaryPresentation?.kind === 'status' && (\n <CtaStatus\n action={primaryPresentation.action}\n icon={primaryPresentation.icon}\n label={primaryPresentation.label}\n tone={primaryPresentation.tone}\n />\n )}\n {isCtaButton && primary_cta && !primaryPresentation && (\n <Button\n aria-disabled={isCtaDisabled(primary_cta.block) || primaryCtaState.disabled}\n disabled={primaryCtaState.disabled}\n onClick={() => onCtaClick('primary', primary_cta)}\n sx={{\n ...(isCtaDisabled(primary_cta.block) && { color: 'text.disabled' }),\n }}\n variant=\"outlined\"\n >\n {primary_cta.label}\n </Button>\n )}\n {/* Mini has room for one CTA. */}\n {showSecondaryCta && secondary_cta && (\n <Button\n aria-disabled={\n isCtaDisabled(secondary_cta.block) || secondaryCtaState.disabled\n }\n color=\"inherit\"\n disabled={secondaryCtaState.disabled}\n onClick={() => onCtaClick('secondary', secondary_cta)}\n sx={{\n ...SECONDARY_CTA_SX,\n ...(isCtaDisabled(secondary_cta.block) && { color: 'text.disabled' }),\n }}\n >\n {secondary_cta.label}\n </Button>\n )}\n </Stack>\n )}\n\n <FeedbackBar onTellUsMore={flow.openRatingSurvey} show={flow.isFeedbackBarShown} />\n </Card>\n </>\n )}\n\n <ActionBlockLayer beat={beat} />\n\n <DismissInsightDialog\n isOpen={flow.isDismissOpen}\n onClose={flow.closeDismissDialog}\n onDismiss={flow.confirmDismiss}\n />\n\n {flow.isSurveyOpen && (\n <FeedbackDialog\n characterLimitLabel={flow.survey.characterLimitLabel}\n closeAriaLabel={flow.survey.closeAriaLabel}\n isOpen={true}\n onBackClick={flow.feedbackDialogCallbacks.onBackClick}\n onClose={flow.closeSurvey}\n onSubmit={flow.submitSurvey}\n onTextInputFocus={flow.feedbackDialogCallbacks.onTextInputFocus}\n options={flow.survey.options}\n primaryText={flow.survey.submitText}\n secondaryText={flow.survey.backText}\n title={flow.survey.title}\n />\n )}\n\n {flow.cardState === 'visible' && insights_payload.footer && (\n <Footer footer={insights_payload.footer} />\n )}\n </Stack>\n </BeatActionsProvider>\n )\n },\n)\n\nexport default BaseLayout\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmDA,IAAM,KAA+B,CAAC,GAEhC,KAAsB;AAAA,EAC1B,UAAU;AAAA,EACV,KAAK;AAAA,EACL,MAAM;AAAA,EACN,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,iBAAiB;AAAA,EACjB,SAAS;AAAA,EAET,QAAQ;AACV,GAGM,KAAc;AAAA,EAClB,YAAY;AAAA,EACZ,WAAW;AAAA,EACX,SAAS;AAAA,EACT,YAAY;AAAA,EACZ,QAAQ;AAAA,EACR,IAAI;AAAA,EACJ,eAAe;AACjB,GAMM,KAAmB;AAAA,EACvB,OAAO;AAAA,EACP,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ,kBAAkB,EAAE,OAAO,gBAAgB;AAC7C,GAEM,KAAa,GAAA,CAChB,EACC,MAAA,GACA,aAAA,IAAc,IACd,UAAA,GACA,WAAA,IAAY,IACZ,SAAA,IAAU,GAAA,MACW;AACrB,QAAM,IAAO,EAAmB,GAC1B,IAAkB,EAAmB,GACrC,EAAE,QAAA,EAAA,IAAW,EAAa,GAC1B,IAAO,GAAoB,GAAM,CAAW,GAE5C,IAAS,EAAe,GACxB,EACJ,QAAQ,GACR,S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EAAK;AAAA,QACjB,CAAA;AAAA,QAEA,EAAK,gBACJ,gBAAA,EAAC,IAAD;AAAA,UACE,qBAAqB,EAAK,OAAO;AAAA,UACjC,gBAAgB,EAAK,OAAO;AAAA,UAC5B,QAAQ;AAAA,UACR,aAAa,EAAK,wBAAwB;AAAA,UAC1C,SAAS,EAAK;AAAA,UACd,UAAU,EAAK;AAAA,UACf,kBAAkB,EAAK,wBAAwB;AAAA,UAC/C,SAAS,EAAK,OAAO;AAAA,UACrB,aAAa,EAAK,OAAO;AAAA,UACzB,eAAe,EAAK,OAAO;AAAA,UAC3B,OAAO,EAAK,OAAO;AAAA,QACpB,CAAA;AAAA,QAGF,EAAK,cAAc,aAAa,EAAiB,UAChD,gBAAA,EAAC,IAAD,EAAQ,QAAQ,EAAiB,OAAS,CAAA;AAAA,MAEvC;AAAA;EACY,CAAA;AAEzB,CACF"}
|
|
@@ -6,14 +6,14 @@ 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:
|
|
9
|
+
var p = 0.75, j = ({ amount: d, label: s, slot: a = !0, sx: c }) => {
|
|
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: {
|
|
13
13
|
backgroundImage: a ? l : void 0,
|
|
14
14
|
bgcolor: a ? "background.paper" : "transparent",
|
|
15
15
|
p: 16,
|
|
16
|
-
...
|
|
16
|
+
...c
|
|
17
17
|
},
|
|
18
18
|
children: /* @__PURE__ */ n(t, {
|
|
19
19
|
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: "
|
|
48
|
-
borderTopRightRadius: "
|
|
47
|
+
borderBottomRightRadius: "8px",
|
|
48
|
+
borderTopRightRadius: "8px",
|
|
49
49
|
height: 74,
|
|
50
50
|
justifyContent: "center",
|
|
51
51
|
px: 12,
|
|
@@ -53,8 +53,9 @@ 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
|
-
children:
|
|
58
|
+
children: s
|
|
58
59
|
}), /* @__PURE__ */ r(i, {
|
|
59
60
|
variant: "h1",
|
|
60
61
|
children: d
|
|
@@ -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: '
|
|
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 <Text variant=\"h1\">{amount}</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,EAAA,MACiC;AACjC,QAAM,IAAQ,EAAS,GACjB,IAAiB,0BAA0B,EAC/C,EAAM,QAAQ,QAAQ,MACtB,CACF,CAAA,KAAM,EAAM,EAAM,QAAQ,QAAQ,OAAO,CAAqB,CAAA;AAE9D,SACE,gBAAA,EAAC,GAAD;AAAA,IACE,IAAI;AAAA,MACF,iBAAiB,IAAO,IAAiB;AAAA,MACzC,SAAS,IAAO,qBAAqB;AAAA,MACrC,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IAEA,UAAA,gBAAA,EAAC,GAAD;AAAA,MAAO,IAAI;AAAA,QAAE,eAAe;AAAA,QAAO,gBAAgB;AAAA,MAAS;AAAA,MAA5D,UAAA;AAAA,QACE,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,SAAS;AAAA,YACT,wBAAwB;AAAA,YACxB,qBAAqB;AAAA,YACrB,GAAG;AAAA,YACH,IAAI;AAAA,UACN;AAAA,UAEC,UAAA,EAAM,QAAQ,SAAS,SACtB,gBAAA,EAAC,GAAD,EAAU,eAAa,GAAO,CAAA,IAE9B,gBAAA,EAAC,GAAD,EAAM,eAAa,GAAO,CAAA;AAAA,QAEvB,CAAA;AAAA,QACP,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI,EACF,KAAK;AAAA,YACH,MAAM;AAAA,cACJ,mBAAmB,EACjB,MAAM,EAAM,QAAQ,WAAW,MACjC;AAAA,cACA,aAAa,EACX,QAAQ,EAAM,EAAM,QAAQ,SAAS,IAAI,EAC3C;AAAA,YACF;AAAA,YACA,MAAM,EACJ,MAAM,EAAM,QAAQ,WAAW,MACjC;AAAA,UACF,EACF;AAAA,UAEA,UAAA,gBAAA,EAAC,GAAD,EAAa,eAAa,GAAO,CAAA;AAAA,QAC5B,CAAA;AAAA,QACP,gBAAA,EAAC,GAAD;AAAA,UACE,IAAI;AAAA,YACF,SAAS;AAAA,YACT,yBAAyB;AAAA,YACzB,sBAAsB;AAAA,YACtB,QAAQ;AAAA,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,GACN,gBAAA,EAAC,GAAD;AAAA,YAAM,SAAQ;AAAA,YAAM,UAAA;AAAA,UAAa,CAAA,CAC5B;AAAA;MACF;AAAA;EACJ,CAAA;AAET"}
|
|
@@ -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, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, } from './types';
|
|
7
|
+
export type { CtaContext, CtaEffect, CtaHandler, CtaHandlerContext, CtaParams, CtaPresentation, CtaSlot, CtaState, CtaStateContext, CtaStep, RunHandlerOptions, } from './types';
|
|
@@ -5,7 +5,7 @@ import { CtaContext, CtaHandlerContext, CtaState, CtaStateContext, CtaStep, RunH
|
|
|
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
7
|
export declare const resolveStep: ({ cta }: Pick<CtaStateContext, "cta">) => CtaStep;
|
|
8
|
-
/** Pending always disables
|
|
8
|
+
/** Pending always disables, as may the step's `disabledWhen`; its `presenter` may replace the button. */
|
|
9
9
|
export declare const resolveCtaState: (ctx: CtaStateContext) => CtaState;
|
|
10
10
|
type AnalyticsCtx = Pick<CtaContext, 'beat' | 'stores' | 'hostActions'>;
|
|
11
11
|
/**
|
|
@@ -7,11 +7,14 @@ import { ctaHandlers as A } from "./ctaHandlers.es.js";
|
|
|
7
7
|
import { resolveCtaMetadata as E } from "./ctaPostMessages.es.js";
|
|
8
8
|
import { hasDrawerBlock as S } from "../mappings/hasDrawerBlock.es.js";
|
|
9
9
|
var y = {}, c = ({ cta: t }) => t.action_key && _[t.action_key] || y, B = (t) => {
|
|
10
|
-
const a = c(t);
|
|
11
|
-
return {
|
|
10
|
+
const a = c(t), r = t.stores.insightsV2Store.ctaStatus[t.beat.guid] === "pending", e = a.presenter?.(t);
|
|
11
|
+
return {
|
|
12
|
+
disabled: r || (a.disabledWhen?.(t) ?? !1),
|
|
13
|
+
...e && { presentation: e }
|
|
14
|
+
};
|
|
12
15
|
}, l = ({ beat: t, slot: a, stores: r }) => {
|
|
13
16
|
r.insightsV2Store.openCtaDrawer(t.guid, a === "primary" ? "primaryCta" : "secondaryCta");
|
|
14
|
-
},
|
|
17
|
+
}, g = ({ beat: t, stores: a }, r) => {
|
|
15
18
|
const { is_mobile_webview: e, clientConfig: s } = a.appDataStore.appConfig, { event: i, action: u, payload: C } = r;
|
|
16
19
|
m(t, {
|
|
17
20
|
event: i ?? void 0,
|
|
@@ -21,7 +24,7 @@ var y = {}, c = ({ cta: t }) => t.action_key && _[t.action_key] || y, B = (t) =>
|
|
|
21
24
|
webviewScheme: s?.master?.ui_message_webview_url_scheme,
|
|
22
25
|
userGuid: t.insights_payload?.user_guid ?? t.user_guid
|
|
23
26
|
});
|
|
24
|
-
},
|
|
27
|
+
}, h = (t) => {
|
|
25
28
|
S(t.cta.block) && l(t);
|
|
26
29
|
}, w = (t, { beat: a, stores: r }) => {
|
|
27
30
|
t === "refreshBeat" && r.emitUpdate({ staleBeatGuid: a.guid });
|
|
@@ -75,9 +78,9 @@ var y = {}, c = ({ cta: t }) => t.action_key && _[t.action_key] || y, B = (t) =>
|
|
|
75
78
|
T(e, { skipCtaClicked: a.skipCtaClicked }), await d(e, async () => {
|
|
76
79
|
a.run && await p(e, a.run, a.onSuccess ?? []), a.analytics && o(e, a.analytics);
|
|
77
80
|
const s = E(e);
|
|
78
|
-
s &&
|
|
81
|
+
s && g(e, s);
|
|
79
82
|
const i = a.next ?? (a.run ? "none" : "default");
|
|
80
|
-
i === "default" ?
|
|
83
|
+
i === "default" ? h(e) : i === "drawer" && l(e);
|
|
81
84
|
});
|
|
82
85
|
}, b = {
|
|
83
86
|
label: "",
|