@mx-cartographer/experiences 9.4.33 → 9.4.34
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,7 @@
|
|
|
1
|
+
## [9.4.34] - 09-21-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - refreshLoadedCategoryTotals to CategoryStore, which re-fetches category totals using the same accounts and date range as the last fetch
|
|
4
|
+
|
|
1
5
|
## [9.4.33] - 09-21-2026
|
|
2
6
|
|
|
3
7
|
- **CHANGED** - Insights V2 components and hooks migrated to use `insights_payload` keys instead of accessing properties directly from `beat`. `BaseLayout`, `ActionBlockLayer`, and the `useBeatFeedbackFlow` hook now destructure and read content properties (`guid`, `user_guid`, `dismissed_at`, `title`, `sub_title`, `description.html_text`, etc.) from `insights_payload` instead of `beat`. `BaseLayout` also updated to use `insights_payload.guid` instead of `beat.guid` when passing to block components. Updated `InsightsPayload` type with mandatory fields (`guid`, `user_guid`, `dismissed_at`, `is_dismissed`), component implementations, test fixtures (BaseLayout tests cover 37 scenarios), and mock data. Added TODO comment for `in_description_cta` migration pending backend support (WEC-1807)
|
|
@@ -16,6 +16,8 @@ export declare class CategoryStore {
|
|
|
16
16
|
monthlyTotalsLoading: boolean;
|
|
17
17
|
dateRangeTotalsRequestId: number;
|
|
18
18
|
monthlyTotalsRequestId: number;
|
|
19
|
+
private lastDateRangeTotalsArgs;
|
|
20
|
+
private lastMonthlyTotalsArgs;
|
|
19
21
|
constructor(globalStore: GlobalStore);
|
|
20
22
|
get detailedCategories(): DetailedCategory[];
|
|
21
23
|
get detailedCategoriesWithTransactions(): DetailedCategoryWithTransactions[];
|
|
@@ -31,6 +33,7 @@ export declare class CategoryStore {
|
|
|
31
33
|
loadDateRangeCategoryTotals: (accounts: Account[], startDate: Date, endDate: Date) => Promise<void>;
|
|
32
34
|
loadMonthlyCategoryTotals: (accounts?: Account[], startDate?: Date, endDate?: Date) => Promise<void>;
|
|
33
35
|
reloadCategoryTotals: (accounts: Account[], startDate?: Date, endDate?: Date) => Promise<void>;
|
|
36
|
+
refreshLoadedCategoryTotals: () => Promise<void>;
|
|
34
37
|
removeCategory: (guid: string) => Promise<void>;
|
|
35
38
|
updateCategory: (category: Category) => Promise<void>;
|
|
36
39
|
getCategoryName: (guid: string) => string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { CategoryGuidToName as
|
|
1
|
+
import { CategoryGuidToName as T, CategoryGuids as n } from "../constants/Category.es.js";
|
|
2
2
|
import { CategoryApi as d } from "../api/CategoryApi.es.js";
|
|
3
|
-
import { augmentCategories as
|
|
3
|
+
import { augmentCategories as C, getDetailedCategoryTransactions as f } from "../utils/CategoryUtil.es.js";
|
|
4
4
|
import { toUnixUTC as l } from "../utils/DateUtil.es.js";
|
|
5
|
-
import { endOfMonth as
|
|
6
|
-
import { startOfMonth as
|
|
7
|
-
import { subMonths as
|
|
8
|
-
import { makeAutoObservable as
|
|
9
|
-
var
|
|
5
|
+
import { endOfMonth as h } from "date-fns/endOfMonth";
|
|
6
|
+
import { startOfMonth as S } from "date-fns/startOfMonth";
|
|
7
|
+
import { subMonths as c } from "date-fns/subMonths";
|
|
8
|
+
import { makeAutoObservable as y, runInAction as g } from "mobx";
|
|
9
|
+
var A = class {
|
|
10
10
|
globalStore;
|
|
11
11
|
uiStore;
|
|
12
12
|
api = new d("/", "");
|
|
@@ -21,17 +21,21 @@ var I = class {
|
|
|
21
21
|
monthlyTotalsLoading = !1;
|
|
22
22
|
dateRangeTotalsRequestId = 0;
|
|
23
23
|
monthlyTotalsRequestId = 0;
|
|
24
|
+
lastDateRangeTotalsArgs = null;
|
|
25
|
+
lastMonthlyTotalsArgs = null;
|
|
24
26
|
constructor(t) {
|
|
25
|
-
this.globalStore = t, this.uiStore = new
|
|
27
|
+
this.globalStore = t, this.uiStore = new m(), this.api = new d(t.endpoint, t.sessionToken, t.onError), y(this, {
|
|
26
28
|
dateRangeTotalsRequestId: !1,
|
|
27
|
-
monthlyTotalsRequestId: !1
|
|
29
|
+
monthlyTotalsRequestId: !1,
|
|
30
|
+
lastDateRangeTotalsArgs: !1,
|
|
31
|
+
lastMonthlyTotalsArgs: !1
|
|
28
32
|
});
|
|
29
33
|
}
|
|
30
34
|
get detailedCategories() {
|
|
31
|
-
return this.globalStore.isInitialized ?
|
|
35
|
+
return this.globalStore.isInitialized ? C(this.categories, this.globalStore.copyStore.copy.categories, this.dateRangeCategoryTotals, this.monthlyCategoryTotals) : [];
|
|
32
36
|
}
|
|
33
37
|
get detailedCategoriesWithTransactions() {
|
|
34
|
-
return
|
|
38
|
+
return f(this.detailedCategories, this.globalStore.transactionStore.sortedTransactions);
|
|
35
39
|
}
|
|
36
40
|
get incomeCategories() {
|
|
37
41
|
return this.detailedCategories.filter((t) => t.is_income);
|
|
@@ -55,14 +59,14 @@ var I = class {
|
|
|
55
59
|
return this.detailedCategories.filter((t) => t.totalAmount !== 0).filter((t) => t.guid !== n.INVESTMENTS && t.guid !== n.TRANSFER);
|
|
56
60
|
}
|
|
57
61
|
addCategory = async (t, e) => {
|
|
58
|
-
const
|
|
62
|
+
const a = {
|
|
59
63
|
name: t,
|
|
60
64
|
parent_guid: e
|
|
61
65
|
};
|
|
62
66
|
try {
|
|
63
|
-
await this.api.addCategory(
|
|
64
|
-
} catch (
|
|
65
|
-
console.error("Error occurred while adding category:",
|
|
67
|
+
await this.api.addCategory(a), await this.loadCategories();
|
|
68
|
+
} catch (o) {
|
|
69
|
+
console.error("Error occurred while adding category:", o), this.globalStore.captureException(o, { store: "CategoryStore" });
|
|
66
70
|
}
|
|
67
71
|
};
|
|
68
72
|
loadCategories = async () => {
|
|
@@ -78,38 +82,58 @@ var I = class {
|
|
|
78
82
|
}
|
|
79
83
|
}
|
|
80
84
|
};
|
|
81
|
-
loadDateRangeCategoryTotals = async (t, e,
|
|
82
|
-
const
|
|
83
|
-
|
|
85
|
+
loadDateRangeCategoryTotals = async (t, e, a) => {
|
|
86
|
+
const o = ++this.dateRangeTotalsRequestId, s = () => o !== this.dateRangeTotalsRequestId;
|
|
87
|
+
this.lastDateRangeTotalsArgs = {
|
|
88
|
+
accounts: t,
|
|
89
|
+
startDate: e,
|
|
90
|
+
endDate: a
|
|
91
|
+
}, g(() => {
|
|
84
92
|
this.dateRangeTotalsLoading = !0;
|
|
85
93
|
});
|
|
86
94
|
try {
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
89
|
-
this.setDateRangeCategoryTotals(
|
|
90
|
-
} catch (
|
|
91
|
-
if (
|
|
92
|
-
console.error("Error occurred while getting date range category totals:",
|
|
95
|
+
const r = await this.api.getDateRangeCategoryTotals(l(e), l(a), t);
|
|
96
|
+
if (s()) return;
|
|
97
|
+
this.setDateRangeCategoryTotals(r);
|
|
98
|
+
} catch (r) {
|
|
99
|
+
if (s()) return;
|
|
100
|
+
console.error("Error occurred while getting date range category totals:", r), this.globalStore.captureException(r, { store: "CategoryStore" }), this.setDateRangeCategoryTotals([]);
|
|
93
101
|
}
|
|
94
102
|
};
|
|
95
|
-
loadMonthlyCategoryTotals = async (t = this.globalStore.globalUiStore.selectedAccounts, e,
|
|
96
|
-
const
|
|
97
|
-
|
|
103
|
+
loadMonthlyCategoryTotals = async (t = this.globalStore.globalUiStore.selectedAccounts, e, a) => {
|
|
104
|
+
const o = ++this.monthlyTotalsRequestId, s = () => o !== this.monthlyTotalsRequestId;
|
|
105
|
+
this.lastMonthlyTotalsArgs = {
|
|
106
|
+
accounts: t,
|
|
107
|
+
startDate: e,
|
|
108
|
+
endDate: a
|
|
109
|
+
}, g(() => {
|
|
98
110
|
this.monthlyTotalsLoading = !0;
|
|
99
111
|
});
|
|
100
|
-
const
|
|
112
|
+
const r = l(S(e ?? c(/* @__PURE__ */ new Date(), 11))), u = l(h(a ?? /* @__PURE__ */ new Date()));
|
|
101
113
|
try {
|
|
102
|
-
const i = await this.api.getMonthlyCategoryTotals(
|
|
103
|
-
if (
|
|
114
|
+
const i = await this.api.getMonthlyCategoryTotals(r, u, t);
|
|
115
|
+
if (s()) return;
|
|
104
116
|
this.setMonthlyCategoryTotals(i);
|
|
105
117
|
} catch (i) {
|
|
106
|
-
if (
|
|
118
|
+
if (s()) return;
|
|
107
119
|
console.error("Error occurred while getting monthly category totals:", i), this.globalStore.captureException(i, { store: "CategoryStore" }), this.setMonthlyCategoryTotals([]);
|
|
108
120
|
}
|
|
109
121
|
};
|
|
110
|
-
reloadCategoryTotals = async (t, e,
|
|
111
|
-
const
|
|
112
|
-
await Promise.all([this.loadMonthlyCategoryTotals(t,
|
|
122
|
+
reloadCategoryTotals = async (t, e, a) => {
|
|
123
|
+
const o = e ?? c(/* @__PURE__ */ new Date(), 11), s = a ?? h(/* @__PURE__ */ new Date());
|
|
124
|
+
await Promise.all([this.loadMonthlyCategoryTotals(t, o, s), this.loadDateRangeCategoryTotals(t, o, s)]);
|
|
125
|
+
};
|
|
126
|
+
refreshLoadedCategoryTotals = async () => {
|
|
127
|
+
const t = [];
|
|
128
|
+
if (this.lastDateRangeTotalsArgs) {
|
|
129
|
+
const { accounts: e, startDate: a, endDate: o } = this.lastDateRangeTotalsArgs;
|
|
130
|
+
t.push(this.loadDateRangeCategoryTotals(e, a, o));
|
|
131
|
+
}
|
|
132
|
+
if (this.lastMonthlyTotalsArgs) {
|
|
133
|
+
const { accounts: e, startDate: a, endDate: o } = this.lastMonthlyTotalsArgs;
|
|
134
|
+
t.push(this.loadMonthlyCategoryTotals(e, a, o));
|
|
135
|
+
}
|
|
136
|
+
await Promise.all(t);
|
|
113
137
|
};
|
|
114
138
|
removeCategory = async (t) => {
|
|
115
139
|
try {
|
|
@@ -125,8 +149,8 @@ var I = class {
|
|
|
125
149
|
console.error("Error occurred while updating category:", e), this.globalStore.captureException(e, { store: "CategoryStore" });
|
|
126
150
|
}
|
|
127
151
|
};
|
|
128
|
-
getCategoryName = (t) => this.categories.find((e) => e.guid === t)?.name ??
|
|
129
|
-
},
|
|
152
|
+
getCategoryName = (t) => this.categories.find((e) => e.guid === t)?.name ?? T[t];
|
|
153
|
+
}, m = class {
|
|
130
154
|
expandedGuid = null;
|
|
131
155
|
selectedGuid = null;
|
|
132
156
|
searchValue = "";
|
|
@@ -136,7 +160,7 @@ var I = class {
|
|
|
136
160
|
unselectableText = "";
|
|
137
161
|
savedOnSelect;
|
|
138
162
|
constructor() {
|
|
139
|
-
|
|
163
|
+
y(this);
|
|
140
164
|
}
|
|
141
165
|
setExpandedGuid = (t) => this.expandedGuid = t;
|
|
142
166
|
setSelectedGuid = (t) => this.selectedGuid = t;
|
|
@@ -149,7 +173,7 @@ var I = class {
|
|
|
149
173
|
setOnSelect = (t) => this.savedOnSelect = t;
|
|
150
174
|
};
|
|
151
175
|
export {
|
|
152
|
-
|
|
176
|
+
A as CategoryStore
|
|
153
177
|
};
|
|
154
178
|
|
|
155
179
|
//# sourceMappingURL=CategoryStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryStore.es.js","names":[],"sources":["../../../src/core/stores/CategoryStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\nimport { subMonths } from 'date-fns/subMonths'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { endOfMonth } from 'date-fns/endOfMonth'\n\nimport { CategoryGuids, CategoryGuidToName } from '../constants'\nimport { CategoryApi } from '../api'\nimport { toUnixUTC } from '../utils/DateUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nimport type {\n Account,\n Category,\n DetailedCategory,\n DetailedCategoryWithTransactions,\n DateRangeCategoryTotals,\n MonthlyCategoryTotals,\n} from '../types'\n\nimport { augmentCategories, getDetailedCategoryTransactions } from '../utils/CategoryUtil'\n\nexport class CategoryStore {\n globalStore: GlobalStore\n uiStore: UiStore\n api = new CategoryApi('/', '')\n\n categories: Category[] = []\n categoriesLoaded: boolean = false\n categoriesLoading: boolean = false\n dateRangeCategoryTotals: DateRangeCategoryTotals[] = []\n monthlyCategoryTotals: MonthlyCategoryTotals[] = []\n\n dateRangeTotalsLoaded = false\n dateRangeTotalsLoading = false\n monthlyTotalsLoaded = false\n monthlyTotalsLoading = false\n\n // Monotonic request tokens, one per totals endpoint. A newer request\n // supersedes an older in-flight one: the stale response is discarded rather\n // than the newer request being dropped. These loaders used to early-return\n // while a request was in flight, which silently swallowed date-range/account\n // changes made mid-flight. (MEW-3910)\n //\n // Deliberately per-endpoint rather than one shared counter: several callers\n // (BubbleBudgetsWidget, BubbleBudgetsMiniWidget) fire the two loaders\n // independently and concurrently, and a shared counter would make the second\n // call supersede — and silently drop — the first.\n //\n // Kept out of the observable graph — internal concurrency bookkeeping, not\n // renderable state.\n dateRangeTotalsRequestId = 0\n monthlyTotalsRequestId = 0\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new CategoryApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this, {\n dateRangeTotalsRequestId: false,\n monthlyTotalsRequestId: false,\n })\n }\n\n get detailedCategories(): DetailedCategory[] {\n if (!this.globalStore.isInitialized) return []\n return augmentCategories(\n this.categories,\n this.globalStore.copyStore.copy.categories,\n this.dateRangeCategoryTotals,\n this.monthlyCategoryTotals,\n )\n }\n\n get detailedCategoriesWithTransactions(): DetailedCategoryWithTransactions[] {\n return getDetailedCategoryTransactions(\n this.detailedCategories,\n this.globalStore.transactionStore.sortedTransactions,\n )\n }\n\n get incomeCategories(): DetailedCategory[] {\n return this.detailedCategories.filter((c) => c.is_income)\n }\n\n get spendCategories(): DetailedCategory[] {\n return this.detailedCategories.filter(\n (c) => !c.is_income && !c.isTransfer && c.guid !== CategoryGuids.INVESTMENTS,\n )\n }\n\n get transferCategories(): DetailedCategory[] {\n return this.detailedCategories.filter((c) => c.isTransfer)\n }\n\n setCategories = (categories: Category[]) => {\n this.categories = categories\n this.categoriesLoading = false\n this.categoriesLoaded = true\n }\n\n setMonthlyCategoryTotals = (totals: MonthlyCategoryTotals[]) => {\n this.monthlyCategoryTotals = totals\n this.monthlyTotalsLoading = false\n this.monthlyTotalsLoaded = true\n }\n\n setDateRangeCategoryTotals = (totals: DateRangeCategoryTotals[]) => {\n this.dateRangeCategoryTotals = totals\n this.dateRangeTotalsLoading = false\n this.dateRangeTotalsLoaded = true\n }\n\n get trendsCategories(): DetailedCategory[] {\n return this.detailedCategories\n .filter((c) => c.totalAmount !== 0)\n .filter((c) => c.guid !== CategoryGuids.INVESTMENTS && c.guid !== CategoryGuids.TRANSFER)\n }\n\n addCategory = async (name: string, parentGuid: string) => {\n const category = { name, parent_guid: parentGuid } as Category\n\n try {\n await this.api.addCategory(category)\n await this.loadCategories()\n } catch (error) {\n console.error('Error occurred while adding category:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n loadCategories = async () => {\n if (this.categoriesLoading) return\n\n this.categoriesLoading = true\n try {\n const categories = await this.api.getCategories()\n this.setCategories(categories)\n } catch (error) {\n console.error('Error occurred while getting categories:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n runInAction(() => {\n this.categoriesLoading = false\n })\n }\n }\n\n loadDateRangeCategoryTotals = async (accounts: Account[], startDate: Date, endDate: Date) => {\n // Claim this request. Any request started later wins, so a date-range or\n // account change made while a request is in flight is no longer dropped.\n const requestId = ++this.dateRangeTotalsRequestId\n const isStale = () => requestId !== this.dateRangeTotalsRequestId\n\n runInAction(() => {\n this.dateRangeTotalsLoading = true\n })\n\n try {\n // UTC-midnight boundaries so the window matches the absolute post dates the\n // API keys on; local Dates would shift it by the viewer's timezone offset.\n const totals = await this.api.getDateRangeCategoryTotals(\n toUnixUTC(startDate),\n toUnixUTC(endDate),\n accounts,\n )\n // A newer request superseded this one; its response is authoritative.\n // Leave the loading flag alone: the newest request still owns it.\n if (isStale()) return\n this.setDateRangeCategoryTotals(totals)\n } catch (error) {\n // Don't report deliberately superseded requests — rapid date scrubbing\n // would otherwise spam the error backend. (MEW-3910)\n if (isStale()) return\n console.error('Error occurred while getting date range category totals:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n this.setDateRangeCategoryTotals([])\n }\n }\n\n loadMonthlyCategoryTotals = async (\n accounts: Account[] = this.globalStore.globalUiStore.selectedAccounts,\n startDate?: Date,\n endDate?: Date,\n ) => {\n // See loadDateRangeCategoryTotals: newest request wins. (MEW-3910)\n const requestId = ++this.monthlyTotalsRequestId\n const isStale = () => requestId !== this.monthlyTotalsRequestId\n runInAction(() => {\n this.monthlyTotalsLoading = true\n })\n\n // UTC-midnight boundaries; see loadDateRangeCategoryTotals.\n const start = toUnixUTC(startOfMonth(startDate ?? subMonths(new Date(), 11)))\n const end = toUnixUTC(endOfMonth(endDate ?? new Date()))\n\n try {\n const totals = await this.api.getMonthlyCategoryTotals(start, end, accounts)\n if (isStale()) return\n this.setMonthlyCategoryTotals(totals)\n } catch (error) {\n // Superseded requests are not reported. (MEW-3910)\n if (isStale()) return\n console.error('Error occurred while getting monthly category totals:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n // Setter clears monthlyTotalsLoading and marks loaded so the UI recovers\n // and retries aren't blocked. (MEW-3538)\n this.setMonthlyCategoryTotals([])\n }\n }\n\n reloadCategoryTotals = async (accounts: Account[], startDate?: Date, endDate?: Date) => {\n const start = startDate ?? subMonths(new Date(), 11)\n const end = endDate ?? endOfMonth(new Date())\n // Each loader claims its own token, so the pair does not invalidate itself.\n // No try/catch: both loaders handle and report their own errors and always\n // resolve, so nothing can reject here.\n await Promise.all([\n this.loadMonthlyCategoryTotals(accounts, start, end),\n this.loadDateRangeCategoryTotals(accounts, start, end),\n ])\n }\n\n removeCategory = async (guid: string) => {\n try {\n await this.api.removeCategory(guid)\n await this.loadCategories()\n } catch (error) {\n console.error('Error occurred while removing category:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n updateCategory = async (category: Category) => {\n try {\n await this.api.updateCategory(category)\n await this.loadCategories()\n } catch (error) {\n console.error('Error occurred while updating category:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n // TODO: Remove this after refactoring Trends components to use detailedCategories\n getCategoryName = (guid: string) => {\n const category = this.categories.find((c) => c.guid === guid)\n return category?.name ?? CategoryGuidToName[guid]\n }\n}\n\n// TODO: Move into CategoryStore\nclass UiStore {\n expandedGuid: string | null = null\n selectedGuid: string | null = null\n searchValue = ''\n showSelected = true\n shouldDisableDrawerScroll = false\n unselectable: string[] = []\n unselectableText = ''\n\n savedOnSelect: any // todo\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setExpandedGuid = (guid: string | null) => (this.expandedGuid = guid)\n\n setSelectedGuid = (guid: string | null) => (this.selectedGuid = guid)\n\n setSearchValue = (value: string) => (this.searchValue = value)\n\n setShouldDisableDrawerScroll = (shouldDisable: boolean) =>\n (this.shouldDisableDrawerScroll = shouldDisable)\n\n setShowSelected = (showSelected: boolean) => (this.showSelected = showSelected)\n\n setUnselectable = (unselectable: string[]) => (this.unselectable = unselectable)\n\n setUnselectableText = (text: string) => (this.unselectableText = text)\n\n onSelect = (guid: string) => this.savedOnSelect(guid)\n\n setOnSelect = (callback: any) => (this.savedOnSelect = callback)\n}\n"],"mappings":";;;;;;;;AAsBA,IAAa,IAAb,MAA2B;AAAA,EACzB;AAAA,EACA;AAAA,EACA,MAAM,IAAI,EAAY,KAAK,EAAE;AAAA,EAE7B,aAAyB,CAAC;AAAA,EAC1B,mBAA4B;AAAA,EAC5B,oBAA6B;AAAA,EAC7B,0BAAqD,CAAC;AAAA,EACtD,wBAAiD,CAAC;AAAA,EAElD,wBAAwB;AAAA,EACxB,yBAAyB;AAAA,EACzB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EAevB,2BAA2B;AAAA,EAC3B,yBAAyB;AAAA,EAEzB,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,UAAU,IAAI,EAAQ,GAC3B,KAAK,MAAM,IAAI,EAAY,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE9F,EAAmB,MA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2CAA2C,CAAK,GAC9D,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,gBAAgB,CAAC;AAAA,IACrE;AAAA,EACF;AAAA,EAGA,kBAAA,CAAmB,MACA,KAAK,WAAW,KAAA,CAAM,MAAM,EAAE,SAAS,CACjD,GAAU,QAAQ,EAAmB,CAAA;AAEhD,GAGM,IAAN,MAAc;AAAA,EACZ,eAA8B;AAAA,EAC9B,eAA8B;AAAA,EAC9B,cAAc;AAAA,EACd,eAAe;AAAA,EACf,4BAA4B;AAAA,EAC5B,eAAyB,CAAC;AAAA,EAC1B,mBAAmB;AAAA,EAEnB;AAAA,EAEA,cAAc;AACZ,IAAA,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,kBAAA,CAAmB,MAAyB,KAAK,eAAe;AAAA,EAEhE,kBAAA,CAAmB,MAAyB,KAAK,eAAe;AAAA,EAEhE,iBAAA,CAAkB,MAAmB,KAAK,cAAc;AAAA,EAExD,+BAAA,CAAgC,MAC7B,KAAK,4BAA4B;AAAA,EAEpC,kBAAA,CAAmB,MAA2B,KAAK,eAAe;AAAA,EAElE,kBAAA,CAAmB,MAA4B,KAAK,eAAe;AAAA,EAEnE,sBAAA,CAAuB,MAAkB,KAAK,mBAAmB;AAAA,EAEjE,WAAA,CAAY,MAAiB,KAAK,cAAc,CAAI;AAAA,EAEpD,cAAA,CAAe,MAAmB,KAAK,gBAAgB;AACzD"}
|
|
1
|
+
{"version":3,"file":"CategoryStore.es.js","names":[],"sources":["../../../src/core/stores/CategoryStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\nimport { subMonths } from 'date-fns/subMonths'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { endOfMonth } from 'date-fns/endOfMonth'\n\nimport { CategoryGuids, CategoryGuidToName } from '../constants'\nimport { CategoryApi } from '../api'\nimport { toUnixUTC } from '../utils/DateUtil'\n\nimport { GlobalStore } from './GlobalStore'\n\nimport type {\n Account,\n Category,\n DetailedCategory,\n DetailedCategoryWithTransactions,\n DateRangeCategoryTotals,\n MonthlyCategoryTotals,\n} from '../types'\n\nimport { augmentCategories, getDetailedCategoryTransactions } from '../utils/CategoryUtil'\n\nexport class CategoryStore {\n globalStore: GlobalStore\n uiStore: UiStore\n api = new CategoryApi('/', '')\n\n categories: Category[] = []\n categoriesLoaded: boolean = false\n categoriesLoading: boolean = false\n dateRangeCategoryTotals: DateRangeCategoryTotals[] = []\n monthlyCategoryTotals: MonthlyCategoryTotals[] = []\n\n dateRangeTotalsLoaded = false\n dateRangeTotalsLoading = false\n monthlyTotalsLoaded = false\n monthlyTotalsLoading = false\n\n // Monotonic request tokens, one per totals endpoint. A newer request\n // supersedes an older in-flight one: the stale response is discarded rather\n // than the newer request being dropped. These loaders used to early-return\n // while a request was in flight, which silently swallowed date-range/account\n // changes made mid-flight. (MEW-3910)\n //\n // Deliberately per-endpoint rather than one shared counter: several callers\n // (BubbleBudgetsWidget, BubbleBudgetsMiniWidget) fire the two loaders\n // independently and concurrently, and a shared counter would make the second\n // call supersede — and silently drop — the first.\n //\n // Kept out of the observable graph — internal concurrency bookkeeping, not\n // renderable state.\n dateRangeTotalsRequestId = 0\n monthlyTotalsRequestId = 0\n\n // Args each loader was last requested with; refreshLoadedCategoryTotals replays them.\n private lastDateRangeTotalsArgs: {\n accounts: Account[]\n startDate: Date\n endDate: Date\n } | null = null\n private lastMonthlyTotalsArgs: {\n accounts: Account[]\n startDate?: Date\n endDate?: Date\n } | null = null\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new CategoryApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable<CategoryStore, 'lastDateRangeTotalsArgs' | 'lastMonthlyTotalsArgs'>(this, {\n dateRangeTotalsRequestId: false,\n monthlyTotalsRequestId: false,\n lastDateRangeTotalsArgs: false,\n lastMonthlyTotalsArgs: false,\n })\n }\n\n get detailedCategories(): DetailedCategory[] {\n if (!this.globalStore.isInitialized) return []\n return augmentCategories(\n this.categories,\n this.globalStore.copyStore.copy.categories,\n this.dateRangeCategoryTotals,\n this.monthlyCategoryTotals,\n )\n }\n\n get detailedCategoriesWithTransactions(): DetailedCategoryWithTransactions[] {\n return getDetailedCategoryTransactions(\n this.detailedCategories,\n this.globalStore.transactionStore.sortedTransactions,\n )\n }\n\n get incomeCategories(): DetailedCategory[] {\n return this.detailedCategories.filter((c) => c.is_income)\n }\n\n get spendCategories(): DetailedCategory[] {\n return this.detailedCategories.filter(\n (c) => !c.is_income && !c.isTransfer && c.guid !== CategoryGuids.INVESTMENTS,\n )\n }\n\n get transferCategories(): DetailedCategory[] {\n return this.detailedCategories.filter((c) => c.isTransfer)\n }\n\n setCategories = (categories: Category[]) => {\n this.categories = categories\n this.categoriesLoading = false\n this.categoriesLoaded = true\n }\n\n setMonthlyCategoryTotals = (totals: MonthlyCategoryTotals[]) => {\n this.monthlyCategoryTotals = totals\n this.monthlyTotalsLoading = false\n this.monthlyTotalsLoaded = true\n }\n\n setDateRangeCategoryTotals = (totals: DateRangeCategoryTotals[]) => {\n this.dateRangeCategoryTotals = totals\n this.dateRangeTotalsLoading = false\n this.dateRangeTotalsLoaded = true\n }\n\n get trendsCategories(): DetailedCategory[] {\n return this.detailedCategories\n .filter((c) => c.totalAmount !== 0)\n .filter((c) => c.guid !== CategoryGuids.INVESTMENTS && c.guid !== CategoryGuids.TRANSFER)\n }\n\n addCategory = async (name: string, parentGuid: string) => {\n const category = { name, parent_guid: parentGuid } as Category\n\n try {\n await this.api.addCategory(category)\n await this.loadCategories()\n } catch (error) {\n console.error('Error occurred while adding category:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n loadCategories = async () => {\n if (this.categoriesLoading) return\n\n this.categoriesLoading = true\n try {\n const categories = await this.api.getCategories()\n this.setCategories(categories)\n } catch (error) {\n console.error('Error occurred while getting categories:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n runInAction(() => {\n this.categoriesLoading = false\n })\n }\n }\n\n loadDateRangeCategoryTotals = async (accounts: Account[], startDate: Date, endDate: Date) => {\n // Claim this request. Any request started later wins, so a date-range or\n // account change made while a request is in flight is no longer dropped.\n const requestId = ++this.dateRangeTotalsRequestId\n const isStale = () => requestId !== this.dateRangeTotalsRequestId\n this.lastDateRangeTotalsArgs = { accounts, startDate, endDate }\n\n runInAction(() => {\n this.dateRangeTotalsLoading = true\n })\n\n try {\n // UTC-midnight boundaries so the window matches the absolute post dates the\n // API keys on; local Dates would shift it by the viewer's timezone offset.\n const totals = await this.api.getDateRangeCategoryTotals(\n toUnixUTC(startDate),\n toUnixUTC(endDate),\n accounts,\n )\n // A newer request superseded this one; its response is authoritative.\n // Leave the loading flag alone: the newest request still owns it.\n if (isStale()) return\n this.setDateRangeCategoryTotals(totals)\n } catch (error) {\n // Don't report deliberately superseded requests — rapid date scrubbing\n // would otherwise spam the error backend. (MEW-3910)\n if (isStale()) return\n console.error('Error occurred while getting date range category totals:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n this.setDateRangeCategoryTotals([])\n }\n }\n\n loadMonthlyCategoryTotals = async (\n accounts: Account[] = this.globalStore.globalUiStore.selectedAccounts,\n startDate?: Date,\n endDate?: Date,\n ) => {\n // See loadDateRangeCategoryTotals: newest request wins. (MEW-3910)\n const requestId = ++this.monthlyTotalsRequestId\n const isStale = () => requestId !== this.monthlyTotalsRequestId\n this.lastMonthlyTotalsArgs = { accounts, startDate, endDate }\n runInAction(() => {\n this.monthlyTotalsLoading = true\n })\n\n // UTC-midnight boundaries; see loadDateRangeCategoryTotals.\n const start = toUnixUTC(startOfMonth(startDate ?? subMonths(new Date(), 11)))\n const end = toUnixUTC(endOfMonth(endDate ?? new Date()))\n\n try {\n const totals = await this.api.getMonthlyCategoryTotals(start, end, accounts)\n if (isStale()) return\n this.setMonthlyCategoryTotals(totals)\n } catch (error) {\n // Superseded requests are not reported. (MEW-3910)\n if (isStale()) return\n console.error('Error occurred while getting monthly category totals:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n // Setter clears monthlyTotalsLoading and marks loaded so the UI recovers\n // and retries aren't blocked. (MEW-3538)\n this.setMonthlyCategoryTotals([])\n }\n }\n\n reloadCategoryTotals = async (accounts: Account[], startDate?: Date, endDate?: Date) => {\n const start = startDate ?? subMonths(new Date(), 11)\n const end = endDate ?? endOfMonth(new Date())\n // Each loader claims its own token, so the pair does not invalidate itself.\n // No try/catch: both loaders handle and report their own errors and always\n // resolve, so nothing can reject here.\n await Promise.all([\n this.loadMonthlyCategoryTotals(accounts, start, end),\n this.loadDateRangeCategoryTotals(accounts, start, end),\n ])\n }\n\n // Re-issues each loader's last request; a replay supersedes an in-flight\n // request via the request-id guard, so the replayed response wins.\n refreshLoadedCategoryTotals = async () => {\n const refreshes: Promise<void>[] = []\n\n if (this.lastDateRangeTotalsArgs) {\n const { accounts, startDate, endDate } = this.lastDateRangeTotalsArgs\n refreshes.push(this.loadDateRangeCategoryTotals(accounts, startDate, endDate))\n }\n if (this.lastMonthlyTotalsArgs) {\n const { accounts, startDate, endDate } = this.lastMonthlyTotalsArgs\n refreshes.push(this.loadMonthlyCategoryTotals(accounts, startDate, endDate))\n }\n\n await Promise.all(refreshes)\n }\n\n removeCategory = async (guid: string) => {\n try {\n await this.api.removeCategory(guid)\n await this.loadCategories()\n } catch (error) {\n console.error('Error occurred while removing category:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n updateCategory = async (category: Category) => {\n try {\n await this.api.updateCategory(category)\n await this.loadCategories()\n } catch (error) {\n console.error('Error occurred while updating category:', error)\n this.globalStore.captureException(error, { store: 'CategoryStore' })\n }\n }\n\n // TODO: Remove this after refactoring Trends components to use detailedCategories\n getCategoryName = (guid: string) => {\n const category = this.categories.find((c) => c.guid === guid)\n return category?.name ?? CategoryGuidToName[guid]\n }\n}\n\n// TODO: Move into CategoryStore\nclass UiStore {\n expandedGuid: string | null = null\n selectedGuid: string | null = null\n searchValue = ''\n showSelected = true\n shouldDisableDrawerScroll = false\n unselectable: string[] = []\n unselectableText = ''\n\n savedOnSelect: any // todo\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setExpandedGuid = (guid: string | null) => (this.expandedGuid = guid)\n\n setSelectedGuid = (guid: string | null) => (this.selectedGuid = guid)\n\n setSearchValue = (value: string) => (this.searchValue = value)\n\n setShouldDisableDrawerScroll = (shouldDisable: boolean) =>\n (this.shouldDisableDrawerScroll = shouldDisable)\n\n setShowSelected = (showSelected: boolean) => (this.showSelected = showSelected)\n\n setUnselectable = (unselectable: string[]) => (this.unselectable = unselectable)\n\n setUnselectableText = (text: string) => (this.unselectableText = text)\n\n onSelect = (guid: string) => this.savedOnSelect(guid)\n\n setOnSelect = (callback: any) => (this.savedOnSelect = callback)\n}\n"],"mappings":";;;;;;;;AAsBA,IAAa,IAAb,MAA2B;AAAA,EACzB;AAAA,EACA;AAAA,EACA,MAAM,IAAI,EAAY,KAAK,EAAE;AAAA,EAE7B,aAAyB,CAAC;AAAA,EAC1B,mBAA4B;AAAA,EAC5B,oBAA6B;AAAA,EAC7B,0BAAqD,CAAC;AAAA,EACtD,wBAAiD,CAAC;AAAA,EAElD,wBAAwB;AAAA,EACxB,yBAAyB;AAAA,EACzB,sBAAsB;AAAA,EACtB,uBAAuB;AAAA,EAevB,2BAA2B;AAAA,EAC3B,yBAAyB;AAAA,EAGzB,0BAIW;AAAA,EACX,wBAIW;AAAA,EAEX,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,UAAU,IAAI,EAAQ,GAC3B,KAAK,MAAM,IAAI,EAAY,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE9F,EAAuF,MAAM;AAAA,MAC3F,0BAA0B;AAAA,MAC1B,wBAAwB;AAAA,MACxB,yBAAyB;AAAA,MACzB,uBAAuB;AAAA,IACzB,CAAC;AAAA,EACH;AAAA,EAEA,IAAI,qBAAyC;AAC3C,WAAK,KAAK,YAAY,gBACf,EACL,KAAK,YACL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