@mx-cartographer/experiences 7.3.0-alpha.sms1 → 7.3.1

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 (105) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/dist/{Account-Bxw0_4FU.mjs → Account-YwUMFz93.mjs} +1 -1
  3. package/dist/{AccountDetailsContent-CAM9y39M.mjs → AccountDetailsContent-BgCST7mK.mjs} +8 -8
  4. package/dist/AccountDetailsHeader-jAFWoHj7.mjs +87 -0
  5. package/dist/{AccountFields-C9FlatNb.mjs → AccountFields-DPxMPBF0.mjs} +2 -2
  6. package/dist/{AccountListItem-JFMZROh7.mjs → AccountListItem-D6rWAreC.mjs} +8 -8
  7. package/dist/{AccountStore-BgNOyMdp.mjs → AccountStore-B5E98oM1.mjs} +100 -74
  8. package/dist/Accounts-UIlYCmHb.mjs +9 -0
  9. package/dist/{BeatApi-DhJpgCLz.mjs → BeatApi-De2IaqH2.mjs} +1 -1
  10. package/dist/{BeatStore-IBnXd4YK.mjs → BeatStore-D_NYuBSz.mjs} +1 -1
  11. package/dist/{BudgetUtil-B2ZXyw-g.mjs → BudgetUtil-CXvenbdN.mjs} +1 -1
  12. package/dist/{CategorySelectorDrawer-DUe4lH5-.mjs → CategorySelectorDrawer-Buy70Y3V.mjs} +21 -19
  13. package/dist/CategoryStore-BEdFs69_.mjs +183 -0
  14. package/dist/CategoryUtil-BR3H5i6n.mjs +78 -0
  15. package/dist/{ConnectDrawer-BQNs-hjk.mjs → ConnectDrawer-CbxHKlRv.mjs} +10 -10
  16. package/dist/{ConnectionsDrawer-ByGQE7D5.mjs → ConnectionsDrawer-C6kanU7I.mjs} +4 -4
  17. package/dist/{CurrencyInput-DUsQbkXb.mjs → CurrencyInput-lSC7oPDg.mjs} +1 -1
  18. package/dist/{DebtsStore-C9bblOgW.mjs → DebtsStore-DgIcphe_.mjs} +1 -1
  19. package/dist/{ExportCsvAction-sX8Rg4Ov.mjs → ExportCsvAction-DNSgmdyv.mjs} +3 -3
  20. package/dist/{Fetch-87LIQbEA.mjs → Fetch-DecPFeGU.mjs} +24 -22
  21. package/dist/{FinstrongStore-F2c607dj.mjs → FinstrongStore-CL7t5lBL.mjs} +1 -1
  22. package/dist/{GoalStore-D-aB35SY.mjs → GoalStore-CAlmSu4U.mjs} +112 -152
  23. package/dist/{Help-B6dIcujh.mjs → Help-hi9I9EYP.mjs} +1 -1
  24. package/dist/{LineChart-D4GI7nVh.mjs → LineChart-eK4IQImU.mjs} +2 -2
  25. package/dist/{ListItemAction-DHa3KJPs.mjs → ListItemAction-BmL5buOf.mjs} +1 -1
  26. package/dist/{ManageIncome-1s_q5W4X.mjs → ManageIncome-Cypo9qY4.mjs} +66 -65
  27. package/dist/{MerchantStore-DrFvsUyy.mjs → MerchantStore-WvZ4gnQe.mjs} +1 -1
  28. package/dist/{MicroWidgetContainer-DpeqN9n3.mjs → MicroWidgetContainer-CFdMGJKg.mjs} +1 -1
  29. package/dist/{MiniWidgetContainer-D0gfmbaF.mjs → MiniWidgetContainer-BdgBvpga.mjs} +1 -1
  30. package/dist/{NetWorthStore-DCsTZpuS.mjs → NetWorthStore-CxqIxAgN.mjs} +2 -2
  31. package/dist/{NotificationSettings-DqrkNMod.mjs → NotificationSettings-DxytNHlN.mjs} +240 -237
  32. package/dist/{NotificationStore-BxP_P2dA.mjs → NotificationStore-CDX_kqHa.mjs} +7 -15
  33. package/dist/{OriginalBalanceAction-CWuVvRq9.mjs → OriginalBalanceAction-V6FEoIDe.mjs} +3 -3
  34. package/dist/{RecurringSettings-A_rAGCTP.mjs → RecurringSettings-iIupYxJW.mjs} +4 -4
  35. package/dist/{RecurringTransactions-DK8dWldr.mjs → RecurringTransactions-ej39mgA6.mjs} +3 -3
  36. package/dist/{RecurringTransactionsStore-C4YOD7_D.mjs → RecurringTransactionsStore-BiwCzScZ.mjs} +26 -29
  37. package/dist/{SettingsStore-BcgS_Ohv.mjs → SettingsStore-krIRNwHK.mjs} +3 -3
  38. package/dist/{ToggleListItem-r0Kx56wF.mjs → ToggleListItem-ciFTiqRS.mjs} +19 -14
  39. package/dist/TransactionApi-CjBoLleL.mjs +86 -0
  40. package/dist/{TransactionDetails-oP1eSuiS.mjs → TransactionDetails-BUoNbsu-.mjs} +402 -367
  41. package/dist/TransactionStore-CtGTg0XS.mjs +677 -0
  42. package/dist/TrendsStore-5PvDT_o6.mjs +182 -0
  43. package/dist/{User-BQUxBeZV.mjs → User-Bj34_i8g.mjs} +1 -1
  44. package/dist/{ViewMoreMicroCard-SCn2wt4i.mjs → ViewMoreMicroCard-lihSDk2J.mjs} +517 -493
  45. package/dist/{WidgetContainer-BHWANqT4.mjs → WidgetContainer-BnTgAfQn.mjs} +2 -2
  46. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.d.ts +4 -1
  47. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsHeader.d.ts +2 -1
  48. package/dist/accounts/index.es.js +241 -203
  49. package/dist/accounts/stores/AccountStore.d.ts +22 -25
  50. package/dist/accounts/utils/Accounts.d.ts +1 -2
  51. package/dist/analytics/index.es.js +2 -2
  52. package/dist/budgets/index.es.js +500 -507
  53. package/dist/budgets/store/BudgetsStore.d.ts +0 -1
  54. package/dist/cashflow/index.es.js +384 -382
  55. package/dist/categories/index.es.js +2 -2
  56. package/dist/categories/stores/CategoryStore.d.ts +1 -5
  57. package/dist/categories/util/CategoryUtil.d.ts +2 -3
  58. package/dist/common/components/charts/index.d.ts +0 -2
  59. package/dist/common/index.es.js +391 -376
  60. package/dist/common/stores/AppDataStore.d.ts +1 -3
  61. package/dist/common/stores/GlobalCopyStore.d.ts +1 -0
  62. package/dist/common/stores/GlobalStore.d.ts +10 -4
  63. package/dist/common/stores/UserStore.d.ts +2 -3
  64. package/dist/common/types/Account.d.ts +6 -9
  65. package/dist/common/types/Global.d.ts +1 -0
  66. package/dist/dashboard/index.es.js +2 -2
  67. package/dist/debts/index.es.js +506 -498
  68. package/dist/exportTransactionsToCSV-C4PkIYP6.mjs +48 -0
  69. package/dist/finstrong/index.es.js +417 -415
  70. package/dist/goals/index.es.js +559 -557
  71. package/dist/goals/stores/GoalStore.d.ts +4 -17
  72. package/dist/help/index.es.js +3 -3
  73. package/dist/{hooks-D6XlXHf4.mjs → hooks-Cy8JnjCg.mjs} +2 -2
  74. package/dist/insights/index.es.js +1 -1
  75. package/dist/investments/index.es.js +437 -435
  76. package/dist/investments/stores/HoldingStore.d.ts +0 -1
  77. package/dist/merchants/index.es.js +2 -2
  78. package/dist/microinsights/carousel/BeatList.d.ts +10 -0
  79. package/dist/microinsights/carousel/CarouselControls.d.ts +1 -1
  80. package/dist/microinsights/index.es.js +1 -1
  81. package/dist/microinsights/interfaces.d.ts +0 -1
  82. package/dist/networth/index.es.js +176 -174
  83. package/dist/notifications/index.es.js +23 -23
  84. package/dist/notifications/stores/NotificationStore.d.ts +1 -3
  85. package/dist/recurringtransactions/index.es.js +175 -173
  86. package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +2 -3
  87. package/dist/settings/index.es.js +285 -279
  88. package/dist/spending/index.es.js +328 -304
  89. package/dist/transactions/components/shared/TransactionDetails.d.ts +1 -0
  90. package/dist/transactions/index.es.js +63 -64
  91. package/dist/transactions/stores/TransactionStore.d.ts +77 -21
  92. package/dist/trends/index.es.js +948 -583
  93. package/dist/{useAccountDisplayName-BUAApBIb.mjs → useAccountDisplayName-D6sQsNNQ.mjs} +2 -2
  94. package/dist/{useCombineEvents-BUDIR1ba.mjs → useCombineEvents-CRwX-qWE.mjs} +1 -1
  95. package/dist/{useInsightsEnabled-DBpwEq10.mjs → useInsightsEnabled-BxytCjq5.mjs} +1 -1
  96. package/package.json +3 -3
  97. package/dist/AccountDetailsHeader-JtSX6Uf9.mjs +0 -120
  98. package/dist/Accounts-BRf_YeTf.mjs +0 -27
  99. package/dist/CategoryStore-yHI0hWmK.mjs +0 -174
  100. package/dist/CategoryUtil-pZRIYOgN.mjs +0 -80
  101. package/dist/TransactionApi-B3Tksf7L.mjs +0 -86
  102. package/dist/TransactionStore-ai3uII_r.mjs +0 -690
  103. package/dist/TrendsStore-DCYbpXPO.mjs +0 -559
  104. package/dist/exportTransactionsToCSV-7bVS7KXf.mjs +0 -47
  105. package/dist/useAriaLive-B3_pRUio.mjs +0 -35
@@ -2,7 +2,7 @@ import { jsx as t, jsxs as E } from "react/jsx-runtime";
2
2
  import { observer as g } from "mobx-react-lite";
3
3
  import C from "react";
4
4
  import $ from "@mui/material/Stack";
5
- import { G as K, m as y, u as b, g as D, b as U } from "./hooks-D6XlXHf4.mjs";
5
+ import { G as K, m as y, u as b, g as D, b as U } from "./hooks-Cy8JnjCg.mjs";
6
6
  import Y from "@mui/material/List";
7
7
  import V from "@mui/material/Paper";
8
8
  import v from "@mui/material/Divider";
@@ -23,7 +23,7 @@ import I from "@mui/material/IconButton";
23
23
  import { S as oe } from "./SearchBox-B2_zLv8-.mjs";
24
24
  import { L as k } from "./Loader-DUaFpDGv.mjs";
25
25
  import { D as ae } from "./Drawer-kEE73B87.mjs";
26
- const h = () => {
26
+ const p = () => {
27
27
  if (!C.useContext(K))
28
28
  throw new Error("useCategoryUiStore() must be used within the GlobalDataContext");
29
29
  return y().uiStore;
@@ -48,7 +48,7 @@ const re = ({
48
48
  isOpen: c,
49
49
  type: s
50
50
  }) => {
51
- const [a, i] = C.useState(e), { categories: n } = b(), { setShouldDisableDrawerScroll: l } = h();
51
+ const [a, i] = C.useState(e), { categories: n } = b(), { setShouldDisableDrawerScroll: l } = p();
52
52
  let u = "", d = [];
53
53
  const _ = s === "delete";
54
54
  switch (s) {
@@ -82,9 +82,11 @@ const re = ({
82
82
  children: /* @__PURE__ */ t(Q, { children: _ ? /* @__PURE__ */ t(B, { children: d }) : /* @__PURE__ */ t(
83
83
  q,
84
84
  {
85
- "aria-label": s === "edit" ? n.edit_subcategory_aria : n.add_subcategory_aria,
85
+ inputProps: {
86
+ "aria-label": s === "edit" ? n.edit_subcategory_aria : n.add_subcategory_aria
87
+ },
86
88
  name: "modify-subcategory",
87
- onChange: (p) => i(p.target.value),
89
+ onChange: (h) => i(h.target.value),
88
90
  placeholder: n.input_placeholder,
89
91
  sx: { width: "100%" },
90
92
  value: a
@@ -93,7 +95,7 @@ const re = ({
93
95
  }
94
96
  );
95
97
  }, R = g(re), ne = ({ parentCategory: e }) => {
96
- const [o, r] = C.useState(!1), { addCategory: c } = y(), { categories: s } = b(), { onEvent: a } = D(), { setShouldDisableDrawerScroll: i } = h(), n = async (d) => {
98
+ const [o, r] = C.useState(!1), { addCategory: c } = y(), { categories: s } = b(), { onEvent: a } = D(), { setShouldDisableDrawerScroll: i } = p(), n = async (d) => {
97
99
  await c(d.trim(), e.guid), a(m.ON_SUBCATEGORY_ADDED), r(!1);
98
100
  }, l = async () => {
99
101
  a(m.ON_SUBCATEGORY_ADD_CLICK), i(!0), r(!0);
@@ -168,7 +170,7 @@ const re = ({
168
170
  showSelected: i,
169
171
  unselectable: n,
170
172
  unselectableText: l
171
- } = h(), { categories: u } = b(), { onEvent: d } = D(), [_, p] = C.useState(!1), [f, O] = C.useState(!1), T = !!o.revision, A = o.guid === c, w = !n.some((P) => P === o.guid);
173
+ } = p(), { categories: u } = b(), { onEvent: d } = D(), [_, h] = C.useState(!1), [f, O] = C.useState(!1), T = !!o.revision, A = o.guid === c, w = !n.some((P) => P === o.guid);
172
174
  return /* @__PURE__ */ E(
173
175
  x,
174
176
  {
@@ -205,7 +207,7 @@ const re = ({
205
207
  {
206
208
  "aria-label": S(u.edit_subcategory_aria, o.name),
207
209
  onClick: () => {
208
- p(!0), a(!0), d(m.ON_SUBCATEGORY_EDIT_CLICK);
210
+ h(!0), a(!0), d(m.ON_SUBCATEGORY_EDIT_CLICK);
209
211
  },
210
212
  children: /* @__PURE__ */ t(j, { color: "secondary" })
211
213
  }
@@ -234,7 +236,7 @@ const re = ({
234
236
  _ && /* @__PURE__ */ t(
235
237
  ce,
236
238
  {
237
- setShowRename: p,
239
+ setShowRename: h,
238
240
  showRename: _,
239
241
  subCategory: o
240
242
  }
@@ -243,7 +245,7 @@ const re = ({
243
245
  }
244
246
  );
245
247
  }, me = g(ue), Ce = ({ categories: e, parentCategory: o }) => {
246
- const { expandedGuid: r, searchValue: c } = h(), s = o.guid === r, a = !!c;
248
+ const { expandedGuid: r, searchValue: c } = p(), s = o.guid === r, a = !!c;
247
249
  return /* @__PURE__ */ t(
248
250
  J,
249
251
  {
@@ -269,7 +271,7 @@ const re = ({
269
271
  }
270
272
  );
271
273
  }, ge = g(Ce), _e = ({ category: e, subCategories: o }) => {
272
- const { expandedGuid: r, searchValue: c, setExpandedGuid: s } = h(), { onEvent: a } = D(), i = e.guid === r, n = () => {
274
+ const { expandedGuid: r, searchValue: c, setExpandedGuid: s } = p(), { onEvent: a } = D(), i = e.guid === r, n = () => {
273
275
  const l = e.guid !== r ? e.guid : null;
274
276
  s(l), a(l ? m.ON_CATEGORY_EXPANDED : m.ON_CATEGORY_COLLAPSED);
275
277
  };
@@ -307,8 +309,8 @@ const re = ({
307
309
  /* @__PURE__ */ t(v, { sx: { ml: 58 } }),
308
310
  /* @__PURE__ */ t(ge, { categories: o, parentCategory: e })
309
311
  ] });
310
- }, Ee = g(_e), he = () => {
311
- const { categories: e } = y(), { searchValue: o } = h(), { categories: r } = b(), s = ((a, i = "") => a.reduce((n, l) => {
312
+ }, Ee = g(_e), pe = () => {
313
+ const { categories: e } = y(), { searchValue: o } = p(), { categories: r } = b(), s = ((a, i = "") => a.reduce((n, l) => {
312
314
  if (l.parent_guid === null) {
313
315
  const d = [
314
316
  {
@@ -333,7 +335,7 @@ const re = ({
333
335
  },
334
336
  a.category.guid
335
337
  )) }) });
336
- }, pe = g(he), Se = ({
338
+ }, he = g(pe), Se = ({
337
339
  initialSelected: e,
338
340
  onSelect: o = void 0,
339
341
  showSelected: r = !0,
@@ -344,17 +346,17 @@ const re = ({
344
346
  searchValue: u,
345
347
  setOnSelect: d,
346
348
  setSearchValue: _,
347
- setSelectedGuid: p,
349
+ setSelectedGuid: h,
348
350
  setShowSelected: f,
349
351
  setUnselectable: O,
350
352
  setUnselectableText: T
351
- } = h();
353
+ } = p();
352
354
  return C.useEffect(() => {
353
355
  o && d(o);
354
356
  }), C.useEffect(() => {
355
357
  a.length || i();
356
358
  }, []), C.useEffect(() => {
357
- e && p(e), f(r), O(c), T(s);
359
+ e && h(e), f(r), O(c), T(s);
358
360
  }, [e, r, c, s]), l ? /* @__PURE__ */ E($, { className: "mx-cat-category-selector", sx: { width: "100%" }, children: [
359
361
  /* @__PURE__ */ t(
360
362
  oe,
@@ -366,7 +368,7 @@ const re = ({
366
368
  searchValue: u
367
369
  }
368
370
  ),
369
- /* @__PURE__ */ t(pe, {})
371
+ /* @__PURE__ */ t(he, {})
370
372
  ] }) : /* @__PURE__ */ t(k, {});
371
373
  }, ye = g(Se), be = ({
372
374
  id: e,
@@ -393,5 +395,5 @@ export {
393
395
  ye as C,
394
396
  ze as a,
395
397
  Ee as b,
396
- h as u
398
+ p as u
397
399
  };
@@ -0,0 +1,183 @@
1
+ import { makeAutoObservable as u, runInAction as l } from "mobx";
2
+ import { getUnixTime as r } from "date-fns/getUnixTime";
3
+ import { subMonths as g } from "date-fns/subMonths";
4
+ import { startOfMonth as h } from "date-fns/startOfMonth";
5
+ import { endOfMonth as d } from "date-fns/endOfMonth";
6
+ import { a as T, g as m } from "./CategoryUtil-BR3H5i6n.mjs";
7
+ import { F as p, A as i } from "./Fetch-DecPFeGU.mjs";
8
+ import { b as f, c as w } from "./Category-CevNQ03n.mjs";
9
+ class y {
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 S {
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 G {
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 S(), 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
+ 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 ?? w[t];
179
+ }
180
+ export {
181
+ G as C,
182
+ y as a
183
+ };
@@ -0,0 +1,78 @@
1
+ import { format as l } from "date-fns/format";
2
+ import { startOfMonth as h } from "date-fns/startOfMonth";
3
+ import { startOfToday as M } from "date-fns/startOfToday";
4
+ import { subMonths as T } from "date-fns/subMonths";
5
+ import { CategoryIconList as C } from "@mxenabled/mxui";
6
+ import { C as N, a as O, b } from "./Category-CevNQ03n.mjs";
7
+ import { f as D, D as E } from "./Dialog-CWW597AF.mjs";
8
+ const R = 3, d = 12, Y = (n, r, t) => n.filter((e) => !e.parent_guid).map(
9
+ (e) => _(
10
+ e,
11
+ r,
12
+ t,
13
+ n.filter((o) => o.parent_guid === e.guid)
14
+ )
15
+ ), x = (n, r) => {
16
+ const t = C.find((e) => e.guid === n);
17
+ return t ? r.palette.categories[t.colorName] || "" : r.palette.categories.uncategorized || "";
18
+ }, _ = (n, r, t, e = []) => {
19
+ const o = n.guid, i = n.parent_guid || o, u = o === i, s = r.find((a) => a.category_guid === o)?.total || 0, c = f(
20
+ t.filter((a) => a.category_guid === o)
21
+ ), g = f(
22
+ t.filter(
23
+ (a) => a.category_guid === o || a.top_level_category_guid === o
24
+ )
25
+ ), m = e.map(
26
+ (a) => _(a, r, t)
27
+ ), p = m.reduce(
28
+ (a, A) => a + A.currentAmount,
29
+ s
30
+ );
31
+ return {
32
+ ...n,
33
+ currentAmount: s,
34
+ averageAmount: y(c),
35
+ color: N[i],
36
+ icon: O[i],
37
+ isTransfer: i === b.TRANSFER,
38
+ monthlyAmounts: c,
39
+ subCategories: m,
40
+ totalAmount: u ? p : 0,
41
+ totalAverageAmount: y(g),
42
+ totalMonthlyAmounts: u ? g : []
43
+ };
44
+ }, k = (n, r) => n.map((t) => {
45
+ const e = r.filter(
46
+ (o) => o.category_guid === t.guid || o.top_level_category_guid === t.guid
47
+ );
48
+ return {
49
+ ...t,
50
+ transactions: e
51
+ };
52
+ }), y = (n, r = R) => {
53
+ const t = r > history.length ? history.length : r;
54
+ return Math.ceil(
55
+ Math.max(
56
+ 0,
57
+ n.slice(-t).reduce((e, o) => e + o.amount, 0) / t
58
+ )
59
+ );
60
+ }, f = (n) => {
61
+ const r = [], t = M();
62
+ for (let e = 0; e <= d; e++) {
63
+ const o = h(T(t, d - e)), u = n.filter(
64
+ (s) => s.year_month === Number(l(o, "yyyyMM"))
65
+ ).reduce((s, c) => s + c.total, 0);
66
+ r.push({
67
+ amount: u,
68
+ isoDate: l(o, "yyyy-MM-dd"),
69
+ label: D(o, E.MONTH_YEAR)
70
+ });
71
+ }
72
+ return r;
73
+ };
74
+ export {
75
+ Y as a,
76
+ x as b,
77
+ k as g
78
+ };
@@ -14,7 +14,7 @@ import EE from "@mui/material/ListItemText";
14
14
  import IE from "@mui/material/Popover";
15
15
  import F from "@mui/material/Stack";
16
16
  import w from "@mui/material/Checkbox";
17
- import { u as o, f as _E, d as NE, e as rE } from "./hooks-D6XlXHf4.mjs";
17
+ import { u as o, f as _E, d as NE, e as rE } from "./hooks-Cy8JnjCg.mjs";
18
18
  import { b as W } from "./Localization-2MODESHW.mjs";
19
19
  import { u as RE } from "./useScreenSize-B6JyS_Lj.mjs";
20
20
  import { observer as Q } from "mobx-react-lite";
@@ -520,23 +520,23 @@ const j = "connect_widget", rI = "connections_widget", HE = ({
520
520
  }, RI = Q(HE);
521
521
  export {
522
522
  T as A,
523
- dE as C,
523
+ rI as C,
524
524
  CE as E,
525
525
  tE as F,
526
- DE as M,
526
+ t as M,
527
527
  pE as N,
528
528
  LE as P,
529
529
  cE as S,
530
530
  yE as a,
531
531
  II as b,
532
- bE as c,
533
- rI as d,
534
- J as e,
535
- t as f,
532
+ J as c,
533
+ dE as d,
534
+ uE as e,
535
+ PE as f,
536
536
  AE as g,
537
- uE as h,
538
- PE as i,
539
- sE as j,
537
+ sE as h,
538
+ bE as i,
539
+ DE as j,
540
540
  NI as k,
541
541
  RI as l,
542
542
  _I as m,
@@ -3,8 +3,8 @@ import s from "react";
3
3
  import { observer as E } from "mobx-react-lite";
4
4
  import { useTheme as b } from "@mui/material/styles";
5
5
  import { ConnectionsWidget as D } from "@mxenabled/web-widget-sdk";
6
- import { d as a, e as c, f as i } from "./ConnectDrawer-BQNs-hjk.mjs";
7
- import { d as L, e as w, u as _ } from "./hooks-D6XlXHf4.mjs";
6
+ import { C as a, c, M as i } from "./ConnectDrawer-CbxHKlRv.mjs";
7
+ import { d as L, e as w, u as _ } from "./hooks-Cy8JnjCg.mjs";
8
8
  import { D as x } from "./Drawer-kEE73B87.mjs";
9
9
  const I = ({
10
10
  onClose: l,
@@ -47,7 +47,7 @@ const I = ({
47
47
  ] })
48
48
  }
49
49
  );
50
- }, W = E(I);
50
+ }, M = E(I);
51
51
  export {
52
- W as C
52
+ M as C
53
53
  };
@@ -5,7 +5,7 @@ import { v4 as B } from "uuid";
5
5
  import { useTokens as L, TextField as O, P as _ } from "@mxenabled/mxui";
6
6
  import { b as y, g as C } from "./Localization-2MODESHW.mjs";
7
7
  import { g as W, C as j, f as g, M as b } from "./NumberFormatting-Buh7u8Oi.mjs";
8
- import { u as D } from "./hooks-D6XlXHf4.mjs";
8
+ import { u as D } from "./hooks-Cy8JnjCg.mjs";
9
9
  const F = ({
10
10
  allowDecimals: o = !0,
11
11
  ariaLabel: h,
@@ -1,6 +1,6 @@
1
1
  import { makeAutoObservable as l } from "mobx";
2
2
  import { getDate as r, fromUnixTime as _, startOfMonth as m } from "date-fns";
3
- import { A as p } from "./ConnectDrawer-BQNs-hjk.mjs";
3
+ import { A as p } from "./ConnectDrawer-CbxHKlRv.mjs";
4
4
  const E = 12, T = 100;
5
5
  var c = /* @__PURE__ */ ((a) => (a[a.FASTEST_PAYOFF_FIRST = 1] = "FASTEST_PAYOFF_FIRST", a[a.HIGHEST_INTEREST = 2] = "HIGHEST_INTEREST", a[a.LOWEST_BALANCE = 3] = "LOWEST_BALANCE", a[a.HIGHEST_BALANCE = 4] = "HIGHEST_BALANCE", a))(c || {});
6
6
  const b = {
@@ -1,10 +1,10 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
2
  import { observer as c } from "mobx-react-lite";
3
3
  import { Icon as i } from "@mxenabled/mxui";
4
- import { e as p } from "./exportTransactionsToCSV-7bVS7KXf.mjs";
5
- import { O as m } from "./User-BQUxBeZV.mjs";
4
+ import { e as p } from "./exportTransactionsToCSV-C4PkIYP6.mjs";
5
+ import { O as m } from "./User-Bj34_i8g.mjs";
6
6
  import { R as x } from "./ResponsiveButton-DZFp78fJ.mjs";
7
- import { g as _, h as C, u as l } from "./hooks-D6XlXHf4.mjs";
7
+ import { g as _, h as C, u as l } from "./hooks-Cy8JnjCg.mjs";
8
8
  const v = ({ filter: t }) => {
9
9
  const { onEvent: r } = _(), { tags: e, sortedTransactions: s } = C(), { transactions: n } = l(), a = () => {
10
10
  r(m.ON_TRANSACTION_EXPORT_CSV_CLICK), p(t ? s.filter(t) : s, e);
@@ -1,4 +1,4 @@
1
- import { g as r } from "./Localization-2MODESHW.mjs";
1
+ import { g as i } from "./Localization-2MODESHW.mjs";
2
2
  const E = {
3
3
  ACCOUNTS: "accounts",
4
4
  ANALYTICS_EVENTS: "analytics_events",
@@ -46,26 +46,26 @@ const E = {
46
46
  USER_PROFILES: "user_profiles",
47
47
  WIDGET_URLS: "widget_urls"
48
48
  };
49
- class S {
49
+ class _ {
50
50
  endpoint = "/";
51
51
  headers;
52
52
  onError;
53
- constructor(s, n, t, o) {
54
- this.endpoint = s;
53
+ constructor(n, s, t, o) {
54
+ this.endpoint = n;
55
55
  const e = {
56
56
  Accept: "application/json",
57
- "Accept-Language": r(),
57
+ "Accept-Language": i(),
58
58
  "Content-Type": "application/json",
59
- "MD-Session-Token": n
59
+ "MD-Session-Token": s
60
60
  };
61
61
  this.headers = t || e, this.onError = o;
62
62
  }
63
- get = async (s) => {
64
- const n = {
63
+ get = async (n) => {
64
+ const s = {
65
65
  method: "GET",
66
66
  headers: this.headers
67
67
  };
68
- return fetch(`${this.endpoint}${s}`, n).then((t) => {
68
+ return fetch(`${this.endpoint}${n}`, s).then((t) => {
69
69
  if (t.ok)
70
70
  return t.text();
71
71
  throw t;
@@ -73,13 +73,13 @@ class S {
73
73
  throw this.onError?.(t, void 0, "ApiGetRequestError"), t;
74
74
  });
75
75
  };
76
- post = async (s, n) => {
77
- const t = n ? JSON.stringify(n) : void 0, o = {
76
+ post = async (n, s) => {
77
+ const t = s ? JSON.stringify(s) : void 0, o = {
78
78
  method: "POST",
79
79
  headers: this.headers,
80
80
  body: t
81
81
  };
82
- return fetch(`${this.endpoint}${s}`, o).then((e) => {
82
+ return fetch(`${this.endpoint}${n}`, o).then((e) => {
83
83
  if (!e.ok)
84
84
  throw e;
85
85
  return e.text();
@@ -87,24 +87,26 @@ class S {
87
87
  throw e;
88
88
  });
89
89
  };
90
- put = async (s, n) => {
91
- const t = JSON.stringify(n), o = {
90
+ put = async (n, s) => {
91
+ const t = JSON.stringify(s), o = {
92
92
  method: "PUT",
93
93
  headers: this.headers,
94
94
  body: t
95
95
  };
96
- return fetch(`${this.endpoint}${s}`, o).then((e) => e.ok ? e.text() : e.text().then((i) => {
97
- throw new Error(i);
98
- })).then((e) => e.length ? JSON.parse(e) : {}).then((e) => e).catch((e) => {
99
- throw e;
96
+ return fetch(`${this.endpoint}${n}`, o).then((e) => {
97
+ if (e.ok)
98
+ return e.text();
99
+ throw new Error(`${e.status}`);
100
+ }).then((e) => e.length ? JSON.parse(e) : {}).then((e) => e).catch((e) => {
101
+ throw window?.app?.config?.type === "pulse" && this.onError?.(e.message), e.message;
100
102
  });
101
103
  };
102
- delete = async (s) => {
103
- const n = {
104
+ delete = async (n) => {
105
+ const s = {
104
106
  method: "DELETE",
105
107
  headers: this.headers
106
108
  };
107
- return fetch(`${this.endpoint}${s}`, n).then((t) => t.ok ? t.text() : t.text().then((o) => {
109
+ return fetch(`${this.endpoint}${n}`, s).then((t) => t.ok ? t.text() : t.text().then((o) => {
108
110
  throw new Error(o);
109
111
  })).then((t) => t.length ? JSON.parse(t) : {}).then((t) => t).catch((t) => {
110
112
  throw t;
@@ -113,5 +115,5 @@ class S {
113
115
  }
114
116
  export {
115
117
  E as A,
116
- S as F
118
+ _ as F
117
119
  };
@@ -3,7 +3,7 @@ import { format as i } from "date-fns/format";
3
3
  import { fromUnixTime as g } from "date-fns/fromUnixTime";
4
4
  import { getUnixTime as s } from "date-fns/getUnixTime";
5
5
  import { subMonths as S } from "date-fns/subMonths";
6
- import { F as m, A as o } from "./Fetch-87LIQbEA.mjs";
6
+ import { F as m, A as o } from "./Fetch-DecPFeGU.mjs";
7
7
  import { f as p, D as u } from "./Dialog-CWW597AF.mjs";
8
8
  class n {
9
9
  fetchInstance;