@mx-cartographer/experiences 8.2.1 → 8.2.3
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 +8 -0
- package/dist/ViewMoreMicroCard-D_LoKlJU.mjs +1287 -0
- package/dist/microinsights/InsightsMicroWidget.d.ts +1 -16
- package/dist/microinsights/MicroCardTemplate.d.ts +2 -4
- package/dist/microinsights/cards/InsightCard.d.ts +1 -1
- package/dist/microinsights/cards/NoRelevantInsightsCard.d.ts +4 -2
- package/dist/microinsights/cards/ViewMoreMicroCard.d.ts +4 -2
- package/dist/microinsights/cards/ZeroStateCard.d.ts +4 -2
- package/dist/microinsights/carousel/BeatList.d.ts +1 -1
- package/dist/microinsights/carousel/CarouselHeader.d.ts +1 -1
- package/dist/microinsights/carousel/MicroBeatCarousel.d.ts +2 -13
- package/dist/microinsights/index.d.ts +1 -1
- package/dist/microinsights/index.es.js +1 -1
- package/dist/microinsights/interfaces.d.ts +13 -3
- package/dist/trends/index.es.js +1 -1
- package/package.json +1 -1
- package/dist/ViewMoreMicroCard-K69RRs_b.mjs +0 -1282
|
@@ -0,0 +1,1287 @@
|
|
|
1
|
+
import { jsx as o, jsxs as M, Fragment as Re } from "react/jsx-runtime";
|
|
2
|
+
import g, { useEffect as re, useState as ie } from "react";
|
|
3
|
+
import { observer as z } from "mobx-react-lite";
|
|
4
|
+
import U from "@mui/material/Stack";
|
|
5
|
+
import Ue from "@mui/material/Button";
|
|
6
|
+
import { CategoryIcon as ze, MerchantLogo as Ke, InstitutionLogo as Fe, P as me, Text as ue, H3 as He } from "@mxenabled/mxui";
|
|
7
|
+
import { Icon as $e, Close as je, ChevronLeft as Ye, ChevronRight as Oe } from "@mxenabled/mx-icons";
|
|
8
|
+
import { L as Xe } from "./Loader-CxeBwuPG.mjs";
|
|
9
|
+
import ae from "@mui/material/Box";
|
|
10
|
+
import Ce from "@mui/material/IconButton";
|
|
11
|
+
import { alpha as c, useTheme as H } from "@mui/material/styles";
|
|
12
|
+
import { useInView as We } from "react-intersection-observer";
|
|
13
|
+
import se from "@mui/material/styles/useTheme";
|
|
14
|
+
import { C as Ze } from "./Category-DEKZGLYe.mjs";
|
|
15
|
+
import { b as Qe } from "./Localization-DnoVyBNK.mjs";
|
|
16
|
+
import qe from "@mui/material/CircularProgress";
|
|
17
|
+
import { makeAutoObservable as ce, runInAction as we } from "mobx";
|
|
18
|
+
import { a as Je, u as et, b as tt } from "./Analytics-CkYXKvco.mjs";
|
|
19
|
+
import { G as he, B as ge } from "./GlobalCopyApi-wcnDUzMV.mjs";
|
|
20
|
+
import { u as ot } from "./useWidgetLoadTimer-CJb-RELP.mjs";
|
|
21
|
+
import { Card as nt, CardActionArea as it, Box as rt, IconButton as at, Stack as F, Button as Ie } from "@mui/material";
|
|
22
|
+
import st from "@mui/material/Avatar";
|
|
23
|
+
class ct {
|
|
24
|
+
copyApi = new he("/", "");
|
|
25
|
+
copyObject = {};
|
|
26
|
+
namespace = "experiences";
|
|
27
|
+
translationKey = "micro_insights";
|
|
28
|
+
constructor() {
|
|
29
|
+
ce(this);
|
|
30
|
+
}
|
|
31
|
+
// NOTE: Not sure if this is special case, but other stores have this deprecation todo
|
|
32
|
+
// DEPRECATED: Initialize api in constructor and use loadCopy instead
|
|
33
|
+
// TODO: Remove this function
|
|
34
|
+
initialize = async (e, n) => {
|
|
35
|
+
this.copyApi = new he(e, n), await this.loadCopy();
|
|
36
|
+
};
|
|
37
|
+
loadCopy = async () => {
|
|
38
|
+
const e = await this.copyApi.getGlobalCopy(this.namespace, this.translationKey);
|
|
39
|
+
we(() => {
|
|
40
|
+
this.copyObject = e[this.translationKey];
|
|
41
|
+
});
|
|
42
|
+
};
|
|
43
|
+
get cardsCopy() {
|
|
44
|
+
return this.copyObject.cards;
|
|
45
|
+
}
|
|
46
|
+
get carouselCopy() {
|
|
47
|
+
return this.copyObject.carousel;
|
|
48
|
+
}
|
|
49
|
+
get zeroStateCopy() {
|
|
50
|
+
return this.copyObject.zero_state;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
const le = {
|
|
54
|
+
BillAmountNotStandard: "BillAmountNotStandard",
|
|
55
|
+
CanadianUpcomingDeadlineAlert: "CanadianUpcomingDeadlineAlert",
|
|
56
|
+
DuplicatePaymentV2: "DuplicatePaymentV2",
|
|
57
|
+
IntroducePulse: "IntroducePulse",
|
|
58
|
+
LargeTransaction: "LargeTransaction",
|
|
59
|
+
MonthlySpendToIncomeComparisonV2: "MonthlySpendToIncomeComparisonV2",
|
|
60
|
+
QuarterlySummary: "QuarterlySummary",
|
|
61
|
+
SpendingPlanCategorySpending: "SpendingPlanCategorySpending",
|
|
62
|
+
SubscriptionPriceIncrease: "SubscriptionPriceIncrease",
|
|
63
|
+
UncategorizedTransactionsV2: "UncategorizedTransactionsV2",
|
|
64
|
+
UpcomingBill: "UpcomingBill",
|
|
65
|
+
UnifiedDeposit: "UnifiedDeposit",
|
|
66
|
+
WeeklySpendingPlanSummary: "WeeklySpendingPlanSummary",
|
|
67
|
+
WeeklyNewMerchantsV2: "WeeklyNewMerchantsV2",
|
|
68
|
+
MonthlySpendComparison: "MonthlySpendComparison",
|
|
69
|
+
MonthlySpendToIncomeComparison: "MonthlySpendToIncomeComparison"
|
|
70
|
+
}, W = window?.app?.clientConfig?.microwidget_instance_id || "", Ee = {
|
|
71
|
+
INSIGHTS_MICRO_WIDGET: "/micro-insights-carousel"
|
|
72
|
+
}, Ne = (t) => `on${t}Click`, Me = (t) => `on${t}View`, Le = (t) => `on${t}ViewFirstTime`, de = (t) => t.replace(/([a-z])([A-Z])/g, "$1 $2"), lt = () => Object.values(le).reduce(
|
|
73
|
+
(t, e) => ({
|
|
74
|
+
...t,
|
|
75
|
+
[Ne(e)]: {
|
|
76
|
+
action: v.MICRO_BEAT_CLICKED,
|
|
77
|
+
category: b.BEAT_INTERACTION,
|
|
78
|
+
label: de(e),
|
|
79
|
+
value: W
|
|
80
|
+
}
|
|
81
|
+
}),
|
|
82
|
+
{}
|
|
83
|
+
), dt = () => Object.values(le).reduce(
|
|
84
|
+
(t, e) => ({
|
|
85
|
+
...t,
|
|
86
|
+
[Me(e)]: {
|
|
87
|
+
action: v.MICRO_BEAT_DISPLAYED,
|
|
88
|
+
category: b.BEAT_INTERACTION,
|
|
89
|
+
label: de(e),
|
|
90
|
+
value: W
|
|
91
|
+
}
|
|
92
|
+
}),
|
|
93
|
+
{}
|
|
94
|
+
), _t = () => Object.values(le).reduce(
|
|
95
|
+
(t, e) => ({
|
|
96
|
+
...t,
|
|
97
|
+
[Le(e)]: {
|
|
98
|
+
action: v.MICRO_BEAT_DISPLAYED_FIRST_TIME,
|
|
99
|
+
category: b.BEAT_INTERACTION,
|
|
100
|
+
label: de(e),
|
|
101
|
+
value: W
|
|
102
|
+
}
|
|
103
|
+
}),
|
|
104
|
+
{}
|
|
105
|
+
), L = {
|
|
106
|
+
CAROUSEL_CONTROL: "Carousel Control",
|
|
107
|
+
MICRO_WIDGET: "Micro Widget",
|
|
108
|
+
VIEW_MORE: "View More"
|
|
109
|
+
}, b = {
|
|
110
|
+
MICRO_WIDGET_INTERACTION: "Micro Widget Interaction",
|
|
111
|
+
BEAT_INTERACTION: "Beat Interaction"
|
|
112
|
+
}, w = {
|
|
113
|
+
ON_CAROUSEL_BACK_CLICK: "onCarouselBackClick",
|
|
114
|
+
ON_CAROUSEL_BACK_SWIPE: "onCarouselBackSwipe",
|
|
115
|
+
ON_CAROUSEL_FORWARD_CLICK: "onCarouselForwardClick",
|
|
116
|
+
ON_CAROUSEL_FORWARD_SWIPE: "onCarouselForwardSwipe",
|
|
117
|
+
ON_NO_RELEVANT_INSIGHTS_CLICKED: "onNoRelevantInsightsClicked",
|
|
118
|
+
ON_VIEW_MORE_CLICKED: "onViewMoreClicked"
|
|
119
|
+
}, be = {
|
|
120
|
+
ON_VIEW_MORE_VIEWED: "onViewMoreCardView"
|
|
121
|
+
}, v = {
|
|
122
|
+
CONTROL_BACKWARD: "Control Backward",
|
|
123
|
+
CONTROL_FORWARD: "Control Forward",
|
|
124
|
+
MICRO_BEAT_CLICKED: "Micro Beat Clicked",
|
|
125
|
+
MICRO_BEAT_DISPLAYED: "Micro Beat Displayed",
|
|
126
|
+
MICRO_BEAT_DISPLAYED_FIRST_TIME: "Micro Beat Displayed For First Time",
|
|
127
|
+
SWIPE_BACKWARD: "Swipe Backward",
|
|
128
|
+
SWIPE_FORWARD: "Swipe Forward"
|
|
129
|
+
}, P = {
|
|
130
|
+
MICRO_WIDGET_CAROUSEL: "Micro Widget Carousel",
|
|
131
|
+
MICRO_WIDGET_CAROUSEL_ZERO_STATE: "Micro Widget Carousel Zero State",
|
|
132
|
+
MICRO_WIDGET_CAROUSEL_NO_RELEVANT_INSIGHTS: "Micro Widget Carousel No Relevant Insights"
|
|
133
|
+
}, fe = {
|
|
134
|
+
[P.MICRO_WIDGET_CAROUSEL]: {
|
|
135
|
+
label: L.MICRO_WIDGET,
|
|
136
|
+
name: P.MICRO_WIDGET_CAROUSEL,
|
|
137
|
+
path: Ee.INSIGHTS_MICRO_WIDGET,
|
|
138
|
+
value: W
|
|
139
|
+
},
|
|
140
|
+
// zero state
|
|
141
|
+
[P.MICRO_WIDGET_CAROUSEL_ZERO_STATE]: {
|
|
142
|
+
label: L.MICRO_WIDGET,
|
|
143
|
+
name: P.MICRO_WIDGET_CAROUSEL_ZERO_STATE,
|
|
144
|
+
path: Ee.INSIGHTS_MICRO_WIDGET,
|
|
145
|
+
value: W
|
|
146
|
+
},
|
|
147
|
+
// no relevant cards
|
|
148
|
+
[P.MICRO_WIDGET_CAROUSEL_NO_RELEVANT_INSIGHTS]: {
|
|
149
|
+
label: L.MICRO_WIDGET,
|
|
150
|
+
name: P.MICRO_WIDGET_CAROUSEL_NO_RELEVANT_INSIGHTS,
|
|
151
|
+
path: "/micro-widget",
|
|
152
|
+
value: W
|
|
153
|
+
}
|
|
154
|
+
}, ye = {
|
|
155
|
+
// carousel control interaction events - clicks and swipes
|
|
156
|
+
[w.ON_CAROUSEL_BACK_CLICK]: {
|
|
157
|
+
action: v.CONTROL_BACKWARD,
|
|
158
|
+
category: b.MICRO_WIDGET_INTERACTION,
|
|
159
|
+
label: L.CAROUSEL_CONTROL,
|
|
160
|
+
value: W
|
|
161
|
+
},
|
|
162
|
+
[w.ON_CAROUSEL_FORWARD_CLICK]: {
|
|
163
|
+
action: v.CONTROL_FORWARD,
|
|
164
|
+
category: b.MICRO_WIDGET_INTERACTION,
|
|
165
|
+
label: L.CAROUSEL_CONTROL,
|
|
166
|
+
value: W
|
|
167
|
+
},
|
|
168
|
+
[w.ON_CAROUSEL_BACK_SWIPE]: {
|
|
169
|
+
action: v.SWIPE_BACKWARD,
|
|
170
|
+
category: b.MICRO_WIDGET_INTERACTION,
|
|
171
|
+
label: L.CAROUSEL_CONTROL,
|
|
172
|
+
value: W
|
|
173
|
+
},
|
|
174
|
+
[w.ON_CAROUSEL_FORWARD_SWIPE]: {
|
|
175
|
+
action: v.SWIPE_FORWARD,
|
|
176
|
+
category: b.MICRO_WIDGET_INTERACTION,
|
|
177
|
+
label: L.CAROUSEL_CONTROL,
|
|
178
|
+
value: W
|
|
179
|
+
},
|
|
180
|
+
// read more card events
|
|
181
|
+
[w.ON_VIEW_MORE_CLICKED]: {
|
|
182
|
+
action: v.MICRO_BEAT_CLICKED,
|
|
183
|
+
category: b.BEAT_INTERACTION,
|
|
184
|
+
label: L.VIEW_MORE,
|
|
185
|
+
value: W
|
|
186
|
+
},
|
|
187
|
+
[be.ON_VIEW_MORE_VIEWED]: {
|
|
188
|
+
action: v.MICRO_BEAT_DISPLAYED,
|
|
189
|
+
category: b.BEAT_INTERACTION,
|
|
190
|
+
label: L.VIEW_MORE,
|
|
191
|
+
value: W
|
|
192
|
+
},
|
|
193
|
+
...lt(),
|
|
194
|
+
...dt(),
|
|
195
|
+
..._t()
|
|
196
|
+
}, Ae = async (t, e) => !e || !ye[t] ? null : e.sendAnalyticEvent(ye[t]).then((n) => n).catch((n) => {
|
|
197
|
+
throw n;
|
|
198
|
+
}), Se = async (t, e) => !e || !fe[t] ? null : e.sendAnalyticsPageview(fe[t]).then((n) => n).catch((n) => {
|
|
199
|
+
throw n;
|
|
200
|
+
});
|
|
201
|
+
class pt {
|
|
202
|
+
onAnalyticEvent = Ae;
|
|
203
|
+
onAnalyticPageView = Se;
|
|
204
|
+
beatApi = new ge("/", "");
|
|
205
|
+
constructor() {
|
|
206
|
+
ce(this);
|
|
207
|
+
}
|
|
208
|
+
initialize = async (e, n, i) => {
|
|
209
|
+
this.onAnalyticEvent = (r, a) => {
|
|
210
|
+
Ae(r, a).then((s) => s).catch((s) => {
|
|
211
|
+
throw s.status === 401 && i(), s;
|
|
212
|
+
});
|
|
213
|
+
}, this.onAnalyticPageView = (r, a) => {
|
|
214
|
+
Se(r, a).then((s) => s).catch((s) => {
|
|
215
|
+
throw s.status === 401 && i(), s;
|
|
216
|
+
});
|
|
217
|
+
}, this.beatApi = new ge(e, n);
|
|
218
|
+
};
|
|
219
|
+
updateBeat = async (e) => {
|
|
220
|
+
this.beatApi.updateBeat(e);
|
|
221
|
+
};
|
|
222
|
+
updateOffer = async (e) => {
|
|
223
|
+
this.beatApi.updateOffer(e);
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
class mt {
|
|
227
|
+
copyStore;
|
|
228
|
+
endpoint = "/";
|
|
229
|
+
insightsMicroWidgetStore;
|
|
230
|
+
session = null;
|
|
231
|
+
token = "";
|
|
232
|
+
isInitialized = !1;
|
|
233
|
+
constructor() {
|
|
234
|
+
this.copyStore = new ct(), this.insightsMicroWidgetStore = new pt(), ce(this);
|
|
235
|
+
}
|
|
236
|
+
initialize = async (e, n, i) => {
|
|
237
|
+
await this.copyStore.initialize(e, n), await this.insightsMicroWidgetStore.initialize(e, n, i);
|
|
238
|
+
const r = await Je(e, n, "1.0.0", "Micro Insights Carousel");
|
|
239
|
+
we(() => {
|
|
240
|
+
this.session = r, this.isInitialized = !0;
|
|
241
|
+
});
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
const $ = g.createContext(null), ut = ({
|
|
245
|
+
onEvent: t,
|
|
246
|
+
onPageview: e,
|
|
247
|
+
store: n,
|
|
248
|
+
children: i
|
|
249
|
+
}) => /* @__PURE__ */ o($.Provider, { value: { onEvent: t, onPageview: e, store: n, children: i }, children: i }), Ct = ({ beat: t }) => {
|
|
250
|
+
const { primary_category_guid: e, category_guids: n } = t, i = e || n?.[0] || Ze.UNCATEGORIZED;
|
|
251
|
+
return /* @__PURE__ */ o(ze, { categoryGuid: i, size: 32, sx: { minWidth: 32 } });
|
|
252
|
+
}, l = ({
|
|
253
|
+
avatarSx: t,
|
|
254
|
+
bgColor: e,
|
|
255
|
+
name: n,
|
|
256
|
+
iconColor: i = "primary",
|
|
257
|
+
fill: r = !0,
|
|
258
|
+
sx: a
|
|
259
|
+
}) => /* @__PURE__ */ o(
|
|
260
|
+
st,
|
|
261
|
+
{
|
|
262
|
+
sx: {
|
|
263
|
+
bgcolor: e,
|
|
264
|
+
width: 32,
|
|
265
|
+
height: 32,
|
|
266
|
+
...t
|
|
267
|
+
},
|
|
268
|
+
variant: "rounded",
|
|
269
|
+
children: /* @__PURE__ */ o($e, { color: i, fill: r, name: n, size: 20, sx: a })
|
|
270
|
+
}
|
|
271
|
+
), ht = ({ beat: t }) => {
|
|
272
|
+
const { category_guids: e, merchant_guids: n, primary_category_guid: i, primary_merchant_guid: r } = t;
|
|
273
|
+
return /* @__PURE__ */ o(
|
|
274
|
+
Ke,
|
|
275
|
+
{
|
|
276
|
+
categoryGuid: i || e && e[0] || "",
|
|
277
|
+
merchantGuid: r || n[0],
|
|
278
|
+
size: 32,
|
|
279
|
+
sx: {
|
|
280
|
+
display: "flex",
|
|
281
|
+
mt: 2,
|
|
282
|
+
minWidth: 32
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
);
|
|
286
|
+
}, gt = (t) => t ? t.data ? t.data.map((e) => {
|
|
287
|
+
const n = {};
|
|
288
|
+
return t.names?.map((i, r) => {
|
|
289
|
+
n[i] = e[r];
|
|
290
|
+
}), n;
|
|
291
|
+
}) : [] : [], ee = "primary", ve = "success", De = "error", xe = (t) => {
|
|
292
|
+
const e = gt(t), n = Math.floor(e.length / 2);
|
|
293
|
+
if (n === 0 || n === e.length) return ee;
|
|
294
|
+
const i = e[0]?.amount, r = e[n]?.amount;
|
|
295
|
+
return i == null || r == null ? ee : i > r ? De : i < r ? ve : ee;
|
|
296
|
+
}, It = (t, e) => t < e ? ve : t > e ? De : ee, Et = ({ beat: t }) => {
|
|
297
|
+
const e = se(), n = xe(t.data_series), i = e.palette[n].main;
|
|
298
|
+
return /* @__PURE__ */ o(l, { bgColor: c(i, 0.15), iconColor: n, name: "bar_chart" });
|
|
299
|
+
}, ft = ({ beat: t }) => {
|
|
300
|
+
const e = se(), n = t.payload?.average_spend || 0;
|
|
301
|
+
let i = 0;
|
|
302
|
+
if (t.data_series?.data && t.data_series.data.length > 0) {
|
|
303
|
+
const s = (t.data_series.names || []).indexOf("amount");
|
|
304
|
+
s !== -1 && (i = t.data_series.data[0][s] || 0);
|
|
305
|
+
}
|
|
306
|
+
const r = It(i, n);
|
|
307
|
+
return /* @__PURE__ */ o(
|
|
308
|
+
l,
|
|
309
|
+
{
|
|
310
|
+
bgColor: c(e.palette[r].main, 0.15),
|
|
311
|
+
iconColor: r,
|
|
312
|
+
name: "timeline"
|
|
313
|
+
}
|
|
314
|
+
);
|
|
315
|
+
}, yt = ({ beat: t }) => {
|
|
316
|
+
const e = se(), n = xe(t.data_series), i = e.palette[n].main;
|
|
317
|
+
return /* @__PURE__ */ o(
|
|
318
|
+
l,
|
|
319
|
+
{
|
|
320
|
+
bgColor: c(i, 0.15),
|
|
321
|
+
fill: !1,
|
|
322
|
+
iconColor: n,
|
|
323
|
+
name: "area_chart"
|
|
324
|
+
}
|
|
325
|
+
);
|
|
326
|
+
}, At = ({ beat: t }) => /* @__PURE__ */ o(Fe, { alt: t.institutionName || "", institutionGuid: t.institutionGuid || "" }), St = {
|
|
327
|
+
0: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "error" }),
|
|
328
|
+
1: (t) => /* @__PURE__ */ o(Ct, { beat: t }),
|
|
329
|
+
2: (t) => /* @__PURE__ */ o(ht, { beat: t }),
|
|
330
|
+
3: (t) => /* @__PURE__ */ o(Et, { beat: t }),
|
|
331
|
+
4: (t, e) => /* @__PURE__ */ o(
|
|
332
|
+
l,
|
|
333
|
+
{
|
|
334
|
+
bgColor: c(e.palette.secondary.main, 0.15),
|
|
335
|
+
iconColor: "secondary",
|
|
336
|
+
name: "info"
|
|
337
|
+
}
|
|
338
|
+
),
|
|
339
|
+
5: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "campaign" }),
|
|
340
|
+
6: (t, e) => /* @__PURE__ */ o(
|
|
341
|
+
l,
|
|
342
|
+
{
|
|
343
|
+
bgColor: c(e.palette.success.main, 0.15),
|
|
344
|
+
iconColor: "success",
|
|
345
|
+
name: "check_circle"
|
|
346
|
+
}
|
|
347
|
+
),
|
|
348
|
+
7: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "today" }),
|
|
349
|
+
8: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "calendar_clock" }),
|
|
350
|
+
9: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "celebration" }),
|
|
351
|
+
// TODO: Waiting for the backend to accommodate the below icon types
|
|
352
|
+
10: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "problem" }),
|
|
353
|
+
11: (t, e) => /* @__PURE__ */ o(
|
|
354
|
+
l,
|
|
355
|
+
{
|
|
356
|
+
avatarSx: { border: `1px solid ${e.palette.secondary.main}` },
|
|
357
|
+
bgColor: c(e.palette.secondary.main, 0.15),
|
|
358
|
+
fill: !1,
|
|
359
|
+
name: "category",
|
|
360
|
+
sx: { color: "text.primary" }
|
|
361
|
+
}
|
|
362
|
+
),
|
|
363
|
+
12: (t) => /* @__PURE__ */ o(yt, { beat: t }),
|
|
364
|
+
13: () => /* @__PURE__ */ o(
|
|
365
|
+
l,
|
|
366
|
+
{
|
|
367
|
+
avatarSx: { border: "1px solid #EB00D0" },
|
|
368
|
+
bgColor: c("#EB00D0", 0.25),
|
|
369
|
+
fill: !1,
|
|
370
|
+
name: "money_bag",
|
|
371
|
+
sx: { color: "text.primary" }
|
|
372
|
+
}
|
|
373
|
+
),
|
|
374
|
+
14: (t, e) => /* @__PURE__ */ o(
|
|
375
|
+
l,
|
|
376
|
+
{
|
|
377
|
+
bgColor: c(e.palette.secondary.main, 0.15),
|
|
378
|
+
fill: !1,
|
|
379
|
+
iconColor: "secondary",
|
|
380
|
+
name: "person"
|
|
381
|
+
}
|
|
382
|
+
),
|
|
383
|
+
15: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "payment_arrow_down" }),
|
|
384
|
+
16: (t, e) => /* @__PURE__ */ o(
|
|
385
|
+
l,
|
|
386
|
+
{
|
|
387
|
+
bgColor: c(e.palette.success.main, 0.15),
|
|
388
|
+
name: "beenhere",
|
|
389
|
+
sx: { color: "success.main" }
|
|
390
|
+
}
|
|
391
|
+
),
|
|
392
|
+
17: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "savings" }),
|
|
393
|
+
18: (t, e) => /* @__PURE__ */ o(
|
|
394
|
+
l,
|
|
395
|
+
{
|
|
396
|
+
bgColor: t.payload.projected_overdraft_amount < 0 ? c(e.palette.warning.main, 0.15) : c(e.palette.error.main, 0.15),
|
|
397
|
+
iconColor: t?.payload?.projected_overdraft_amount < 0 ? "warning" : "error",
|
|
398
|
+
name: "error"
|
|
399
|
+
}
|
|
400
|
+
),
|
|
401
|
+
19: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "finance_mode" }),
|
|
402
|
+
20: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "tips_and_updates" }),
|
|
403
|
+
21: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "currency_exchange" }),
|
|
404
|
+
22: (t, e) => /* @__PURE__ */ o(
|
|
405
|
+
l,
|
|
406
|
+
{
|
|
407
|
+
bgColor: c(e.palette.warning.main, 0.15),
|
|
408
|
+
name: "flag",
|
|
409
|
+
sx: { color: "warning.main" }
|
|
410
|
+
}
|
|
411
|
+
),
|
|
412
|
+
23: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "thumb_up" }),
|
|
413
|
+
24: () => /* @__PURE__ */ o(
|
|
414
|
+
l,
|
|
415
|
+
{
|
|
416
|
+
bgColor: c("#EB00D0", 0.15),
|
|
417
|
+
name: "attach_money",
|
|
418
|
+
sx: { color: "#EB00D0" }
|
|
419
|
+
}
|
|
420
|
+
),
|
|
421
|
+
25: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "note_stack" }),
|
|
422
|
+
26: (t, e) => /* @__PURE__ */ o(
|
|
423
|
+
l,
|
|
424
|
+
{
|
|
425
|
+
bgColor: c(e.palette.primary.main, 0.15),
|
|
426
|
+
fill: !1,
|
|
427
|
+
name: "price_change"
|
|
428
|
+
}
|
|
429
|
+
),
|
|
430
|
+
27: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "directions_car" }),
|
|
431
|
+
28: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "contract" }),
|
|
432
|
+
29: (t) => /* @__PURE__ */ o(ft, { beat: t }),
|
|
433
|
+
30: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "calendar_month" }),
|
|
434
|
+
31: (t, e) => /* @__PURE__ */ o(
|
|
435
|
+
l,
|
|
436
|
+
{
|
|
437
|
+
bgColor: c(e.palette.warning.main, 0.15),
|
|
438
|
+
name: "star_rate",
|
|
439
|
+
sx: { color: "warning.400" }
|
|
440
|
+
}
|
|
441
|
+
),
|
|
442
|
+
32: (t, e) => /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "help" }),
|
|
443
|
+
33: (t, e) => /* @__PURE__ */ o(
|
|
444
|
+
l,
|
|
445
|
+
{
|
|
446
|
+
bgColor: c(e.palette.primary.main, 0.15),
|
|
447
|
+
fill: !1,
|
|
448
|
+
name: "storefront"
|
|
449
|
+
}
|
|
450
|
+
),
|
|
451
|
+
34: (t) => /* @__PURE__ */ o(At, { beat: t })
|
|
452
|
+
}, Tt = ({ beat: t }) => {
|
|
453
|
+
const e = H(), { icon_type: n } = t, i = n != null ? St[n] : null;
|
|
454
|
+
return i ? i(t, e) : /* @__PURE__ */ o(l, { bgColor: c(e.palette.primary.main, 0.15), name: "error" });
|
|
455
|
+
}, D = () => {
|
|
456
|
+
const t = g.useContext($);
|
|
457
|
+
if (!t)
|
|
458
|
+
throw new Error("useCopyStore() must be used within the InsightsMicroWidgetDataProvider");
|
|
459
|
+
return t.store.copyStore;
|
|
460
|
+
}, Rt = () => {
|
|
461
|
+
const t = g.useContext($);
|
|
462
|
+
if (!t?.store?.insightsMicroWidgetStore)
|
|
463
|
+
throw new Error(
|
|
464
|
+
"useInsightsMicroWidgetStore() must be used within the InsightsMicroWidgetDataProvider"
|
|
465
|
+
);
|
|
466
|
+
return t.store.insightsMicroWidgetStore;
|
|
467
|
+
}, j = () => {
|
|
468
|
+
const t = g.useContext($);
|
|
469
|
+
if (!t)
|
|
470
|
+
throw new Error("useEvent() must be used within the InsightsMicroWidgetDataProvider");
|
|
471
|
+
return { onEvent: t.onEvent };
|
|
472
|
+
}, Be = () => {
|
|
473
|
+
const t = g.useContext($);
|
|
474
|
+
if (!t)
|
|
475
|
+
throw new Error("usePageview() must be used within the InsightsMicroWidgetDataProvider");
|
|
476
|
+
return { onPageview: t.onPageview };
|
|
477
|
+
}, Ot = {
|
|
478
|
+
LARGE: 180,
|
|
479
|
+
STANDARD: 154,
|
|
480
|
+
XLARGE: 200,
|
|
481
|
+
XXLARGE: 248
|
|
482
|
+
}, Wt = 50, Pe = 1, te = g.forwardRef(
|
|
483
|
+
function({
|
|
484
|
+
ariaLabel: e,
|
|
485
|
+
closeAriaLabel: n,
|
|
486
|
+
description: i,
|
|
487
|
+
elevation: r,
|
|
488
|
+
icon: a,
|
|
489
|
+
isActiveCard: s,
|
|
490
|
+
heightOverrides: m,
|
|
491
|
+
onClose: C,
|
|
492
|
+
onCardClick: I,
|
|
493
|
+
onPrimaryAction: h,
|
|
494
|
+
onSecondaryAction: d,
|
|
495
|
+
primaryActionText: _,
|
|
496
|
+
secondaryActionText: p,
|
|
497
|
+
title: E,
|
|
498
|
+
variant: y,
|
|
499
|
+
widthOverrides: A,
|
|
500
|
+
...O
|
|
501
|
+
}, S) {
|
|
502
|
+
const N = !!(h && _), f = /* @__PURE__ */ M(Re, { children: [
|
|
503
|
+
C && /* @__PURE__ */ o(
|
|
504
|
+
at,
|
|
505
|
+
{
|
|
506
|
+
"aria-label": n,
|
|
507
|
+
onClick: (u) => {
|
|
508
|
+
u.stopPropagation(), C?.();
|
|
509
|
+
},
|
|
510
|
+
onMouseDown: (u) => {
|
|
511
|
+
u.stopPropagation();
|
|
512
|
+
},
|
|
513
|
+
onTouchStart: (u) => {
|
|
514
|
+
u.stopPropagation();
|
|
515
|
+
},
|
|
516
|
+
sx: { minHeight: 40, minWidth: 40, position: "absolute", right: 4, top: 4 },
|
|
517
|
+
children: /* @__PURE__ */ o(je, {})
|
|
518
|
+
}
|
|
519
|
+
),
|
|
520
|
+
/* @__PURE__ */ M(F, { sx: { gap: 6, height: "100%", justifyContent: "space-between" }, children: [
|
|
521
|
+
/* @__PURE__ */ M(F, { sx: { flexDirection: "row", gap: 12 }, children: [
|
|
522
|
+
a && a,
|
|
523
|
+
/* @__PURE__ */ M(F, { sx: { gap: 6 }, children: [
|
|
524
|
+
/* @__PURE__ */ o(F, { sx: { flexDirection: "row", justifyContent: "space-between" }, children: /* @__PURE__ */ o(me, { bold: !0, sx: { lineHeight: "16px" }, variant: "body1", children: E }) }),
|
|
525
|
+
/* @__PURE__ */ o(
|
|
526
|
+
me,
|
|
527
|
+
{
|
|
528
|
+
dangerouslySetInnerHTML: { __html: i },
|
|
529
|
+
sx: {
|
|
530
|
+
display: "-webkit-box",
|
|
531
|
+
overflow: "hidden",
|
|
532
|
+
textOverflow: "ellipsis",
|
|
533
|
+
WebkitBoxOrient: "vertical",
|
|
534
|
+
WebkitLineClamp: N ? 2 : 3,
|
|
535
|
+
"& .bold-copy": {
|
|
536
|
+
fontWeight: "bold",
|
|
537
|
+
fontFamily: "inherit"
|
|
538
|
+
}
|
|
539
|
+
},
|
|
540
|
+
variant: "subtitle2"
|
|
541
|
+
}
|
|
542
|
+
)
|
|
543
|
+
] })
|
|
544
|
+
] }),
|
|
545
|
+
N && /* @__PURE__ */ M(
|
|
546
|
+
F,
|
|
547
|
+
{
|
|
548
|
+
sx: {
|
|
549
|
+
alignItems: "center",
|
|
550
|
+
flexDirection: "row",
|
|
551
|
+
height: 28,
|
|
552
|
+
pb: 4,
|
|
553
|
+
pl: a ? 36 : 0
|
|
554
|
+
},
|
|
555
|
+
children: [
|
|
556
|
+
N && /* @__PURE__ */ o(
|
|
557
|
+
Ie,
|
|
558
|
+
{
|
|
559
|
+
onClick: (u) => {
|
|
560
|
+
u.stopPropagation(), h?.();
|
|
561
|
+
},
|
|
562
|
+
onMouseDown: (u) => {
|
|
563
|
+
u.stopPropagation();
|
|
564
|
+
},
|
|
565
|
+
onTouchStart: (u) => {
|
|
566
|
+
u.stopPropagation();
|
|
567
|
+
},
|
|
568
|
+
size: "small",
|
|
569
|
+
sx: { px: 8, ml: a ? 0 : -8 },
|
|
570
|
+
variant: "text",
|
|
571
|
+
children: /* @__PURE__ */ o(ue, { bold: !0, variant: "body2", children: _ })
|
|
572
|
+
}
|
|
573
|
+
),
|
|
574
|
+
!!(d && p) && /* @__PURE__ */ o(
|
|
575
|
+
Ie,
|
|
576
|
+
{
|
|
577
|
+
onClick: (u) => {
|
|
578
|
+
u.stopPropagation(), d?.();
|
|
579
|
+
},
|
|
580
|
+
onMouseDown: (u) => {
|
|
581
|
+
u.stopPropagation();
|
|
582
|
+
},
|
|
583
|
+
onTouchStart: (u) => {
|
|
584
|
+
u.stopPropagation();
|
|
585
|
+
},
|
|
586
|
+
size: "small",
|
|
587
|
+
sx: { px: 8 },
|
|
588
|
+
variant: "text",
|
|
589
|
+
children: /* @__PURE__ */ o(ue, { bold: !0, sx: { color: "text.secondary" }, variant: "body2", children: p })
|
|
590
|
+
}
|
|
591
|
+
)
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
)
|
|
595
|
+
] })
|
|
596
|
+
] });
|
|
597
|
+
return /* @__PURE__ */ o(
|
|
598
|
+
nt,
|
|
599
|
+
{
|
|
600
|
+
"aria-hidden": !s,
|
|
601
|
+
"aria-label": e,
|
|
602
|
+
elevation: r,
|
|
603
|
+
ref: S,
|
|
604
|
+
role: "group",
|
|
605
|
+
sx: {
|
|
606
|
+
backgroundColor: "background.paper",
|
|
607
|
+
height: m ? "100%" : 120,
|
|
608
|
+
minWidth: A ? `${A}px` : "100%",
|
|
609
|
+
position: "relative",
|
|
610
|
+
my: 1,
|
|
611
|
+
borderRadius: 2
|
|
612
|
+
},
|
|
613
|
+
tabIndex: I || !s ? -1 : 0,
|
|
614
|
+
variant: y,
|
|
615
|
+
...O,
|
|
616
|
+
children: I ? /* @__PURE__ */ o(
|
|
617
|
+
it,
|
|
618
|
+
{
|
|
619
|
+
component: "div",
|
|
620
|
+
onClick: I,
|
|
621
|
+
sx: {
|
|
622
|
+
pb: 8,
|
|
623
|
+
pt: 16,
|
|
624
|
+
px: 16,
|
|
625
|
+
height: "100%"
|
|
626
|
+
},
|
|
627
|
+
children: f
|
|
628
|
+
}
|
|
629
|
+
) : /* @__PURE__ */ o(rt, { sx: { pb: 8, pt: 16, px: 16, height: "100%" }, children: f })
|
|
630
|
+
}
|
|
631
|
+
);
|
|
632
|
+
}
|
|
633
|
+
), wt = ({
|
|
634
|
+
ariaLabel: t,
|
|
635
|
+
beat: e,
|
|
636
|
+
elevation: n,
|
|
637
|
+
index: i,
|
|
638
|
+
isActiveCard: r,
|
|
639
|
+
onCardClick: a,
|
|
640
|
+
posthog: s,
|
|
641
|
+
widthOverrides: m,
|
|
642
|
+
variant: C,
|
|
643
|
+
showIcon: I,
|
|
644
|
+
heightOverrides: h
|
|
645
|
+
}) => {
|
|
646
|
+
const { ref: d, inView: _ } = We({
|
|
647
|
+
threshold: Pe
|
|
648
|
+
}), { cardsCopy: p } = D(), { onEvent: E } = j(), { updateBeat: y, updateOffer: A } = Rt();
|
|
649
|
+
re(() => {
|
|
650
|
+
_ && (e.has_been_displayed ? E(Me(e.template)) : (e.guid.startsWith("OFR") ? A({
|
|
651
|
+
...e,
|
|
652
|
+
has_been_displayed: !0
|
|
653
|
+
}) : y({
|
|
654
|
+
...e,
|
|
655
|
+
has_been_displayed: !0
|
|
656
|
+
}), E(Le(e.template))));
|
|
657
|
+
}, [_]), re(() => {
|
|
658
|
+
if (_ && e)
|
|
659
|
+
if (e.template === "MarketingOffer") {
|
|
660
|
+
const S = e;
|
|
661
|
+
s?.capture("viewed_messaging_insight", {
|
|
662
|
+
template: e.template,
|
|
663
|
+
campaign_guid: S.campaign_guid,
|
|
664
|
+
campaign_name: S.pulse_campaign_name
|
|
665
|
+
});
|
|
666
|
+
} else
|
|
667
|
+
s?.capture("viewed_insight", {
|
|
668
|
+
beat_guid: e.guid,
|
|
669
|
+
template: e.template,
|
|
670
|
+
position: i
|
|
671
|
+
});
|
|
672
|
+
}, [e, i, _]);
|
|
673
|
+
const O = () => {
|
|
674
|
+
if (a && a(e), E(Ne(e.template)), e.template === "MarketingOffer") {
|
|
675
|
+
const S = e;
|
|
676
|
+
s?.capture("clicked_messaging_insight", {
|
|
677
|
+
template: e.template,
|
|
678
|
+
campaign_guid: S.campaign_guid,
|
|
679
|
+
campaign_name: S.pulse_campaign_name
|
|
680
|
+
});
|
|
681
|
+
} else
|
|
682
|
+
s?.capture("clicked_insight", {
|
|
683
|
+
beat_guid: e.guid,
|
|
684
|
+
template: e.template,
|
|
685
|
+
position: i
|
|
686
|
+
});
|
|
687
|
+
};
|
|
688
|
+
return /* @__PURE__ */ o(
|
|
689
|
+
te,
|
|
690
|
+
{
|
|
691
|
+
"aria-roledescription": "slide",
|
|
692
|
+
ariaLabel: t,
|
|
693
|
+
description: e?.html_micro_description && e?.html_micro_description.length > 0 ? e.html_micro_description : e.html_description || "",
|
|
694
|
+
elevation: n,
|
|
695
|
+
heightOverrides: h,
|
|
696
|
+
icon: I && /* @__PURE__ */ o(Tt, { beat: e }),
|
|
697
|
+
isActiveCard: r,
|
|
698
|
+
onCardClick: O,
|
|
699
|
+
onPrimaryAction: O,
|
|
700
|
+
primaryActionText: e.micro_call_to_action || p?.micro_card_cta,
|
|
701
|
+
ref: d,
|
|
702
|
+
title: e.micro_title && e.micro_title.length > 0 ? e.micro_title : e.title,
|
|
703
|
+
variant: C,
|
|
704
|
+
widthOverrides: m
|
|
705
|
+
}
|
|
706
|
+
);
|
|
707
|
+
}, Nt = ({
|
|
708
|
+
currentBeatIndex: t,
|
|
709
|
+
numBeats: e,
|
|
710
|
+
onNextClick: n,
|
|
711
|
+
onPreviousClick: i,
|
|
712
|
+
scrollRightBoundary: r,
|
|
713
|
+
scrollX: a,
|
|
714
|
+
shouldApplyDotAnimation: s = !1,
|
|
715
|
+
visibleCardsCount: m = 1
|
|
716
|
+
}) => {
|
|
717
|
+
const C = H(), { carouselCopy: I } = D(), h = Math.floor(a) > r || t - m + 1 === 0, d = a < 0 || e - 1 === t, _ = C.palette.grey[500], p = C.palette.primary.main;
|
|
718
|
+
return /* @__PURE__ */ M(
|
|
719
|
+
U,
|
|
720
|
+
{
|
|
721
|
+
direction: "row",
|
|
722
|
+
sx: {
|
|
723
|
+
alignItems: "center",
|
|
724
|
+
justifyContent: "center",
|
|
725
|
+
pt: 4,
|
|
726
|
+
width: "100%",
|
|
727
|
+
// we were using `gap` instead of margin, but it doesn't work in safari browsers older than iOS 14.1
|
|
728
|
+
"& button:first-child": {
|
|
729
|
+
mr: 8
|
|
730
|
+
}
|
|
731
|
+
},
|
|
732
|
+
children: [
|
|
733
|
+
/* @__PURE__ */ o(
|
|
734
|
+
Ce,
|
|
735
|
+
{
|
|
736
|
+
"aria-disabled": h,
|
|
737
|
+
"aria-label": I?.previous_insight_cta_aria,
|
|
738
|
+
disabled: h,
|
|
739
|
+
onClick: i,
|
|
740
|
+
children: /* @__PURE__ */ o(
|
|
741
|
+
Ye,
|
|
742
|
+
{
|
|
743
|
+
style: {
|
|
744
|
+
color: h ? _ : p
|
|
745
|
+
}
|
|
746
|
+
}
|
|
747
|
+
)
|
|
748
|
+
}
|
|
749
|
+
),
|
|
750
|
+
Array.from({ length: e }).map((E, y) => {
|
|
751
|
+
const A = y === t;
|
|
752
|
+
return /* @__PURE__ */ o(
|
|
753
|
+
ae,
|
|
754
|
+
{
|
|
755
|
+
className: "mx-insights-micro-carousel-dots",
|
|
756
|
+
sx: {
|
|
757
|
+
bgcolor: A ? p : _,
|
|
758
|
+
height: 8,
|
|
759
|
+
mr: 8,
|
|
760
|
+
// existing comment from meganthan "we were using `gap` instead of margin, but it doesn't work in safari browsers older than iOS 14.1"
|
|
761
|
+
...s ? {
|
|
762
|
+
borderRadius: "4px",
|
|
763
|
+
transformOrigin: "center",
|
|
764
|
+
transition: "all 0.5s ease-out",
|
|
765
|
+
willChange: "width, background-color"
|
|
766
|
+
} : {
|
|
767
|
+
borderRadius: "50%",
|
|
768
|
+
p: 0
|
|
769
|
+
},
|
|
770
|
+
width: A && s ? 24 : 8
|
|
771
|
+
}
|
|
772
|
+
},
|
|
773
|
+
`carousel-button-${y}`
|
|
774
|
+
);
|
|
775
|
+
}),
|
|
776
|
+
/* @__PURE__ */ o(
|
|
777
|
+
Ce,
|
|
778
|
+
{
|
|
779
|
+
"aria-disabled": d,
|
|
780
|
+
"aria-label": I?.next_insight_cta_aria,
|
|
781
|
+
disabled: d,
|
|
782
|
+
onClick: n,
|
|
783
|
+
children: /* @__PURE__ */ o(
|
|
784
|
+
Oe,
|
|
785
|
+
{
|
|
786
|
+
style: {
|
|
787
|
+
color: d ? _ : p
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
)
|
|
791
|
+
}
|
|
792
|
+
)
|
|
793
|
+
]
|
|
794
|
+
}
|
|
795
|
+
);
|
|
796
|
+
}, Mt = ({
|
|
797
|
+
activeCardIndex: t,
|
|
798
|
+
beats: e,
|
|
799
|
+
cardWidth: n,
|
|
800
|
+
elevation: i,
|
|
801
|
+
heightOverrides: r,
|
|
802
|
+
onCardClick: a,
|
|
803
|
+
posthog: s,
|
|
804
|
+
showIcon: m,
|
|
805
|
+
variant: C
|
|
806
|
+
}) => {
|
|
807
|
+
const { carouselCopy: I } = D(), h = {
|
|
808
|
+
elevation: i,
|
|
809
|
+
heightOverrides: r,
|
|
810
|
+
posthog: s,
|
|
811
|
+
showIcon: m,
|
|
812
|
+
variant: C
|
|
813
|
+
};
|
|
814
|
+
return /* @__PURE__ */ M(Re, { children: [
|
|
815
|
+
e.map((d, _) => {
|
|
816
|
+
const p = _ + 1, E = e.length + 1, y = Qe(
|
|
817
|
+
I?.card_position_in_carousel_aria,
|
|
818
|
+
p.toString(),
|
|
819
|
+
E.toString()
|
|
820
|
+
), A = d.micro_title && d.micro_title.length > 0, O = d.micro_description && d.micro_description.length > 0, S = A ? d.micro_title : d.title, N = O ? d.micro_description : d.description;
|
|
821
|
+
return /* @__PURE__ */ o(
|
|
822
|
+
wt,
|
|
823
|
+
{
|
|
824
|
+
ariaLabel: `${y}: ${S}, ${N}`,
|
|
825
|
+
beat: d,
|
|
826
|
+
index: _,
|
|
827
|
+
isActiveCard: _ === t,
|
|
828
|
+
onCardClick: a,
|
|
829
|
+
widthOverrides: n || void 0,
|
|
830
|
+
...h
|
|
831
|
+
},
|
|
832
|
+
`${d.guid} ${_}`
|
|
833
|
+
);
|
|
834
|
+
}),
|
|
835
|
+
/* @__PURE__ */ o(
|
|
836
|
+
Gt,
|
|
837
|
+
{
|
|
838
|
+
isActiveCard: t === e.length,
|
|
839
|
+
onCardClick: a,
|
|
840
|
+
widthOverrides: n || void 0,
|
|
841
|
+
...h
|
|
842
|
+
}
|
|
843
|
+
)
|
|
844
|
+
] });
|
|
845
|
+
}, Lt = ({
|
|
846
|
+
analyticsMetadata: t,
|
|
847
|
+
allowSingleCardPeeking: e = !1,
|
|
848
|
+
beats: n = [],
|
|
849
|
+
elevation: i,
|
|
850
|
+
heightOverrides: r,
|
|
851
|
+
onCardClick: a,
|
|
852
|
+
posthog: s,
|
|
853
|
+
showCarouselControls: m,
|
|
854
|
+
showIcon: C,
|
|
855
|
+
showWithMargin: I = !0,
|
|
856
|
+
variant: h,
|
|
857
|
+
widthOverrides: d,
|
|
858
|
+
visibleCardsCount: _ = 1
|
|
859
|
+
// Default to 1 card visible
|
|
860
|
+
}) => {
|
|
861
|
+
const p = g.useRef(null), E = g.useRef(null), [y, A] = g.useState(0), [O, S] = g.useState(null), [N, Y] = g.useState(null), [f, u] = g.useState(null), { carouselCopy: X } = D(), { onEvent: V } = j();
|
|
862
|
+
g.useEffect(() => {
|
|
863
|
+
if (p.current && !e) {
|
|
864
|
+
const T = p.current.offsetWidth, x = 8;
|
|
865
|
+
let R;
|
|
866
|
+
if (_ > 1) {
|
|
867
|
+
const _e = (T - (_ - 1) * x) / _ / 3;
|
|
868
|
+
R = (T - _e - (_ - 1) * x) / _;
|
|
869
|
+
} else
|
|
870
|
+
R = T;
|
|
871
|
+
u(R);
|
|
872
|
+
}
|
|
873
|
+
}, [_, p.current?.offsetWidth]), g.useEffect(() => {
|
|
874
|
+
const T = E.current?.offsetWidth;
|
|
875
|
+
if (typeof T == "number" && e) {
|
|
876
|
+
const x = (K) => {
|
|
877
|
+
const pe = [
|
|
878
|
+
{ maxWidth: 375, cardWidth: 268 },
|
|
879
|
+
{ maxWidth: 444, cardWidth: 300 },
|
|
880
|
+
{ maxWidth: 599, cardWidth: 350 },
|
|
881
|
+
{ maxWidth: 749, cardWidth: 450 },
|
|
882
|
+
{ maxWidth: 900, cardWidth: 600 }
|
|
883
|
+
].find((ke) => K <= ke.maxWidth);
|
|
884
|
+
return pe ? pe.cardWidth : 750;
|
|
885
|
+
};
|
|
886
|
+
u(x(T));
|
|
887
|
+
const R = () => {
|
|
888
|
+
const K = E.current?.offsetWidth;
|
|
889
|
+
typeof K == "number" && u(x(K));
|
|
890
|
+
};
|
|
891
|
+
return window.addEventListener("resize", R), () => {
|
|
892
|
+
window.removeEventListener("resize", R);
|
|
893
|
+
};
|
|
894
|
+
}
|
|
895
|
+
}, [e, E]);
|
|
896
|
+
const Z = () => {
|
|
897
|
+
V(w.ON_CAROUSEL_FORWARD_CLICK, t), p.current && f && p.current.scrollTo({
|
|
898
|
+
left: y + f + 8,
|
|
899
|
+
top: 0,
|
|
900
|
+
behavior: "smooth"
|
|
901
|
+
});
|
|
902
|
+
}, k = () => {
|
|
903
|
+
V(w.ON_CAROUSEL_BACK_CLICK, t), p.current && f && p.current.scrollTo({
|
|
904
|
+
left: Math.max(0, y - (f + 8)),
|
|
905
|
+
top: 0,
|
|
906
|
+
behavior: "smooth"
|
|
907
|
+
});
|
|
908
|
+
}, G = () => {
|
|
909
|
+
p.current && A(p.current.scrollLeft);
|
|
910
|
+
}, oe = () => {
|
|
911
|
+
if (!N || !O) return;
|
|
912
|
+
N - O > Wt ? V(w.ON_CAROUSEL_FORWARD_SWIPE, t) : V(w.ON_CAROUSEL_BACK_SWIPE, t);
|
|
913
|
+
}, Q = (T) => {
|
|
914
|
+
S(T.targetTouches[0].clientX);
|
|
915
|
+
}, q = (T) => {
|
|
916
|
+
S(null), Y(T.targetTouches[0].clientX);
|
|
917
|
+
}, J = f ? Math.round(y / (f + 8)) : 0, ne = p.current ? p.current.scrollWidth - p.current.offsetWidth : 0;
|
|
918
|
+
return /* @__PURE__ */ M(
|
|
919
|
+
U,
|
|
920
|
+
{
|
|
921
|
+
"aria-label": X?.carousel_title,
|
|
922
|
+
"aria-roledescription": "carousel",
|
|
923
|
+
ref: E,
|
|
924
|
+
role: "region",
|
|
925
|
+
sx: {
|
|
926
|
+
alignItems: "center",
|
|
927
|
+
boxSizing: "border-box",
|
|
928
|
+
height: r,
|
|
929
|
+
width: d || "100%"
|
|
930
|
+
},
|
|
931
|
+
children: [
|
|
932
|
+
/* @__PURE__ */ o(
|
|
933
|
+
U,
|
|
934
|
+
{
|
|
935
|
+
direction: "row",
|
|
936
|
+
onScroll: G,
|
|
937
|
+
onTouchEnd: oe,
|
|
938
|
+
onTouchMove: Q,
|
|
939
|
+
onTouchStart: q,
|
|
940
|
+
ref: p,
|
|
941
|
+
sx: {
|
|
942
|
+
alignItems: "center",
|
|
943
|
+
height: r && "100%",
|
|
944
|
+
gap: 8,
|
|
945
|
+
listStyleType: "none",
|
|
946
|
+
m: 0,
|
|
947
|
+
maxWidth: I ? "calc(100% - 32px)" : "100%",
|
|
948
|
+
overflowX: "auto",
|
|
949
|
+
overflowY: "hidden",
|
|
950
|
+
p: 0,
|
|
951
|
+
scrollbarWidth: "none",
|
|
952
|
+
"-ms-overflow-style": "none",
|
|
953
|
+
"-webkit-overflow-scrolling": "touch",
|
|
954
|
+
"&::-webkit-scrollbar": {
|
|
955
|
+
display: "none"
|
|
956
|
+
}
|
|
957
|
+
},
|
|
958
|
+
children: /* @__PURE__ */ o(
|
|
959
|
+
Mt,
|
|
960
|
+
{
|
|
961
|
+
activeCardIndex: J,
|
|
962
|
+
beats: n,
|
|
963
|
+
cardWidth: f,
|
|
964
|
+
elevation: i,
|
|
965
|
+
heightOverrides: r,
|
|
966
|
+
onCardClick: a,
|
|
967
|
+
posthog: s,
|
|
968
|
+
showIcon: C,
|
|
969
|
+
variant: h
|
|
970
|
+
}
|
|
971
|
+
)
|
|
972
|
+
}
|
|
973
|
+
),
|
|
974
|
+
m && /* @__PURE__ */ o(
|
|
975
|
+
Nt,
|
|
976
|
+
{
|
|
977
|
+
currentBeatIndex: J + _ - 1,
|
|
978
|
+
numBeats: n.length + 1,
|
|
979
|
+
onNextClick: Z,
|
|
980
|
+
onPreviousClick: k,
|
|
981
|
+
scrollRightBoundary: ne,
|
|
982
|
+
scrollX: y,
|
|
983
|
+
shouldApplyDotAnimation: e,
|
|
984
|
+
visibleCardsCount: _
|
|
985
|
+
}
|
|
986
|
+
)
|
|
987
|
+
]
|
|
988
|
+
}
|
|
989
|
+
);
|
|
990
|
+
}, bt = z(Lt), vt = ({
|
|
991
|
+
analyticsMetadata: t,
|
|
992
|
+
onCardClick: e,
|
|
993
|
+
posthog: n,
|
|
994
|
+
widthOverrides: i,
|
|
995
|
+
headerSx: r
|
|
996
|
+
}) => {
|
|
997
|
+
const { carouselCopy: a } = D(), { onEvent: s } = j(), m = () => {
|
|
998
|
+
s && (s(w.ON_VIEW_MORE_CLICKED, t), e(), n?.capture("clicked_view_more"));
|
|
999
|
+
};
|
|
1000
|
+
return a ? /* @__PURE__ */ M(
|
|
1001
|
+
U,
|
|
1002
|
+
{
|
|
1003
|
+
alignItems: "center",
|
|
1004
|
+
direction: "row",
|
|
1005
|
+
justifyContent: "space-between",
|
|
1006
|
+
spacing: 2,
|
|
1007
|
+
sx: {
|
|
1008
|
+
p: 16,
|
|
1009
|
+
pb: 8,
|
|
1010
|
+
width: i || void 0,
|
|
1011
|
+
...r
|
|
1012
|
+
},
|
|
1013
|
+
children: [
|
|
1014
|
+
/* @__PURE__ */ o(He, { children: a.carousel_title }),
|
|
1015
|
+
/* @__PURE__ */ o(
|
|
1016
|
+
Ue,
|
|
1017
|
+
{
|
|
1018
|
+
endIcon: /* @__PURE__ */ o(Oe, { size: 20 }),
|
|
1019
|
+
onClick: m,
|
|
1020
|
+
size: "small",
|
|
1021
|
+
variant: "text",
|
|
1022
|
+
children: a.view_all_insights_in_full_feed_cta_aria
|
|
1023
|
+
}
|
|
1024
|
+
)
|
|
1025
|
+
]
|
|
1026
|
+
}
|
|
1027
|
+
) : /* @__PURE__ */ o(Xe, {});
|
|
1028
|
+
}, Dt = z(vt), xt = ({
|
|
1029
|
+
heightOverrides: t,
|
|
1030
|
+
widthOverrides: e,
|
|
1031
|
+
children: n
|
|
1032
|
+
}) => {
|
|
1033
|
+
const { carouselCopy: i } = D();
|
|
1034
|
+
return /* @__PURE__ */ o(
|
|
1035
|
+
ae,
|
|
1036
|
+
{
|
|
1037
|
+
"aria-label": i?.carousel_title,
|
|
1038
|
+
"aria-roledescription": "carousel",
|
|
1039
|
+
role: "group",
|
|
1040
|
+
sx: {
|
|
1041
|
+
boxSizing: "border-box",
|
|
1042
|
+
height: t ? void 0 : "100%",
|
|
1043
|
+
m: "0 auto",
|
|
1044
|
+
width: e ? void 0 : "100%"
|
|
1045
|
+
},
|
|
1046
|
+
children: n
|
|
1047
|
+
}
|
|
1048
|
+
);
|
|
1049
|
+
}, Ve = ({
|
|
1050
|
+
ariaLabel: t,
|
|
1051
|
+
elevation: e,
|
|
1052
|
+
heightOverrides: n,
|
|
1053
|
+
onCardClick: i,
|
|
1054
|
+
posthog: r,
|
|
1055
|
+
showIcon: a,
|
|
1056
|
+
variant: s
|
|
1057
|
+
}) => {
|
|
1058
|
+
const { cardsCopy: m } = D(), C = H(), { onEvent: I } = j(), { onPageview: h } = Be();
|
|
1059
|
+
g.useEffect(() => {
|
|
1060
|
+
h(P.MICRO_WIDGET_CAROUSEL_NO_RELEVANT_INSIGHTS);
|
|
1061
|
+
}, []);
|
|
1062
|
+
const d = () => {
|
|
1063
|
+
i && i(), I(w.ON_NO_RELEVANT_INSIGHTS_CLICKED), r?.capture("clicked_insight", {
|
|
1064
|
+
template: "no_relevant_insights"
|
|
1065
|
+
});
|
|
1066
|
+
};
|
|
1067
|
+
return /* @__PURE__ */ o(
|
|
1068
|
+
te,
|
|
1069
|
+
{
|
|
1070
|
+
ariaLabel: t,
|
|
1071
|
+
description: m.no_relevant_insights_card_description,
|
|
1072
|
+
elevation: e,
|
|
1073
|
+
heightOverrides: n,
|
|
1074
|
+
icon: a && /* @__PURE__ */ o(l, { bgColor: c(C.palette.primary.main, 0.15), name: "lightbulb" }),
|
|
1075
|
+
onCardClick: d,
|
|
1076
|
+
onPrimaryAction: d,
|
|
1077
|
+
primaryActionText: m.micro_card_cta,
|
|
1078
|
+
title: m.no_relevant_insights_card_title,
|
|
1079
|
+
variant: s
|
|
1080
|
+
}
|
|
1081
|
+
);
|
|
1082
|
+
}, co = z(Ve), Ge = ({
|
|
1083
|
+
ariaLabel: t,
|
|
1084
|
+
elevation: e,
|
|
1085
|
+
heightOverrides: n,
|
|
1086
|
+
onCardClick: i,
|
|
1087
|
+
showIcon: r,
|
|
1088
|
+
variant: a
|
|
1089
|
+
}) => {
|
|
1090
|
+
const { onPageview: s } = Be(), { zeroStateCopy: m } = D(), C = H();
|
|
1091
|
+
return g.useEffect(() => {
|
|
1092
|
+
s(P.MICRO_WIDGET_CAROUSEL_ZERO_STATE);
|
|
1093
|
+
}, []), /* @__PURE__ */ o(
|
|
1094
|
+
te,
|
|
1095
|
+
{
|
|
1096
|
+
ariaLabel: t,
|
|
1097
|
+
description: m.carousel_zero_state_description,
|
|
1098
|
+
elevation: e,
|
|
1099
|
+
heightOverrides: n,
|
|
1100
|
+
icon: r && /* @__PURE__ */ o(l, { bgColor: c(C.palette.primary.main, 0.15), name: "lightbulb" }),
|
|
1101
|
+
onCardClick: i,
|
|
1102
|
+
title: m.carousel_zero_state_title,
|
|
1103
|
+
variant: a
|
|
1104
|
+
}
|
|
1105
|
+
);
|
|
1106
|
+
}, lo = z(Ge), Bt = () => /* @__PURE__ */ o(
|
|
1107
|
+
ae,
|
|
1108
|
+
{
|
|
1109
|
+
sx: {
|
|
1110
|
+
alignItems: "center",
|
|
1111
|
+
display: "flex",
|
|
1112
|
+
height: "100%",
|
|
1113
|
+
justifyContent: "center",
|
|
1114
|
+
width: "100%"
|
|
1115
|
+
},
|
|
1116
|
+
children: /* @__PURE__ */ o(qe, {})
|
|
1117
|
+
}
|
|
1118
|
+
), Te = {
|
|
1119
|
+
featureVersion: "spendVsIncomeTrends"
|
|
1120
|
+
}, B = new mt(), Pt = ({
|
|
1121
|
+
allowSingleCardPeeking: t = !0,
|
|
1122
|
+
areBeatsLoading: e = !1,
|
|
1123
|
+
beats: n = [],
|
|
1124
|
+
// This also determines the length of the carousel controls (beat.length + 1)
|
|
1125
|
+
cardStyle: i = "elevation 1",
|
|
1126
|
+
endpoint: r = "/",
|
|
1127
|
+
heightOverrides: a,
|
|
1128
|
+
headerSx: s,
|
|
1129
|
+
logOutUser: m = () => {
|
|
1130
|
+
},
|
|
1131
|
+
onCardClick: C = () => {
|
|
1132
|
+
},
|
|
1133
|
+
onEvent: I = () => {
|
|
1134
|
+
},
|
|
1135
|
+
onPageview: h = () => {
|
|
1136
|
+
},
|
|
1137
|
+
posthog: d,
|
|
1138
|
+
showBorder: _ = !0,
|
|
1139
|
+
showCarouselControls: p,
|
|
1140
|
+
showHeader: E,
|
|
1141
|
+
showIcon: y,
|
|
1142
|
+
showWithMargin: A = !0,
|
|
1143
|
+
token: O = "",
|
|
1144
|
+
userHasFullInsightFeedBeats: S,
|
|
1145
|
+
variant: N,
|
|
1146
|
+
visibleCardsCount: Y = 1,
|
|
1147
|
+
widthOverrides: f
|
|
1148
|
+
}) => {
|
|
1149
|
+
const X = (() => {
|
|
1150
|
+
if (i === "border" || _) return "outlined";
|
|
1151
|
+
if (N) return N;
|
|
1152
|
+
if (i === "elevation 1") return "elevation";
|
|
1153
|
+
if (i !== "flat")
|
|
1154
|
+
return "elevation";
|
|
1155
|
+
})(), V = i === "flat" ? 0 : 1, [Z, k] = ie("STANDARD"), [G, oe] = ie(!1), [Q, q] = ie(!1), J = et([I], B), ne = tt([h], B);
|
|
1156
|
+
ot({
|
|
1157
|
+
widgetName: "InsightsMicroWidget",
|
|
1158
|
+
isLoaded: G
|
|
1159
|
+
}), g.useEffect(() => {
|
|
1160
|
+
!B.isInitialized && !Q && (B.initialize(r, O, m).catch(() => q(!1)), q(!0));
|
|
1161
|
+
}, [r, O, m, B.isInitialized, Q]), g.useEffect(() => {
|
|
1162
|
+
const R = window.innerHeight;
|
|
1163
|
+
R < 180 ? k("STANDARD") : R >= 180 && R < 200 ? k("LARGE") : R >= 200 && R < 248 ? k("XLARGE") : R >= 248 && k("XXLARGE");
|
|
1164
|
+
}, [window.innerHeight]), g.useEffect(() => {
|
|
1165
|
+
oe(!e && B.isInitialized);
|
|
1166
|
+
}, [e, B.isInitialized]);
|
|
1167
|
+
const T = {
|
|
1168
|
+
heightOverrides: a,
|
|
1169
|
+
onCardClick: C,
|
|
1170
|
+
posthog: d,
|
|
1171
|
+
showIcon: y,
|
|
1172
|
+
showWithMargin: A,
|
|
1173
|
+
widthOverrides: f
|
|
1174
|
+
}, x = {
|
|
1175
|
+
carouselSize: Z,
|
|
1176
|
+
elevation: V,
|
|
1177
|
+
variant: X,
|
|
1178
|
+
heightOverrides: a,
|
|
1179
|
+
onCardClick: C,
|
|
1180
|
+
posthog: d,
|
|
1181
|
+
showIcon: y
|
|
1182
|
+
};
|
|
1183
|
+
return /* @__PURE__ */ o(ut, { onEvent: J, onPageview: ne, store: B, children: /* @__PURE__ */ M(xt, { heightOverrides: a, widthOverrides: f, children: [
|
|
1184
|
+
!G && /* @__PURE__ */ o(Bt, {}),
|
|
1185
|
+
G && E && /* @__PURE__ */ o(
|
|
1186
|
+
Dt,
|
|
1187
|
+
{
|
|
1188
|
+
analyticsMetadata: Te,
|
|
1189
|
+
headerSx: s,
|
|
1190
|
+
onCardClick: C,
|
|
1191
|
+
posthog: d,
|
|
1192
|
+
widthOverrides: f
|
|
1193
|
+
}
|
|
1194
|
+
),
|
|
1195
|
+
G && !!n.length && /* @__PURE__ */ o(
|
|
1196
|
+
bt,
|
|
1197
|
+
{
|
|
1198
|
+
allowSingleCardPeeking: t,
|
|
1199
|
+
analyticsMetadata: Te,
|
|
1200
|
+
beats: n,
|
|
1201
|
+
elevation: V,
|
|
1202
|
+
showCarouselControls: p,
|
|
1203
|
+
variant: X,
|
|
1204
|
+
visibleCardsCount: Y,
|
|
1205
|
+
...T
|
|
1206
|
+
}
|
|
1207
|
+
),
|
|
1208
|
+
G && !n.length && /* @__PURE__ */ o(
|
|
1209
|
+
U,
|
|
1210
|
+
{
|
|
1211
|
+
sx: {
|
|
1212
|
+
alignItems: "center",
|
|
1213
|
+
height: a,
|
|
1214
|
+
width: f || "100%"
|
|
1215
|
+
},
|
|
1216
|
+
children: /* @__PURE__ */ o(
|
|
1217
|
+
U,
|
|
1218
|
+
{
|
|
1219
|
+
sx: {
|
|
1220
|
+
height: `calc(${Ot[Z]}px - 44px)`,
|
|
1221
|
+
width: A ? `calc(${f}px - 32px)` : "100%"
|
|
1222
|
+
},
|
|
1223
|
+
children: S ? /* @__PURE__ */ o(Ve, { ...x }) : /* @__PURE__ */ o(Ge, { ...x })
|
|
1224
|
+
}
|
|
1225
|
+
)
|
|
1226
|
+
}
|
|
1227
|
+
)
|
|
1228
|
+
] }) });
|
|
1229
|
+
}, _o = z(Pt), Vt = ({
|
|
1230
|
+
ariaLabel: t,
|
|
1231
|
+
elevation: e,
|
|
1232
|
+
heightOverrides: n,
|
|
1233
|
+
isActiveCard: i,
|
|
1234
|
+
onCardClick: r,
|
|
1235
|
+
posthog: a,
|
|
1236
|
+
widthOverrides: s,
|
|
1237
|
+
showIcon: m,
|
|
1238
|
+
variant: C
|
|
1239
|
+
}) => {
|
|
1240
|
+
const I = H(), { ref: h, inView: d } = We({
|
|
1241
|
+
threshold: Pe
|
|
1242
|
+
}), { cardsCopy: _ } = D(), { onEvent: p } = j();
|
|
1243
|
+
re(() => {
|
|
1244
|
+
d && (p(be.ON_VIEW_MORE_VIEWED), a?.capture("viewed_insight", {
|
|
1245
|
+
template: "view_more_card"
|
|
1246
|
+
}));
|
|
1247
|
+
}, [d]);
|
|
1248
|
+
const E = () => {
|
|
1249
|
+
r && r(), p(w.ON_VIEW_MORE_CLICKED), a?.capture("clicked_insight", {
|
|
1250
|
+
template: "view_more_card"
|
|
1251
|
+
});
|
|
1252
|
+
};
|
|
1253
|
+
return /* @__PURE__ */ o(
|
|
1254
|
+
te,
|
|
1255
|
+
{
|
|
1256
|
+
"aria-roledescription": "slide",
|
|
1257
|
+
ariaLabel: t,
|
|
1258
|
+
description: _?.view_more_card_description,
|
|
1259
|
+
elevation: e,
|
|
1260
|
+
heightOverrides: n,
|
|
1261
|
+
icon: m && /* @__PURE__ */ o(l, { bgColor: c(I.palette.primary.main, 0.15), name: "show_chart" }),
|
|
1262
|
+
isActiveCard: i,
|
|
1263
|
+
onCardClick: E,
|
|
1264
|
+
onPrimaryAction: E,
|
|
1265
|
+
primaryActionText: _?.micro_card_cta,
|
|
1266
|
+
ref: h,
|
|
1267
|
+
title: _?.view_more_card_title,
|
|
1268
|
+
variant: C,
|
|
1269
|
+
widthOverrides: s
|
|
1270
|
+
}
|
|
1271
|
+
);
|
|
1272
|
+
}, Gt = z(Vt);
|
|
1273
|
+
export {
|
|
1274
|
+
mt as A,
|
|
1275
|
+
l as B,
|
|
1276
|
+
Dt as C,
|
|
1277
|
+
wt as I,
|
|
1278
|
+
bt as M,
|
|
1279
|
+
co as N,
|
|
1280
|
+
Te as T,
|
|
1281
|
+
Gt as V,
|
|
1282
|
+
lo as Z,
|
|
1283
|
+
_o as a,
|
|
1284
|
+
ut as b,
|
|
1285
|
+
te as c,
|
|
1286
|
+
Et as d
|
|
1287
|
+
};
|