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