@mx-cartographer/experiences 7.12.0 → 7.12.1

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