@mx-cartographer/experiences 9.0.2 → 9.1.0-alpha.bb1

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