@mx-cartographer/experiences 8.1.10 → 8.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [8.1.12] - 05-06-2026
2
+
3
+ - **FIXED** - Spendng Donut initializing with mismatched date range category totals
4
+
5
+ ## [8.1.11] - 05-05-2026
6
+
7
+ - **FIXED** - Spending chart crash on chart color index overflow
8
+
1
9
  ## [8.1.10] - 05-05-2026
2
10
 
3
11
  - **UPDATED** - Error component UI and no network fallback
@@ -13,72 +13,72 @@ import { u as R } from "./useAriaLive-MkYebyUR.mjs";
13
13
  import { u as v } from "./hooks-RzCoiTd0.mjs";
14
14
  import { u as V } from "./useScreenSize-CeFhWTt_.mjs";
15
15
  import { f as b } from "./NumberFormatting-CyrvFgfd.mjs";
16
- const D = 5, B = (i, l, g, m) => m.reduce((o, n) => {
17
- const a = i.find((s) => s.guid === n.category_guid);
18
- if (!a) return o;
19
- const t = a.parent_guid ?? a.guid, r = i.find((s) => s.guid === t);
20
- if (!r || n.total <= 0) return o;
16
+ const D = 5, B = (i, l, s, m) => m.reduce((o, n) => {
17
+ const r = i.find((u) => u.guid === n.category_guid);
18
+ if (!r) return o;
19
+ const t = r.parent_guid ?? r.guid, a = i.find((u) => u.guid === t);
20
+ if (!a || n.total <= 0) return o;
21
21
  const c = {
22
- guid: a.guid,
23
- name: a.guid === t ? `${l.parent_category_totals_label_general} ${a.name}` : a.name,
24
- color: _(r.guid, g),
22
+ guid: r.guid,
23
+ name: r.guid === t ? `${l.parent_category_totals_label_general} ${r.name}` : r.name,
24
+ color: _(a.guid, s),
25
25
  amount: n.total
26
- }, e = o.find((s) => s.guid === t);
26
+ }, e = o.find((u) => u.guid === t);
27
27
  return e ? (e.amount += n.total, e.categoryTotals?.push(c)) : o.push({
28
28
  guid: t,
29
- name: r.name,
30
- color: _(r.guid, g),
29
+ name: a.name,
30
+ color: _(a.guid, s),
31
31
  categoryTotals: [c],
32
32
  amount: n.total
33
33
  }), o;
34
- }, []), nt = (i, l, g, m) => {
35
- const n = B(i, l, g, m).filter(
34
+ }, []), nt = (i, l, s, m) => {
35
+ const n = B(i, l, s, m).filter(
36
36
  (e) => e.guid !== p.INCOME && e.guid !== p.INVESTMENTS && e.guid !== p.TRANSFER && e.amount > 0
37
- ).sort((e, s) => s.amount - e.amount), a = n.reduce(
38
- (e, s) => e + s.amount,
37
+ ).sort((e, u) => u.amount - e.amount), r = n.reduce(
38
+ (e, u) => e + u.amount,
39
39
  0
40
- ), t = n.length > D ? D : n.length, r = n.slice(0, t), c = r.map((e) => ({
40
+ ), t = n.length > D ? D : n.length, a = n.slice(0, t), c = a.map((e) => ({
41
41
  id: e.guid,
42
- color: _(e.guid, g),
42
+ color: _(e.guid, s),
43
43
  label: e.name,
44
- value: e.amount / a * 100
44
+ value: e.amount / r * 100
45
45
  }));
46
46
  if (n.length > 5) {
47
- const e = n.slice(D), s = e.reduce(
48
- (C, u) => C + u.amount,
47
+ const e = n.slice(D), u = e.reduce(
48
+ (C, g) => C + g.amount,
49
49
  0
50
50
  );
51
- r.push({
51
+ a.push({
52
52
  guid: "other",
53
- color: g.palette.categories.others || "",
53
+ color: s.palette.categories.others || "",
54
54
  name: l.saving_goal_other,
55
55
  categoryTotals: e,
56
- amount: s
56
+ amount: u
57
57
  }), c.push({
58
58
  id: "other",
59
- color: g.palette.categories.others || "",
59
+ color: s.palette.categories.others || "",
60
60
  label: l.saving_goal_other,
61
- value: s / a * 100
61
+ value: u / r * 100
62
62
  });
63
63
  }
64
64
  return {
65
- categoryData: r,
65
+ categoryData: a,
66
66
  donutData: c,
67
- totalAmount: a
67
+ totalAmount: r
68
68
  };
69
- }, et = (i, l, g) => {
69
+ }, et = (i, l, s) => {
70
70
  const m = i.filter(
71
71
  (t) => t.guid === p.INCOME || t.parent_guid === p.INCOME
72
- ), o = l.filter((t) => m.some((r) => r.guid === t.category_guid)).sort((t, r) => t.total - r.total).map((t, r) => ({
72
+ ), o = l.filter((t) => m.some((a) => a.guid === t.category_guid)).sort((t, a) => t.total - a.total).map((t, a) => ({
73
73
  guid: t.category_guid,
74
74
  name: i.find((c) => c.guid === t.category_guid)?.name,
75
- color: g[r],
75
+ color: s[a % s.length],
76
76
  categoryTotals: [],
77
77
  amount: Math.abs(t.total)
78
78
  })), n = o.reduce(
79
- (t, r) => t + r.amount,
79
+ (t, a) => t + a.amount,
80
80
  0
81
- ), a = o.map((t) => ({
81
+ ), r = o.map((t) => ({
82
82
  id: t.guid,
83
83
  color: t.color,
84
84
  label: t.name,
@@ -86,36 +86,36 @@ const D = 5, B = (i, l, g, m) => m.reduce((o, n) => {
86
86
  }));
87
87
  return {
88
88
  categoryData: o,
89
- donutData: a,
89
+ donutData: r,
90
90
  totalAmount: n
91
91
  };
92
92
  }, P = ({
93
93
  data: i,
94
94
  isIncome: l = !1,
95
- onSelected: g,
95
+ onSelected: s,
96
96
  onViewTransactions: m,
97
97
  selectedId: o,
98
98
  size: n = 150,
99
- totalLabel: a,
99
+ totalLabel: r,
100
100
  variant: t = "mini"
101
101
  }) => {
102
- const { spending: r } = v(), c = M(), { isTablet: e } = V(), { announce: s, ariaLive: C } = R(), u = T.useMemo(
102
+ const { spending: a } = v(), c = M(), { isTablet: e } = V(), { announce: u, ariaLive: C } = R(), g = T.useMemo(
103
103
  () => o ? i.categoryData.find((x) => x.guid === o) : void 0,
104
104
  [o]
105
105
  );
106
106
  T.useEffect(() => {
107
- if (u) {
108
- const x = b(u.amount, t === "mini" ? "0,0" : "0,0.00");
109
- s(`${u.name}: ${x}`);
107
+ if (g) {
108
+ const x = b(g.amount, t === "mini" ? "0,0" : "0,0.00");
109
+ u(`${g.name}: ${x}`);
110
110
  }
111
- }, [u, s, t]);
111
+ }, [g, u, t]);
112
112
  const E = i.donutData.length > 0 ? i.donutData : [{ id: "0", color: c.palette.divider, value: 100 }], I = () => {
113
113
  m?.(o);
114
114
  }, w = e ? 32 : 48;
115
115
  return /* @__PURE__ */ f(N, { children: [
116
116
  C,
117
- /* @__PURE__ */ d(j, { data: E, onClick: g, selectedId: o, size: n, children: /* @__PURE__ */ d(h, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ f(h, { alignItems: "center", justifyContent: "center", minHeight: n, minWidth: n, children: [
118
- u && /* @__PURE__ */ f(
117
+ /* @__PURE__ */ d(j, { data: E, onClick: s, selectedId: o, size: n, children: /* @__PURE__ */ d(h, { alignItems: "center", height: "100%", justifyContent: "center", width: "100%", children: /* @__PURE__ */ f(h, { alignItems: "center", justifyContent: "center", minHeight: n, minWidth: n, children: [
118
+ g && /* @__PURE__ */ f(
119
119
  h,
120
120
  {
121
121
  alignItems: "center",
@@ -127,7 +127,7 @@ const D = 5, B = (i, l, g, m) => m.reduce((o, n) => {
127
127
  /* @__PURE__ */ d(S, { "aria-hidden": "true", role: "presentation", children: /* @__PURE__ */ d(
128
128
  G,
129
129
  {
130
- categoryGuid: l ? p.INCOME : u.guid,
130
+ categoryGuid: l ? p.INCOME : g.guid,
131
131
  size: t === "mini" ? 24 : w,
132
132
  variant: O.Transparent
133
133
  }
@@ -138,29 +138,29 @@ const D = 5, B = (i, l, g, m) => m.reduce((o, n) => {
138
138
  color: "text.secondary",
139
139
  noWrap: !0,
140
140
  variant: t === "mini" ? "tiny" : "body1",
141
- children: u ? u.name : a
141
+ children: g ? g.name : r
142
142
  }
143
143
  )
144
144
  ]
145
145
  }
146
146
  ),
147
- !u && t === "full" && /* @__PURE__ */ d(y, { bold: !0, color: "text.secondary", sx: { mb: { xs: 4, xl: 8 } }, children: a }),
148
- /* @__PURE__ */ d($, { variant: t === "mini" ? "h2" : "h1", children: u ? b(u.amount, t === "mini" ? "0,0" : "0,0.00") : b(i.totalAmount, t === "mini" ? "0,0" : "0,0.00") }),
149
- !u && t === "mini" && /* @__PURE__ */ d(y, { color: "text.secondary", noWrap: !0, variant: "tiny", children: a }),
147
+ !g && t === "full" && /* @__PURE__ */ d(y, { bold: !0, color: "text.secondary", sx: { mb: { xs: 4, xl: 8 } }, children: r }),
148
+ /* @__PURE__ */ d($, { variant: t === "mini" ? "h2" : "h1", children: g ? b(g.amount, t === "mini" ? "0,0" : "0,0.00") : b(i.totalAmount, t === "mini" ? "0,0" : "0,0.00") }),
149
+ !g && t === "mini" && /* @__PURE__ */ d(y, { color: "text.secondary", noWrap: !0, variant: "tiny", children: r }),
150
150
  t === "full" && /* @__PURE__ */ d(
151
151
  A,
152
152
  {
153
- "aria-label": `View ${u?.name || ""} Transactions`,
153
+ "aria-label": `View ${g?.name || ""} Transactions`,
154
154
  disabled: i.categoryData.length === 0,
155
155
  onClick: I,
156
156
  sx: { mt: { xl: 4, xs: 0 }, zIndex: 1 },
157
157
  variant: "text",
158
- children: r.view_transactions
158
+ children: a.view_transactions
159
159
  }
160
160
  )
161
161
  ] }) }) })
162
162
  ] });
163
- }, rt = k(P), at = ({ data: i, onSelected: l, selectedId: g }) => {
163
+ }, at = k(P), rt = ({ data: i, onSelected: l, selectedId: s }) => {
164
164
  const m = (o, n) => {
165
165
  (o.key === "Enter" || o.key === " ") && (o.preventDefault(), l(n));
166
166
  };
@@ -169,7 +169,7 @@ const D = 5, B = (i, l, g, m) => m.reduce((o, n) => {
169
169
  {
170
170
  alignItems: "center",
171
171
  "aria-label": o.name,
172
- "aria-pressed": o.guid === g,
172
+ "aria-pressed": o.guid === s,
173
173
  direction: "row",
174
174
  gap: 8,
175
175
  onClick: () => l(o.guid),
@@ -179,15 +179,15 @@ const D = 5, B = (i, l, g, m) => m.reduce((o, n) => {
179
179
  tabIndex: 0,
180
180
  children: [
181
181
  /* @__PURE__ */ d(S, { borderRadius: 4, height: 8, sx: { backgroundColor: o.color }, width: 8 }),
182
- /* @__PURE__ */ d(y, { bold: o.guid === g, variant: "caption", children: o.name })
182
+ /* @__PURE__ */ d(y, { bold: o.guid === s, variant: "caption", children: o.name })
183
183
  ]
184
184
  },
185
185
  o.guid
186
186
  )) });
187
187
  };
188
188
  export {
189
- rt as S,
189
+ at as S,
190
190
  et as a,
191
- at as b,
191
+ rt as b,
192
192
  nt as g
193
193
  };
@@ -51,7 +51,7 @@ import { ChartsXAxis as Zn } from "@mui/x-charts/ChartsXAxis";
51
51
  import { ChartsYAxis as Jn } from "@mui/x-charts/ChartsYAxis";
52
52
  import { startOfMonth as Dt } from "date-fns/startOfMonth";
53
53
  import { endOfMonth as It } from "date-fns/endOfMonth";
54
- import { g as eo, S as to, b as no } from "../SpendingLegend-DLElSvH0.mjs";
54
+ import { g as eo, S as to, b as no } from "../SpendingLegend-BS8mHUbu.mjs";
55
55
  import { formatISO as oo } from "date-fns/formatISO";
56
56
  import { fromUnixTime as ro } from "date-fns/fromUnixTime";
57
57
  import { startOfToday as st } from "date-fns/startOfToday";
@@ -1,21 +1,21 @@
1
1
  import { jsxs as p, jsx as t } from "react/jsx-runtime";
2
- import l from "react";
2
+ import c from "react";
3
3
  import { observer as I } from "mobx-react-lite";
4
- import { startOfMonth as ot } from "date-fns/startOfMonth";
5
- import { endOfMonth as at } from "date-fns/endOfMonth";
4
+ import { startOfMonth as at } from "date-fns/startOfMonth";
5
+ import { endOfMonth as it } from "date-fns/endOfMonth";
6
6
  import L from "@mui/material/Box";
7
7
  import y from "@mui/material/Stack";
8
- import O from "@mui/material/Tab";
9
- import it from "@mui/material/Tabs";
8
+ import $ from "@mui/material/Tab";
9
+ import rt from "@mui/material/Tabs";
10
10
  import _t from "@mui/material/styles/useTheme";
11
- import { g as rt, a as st, S as k, b as Y } from "../SpendingLegend-DLElSvH0.mjs";
11
+ import { g as st, a as lt, S as B, b as q } from "../SpendingLegend-BS8mHUbu.mjs";
12
12
  import { Text as T, Icon as bt } from "@mxenabled/mxui";
13
- import { f as N } from "../NumberFormatting-CyrvFgfd.mjs";
14
- import { u as A, l as W, d as lt, b as z, a as V, h as ct, g as yt } from "../hooks-RzCoiTd0.mjs";
15
- import { u as dt } from "../useWidgetLoadTimer-BZjr-BiE.mjs";
16
- import { L as gt } from "../Loader-CxeBwuPG.mjs";
13
+ import { f as k } from "../NumberFormatting-CyrvFgfd.mjs";
14
+ import { u as A, l as R, d as ct, b as P, a as H, h as dt, g as yt } from "../hooks-RzCoiTd0.mjs";
15
+ import { u as gt } from "../useWidgetLoadTimer-BZjr-BiE.mjs";
16
+ import { L as pt } from "../Loader-CxeBwuPG.mjs";
17
17
  import { M as Ct } from "../MiniWidgetContainer-BOv3n4iw.mjs";
18
- import { startOfToday as q } from "date-fns/startOfToday";
18
+ import { startOfToday as J } from "date-fns/startOfToday";
19
19
  import St from "@mui/material/Button";
20
20
  import { useTheme as Tt } from "@mui/material";
21
21
  import { e as Mt } from "../exportTransactionsToCSV-CSvbZrvL.mjs";
@@ -23,20 +23,20 @@ import { T as Dt } from "../EmbeddedCard-B9JoBaan.mjs";
23
23
  import { T as xt } from "../TransactionDetails-C_skrQk8.mjs";
24
24
  import vt from "@mui/material/Collapse";
25
25
  import wt from "@mui/material/Divider";
26
- import J from "@mui/material/List";
27
- import Q from "@mui/material/ListItem";
28
- import X from "@mui/material/ListItemButton";
26
+ import Q from "@mui/material/List";
27
+ import X from "@mui/material/ListItem";
28
+ import Z from "@mui/material/ListItemButton";
29
29
  import { u as Lt } from "../useScreenSize-CeFhWTt_.mjs";
30
- import { D as Z } from "../Drawer-XPaLYjiO.mjs";
30
+ import { D as tt } from "../Drawer-XPaLYjiO.mjs";
31
31
  import { b as w } from "../Category-Ccoew_sA.mjs";
32
- import { parseISO as tt } from "date-fns/parseISO";
33
- import { A as et } from "../Analytics-CzGzz_sE.mjs";
32
+ import { parseISO as et } from "date-fns/parseISO";
33
+ import { A as nt } from "../Analytics-CzGzz_sE.mjs";
34
34
  import { W as It } from "../WidgetContainer-BPJoDkhL.mjs";
35
- const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y, { direction: "column", children: [
35
+ const G = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y, { direction: "column", children: [
36
36
  /* @__PURE__ */ t(T, { bold: !0, sx: { textTransform: "none" }, variant: "body1", children: d }),
37
- /* @__PURE__ */ t(T, { variant: "caption", children: N(n, o === "mini" ? "0,0" : "0,0.00") })
37
+ /* @__PURE__ */ t(T, { variant: "caption", children: k(n, o === "mini" ? "0,0" : "0,0.00") })
38
38
  ] }), At = () => {
39
- const n = _t(), { goals: d, spending: o } = A(), { categories: a, dateRangeCategoryTotals: i } = W(), g = l.useMemo(
39
+ const n = _t(), { goals: d, spending: o } = A(), { categories: a, dateRangeCategoryTotals: i } = R(), g = c.useMemo(
40
40
  () => [
41
41
  n.palette.chartMono.chartMono5,
42
42
  n.palette.chartMono.chartMono4,
@@ -46,57 +46,57 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
46
46
  n.palette.chartMono.chartMono6
47
47
  ],
48
48
  [n]
49
- ), [e, r] = l.useState(""), [c, b] = l.useState(0), u = l.useMemo(
50
- () => rt(a, d, n, i),
49
+ ), [e, r] = c.useState(""), [s, b] = c.useState(0), u = c.useMemo(
50
+ () => st(a, d, n, i),
51
51
  [a, i]
52
- ), h = l.useMemo(
53
- () => st(a, i, g),
52
+ ), h = c.useMemo(
53
+ () => lt(a, i, g),
54
54
  [a, i, g]
55
- ), M = (f, x) => {
56
- b(x), r("");
57
- }, _ = (f) => {
58
- r(e === f ? "" : f);
55
+ ), M = (_, D) => {
56
+ b(D), r("");
57
+ }, f = (_) => {
58
+ r(e === _ ? "" : _);
59
59
  };
60
60
  return /* @__PURE__ */ p(L, { width: "100%", children: [
61
61
  /* @__PURE__ */ p(
62
- it,
62
+ rt,
63
63
  {
64
64
  "aria-label": o.mini_title,
65
65
  onChange: M,
66
66
  sx: { touchAction: "manipulation" },
67
- value: c,
67
+ value: s,
68
68
  variant: "fullWidth",
69
69
  children: [
70
70
  /* @__PURE__ */ t(
71
- O,
71
+ $,
72
72
  {
73
73
  "aria-controls": "spending-tabpanel",
74
74
  id: "spending-tab",
75
75
  label: /* @__PURE__ */ t(
76
- $,
76
+ G,
77
77
  {
78
78
  amount: u.totalAmount,
79
79
  label: o.spend_tab_title,
80
80
  variant: "mini"
81
81
  }
82
82
  ),
83
- tabIndex: c === 0 ? 0 : -1
83
+ tabIndex: s === 0 ? 0 : -1
84
84
  }
85
85
  ),
86
86
  /* @__PURE__ */ t(
87
- O,
87
+ $,
88
88
  {
89
89
  "aria-controls": "income-tabpanel",
90
90
  id: "income-tab",
91
91
  label: /* @__PURE__ */ t(
92
- $,
92
+ G,
93
93
  {
94
94
  amount: h.totalAmount,
95
95
  label: o.income_tab_title,
96
96
  variant: "mini"
97
97
  }
98
98
  ),
99
- tabIndex: c === 1 ? 0 : -1
99
+ tabIndex: s === 1 ? 0 : -1
100
100
  }
101
101
  )
102
102
  ]
@@ -106,20 +106,20 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
106
106
  L,
107
107
  {
108
108
  "aria-labelledby": "spending-tab",
109
- hidden: c !== 0,
109
+ hidden: s !== 0,
110
110
  id: "spending-tabpanel",
111
111
  role: "tabpanel",
112
112
  children: /* @__PURE__ */ p(y, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
113
113
  /* @__PURE__ */ t(
114
- k,
114
+ B,
115
115
  {
116
116
  data: u,
117
- onSelected: _,
117
+ onSelected: f,
118
118
  selectedId: e,
119
119
  totalLabel: o.total_spending
120
120
  }
121
121
  ),
122
- /* @__PURE__ */ t(Y, { data: u, onSelected: _, selectedId: e })
122
+ /* @__PURE__ */ t(q, { data: u, onSelected: f, selectedId: e })
123
123
  ] })
124
124
  }
125
125
  ),
@@ -127,50 +127,50 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
127
127
  L,
128
128
  {
129
129
  "aria-labelledby": "income-tab",
130
- hidden: c !== 1,
130
+ hidden: s !== 1,
131
131
  id: "income-tabpanel",
132
132
  role: "tabpanel",
133
133
  children: /* @__PURE__ */ p(y, { direction: "row", gap: 16, justifyContent: "center", p: 24, children: [
134
134
  /* @__PURE__ */ t(
135
- k,
135
+ B,
136
136
  {
137
137
  data: h,
138
138
  isIncome: !0,
139
- onSelected: _,
139
+ onSelected: f,
140
140
  selectedId: e,
141
141
  totalLabel: o.total_income
142
142
  }
143
143
  ),
144
- /* @__PURE__ */ t(Y, { data: h, onSelected: _, selectedId: e })
144
+ /* @__PURE__ */ t(q, { data: h, onSelected: f, selectedId: e })
145
145
  ] })
146
146
  }
147
147
  )
148
148
  ] });
149
149
  }, Et = I(At), Wt = ({ onPrimaryCtaClick: n, sx: d = {} }) => {
150
- const { isAccountDataLoaded: o, loadAccountData: a } = lt(), { dateRangeTotalsLoaded: i, categoriesLoaded: g, loadCategories: e, loadDateRangeCategoryTotals: r } = W(), { spending: c } = A(), { isInitialized: b, selectedAccounts: u } = z();
151
- return dt({
150
+ const { isAccountDataLoaded: o, loadAccountData: a } = ct(), { dateRangeTotalsLoaded: i, categoriesLoaded: g, loadCategories: e, loadDateRangeCategoryTotals: r } = R(), { spending: s } = A(), { isInitialized: b, selectedAccounts: u } = P();
151
+ return gt({
152
152
  widgetName: "SpendingMiniWidget",
153
153
  isLoaded: i
154
- }), l.useEffect(() => {
154
+ }), c.useEffect(() => {
155
155
  o || a().finally(), g || e().finally();
156
- }, []), l.useEffect(() => {
156
+ }, []), c.useEffect(() => {
157
157
  r(
158
158
  u,
159
- ot(/* @__PURE__ */ new Date()),
160
- at(/* @__PURE__ */ new Date())
159
+ at(/* @__PURE__ */ new Date()),
160
+ it(/* @__PURE__ */ new Date())
161
161
  ).finally();
162
162
  }, [u]), b ? /* @__PURE__ */ t(
163
163
  Ct,
164
164
  {
165
165
  className: "mx-exp-spending-miniwidget",
166
166
  onPrimaryCtaClick: n,
167
- primaryCtaLabel: c.primary_cta,
168
- primaryCtaLabelAria: c.primary_cta_aria,
167
+ primaryCtaLabel: s.primary_cta,
168
+ primaryCtaLabelAria: s.primary_cta_aria,
169
169
  sx: { height: "100%", ...d },
170
- title: c.mini_title,
170
+ title: s.mini_title,
171
171
  children: /* @__PURE__ */ t(Et, {})
172
172
  }
173
- ) : /* @__PURE__ */ t(gt, {});
173
+ ) : /* @__PURE__ */ t(pt, {});
174
174
  }, Ce = I(Wt), Rt = ({
175
175
  data: n,
176
176
  onSelected: d,
@@ -181,9 +181,9 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
181
181
  return /* @__PURE__ */ p(y, { direction: "column", justifyContent: "center", maxWidth: 400, minWidth: 275, width: "100%", children: [
182
182
  /* @__PURE__ */ t(T, { bold: !0, id: "spending-list-title", sx: { py: 12 }, variant: "h3", children: `${a} ${i.by_category}` }),
183
183
  /* @__PURE__ */ t(wt, { "aria-hidden": "true" }),
184
- /* @__PURE__ */ t(J, { "aria-labelledby": "spending-list-title", children: n.categoryData.map((e) => /* @__PURE__ */ p(l.Fragment, { children: [
184
+ /* @__PURE__ */ t(Q, { "aria-labelledby": "spending-list-title", children: n.categoryData.map((e) => /* @__PURE__ */ p(c.Fragment, { children: [
185
185
  /* @__PURE__ */ t(
186
- Q,
186
+ X,
187
187
  {
188
188
  disableGutters: !0,
189
189
  disablePadding: !0,
@@ -193,7 +193,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
193
193
  minHeight: 44
194
194
  },
195
195
  children: /* @__PURE__ */ p(
196
- X,
196
+ Z,
197
197
  {
198
198
  "aria-expanded": g?.guid === e.guid,
199
199
  id: `spending-list-category-${e.guid}`,
@@ -221,7 +221,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
221
221
  width: "100%",
222
222
  children: [
223
223
  /* @__PURE__ */ t(T, { bold: o === e.guid, children: e.name }),
224
- /* @__PURE__ */ t(T, { bold: o === e.guid, variant: "body1", children: N(e.amount, "0,0.00") })
224
+ /* @__PURE__ */ t(T, { bold: o === e.guid, variant: "body1", children: k(e.amount, "0,0.00") })
225
225
  ]
226
226
  }
227
227
  )
@@ -230,15 +230,15 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
230
230
  )
231
231
  }
232
232
  ),
233
- e.categoryTotals && e.categoryTotals.length > 0 && /* @__PURE__ */ t(vt, { in: g?.guid === e.guid, unmountOnExit: !0, children: /* @__PURE__ */ t(J, { sx: { borderBottom: 1, borderColor: "divider" }, children: g?.categoryTotals?.map((r) => /* @__PURE__ */ t(
234
- Q,
233
+ e.categoryTotals && e.categoryTotals.length > 0 && /* @__PURE__ */ t(vt, { in: g?.guid === e.guid, unmountOnExit: !0, children: /* @__PURE__ */ t(Q, { sx: { borderBottom: 1, borderColor: "divider" }, children: g?.categoryTotals?.map((r) => /* @__PURE__ */ t(
234
+ X,
235
235
  {
236
236
  sx: {
237
237
  pl: 12,
238
238
  py: 0
239
239
  },
240
240
  children: /* @__PURE__ */ t(
241
- X,
241
+ Z,
242
242
  {
243
243
  id: `spending-list-subcategory-${r.guid}`,
244
244
  onClick: () => d(r.guid, !0),
@@ -248,7 +248,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
248
248
  r.name,
249
249
  " "
250
250
  ] }),
251
- /* @__PURE__ */ t(T, { children: N(r.amount, "0,0.00") })
251
+ /* @__PURE__ */ t(T, { children: k(r.amount, "0,0.00") })
252
252
  ] })
253
253
  }
254
254
  )
@@ -256,7 +256,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
256
256
  r.guid
257
257
  )) }) })
258
258
  ] }, e.guid)) }),
259
- /* @__PURE__ */ t(T, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${i.total}: ${N(n.totalAmount, "0,0.00")}` })
259
+ /* @__PURE__ */ t(T, { bold: !0, sx: { mt: 12, pr: 8, textAlign: "right" }, children: `${i.total}: ${k(n.totalAmount, "0,0.00")}` })
260
260
  ] });
261
261
  }, Nt = I(Rt), Ot = ({
262
262
  data: n,
@@ -265,7 +265,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
265
265
  selectedId: a,
266
266
  title: i
267
267
  }) => {
268
- const { isDesktop: g, isMobile: e } = Lt(), { dateRangeTotalsLoading: r } = W(), { spending: c } = A();
268
+ const { isDesktop: g, isMobile: e } = Lt(), { dateRangeTotalsLoading: r } = R(), { spending: s } = A();
269
269
  return /* @__PURE__ */ p(
270
270
  y,
271
271
  {
@@ -277,7 +277,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
277
277
  px: 8,
278
278
  children: [
279
279
  r && /* @__PURE__ */ t(
280
- k,
280
+ B,
281
281
  {
282
282
  data: {
283
283
  categoryData: [],
@@ -293,7 +293,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
293
293
  }
294
294
  ),
295
295
  !r && /* @__PURE__ */ t(
296
- k,
296
+ B,
297
297
  {
298
298
  data: n,
299
299
  onSelected: (h) => {
@@ -302,7 +302,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
302
302
  onViewTransactions: o,
303
303
  selectedId: a,
304
304
  size: g ? 400 : 300,
305
- totalLabel: c.total_amount,
305
+ totalLabel: s.total_amount,
306
306
  variant: "full"
307
307
  }
308
308
  ),
@@ -310,7 +310,7 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
310
310
  ]
311
311
  }
312
312
  );
313
- }, nt = I(Ot), kt = (n) => [
313
+ }, ot = I(Ot), kt = (n) => [
314
314
  n.palette.chartMono.chartMono5,
315
315
  n.palette.chartMono.chartMono4,
316
316
  n.palette.chartMono.chartMono3,
@@ -318,85 +318,85 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
318
318
  n.palette.chartMono.chartMono1,
319
319
  n.palette.chartMono.chartMono6
320
320
  ], $t = () => {
321
- const n = Tt(), { is_mobile_webview: d } = V(), { clientConfig: o } = V(), { categories: a, dateRangeCategoryTotals: i } = W(), {
321
+ const n = Tt(), { is_mobile_webview: d } = H(), { clientConfig: o } = H(), { categories: a, dateRangeCategoryTotals: i } = R(), {
322
322
  goals: g,
323
323
  spending: e,
324
324
  transactions: r
325
- } = A(), { displayedDateRange: c, selectedAccountGuids: b } = z(), {
325
+ } = A(), { displayedDateRange: s, selectedAccountGuids: b } = P(), {
326
326
  setFilter: u,
327
327
  sortedTransactions: h,
328
328
  sortedTransactionsWithSplits: M,
329
- tags: _
330
- } = ct(), f = o?.master?.deep_link_params?.account_guids, x = o?.master?.deep_link_params?.view, [D, R] = l.useState(""), [v, C] = l.useState(x === "income" ? 1 : 0), [E, H] = l.useState(""), [pt, B] = l.useState(!1), G = l.useMemo(
331
- () => rt(a, g, n, i),
329
+ tags: f
330
+ } = dt(), _ = o?.master?.deep_link_params?.account_guids, D = o?.master?.deep_link_params?.view, [x, N] = c.useState(""), [v, C] = c.useState(D === "income" ? 1 : 0), [E, W] = c.useState(""), [O, j] = c.useState(!1), F = c.useMemo(
331
+ () => st(a, g, n, i),
332
332
  [a, i]
333
- ), P = l.useMemo(
334
- () => st(a, i, kt(n)),
333
+ ), K = c.useMemo(
334
+ () => lt(a, i, kt(n)),
335
335
  [a, i]
336
- ), j = l.useMemo(
337
- () => h.find((s) => s.guid === E),
336
+ ), V = c.useMemo(
337
+ () => h.find((l) => l.guid === E),
338
338
  [E, h]
339
- ), ut = (s, S) => {
340
- C(S), R("");
341
- }, K = (s, S = !1) => {
342
- S ? mt(s) : R(D === s || s === "0" ? "" : s);
343
- }, mt = (s) => {
339
+ ), ut = (l, S) => {
340
+ C(S), N("");
341
+ }, U = (l, S = !1) => {
342
+ S ? mt(l) : N(x === l || l === "0" ? "" : l);
343
+ }, mt = (l) => {
344
344
  u({
345
345
  ...{
346
- accounts: f || b,
347
- dateRange: c
346
+ accounts: _ || b,
347
+ dateRange: s
348
348
  },
349
- custom: (m) => D === "other" ? m.top_level_category_guid === s : m.category_guid === s,
349
+ custom: (m) => x === "other" ? m.top_level_category_guid === l : m.category_guid === l,
350
350
  showSplits: !0
351
- }), B(!0);
352
- }, U = (s) => {
351
+ }), j(!0);
352
+ }, Y = (l) => {
353
353
  const S = {
354
- accounts: f || b,
355
- dateRange: c
354
+ accounts: _ || b,
355
+ dateRange: s
356
356
  };
357
357
  if (v === 0)
358
- if (s === "other") {
359
- const m = G.categoryData.find((F) => F.guid === "other");
358
+ if (l === "other") {
359
+ const m = F.categoryData.find((z) => z.guid === "other");
360
360
  u({
361
361
  ...S,
362
- custom: (F) => !!m?.categoryTotals?.find((ft) => ft.guid === F.top_level_category_guid)
362
+ custom: (z) => !!m?.categoryTotals?.find((ft) => ft.guid === z.top_level_category_guid)
363
363
  });
364
364
  } else
365
365
  u({
366
366
  ...S,
367
- custom: (m) => s ? m.top_level_category_guid === s : m.top_level_category_guid !== w.INCOME && m.category_guid !== w.INCOME && m.top_level_category_guid !== w.INVESTMENTS && m.top_level_category_guid !== w.TRANSFER,
368
- showSplits: !!s
367
+ custom: (m) => l ? m.top_level_category_guid === l : m.top_level_category_guid !== w.INCOME && m.category_guid !== w.INCOME && m.top_level_category_guid !== w.INVESTMENTS && m.top_level_category_guid !== w.TRANSFER,
368
+ showSplits: !!l
369
369
  });
370
370
  else
371
371
  u({
372
372
  ...S,
373
- custom: (m) => s ? m.category_guid === s : m.category_guid === w.INCOME || m.top_level_category_guid === w.INCOME
373
+ custom: (m) => l ? m.category_guid === l : m.category_guid === w.INCOME || m.top_level_category_guid === w.INCOME
374
374
  });
375
- B(!0);
375
+ j(!0);
376
376
  }, ht = () => {
377
- Mt(M, _);
377
+ Mt(M, f);
378
378
  };
379
379
  return /* @__PURE__ */ p(L, { children: [
380
- /* @__PURE__ */ p(it, { onChange: ut, value: v, variant: "fullWidth", children: [
380
+ /* @__PURE__ */ p(rt, { onChange: ut, value: v, variant: "fullWidth", children: [
381
381
  /* @__PURE__ */ t(
382
- O,
382
+ $,
383
383
  {
384
384
  label: /* @__PURE__ */ t(
385
- $,
385
+ G,
386
386
  {
387
- amount: G.totalAmount,
387
+ amount: F.totalAmount,
388
388
  label: e.spend_tab_title
389
389
  }
390
390
  )
391
391
  }
392
392
  ),
393
393
  /* @__PURE__ */ t(
394
- O,
394
+ $,
395
395
  {
396
396
  label: /* @__PURE__ */ t(
397
- $,
397
+ G,
398
398
  {
399
- amount: P.totalAmount,
399
+ amount: K.totalAmount,
400
400
  label: e.income_tab_title
401
401
  }
402
402
  )
@@ -404,31 +404,31 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
404
404
  )
405
405
  ] }),
406
406
  v === 0 && /* @__PURE__ */ t(
407
- nt,
407
+ ot,
408
408
  {
409
- data: G,
410
- onSelected: K,
411
- onViewTransactions: U,
412
- selectedId: D,
409
+ data: F,
410
+ onSelected: U,
411
+ onViewTransactions: Y,
412
+ selectedId: x,
413
413
  title: e.spend_tab_title
414
414
  }
415
415
  ),
416
416
  v === 1 && /* @__PURE__ */ t(
417
- nt,
417
+ ot,
418
418
  {
419
- data: P,
420
- onSelected: K,
421
- onViewTransactions: U,
422
- selectedId: D,
419
+ data: K,
420
+ onSelected: U,
421
+ onViewTransactions: Y,
422
+ selectedId: x,
423
423
  title: e.income_tab_title
424
424
  }
425
425
  ),
426
426
  /* @__PURE__ */ t(
427
- Z,
427
+ tt,
428
428
  {
429
429
  ariaLabelClose: e.close_drawer_aria,
430
- isOpen: pt,
431
- onClose: () => B(!1),
430
+ isOpen: O,
431
+ onClose: () => j(!1),
432
432
  title: e.transactions_drawer_title,
433
433
  children: /* @__PURE__ */ p(y, { children: [
434
434
  !d && h.length > 0 && /* @__PURE__ */ t(y, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ t(
@@ -440,51 +440,51 @@ const $ = ({ amount: n, label: d, variant: o = "full" }) => /* @__PURE__ */ p(y,
440
440
  children: r.export_csv_btn
441
441
  }
442
442
  ) }),
443
- /* @__PURE__ */ t(Dt, { onClick: H })
443
+ /* @__PURE__ */ t(Dt, { onClick: W })
444
444
  ] })
445
445
  }
446
446
  ),
447
447
  /* @__PURE__ */ t(
448
- Z,
448
+ tt,
449
449
  {
450
450
  ariaLabelClose: e.close_drawer_aria,
451
- isOpen: !!j,
452
- onClose: () => H(""),
451
+ isOpen: !!V,
452
+ onClose: () => W(""),
453
453
  title: e.transaction_details_drawer_title,
454
- children: j && /* @__PURE__ */ t(xt, { transaction: j })
454
+ children: V && /* @__PURE__ */ t(xt, { transaction: V })
455
455
  }
456
456
  )
457
457
  ] });
458
458
  }, Bt = I($t), Gt = ({ onBackClick: n, onMenuClick: d, sx: o = {} }) => {
459
- const { isAccountDataLoaded: a, loadAccountData: i } = lt(), { categoriesLoaded: g, dateRangeTotalsLoaded: e, loadCategories: r, loadDateRangeCategoryTotals: c } = W(), { isTransactionDataLoaded: b, loadTransactionData: u } = ct(), { spending: h } = A(), { displayedDateRange: M, isInitialized: _, setDisplayedDate: f, selectedAccounts: x } = z(), { onEvent: D } = yt(), { clientConfig: R } = V();
460
- dt({
459
+ const { isAccountDataLoaded: a, loadAccountData: i } = ct(), { categoriesLoaded: g, dateRangeTotalsLoaded: e, loadCategories: r, loadDateRangeCategoryTotals: s } = R(), { isTransactionDataLoaded: b, loadTransactionData: u } = dt(), { spending: h } = A(), { displayedDateRange: M, isInitialized: f, setDisplayedDate: _, selectedAccounts: D } = P(), { onEvent: x } = yt(), { clientConfig: N } = H();
460
+ gt({
461
461
  widgetName: "SpendingWidget",
462
462
  isLoaded: e
463
- }), l.useEffect(() => {
464
- const C = R?.master?.deep_link_params, E = C?.date_range ? [tt(C.date_range.from), tt(C.date_range.to)] : [ot(q()), at(q())];
465
- f(E[0], E[1]), a || i().finally(), g || r().finally(), b || u().finally(), D(et.SPENDING_VIEW);
466
- }, []), l.useEffect(() => {
467
- _ && c(
468
- x,
463
+ }), c.useEffect(() => {
464
+ const C = N?.master?.deep_link_params, E = C?.date_range ? [et(C.date_range.from), et(C.date_range.to)] : [at(J()), it(J())], W = E[0], O = E[1];
465
+ _(W, O), a || i().finally(), g || r().finally(), b || u().finally(), f && s(D, W, O).finally(), x(nt.SPENDING_VIEW);
466
+ }, []), c.useEffect(() => {
467
+ f && s(
468
+ D,
469
469
  M.start,
470
470
  M.end
471
471
  ).finally();
472
- }, [M, _, x]);
472
+ }, [M, f, D]);
473
473
  const v = (C) => {
474
- f(C[0], C[1]);
474
+ _(C[0], C[1]);
475
475
  };
476
- return _ ? /* @__PURE__ */ t(
476
+ return f ? /* @__PURE__ */ t(
477
477
  It,
478
478
  {
479
479
  calendarActions: { onRangeChanged: v },
480
- onAccountsFilterClick: () => D(et.SPENDING_CLICK_FILTER),
480
+ onAccountsFilterClick: () => x(nt.SPENDING_CLICK_FILTER),
481
481
  onBackClick: n,
482
482
  onMenuClick: d,
483
483
  sx: o,
484
484
  title: h.title,
485
485
  children: /* @__PURE__ */ t(L, { width: "100%", children: /* @__PURE__ */ t(Bt, {}) })
486
486
  }
487
- ) : /* @__PURE__ */ t(gt, {});
487
+ ) : /* @__PURE__ */ t(pt, {});
488
488
  }, Se = I(Gt);
489
489
  export {
490
490
  Ce as SpendingMiniWidget,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "8.1.10",
3
+ "version": "8.1.12",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",