@mx-cartographer/experiences 7.2.15-alpha-ram9-finstrong-testing → 7.2.15-alpha-ram11-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-Cj8gkPYI.mjs → AccountStore-CBtethNX.mjs} +2 -1
- package/dist/CategoryStore-C8X_SKgM.mjs +220 -0
- package/dist/accounts/index.es.js +1 -1
- package/dist/categories/index.es.js +1 -1
- package/dist/common/index.es.js +3 -3
- package/package.json +1 -1
- package/dist/CategoryStore-2mI6CCiD.mjs +0 -183
|
@@ -83,7 +83,7 @@ class w {
|
|
|
83
83
|
);
|
|
84
84
|
}
|
|
85
85
|
get visibleAccounts() {
|
|
86
|
-
return this.accounts.filter((t) => !t.is_hidden
|
|
86
|
+
return this.accounts.filter((t) => !t.is_hidden);
|
|
87
87
|
}
|
|
88
88
|
get visibleCashAccounts() {
|
|
89
89
|
return this.cashAccounts.filter((t) => !t.is_hidden);
|
|
@@ -137,6 +137,7 @@ class w {
|
|
|
137
137
|
n,
|
|
138
138
|
"MD_EXCLUDE_EXTERNAL_ACCOUNTS"
|
|
139
139
|
);
|
|
140
|
+
console.log(s, "shouldExcludeExternalAccounts");
|
|
140
141
|
for (const o of t) {
|
|
141
142
|
if (s && o.member_is_managed_by_user) continue;
|
|
142
143
|
const r = this.members.find((m) => m.guid === o.member_guid);
|
|
@@ -0,0 +1,220 @@
|
|
|
1
|
+
import { makeAutoObservable as C, runInAction as n } from "mobx";
|
|
2
|
+
import { getUnixTime as r } from "date-fns/getUnixTime";
|
|
3
|
+
import { subMonths as l } from "date-fns/subMonths";
|
|
4
|
+
import { startOfMonth as g } from "date-fns/startOfMonth";
|
|
5
|
+
import { endOfMonth as h } from "date-fns/endOfMonth";
|
|
6
|
+
import { a as b, g as y } from "./CategoryUtil-DUM8NuGO.mjs";
|
|
7
|
+
import { F as u, A as c } from "./Fetch-87LIQbEA.mjs";
|
|
8
|
+
import { b as A, c as m } from "./Category-CevNQ03n.mjs";
|
|
9
|
+
class f {
|
|
10
|
+
fetchInstance;
|
|
11
|
+
constructor(e, t, o) {
|
|
12
|
+
this.fetchInstance = new u(e, t, void 0, o);
|
|
13
|
+
}
|
|
14
|
+
addCategory = async (e) => this.fetchInstance.post(c.CATEGORIES, e).then((t) => t.category);
|
|
15
|
+
getCategories = async () => this.fetchInstance.get(c.CATEGORIES).then((e) => e.categories);
|
|
16
|
+
getDateRangeCategoryTotals = async (e, t, o) => o.length === 0 ? [] : this.fetchInstance.post(`${c.DATE_RANGE_CATEGORY_TOTALS}/from/${e}/to/${t}`, {
|
|
17
|
+
account_guid: [
|
|
18
|
+
"ACT-cdcb176b-5bb3-4011-a682-ec68e8a5ae85",
|
|
19
|
+
"ACT-16092890-0d3c-465c-85c5-3e66a2713885",
|
|
20
|
+
"ACT-d004e7ae-b748-4353-8211-834b7fc50143",
|
|
21
|
+
"ACT-453215c4-04fc-4f11-94dd-06c01819f889",
|
|
22
|
+
"ACT-5e6c333b-7236-4681-a520-ef0e01ee76fd",
|
|
23
|
+
"ACT-551f2234-1f2b-4706-af40-ebb92af73582",
|
|
24
|
+
"ACT-33b06fa7-74ad-4819-9d25-fd21ae2db370",
|
|
25
|
+
"ACT-08ea6516-9d02-4a73-a204-a204dc286671",
|
|
26
|
+
"ACT-d6cb8266-6365-45a9-8693-df263b3adaef",
|
|
27
|
+
"ACT-82b0641f-9d9e-4e81-afc0-887dd14e9220",
|
|
28
|
+
"ACT-e0c40141-b390-48af-abeb-346351c5cdf9",
|
|
29
|
+
"ACT-14937593-e375-48b7-8bd1-0f19a3926917",
|
|
30
|
+
"ACT-cb4dafd5-00c1-432c-8128-f7e7feea548c",
|
|
31
|
+
"ACT-3358d236-7819-4316-aabd-6c2bc7114c21",
|
|
32
|
+
"ACT-d7cf56cd-2b86-4d39-aeb2-953d9f9970b8",
|
|
33
|
+
"ACT-5c6e4140-5d48-4d30-8bb0-7f6f3237f088",
|
|
34
|
+
"ACT-204383a1-4377-48d3-87f0-b99fc9cb2cbc",
|
|
35
|
+
"ACT-c331e814-606d-4d5f-9ec0-342b15252cb7",
|
|
36
|
+
"ACT-6da8bec2-42d6-434d-bf16-d9ada7467069",
|
|
37
|
+
"ACT-907be5ae-30c6-493b-920c-92f002876b87",
|
|
38
|
+
"ACT-21c8461f-bcc0-4807-8e4f-b745f70fca57",
|
|
39
|
+
"ACT-dce95a0a-f57c-42d3-a2e7-dce6ec4304f3",
|
|
40
|
+
"ACT-3145e21c-9b29-425b-a354-f850d3b09b11",
|
|
41
|
+
"ACT-ecb30af0-2230-4e4b-a123-305bfb197be9",
|
|
42
|
+
"ACT-92bb79a5-de92-42af-a38e-f91a5c06af69",
|
|
43
|
+
"ACT-b38d599e-72d4-42bd-ac77-33ac27132dbd",
|
|
44
|
+
"ACT-703d0a24-388a-4f9b-bb5d-8b8ed4364fa1",
|
|
45
|
+
"ACT-f9063bbc-9aef-4788-8298-85c964219cc8",
|
|
46
|
+
"ACT-7a70929e-3a5a-40ce-a674-4eb874d7161c",
|
|
47
|
+
"ACT-2a1ff26d-5101-460d-a989-4428dcea5418",
|
|
48
|
+
"ACT-c03b6353-9cb8-44e2-ad0f-5569934ee367",
|
|
49
|
+
"ACT-92a57dff-d4bf-48e3-828c-6d833b96f358",
|
|
50
|
+
"ACT-375e1000-e465-446e-9458-7edc7937eab7",
|
|
51
|
+
"ACT-ffb04a70-2865-4499-a7a9-7fcf303cf439",
|
|
52
|
+
"ACT-6dfaa634-118b-4f74-8c38-0dd22c38e1e5",
|
|
53
|
+
"ACT-5fd6cbc6-d90a-4b8b-92db-42bc4bd2b916"
|
|
54
|
+
]
|
|
55
|
+
}).then((a) => a.date_range_category_totals);
|
|
56
|
+
getMonthlyCategoryTotals = async (e, t, o) => {
|
|
57
|
+
try {
|
|
58
|
+
const a = `${c.MONTHLY_CATEGORY_TOTALS}/from/${e}/to/${t}`;
|
|
59
|
+
if (o) {
|
|
60
|
+
const s = o.length === 0 ? [""] : o.map((T) => T.guid);
|
|
61
|
+
return (await this.fetchInstance.post(a, { account_guid: s })).monthly_category_totals;
|
|
62
|
+
} else
|
|
63
|
+
return (await this.fetchInstance.get(a)).monthly_category_totals;
|
|
64
|
+
} catch (a) {
|
|
65
|
+
throw console.error("Error fetching monthly category totals:", a), a;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
removeCategory = async (e) => this.fetchInstance.delete(`${c.CATEGORIES}/${e}`);
|
|
69
|
+
updateCategory = async (e) => this.fetchInstance.put(`${c.CATEGORIES}/${e.guid}`, e).then((t) => t.category);
|
|
70
|
+
}
|
|
71
|
+
class p {
|
|
72
|
+
expandedGuid = null;
|
|
73
|
+
selectedGuid = null;
|
|
74
|
+
searchValue = "";
|
|
75
|
+
showSelected = !0;
|
|
76
|
+
shouldDisableDrawerScroll = !1;
|
|
77
|
+
unselectable = [];
|
|
78
|
+
unselectableText = "";
|
|
79
|
+
savedOnSelect;
|
|
80
|
+
// todo
|
|
81
|
+
constructor() {
|
|
82
|
+
C(this);
|
|
83
|
+
}
|
|
84
|
+
setExpandedGuid = (e) => this.expandedGuid = e;
|
|
85
|
+
setSelectedGuid = (e) => this.selectedGuid = e;
|
|
86
|
+
setSearchValue = (e) => this.searchValue = e;
|
|
87
|
+
setShouldDisableDrawerScroll = (e) => this.shouldDisableDrawerScroll = e;
|
|
88
|
+
setShowSelected = (e) => this.showSelected = e;
|
|
89
|
+
setUnselectable = (e) => this.unselectable = e;
|
|
90
|
+
setUnselectableText = (e) => this.unselectableText = e;
|
|
91
|
+
onSelect = (e) => this.savedOnSelect(e);
|
|
92
|
+
setOnSelect = (e) => this.savedOnSelect = e;
|
|
93
|
+
}
|
|
94
|
+
class $ {
|
|
95
|
+
globalStore;
|
|
96
|
+
uiStore;
|
|
97
|
+
api = new f("/", "");
|
|
98
|
+
categories = [];
|
|
99
|
+
dateRangeCategoryTotals = [];
|
|
100
|
+
monthlyCategoryTotals = [];
|
|
101
|
+
dataRangeTotalsLoaded = !1;
|
|
102
|
+
isLoadingCategoryTotals = !1;
|
|
103
|
+
monthlyTotalsLoaded = !1;
|
|
104
|
+
constructor(e) {
|
|
105
|
+
this.globalStore = e, this.uiStore = new p(), this.api = new f(e.endpoint, e.sessionToken, e.onError), C(this);
|
|
106
|
+
}
|
|
107
|
+
get detailedCategories() {
|
|
108
|
+
return b(
|
|
109
|
+
this.categories,
|
|
110
|
+
this.dateRangeCategoryTotals,
|
|
111
|
+
this.monthlyCategoryTotals
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
get detailedCategoriesWithTransactions() {
|
|
115
|
+
return y(
|
|
116
|
+
this.detailedCategories,
|
|
117
|
+
this.globalStore.transactionStore.sortedTransactions
|
|
118
|
+
);
|
|
119
|
+
}
|
|
120
|
+
get incomeCategories() {
|
|
121
|
+
return this.detailedCategories.filter((e) => e.is_income);
|
|
122
|
+
}
|
|
123
|
+
get spendCategories() {
|
|
124
|
+
return this.detailedCategories.filter(
|
|
125
|
+
(e) => !e.is_income && !e.isTransfer && e.guid !== A.INVESTMENTS
|
|
126
|
+
);
|
|
127
|
+
}
|
|
128
|
+
get transferCategories() {
|
|
129
|
+
return this.detailedCategories.filter((e) => e.isTransfer);
|
|
130
|
+
}
|
|
131
|
+
addCategory = async (e, t) => {
|
|
132
|
+
const o = { name: e, parent_guid: t };
|
|
133
|
+
try {
|
|
134
|
+
await this.api.addCategory(o), await this.loadCategories();
|
|
135
|
+
} catch (a) {
|
|
136
|
+
console.error(`Error occurred while adding category: ${a}`);
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
loadCategories = async (e) => {
|
|
140
|
+
try {
|
|
141
|
+
const t = e || await this.api.getCategories(), { default_categories: o } = this.globalStore.copyStore.copy.categories;
|
|
142
|
+
n(() => {
|
|
143
|
+
this.categories = t.map((a) => ({
|
|
144
|
+
...a,
|
|
145
|
+
name: o[a.guid] ? o[a.guid].replace(/&/g, "&") : a.name
|
|
146
|
+
}));
|
|
147
|
+
});
|
|
148
|
+
} catch (t) {
|
|
149
|
+
console.error(`Error occurred while getting categories: ${t}`);
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
loadDateRangeCategoryTotals = async (e, t, o) => {
|
|
153
|
+
this.setIsLoadingCategoryTotals(!0);
|
|
154
|
+
try {
|
|
155
|
+
const a = await this.api.getDateRangeCategoryTotals(
|
|
156
|
+
r(t),
|
|
157
|
+
r(o),
|
|
158
|
+
e
|
|
159
|
+
);
|
|
160
|
+
console.log(t, o, "start date", "enddate"), console.log(JSON.parse(JSON.stringify(a)), "totals"), n(() => {
|
|
161
|
+
this.dateRangeCategoryTotals = a, this.setIsLoadingCategoryTotals(!1), this.dataRangeTotalsLoaded = !0;
|
|
162
|
+
});
|
|
163
|
+
} catch (a) {
|
|
164
|
+
this.setIsLoadingCategoryTotals(!1), console.error(`Error occurred while getting date range category totals: ${a}`);
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
loadMonthlyCategoryTotals = async (e = this.globalStore.globalUiStore.selectedAccounts, t, o) => {
|
|
168
|
+
const a = r(g(t ?? l(/* @__PURE__ */ new Date(), 11))), s = r(h(o ?? /* @__PURE__ */ new Date()));
|
|
169
|
+
try {
|
|
170
|
+
const i = await this.api.getMonthlyCategoryTotals(a, s, e);
|
|
171
|
+
n(() => {
|
|
172
|
+
this.monthlyCategoryTotals = i, this.monthlyTotalsLoaded = !0;
|
|
173
|
+
});
|
|
174
|
+
} catch (i) {
|
|
175
|
+
console.error(`Error occurred while getting monthly category totals: ${i}`);
|
|
176
|
+
}
|
|
177
|
+
};
|
|
178
|
+
reloadCategoryTotals = async (e, t, o) => {
|
|
179
|
+
this.setIsLoadingCategoryTotals(!0);
|
|
180
|
+
try {
|
|
181
|
+
const a = await this.api.getDateRangeCategoryTotals(
|
|
182
|
+
r(t),
|
|
183
|
+
r(o),
|
|
184
|
+
e
|
|
185
|
+
), s = await this.api.getMonthlyCategoryTotals(
|
|
186
|
+
r(g(l(o, 11))),
|
|
187
|
+
r(h(o)),
|
|
188
|
+
e
|
|
189
|
+
);
|
|
190
|
+
n(() => {
|
|
191
|
+
this.dateRangeCategoryTotals = a, this.monthlyCategoryTotals = s, this.dataRangeTotalsLoaded = !0, this.monthlyTotalsLoaded = !0, this.setIsLoadingCategoryTotals(!1);
|
|
192
|
+
});
|
|
193
|
+
} catch (a) {
|
|
194
|
+
console.error(`Error occurred while getting category totals: ${a}`);
|
|
195
|
+
}
|
|
196
|
+
};
|
|
197
|
+
removeCategory = async (e) => {
|
|
198
|
+
try {
|
|
199
|
+
await this.api.removeCategory(e), await this.loadCategories();
|
|
200
|
+
} catch (t) {
|
|
201
|
+
console.error(`Error occurred while removing category: ${t}`);
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
setIsLoadingCategoryTotals = (e) => {
|
|
205
|
+
this.isLoadingCategoryTotals = e;
|
|
206
|
+
};
|
|
207
|
+
updateCategory = async (e) => {
|
|
208
|
+
try {
|
|
209
|
+
await this.api.updateCategory(e), await this.loadCategories();
|
|
210
|
+
} catch (t) {
|
|
211
|
+
console.error(`Error occurred while updating category: ${t}`);
|
|
212
|
+
}
|
|
213
|
+
};
|
|
214
|
+
// TODO: Remove this after refactoring Trends components to use detailedCategories
|
|
215
|
+
getCategoryName = (e) => this.categories.find((o) => o.guid === e)?.name ?? m[e];
|
|
216
|
+
}
|
|
217
|
+
export {
|
|
218
|
+
$ as C,
|
|
219
|
+
f as a
|
|
220
|
+
};
|
|
@@ -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-CBtethNX.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),
|
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-C8X_SKgM.mjs";
|
|
6
|
+
import { a as ds } from "../CategoryStore-C8X_SKgM.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-CBtethNX.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";
|
package/package.json
CHANGED
|
@@ -1,183 +0,0 @@
|
|
|
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
|
-
r(e),
|
|
120
|
-
r(o),
|
|
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
|
-
};
|