@mx-cartographer/experiences 7.4.15 → 7.5.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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [7.5.0] - 01-06-2025
2
+
3
+ - **UPDATED** - Trends table with a new total column
4
+ - **UPDATED** - Trends table style to match updated designs
5
+
6
+ ## [7.4.16] - 12-23-2025
7
+
8
+ - **FIXED** - `MicroCardTemplate` LineHeight Fix
9
+
1
10
  ## [7.4.15] - 12-22-2025
2
11
 
3
12
  - **FIXED** - Spending Total Amount Discrepancies wrt legacy - Bug Fixed
@@ -1,15 +1,15 @@
1
- import { makeAutoObservable as u, runInAction as l } from "mobx";
1
+ import { makeAutoObservable as C, runInAction as l } from "mobx";
2
2
  import { getUnixTime as r } from "date-fns/getUnixTime";
3
- import { subMonths as g } from "date-fns/subMonths";
4
- import { startOfMonth as h } from "date-fns/startOfMonth";
5
- import { endOfMonth as d } from "date-fns/endOfMonth";
6
- import { a as T, g as m } from "./CategoryUtil-DUM8NuGO.mjs";
7
- import { F as p, A as i } from "./Fetch-DecPFeGU.mjs";
8
- import { b as f, c as w } from "./Category-CevNQ03n.mjs";
9
- class y {
3
+ import { subMonths as h } from "date-fns/subMonths";
4
+ import { startOfMonth as d } from "date-fns/startOfMonth";
5
+ import { endOfMonth as y } from "date-fns/endOfMonth";
6
+ import { a as m, g as p } from "./CategoryUtil-DUM8NuGO.mjs";
7
+ import { F as f, A as i } from "./Fetch-DecPFeGU.mjs";
8
+ import { b as g, c as S } from "./Category-CevNQ03n.mjs";
9
+ class u {
10
10
  fetchInstance;
11
11
  constructor(t, e, o) {
12
- this.fetchInstance = new p(t, e, void 0, o);
12
+ this.fetchInstance = new f(t, e, void 0, o);
13
13
  }
14
14
  addCategory = async (t) => this.fetchInstance.post(i.CATEGORIES, t).then((e) => e.category);
15
15
  getCategories = async () => this.fetchInstance.get(i.CATEGORIES).then((t) => t.categories);
@@ -20,7 +20,7 @@ class y {
20
20
  try {
21
21
  const a = `${i.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`;
22
22
  if (o) {
23
- const s = o.length === 0 ? [""] : o.map((C) => C.guid);
23
+ const s = o.length === 0 ? [""] : o.map((T) => T.guid);
24
24
  return (await this.fetchInstance.post(a, { account_guid: s })).monthly_category_totals;
25
25
  } else
26
26
  return (await this.fetchInstance.get(a)).monthly_category_totals;
@@ -31,7 +31,7 @@ class y {
31
31
  removeCategory = async (t) => this.fetchInstance.delete(`${i.CATEGORIES}/${t}`);
32
32
  updateCategory = async (t) => this.fetchInstance.put(`${i.CATEGORIES}/${t.guid}`, t).then((e) => e.category);
33
33
  }
34
- class S {
34
+ class w {
35
35
  expandedGuid = null;
36
36
  selectedGuid = null;
37
37
  searchValue = "";
@@ -42,7 +42,7 @@ class S {
42
42
  savedOnSelect;
43
43
  // todo
44
44
  constructor() {
45
- u(this);
45
+ C(this);
46
46
  }
47
47
  setExpandedGuid = (t) => this.expandedGuid = t;
48
48
  setSelectedGuid = (t) => this.selectedGuid = t;
@@ -57,7 +57,7 @@ class S {
57
57
  class G {
58
58
  globalStore;
59
59
  uiStore;
60
- api = new y("/", "");
60
+ api = new u("/", "");
61
61
  categories = [];
62
62
  dateRangeCategoryTotals = [];
63
63
  monthlyCategoryTotals = [];
@@ -65,17 +65,17 @@ class G {
65
65
  isLoadingCategoryTotals = !1;
66
66
  monthlyTotalsLoaded = !1;
67
67
  constructor(t) {
68
- this.globalStore = t, this.uiStore = new S(), this.api = new y(t.endpoint, t.sessionToken, t.onError), u(this);
68
+ this.globalStore = t, this.uiStore = new w(), this.api = new u(t.endpoint, t.sessionToken, t.onError), C(this);
69
69
  }
70
70
  get detailedCategories() {
71
- return T(
71
+ return m(
72
72
  this.categories,
73
73
  this.dateRangeCategoryTotals,
74
74
  this.monthlyCategoryTotals
75
75
  );
76
76
  }
77
77
  get detailedCategoriesWithTransactions() {
78
- return m(
78
+ return p(
79
79
  this.detailedCategories,
80
80
  this.globalStore.transactionStore.sortedTransactions
81
81
  );
@@ -85,12 +85,15 @@ class G {
85
85
  }
86
86
  get spendCategories() {
87
87
  return this.detailedCategories.filter(
88
- (t) => !t.is_income && !t.isTransfer && t.guid !== f.INVESTMENTS
88
+ (t) => !t.is_income && !t.isTransfer && t.guid !== g.INVESTMENTS
89
89
  );
90
90
  }
91
91
  get transferCategories() {
92
92
  return this.detailedCategories.filter((t) => t.isTransfer);
93
93
  }
94
+ get trendsCategories() {
95
+ return this.detailedCategories.filter((t) => t.monthlyAmounts.some((e) => e.amount > 0)).filter((t) => t.guid !== g.INVESTMENTS && t.guid !== g.TRANSFER);
96
+ }
94
97
  addCategory = async (t, e) => {
95
98
  const o = { name: t, parent_guid: e };
96
99
  try {
@@ -128,7 +131,7 @@ class G {
128
131
  }
129
132
  };
130
133
  loadMonthlyCategoryTotals = async (t = this.globalStore.globalUiStore.selectedAccounts, e, o) => {
131
- const a = r(h(e ?? g(/* @__PURE__ */ new Date(), 11))), s = r(d(o ?? /* @__PURE__ */ new Date()));
134
+ const a = r(d(e ?? h(/* @__PURE__ */ new Date(), 11))), s = r(y(o ?? /* @__PURE__ */ new Date()));
132
135
  try {
133
136
  const n = await this.api.getMonthlyCategoryTotals(a, s, t);
134
137
  l(() => {
@@ -146,8 +149,8 @@ class G {
146
149
  r(o),
147
150
  t
148
151
  ), s = await this.api.getMonthlyCategoryTotals(
149
- r(h(g(o, 11))),
150
- r(d(o)),
152
+ r(d(h(o, 11))),
153
+ r(y(o)),
151
154
  t
152
155
  );
153
156
  l(() => {
@@ -175,9 +178,9 @@ class G {
175
178
  }
176
179
  };
177
180
  // TODO: Remove this after refactoring Trends components to use detailedCategories
178
- getCategoryName = (t) => this.categories.find((o) => o.guid === t)?.name ?? w[t];
181
+ getCategoryName = (t) => this.categories.find((o) => o.guid === t)?.name ?? S[t];
179
182
  }
180
183
  export {
181
184
  G as C,
182
- y as a
185
+ u as a
183
186
  };
@@ -0,0 +1,53 @@
1
+ import { addMonths as u } from "date-fns/addMonths";
2
+ import { isBefore as d } from "date-fns/isBefore";
3
+ import { startOfMonth as _ } from "date-fns/startOfMonth";
4
+ import { subMonths as y } from "date-fns/subMonths";
5
+ import { endOfMonth as M } from "date-fns/endOfMonth";
6
+ import { b as a, P as l } from "./Category-CevNQ03n.mjs";
7
+ import { f as m, a as T } from "./Dialog-BPTr3qHE.mjs";
8
+ const i = (e) => (e.top_level_category_guid === a.INCOME || e.category_guid === a.INCOME) && !h(e), C = (e) => !i(e) && !f(e), p = (e) => l.includes(e.top_level_category_guid) || l.includes(e.category_guid), f = (e) => e.top_level_category_guid === a.TRANSFER || e.category_guid === a.TRANSFER, h = (e) => e.top_level_category_guid === a.INVESTMENTS || e.category_guid === a.INVESTMENTS, N = (e) => !i(e) && !p(e) && !f(e) && !h(e), w = (e) => e.filter((r) => r.category_guid === r.top_level_category_guid), F = (e, r) => {
9
+ if (r === 0) return 0;
10
+ const o = (e - r) / r;
11
+ return isNaN(o) ? 0 : o;
12
+ }, g = (e, r) => {
13
+ const o = [];
14
+ let t = _(r?.start ?? y(/* @__PURE__ */ new Date(), 5));
15
+ const s = r?.end ?? /* @__PURE__ */ new Date();
16
+ for (; d(t, s); )
17
+ o.push({
18
+ x: m(t, T.MONTH_SHORT),
19
+ y: e.filter((n) => n.year === t.getFullYear() && n.month === t.getMonth() + 1).reduce((n, c) => n + c.total, 0)
20
+ }), t = u(t, 1);
21
+ return o;
22
+ }, b = (e, r) => {
23
+ const o = e.filter(i);
24
+ return g(o, r).map((t) => ({ ...t, y: Math.abs(t.y) }));
25
+ }, A = (e, r) => {
26
+ const o = e.filter(p);
27
+ return g(o, r).map((t) => ({ ...t, y: Math.abs(t.y) }));
28
+ }, x = (e, r) => {
29
+ const o = e.filter(N);
30
+ return g(o, r);
31
+ }, H = (e) => {
32
+ const r = [], o = e.filter(
33
+ (n) => n.top_level_category_guid !== a.INCOME && n.top_level_category_guid !== a.TRANSFER && n.total > 0
34
+ );
35
+ let t = _(y(/* @__PURE__ */ new Date(), 5));
36
+ const s = M(/* @__PURE__ */ new Date());
37
+ for (; d(t, s); )
38
+ r.push({
39
+ x: m(t, T.MONTH_SHORT),
40
+ y: o.filter((n) => n.year === t.getFullYear() && n.month === t.getMonth() + 1).reduce((n, c) => n + c.total, 0)
41
+ }), t = u(t, 1);
42
+ return r;
43
+ };
44
+ export {
45
+ A as a,
46
+ x as b,
47
+ w as c,
48
+ i as d,
49
+ H as e,
50
+ F as f,
51
+ b as g,
52
+ C as i
53
+ };
@@ -0,0 +1,186 @@
1
+ import { jsxs as u, jsx as l } from "react/jsx-runtime";
2
+ import x from "react";
3
+ import S from "@mui/material/ListItem";
4
+ import R from "@mui/material/ListItemButton";
5
+ import D from "@mui/material/ListItemIcon";
6
+ import A from "@mui/material/ListItemText";
7
+ import h from "@mui/material/Stack";
8
+ import { Text as b } from "@mxenabled/mxui";
9
+ import { makeAutoObservable as N } from "mobx";
10
+ import { addSeconds as v } from "date-fns/addSeconds";
11
+ import { differenceInCalendarMonths as w } from "date-fns/differenceInCalendarMonths";
12
+ import { endOfMonth as _ } from "date-fns/endOfMonth";
13
+ import { subMonths as I } from "date-fns/subMonths";
14
+ import { b as E, C, c as f } from "./Category-CevNQ03n.mjs";
15
+ import { f as L, a as M } from "./Dialog-BPTr3qHE.mjs";
16
+ const rt = ({
17
+ onClick: e,
18
+ leftIcon: t,
19
+ rightIcon: o,
20
+ title: r,
21
+ subtitle: n,
22
+ rightContent: a,
23
+ titleBold: i = !0,
24
+ rightContentBold: c = !0
25
+ }) => {
26
+ const g = /* @__PURE__ */ u(x.Fragment, { children: [
27
+ t && /* @__PURE__ */ l(D, { sx: { ml: 0 }, children: t }),
28
+ /* @__PURE__ */ l(A, { children: /* @__PURE__ */ u(
29
+ h,
30
+ {
31
+ sx: {
32
+ alignItems: "center",
33
+ flexDirection: "row",
34
+ marginLeft: 12
35
+ },
36
+ children: [
37
+ /* @__PURE__ */ u(h, { sx: { flex: 1, minWidth: 0 }, children: [
38
+ /* @__PURE__ */ l(b, { bold: i, variant: "body1", children: r }),
39
+ n && /* @__PURE__ */ l(b, { variant: "caption", children: n })
40
+ ] }),
41
+ /* @__PURE__ */ u(h, { sx: { flexDirection: "row", alignItems: "center", gap: 1 }, children: [
42
+ a && /* @__PURE__ */ l(b, { bold: c, display: "flex", variant: "body1", children: a }),
43
+ o && /* @__PURE__ */ l(D, { children: o })
44
+ ] })
45
+ ]
46
+ }
47
+ ) })
48
+ ] });
49
+ return /* @__PURE__ */ l(S, { sx: { bgcolor: "background.paper" }, children: e ? /* @__PURE__ */ l(
50
+ R,
51
+ {
52
+ onClick: e,
53
+ sx: {
54
+ py: 14
55
+ },
56
+ children: g
57
+ }
58
+ ) : /* @__PURE__ */ l(
59
+ h,
60
+ {
61
+ sx: {
62
+ py: 14,
63
+ px: 24,
64
+ width: "100%",
65
+ flexDirection: "row",
66
+ alignItems: "center"
67
+ },
68
+ children: g
69
+ }
70
+ ) });
71
+ }, O = (e) => C[e] ?? C.default, W = (e) => f[e];
72
+ function F(e, t) {
73
+ const o = [], r = new Date(e);
74
+ for (; r <= t; ) {
75
+ const n = r.getFullYear(), a = String(r.getMonth() + 1).padStart(2, "0");
76
+ o.push(+`${n}${a}`), r.setMonth(r.getMonth() + 1);
77
+ }
78
+ return o;
79
+ }
80
+ const G = (e) => e.reduce((t, o) => {
81
+ const r = {
82
+ top_level_category_guid: o.top_level_category_guid,
83
+ category_guid: o.category_guid,
84
+ amount: o.total,
85
+ year_month: o.year_month
86
+ }, { top_level_category_guid: n, category_guid: a } = r;
87
+ return t[a] || (t[a] = []), t[a].push(r), n !== a && (t[n] || (t[n] = []), t[n].push(r)), t;
88
+ }, {}), at = (e, t, o) => {
89
+ const r = G(e), n = F(t, o);
90
+ return Object.entries(r).map(([a, i]) => {
91
+ const c = i[0].top_level_category_guid, g = n.map((m) => {
92
+ const s = i.filter((y) => y.year_month === m).reduce((y, T) => y + Math.abs(T.amount), 0), d = Number(String(m).slice(0, 4)), p = Number(String(m).slice(4));
93
+ return { x: new Date(d, p - 1), y: s };
94
+ }).sort((m, s) => m.x.getTime() - s.x.getTime());
95
+ return {
96
+ top_level_category_guid: c,
97
+ category_guid: a,
98
+ category_name: W(a),
99
+ category_color: O(c),
100
+ dataset: g
101
+ };
102
+ });
103
+ }, nt = (e, t) => {
104
+ const o = typeof e == "string" ? parseFloat(e.replace(/[^0-9.-]+/g, "")) : e, r = typeof t == "string" ? parseFloat(t.replace(/[^0-9.-]+/g, "")) : t;
105
+ return (o || 0) - (r || 0);
106
+ }, st = (e, t) => {
107
+ const o = f[e] || "", r = f[t] || "";
108
+ return o.localeCompare(r);
109
+ }, $ = (e, t) => {
110
+ const o = e.subCategories.filter((a) => a.currentAmount !== 0), r = e.totalMonthlyAmounts.slice(-t), n = (a) => a.substring(0, 3) + " " + a.slice(-4);
111
+ return r.map((a) => {
112
+ const i = n(a.label), c = o.map((s) => {
113
+ const d = s.monthlyAmounts.slice(-t).find((p) => n(p.label) === i);
114
+ return {
115
+ label: s.name,
116
+ amount: Math.abs(d?.amount || 0),
117
+ header: i
118
+ };
119
+ }), g = e.monthlyAmounts.slice(-t).find((s) => n(s.label) === i);
120
+ return [{
121
+ label: e.name,
122
+ amount: Math.abs(g?.amount || 0),
123
+ header: i
124
+ }, ...c].sort((s, d) => d.amount - s.amount);
125
+ });
126
+ }, j = (e, t) => {
127
+ const o = e ? e.totalMonthlyAmounts.slice(-t).map((n) => ({
128
+ x: n.label.substring(0, 3),
129
+ y: Math.abs(n.amount)
130
+ })) : [], r = e ? $(e, t) : [];
131
+ return { monthlyAmounts: o, tooltipLabels: r };
132
+ }, k = (e) => e.slice().filter(
133
+ (t) => t.totalAmount !== 0 && !t.isTransfer && t.guid !== E.INVESTMENTS
134
+ ).sort((t, o) => Math.abs(o.totalAmount) - Math.abs(t.totalAmount));
135
+ class it {
136
+ globalStore;
137
+ selectedCategoryData = null;
138
+ selectedDateRange;
139
+ visibleListLength = 5;
140
+ constructor(t) {
141
+ this.globalStore = t, this.selectedDateRange = {
142
+ start: v(_(I(/* @__PURE__ */ new Date(), 6)), 1),
143
+ end: _(/* @__PURE__ */ new Date())
144
+ }, N(this);
145
+ }
146
+ setSelectedCategoryData = (t) => {
147
+ this.selectedCategoryData = t;
148
+ };
149
+ setSelectedDateRange = (t) => {
150
+ this.selectedDateRange = t;
151
+ };
152
+ setVisibleListLength = (t) => {
153
+ this.visibleListLength = t;
154
+ };
155
+ get sortedDetailedCategoriesWithTransactions() {
156
+ return k(
157
+ this.globalStore.categoryStore.detailedCategoriesWithTransactions
158
+ );
159
+ }
160
+ get selectedDateRangeMonthCount() {
161
+ return w(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
162
+ }
163
+ get selectedDateRangeMonthRange() {
164
+ const t = L(this.selectedDateRange.start, M.MONTH_LONG), o = L(this.selectedDateRange.end, M.MONTH_LONG);
165
+ return `${t} - ${o}`;
166
+ }
167
+ get visibleCategories() {
168
+ return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
169
+ }
170
+ get collapsedCategories() {
171
+ return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
172
+ }
173
+ get categoryDetailsChartData() {
174
+ return j(
175
+ this.selectedCategoryData,
176
+ this.selectedDateRangeMonthCount
177
+ );
178
+ }
179
+ }
180
+ export {
181
+ rt as L,
182
+ it as T,
183
+ nt as a,
184
+ st as c,
185
+ at as g
186
+ };
@@ -10,7 +10,7 @@ import { Text as g } from "@mxenabled/mxui";
10
10
  import { useTheme as Q } from "@mui/material/styles";
11
11
  import { u as U, A as X } from "../AccountDetailsHeader-BkG3MNYo.mjs";
12
12
  import { L as e1 } from "../LineChart-BQRxZF3p.mjs";
13
- import { g as t1, a as n1, b as l1 } from "../SpendingData-BuJ03S9d.mjs";
13
+ import { g as t1, a as n1, b as l1 } from "../SpendingData-DQ1b9uqq.mjs";
14
14
  import { m as i1, u as M, b as S, d as W, g as P, a as o1 } from "../hooks-ZMp65DFz.mjs";
15
15
  import { A as I, l as G, m as C1 } from "../ConnectDrawer-BkvlItWx.mjs";
16
16
  import { F as C3, M as d3 } from "../ConnectDrawer-BkvlItWx.mjs";
@@ -1,5 +1,5 @@
1
1
  import { b as o, C as a, a as t, u as C } from "../CategorySelectorDrawer-B-I3kajA.mjs";
2
- import { C as g } from "../CategoryStore-U7hOZAbP.mjs";
2
+ import { C as g } from "../CategoryStore-gILjk6Jj.mjs";
3
3
  export {
4
4
  o as CategoryRow,
5
5
  a as CategorySelector,
@@ -16,6 +16,7 @@ export declare class CategoryStore {
16
16
  get incomeCategories(): DetailedCategory[];
17
17
  get spendCategories(): DetailedCategory[];
18
18
  get transferCategories(): DetailedCategory[];
19
+ get trendsCategories(): DetailedCategory[];
19
20
  addCategory: (name: string, parentGuid: string) => Promise<void>;
20
21
  loadCategories: (categoriesOverride?: Category[]) => Promise<void>;
21
22
  loadDateRangeCategoryTotals: (accounts: Account[], startDate: Date, endDate: Date) => Promise<void>;
@@ -2,8 +2,8 @@ import { G as $ } from "../useCombineEvents-CRwX-qWE.mjs";
2
2
  import { A as rs, a as os, u as as, b as ns } from "../useCombineEvents-CRwX-qWE.mjs";
3
3
  import { F as S, A as h } from "../Fetch-DecPFeGU.mjs";
4
4
  import { B as cs } from "../BeatApi-De2IaqH2.mjs";
5
- import { C as et } from "../CategoryStore-U7hOZAbP.mjs";
6
- import { a as ls } from "../CategoryStore-U7hOZAbP.mjs";
5
+ import { C as et } from "../CategoryStore-gILjk6Jj.mjs";
6
+ import { a as ls } from "../CategoryStore-gILjk6Jj.mjs";
7
7
  import { N as st } from "../NotificationStore-CDX_kqHa.mjs";
8
8
  import { a as hs } from "../NotificationStore-CDX_kqHa.mjs";
9
9
  import { T as rt } from "../User-Cnlegl1N.mjs";
@@ -30,8 +30,8 @@ import { C as mr, G as _r, M as fr, T as yr } from "../GoalStore-1P19goZ7.mjs";
30
30
  import { C as br } from "../CurrencyText-Dr0EZ7bp.mjs";
31
31
  import { E as xr } from "../EmptyState-DoxNUae-.mjs";
32
32
  import { L as vr } from "../ListItemAction-BxTkF6Tz.mjs";
33
- import { T as ct } from "../TrendsStore-BW9FGQeE.mjs";
34
- import { L as Ar } from "../TrendsStore-BW9FGQeE.mjs";
33
+ import { T as ct } from "../TrendsStore-yO7qYv97.mjs";
34
+ import { L as Ar } from "../TrendsStore-yO7qYv97.mjs";
35
35
  import { A as Tr, B as Br, I as Ir, N as Nr, T as Mr, a as $r } from "../ToggleListItem-ciFTiqRS.mjs";
36
36
  import { jsxs as y, jsx as n } from "react/jsx-runtime";
37
37
  import dt, { useRef as lt, useEffect as ut } from "react";
@@ -59,7 +59,7 @@ const k = {
59
59
  }
60
60
  ),
61
61
  /* @__PURE__ */ r(t, { sx: { gap: 6 }, children: [
62
- /* @__PURE__ */ e(t, { sx: { flexDirection: "row", justifyContent: "space-between" }, children: /* @__PURE__ */ e(i, { bold: !0, sx: { lineHeight: 16 }, variant: "body1", children: b }) }),
62
+ /* @__PURE__ */ e(t, { sx: { flexDirection: "row", justifyContent: "space-between" }, children: /* @__PURE__ */ e(i, { bold: !0, sx: { lineHeight: "16px" }, variant: "body1", children: b }) }),
63
63
  /* @__PURE__ */ e(
64
64
  M,
65
65
  {
@@ -1,9 +1,7 @@
1
1
  import { default as React } from 'react';
2
- import { MonthlyCategoryTotals } from '../../common';
3
2
  interface TrendsTableProps {
4
3
  sx?: any;
5
4
  height?: number | string;
6
- monthlyCategoryTotals: MonthlyCategoryTotals[];
7
5
  selectedDateRange: {
8
6
  start: Date;
9
7
  end: Date;