@mx-cartographer/experiences 8.0.0-alpha.bb4 → 8.0.0-alpha.mega1

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 (154) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/dist/{Account-B4CDD-zq.mjs → Account-CvR2-dSR.mjs} +1 -1
  3. package/dist/AccountDetailsContent-CitErkuS.mjs +686 -0
  4. package/dist/{AccountDetailsHeader-DRjFuyJT.mjs → AccountDetailsHeader-BkG3MNYo.mjs} +19 -19
  5. package/dist/{AccountFields-Cl4KHoSj.mjs → AccountFields-zCMqet85.mjs} +10 -12
  6. package/dist/AccountListItem-DHrz8Mml.mjs +90 -0
  7. package/dist/{AccountStore-HbVblv86.mjs → AccountStore-LgfBcYMe.mjs} +101 -75
  8. package/dist/Accounts-Bzy1_REQ.mjs +9 -0
  9. package/dist/{BudgetUtil-Jv8h9H9l.mjs → BudgetUtil-BmZXkL0C.mjs} +32 -32
  10. package/dist/{CashflowStore-CA190BPF.mjs → CashflowStore-D9Dpuz7X.mjs} +25 -18
  11. package/dist/{Category-Ccoew_sA.mjs → Category-CevNQ03n.mjs} +2 -2
  12. package/dist/{CategorySelectorDrawer-Dl006GKy.mjs → CategorySelectorDrawer-B-I3kajA.mjs} +27 -27
  13. package/dist/CategoryStore-CA3tS1BO.mjs +186 -0
  14. package/dist/CategoryUtil-DUM8NuGO.mjs +78 -0
  15. package/dist/{ConnectDrawer-DVp54lUH.mjs → ConnectDrawer-BkvlItWx.mjs} +55 -56
  16. package/dist/{ConnectionsDrawer-Dsc04-4Z.mjs → ConnectionsDrawer-VmuVFHbL.mjs} +5 -5
  17. package/dist/CurrencyInput-itK0R3wV.mjs +85 -0
  18. package/dist/{DateUtil-CDPZw_-m.mjs → DateUtil-CBdcsyuk.mjs} +1 -1
  19. package/dist/{DebtsStore-pL63fmdT.mjs → DebtsStore-Bq-aPy-5.mjs} +3 -3
  20. package/dist/{Dialog-CDV0kKxj.mjs → Dialog-BPTr3qHE.mjs} +24 -24
  21. package/dist/Drawer-By9V-B5L.mjs +178 -0
  22. package/dist/{ExportCsvAction-QhQK4_FU.mjs → ExportCsvAction-Cglo8Mca.mjs} +4 -4
  23. package/dist/{FinstrongStore-BGf36b0z.mjs → FinstrongStore-BIrX0Xg2.mjs} +56 -56
  24. package/dist/{GoalStore-C1-w3Y1E.mjs → GoalStore-1P19goZ7.mjs} +111 -151
  25. package/dist/HeaderCell-DjuifqHJ.mjs +6 -0
  26. package/dist/{Help-c-zHlDbv.mjs → Help-DhcC-C05.mjs} +8 -8
  27. package/dist/{Help-DBfsTkAi.mjs → Help-Ea3BlXQp.mjs} +146 -125
  28. package/dist/{IconBacking-DgT8DCeh.mjs → IconBacking-B9oC6uL2.mjs} +11 -11
  29. package/dist/LineChart-KpPw1phO.mjs +580 -0
  30. package/dist/{ListItemAction-BNCWQAN_.mjs → ListItemAction-BxTkF6Tz.mjs} +2 -2
  31. package/dist/Loader-DUaFpDGv.mjs +24 -0
  32. package/dist/{ManageIncome-8EsStyIQ.mjs → ManageIncome-CaoQl609.mjs} +142 -142
  33. package/dist/MicroWidgetContainer-r6mtxRer.mjs +52 -0
  34. package/dist/MiniWidgetContainer-Bg02sF1Y.mjs +71 -0
  35. package/dist/{NetWorthStore-Bti6u-d9.mjs → NetWorthStore-rC0q7P7t.mjs} +4 -4
  36. package/dist/NotificationSettings-uzM8tCoH.mjs +674 -0
  37. package/dist/{NotificationStore-Ck2KdNmT.mjs → NotificationStore-CDX_kqHa.mjs} +14 -22
  38. package/dist/{OriginalBalanceAction-2Y_3U_mg.mjs → OriginalBalanceAction-C6jdS4ws.mjs} +9 -9
  39. package/dist/{RecurringSettings-DAncu--R.mjs → RecurringSettings-B4ybrS0B.mjs} +17 -17
  40. package/dist/{RecurringTransactions-CxcSL1dY.mjs → RecurringTransactions-BqijW_8S.mjs} +79 -79
  41. package/dist/{RecurringTransactionsStore-CNFxyGB6.mjs → RecurringTransactionsStore-BhBUVm9a.mjs} +81 -91
  42. package/dist/{ResponsiveButton-Cn6-R7ue.mjs → ResponsiveButton-DZFp78fJ.mjs} +10 -10
  43. package/dist/SearchBox-B2_zLv8-.mjs +42 -0
  44. package/dist/{SettingsStore-BASMQSIp.mjs → SettingsStore-krIRNwHK.mjs} +1 -1
  45. package/dist/{SingleSegmentDonut-7Uy6VEld.mjs → SingleSegmentDonut-BgbLgwHi.mjs} +6 -6
  46. package/dist/SpendingData-DQ1b9uqq.mjs +53 -0
  47. package/dist/{SpendingLegend-6FqtMcBV.mjs → SpendingLegend-CDO060GT.mjs} +65 -65
  48. package/dist/{StatusBar-CPfSXe80.mjs → StatusBar-BK_uYHAB.mjs} +6 -6
  49. package/dist/{TabContentContainer-CnMXkVqr.mjs → TabContentContainer-j01JYR_7.mjs} +8 -8
  50. package/dist/TransactionDetails-m5PddMQn.mjs +1380 -0
  51. package/dist/TransactionStore-PRlwE-TF.mjs +677 -0
  52. package/dist/TrendsStore-yO7qYv97.mjs +186 -0
  53. package/dist/{User-BklmOUSd.mjs → User-Cnlegl1N.mjs} +107 -107
  54. package/dist/{ViewMoreMicroCard-DAkyNRlD.mjs → ViewMoreMicroCard-DwR0v_ll.mjs} +211 -205
  55. package/dist/{WidgetContainer-CDh9fjpR.mjs → WidgetContainer-CoFDmQRE.mjs} +36 -36
  56. package/dist/accounts/index.es.js +200 -197
  57. package/dist/accounts/stores/AccountStore.d.ts +22 -25
  58. package/dist/accounts/utils/Accounts.d.ts +1 -2
  59. package/dist/analytics/index.es.js +27 -27
  60. package/dist/budgets/components/AddBudgets.d.ts +2 -1
  61. package/dist/budgets/index.es.js +703 -669
  62. package/dist/budgets/store/BudgetsStore.d.ts +0 -1
  63. package/dist/cashflow/index.es.js +420 -404
  64. package/dist/categories/index.es.js +2 -2
  65. package/dist/categories/stores/CategoryStore.d.ts +3 -6
  66. package/dist/categories/util/CategoryUtil.d.ts +2 -3
  67. package/dist/common/components/ErrorBoundary.d.ts +1 -1
  68. package/dist/common/components/Loader.d.ts +2 -1
  69. package/dist/common/components/accountfilter/AccountFilterOptions.d.ts +1 -1
  70. package/dist/common/components/barchart/Bar.d.ts +25 -0
  71. package/dist/common/components/barchart/BarChart.d.ts +34 -0
  72. package/dist/common/components/barchart/BarColumn.d.ts +37 -0
  73. package/dist/common/components/barchart/Legend.d.ts +8 -0
  74. package/dist/common/components/barchart/Util.d.ts +42 -0
  75. package/dist/common/components/barchart/index.d.ts +1 -0
  76. package/dist/common/components/charts/linechart/CustomMark.d.ts +1 -1
  77. package/dist/common/components/charts/linechart/CustomTooltip.d.ts +6 -1
  78. package/dist/common/components/charts/stackedlinechart/CustomPointTooltip.d.ts +5 -2
  79. package/dist/common/components/index.d.ts +1 -0
  80. package/dist/common/hooks/index.d.ts +2 -0
  81. package/dist/common/hooks/useAriaLive.d.ts +1 -1
  82. package/dist/common/hooks/usePrevious.d.ts +2 -0
  83. package/dist/common/hooks/useWidgetLoadTimer.d.ts +6 -0
  84. package/dist/common/index.es.js +712 -436
  85. package/dist/common/stores/AppDataStore.d.ts +1 -3
  86. package/dist/common/stores/GlobalCopyStore.d.ts +1 -0
  87. package/dist/common/stores/GlobalStore.d.ts +3 -3
  88. package/dist/common/stores/GlobalUiStore.d.ts +2 -3
  89. package/dist/common/stores/UserStore.d.ts +2 -3
  90. package/dist/common/types/Account.d.ts +6 -9
  91. package/dist/common/types/localization/TransactionsCopy.d.ts +1 -0
  92. package/dist/common/utils/Theme.d.ts +3 -1
  93. package/dist/dashboard/index.es.js +93 -91
  94. package/dist/debts/components/DebtsChart.d.ts +2 -1
  95. package/dist/debts/index.es.js +529 -527
  96. package/dist/{exportTransactionsToCSV-BgV_wTLT.mjs → exportTransactionsToCSV-DuAaI5XA.mjs} +3 -3
  97. package/dist/finstrong/components/shared/CustomDoubleBarPlot.d.ts +4 -5
  98. package/dist/finstrong/index.es.js +876 -867
  99. package/dist/goals/index.es.js +526 -525
  100. package/dist/goals/stores/GoalStore.d.ts +4 -17
  101. package/dist/help/components/content/BottomImageContent.d.ts +1 -1
  102. package/dist/help/components/content/LeftImageContent.d.ts +1 -1
  103. package/dist/help/components/content/RightImageContent.d.ts +1 -1
  104. package/dist/help/components/content/TopImageContent.d.ts +1 -1
  105. package/dist/help/index.es.js +13 -9
  106. package/dist/{hooks-C41HAxM5.mjs → hooks-ZMp65DFz.mjs} +11 -11
  107. package/dist/investments/index.es.js +534 -531
  108. package/dist/investments/stores/HoldingStore.d.ts +0 -1
  109. package/dist/merchants/index.es.js +8 -8
  110. package/dist/microinsights/MicroCardTemplate.d.ts +16 -0
  111. package/dist/microinsights/index.d.ts +1 -0
  112. package/dist/microinsights/index.es.js +101 -14
  113. package/dist/networth/components/NetWorthChange.d.ts +1 -3
  114. package/dist/networth/index.es.js +284 -285
  115. package/dist/notifications/index.es.js +95 -94
  116. package/dist/notifications/stores/NotificationStore.d.ts +1 -3
  117. package/dist/recurringtransactions/index.es.js +582 -562
  118. package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +2 -4
  119. package/dist/settings/index.es.js +340 -337
  120. package/dist/spending/index.es.js +281 -268
  121. package/dist/transactions/components/shared/transactionlist/DateRow.d.ts +7 -0
  122. package/dist/transactions/index.es.js +253 -255
  123. package/dist/transactions/stores/TransactionStore.d.ts +77 -21
  124. package/dist/transactions/stores/UiStore.d.ts +2 -0
  125. package/dist/trends/components/TrendsTable.d.ts +0 -2
  126. package/dist/trends/index.es.js +838 -793
  127. package/dist/trends/utils/TrendsData.d.ts +1 -0
  128. package/dist/{useAccountDisplayName-CcIp09Xc.mjs → useAccountDisplayName-B7iXTNM8.mjs} +2 -2
  129. package/dist/{useCombineEvents-kNzLTWCp.mjs → useCombineEvents-CRwX-qWE.mjs} +2 -2
  130. package/dist/{useInsightsEnabled-CNjP5cfR.mjs → useInsightsEnabled-B7dxpDrX.mjs} +1 -1
  131. package/dist/{useScreenSize-B5afALev.mjs → useScreenSize-B6JyS_Lj.mjs} +1 -1
  132. package/dist/useWidgetLoadTimer-hIOioiKx.mjs +19 -0
  133. package/package.json +57 -52
  134. package/dist/AccountDetailsContent-adZTkM52.mjs +0 -683
  135. package/dist/AccountListItem-wgmlex-_.mjs +0 -90
  136. package/dist/Accounts-CRUehOiy.mjs +0 -27
  137. package/dist/CategoryStore-MUwRWH9e.mjs +0 -176
  138. package/dist/CategoryUtil-DfVKKkRf.mjs +0 -80
  139. package/dist/CurrencyInput-D1cjbdCI.mjs +0 -85
  140. package/dist/Drawer-BF40nbsH.mjs +0 -163
  141. package/dist/HeaderCell-P8w6CmfO.mjs +0 -6
  142. package/dist/LineChart-C1PxNf7P.mjs +0 -581
  143. package/dist/Loader-Ckqi9Rx6.mjs +0 -21
  144. package/dist/MicroWidgetContainer-BGpNl5ZS.mjs +0 -45
  145. package/dist/MiniWidgetContainer-CKzf_Ira.mjs +0 -56
  146. package/dist/NotificationSettings-B74rQVYC.mjs +0 -672
  147. package/dist/SearchBox-B7km148n.mjs +0 -39
  148. package/dist/SkeletonLoader-BaNboJjD.mjs +0 -38
  149. package/dist/SpendingData-DPQ96k3x.mjs +0 -55
  150. package/dist/TransactionDetails-Bn0qY5Hw.mjs +0 -1336
  151. package/dist/TransactionStore-DbwAutwC.mjs +0 -671
  152. package/dist/TrendsStore-_mRaFUdf.mjs +0 -182
  153. package/dist/common/components/SkeletonLoader.d.ts +0 -7
  154. package/dist/recurringtransactions/components/MicroWidgetContent.d.ts +0 -3
@@ -2,40 +2,47 @@ import { jsx as t, jsxs as a } from "react/jsx-runtime";
2
2
  import c from "@mui/material/IconButton";
3
3
  import m from "@mui/material/Stack";
4
4
  import l from "@mui/material/Tooltip";
5
- import { Icon as p, Text as n } from "@mxenabled/mxui";
5
+ import { Text as s, Icon as p, IconWeight as h } from "@mxenabled/mxui";
6
6
  import { makeAutoObservable as i } from "mobx";
7
7
  import { addDays as d } from "date-fns/addDays";
8
- import { differenceInDays as h } from "date-fns/differenceInDays";
9
- import { endOfMonth as f } from "date-fns/endOfMonth";
10
- import { isBefore as x } from "date-fns/isBefore";
8
+ import { differenceInDays as f } from "date-fns/differenceInDays";
9
+ import { endOfMonth as x } from "date-fns/endOfMonth";
10
+ import { isBefore as u } from "date-fns/isBefore";
11
11
  import { startOfToday as r } from "date-fns/startOfToday";
12
- const U = ({
12
+ const g = ({
13
13
  body: o,
14
14
  iconName: e = "info",
15
- title: s
15
+ title: n
16
16
  }) => /* @__PURE__ */ t(
17
17
  l,
18
18
  {
19
19
  enterTouchDelay: 500,
20
20
  title: /* @__PURE__ */ a(m, { gap: 2, p: 12, sx: { textOverflow: "none" }, children: [
21
- /* @__PURE__ */ t(n, { bold: !0, variant: "body1", children: s }),
22
- /* @__PURE__ */ t(n, { sx: { whiteSpace: "unset" }, variant: "body2", children: o })
21
+ /* @__PURE__ */ t(s, { bold: !0, variant: "Body", children: n }),
22
+ /* @__PURE__ */ t(s, { sx: { whiteSpace: "unset" }, variant: "Small", children: o })
23
23
  ] }),
24
24
  children: /* @__PURE__ */ t(
25
25
  c,
26
26
  {
27
- "aria-label": s,
27
+ "aria-label": n,
28
28
  sx: {
29
29
  minHeight: 0,
30
30
  minWidth: 0,
31
31
  p: 0
32
32
  },
33
- children: /* @__PURE__ */ t(p, { name: e, sx: { color: "primary.main", fontSize: 16 } })
33
+ children: /* @__PURE__ */ t(
34
+ p,
35
+ {
36
+ name: e,
37
+ sx: { color: "primary.main", fontSize: 16 },
38
+ weight: h.Dark
39
+ }
40
+ )
34
41
  }
35
42
  )
36
43
  }
37
- );
38
- class u {
44
+ ), E = g;
45
+ class I {
39
46
  // Cashflow is hard-coded to display 30 days starting from today
40
47
  dateRange = { start: r(), end: d(r(), 30) };
41
48
  isDirty = !1;
@@ -47,13 +54,13 @@ class u {
47
54
  }
48
55
  // Returns the number of days until the next income activity or 0 if there is no income activity
49
56
  get daysUntilNextIncome() {
50
- return this.nextIncome ? Math.abs(h(r(), this.nextIncome.expectedDate)) : 0;
57
+ return this.nextIncome ? Math.abs(f(r(), this.nextIncome.expectedDate)) : 0;
51
58
  }
52
59
  // Returns the expenses (Activities) until the next income activity or the end of the month
53
60
  // if there is no income activity
54
61
  get expensesTilNextIncome() {
55
62
  return this.upcomingExpenses.filter(
56
- (e) => x(e.expectedDate, this.nextIncome?.expectedDate || f(/* @__PURE__ */ new Date()))
63
+ (e) => u(e.expectedDate, this.nextIncome?.expectedDate || x(/* @__PURE__ */ new Date()))
57
64
  );
58
65
  }
59
66
  setNextIncome = (e) => {
@@ -64,11 +71,11 @@ class u {
64
71
  };
65
72
  setSelectedCashAccounts = (e) => this.selectedCashAccounts = e;
66
73
  }
67
- class A {
74
+ class _ {
68
75
  globalStore;
69
76
  uiStore;
70
77
  constructor(e) {
71
- this.globalStore = e, this.uiStore = new u(), i(this);
78
+ this.globalStore = e, this.uiStore = new I(), i(this);
72
79
  }
73
80
  completeOnboarding = async () => {
74
81
  const e = {
@@ -79,6 +86,6 @@ class A {
79
86
  };
80
87
  }
81
88
  export {
82
- A as C,
83
- U as I
89
+ _ as C,
90
+ E as I
84
91
  };
@@ -293,9 +293,9 @@ const A = {
293
293
  UNKNOWN: "help"
294
294
  };
295
295
  export {
296
- E as C,
296
+ T as C,
297
297
  e as P,
298
- T as a,
298
+ E as a,
299
299
  A as b,
300
300
  a as c
301
301
  };
@@ -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 b, u as y, g as D, b as U } from "./hooks-C41HAxM5.mjs";
5
+ import { G as K, m as y, u as b, g as D, b as U } from "./hooks-ZMp65DFz.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";
@@ -12,21 +12,21 @@ import N from "@mui/material/ListItemButton";
12
12
  import F from "@mui/material/ListItemIcon";
13
13
  import G from "@mui/material/ListItemText";
14
14
  import { CheckCircle as M, Edit as j, Delete as X, ExpandMore as z } from "@mxenabled/mx-icons";
15
- import { Text as I, TextField as q, CategoryIcon as H } from "@mxenabled/mxui";
15
+ import { Text as B, TextField as q, CategoryIcon as H } from "@mxenabled/mxui";
16
16
  import J from "@mui/material/Collapse";
17
17
  import Q from "@mui/material/DialogContent";
18
18
  import { b as S } from "./Localization-2MODESHW.mjs";
19
- import { D as Z } from "./Dialog-CDV0kKxj.mjs";
19
+ import { D as Z } from "./Dialog-BPTr3qHE.mjs";
20
20
  import ee from "@mui/material/Box";
21
21
  import te from "@mui/material/Chip";
22
- import B from "@mui/material/IconButton";
23
- import { L as k } from "./Loader-Ckqi9Rx6.mjs";
24
- import { S as oe } from "./SearchBox-B7km148n.mjs";
25
- import { D as ae } from "./Drawer-BF40nbsH.mjs";
22
+ import I from "@mui/material/IconButton";
23
+ import { S as oe } from "./SearchBox-B2_zLv8-.mjs";
24
+ import { L as k } from "./Loader-DUaFpDGv.mjs";
25
+ import { D as ae } from "./Drawer-By9V-B5L.mjs";
26
26
  const p = () => {
27
27
  if (!C.useContext(K))
28
28
  throw new Error("useCategoryUiStore() must be used within the GlobalDataContext");
29
- return b().uiStore;
29
+ return y().uiStore;
30
30
  }, m = {
31
31
  ON_CATEGORY_EXPANDED: "onCategoryExpanded",
32
32
  ON_CATEGORY_COLLAPSED: "onCategoryCollapsed",
@@ -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 } = y(), { setShouldDisableDrawerScroll: l } = p();
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) {
@@ -61,7 +61,7 @@ const re = ({
61
61
  case "delete":
62
62
  u = n.delete_subcategory_heading, d = S(
63
63
  n.all_transactions_in_this_subcategory,
64
- /* @__PURE__ */ t(I, { bold: !0, children: S(n.all_parent_category, e) })
64
+ /* @__PURE__ */ t(B, { bold: !0, children: S(n.all_parent_category, e) })
65
65
  );
66
66
  break;
67
67
  }
@@ -79,7 +79,7 @@ const re = ({
79
79
  onPrimaryAction: () => {
80
80
  l(!1), r(a);
81
81
  },
82
- children: /* @__PURE__ */ t(Q, { children: _ ? /* @__PURE__ */ t(I, { children: d }) : /* @__PURE__ */ t(
82
+ children: /* @__PURE__ */ t(Q, { children: _ ? /* @__PURE__ */ t(B, { children: d }) : /* @__PURE__ */ t(
83
83
  q,
84
84
  {
85
85
  inputProps: {
@@ -95,7 +95,7 @@ const re = ({
95
95
  }
96
96
  );
97
97
  }, R = g(re), ne = ({ parentCategory: e }) => {
98
- const [o, r] = C.useState(!1), { addCategory: c } = b(), { categories: s } = y(), { onEvent: a } = D(), { setShouldDisableDrawerScroll: i } = p(), 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) => {
99
99
  await c(d.trim(), e.guid), a(m.ON_SUBCATEGORY_ADDED), r(!1);
100
100
  }, l = async () => {
101
101
  a(m.ON_SUBCATEGORY_ADD_CLICK), i(!0), r(!0);
@@ -107,7 +107,7 @@ const re = ({
107
107
  G,
108
108
  {
109
109
  primary: s.add_subcategory_button,
110
- primaryTypographyProps: { color: "primary", fontWeight: "normal", variant: "body1" }
110
+ primaryTypographyProps: { color: "primary", fontWeight: "normal", variant: "Body" }
111
111
  }
112
112
  ) }),
113
113
  o && /* @__PURE__ */ t(
@@ -125,7 +125,7 @@ const re = ({
125
125
  subCategory: o,
126
126
  showRename: r
127
127
  }) => {
128
- const { updateCategory: c } = b(), { onEvent: s } = D(), a = async (n) => {
128
+ const { updateCategory: c } = y(), { onEvent: s } = D(), a = async (n) => {
129
129
  await c({ ...o, name: n }), s(m.ON_SUBCATEGORY_SAVED), e(!1);
130
130
  }, i = () => {
131
131
  e(!1), s(m.ON_SUBCATEGORY_EDIT_CANCEL_CLICK);
@@ -146,7 +146,7 @@ const re = ({
146
146
  setShowDelete: r,
147
147
  subCategory: c
148
148
  }) => {
149
- const { onEvent: s } = D(), { removeCategory: a } = b(), i = () => {
149
+ const { onEvent: s } = D(), { removeCategory: a } = y(), i = () => {
150
150
  r(!1), s(m.ON_SUBCATEGORY_DELETE_CLICK);
151
151
  }, n = async () => {
152
152
  s(m.ON_SUBCATEGORY_DELETED), await a(c.guid), r(!1);
@@ -170,7 +170,7 @@ const re = ({
170
170
  showSelected: i,
171
171
  unselectable: n,
172
172
  unselectableText: l
173
- } = p(), { categories: u } = y(), { 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);
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);
174
174
  return /* @__PURE__ */ E(
175
175
  x,
176
176
  {
@@ -193,7 +193,7 @@ const re = ({
193
193
  G,
194
194
  {
195
195
  primary: o.name,
196
- primaryTypographyProps: { fontWeight: "normal", variant: "body1" }
196
+ primaryTypographyProps: { fontWeight: "normal", variant: "Body" }
197
197
  }
198
198
  ),
199
199
  i && A && /* @__PURE__ */ t(M, { fontSize: "small" }),
@@ -203,7 +203,7 @@ const re = ({
203
203
  ),
204
204
  T && /* @__PURE__ */ E(ee, { className: "mx-cat-subcategory-edit-container", sx: { marginRight: 24 }, children: [
205
205
  /* @__PURE__ */ t(
206
- B,
206
+ I,
207
207
  {
208
208
  "aria-label": S(u.edit_subcategory_aria, o.name),
209
209
  onClick: () => {
@@ -213,7 +213,7 @@ const re = ({
213
213
  }
214
214
  ),
215
215
  /* @__PURE__ */ t(
216
- B,
216
+ I,
217
217
  {
218
218
  "aria-label": S(u.delete_subcategory_aria, o.name),
219
219
  edge: "end",
@@ -290,7 +290,7 @@ const re = ({
290
290
  G,
291
291
  {
292
292
  primary: e.name,
293
- primaryTypographyProps: { fontWeight: "normal", variant: "body1" }
293
+ primaryTypographyProps: { fontWeight: "normal", variant: "Body" }
294
294
  }
295
295
  ),
296
296
  /* @__PURE__ */ t(F, { children: /* @__PURE__ */ t(
@@ -310,7 +310,7 @@ const re = ({
310
310
  /* @__PURE__ */ t(ge, { categories: o, parentCategory: e })
311
311
  ] });
312
312
  }, Ee = g(_e), pe = () => {
313
- const { categories: e } = b(), { searchValue: o } = p(), { categories: r } = y(), s = ((a, i = "") => a.reduce((n, l) => {
313
+ const { categories: e } = y(), { searchValue: o } = p(), { categories: r } = b(), s = ((a, i = "") => a.reduce((n, l) => {
314
314
  if (l.parent_guid === null) {
315
315
  const d = [
316
316
  {
@@ -342,7 +342,7 @@ const re = ({
342
342
  unselectable: c = [],
343
343
  unselectableText: s = "Unselectable"
344
344
  }) => {
345
- const { categories: a, loadCategories: i } = b(), { common: n } = y(), { isCopyLoaded: l } = U(), {
345
+ const { categories: a, loadCategories: i } = y(), { common: n } = b(), { isCopyLoaded: l } = U(), {
346
346
  searchValue: u,
347
347
  setOnSelect: d,
348
348
  setSearchValue: _,
@@ -370,14 +370,14 @@ const re = ({
370
370
  ),
371
371
  /* @__PURE__ */ t(he, {})
372
372
  ] }) : /* @__PURE__ */ t(k, {});
373
- }, be = g(Se), ye = ({
373
+ }, ye = g(Se), be = ({
374
374
  id: e,
375
375
  onClose: o,
376
376
  title: r,
377
377
  showDrawer: c,
378
378
  ...s
379
379
  }) => {
380
- const { common: a } = y(), { isCopyLoaded: i } = U();
380
+ const { common: a } = b(), { isCopyLoaded: i } = U();
381
381
  return i ? /* @__PURE__ */ t(
382
382
  ae,
383
383
  {
@@ -387,12 +387,12 @@ const re = ({
387
387
  isOpen: c,
388
388
  onClose: o,
389
389
  title: r,
390
- children: /* @__PURE__ */ t(be, { ...s })
390
+ children: /* @__PURE__ */ t(ye, { ...s })
391
391
  }
392
392
  ) : /* @__PURE__ */ t(k, {});
393
- }, ze = g(ye);
393
+ }, ze = g(be);
394
394
  export {
395
- be as C,
395
+ ye as C,
396
396
  ze as a,
397
397
  Ee as b,
398
398
  p as u
@@ -0,0 +1,186 @@
1
+ import { makeAutoObservable as C, runInAction as l } from "mobx";
2
+ import { getUnixTime as r } from "date-fns/getUnixTime";
3
+ import { subMonths as h } from "date-fns/subMonths";
4
+ import { startOfMonth as d } from "date-fns/startOfMonth";
5
+ import { endOfMonth as y } from "date-fns/endOfMonth";
6
+ import { a as m, g as p } from "./CategoryUtil-DUM8NuGO.mjs";
7
+ import { F as f, A as i } from "./Fetch-DecPFeGU.mjs";
8
+ import { b as g, c as S } from "./Category-CevNQ03n.mjs";
9
+ class u {
10
+ fetchInstance;
11
+ constructor(t, e, o) {
12
+ this.fetchInstance = new f(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((T) => T.guid);
24
+ return (await this.fetchInstance.post(a, { account_guid: s })).monthly_category_totals;
25
+ } else
26
+ return (await this.fetchInstance.get(a)).monthly_category_totals;
27
+ } catch (a) {
28
+ throw console.error("Error fetching monthly category totals:", a), a;
29
+ }
30
+ };
31
+ removeCategory = async (t) => this.fetchInstance.delete(`${i.CATEGORIES}/${t}`);
32
+ updateCategory = async (t) => this.fetchInstance.put(`${i.CATEGORIES}/${t.guid}`, t).then((e) => e.category);
33
+ }
34
+ class w {
35
+ expandedGuid = null;
36
+ selectedGuid = null;
37
+ searchValue = "";
38
+ showSelected = !0;
39
+ shouldDisableDrawerScroll = !1;
40
+ unselectable = [];
41
+ unselectableText = "";
42
+ savedOnSelect;
43
+ // todo
44
+ constructor() {
45
+ C(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 u("/", "");
61
+ categories = [];
62
+ dateRangeCategoryTotals = [];
63
+ monthlyCategoryTotals = [];
64
+ dataRangeTotalsLoaded = !1;
65
+ isLoadingCategoryTotals = !1;
66
+ monthlyTotalsLoaded = !1;
67
+ constructor(t) {
68
+ this.globalStore = t, this.uiStore = new w(), this.api = new u(t.endpoint, t.sessionToken, t.onError), C(this);
69
+ }
70
+ get detailedCategories() {
71
+ return m(
72
+ this.categories,
73
+ this.dateRangeCategoryTotals,
74
+ this.monthlyCategoryTotals
75
+ );
76
+ }
77
+ get detailedCategoriesWithTransactions() {
78
+ return p(
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 !== g.INVESTMENTS
89
+ );
90
+ }
91
+ get transferCategories() {
92
+ return this.detailedCategories.filter((t) => t.isTransfer);
93
+ }
94
+ get trendsCategories() {
95
+ return this.detailedCategories.filter((t) => t.totalAmount !== 0).filter((t) => t.guid !== g.INVESTMENTS && t.guid !== g.TRANSFER);
96
+ }
97
+ addCategory = async (t, e) => {
98
+ const o = { name: t, parent_guid: e };
99
+ try {
100
+ await this.api.addCategory(o), await this.loadCategories();
101
+ } catch (a) {
102
+ console.error(`Error occurred while adding category: ${a}`);
103
+ }
104
+ };
105
+ loadCategories = async (t) => {
106
+ try {
107
+ const e = t || await this.api.getCategories(), { default_categories: o } = this.globalStore.copyStore.copy.categories;
108
+ l(() => {
109
+ this.categories = e.map((a) => ({
110
+ ...a,
111
+ name: o[a.guid] ? o[a.guid].replace(/&/g, "&") : a.name
112
+ }));
113
+ });
114
+ } catch (e) {
115
+ console.error(`Error occurred while getting categories: ${e}`);
116
+ }
117
+ };
118
+ loadDateRangeCategoryTotals = async (t, e, o) => {
119
+ this.setIsLoadingCategoryTotals(!0);
120
+ try {
121
+ const a = await this.api.getDateRangeCategoryTotals(
122
+ r(e),
123
+ r(o),
124
+ t
125
+ );
126
+ l(() => {
127
+ this.dateRangeCategoryTotals = a, this.setIsLoadingCategoryTotals(!1), this.dataRangeTotalsLoaded = !0;
128
+ });
129
+ } catch (a) {
130
+ this.setIsLoadingCategoryTotals(!1), console.error(`Error occurred while getting date range category totals: ${a}`);
131
+ }
132
+ };
133
+ loadMonthlyCategoryTotals = async (t = this.globalStore.globalUiStore.selectedAccounts, e, o) => {
134
+ const a = r(d(e ?? h(/* @__PURE__ */ new Date(), 11))), s = r(y(o ?? /* @__PURE__ */ new Date()));
135
+ try {
136
+ const n = await this.api.getMonthlyCategoryTotals(a, s, t);
137
+ l(() => {
138
+ this.monthlyCategoryTotals = n, this.monthlyTotalsLoaded = !0;
139
+ });
140
+ } catch (n) {
141
+ console.error(`Error occurred while getting monthly category totals: ${n}`);
142
+ }
143
+ };
144
+ reloadCategoryTotals = async (t, e, o) => {
145
+ this.setIsLoadingCategoryTotals(!0);
146
+ try {
147
+ const a = await this.api.getDateRangeCategoryTotals(
148
+ r(e),
149
+ r(o),
150
+ t
151
+ ), s = await this.api.getMonthlyCategoryTotals(
152
+ r(d(h(o, 11))),
153
+ r(y(o)),
154
+ t
155
+ );
156
+ l(() => {
157
+ this.dateRangeCategoryTotals = a, this.monthlyCategoryTotals = s, this.dataRangeTotalsLoaded = !0, this.monthlyTotalsLoaded = !0, this.setIsLoadingCategoryTotals(!1);
158
+ });
159
+ } catch (a) {
160
+ console.error(`Error occurred while getting category totals: ${a}`);
161
+ }
162
+ };
163
+ removeCategory = async (t) => {
164
+ try {
165
+ await this.api.removeCategory(t), await this.loadCategories();
166
+ } catch (e) {
167
+ console.error(`Error occurred while removing category: ${e}`);
168
+ }
169
+ };
170
+ setIsLoadingCategoryTotals = (t) => {
171
+ this.isLoadingCategoryTotals = t;
172
+ };
173
+ updateCategory = async (t) => {
174
+ try {
175
+ await this.api.updateCategory(t), await this.loadCategories();
176
+ } catch (e) {
177
+ console.error(`Error occurred while updating category: ${e}`);
178
+ }
179
+ };
180
+ // TODO: Remove this after refactoring Trends components to use detailedCategories
181
+ getCategoryName = (t) => this.categories.find((o) => o.guid === t)?.name ?? S[t];
182
+ }
183
+ export {
184
+ G as C,
185
+ u as a
186
+ };
@@ -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, a as E } from "./Dialog-BPTr3qHE.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
+ };