@mx-cartographer/experiences 7.0.23-alpha.al14 → 7.0.23-alpha.al2

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.
@@ -1,7 +1,7 @@
1
1
  import { jsx as e, jsxs as f, Fragment as Pe } from "react/jsx-runtime";
2
2
  import r from "react";
3
3
  import { observer as M } from "mobx-react-lite";
4
- import { Icon as re, Text as X, CategoryIcon as Te, P as Y, H3 as De, ChevronRightIcon as Ke } from "@mxenabled/mxui";
4
+ import { Icon as ae, Text as X, CategoryIcon as Te, P as Y, H3 as De, ChevronRightIcon as Ke } from "@mxenabled/mxui";
5
5
  import O from "@mui/material/Box";
6
6
  import _ from "@mui/material/Stack";
7
7
  import pe from "@mui/material/Button";
@@ -12,7 +12,7 @@ import { T as to } from "../TrendsStore-WrHxzdbQ.mjs";
12
12
  import { i as Xe, c as Ze, d as Qe, e as qe, f as Je, h as et, b as Le, g as xe, j as _e } from "../SpendingData-D5vsfYKo.mjs";
13
13
  import tt from "@mui/material/ToggleButton";
14
14
  import nt from "@mui/material/ToggleButtonGroup";
15
- import { u as R, k as F, e as H, a as P, f as ie, c as ce, v as q, l as ve, p as ot, m as st } from "../hooks-DkUqN6JE.mjs";
15
+ import { u as R, k as F, e as H, a as P, f as re, c as ie, v as q, l as ve, p as ot, m as st } from "../hooks-DkUqN6JE.mjs";
16
16
  import { u as K } from "../useScreenSize-B6JyS_Lj.mjs";
17
17
  import { f as Z, D as B } from "../Dialog-CWW597AF.mjs";
18
18
  import { DataGridPro as at } from "@mui/x-data-grid-pro";
@@ -29,7 +29,7 @@ import { useTheme as He } from "@mui/material/styles";
29
29
  import { L as ye } from "../LineChart-BWWmmJxV.mjs";
30
30
  import { M as lt } from "../MiniWidgetContainer-CTyjmE1h.mjs";
31
31
  import { subMonths as dt } from "date-fns";
32
- import { TrendingUp as ht, TrendingDown as ut, MultilineChart as mt, ExpandLess as gt, ExpandMore as pt } from "@mxenabled/mx-icons";
32
+ import { TrendingUp as ht, TrendingDown as ut, MultilineChart as gt, ExpandLess as mt, ExpandMore as pt } from "@mxenabled/mx-icons";
33
33
  import { a as Ct, f as U } from "../NumberFormatting-CtWHhyBX.mjs";
34
34
  import { M as ft } from "../MicroWidgetContainer-Dxz8uBN9.mjs";
35
35
  import Tt from "@mui/material/Collapse";
@@ -52,7 +52,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
52
52
  onChange: o,
53
53
  orientation: "horizontal",
54
54
  value: n,
55
- children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(tt, { color: "primary", sx: { width: 56 }, value: t, children: t === "Chart" ? /* @__PURE__ */ e(re, { name: "table_chart_view" }) : /* @__PURE__ */ e(re, { name: "format_list_bulleted" }) }, t))
55
+ children: ["Chart", "Table"].map((t) => /* @__PURE__ */ e(tt, { color: "primary", sx: { width: 56 }, value: t, children: t === "Chart" ? /* @__PURE__ */ e(ae, { name: "table_chart_view" }) : /* @__PURE__ */ e(ae, { name: "format_list_bulleted" }) }, t))
56
56
  }
57
57
  ), Oe = ({ selectedDateRange: n, selectedCategoryGuid: o }) => {
58
58
  const { trends: t } = R(), { isMobile: s, isDesktop: i } = K(), { getCategoryName: h } = F(), d = r.useMemo(() => {
@@ -119,7 +119,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
119
119
  height: i = "100dvh",
120
120
  sx: h = {}
121
121
  }) => {
122
- const { onEvent: d } = H(), l = Z(/* @__PURE__ */ new Date(), B.MONTH_SHORT), [c, m] = r.useState([
122
+ const { onEvent: d } = H(), l = Z(/* @__PURE__ */ new Date(), B.MONTH_SHORT), [c, g] = r.useState([
123
123
  { field: l, sort: "desc" }
124
124
  ]), C = r.useMemo(() => Ht(o.start, o.end), [o]), u = [
125
125
  {
@@ -154,16 +154,16 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
154
154
  ), T = (t ? a.filter(
155
155
  (p) => p.category_guid === t || p.top_level_category_guid === t
156
156
  ) : a).reduce(
157
- (p, L) => {
158
- const { category_guid: w, top_level_category_guid: E, month: k, total: D, year: N } = L, x = t ? w : E;
159
- p[x] || (p[x] = {
160
- id: x,
161
- category: x,
157
+ (p, E) => {
158
+ const { category_guid: w, top_level_category_guid: I, month: k, total: D, year: N } = E, L = t ? w : I;
159
+ p[L] || (p[L] = {
160
+ id: L,
161
+ category: L,
162
162
  category_guid: w,
163
- top_level_category_guid: E
163
+ top_level_category_guid: I
164
164
  });
165
- const I = Z(new Date(N, k - 1), B.MONTH_SHORT);
166
- return p[x][I] || (p[x][I] = 0), p[x][I] = p[x][I] + Math.abs(D), p;
165
+ const x = Z(new Date(N, k - 1), B.MONTH_SHORT);
166
+ return p[L][x] || (p[L][x] = 0), p[L][x] = p[L][x] + Math.abs(D), p;
167
167
  },
168
168
  {}
169
169
  );
@@ -184,7 +184,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
184
184
  });
185
185
  },
186
186
  onSortModelChange: (a) => {
187
- m(a), d(y.TRENDS_CLICK_TABLE_SORT, A);
187
+ g(a), d(y.TRENDS_CLICK_TABLE_SORT, A);
188
188
  },
189
189
  rows: b,
190
190
  slotProps: { baseIconButton: { color: "secondary", sx: { ml: 8 } } },
@@ -200,9 +200,9 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
200
200
  isOpen: t,
201
201
  onClose: s
202
202
  }) => {
203
- const { onEvent: i } = H(), { selectedAccountGuids: h } = P(), { common: d } = R(), { setFilter: l, sortedTransactions: c } = ie(), [m, C] = r.useState(""), u = r.useMemo(
204
- () => c.find((a) => a.guid === m),
205
- [m, c]
203
+ const { onEvent: i } = H(), { selectedAccountGuids: h } = P(), { common: d } = R(), { setFilter: l, sortedTransactions: c } = re(), [g, C] = r.useState(""), u = r.useMemo(
204
+ () => c.find((a) => a.guid === g),
205
+ [g, c]
206
206
  );
207
207
  r.useEffect(() => {
208
208
  l({
@@ -229,65 +229,65 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
229
229
  }
230
230
  );
231
231
  }, Ot = M(Wt), Vt = ({ onBackClick: n, sx: o }) => {
232
- const { onEvent: t } = H(), { isDesktop: s, isTablet: i, isMobile: h } = K(), { visibleAccounts: d } = ce(), { loadMonthlyCategoryTotals: l, monthlyCategoryTotals: c, getCategoryName: m } = F(), { sortedTransactions: C } = ie(), { selectedDateRange: u, setSelectedDateRange: b } = q(), { isCopyLoaded: a, isInitialized: g, selectedAccounts: T, setSelectedAccounts: p } = P(), { trends: L } = R(), [w, E] = r.useState(!1), [k, D] = r.useState(!1), [N, x] = r.useState("Chart"), [I, $] = r.useState(""), [z, le] = r.useState(window.innerHeight), ee = z - (h ? 315 : 345);
232
+ const { onEvent: t } = H(), { isDesktop: s, isTablet: i, isMobile: h } = K(), { visibleAccounts: d } = ie(), { loadMonthlyCategoryTotals: l, monthlyCategoryTotals: c, getCategoryName: g } = F(), { sortedTransactions: C } = re(), { selectedDateRange: u, setSelectedDateRange: b } = q(), { isCopyLoaded: a, isInitialized: m, selectedAccounts: T, setSelectedAccounts: p } = P(), { trends: E } = R(), [w, I] = r.useState(!1), [k, D] = r.useState(!1), [N, L] = r.useState("Chart"), [x, $] = r.useState(""), [z, ce] = r.useState(window.innerHeight), ee = z - (h ? 315 : 345);
233
233
  r.useEffect(() => {
234
- const S = () => le(window.innerHeight);
234
+ const S = () => ce(window.innerHeight);
235
235
  return window.addEventListener("resize", S), () => window.removeEventListener("resize", S);
236
236
  }, []), r.useEffect(() => {
237
237
  p(d);
238
238
  }, [d]), r.useEffect(() => {
239
- g && l(
239
+ m && l(
240
240
  T,
241
241
  u.start,
242
242
  u.end
243
243
  ).finally(() => {
244
- E(!0);
244
+ I(!0);
245
245
  });
246
- }, [g, T, u]);
246
+ }, [m, T, u]);
247
247
  const te = r.useMemo(() => {
248
248
  if (!w) return { stackedDatasets: [], unstackedDatasets: [] };
249
249
  const S = je(
250
250
  c,
251
251
  u.start,
252
252
  u.end
253
- ), W = I.length ? S.filter(
254
- (G) => G.top_level_category_guid === I || G.category_guid === I
253
+ ), W = x.length ? S.filter(
254
+ (G) => G.top_level_category_guid === x || G.category_guid === x
255
255
  ) : Qe(S);
256
256
  return {
257
257
  stackedDatasets: W.filter(qe),
258
258
  unstackedDatasets: W.filter(Je)
259
259
  };
260
- }, [c, I, u]), ne = (S, W) => {
261
- x(W ?? N), t(y.TRENDS_CLICK_TOGGLE_VIEW);
260
+ }, [c, x, u]), ne = (S, W) => {
261
+ L(W ?? N), t(y.TRENDS_CLICK_TOGGLE_VIEW);
262
262
  }, oe = (S) => {
263
- const W = Ie(S?.[0], 1), G = S?.[1], ge = Ce(G, W);
263
+ const W = Ie(S?.[0], 1), G = S?.[1], me = Ce(G, W);
264
264
  b({ start: W, end: G }), t(y.TRENDS_CLICK_TIME_WINDOW, {
265
- time_period: ge + "M"
265
+ time_period: me + "M"
266
266
  });
267
- }, de = () => {
267
+ }, le = () => {
268
268
  t(y.TRENDS_CLICK_FILTER);
269
269
  }, se = (S) => {
270
270
  $(S);
271
+ }, de = (S) => {
272
+ $(S), t(y.TRENDS_CLICK_LEGEND, { category: g(S) });
271
273
  }, he = (S) => {
272
- $(S), t(y.TRENDS_CLICK_LEGEND, { category: m(S) });
273
- }, ae = (S) => {
274
- t(y.TRENDS_HOVER_LEGEND, { category: m(S) });
274
+ t(y.TRENDS_HOVER_LEGEND, { category: g(S) });
275
275
  }, ue = (S) => {
276
276
  t(y.TRENDS_HOVER_AREA, { category: S });
277
- }, me = (S) => {
277
+ }, ge = (S) => {
278
278
  t(y.TRENDS_HOVER_POINT, { category: S });
279
279
  };
280
- return !a || !g || !w ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ f(
280
+ return !a || !m || !w ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ f(
281
281
  Ae,
282
282
  {
283
283
  accountOptions: d,
284
284
  calendarActions: { onRangeChanged: oe },
285
285
  dateRange: u,
286
286
  dateRangeVariant: "timeframebuttons",
287
- onAccountsFilterClick: de,
287
+ onAccountsFilterClick: le,
288
288
  onBackClick: n,
289
289
  sx: o,
290
- title: L.title,
290
+ title: E.title,
291
291
  children: [
292
292
  /* @__PURE__ */ f(
293
293
  _,
@@ -307,7 +307,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
307
307
  /* @__PURE__ */ e(
308
308
  Oe,
309
309
  {
310
- selectedCategoryGuid: I,
310
+ selectedCategoryGuid: x,
311
311
  selectedDateRange: u
312
312
  }
313
313
  ),
@@ -316,21 +316,21 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
316
316
  }
317
317
  ),
318
318
  /* @__PURE__ */ f(_, { alignItems: "center", flexDirection: "row", width: "100%", children: [
319
- /* @__PURE__ */ e(O, { flexGrow: 1, children: I && /* @__PURE__ */ f(pe, { onClick: () => $(""), sx: { p: 0, pr: 5 }, children: [
320
- /* @__PURE__ */ e(re, { name: "arrow_back" }),
321
- L.all_categories
319
+ /* @__PURE__ */ e(O, { flexGrow: 1, children: x && /* @__PURE__ */ f(pe, { onClick: () => $(""), sx: { p: 0, pr: 5 }, children: [
320
+ /* @__PURE__ */ e(ae, { name: "arrow_back" }),
321
+ E.all_categories
322
322
  ] }) }),
323
- /* @__PURE__ */ e(pe, { onClick: () => D(!0), sx: { px: 5 }, children: `${L.view_transactions} (${C.length})` })
323
+ /* @__PURE__ */ e(pe, { onClick: () => D(!0), sx: { px: 5 }, children: `${E.view_transactions} (${C.length})` })
324
324
  ] }),
325
325
  /* @__PURE__ */ f(O, { children: [
326
326
  N === "Chart" && /* @__PURE__ */ e(
327
327
  Ye,
328
328
  {
329
329
  availableHeight: ee,
330
- onClickLegend: he,
330
+ onClickLegend: de,
331
331
  onHoverArea: ue,
332
- onHoverLegend: ae,
333
- onHoverPoint: me,
332
+ onHoverLegend: he,
333
+ onHoverPoint: ge,
334
334
  stackedDatasets: te.stackedDatasets,
335
335
  unstackedDatasets: te.unstackedDatasets
336
336
  }
@@ -340,7 +340,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
340
340
  {
341
341
  monthlyCategoryTotals: c,
342
342
  onClickRow: se,
343
- selectedCategory: I,
343
+ selectedCategory: x,
344
344
  selectedDateRange: u
345
345
  }
346
346
  )
@@ -351,7 +351,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
351
351
  /* @__PURE__ */ e(
352
352
  Ot,
353
353
  {
354
- categoryGuid: I,
354
+ categoryGuid: x,
355
355
  dateRange: u,
356
356
  isOpen: k,
357
357
  onClose: () => D(!1)
@@ -379,9 +379,9 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
379
379
  }
380
380
  );
381
381
  }, Bt = M(Gt), zt = ({ onPrimaryCtaClick: n, sx: o }) => {
382
- const { visibleAccounts: t } = ce(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: i } = F(), { isInitialized: h } = ve(), { trends: d } = R(), { isCopyLoaded: l, selectedAccounts: c, setSelectedAccounts: m } = P();
382
+ const { visibleAccounts: t } = ie(), { loadMonthlyCategoryTotals: s, monthlyTotalsLoaded: i } = F(), { isInitialized: h } = ve(), { trends: d } = R(), { isCopyLoaded: l, selectedAccounts: c, setSelectedAccounts: g } = P();
383
383
  return r.useEffect(() => {
384
- m(t);
384
+ g(t);
385
385
  }, [t]), r.useEffect(() => {
386
386
  h && s(c).finally();
387
387
  }, [h, c]), !l || !h ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ e(
@@ -403,10 +403,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
403
403
  secondaryLabel: i,
404
404
  shouldDisplayPercentage: h
405
405
  }) => {
406
- const { availableWidth: d } = ot(), l = r.useRef(null), c = r.useRef(null), m = Ct(Number(Math.abs(s)), {
406
+ const { availableWidth: d } = ot(), l = r.useRef(null), c = r.useRef(null), g = Ct(Number(Math.abs(s)), {
407
407
  style: "percent",
408
408
  minimumIntegerDigits: 1
409
- }), C = d === 288 && U(o, "0,0.00").length > 10 ? U(o, "0,0") : U(o, "0,0.00"), u = t === "spending" ? s > 0 : s >= 0, b = t === "spending" ? "error.main" : "success.main", a = t === "spending" ? "success.main" : "text.secondary", g = l?.current, T = c?.current, p = g && T ? g.scrollWidth > T.clientWidth - Ft : !1;
409
+ }), C = d === 288 && U(o, "0,0.00").length > 10 ? U(o, "0,0") : U(o, "0,0.00"), u = t === "spending" ? s > 0 : s >= 0, b = t === "spending" ? "error.main" : "success.main", a = t === "spending" ? "success.main" : "text.secondary", m = l?.current, T = c?.current, p = m && T ? m.scrollWidth > T.clientWidth - Ft : !1;
410
410
  return /* @__PURE__ */ f(
411
411
  _,
412
412
  {
@@ -440,7 +440,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
440
440
  fontWeight: 600
441
441
  },
442
442
  variant: "body2",
443
- children: m
443
+ children: g
444
444
  }
445
445
  )
446
446
  ] })
@@ -482,19 +482,19 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
482
482
  }, Pt = M(() => {
483
483
  const { trends: n } = R();
484
484
  return /* @__PURE__ */ f(_, { sx: { alignItems: "start", flexDirection: "row", gap: 12 }, children: [
485
- /* @__PURE__ */ e(mt, { size: 32 }),
485
+ /* @__PURE__ */ e(gt, { size: 32 }),
486
486
  /* @__PURE__ */ f(_, { children: [
487
487
  /* @__PURE__ */ e(Y, { fontWeight: 600, variant: "body1", children: n.zero_state_content_header }),
488
488
  /* @__PURE__ */ e(Y, { color: "text.secondary", variant: "subtitle2", children: n.zero_state_content_description })
489
489
  ] })
490
490
  ] });
491
491
  }), Qn = M(({ onCtaClick: n }) => {
492
- const { visibleAccounts: o } = ce(), { onEvent: t } = H(), { monthlyCategoryTotals: s, loadMonthlyCategoryTotals: i, monthlyTotalsLoaded: h } = F(), d = {
492
+ const { visibleAccounts: o } = ie(), { onEvent: t } = H(), { monthlyCategoryTotals: s, loadMonthlyCategoryTotals: i, monthlyTotalsLoaded: h } = F(), d = {
493
493
  start: dt(/* @__PURE__ */ new Date(), 1),
494
494
  end: /* @__PURE__ */ new Date()
495
- }, { trends: l } = R(), { selectedAccounts: c, setSelectedAccounts: m, isInitialized: C } = P();
495
+ }, { trends: l } = R(), { selectedAccounts: c, setSelectedAccounts: g, isInitialized: C } = P();
496
496
  r.useEffect(() => {
497
- m(o);
497
+ g(o);
498
498
  }, [o]), r.useEffect(() => {
499
499
  C && i(c, d.start).then(() => {
500
500
  t(y.TRENDS_LOAD_WIDGET, {
@@ -508,9 +508,9 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
508
508
  incomeData: xe(s, d)
509
509
  }),
510
510
  [s, d]
511
- ), [a, g] = u, [T, p] = b, L = _e(g.y, a.y), w = _e(p.y, T.y), E = C && !o?.length, k = () => {
511
+ ), [a, m] = u, [T, p] = b, E = _e(m.y, a.y), w = _e(p.y, T.y), I = C && !o?.length, k = () => {
512
512
  t(
513
- E ? y.TRENDS_CLICK_GET_STARTED : y.TRENDS_CLICK_VIEW_MORE
513
+ I ? y.TRENDS_CLICK_GET_STARTED : y.TRENDS_CLICK_VIEW_MORE
514
514
  ), n();
515
515
  };
516
516
  return !h || !C ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ e(
@@ -519,9 +519,9 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
519
519
  className: "mx-trends-microwidget",
520
520
  ctaLabel: l.micro_primary_cta_label,
521
521
  onCTAClick: k,
522
- subHeader: E ? void 0 : l.micro_subheader,
522
+ subHeader: I ? void 0 : l.micro_subheader,
523
523
  title: l.title,
524
- children: E ? /* @__PURE__ */ e(Pt, {}) : /* @__PURE__ */ f(
524
+ children: I ? /* @__PURE__ */ e(Pt, {}) : /* @__PURE__ */ f(
525
525
  _,
526
526
  {
527
527
  sx: {
@@ -533,11 +533,11 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
533
533
  /* @__PURE__ */ e(
534
534
  Se,
535
535
  {
536
- percentage: L,
536
+ percentage: E,
537
537
  secondaryLabel: l.micro_secondary_label,
538
- shouldDisplayPercentage: g.y !== 0 && a.y !== 0,
538
+ shouldDisplayPercentage: m.y !== 0 && a.y !== 0,
539
539
  title: l.spending_label,
540
- totalAmount: g.y,
540
+ totalAmount: m.y,
541
541
  transactionType: "spending"
542
542
  }
543
543
  ),
@@ -566,7 +566,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
566
566
  sx: { color: t.palette.primary.main, flexDirection: "row", alignItems: "center" },
567
567
  children: [
568
568
  /* @__PURE__ */ e(wt, { children: /* @__PURE__ */ e(X, { bold: !0, variant: "body2", children: n ? "View less" : "View more" }) }),
569
- /* @__PURE__ */ e(St, { sx: { color: t.palette.primary.main }, children: n ? /* @__PURE__ */ e(gt, {}) : /* @__PURE__ */ e(
569
+ /* @__PURE__ */ e(St, { sx: { color: t.palette.primary.main }, children: n ? /* @__PURE__ */ e(mt, {}) : /* @__PURE__ */ e(
570
570
  pt,
571
571
  {
572
572
  sx: {
@@ -589,7 +589,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
589
589
  isLastItem: h = !1,
590
590
  showDivider: d = !0
591
591
  }) => {
592
- const { trends: l } = R(), { onEvent: c } = H(), m = `${s.length} ${s.length === 1 ? l.transaction : l.transactions}`, C = () => {
592
+ const { trends: l } = R(), { onEvent: c } = H(), g = `${s.length} ${s.length === 1 ? l.transaction : l.transactions}`, C = () => {
593
593
  i?.(), c(y.TRENDS_CLICK_LIST_ITEM, {
594
594
  ...A,
595
595
  listItem: t
@@ -603,7 +603,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
603
603
  onClick: C,
604
604
  rightContent: U(Math.abs(n), "0,0.00"),
605
605
  rightIcon: i ? /* @__PURE__ */ e(Ke, {}) : void 0,
606
- subtitle: m,
606
+ subtitle: g,
607
607
  title: t
608
608
  }
609
609
  ),
@@ -612,49 +612,49 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
612
612
  }
613
613
  ), $t = M(
614
614
  ({ availableHeight: n = 0, onCategoryClick: o }) => {
615
- const { collapsedCategories: t, visibleCategories: s, setVisibleListLength: i } = q(), { isLargeDesktop: h, isDesktop: d } = K(), { trends: l } = R(), { onEvent: c } = H(), [m, C] = r.useState(!1), u = d || h;
615
+ const { collapsedCategories: t, visibleCategories: s, setVisibleListLength: i } = q(), { isLargeDesktop: h, isDesktop: d } = K(), { trends: l } = R(), { onEvent: c } = H(), [g, C] = r.useState(!1), u = d || h;
616
616
  r.useEffect(() => {
617
- const g = Math.floor(n / 64) - 1, T = s.length + t.length;
618
- g !== s.length && (i(u ? Math.max(g, 5) : 5), C(g >= T));
617
+ const m = Math.floor(n / 64) - 1, T = s.length + t.length;
618
+ m !== s.length && (i(u ? Math.max(m, 5) : 5), C(m >= T));
619
619
  }, [n]);
620
620
  const b = () => {
621
- C(!m), c(y.TRENDS_CLICK_VIEW_MORE, {
621
+ C(!g), c(y.TRENDS_CLICK_VIEW_MORE, {
622
622
  ...A
623
623
  });
624
- }, a = s.length + (m ? t.length : 0);
624
+ }, a = s.length + (g ? t.length : 0);
625
625
  return /* @__PURE__ */ e(_, { sx: { bgColor: "background.paper", width: "100%" }, children: /* @__PURE__ */ f(yt, { children: [
626
626
  /* @__PURE__ */ e(_, { sx: { pb: 4, pt: 16, px: 16 }, children: /* @__PURE__ */ e(De, { children: l.categories }) }),
627
- s.map((g, T) => /* @__PURE__ */ e(
627
+ s.map((m, T) => /* @__PURE__ */ e(
628
628
  we,
629
629
  {
630
- ...g,
630
+ ...m,
631
631
  isLastItem: T === a - 1,
632
- onClick: g.transactions.length > 0 ? () => o(g) : void 0,
632
+ onClick: m.transactions.length > 0 ? () => o(m) : void 0,
633
633
  showDivider: !0
634
634
  },
635
- g.guid
635
+ m.guid
636
636
  )),
637
637
  /* @__PURE__ */ e(
638
638
  Tt,
639
639
  {
640
- in: m,
640
+ in: g,
641
641
  sx: { "&.MuiCollapse-root .MuiListItemButton-root": { paddingLeft: 24 } },
642
- children: t.map((g, T) => {
642
+ children: t.map((m, T) => {
643
643
  const p = s.length + T;
644
644
  return /* @__PURE__ */ e(
645
645
  we,
646
646
  {
647
- ...g,
647
+ ...m,
648
648
  isLastItem: p === a - 1,
649
- onClick: g.transactions.length > 0 ? () => o(g) : void 0,
649
+ onClick: m.transactions.length > 0 ? () => o(m) : void 0,
650
650
  showDivider: !0
651
651
  },
652
- g.guid
652
+ m.guid
653
653
  );
654
654
  })
655
655
  }
656
656
  ),
657
- t.length > 0 && /* @__PURE__ */ e(Kt, { isExpanded: m, onClick: b })
657
+ t.length > 0 && /* @__PURE__ */ e(Kt, { isExpanded: g, onClick: b })
658
658
  ] }) });
659
659
  }
660
660
  ), jt = [
@@ -692,13 +692,13 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
692
692
  "WeeklyNoSpendDays",
693
693
  "WeeklySmallPurchasesSummary"
694
694
  ], Yt = ({ onInsightCardClick: n }) => {
695
- const o = It(), { onEvent: t } = H(), { isMobile: s, isDesktop: i, isLargeDesktop: h } = K(), { beatStore: d, endpoint: l, sessionToken: c } = ve(), { isInitialized: m } = P(), [C, u] = r.useState(!1), b = o.palette.mode === "dark", a = i || h, g = a || s ? 1 : 2;
695
+ const o = It(), { onEvent: t } = H(), { isMobile: s, isDesktop: i, isLargeDesktop: h } = K(), { beatStore: d, endpoint: l, sessionToken: c } = ve(), { isInitialized: g } = P(), [C, u] = r.useState(!1), b = o.palette.mode === "dark", a = i || h, m = a || s ? 1 : 2;
696
696
  r.useEffect(() => {
697
- m && d.loadBeats().finally(() => u(!0));
698
- }, [m]);
699
- const T = r.useMemo(() => C ? d.getFilteredBeats({ templates: jt }) : [], [C]), p = () => null, L = (D) => {
697
+ g && d.loadBeats().finally(() => u(!0));
698
+ }, [g]);
699
+ const T = r.useMemo(() => C ? d.getFilteredBeats({ templates: jt }) : [], [C]), p = () => null, E = (D) => {
700
700
  n?.(D), t(y.TRENDS_CLICK_INSIGHT, A);
701
- }, w = a ? 200 : 170, E = a ? 170 : 124, k = T.length > 0 ? w : E;
701
+ }, w = a ? 200 : 170, I = a ? 170 : 124, k = T.length > 0 ? w : I;
702
702
  return /* @__PURE__ */ e(Et, { sx: { height: k }, children: /* @__PURE__ */ e(
703
703
  ct,
704
704
  {
@@ -706,7 +706,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
706
706
  beats: T,
707
707
  endpoint: l,
708
708
  logOutUser: p,
709
- onCardClick: L,
709
+ onCardClick: E,
710
710
  showBorder: !0,
711
711
  showCTAColocatedWithText: !1,
712
712
  showCarouselControls: !0,
@@ -717,7 +717,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
717
717
  useDarkMode: b,
718
718
  userHasFullInsightFeedBeats: !1,
719
719
  variant: "outlined",
720
- visibleCardsCount: g
720
+ visibleCardsCount: m
721
721
  }
722
722
  ) });
723
723
  }, Ut = M(Yt), Xt = M(({ chartLabel: n, chartColor: o }) => {
@@ -754,13 +754,13 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
754
754
  }
755
755
  ) });
756
756
  }), Zt = M(({ onClose: n }) => {
757
- const o = Ne(), { onEvent: t } = H(), { common: s, trends: i } = R(), { selectedCategoryData: h, selectedDateRangeMonthRange: d } = q(), { sortedTransactions: l } = ie(), [c, m] = r.useState(null);
757
+ const o = Ne(), { onEvent: t } = H(), { common: s, trends: i } = R(), { selectedCategoryData: h, selectedDateRangeMonthRange: d } = q(), { sortedTransactions: l } = re(), [c, g] = r.useState(null);
758
758
  if (!h)
759
759
  return null;
760
- const { guid: C, name: u, is_income: b, totalAmount: a } = h, g = b ? i.category_income : i.category_spending, T = xt(C, o), p = b ? i.income_label : i.spending_label, L = ` ${h.transactions.length === 1 ? i.transaction : i.transactions} (${h.transactions.length})`, w = r.useMemo(
760
+ const { guid: C, name: u, is_income: b, totalAmount: a } = h, m = b ? i.category_income : i.category_spending, T = xt(C, o), p = b ? i.income_label : i.spending_label, E = ` ${h.transactions.length === 1 ? i.transaction : i.transactions} (${h.transactions.length})`, w = r.useMemo(
761
761
  () => l.find((D) => D.guid === c),
762
762
  [c, l]
763
- ), E = (D) => D.category_guid === C || D.top_level_category_guid === C, k = () => {
763
+ ), I = (D) => D.category_guid === C || D.top_level_category_guid === C, k = () => {
764
764
  n?.(), t(y.TRENDS_CLICK_BACK, A);
765
765
  };
766
766
  return /* @__PURE__ */ f(
@@ -770,7 +770,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
770
770
  isOpen: !0,
771
771
  onClose: k,
772
772
  shouldShowHeaderShadow: !0,
773
- title: g,
773
+ title: m,
774
774
  children: [
775
775
  /* @__PURE__ */ f(_, { sx: { alignItems: "center", height: "100%" }, children: [
776
776
  /* @__PURE__ */ f(Lt, { sx: { borderRadius: 0, pb: 4, pt: 16, width: "100%" }, children: [
@@ -785,17 +785,17 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
785
785
  ),
786
786
  /* @__PURE__ */ e(Xt, { chartColor: T, chartLabel: p }),
787
787
  /* @__PURE__ */ f(_, { alignItems: "center", direction: "row", justifyContent: "space-between", sx: { mx: 24 }, children: [
788
- /* @__PURE__ */ e(X, { bold: !0, variant: "body1", children: L }),
789
- /* @__PURE__ */ e(vt, { filter: E })
788
+ /* @__PURE__ */ e(X, { bold: !0, variant: "body1", children: E }),
789
+ /* @__PURE__ */ e(vt, { filter: I })
790
790
  ] })
791
791
  ] }),
792
792
  /* @__PURE__ */ e(
793
793
  ke,
794
794
  {
795
795
  bgcolor: "transparent",
796
- filter: E,
796
+ filter: I,
797
797
  height: "calc(100vh - 475px)",
798
- onClick: m
798
+ onClick: g
799
799
  }
800
800
  )
801
801
  ] }),
@@ -804,7 +804,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
804
804
  {
805
805
  ariaLabelClose: s.close_aria,
806
806
  isOpen: !!w,
807
- onClose: () => m(""),
807
+ onClose: () => g(""),
808
808
  title: i.transaction,
809
809
  children: w && /* @__PURE__ */ e(Re, { transaction: w })
810
810
  }
@@ -818,11 +818,11 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
818
818
  }, qt = (n, o) => {
819
819
  const [t, s] = n, i = t, h = s ?? t, d = [];
820
820
  if (i) {
821
- const l = i.reduce((c, m) => c + m.y, 0);
821
+ const l = i.reduce((c, g) => c + g.y, 0);
822
822
  d.push({ label: o.income_label, amount: l });
823
823
  }
824
824
  if (h) {
825
- const l = h.reduce((c, m) => c + m.y, 0);
825
+ const l = h.reduce((c, g) => c + g.y, 0);
826
826
  d.push({ label: o.spending_label, amount: l });
827
827
  }
828
828
  return d;
@@ -832,7 +832,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
832
832
  selectedDateRange: t,
833
833
  totals: s
834
834
  }) => {
835
- const i = He(), { onEvent: h } = H(), { trends: d } = R(), { isSmallMobile: l, isMobile: c, isSmallTablet: m, isTablet: C } = K(), u = [i.palette.chart?.chart1, i.palette.chart?.chart2], b = Qt(s, t), a = qt(b, d), [g, T] = r.useState(0), p = 458, L = 195, w = 56, E = c || l ? L : m || C ? p : g;
835
+ const i = He(), { onEvent: h } = H(), { trends: d } = R(), { isSmallMobile: l, isMobile: c, isSmallTablet: g, isTablet: C } = K(), u = [i.palette.chart?.chart1, i.palette.chart?.chart2], b = Qt(s, t), a = qt(b, d), [m, T] = r.useState(0), p = 458, E = 195, w = 56, I = c || l ? E : g || C ? p : m;
836
836
  return r.useEffect(() => {
837
837
  const D = Math.max(n - w, o);
838
838
  T(D);
@@ -843,7 +843,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
843
843
  colors: u,
844
844
  curveType: "bump",
845
845
  datasets: b,
846
- height: E,
846
+ height: I,
847
847
  labels: a,
848
848
  onItemClick: () => {
849
849
  h(y.TRENDS_CLICK_CHART, A);
@@ -860,20 +860,22 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
860
860
  }
861
861
  );
862
862
  }, en = M(Jt), tn = ({ onBackClick: n, onInsightCardClick: o, sx: t }) => {
863
- const { onEvent: s } = H(), { config: i } = st(), { isLargeDesktop: h, isDesktop: d, isMobile: l } = K(), { visibleAccounts: c } = ce(), { loadDateRangeCategoryTotals: m, loadMonthlyCategoryTotals: C, monthlyCategoryTotals: u } = F(), { setFilter: b } = ie(), { selectedDateRange: a, setSelectedCategoryData: g, setSelectedDateRange: T } = q(), {
863
+ const { onEvent: s } = H(), { config: i } = st(), { isLargeDesktop: h, isDesktop: d, isMobile: l } = K(), { visibleAccounts: c } = ie(), { loadDateRangeCategoryTotals: g, loadMonthlyCategoryTotals: C, monthlyCategoryTotals: u } = F(), { setFilter: b } = re(), { selectedDateRange: a, setSelectedCategoryData: m, setSelectedDateRange: T } = q(), {
864
864
  isCopyLoaded: p,
865
- isInitialized: L,
865
+ isInitialized: E,
866
866
  selectedAccounts: w,
867
- selectedAccountGuids: E,
867
+ selectedAccountGuids: I,
868
868
  setSelectedAccounts: k
869
- } = P(), { trends: D } = R(), N = Ue(), x = d || h, [I, $] = r.useState(!1), [z, le] = r.useState("Chart"), [J, ee] = r.useState(""), [te, ne] = r.useState(!1), [oe, de] = r.useState(!0), [se, he] = r.useState(window.innerHeight), ae = se - 208, ue = se - (N ? 494 : 266);
869
+ } = P(), { trends: D } = R(), N = Ue(), L = d || h, [x, $] = r.useState(!1), [z, ce] = r.useState("Chart"), [J, ee] = r.useState(""), [te, ne] = r.useState(!1), [oe, le] = r.useState(window.innerHeight), se = oe - 208, de = oe - (N ? 494 : 266), [he, ue] = r.useState(!1);
870
870
  r.useEffect(() => {
871
- const v = () => he(window.innerHeight);
871
+ const v = () => le(window.innerHeight);
872
872
  return window.addEventListener("resize", v), () => window.removeEventListener("resize", v);
873
873
  }, []), r.useEffect(() => {
874
- k(c);
874
+ console.log("accounts changed: ", c.length), k(c);
875
875
  }, [c]), r.useEffect(() => {
876
- L && m(w, a.start, a.end).then(() => {
876
+ console.log("first load: ", c.length), c || ue(!0);
877
+ }, []), r.useEffect(() => {
878
+ E && g(w, a.start, a.end).then(() => {
877
879
  C(
878
880
  w,
879
881
  a.start,
@@ -885,12 +887,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
885
887
  time_period: `${Ce(a.end, a.start)}M`
886
888
  });
887
889
  });
888
- }, [L, w, a]), r.useEffect(() => {
889
- console.log("inside new use effect"), console.log(I && (c?.length ?? 0) > 0), I && (c?.length ?? 0) > 0 && de(!1);
890
- }, [I, c]), r.useEffect(() => {
890
+ }, [E, w, a]), r.useEffect(() => {
891
891
  if (u.length !== 0) {
892
892
  const v = {
893
- accounts: E,
893
+ accounts: I,
894
894
  dateRange: { start: a.start, end: a.end }
895
895
  };
896
896
  b({
@@ -901,12 +901,12 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
901
901
  });
902
902
  }
903
903
  }, [u]);
904
- const me = (v) => {
905
- g(v), ne(!0);
904
+ const ge = (v) => {
905
+ m(v), ne(!0);
906
906
  }, S = () => {
907
- g(null), ne(!1);
907
+ m(null), ne(!1);
908
908
  }, W = (v, V) => {
909
- le(V ?? z), s(y.TRENDS_CLICK_TOGGLE_VIEW, {
909
+ ce(V ?? z), s(y.TRENDS_CLICK_TOGGLE_VIEW, {
910
910
  ...A,
911
911
  toggleView: V
912
912
  });
@@ -916,7 +916,7 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
916
916
  ...A,
917
917
  time_period: Fe + "M"
918
918
  });
919
- }, ge = (v) => {
919
+ }, me = (v) => {
920
920
  s(y.TRENDS_CLICK_FILTER, {
921
921
  ...A,
922
922
  filterValue: v
@@ -926,19 +926,20 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
926
926
  }, Be = () => {
927
927
  ee(""), s(y.TRENDS_CLICK_ALL_CATEGORIES, A);
928
928
  }, ze = i.show_connections_widget_in_master ? "buttons" : "no-buttons";
929
- return !p || !I ? /* @__PURE__ */ e(Q, {}) : /* @__PURE__ */ f(
929
+ return /* @__PURE__ */ f(
930
930
  Ae,
931
931
  {
932
932
  accountOptions: c,
933
933
  calendarActions: { onRangeChanged: G },
934
934
  dateRange: a,
935
935
  dateRangeVariant: l ? "timeframetabs" : "timeframebuttons",
936
- onAccountsFilterClick: ge,
936
+ onAccountsFilterClick: me,
937
937
  onBackClick: n,
938
938
  sx: t,
939
939
  title: D.title,
940
940
  children: [
941
- oe && /* @__PURE__ */ e(
941
+ !p || !x && /* @__PURE__ */ e(Q, {}),
942
+ he ? /* @__PURE__ */ e(
942
943
  Mt,
943
944
  {
944
945
  header: D.zero_state_content_header,
@@ -947,11 +948,10 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
947
948
  },
948
949
  primaryButton: D.empty_state_primary,
949
950
  subText: D.empty_state_sub_text,
950
- sx: { height: ae },
951
+ sx: { height: se },
951
952
  variant: ze
952
953
  }
953
- ),
954
- !oe && /* @__PURE__ */ f(
954
+ ) : /* @__PURE__ */ f(
955
955
  _,
956
956
  {
957
957
  sx: {
@@ -977,27 +977,27 @@ const We = ({ selectedTab: n, onTabChange: o }) => /* @__PURE__ */ e(
977
977
  }
978
978
  ),
979
979
  /* @__PURE__ */ e(_, { alignItems: "center", flexDirection: "row", width: "100%", children: /* @__PURE__ */ e(O, { flexGrow: 1, children: J && /* @__PURE__ */ f(pe, { onClick: Be, sx: { p: 0, pr: 5 }, children: [
980
- /* @__PURE__ */ e(re, { name: "arrow_back" }),
980
+ /* @__PURE__ */ e(ae, { name: "arrow_back" }),
981
981
  D.all_categories
982
982
  ] }) }) }),
983
- /* @__PURE__ */ f(_, { flexDirection: x ? "row" : "column", gap: x ? 48 : 16, children: [
983
+ /* @__PURE__ */ f(_, { flexDirection: L ? "row" : "column", gap: L ? 48 : 16, children: [
984
984
  z === "Chart" && /* @__PURE__ */ f(Pe, { children: [
985
- /* @__PURE__ */ e(O, { sx: { width: x ? "68%" : "100%" }, children: /* @__PURE__ */ e(
985
+ /* @__PURE__ */ e(O, { sx: { width: L ? "68%" : "100%" }, children: /* @__PURE__ */ e(
986
986
  en,
987
987
  {
988
- availableHeight: ae,
988
+ availableHeight: se,
989
989
  minHeight: 450,
990
990
  selectedDateRange: a,
991
991
  totals: u
992
992
  }
993
993
  ) }),
994
- /* @__PURE__ */ f(_, { gap: 16, sx: { width: x ? "32%" : "100%" }, children: [
994
+ /* @__PURE__ */ f(_, { gap: 16, sx: { width: L ? "32%" : "100%" }, children: [
995
995
  N && /* @__PURE__ */ e(Ut, { onInsightCardClick: o }),
996
996
  /* @__PURE__ */ e(
997
997
  $t,
998
998
  {
999
- availableHeight: ue,
1000
- onCategoryClick: me
999
+ availableHeight: de,
1000
+ onCategoryClick: ge
1001
1001
  }
1002
1002
  )
1003
1003
  ] })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.0.23-alpha.al14",
3
+ "version": "7.0.23-alpha.al2",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",