@mx-cartographer/experiences 7.2.15-alpha-ram11-finstrong-testing → 7.2.15-alpha-ram13-finstrong-testing
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/dist/{AccountStore-CBtethNX.mjs → AccountStore-Dh6xUXTr.mjs} +4 -5
- package/dist/CategoryStore-B64CUGgx.mjs +183 -0
- package/dist/accounts/index.es.js +1 -1
- package/dist/categories/index.es.js +1 -1
- package/dist/categories/stores/CategoryStore.d.ts +1 -1
- package/dist/common/index.es.js +3 -3
- package/dist/finstrong/index.es.js +291 -297
- package/package.json +1 -1
- package/dist/CategoryStore-C8X_SKgM.mjs +0 -220
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { makeAutoObservable as _, runInAction as a } from "mobx";
|
|
2
2
|
import { i as f } from "./User-wXzDI4M8.mjs";
|
|
3
3
|
import { F as p, A as i } from "./Fetch-87LIQbEA.mjs";
|
|
4
|
-
import { A as c, h as d, d as h, E as y, i as I, j as
|
|
4
|
+
import { A as c, h as d, d as h, E as y, i as I, j as C } from "./ConnectDrawer-CuUj16NH.mjs";
|
|
5
5
|
class A {
|
|
6
6
|
fetchInstance;
|
|
7
7
|
constructor(t, e, n) {
|
|
@@ -17,7 +17,7 @@ class A {
|
|
|
17
17
|
refreshAllMembers = async () => this.fetchInstance.get(`${i.MEMBERS}/refresh_all`).then((t) => t).catch((t) => t);
|
|
18
18
|
updateAccount = async (t) => this.fetchInstance.put(`${i.ACCOUNTS}/${t.guid}`, t).then((e) => e.account).catch((e) => e);
|
|
19
19
|
}
|
|
20
|
-
class
|
|
20
|
+
class b {
|
|
21
21
|
isLoading = !1;
|
|
22
22
|
selectedAccount = {};
|
|
23
23
|
selectedMember = {};
|
|
@@ -36,7 +36,7 @@ class w {
|
|
|
36
36
|
members = [];
|
|
37
37
|
uiStore;
|
|
38
38
|
constructor(t) {
|
|
39
|
-
this.globalStore = t, this.uiStore = new
|
|
39
|
+
this.globalStore = t, this.uiStore = new b(), this.api = new A(t.endpoint, t.sessionToken, t.onError), _(this);
|
|
40
40
|
}
|
|
41
41
|
loadAccountData = async ({
|
|
42
42
|
accounts: t,
|
|
@@ -139,11 +139,10 @@ class w {
|
|
|
139
139
|
);
|
|
140
140
|
console.log(s, "shouldExcludeExternalAccounts");
|
|
141
141
|
for (const o of t) {
|
|
142
|
-
if (s && o.member_is_managed_by_user) continue;
|
|
143
142
|
const r = this.members.find((m) => m.guid === o.member_guid);
|
|
144
143
|
if (!r) continue;
|
|
145
144
|
let u = h.Connected;
|
|
146
|
-
y.includes(r.connection_status) ? u = h.Error : I.includes(r.connection_status) ? u = h.Processing :
|
|
145
|
+
y.includes(r.connection_status) ? u = h.Error : I.includes(r.connection_status) ? u = h.Processing : C.includes(r.connection_status) && (u = h.RequiresMfa);
|
|
147
146
|
const g = [
|
|
148
147
|
o.user_name || o.feed_name || "",
|
|
149
148
|
o.account_number ? `*${o.account_number}` : ""
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
import { makeAutoObservable as u, runInAction as l } from "mobx";
|
|
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-87LIQbEA.mjs";
|
|
8
|
+
import { b as f, c as S } from "./Category-CevNQ03n.mjs";
|
|
9
|
+
class y {
|
|
10
|
+
fetchInstance;
|
|
11
|
+
constructor(t, e, o) {
|
|
12
|
+
this.fetchInstance = new p(t, e, void 0, o);
|
|
13
|
+
}
|
|
14
|
+
addCategory = async (t) => this.fetchInstance.post(i.CATEGORIES, t).then((e) => e.category);
|
|
15
|
+
getCategories = async () => this.fetchInstance.get(i.CATEGORIES).then((t) => t.categories);
|
|
16
|
+
getDateRangeCategoryTotals = async (t, e, o) => o.length === 0 ? [] : this.fetchInstance.post(`${i.DATE_RANGE_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
|
|
17
|
+
account_guid: o.map((a) => a.guid)
|
|
18
|
+
}).then((a) => a.date_range_category_totals);
|
|
19
|
+
getMonthlyCategoryTotals = async (t, e, o) => {
|
|
20
|
+
try {
|
|
21
|
+
const a = `${i.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`;
|
|
22
|
+
if (o) {
|
|
23
|
+
const s = o.length === 0 ? [""] : o.map((C) => C.guid);
|
|
24
|
+
return (await this.fetchInstance.post(a, { account_guid: s })).monthly_category_totals;
|
|
25
|
+
} else
|
|
26
|
+
return (await this.fetchInstance.get(a)).monthly_category_totals;
|
|
27
|
+
} catch (a) {
|
|
28
|
+
throw console.error("Error fetching monthly category totals:", a), a;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
removeCategory = async (t) => this.fetchInstance.delete(`${i.CATEGORIES}/${t}`);
|
|
32
|
+
updateCategory = async (t) => this.fetchInstance.put(`${i.CATEGORIES}/${t.guid}`, t).then((e) => e.category);
|
|
33
|
+
}
|
|
34
|
+
class w {
|
|
35
|
+
expandedGuid = null;
|
|
36
|
+
selectedGuid = null;
|
|
37
|
+
searchValue = "";
|
|
38
|
+
showSelected = !0;
|
|
39
|
+
shouldDisableDrawerScroll = !1;
|
|
40
|
+
unselectable = [];
|
|
41
|
+
unselectableText = "";
|
|
42
|
+
savedOnSelect;
|
|
43
|
+
// todo
|
|
44
|
+
constructor() {
|
|
45
|
+
u(this);
|
|
46
|
+
}
|
|
47
|
+
setExpandedGuid = (t) => this.expandedGuid = t;
|
|
48
|
+
setSelectedGuid = (t) => this.selectedGuid = t;
|
|
49
|
+
setSearchValue = (t) => this.searchValue = t;
|
|
50
|
+
setShouldDisableDrawerScroll = (t) => this.shouldDisableDrawerScroll = t;
|
|
51
|
+
setShowSelected = (t) => this.showSelected = t;
|
|
52
|
+
setUnselectable = (t) => this.unselectable = t;
|
|
53
|
+
setUnselectableText = (t) => this.unselectableText = t;
|
|
54
|
+
onSelect = (t) => this.savedOnSelect(t);
|
|
55
|
+
setOnSelect = (t) => this.savedOnSelect = t;
|
|
56
|
+
}
|
|
57
|
+
class A {
|
|
58
|
+
globalStore;
|
|
59
|
+
uiStore;
|
|
60
|
+
api = new y("/", "");
|
|
61
|
+
categories = [];
|
|
62
|
+
dateRangeCategoryTotals = [];
|
|
63
|
+
monthlyCategoryTotals = [];
|
|
64
|
+
dataRangeTotalsLoaded = !1;
|
|
65
|
+
isLoadingCategoryTotals = !1;
|
|
66
|
+
monthlyTotalsLoaded = !1;
|
|
67
|
+
constructor(t) {
|
|
68
|
+
this.globalStore = t, this.uiStore = new w(), this.api = new y(t.endpoint, t.sessionToken, t.onError), u(this);
|
|
69
|
+
}
|
|
70
|
+
get detailedCategories() {
|
|
71
|
+
return T(
|
|
72
|
+
this.categories,
|
|
73
|
+
this.dateRangeCategoryTotals,
|
|
74
|
+
this.monthlyCategoryTotals
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
get detailedCategoriesWithTransactions() {
|
|
78
|
+
return m(
|
|
79
|
+
this.detailedCategories,
|
|
80
|
+
this.globalStore.transactionStore.sortedTransactions
|
|
81
|
+
);
|
|
82
|
+
}
|
|
83
|
+
get incomeCategories() {
|
|
84
|
+
return this.detailedCategories.filter((t) => t.is_income);
|
|
85
|
+
}
|
|
86
|
+
get spendCategories() {
|
|
87
|
+
return this.detailedCategories.filter(
|
|
88
|
+
(t) => !t.is_income && !t.isTransfer && t.guid !== f.INVESTMENTS
|
|
89
|
+
);
|
|
90
|
+
}
|
|
91
|
+
get transferCategories() {
|
|
92
|
+
return this.detailedCategories.filter((t) => t.isTransfer);
|
|
93
|
+
}
|
|
94
|
+
addCategory = async (t, e) => {
|
|
95
|
+
const o = { name: t, parent_guid: e };
|
|
96
|
+
try {
|
|
97
|
+
await this.api.addCategory(o), await this.loadCategories();
|
|
98
|
+
} catch (a) {
|
|
99
|
+
console.error(`Error occurred while adding category: ${a}`);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
loadCategories = async (t) => {
|
|
103
|
+
try {
|
|
104
|
+
const e = t || await this.api.getCategories(), { default_categories: o } = this.globalStore.copyStore.copy.categories;
|
|
105
|
+
l(() => {
|
|
106
|
+
this.categories = e.map((a) => ({
|
|
107
|
+
...a,
|
|
108
|
+
name: o[a.guid] ? o[a.guid].replace(/&/g, "&") : a.name
|
|
109
|
+
}));
|
|
110
|
+
});
|
|
111
|
+
} catch (e) {
|
|
112
|
+
console.error(`Error occurred while getting categories: ${e}`);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
loadDateRangeCategoryTotals = async (t, e, o) => {
|
|
116
|
+
this.setIsLoadingCategoryTotals(!0);
|
|
117
|
+
try {
|
|
118
|
+
const a = await this.api.getDateRangeCategoryTotals(
|
|
119
|
+
e ? r(e) : 17619552e5,
|
|
120
|
+
o ? r(o) : 1764633599e3,
|
|
121
|
+
t
|
|
122
|
+
);
|
|
123
|
+
console.log(e, o, "start date", "enddate"), console.log(JSON.parse(JSON.stringify(a)), "totals"), l(() => {
|
|
124
|
+
this.dateRangeCategoryTotals = a, this.setIsLoadingCategoryTotals(!1), this.dataRangeTotalsLoaded = !0;
|
|
125
|
+
});
|
|
126
|
+
} catch (a) {
|
|
127
|
+
this.setIsLoadingCategoryTotals(!1), console.error(`Error occurred while getting date range category totals: ${a}`);
|
|
128
|
+
}
|
|
129
|
+
};
|
|
130
|
+
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()));
|
|
132
|
+
try {
|
|
133
|
+
const n = await this.api.getMonthlyCategoryTotals(a, s, t);
|
|
134
|
+
l(() => {
|
|
135
|
+
this.monthlyCategoryTotals = n, this.monthlyTotalsLoaded = !0;
|
|
136
|
+
});
|
|
137
|
+
} catch (n) {
|
|
138
|
+
console.error(`Error occurred while getting monthly category totals: ${n}`);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
reloadCategoryTotals = async (t, e, o) => {
|
|
142
|
+
this.setIsLoadingCategoryTotals(!0);
|
|
143
|
+
try {
|
|
144
|
+
const a = await this.api.getDateRangeCategoryTotals(
|
|
145
|
+
r(e),
|
|
146
|
+
r(o),
|
|
147
|
+
t
|
|
148
|
+
), s = await this.api.getMonthlyCategoryTotals(
|
|
149
|
+
r(h(g(o, 11))),
|
|
150
|
+
r(d(o)),
|
|
151
|
+
t
|
|
152
|
+
);
|
|
153
|
+
l(() => {
|
|
154
|
+
this.dateRangeCategoryTotals = a, this.monthlyCategoryTotals = s, this.dataRangeTotalsLoaded = !0, this.monthlyTotalsLoaded = !0, this.setIsLoadingCategoryTotals(!1);
|
|
155
|
+
});
|
|
156
|
+
} catch (a) {
|
|
157
|
+
console.error(`Error occurred while getting category totals: ${a}`);
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
removeCategory = async (t) => {
|
|
161
|
+
try {
|
|
162
|
+
await this.api.removeCategory(t), await this.loadCategories();
|
|
163
|
+
} catch (e) {
|
|
164
|
+
console.error(`Error occurred while removing category: ${e}`);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
setIsLoadingCategoryTotals = (t) => {
|
|
168
|
+
this.isLoadingCategoryTotals = t;
|
|
169
|
+
};
|
|
170
|
+
updateCategory = async (t) => {
|
|
171
|
+
try {
|
|
172
|
+
await this.api.updateCategory(t), await this.loadCategories();
|
|
173
|
+
} catch (e) {
|
|
174
|
+
console.error(`Error occurred while updating category: ${e}`);
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
// TODO: Remove this after refactoring Trends components to use detailedCategories
|
|
178
|
+
getCategoryName = (t) => this.categories.find((o) => o.guid === t)?.name ?? S[t];
|
|
179
|
+
}
|
|
180
|
+
export {
|
|
181
|
+
A as C,
|
|
182
|
+
y as a
|
|
183
|
+
};
|
|
@@ -25,7 +25,7 @@ import { F as G1, M as K1 } from "../ConnectDrawer-CuUj16NH.mjs";
|
|
|
25
25
|
import t1 from "@mui/material/ListItem";
|
|
26
26
|
import { M as $ } from "../MiniWidgetContainer-CmXpTylX.mjs";
|
|
27
27
|
import l1 from "@mui/material/Stack";
|
|
28
|
-
import { A as P1, a as Y1 } from "../AccountStore-
|
|
28
|
+
import { A as P1, a as Y1 } from "../AccountStore-Dh6xUXTr.mjs";
|
|
29
29
|
const i1 = () => {
|
|
30
30
|
const [c, H] = d.useState(""), { accounts: C } = w(), { selectedAccounts: l } = S(), { setSelectedAccount: h, setSelectedMember: r } = z(), { members: L } = T(), { onEvent: f } = D(), s = [...new Set(l.map((t) => t.account_type))], a = l.find((t) => c === t.guid), u = d.useMemo(
|
|
31
31
|
() => l.filter((t) => t.is_hidden),
|
|
@@ -18,7 +18,7 @@ export declare class CategoryStore {
|
|
|
18
18
|
get transferCategories(): DetailedCategory[];
|
|
19
19
|
addCategory: (name: string, parentGuid: string) => Promise<void>;
|
|
20
20
|
loadCategories: (categoriesOverride?: Category[]) => Promise<void>;
|
|
21
|
-
loadDateRangeCategoryTotals: (accounts: Account[], startDate
|
|
21
|
+
loadDateRangeCategoryTotals: (accounts: Account[], startDate?: Date, endDate?: Date) => Promise<void>;
|
|
22
22
|
loadMonthlyCategoryTotals: (accounts?: Account[], startDate?: Date, endDate?: Date) => Promise<void>;
|
|
23
23
|
reloadCategoryTotals: (accounts: Account[], startDate: Date, endDate: Date) => Promise<void>;
|
|
24
24
|
removeCategory: (guid: string) => Promise<void>;
|
package/dist/common/index.es.js
CHANGED
|
@@ -2,8 +2,8 @@ import { G as k } from "../useCombineEvents-BUDIR1ba.mjs";
|
|
|
2
2
|
import { A as ss, a as rs, u as os, b as as } from "../useCombineEvents-BUDIR1ba.mjs";
|
|
3
3
|
import { F as S, A as h } from "../Fetch-87LIQbEA.mjs";
|
|
4
4
|
import { B as is } from "../BeatApi-DhJpgCLz.mjs";
|
|
5
|
-
import { C as et } from "../CategoryStore-
|
|
6
|
-
import { a as ds } from "../CategoryStore-
|
|
5
|
+
import { C as et } from "../CategoryStore-B64CUGgx.mjs";
|
|
6
|
+
import { a as ds } from "../CategoryStore-B64CUGgx.mjs";
|
|
7
7
|
import { N as st } from "../NotificationStore-C6PH6MKm.mjs";
|
|
8
8
|
import { a as us } from "../NotificationStore-C6PH6MKm.mjs";
|
|
9
9
|
import { T as rt } from "../User-wXzDI4M8.mjs";
|
|
@@ -55,7 +55,7 @@ import { u as Xo } from "../useAccountDisplayName-CMMlIOXF.mjs";
|
|
|
55
55
|
import { u as Ko } from "../useInsightsEnabled-CNjP5cfR.mjs";
|
|
56
56
|
import { u as Zo } from "../useScreenSize-B6JyS_Lj.mjs";
|
|
57
57
|
import { makeAutoObservable as f, runInAction as p, reaction as _t } from "mobx";
|
|
58
|
-
import { a as ft } from "../AccountStore-
|
|
58
|
+
import { a as ft } from "../AccountStore-Dh6xUXTr.mjs";
|
|
59
59
|
import yt from "posthog-js";
|
|
60
60
|
import { B as St } from "../BeatStore-IBnXd4YK.mjs";
|
|
61
61
|
import { endOfMonth as Z } from "date-fns/endOfMonth";
|