@mx-cartographer/experiences 4.0.14-alpha.JB0 → 4.0.14-alpha.JB2

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.
Files changed (75) hide show
  1. package/dist/AccountStore-B23-oV1B.mjs +244 -0
  2. package/dist/AccountStore-B23-oV1B.mjs.map +1 -0
  3. package/dist/BeatApi-BxXgbSJY.mjs +99 -0
  4. package/dist/BeatApi-BxXgbSJY.mjs.map +1 -0
  5. package/dist/BudgetUtil-BSn9Zr71.mjs +208 -0
  6. package/dist/BudgetUtil-BSn9Zr71.mjs.map +1 -0
  7. package/dist/CashflowApi-zcebgnO1.mjs +103 -0
  8. package/dist/CashflowApi-zcebgnO1.mjs.map +1 -0
  9. package/dist/CashflowStore-gPEEBiXo.mjs +53 -0
  10. package/dist/CashflowStore-gPEEBiXo.mjs.map +1 -0
  11. package/dist/Categories-XVFviD23.mjs +117 -0
  12. package/dist/Categories-XVFviD23.mjs.map +1 -0
  13. package/dist/CategoryStore-CSNSMNA6.mjs +298 -0
  14. package/dist/CategoryStore-CSNSMNA6.mjs.map +1 -0
  15. package/dist/ConnectMiniWidget-Ep65CtHH.mjs +10854 -0
  16. package/dist/ConnectMiniWidget-Ep65CtHH.mjs.map +1 -0
  17. package/dist/DebtsStore-Duf3n1vZ.mjs +127 -0
  18. package/dist/DebtsStore-Duf3n1vZ.mjs.map +1 -0
  19. package/dist/Donut-DgMeKScZ.mjs +53 -0
  20. package/dist/Donut-DgMeKScZ.mjs.map +1 -0
  21. package/dist/Fetch-DpUi1_Dx.mjs +99 -0
  22. package/dist/Fetch-DpUi1_Dx.mjs.map +1 -0
  23. package/dist/GoalStore-BYoRLx99.mjs +128 -0
  24. package/dist/GoalStore-BYoRLx99.mjs.map +1 -0
  25. package/dist/MerchantStore-RhLvDvX-.mjs +118 -0
  26. package/dist/MerchantStore-RhLvDvX-.mjs.map +1 -0
  27. package/dist/NetWorthStore-syD1VnxE.mjs +66 -0
  28. package/dist/NetWorthStore-syD1VnxE.mjs.map +1 -0
  29. package/dist/NotificationStore-CqTYHfJC.mjs +141 -0
  30. package/dist/NotificationStore-CqTYHfJC.mjs.map +1 -0
  31. package/dist/RecurringActivityStore-B_COvGWG.mjs +304 -0
  32. package/dist/RecurringActivityStore-B_COvGWG.mjs.map +1 -0
  33. package/dist/StackedLineChart-CCqGRwvs.mjs +342 -0
  34. package/dist/StackedLineChart-CCqGRwvs.mjs.map +1 -0
  35. package/dist/TransactionStore-BUrjBWkk.mjs +478 -0
  36. package/dist/TransactionStore-BUrjBWkk.mjs.map +1 -0
  37. package/dist/index.es.js +12 -17869
  38. package/dist/index.es.js.map +1 -1
  39. package/dist/index.es10.js +107 -0
  40. package/dist/index.es10.js.map +1 -0
  41. package/dist/index.es11.js +159 -0
  42. package/dist/index.es11.js.map +1 -0
  43. package/dist/index.es12.js +483 -0
  44. package/dist/index.es12.js.map +1 -0
  45. package/dist/index.es13.js +620 -0
  46. package/dist/index.es13.js.map +1 -0
  47. package/dist/index.es14.js +788 -0
  48. package/dist/index.es14.js.map +1 -0
  49. package/dist/index.es15.js +891 -0
  50. package/dist/index.es15.js.map +1 -0
  51. package/dist/index.es16.js +962 -0
  52. package/dist/index.es16.js.map +1 -0
  53. package/dist/index.es17.js +1904 -0
  54. package/dist/index.es17.js.map +1 -0
  55. package/dist/index.es2.js +11 -0
  56. package/dist/index.es2.js.map +1 -0
  57. package/dist/index.es3.js +10 -0
  58. package/dist/index.es3.js.map +1 -0
  59. package/dist/index.es4.js +9 -0
  60. package/dist/index.es4.js.map +1 -0
  61. package/dist/index.es5.js +7 -0
  62. package/dist/index.es5.js.map +1 -0
  63. package/dist/index.es6.js +7 -0
  64. package/dist/index.es6.js.map +1 -0
  65. package/dist/index.es7.js +10 -0
  66. package/dist/index.es7.js.map +1 -0
  67. package/dist/index.es8.js +10 -0
  68. package/dist/index.es8.js.map +1 -0
  69. package/dist/index.es9.js +18 -0
  70. package/dist/index.es9.js.map +1 -0
  71. package/dist/useCombineEvents-CZUDHE96.mjs +170 -0
  72. package/dist/useCombineEvents-CZUDHE96.mjs.map +1 -0
  73. package/dist/usePrevious-BLb3umpI.mjs +11 -0
  74. package/dist/usePrevious-BLb3umpI.mjs.map +1 -0
  75. package/package.json +1 -1
@@ -0,0 +1,103 @@
1
+ import { getUnixTime as i } from "date-fns/getUnixTime";
2
+ import "bowser";
3
+ import { F as m, A as r } from "./Fetch-DpUi1_Dx.mjs";
4
+ import "date-fns/intlFormat";
5
+ import "./ConnectMiniWidget-Ep65CtHH.mjs";
6
+ import "react";
7
+ import "numeral";
8
+ import "date-fns/addMonths";
9
+ import "date-fns/addQuarters";
10
+ import "date-fns/addWeeks";
11
+ import "date-fns/addYears";
12
+ import "date-fns/getDay";
13
+ import "date-fns/isBefore";
14
+ import "date-fns/nextDay";
15
+ import "date-fns/setDate";
16
+ import "date-fns/startOfToday";
17
+ import "date-fns/fromUnixTime";
18
+ import "react/jsx-runtime";
19
+ import "@mui/material/Button";
20
+ import "@kyper/mui";
21
+ import "@mui/material/Tooltip";
22
+ import "@mui/material/Box";
23
+ import "@mui/material/IconButton";
24
+ import "@mui/material/styles/useTheme";
25
+ import "@mui/material/useMediaQuery";
26
+ import "@mxenabled/cssinjs";
27
+ import "date-fns/addDays";
28
+ import "date-fns/eachDayOfInterval";
29
+ import "date-fns/eachWeekOfInterval";
30
+ import "date-fns/endOfMonth";
31
+ import "date-fns/format";
32
+ import "date-fns/isSameMonth";
33
+ import "date-fns/startOfMonth";
34
+ import "date-fns/subMonths";
35
+ import "@mui/material/Paper";
36
+ import "@mui/icons-material/KeyboardArrowLeftRounded";
37
+ import "@mui/icons-material/KeyboardArrowRightRounded";
38
+ import "date-fns/isSameDay";
39
+ import "date-fns/isWithinInterval";
40
+ import "d3";
41
+ import "@mui/material/styles";
42
+ import "@mui/x-charts";
43
+ import "@mui/material/Stack";
44
+ import "@mui/material";
45
+ import "date-fns/differenceInCalendarDays";
46
+ import "date-fns/endOfToday";
47
+ import "date-fns/endOfYear";
48
+ import "date-fns/startOfYear";
49
+ import "date-fns/subDays";
50
+ import "date-fns/subYears";
51
+ import "@mui/material/ButtonGroup";
52
+ import "@mui/material/Tab";
53
+ import "@mui/material/Tabs";
54
+ import "@mui/material/ToggleButton";
55
+ import "@mui/material/ToggleButtonGroup";
56
+ import "@mui/material/Dialog";
57
+ import "@mui/material/DialogContent";
58
+ import "@mui/icons-material/ArrowBackOutlined";
59
+ import "@mui/material/Card";
60
+ import "@mui/material/CardHeader";
61
+ import "@mui/material/CardContent";
62
+ import "uuid";
63
+ import "@mui/material/CircularProgress";
64
+ import "@mui/material/FormControlLabel";
65
+ import "@mui/material/Radio";
66
+ import "@mui/material/Avatar";
67
+ import "@mui/material/ListItem";
68
+ import "@mui/material/ListItemAvatar";
69
+ import "@mui/material/ListItemButton";
70
+ import "@mui/material/ListItemText";
71
+ import "@mui/material/ListItemIcon";
72
+ import "mobx";
73
+ import "date-fns/differenceInDays";
74
+ import "@mui/x-data-grid-pro";
75
+ import "date-fns";
76
+ import "date-fns/getMonth";
77
+ import "date-fns/isAfter";
78
+ import "date-fns/parseISO";
79
+ import "date-fns/subWeeks";
80
+ import "date-fns/formatISO";
81
+ class vt {
82
+ fetchInstance;
83
+ constructor(t, o) {
84
+ this.fetchInstance = new m(t, o);
85
+ }
86
+ addCashflowEvent = async (t) => this.fetchInstance.post(r.CASHFLOW_EVENTS, { ...t }).then((o) => o);
87
+ addCashflowSequence = async (t) => this.fetchInstance.post(r.CASHFLOW_SEQUENCES, { ...t }).then((o) => o.cashflow_sequence);
88
+ getCashflowSequences = async () => this.fetchInstance.get(r.CASHFLOW_SEQUENCES).then((t) => t.cashflow_sequences);
89
+ getCashflowEventsByDateRange = async (t, o) => this.fetchInstance.get(
90
+ `${r.CASHFLOW_EVENTS}/from/${i(t)}/to/${i(o)}`
91
+ ).then((p) => p.cashflow_events);
92
+ deleteCashflowSequence = async (t) => this.fetchInstance.delete(`${r.CASHFLOW_SEQUENCES}/${t}`).then((o) => o);
93
+ getProjectedCashflowEvents = async (t, o) => this.fetchInstance.get(
94
+ `${r.CASHFLOW_SEQUENCES}/projected_events/from/${i(
95
+ t
96
+ )}/to/${i(o)}`
97
+ ).then((p) => p.cashflow_events);
98
+ updateCashflowSequence = async (t) => this.fetchInstance.put(`${r.CASHFLOW_SEQUENCES}/${t.guid}`, t).then((o) => o.cashflow_sequence);
99
+ }
100
+ export {
101
+ vt as C
102
+ };
103
+ //# sourceMappingURL=CashflowApi-zcebgnO1.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CashflowApi-zcebgnO1.mjs","sources":["../src/cashflow/api/CashflowApi.ts"],"sourcesContent":["import { getUnixTime } from 'date-fns/getUnixTime'\n\nimport { ApiEndpoints, Fetch, type CashflowEvent, type CashflowSequence } from '../../common'\n\nexport class CashflowApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n addCashflowEvent = async (cashflowEvent: CashflowEvent) => {\n return this.fetchInstance\n .post(ApiEndpoints.CASHFLOW_EVENTS, { ...cashflowEvent })\n .then((data) => data)\n }\n\n addCashflowSequence = async (cashflowSequence: CashflowSequence) => {\n return this.fetchInstance\n .post(ApiEndpoints.CASHFLOW_SEQUENCES, { ...cashflowSequence })\n .then((data) => data.cashflow_sequence)\n }\n\n getCashflowSequences = async (): Promise<CashflowSequence[]> => {\n return this.fetchInstance\n .get(ApiEndpoints.CASHFLOW_SEQUENCES)\n .then((data) => data.cashflow_sequences)\n }\n\n getCashflowEventsByDateRange = async (\n beginDate: Date,\n endDate: Date,\n ): Promise<CashflowEvent[]> => {\n return this.fetchInstance\n .get(\n `${ApiEndpoints.CASHFLOW_EVENTS}/from/${getUnixTime(beginDate)}/to/${getUnixTime(endDate)}`,\n )\n .then((data) => data.cashflow_events)\n }\n\n deleteCashflowSequence = async (guid: string) => {\n return this.fetchInstance\n .delete(`${ApiEndpoints.CASHFLOW_SEQUENCES}/${guid}`)\n .then((data) => data)\n }\n\n getProjectedCashflowEvents = async (beginDate: Date, endDate: Date): Promise<CashflowEvent[]> => {\n return this.fetchInstance\n .get(\n `${ApiEndpoints.CASHFLOW_SEQUENCES}/projected_events/from/${getUnixTime(\n beginDate,\n )}/to/${getUnixTime(endDate)}`,\n )\n .then((data) => data.cashflow_events)\n }\n\n updateCashflowSequence = async (cashflowSequence: CashflowSequence) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.CASHFLOW_SEQUENCES}/${cashflowSequence.guid}`, cashflowSequence)\n .then((data) => data.cashflow_sequence)\n }\n}\n"],"names":["CashflowApi","endpoint","token","Fetch","cashflowEvent","ApiEndpoints","data","cashflowSequence","beginDate","endDate","getUnixTime","guid"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIO,MAAMA,GAAY;AAAA,EACvB;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK;AAAA,EAChD;AAAA,EAEA,mBAAmB,OAAOE,MACjB,KAAK,cACT,KAAKC,EAAa,iBAAiB,EAAE,GAAGD,EAAA,CAAe,EACvD,KAAK,CAACE,MAASA,CAAI;AAAA,EAGxB,sBAAsB,OAAOC,MACpB,KAAK,cACT,KAAKF,EAAa,oBAAoB,EAAE,GAAGE,EAAkB,CAAA,EAC7D,KAAK,CAACD,MAASA,EAAK,iBAAiB;AAAA,EAG1C,uBAAuB,YACd,KAAK,cACT,IAAID,EAAa,kBAAkB,EACnC,KAAK,CAACC,MAASA,EAAK,kBAAkB;AAAA,EAG3C,+BAA+B,OAC7BE,GACAC,MAEO,KAAK,cACT;AAAA,IACC,GAAGJ,EAAa,eAAe,SAASK,EAAYF,CAAS,CAAC,OAAOE,EAAYD,CAAO,CAAC;AAAA,EAE1F,EAAA,KAAK,CAACH,MAASA,EAAK,eAAe;AAAA,EAGxC,yBAAyB,OAAOK,MACvB,KAAK,cACT,OAAO,GAAGN,EAAa,kBAAkB,IAAIM,CAAI,EAAE,EACnD,KAAK,CAACL,MAASA,CAAI;AAAA,EAGxB,6BAA6B,OAAOE,GAAiBC,MAC5C,KAAK,cACT;AAAA,IACC,GAAGJ,EAAa,kBAAkB,0BAA0BK;AAAA,MAC1DF;AAAA,IACD,CAAA,OAAOE,EAAYD,CAAO,CAAC;AAAA,EAE7B,EAAA,KAAK,CAACH,MAASA,EAAK,eAAe;AAAA,EAGxC,yBAAyB,OAAOC,MACvB,KAAK,cACT,IAAI,GAAGF,EAAa,kBAAkB,IAAIE,EAAiB,IAAI,IAAIA,CAAgB,EACnF,KAAK,CAACD,MAASA,EAAK,iBAAiB;AAE5C;"}
@@ -0,0 +1,53 @@
1
+ import { makeAutoObservable as o } from "mobx";
2
+ import { addDays as r } from "date-fns/addDays";
3
+ import { differenceInDays as n } from "date-fns/differenceInDays";
4
+ import { endOfMonth as i } from "date-fns/endOfMonth";
5
+ import { isBefore as a } from "date-fns/isBefore";
6
+ import { startOfToday as t } from "date-fns/startOfToday";
7
+ class c {
8
+ // Cashflow is hard-coded to display 30 days starting from today
9
+ dateRange = { start: t(), end: r(t(), 30) };
10
+ isDirty = !1;
11
+ nextIncome = void 0;
12
+ upcomingExpenses = [];
13
+ selectedCashAccounts = [];
14
+ constructor() {
15
+ o(this);
16
+ }
17
+ // Returns the number of days until the next income activity or 0 if there is no income activity
18
+ get daysUntilNextIncome() {
19
+ return this.nextIncome ? Math.abs(n(t(), this.nextIncome.expectedDate)) : 0;
20
+ }
21
+ // Returns the expenses (Activities) until the next income activity or the end of the month
22
+ // if there is no income activity
23
+ get expensesTilNextIncome() {
24
+ return this.upcomingExpenses.filter(
25
+ (e) => a(e.expectedDate, this.nextIncome?.expectedDate || i(/* @__PURE__ */ new Date()))
26
+ );
27
+ }
28
+ setNextIncome = (e) => {
29
+ this.nextIncome = e;
30
+ };
31
+ setUpcomingExpenses = (e) => {
32
+ this.upcomingExpenses = e;
33
+ };
34
+ setSelectedCashAccounts = (e) => this.selectedCashAccounts = e;
35
+ }
36
+ class f {
37
+ globalStore;
38
+ uiStore;
39
+ constructor(e) {
40
+ this.globalStore = e, this.uiStore = new c(), o(this);
41
+ }
42
+ completeOnboarding = async () => {
43
+ const e = {
44
+ ...this.globalStore.userStore.userProfile,
45
+ has_completed_cash_flow_onboarding: !0
46
+ };
47
+ await this.globalStore.userStore.updateUserProfile(e);
48
+ };
49
+ }
50
+ export {
51
+ f as C
52
+ };
53
+ //# sourceMappingURL=CashflowStore-gPEEBiXo.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CashflowStore-gPEEBiXo.mjs","sources":["../src/cashflow/stores/UiStore.ts","../src/cashflow/stores/CashflowStore.ts"],"sourcesContent":["import { makeAutoObservable } from 'mobx'\nimport { addDays } from 'date-fns/addDays'\nimport { differenceInDays } from 'date-fns/differenceInDays'\nimport { endOfMonth } from 'date-fns/endOfMonth'\nimport { isBefore } from 'date-fns/isBefore'\nimport { startOfToday } from 'date-fns/startOfToday'\n\nimport { type Account, type Activity } from '../../common'\n\nexport class UiStore {\n // Cashflow is hard-coded to display 30 days starting from today\n dateRange = { start: startOfToday(), end: addDays(startOfToday(), 30) }\n isDirty = false\n\n nextIncome: Activity | undefined = undefined\n upcomingExpenses: Activity[] = []\n\n selectedCashAccounts: Account[] = []\n\n constructor() {\n makeAutoObservable(this)\n }\n\n // Returns the number of days until the next income activity or 0 if there is no income activity\n get daysUntilNextIncome() {\n return this.nextIncome\n ? Math.abs(differenceInDays(startOfToday(), this.nextIncome.expectedDate))\n : 0\n }\n\n // Returns the expenses (Activities) until the next income activity or the end of the month\n // if there is no income activity\n get expensesTilNextIncome() {\n return this.upcomingExpenses.filter((a) =>\n isBefore(a.expectedDate, this.nextIncome?.expectedDate || endOfMonth(new Date())),\n )\n }\n\n setNextIncome = (nextIncome: Activity) => {\n this.nextIncome = nextIncome\n }\n\n setUpcomingExpenses = (expenses: Activity[]) => {\n this.upcomingExpenses = expenses\n }\n\n setSelectedCashAccounts = (accounts: Account[]) => (this.selectedCashAccounts = accounts)\n}\n","import { makeAutoObservable } from 'mobx'\n\nimport { GlobalStore, type UserProfile } from '../../common'\n\nimport { UiStore } from './UiStore'\n\nexport class CashflowStore {\n globalStore: GlobalStore\n uiStore: UiStore\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n\n makeAutoObservable(this)\n }\n\n completeOnboarding = async () => {\n const updatedUserProfile = {\n ...this.globalStore.userStore.userProfile,\n has_completed_cash_flow_onboarding: true,\n } as UserProfile\n\n await this.globalStore.userStore.updateUserProfile(updatedUserProfile)\n }\n}\n"],"names":["UiStore","startOfToday","addDays","makeAutoObservable","differenceInDays","a","isBefore","endOfMonth","nextIncome","expenses","accounts","CashflowStore","globalStore","updatedUserProfile"],"mappings":";;;;;;AASO,MAAMA,EAAQ;AAAA;AAAA,EAEnB,YAAY,EAAE,OAAOC,KAAgB,KAAKC,EAAQD,EAAA,GAAgB,EAAE;EACpE,UAAU;AAAA,EAEV,aAAmC;AAAA,EACnC,mBAA+B,CAAA;AAAA,EAE/B,uBAAkC,CAAA;AAAA,EAElC,cAAc;AACZ,IAAAE,EAAmB,IAAI;AAAA,EACzB;AAAA;AAAA,EAGA,IAAI,sBAAsB;AACjB,WAAA,KAAK,aACR,KAAK,IAAIC,EAAiBH,EAAa,GAAG,KAAK,WAAW,YAAY,CAAC,IACvE;AAAA,EACN;AAAA;AAAA;AAAA,EAIA,IAAI,wBAAwB;AAC1B,WAAO,KAAK,iBAAiB;AAAA,MAAO,CAACI,MACnCC,EAASD,EAAE,cAAc,KAAK,YAAY,gBAAgBE,EAAW,oBAAI,KAAM,CAAA,CAAC;AAAA,IAAA;AAAA,EAEpF;AAAA,EAEA,gBAAgB,CAACC,MAAyB;AACxC,SAAK,aAAaA;AAAA,EAAA;AAAA,EAGpB,sBAAsB,CAACC,MAAyB;AAC9C,SAAK,mBAAmBA;AAAA,EAAA;AAAA,EAG1B,0BAA0B,CAACC,MAAyB,KAAK,uBAAuBA;AAClF;ACzCO,MAAMC,EAAc;AAAA,EACzB;AAAA,EACA;AAAA,EAEA,YAAYC,GAA0B;AACpC,SAAK,cAAcA,GACd,KAAA,UAAU,IAAIZ,KAEnBG,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,qBAAqB,YAAY;AAC/B,UAAMU,IAAqB;AAAA,MACzB,GAAG,KAAK,YAAY,UAAU;AAAA,MAC9B,oCAAoC;AAAA,IAAA;AAGtC,UAAM,KAAK,YAAY,UAAU,kBAAkBA,CAAkB;AAAA,EAAA;AAEzE;"}
@@ -0,0 +1,117 @@
1
+ import "date-fns/intlFormat";
2
+ import "date-fns/getUnixTime";
3
+ import "bowser";
4
+ import "react";
5
+ import "@honeybadger-io/react";
6
+ import "react/jsx-runtime";
7
+ import "@mui/material/Button";
8
+ import "@kyper/mui";
9
+ import "@mui/material/Tooltip";
10
+ import "@mui/material/Box";
11
+ import "@mui/material/IconButton";
12
+ import { V as s } from "./ConnectMiniWidget-Ep65CtHH.mjs";
13
+ import "@mui/material/styles/useTheme";
14
+ import "@mui/material/useMediaQuery";
15
+ import "@mxenabled/cssinjs";
16
+ import "date-fns/addDays";
17
+ import "date-fns/addMonths";
18
+ import "date-fns/eachDayOfInterval";
19
+ import "date-fns/eachWeekOfInterval";
20
+ import "date-fns/endOfMonth";
21
+ import "date-fns/format";
22
+ import "date-fns/isBefore";
23
+ import "date-fns/isSameMonth";
24
+ import "date-fns/startOfMonth";
25
+ import "date-fns/startOfToday";
26
+ import "date-fns/subMonths";
27
+ import "@mui/material/Paper";
28
+ import "@mui/icons-material/KeyboardArrowLeftRounded";
29
+ import "@mui/icons-material/KeyboardArrowRightRounded";
30
+ import "date-fns/isSameDay";
31
+ import "date-fns/isWithinInterval";
32
+ import "d3";
33
+ import "@mui/material/styles";
34
+ import "@mui/x-charts";
35
+ import "@mui/material/Stack";
36
+ import "@mui/material";
37
+ import "date-fns/addYears";
38
+ import "date-fns/differenceInCalendarDays";
39
+ import "date-fns/endOfToday";
40
+ import "date-fns/endOfYear";
41
+ import "date-fns/startOfYear";
42
+ import "date-fns/subDays";
43
+ import "date-fns/subYears";
44
+ import "@mui/material/ButtonGroup";
45
+ import "@mui/material/Tab";
46
+ import "@mui/material/Tabs";
47
+ import "@mui/material/ToggleButton";
48
+ import "@mui/material/ToggleButtonGroup";
49
+ import "@mui/material/Dialog";
50
+ import "@mui/material/DialogContent";
51
+ import "@mui/icons-material/ArrowBackOutlined";
52
+ import "@mui/material/Card";
53
+ import "@mui/material/CardHeader";
54
+ import "@mui/material/CardContent";
55
+ import "uuid";
56
+ import "numeral";
57
+ import "@mui/material/CircularProgress";
58
+ import "@mui/material/FormControlLabel";
59
+ import "@mui/material/Radio";
60
+ import "@mui/material/Avatar";
61
+ import "@mui/material/ListItem";
62
+ import "@mui/material/ListItemAvatar";
63
+ import "@mui/material/ListItemButton";
64
+ import "@mui/material/ListItemText";
65
+ import "@mui/material/ListItemIcon";
66
+ import "mobx";
67
+ import "date-fns/differenceInDays";
68
+ import "date-fns/fromUnixTime";
69
+ import "@mui/x-data-grid-pro";
70
+ import "date-fns";
71
+ import "date-fns/getMonth";
72
+ import "date-fns/isAfter";
73
+ import "date-fns/addQuarters";
74
+ import "date-fns/addWeeks";
75
+ import "date-fns/nextDay";
76
+ import "date-fns/parseISO";
77
+ import "date-fns/setDate";
78
+ import "date-fns/subWeeks";
79
+ import "date-fns/getDay";
80
+ import "date-fns/formatISO";
81
+ const g = (o, r) => o.find((t) => t.guid === r), qt = (o, r) => o.find((t) => t.guid === r), wt = (o, r) => {
82
+ const t = o.find((i) => i.subCategories.find((p) => p.guid === r));
83
+ if (t)
84
+ return t.subCategories.find((i) => i.guid === r);
85
+ }, zt = (o, r) => {
86
+ const t = [];
87
+ for (const i of r) {
88
+ const p = g(o, i.category_guid);
89
+ if (!p) continue;
90
+ const m = p.parent_guid ?? p.guid, e = g(o, m);
91
+ if (!e) continue;
92
+ const n = {
93
+ amount: i.total,
94
+ category: p,
95
+ guid: p.guid,
96
+ subCategoryTotals: []
97
+ }, a = t.find((u) => u.guid === m);
98
+ a ? (a.amount += i.total, a.subCategoryTotals.push(n)) : t.push({
99
+ amount: i.total,
100
+ category: e,
101
+ guid: m,
102
+ subCategoryTotals: [n]
103
+ });
104
+ }
105
+ return t;
106
+ }, At = (o, r) => {
107
+ const t = o.find((i) => i.guid === r);
108
+ return t ? t.guid === s.INCOME || t.parent_guid === s.INCOME : !1;
109
+ };
110
+ export {
111
+ wt as a,
112
+ g as b,
113
+ zt as c,
114
+ qt as g,
115
+ At as i
116
+ };
117
+ //# sourceMappingURL=Categories-XVFviD23.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Categories-XVFviD23.mjs","sources":["../src/common/utils/Categories.ts"],"sourcesContent":["import type { Category, CategoryTotal, DateRangeCategoryTotals, DetailedCategory } from '../types'\nimport { CategoryGuids } from '../constants'\n\nexport const getCategory = (\n categories: Category[],\n categoryGuid: string | undefined,\n): Category | undefined => {\n return categories.find((c) => c.guid === categoryGuid)\n}\n\nexport const getDetailedCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n return detailedCategories.find((dc) => dc.guid === guid)\n}\n\nexport const getDetailedSubCategory = (\n detailedCategories: DetailedCategory[],\n guid: string | undefined,\n): DetailedCategory | undefined => {\n const parent = detailedCategories.find((dc) => dc.subCategories.find((sc) => sc.guid === guid))\n if (!parent) return undefined\n\n return parent.subCategories.find((sc) => sc.guid === guid)\n}\n\nexport const getCategoryTotalsByParent = (\n categories: Category[],\n dateRangeTotals: DateRangeCategoryTotals[],\n): CategoryTotal[] => {\n const categoryTotals = [] as CategoryTotal[]\n\n // Iterate over the category data from BE and roll up all categories into parent categories\n // acc is the accumulated category totals of type CategoryTotal that is initialized as an empty []\n // curr is the current DateRangeCategoryTotal\n\n for (const dateRangeTotal of dateRangeTotals) {\n const category = getCategory(categories, dateRangeTotal.category_guid)\n if (!category) continue\n\n const parentGuid = category.parent_guid ?? category.guid\n const parentCategory = getCategory(categories, parentGuid)\n if (!parentCategory) continue\n\n const categoryTotal = {\n amount: dateRangeTotal.total,\n category,\n guid: category.guid,\n subCategoryTotals: [],\n }\n\n const parentCategoryTotal = categoryTotals.find((ct) => ct.guid === parentGuid)\n if (parentCategoryTotal) {\n parentCategoryTotal.amount += dateRangeTotal.total\n parentCategoryTotal.subCategoryTotals.push(categoryTotal)\n } else {\n categoryTotals.push({\n amount: dateRangeTotal.total,\n category: parentCategory,\n guid: parentGuid,\n subCategoryTotals: [categoryTotal],\n })\n }\n }\n\n return categoryTotals\n}\n\nexport const isIncome = (categories: Category[], guid: string) => {\n const category = categories.find((c) => c.guid === guid)\n if (!category) return false\n\n return category.guid === CategoryGuids.INCOME || category.parent_guid === CategoryGuids.INCOME\n}\n"],"names":["getCategory","categories","categoryGuid","c","getDetailedCategory","detailedCategories","guid","dc","getDetailedSubCategory","parent","sc","getCategoryTotalsByParent","dateRangeTotals","categoryTotals","dateRangeTotal","category","parentGuid","parentCategory","categoryTotal","parentCategoryTotal","ct","isIncome","CategoryGuids"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGa,MAAAA,IAAc,CACzBC,GACAC,MAEOD,EAAW,KAAK,CAACE,MAAMA,EAAE,SAASD,CAAY,GAG1CE,KAAsB,CACjCC,GACAC,MAEOD,EAAmB,KAAK,CAACE,MAAOA,EAAG,SAASD,CAAI,GAG5CE,KAAyB,CACpCH,GACAC,MACiC;AACjC,QAAMG,IAASJ,EAAmB,KAAK,CAACE,MAAOA,EAAG,cAAc,KAAK,CAACG,MAAOA,EAAG,SAASJ,CAAI,CAAC;AAC1F,MAACG;AAEL,WAAOA,EAAO,cAAc,KAAK,CAACC,MAAOA,EAAG,SAASJ,CAAI;AAC3D,GAEaK,KAA4B,CACvCV,GACAW,MACoB;AACpB,QAAMC,IAAiB,CAAA;AAMvB,aAAWC,KAAkBF,GAAiB;AAC5C,UAAMG,IAAWf,EAAYC,GAAYa,EAAe,aAAa;AACrE,QAAI,CAACC,EAAU;AAET,UAAAC,IAAaD,EAAS,eAAeA,EAAS,MAC9CE,IAAiBjB,EAAYC,GAAYe,CAAU;AACzD,QAAI,CAACC,EAAgB;AAErB,UAAMC,IAAgB;AAAA,MACpB,QAAQJ,EAAe;AAAA,MACvB,UAAAC;AAAA,MACA,MAAMA,EAAS;AAAA,MACf,mBAAmB,CAAC;AAAA,IAAA,GAGhBI,IAAsBN,EAAe,KAAK,CAACO,MAAOA,EAAG,SAASJ,CAAU;AAC9E,IAAIG,KACFA,EAAoB,UAAUL,EAAe,OACzBK,EAAA,kBAAkB,KAAKD,CAAa,KAExDL,EAAe,KAAK;AAAA,MAClB,QAAQC,EAAe;AAAA,MACvB,UAAUG;AAAA,MACV,MAAMD;AAAA,MACN,mBAAmB,CAACE,CAAa;AAAA,IAAA,CAClC;AAAA,EAEL;AAEO,SAAAL;AACT,GAEaQ,KAAW,CAACpB,GAAwBK,MAAiB;AAChE,QAAMS,IAAWd,EAAW,KAAK,CAACE,MAAMA,EAAE,SAASG,CAAI;AACnD,SAACS,IAEEA,EAAS,SAASO,EAAc,UAAUP,EAAS,gBAAgBO,EAAc,SAFlE;AAGxB;"}
@@ -0,0 +1,298 @@
1
+ import { makeAutoObservable as w, runInAction as h } from "mobx";
2
+ import { getUnixTime as l } from "date-fns/getUnixTime";
3
+ import { subMonths as p } from "date-fns/subMonths";
4
+ import { startOfMonth as d } from "date-fns/startOfMonth";
5
+ import { endOfMonth as C } from "date-fns/endOfMonth";
6
+ import "bowser";
7
+ import "date-fns/intlFormat";
8
+ import { aj as M, al as b, V as E, af as $, ag as G, am as L } from "./ConnectMiniWidget-Ep65CtHH.mjs";
9
+ import "react";
10
+ import "@honeybadger-io/react";
11
+ import "numeral";
12
+ import "date-fns/addMonths";
13
+ import "date-fns/addQuarters";
14
+ import "date-fns/addWeeks";
15
+ import "date-fns/addYears";
16
+ import "date-fns/getDay";
17
+ import "date-fns/isBefore";
18
+ import "date-fns/nextDay";
19
+ import "date-fns/setDate";
20
+ import { startOfToday as D } from "date-fns/startOfToday";
21
+ import "date-fns/fromUnixTime";
22
+ import { F as N, A as c } from "./Fetch-DpUi1_Dx.mjs";
23
+ import "react/jsx-runtime";
24
+ import "@mui/material/Button";
25
+ import "@kyper/mui";
26
+ import "@mui/material/Tooltip";
27
+ import "@mui/material/Box";
28
+ import "@mui/material/IconButton";
29
+ import "@mui/material/styles/useTheme";
30
+ import "@mui/material/useMediaQuery";
31
+ import "@mxenabled/cssinjs";
32
+ import "date-fns/addDays";
33
+ import "date-fns/eachDayOfInterval";
34
+ import "date-fns/eachWeekOfInterval";
35
+ import { format as T } from "date-fns/format";
36
+ import "date-fns/isSameMonth";
37
+ import "@mui/material/Paper";
38
+ import "@mui/icons-material/KeyboardArrowLeftRounded";
39
+ import "@mui/icons-material/KeyboardArrowRightRounded";
40
+ import "date-fns/isSameDay";
41
+ import "date-fns/isWithinInterval";
42
+ import "d3";
43
+ import "@mui/material/styles";
44
+ import "@mui/x-charts";
45
+ import "@mui/material/Stack";
46
+ import "@mui/material";
47
+ import "date-fns/differenceInCalendarDays";
48
+ import "date-fns/endOfToday";
49
+ import "date-fns/endOfYear";
50
+ import "date-fns/startOfYear";
51
+ import "date-fns/subDays";
52
+ import "date-fns/subYears";
53
+ import "@mui/material/ButtonGroup";
54
+ import "@mui/material/Tab";
55
+ import "@mui/material/Tabs";
56
+ import "@mui/material/ToggleButton";
57
+ import "@mui/material/ToggleButtonGroup";
58
+ import "@mui/material/Dialog";
59
+ import "@mui/material/DialogContent";
60
+ import "@mui/icons-material/ArrowBackOutlined";
61
+ import "@mui/material/Card";
62
+ import "@mui/material/CardHeader";
63
+ import "@mui/material/CardContent";
64
+ import "uuid";
65
+ import "@mui/material/CircularProgress";
66
+ import "@mui/material/FormControlLabel";
67
+ import "@mui/material/Radio";
68
+ import "@mui/material/Avatar";
69
+ import "@mui/material/ListItem";
70
+ import "@mui/material/ListItemAvatar";
71
+ import "@mui/material/ListItemButton";
72
+ import "@mui/material/ListItemText";
73
+ import "@mui/material/ListItemIcon";
74
+ import "date-fns/differenceInDays";
75
+ import "@mui/x-data-grid-pro";
76
+ import "date-fns";
77
+ import "date-fns/getMonth";
78
+ import "date-fns/isAfter";
79
+ import "date-fns/parseISO";
80
+ import "date-fns/subWeeks";
81
+ import "date-fns/formatISO";
82
+ class f {
83
+ fetchInstance;
84
+ constructor(t, e) {
85
+ this.fetchInstance = new N(t, e);
86
+ }
87
+ addCategory = async (t) => this.fetchInstance.post(c.CATEGORIES, t).then((e) => e.category);
88
+ getCategories = async () => this.fetchInstance.get(c.CATEGORIES).then((t) => t.categories);
89
+ getDateRangeCategoryTotals = async (t, e, r) => this.fetchInstance.post(`${c.DATE_RANGE_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
90
+ account_guid: r.map((o) => o.guid)
91
+ }).then((o) => o.date_range_category_totals);
92
+ getMonthlyCategoryTotals = async (t, e, r) => r ? this.fetchInstance.post(`${c.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
93
+ account_guid: r.length === 0 ? [""] : r.map((o) => o.guid)
94
+ }).then((o) => o.monthly_category_totals) : this.fetchInstance.get(`${c.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`).then((o) => o.monthly_category_totals);
95
+ removeCategory = async (t) => this.fetchInstance.delete(`${c.CATEGORIES}/${t}`);
96
+ updateCategory = async (t) => this.fetchInstance.put(`${c.CATEGORIES}/${t.guid}`, t).then((e) => e.category);
97
+ }
98
+ const v = 3, S = 12, x = (a, t, e) => a.filter((r) => !r.parent_guid).map(
99
+ (r) => O(
100
+ r,
101
+ t,
102
+ e,
103
+ a.filter((o) => o.parent_guid === r.guid)
104
+ )
105
+ ), O = (a, t, e, r = []) => {
106
+ const o = a.guid, s = a.parent_guid || o, n = o === s, g = t.find((i) => i.category_guid === o)?.total || 0, m = _(
107
+ e.filter((i) => i.category_guid === o)
108
+ ), y = _(
109
+ e.filter(
110
+ (i) => i.category_guid === o || i.top_level_category_guid === o
111
+ )
112
+ ), u = r.map(
113
+ (i) => O(i, t, e)
114
+ ), I = u.reduce(
115
+ (i, R) => i + R.currentAmount,
116
+ g
117
+ );
118
+ return {
119
+ ...a,
120
+ currentAmount: g,
121
+ averageAmount: A(m),
122
+ color: M[s],
123
+ icon: b[s],
124
+ isTransfer: s === E.TRANSFER,
125
+ monthlyAmounts: m,
126
+ subCategories: u,
127
+ totalAmount: n ? I : 0,
128
+ totalAverageAmount: A(y),
129
+ totalMonthlyAmounts: n ? y : []
130
+ };
131
+ }, A = (a, t = v) => {
132
+ const e = t > history.length ? history.length : t;
133
+ return Math.ceil(
134
+ Math.max(
135
+ 0,
136
+ a.slice(-e).reduce((r, o) => r + o.amount, 0) / e
137
+ )
138
+ );
139
+ }, _ = (a) => {
140
+ const t = [], e = D();
141
+ for (let r = 0; r <= S; r++) {
142
+ const o = d(p(e, S - r)), n = a.filter(
143
+ (g) => g.year_month === Number(T(o, "yyyyMM"))
144
+ ).reduce((g, m) => g + m.total, 0);
145
+ t.push({
146
+ amount: n,
147
+ isoDate: T(o, "yyyy-MM-dd"),
148
+ label: $(o, G.MONTH_YEAR)
149
+ });
150
+ }
151
+ return t;
152
+ };
153
+ class Y {
154
+ expandedGuid = null;
155
+ selectedGuid = null;
156
+ searchValue = "";
157
+ showSelected = !0;
158
+ shouldDisableDrawerScroll = !1;
159
+ unselectable = [];
160
+ unselectableText = "";
161
+ savedOnSelect;
162
+ // todo
163
+ constructor() {
164
+ w(this);
165
+ }
166
+ setExpandedGuid = (t) => this.expandedGuid = t;
167
+ setSelectedGuid = (t) => this.selectedGuid = t;
168
+ setSearchValue = (t) => this.searchValue = t;
169
+ setShouldDisableDrawerScroll = (t) => this.shouldDisableDrawerScroll = t;
170
+ setShowSelected = (t) => this.showSelected = t;
171
+ setUnselectable = (t) => this.unselectable = t;
172
+ setUnselectableText = (t) => this.unselectableText = t;
173
+ onSelect = (t) => this.savedOnSelect(t);
174
+ setOnSelect = (t) => this.savedOnSelect = t;
175
+ }
176
+ class me {
177
+ api = new f("/", "");
178
+ globalStore;
179
+ uiStore;
180
+ categories = [];
181
+ dateRangeCategoryTotals = [];
182
+ monthlyCategoryTotals = [];
183
+ isLoadingCategoryTotals = !1;
184
+ constructor(t) {
185
+ this.globalStore = t, this.uiStore = new Y(), w(this);
186
+ }
187
+ initialize = async (t, e) => {
188
+ this.api = new f(t, e), await this.loadCategories();
189
+ };
190
+ get detailedCategories() {
191
+ return x(
192
+ this.categories,
193
+ this.dateRangeCategoryTotals,
194
+ this.monthlyCategoryTotals
195
+ );
196
+ }
197
+ get incomeCategories() {
198
+ return this.detailedCategories.filter((t) => t.is_income);
199
+ }
200
+ get spendCategories() {
201
+ return this.detailedCategories.filter(
202
+ (t) => !t.is_income && !t.isTransfer && t.guid !== E.INVESTMENTS
203
+ );
204
+ }
205
+ get transferCategories() {
206
+ return this.detailedCategories.filter((t) => t.isTransfer);
207
+ }
208
+ addCategory = async (t, e) => {
209
+ const r = { name: t, parent_guid: e };
210
+ try {
211
+ await this.api.addCategory(r), await this.loadCategories();
212
+ } catch (o) {
213
+ console.error(`Error occurred while adding category: ${o}`);
214
+ }
215
+ };
216
+ loadCategories = async () => {
217
+ try {
218
+ const t = await this.api.getCategories(), { default_categories: e } = this.globalStore.copyStore.copy.categories;
219
+ h(() => {
220
+ this.categories = t.map((r) => ({
221
+ ...r,
222
+ name: e[r.guid] ? e[r.guid].replace(/&amp;/g, "&") : r.name
223
+ }));
224
+ });
225
+ } catch (t) {
226
+ console.error(`Error occurred while getting categories: ${t}`);
227
+ }
228
+ };
229
+ loadDateRangeCategoryTotals = async (t, e, r) => {
230
+ this.setIsLoadingCategoryTotals(!0);
231
+ try {
232
+ const o = await this.api.getDateRangeCategoryTotals(
233
+ l(e),
234
+ l(r),
235
+ t
236
+ );
237
+ h(() => {
238
+ this.dateRangeCategoryTotals = o, this.setIsLoadingCategoryTotals(!1);
239
+ });
240
+ } catch (o) {
241
+ this.setIsLoadingCategoryTotals(!1), console.error(`Error occurred while getting date range category totals: ${o}`);
242
+ }
243
+ };
244
+ loadMonthlyCategoryTotals = async (t = this.globalStore.accountStore.accounts, e, r) => {
245
+ const o = l(d(e ?? p(/* @__PURE__ */ new Date(), 11))), s = l(C(r ?? /* @__PURE__ */ new Date()));
246
+ try {
247
+ const n = await this.api.getMonthlyCategoryTotals(o, s, t);
248
+ h(() => {
249
+ this.monthlyCategoryTotals = n;
250
+ });
251
+ } catch (n) {
252
+ console.error(`Error occurred while getting monthly category totals: ${n}`);
253
+ }
254
+ };
255
+ reloadCategoryTotals = async (t, e, r) => {
256
+ this.setIsLoadingCategoryTotals(!0);
257
+ try {
258
+ const o = await this.api.getDateRangeCategoryTotals(
259
+ l(e),
260
+ l(r),
261
+ t
262
+ ), s = await this.api.getMonthlyCategoryTotals(
263
+ l(d(p(r, 11))),
264
+ l(C(r)),
265
+ t
266
+ );
267
+ h(() => {
268
+ this.dateRangeCategoryTotals = o, this.monthlyCategoryTotals = s, this.setIsLoadingCategoryTotals(!1);
269
+ });
270
+ } catch (o) {
271
+ console.error(`Error occurred while getting category totals: ${o}`);
272
+ }
273
+ };
274
+ removeCategory = async (t) => {
275
+ try {
276
+ await this.api.removeCategory(t), await this.loadCategories();
277
+ } catch (e) {
278
+ console.error(`Error occurred while removing category: ${e}`);
279
+ }
280
+ };
281
+ setIsLoadingCategoryTotals = (t) => {
282
+ this.isLoadingCategoryTotals = t;
283
+ };
284
+ updateCategory = async (t) => {
285
+ try {
286
+ await this.api.updateCategory(t), await this.loadCategories();
287
+ } catch (e) {
288
+ console.error(`Error occurred while updating category: ${e}`);
289
+ }
290
+ };
291
+ // TODO: Remove this after refactoring Trends components to use detailedCategories
292
+ getCategoryName = (t) => this.categories.find((r) => r.guid === t)?.name ?? L[t];
293
+ }
294
+ export {
295
+ me as C,
296
+ f as a
297
+ };
298
+ //# sourceMappingURL=CategoryStore-CSNSMNA6.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CategoryStore-CSNSMNA6.mjs","sources":["../src/common/api/CategoryApi.ts","../src/categories/util/CategoryUtil.ts","../src/categories/stores/UiStore.ts","../src/categories/stores/CategoryStore.ts"],"sourcesContent":["import Fetch from '../utils/Fetch'\n\nimport { ApiEndpoints } from '../constants/ApiEndpoints'\n\nimport type { Account } from '../types/Account'\nimport type { Category } from '../types/Category'\n\nexport class CategoryApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string) {\n this.fetchInstance = new Fetch(endpoint, token)\n }\n\n addCategory = async (category: Category) => {\n return this.fetchInstance.post(ApiEndpoints.CATEGORIES, category).then((data) => data.category)\n }\n\n getCategories = async () => {\n return this.fetchInstance.get(ApiEndpoints.CATEGORIES).then((data) => data.categories)\n }\n\n getDateRangeCategoryTotals = async (startDate: number, endDate: number, accounts: Account[]) => {\n return this.fetchInstance\n .post(`${ApiEndpoints.DATE_RANGE_CATEGORY_TOTALS}/from/${startDate}/to/${endDate}`, {\n account_guid: accounts.map((account) => account.guid),\n })\n .then((data) => data.date_range_category_totals)\n }\n\n getMonthlyCategoryTotals = async (startDate: number, endDate: number, accounts?: Account[]) => {\n return accounts\n ? this.fetchInstance\n .post(`${ApiEndpoints.MONTHLY_CATEGORY_TOTALS}/from/${startDate}/to/${endDate}`, {\n account_guid: accounts.length === 0 ? [''] : accounts.map((account) => account.guid),\n })\n .then((data) => data.monthly_category_totals)\n : this.fetchInstance\n .get(`${ApiEndpoints.MONTHLY_CATEGORY_TOTALS}/from/${startDate}/to/${endDate}`)\n .then((data) => data.monthly_category_totals)\n }\n\n removeCategory = async (guid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.CATEGORIES}/${guid}`)\n }\n\n updateCategory = async (category: Category) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.CATEGORIES}/${category.guid}`, category)\n .then((data) => data.category)\n }\n}\n","import { format } from 'date-fns/format'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { startOfToday } from 'date-fns/startOfToday'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport {\n type Category,\n type DateRangeCategoryTotals,\n type DetailedCategory,\n type MonthlyAmount,\n type MonthlyCategoryTotals,\n CategoryColors,\n CategoryGuids,\n CategoryIcon,\n DATE_FORMATS_INTL,\n formatDate,\n} from '../../common'\n\nconst MONTHLY_AVERAGE_LENGTH = 3\nconst MONTHS_OF_HISTORY = 12\n\n/**\n * Augment categories\n * @param categories - Categories to augment\n * @param monthlyCategoryTotals - Monthly category totals\n * @param currentCategoryTotals - Current month category totals\n */\nexport const augmentCategories = (\n categories: Category[],\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n): DetailedCategory[] => {\n return categories\n .filter((category) => !category.parent_guid)\n .map((category) =>\n getDetailedCategory(\n category,\n currentCategoryTotals,\n monthlyCategoryTotals,\n categories.filter((c) => c.parent_guid === category.guid),\n ),\n )\n}\n\n/**\n * Get an augmented category with additional details\n * @param category - The category to augment\n * @param currentCategoryTotals - Current month category totals\n * @param monthlyCategoryTotals - Past monthly category totals\n * @param subCategories - Subcategories for the specified category (If applicable)\n */\nconst getDetailedCategory = (\n category: Category,\n currentCategoryTotals: DateRangeCategoryTotals[],\n monthlyCategoryTotals: MonthlyCategoryTotals[],\n subCategories: Category[] = [],\n): DetailedCategory => {\n const guid = category.guid\n const parentGuid = category.parent_guid || guid\n const isParent = guid === parentGuid\n\n const currentAmount = currentCategoryTotals.find((t) => t.category_guid === guid)?.total || 0\n const monthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter((total) => total.category_guid === guid),\n )\n const totalMonthlyAmounts = getMonthlyAmounts(\n monthlyCategoryTotals.filter(\n (total) => total.category_guid === guid || total.top_level_category_guid === guid,\n ),\n )\n const detailedSubCategories = subCategories.map((subCategory) =>\n getDetailedCategory(subCategory, currentCategoryTotals, monthlyCategoryTotals),\n )\n const totalAmount = detailedSubCategories.reduce(\n (total, current) => total + current.currentAmount,\n currentAmount,\n )\n\n return {\n ...category,\n currentAmount,\n averageAmount: getAverage(monthlyAmounts),\n color: CategoryColors[parentGuid],\n icon: CategoryIcon[parentGuid],\n isTransfer: parentGuid === CategoryGuids.TRANSFER,\n monthlyAmounts,\n subCategories: detailedSubCategories,\n totalAmount: isParent ? totalAmount : 0,\n totalAverageAmount: getAverage(totalMonthlyAmounts),\n totalMonthlyAmounts: isParent ? totalMonthlyAmounts : [],\n }\n}\n\n/**\n * Get the average amount based on the number of months (numMonths) requested\n * @param monthlyAmounts - Monthly amounts to calculate and average from\n * @param numMonths - Number of months to base the average on (DEFAULT: 3)\n */\nconst getAverage = (\n monthlyAmounts: MonthlyAmount[],\n numMonths: number = MONTHLY_AVERAGE_LENGTH,\n): number => {\n const monthsBack = numMonths > history.length ? history.length : numMonths\n\n return Math.ceil(\n Math.max(\n 0,\n monthlyAmounts.slice(-monthsBack).reduce((total, current) => total + current.amount, 0) /\n monthsBack,\n ),\n )\n}\n\n/**\n * Get the last 12 months of amounts for a category\n * @param categoryTotals - Monthly category totals\n */\nconst getMonthlyAmounts = (categoryTotals: MonthlyCategoryTotals[]): MonthlyAmount[] => {\n const monthlyAmounts: MonthlyAmount[] = []\n const today = startOfToday()\n for (let i = 0; i <= MONTHS_OF_HISTORY; i++) {\n const historyDate = startOfMonth(subMonths(today, MONTHS_OF_HISTORY - i))\n const monthlyTotals = categoryTotals.filter(\n (total) => total.year_month === Number(format(historyDate, 'yyyyMM')),\n )\n const totalAmount = monthlyTotals.reduce((acc, curr) => acc + curr.total, 0)\n\n monthlyAmounts.push({\n amount: totalAmount,\n isoDate: format(historyDate, 'yyyy-MM-dd'),\n label: formatDate(historyDate, DATE_FORMATS_INTL.MONTH_YEAR),\n })\n }\n\n return monthlyAmounts\n}\n","import { makeAutoObservable } from 'mobx'\n\nexport class 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","import { makeAutoObservable, runInAction } from 'mobx'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { subMonths } from 'date-fns/subMonths'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { endOfMonth } from 'date-fns/endOfMonth'\n\nimport { Account, CategoryApi, CategoryGuids, CategoryGuidToName } from '../../common'\n\nimport type {\n Category,\n DetailedCategory,\n DateRangeCategoryTotals,\n GlobalStore,\n MonthlyCategoryTotals,\n} from '../../common'\n\nimport { augmentCategories } from '../util/CategoryUtil'\nimport { UiStore } from './UiStore'\n\nexport class CategoryStore {\n api = new CategoryApi('/', '')\n globalStore: GlobalStore\n uiStore: UiStore\n\n categories: Category[] = []\n dateRangeCategoryTotals: DateRangeCategoryTotals[] = []\n monthlyCategoryTotals: MonthlyCategoryTotals[] = []\n\n isLoadingCategoryTotals = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n\n makeAutoObservable(this)\n }\n\n initialize = async (endpoint: string, token: string) => {\n this.api = new CategoryApi(endpoint, token)\n\n await this.loadCategories()\n }\n\n get detailedCategories(): DetailedCategory[] {\n return augmentCategories(\n this.categories,\n this.dateRangeCategoryTotals,\n this.monthlyCategoryTotals,\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 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 }\n }\n\n loadCategories = async () => {\n try {\n const categories = await this.api.getCategories()\n const { default_categories } = this.globalStore.copyStore.copy.categories\n\n runInAction(() => {\n this.categories = categories.map((category: Category) => ({\n ...category,\n name: default_categories[category.guid]\n ? default_categories[category.guid].replace(/&amp;/g, '&')\n : category.name,\n }))\n })\n } catch (error) {\n console.error(`Error occurred while getting categories: ${error}`)\n }\n }\n\n loadDateRangeCategoryTotals = async (accounts: Account[], startDate: Date, endDate: Date) => {\n this.setIsLoadingCategoryTotals(true)\n try {\n const totals = await this.api.getDateRangeCategoryTotals(\n getUnixTime(startDate),\n getUnixTime(endDate),\n accounts,\n )\n runInAction(() => {\n this.dateRangeCategoryTotals = totals\n this.setIsLoadingCategoryTotals(false)\n })\n } catch (error) {\n this.setIsLoadingCategoryTotals(false)\n console.error(`Error occurred while getting date range category totals: ${error}`)\n }\n }\n\n loadMonthlyCategoryTotals = async (\n accounts: Account[] = this.globalStore.accountStore.accounts,\n startDate?: Date,\n endDate?: Date,\n ) => {\n const start = getUnixTime(startOfMonth(startDate ?? subMonths(new Date(), 11)))\n const end = getUnixTime(endOfMonth(endDate ?? new Date()))\n\n try {\n const totals = await this.api.getMonthlyCategoryTotals(start, end, accounts)\n\n runInAction(() => {\n this.monthlyCategoryTotals = totals\n })\n } catch (error) {\n console.error(`Error occurred while getting monthly category totals: ${error}`)\n }\n }\n\n reloadCategoryTotals = async (accounts: Account[], startDate: Date, endDate: Date) => {\n this.setIsLoadingCategoryTotals(true)\n try {\n const dateRangeTotals = await this.api.getDateRangeCategoryTotals(\n getUnixTime(startDate),\n getUnixTime(endDate),\n accounts,\n )\n\n const monthlyTotals = await this.api.getMonthlyCategoryTotals(\n getUnixTime(startOfMonth(subMonths(endDate, 11))),\n getUnixTime(endOfMonth(endDate)),\n accounts,\n )\n\n runInAction(() => {\n this.dateRangeCategoryTotals = dateRangeTotals\n this.monthlyCategoryTotals = monthlyTotals\n this.setIsLoadingCategoryTotals(false)\n })\n } catch (error) {\n console.error(`Error occurred while getting category totals: ${error}`)\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 }\n }\n\n setIsLoadingCategoryTotals = (isLoading: boolean) => {\n this.isLoadingCategoryTotals = isLoading\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 }\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"],"names":["CategoryApi","endpoint","token","Fetch","category","ApiEndpoints","data","startDate","endDate","accounts","account","guid","MONTHLY_AVERAGE_LENGTH","MONTHS_OF_HISTORY","augmentCategories","categories","currentCategoryTotals","monthlyCategoryTotals","getDetailedCategory","c","subCategories","parentGuid","isParent","currentAmount","t","monthlyAmounts","getMonthlyAmounts","total","totalMonthlyAmounts","detailedSubCategories","subCategory","totalAmount","current","getAverage","CategoryColors","CategoryIcon","CategoryGuids","numMonths","monthsBack","categoryTotals","today","startOfToday","i","historyDate","startOfMonth","subMonths","format","acc","curr","formatDate","DATE_FORMATS_INTL","UiStore","makeAutoObservable","value","shouldDisable","showSelected","unselectable","text","callback","CategoryStore","globalStore","name","error","default_categories","runInAction","totals","getUnixTime","start","end","endOfMonth","dateRangeTotals","monthlyTotals","isLoading","CategoryGuidToName"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOO,MAAMA,EAAY;AAAA,EACvB;AAAA,EAEA,YAAYC,GAAkBC,GAAe;AAC3C,SAAK,gBAAgB,IAAIC,EAAMF,GAAUC,CAAK;AAAA,EAChD;AAAA,EAEA,cAAc,OAAOE,MACZ,KAAK,cAAc,KAAKC,EAAa,YAAYD,CAAQ,EAAE,KAAK,CAACE,MAASA,EAAK,QAAQ;AAAA,EAGhG,gBAAgB,YACP,KAAK,cAAc,IAAID,EAAa,UAAU,EAAE,KAAK,CAACC,MAASA,EAAK,UAAU;AAAA,EAGvF,6BAA6B,OAAOC,GAAmBC,GAAiBC,MAC/D,KAAK,cACT,KAAK,GAAGJ,EAAa,0BAA0B,SAASE,CAAS,OAAOC,CAAO,IAAI;AAAA,IAClF,cAAcC,EAAS,IAAI,CAACC,MAAYA,EAAQ,IAAI;AAAA,EACrD,CAAA,EACA,KAAK,CAACJ,MAASA,EAAK,0BAA0B;AAAA,EAGnD,2BAA2B,OAAOC,GAAmBC,GAAiBC,MAC7DA,IACH,KAAK,cACF,KAAK,GAAGJ,EAAa,uBAAuB,SAASE,CAAS,OAAOC,CAAO,IAAI;AAAA,IAC/E,cAAcC,EAAS,WAAW,IAAI,CAAC,EAAE,IAAIA,EAAS,IAAI,CAACC,MAAYA,EAAQ,IAAI;AAAA,EACpF,CAAA,EACA,KAAK,CAACJ,MAASA,EAAK,uBAAuB,IAC9C,KAAK,cACF,IAAI,GAAGD,EAAa,uBAAuB,SAASE,CAAS,OAAOC,CAAO,EAAE,EAC7E,KAAK,CAACF,MAASA,EAAK,uBAAuB;AAAA,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