@mx-cartographer/experiences 8.0.0-alpha.sms2 → 9.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 (139) hide show
  1. package/CHANGELOG.md +217 -0
  2. package/dist/{Account-Cp30A3ad.mjs → Account-BIKn4XEZ.mjs} +1 -1
  3. package/dist/Account-CMjOp7S2.mjs +118 -0
  4. package/dist/AccountApi-DgZ8ILj1.mjs +19 -0
  5. package/dist/AccountDetailsHeader-BOV91g1o.mjs +95 -0
  6. package/dist/AccountDisplayName-CO7z3v99.mjs +11 -0
  7. package/dist/{AccountFields-CW6cIthP.mjs → AccountFields-BRRH37K1.mjs} +10 -11
  8. package/dist/{AccountListItem-DxmAs98Z.mjs → AccountListItem-Ds5C0mOT.mjs} +4 -4
  9. package/dist/{AccountStore-hIs-yA6W.mjs → AccountStore-BFKvXJSD.mjs} +79 -69
  10. package/dist/{Accounts-DUHkUyK4.mjs → Accounts-CuE8aSZN.mjs} +1 -1
  11. package/dist/{BudgetUtil-CIDAPPPT.mjs → BudgetUtil-CDSOZXem.mjs} +4 -4
  12. package/dist/CategorySelectorDrawer-C4aZYP4N.mjs +418 -0
  13. package/dist/CategoryStore-DEqAnHbi.mjs +186 -0
  14. package/dist/{CategoryUtil-DfVKKkRf.mjs → CategoryUtil-CFHBvaV4.mjs} +1 -1
  15. package/dist/{ConnectionsDrawer-CSo6AFkG.mjs → ConnectionsDrawer-BExzgE16.mjs} +5 -5
  16. package/dist/{CurrencyInput-BrGvhgVK.mjs → CurrencyInput-DDQ4DBrE.mjs} +1 -1
  17. package/dist/{CurrencyText-Dr0EZ7bp.mjs → CurrencyText-C-85TnUF.mjs} +3 -3
  18. package/dist/{DateUtil-CDPZw_-m.mjs → DateUtil-CVsMhbZU.mjs} +3 -3
  19. package/dist/{DebtsStore-hi1cqrRk.mjs → DebtsStore-Dv_T7Dts.mjs} +12 -12
  20. package/dist/{Dialog-CDV0kKxj.mjs → Dialog-CWymUiuO.mjs} +32 -35
  21. package/dist/Drawer-Bet2ZPJo.mjs +176 -0
  22. package/dist/{ExportCsvAction-CQ1grpwo.mjs → ExportCsvAction-oG_Mn66T.mjs} +3 -3
  23. package/dist/{FinstrongStore-dKZOZ2hM.mjs → FinstrongStore-BjFkMTIL.mjs} +6 -6
  24. package/dist/GlobalAccountFilter-BpWlPAl5.mjs +316 -0
  25. package/dist/{GoalStore-CFeAJloA.mjs → GoalStore-Dbjgft2i.mjs} +155 -137
  26. package/dist/{Help-i4OasOO-.mjs → Help-BW_ar-4B.mjs} +2 -2
  27. package/dist/LineChart-DHj-Bufi.mjs +580 -0
  28. package/dist/{ListItemAction-BNCWQAN_.mjs → ListItemAction-Cbr3417C.mjs} +10 -10
  29. package/dist/{ManageIncome-D_qVX5dN.mjs → ManageIncome-DIIyqDTp.mjs} +85 -85
  30. package/dist/{MicroWidgetContainer-BGpNl5ZS.mjs → MicroWidgetContainer-DSyYwRCU.mjs} +2 -2
  31. package/dist/{MiniWidgetContainer-D7MkHG15.mjs → MiniWidgetContainer-DKn7ndO6.mjs} +1 -1
  32. package/dist/NetWorthStore-B6ziBtaH.mjs +168 -0
  33. package/dist/NotificationSettings-e789PcRb.mjs +676 -0
  34. package/dist/{OriginalBalanceAction-62e0mU_3.mjs → OriginalBalanceAction-DFoG79Ba.mjs} +3 -3
  35. package/dist/{RecurringSettings-RfZ8Wuhh.mjs → RecurringSettings-BpCUcE8w.mjs} +4 -4
  36. package/dist/{RecurringTransactionsStore-D3EOKZ2B.mjs → RecurringTransactionsStore-D_--5PWH.mjs} +1 -1
  37. package/dist/{RecurringTransactions-Bhx56aA3.mjs → RepeatingTransaction-C2txVA9O.mjs} +3 -3
  38. package/dist/{SettingsStore-BASMQSIp.mjs → SettingsStore-CInvh-rQ.mjs} +1 -1
  39. package/dist/SpendingData-B7NuTQ9s.mjs +53 -0
  40. package/dist/SpendingLegend-BxefXiQd.mjs +193 -0
  41. package/dist/TransactionDetails-CPwv9xtZ.mjs +1374 -0
  42. package/dist/{TransactionStore-DgLrYW4C.mjs → TransactionStore-D2aMUClq.mjs} +128 -111
  43. package/dist/TrendsStore-BdsYfCc7.mjs +183 -0
  44. package/dist/{User-DqNX2GAK.mjs → User-CulNdZUr.mjs} +21 -20
  45. package/dist/ViewMoreMicroCard-CDWR16_h.mjs +1147 -0
  46. package/dist/WidgetContainer-mzejMmz2.mjs +555 -0
  47. package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsChart.d.ts +1 -0
  48. package/dist/accounts/index.es.js +933 -232
  49. package/dist/accounts/stores/AccountStore.d.ts +6 -2
  50. package/dist/accounts/utils/AccountDetails.d.ts +5 -0
  51. package/dist/analytics/index.es.js +2 -2
  52. package/dist/budgets/components/AddBudgets.d.ts +2 -1
  53. package/dist/budgets/index.es.js +561 -522
  54. package/dist/cashflow/index.es.js +397 -396
  55. package/dist/categories/components/CustomCategories/AddSubcategory.d.ts +1 -0
  56. package/dist/categories/components/CustomCategories/DeleteSubcategory.d.ts +1 -0
  57. package/dist/categories/components/CustomCategories/RenameSubcategory.d.ts +1 -0
  58. package/dist/categories/components/SubcategoryRow.d.ts +1 -0
  59. package/dist/categories/index.es.js +2 -2
  60. package/dist/categories/stores/CategoryStore.d.ts +5 -3
  61. package/dist/common/components/GlobalAccountFilter.d.ts +11 -0
  62. package/dist/common/components/WidgetContainer.d.ts +7 -6
  63. package/dist/common/components/charts/linechart/CustomTooltip.d.ts +6 -1
  64. package/dist/common/components/charts/stackedlinechart/CustomPointTooltip.d.ts +5 -2
  65. package/dist/common/components/globalaccountfilter/GlobalAccountFilterList.d.ts +7 -0
  66. package/dist/common/components/index.d.ts +2 -2
  67. package/dist/common/hooks/index.d.ts +1 -0
  68. package/dist/common/hooks/useWidgetLoadTimer.d.ts +6 -0
  69. package/dist/common/index.es.js +325 -306
  70. package/dist/common/stores/GlobalUiStore.d.ts +7 -4
  71. package/dist/common/types/localization/AccountsCopy.d.ts +6 -0
  72. package/dist/common/types/localization/CategoryCopy.d.ts +3 -0
  73. package/dist/common/types/localization/CommonCopy.d.ts +3 -0
  74. package/dist/common/types/localization/GoalsCopy.d.ts +3 -1
  75. package/dist/common/types/localization/MicroInsightsCopy.d.ts +1 -0
  76. package/dist/common/types/localization/TransactionsCopy.d.ts +4 -0
  77. package/dist/common/types/localization/TrendsCopy.d.ts +4 -0
  78. package/dist/dashboard/index.es.js +95 -125
  79. package/dist/debts/index.es.js +466 -460
  80. package/dist/{exportTransactionsToCSV-BFpuIAXW.mjs → exportTransactionsToCSV-BU1jTY0Q.mjs} +4 -4
  81. package/dist/finstrong/components/shared/CustomDoubleBarPlot.d.ts +4 -5
  82. package/dist/finstrong/index.es.js +1660 -1553
  83. package/dist/goals/index.es.js +716 -677
  84. package/dist/goals/stores/GoalStore.d.ts +2 -0
  85. package/dist/help/index.es.js +14 -10
  86. package/dist/{hooks-C41HAxM5.mjs → hooks-fY_n74f7.mjs} +16 -16
  87. package/dist/investments/index.es.js +464 -457
  88. package/dist/merchants/index.es.js +1 -1
  89. package/dist/microinsights/MicroCardTemplate.d.ts +23 -0
  90. package/dist/microinsights/beaticons/BeatMaterialIcon.d.ts +8 -0
  91. package/dist/microinsights/beaticons/MonthlySpendComparisonIcon.d.ts +1 -2
  92. package/dist/microinsights/beaticons/index.d.ts +1 -0
  93. package/dist/microinsights/cards/InsightCard.d.ts +0 -2
  94. package/dist/microinsights/cards/ViewMoreMicroCard.d.ts +2 -5
  95. package/dist/microinsights/index.d.ts +2 -2
  96. package/dist/microinsights/index.es.js +824 -14
  97. package/dist/networth/components/NetWorthChart.d.ts +3 -2
  98. package/dist/networth/components/NetWorthList.d.ts +3 -3
  99. package/dist/networth/index.es.js +433 -438
  100. package/dist/networth/stores/NetWorthStore.d.ts +20 -9
  101. package/dist/networth/utils/NetWorthUtils.d.ts +2 -2
  102. package/dist/notifications/index.es.js +5 -5
  103. package/dist/recurringtransactions/index.es.js +331 -325
  104. package/dist/settings/index.es.js +293 -285
  105. package/dist/spending/components/SpendingChart.d.ts +1 -1
  106. package/dist/spending/components/SpendingList.d.ts +1 -1
  107. package/dist/spending/components/SpendingTabLabel.d.ts +1 -0
  108. package/dist/spending/index.es.js +250 -235
  109. package/dist/transactions/index.es.js +288 -281
  110. package/dist/transactions/stores/TransactionStore.d.ts +5 -0
  111. package/dist/trends/components/TrendsTable.d.ts +0 -2
  112. package/dist/trends/index.es.js +876 -802
  113. package/dist/trends/utils/TrendsData.d.ts +1 -0
  114. package/dist/trends/utils/TrendsTable.d.ts +12 -0
  115. package/dist/{useAccountDisplayName-usSZCQ7I.mjs → useAccountDisplayName-DbkgGLdg.mjs} +2 -2
  116. package/dist/useAriaLive-B3_pRUio.mjs +35 -0
  117. package/dist/{useInsightsEnabled-CNjP5cfR.mjs → useInsightsEnabled-dhmXeSyF.mjs} +1 -1
  118. package/dist/useWidgetLoadTimer-CrUzxN-P.mjs +19 -0
  119. package/package.json +26 -21
  120. package/dist/AccountDetailsContent-C1HumFnW.mjs +0 -683
  121. package/dist/AccountDetailsHeader-NMx79DGs.mjs +0 -87
  122. package/dist/CategorySelectorDrawer-DqDAA_5I.mjs +0 -399
  123. package/dist/CategoryStore-MUwRWH9e.mjs +0 -176
  124. package/dist/ConnectDrawer-Dn1MlqLz.mjs +0 -545
  125. package/dist/Drawer-Dqe5EqvA.mjs +0 -163
  126. package/dist/LineChart-bc1D9xBE.mjs +0 -581
  127. package/dist/NetWorthStore-8FFC1Bs0.mjs +0 -150
  128. package/dist/NotificationSettings-BsWiYD94.mjs +0 -672
  129. package/dist/SpendingData-DPQ96k3x.mjs +0 -55
  130. package/dist/SpendingLegend-CZzDb-7d.mjs +0 -193
  131. package/dist/TransactionDetails-Duv1X9ec.mjs +0 -1379
  132. package/dist/TrendsStore-_mRaFUdf.mjs +0 -182
  133. package/dist/ViewMoreMicroCard-CH9E-jOx.mjs +0 -1930
  134. package/dist/WidgetContainer-B1Jzb4XA.mjs +0 -565
  135. package/dist/common/components/accountfilter/AccountFilter.d.ts +0 -20
  136. package/dist/common/components/accountfilter/AccountFilterOptions.d.ts +0 -31
  137. package/dist/common/components/accountfilter/index.d.ts +0 -1
  138. package/dist/microinsights/cards/BaseCard.d.ts +0 -13
  139. package/dist/{ToggleListItem-ciFTiqRS.mjs → Notification-Bs1fdbzI.mjs} +1 -1
@@ -1,35 +1,35 @@
1
- import { jsx as g } from "react/jsx-runtime";
1
+ import { jsx as E } from "react/jsx-runtime";
2
2
  import x from "@mui/material/Box";
3
3
  import P from "@mui/material/FormControlLabel";
4
4
  import H from "@mui/material/Radio";
5
- import K from "@mui/material/styles/useTheme";
6
- import U from "@mui/material/Tooltip";
5
+ import B from "@mui/material/styles/useTheme";
6
+ import K from "@mui/material/Tooltip";
7
7
  import { makeAutoObservable as p } from "mobx";
8
8
  import { endOfToday as f } from "date-fns/endOfToday";
9
- import { formatISO as V } from "date-fns/formatISO";
9
+ import { formatISO as U } from "date-fns/formatISO";
10
10
  import { getUnixTime as O } from "date-fns/getUnixTime";
11
- import { isBefore as v } from "date-fns/isBefore";
11
+ import { isBefore as V } from "date-fns/isBefore";
12
12
  import { startOfMonth as h } from "date-fns/startOfMonth";
13
13
  import { startOfToday as m } from "date-fns/startOfToday";
14
- import { subDays as B } from "date-fns/subDays";
15
- import { O as o, a as y, T as b } from "./User-DqNX2GAK.mjs";
14
+ import { subDays as v } from "date-fns/subDays";
15
+ import { O as o, a as y, T as b } from "./User-CulNdZUr.mjs";
16
16
  import { T as u } from "./TransactionApi-CjBoLleL.mjs";
17
17
  import { b as Y } from "./Category-Ccoew_sA.mjs";
18
- import { f as F } from "./exportTransactionsToCSV-BFpuIAXW.mjs";
18
+ import { f as F } from "./exportTransactionsToCSV-BU1jTY0Q.mjs";
19
19
  import { format as W } from "date-fns/format";
20
20
  import { fromUnixTime as $ } from "date-fns/fromUnixTime";
21
- import { f as I, a as C, O as k } from "./Dialog-CDV0kKxj.mjs";
21
+ import { f as I, D as C, O as k } from "./Dialog-CWymUiuO.mjs";
22
22
  import { endOfMonth as z } from "date-fns/endOfMonth";
23
- import { B as L } from "./BeatApi-De2IaqH2.mjs";
23
+ import { B as D } from "./BeatApi-De2IaqH2.mjs";
24
24
  const Rt = ({
25
25
  checked: l = !1,
26
26
  label: t,
27
27
  sx: a = {},
28
- tooltip: e = "",
28
+ tooltip: s = "",
29
29
  value: A
30
30
  }) => {
31
- const d = K(), s = d.palette.mode === "light" ? d.palette.grey[400] : d.palette.grey[700], c = l ? d.palette.action.active : s;
32
- return /* @__PURE__ */ g(
31
+ const d = B(), e = d.palette.mode === "light" ? d.palette.grey[400] : d.palette.grey[700], c = l ? d.palette.action.active : e;
32
+ return /* @__PURE__ */ E(
33
33
  x,
34
34
  {
35
35
  bgcolor: "background.paper",
@@ -41,10 +41,10 @@ const Rt = ({
41
41
  pr: 8,
42
42
  py: 4,
43
43
  sx: { "&:hover": { borderColor: d.palette.action.active }, ...a },
44
- children: /* @__PURE__ */ g(U, { title: e, children: /* @__PURE__ */ g(
44
+ children: /* @__PURE__ */ E(K, { title: s, children: /* @__PURE__ */ E(
45
45
  P,
46
46
  {
47
- control: /* @__PURE__ */ g(
47
+ control: /* @__PURE__ */ E(
48
48
  H,
49
49
  {
50
50
  disableRipple: !0,
@@ -309,25 +309,25 @@ const Rt = ({
309
309
  category: T.TRANSACTIONS_WIDGET,
310
310
  label: r.DELETE_TRANSACTION
311
311
  }
312
- }, X = async (l, t) => !t || !R[l] ? null : t.sendAnalyticEvent(R[l]), D = {
312
+ }, X = async (l, t) => !t || !R[l] ? null : t.sendAnalyticEvent(R[l]), L = {
313
313
  DATE: "date",
314
314
  AMOUNT: "amount"
315
- }, j = (l, t, a, e = []) => {
316
- const A = t.reduce((c, i) => ({ ...c, [i.guid]: i }), {}), d = a.reduce((c, i) => ({ ...c, [i.guid]: i }), {}), s = e.reduce((c, i) => {
317
- const { transaction_guid: S, tag_guid: E } = i;
315
+ }, j = (l, t, a, s = []) => {
316
+ const A = t.reduce((c, i) => ({ ...c, [i.guid]: i }), {}), d = a.reduce((c, i) => ({ ...c, [i.guid]: i }), {}), e = s.reduce((c, i) => {
317
+ const { transaction_guid: S, tag_guid: N } = i;
318
318
  if (!c[S])
319
319
  return {
320
320
  ...c,
321
- [S]: [E]
321
+ [S]: [N]
322
322
  };
323
- const N = [...c[S], E];
323
+ const g = [...c[S], N];
324
324
  return {
325
325
  ...c,
326
- [S]: N
326
+ [S]: g
327
327
  };
328
328
  }, {});
329
329
  return l.map((c) => {
330
- const i = A[c.account_guid], S = c.category_guid ? d[c.category_guid] : null, E = s[c.guid] ?? [];
330
+ const i = A[c.account_guid], S = c.category_guid ? d[c.category_guid] : null, N = e[c.guid] ?? [];
331
331
  return {
332
332
  ...c,
333
333
  account: i?.user_name || "Unknown",
@@ -338,40 +338,40 @@ const Rt = ({
338
338
  isPending: c.feed_status === y.PENDING,
339
339
  number: i?.account_number || "",
340
340
  payee: c.description,
341
- tags: E
341
+ tags: N
342
342
  };
343
343
  });
344
- }, Z = "uncategorized", q = (l, t, a, e, A, d) => {
345
- const s = J(l, A, d), c = Q(s, a, e);
344
+ }, Z = "uncategorized", q = (l, t, a, s, A, d) => {
345
+ const e = J(l, A, d), c = Q(e, a, s);
346
346
  return t.forEach((i) => {
347
- const S = c.findIndex((N) => N.guid === i), E = d.filter((N) => N.parent_guid === i);
348
- c.splice(S + 1, 0, ...E);
347
+ const S = c.findIndex((g) => g.guid === i), N = d.filter((g) => g.parent_guid === i);
348
+ c.splice(S + 1, 0, ...N);
349
349
  }), c;
350
350
  }, J = (l, t, a) => {
351
351
  const {
352
- accounts: e = [],
352
+ accounts: s = [],
353
353
  dateRange: A = { start: h(m()), end: f() },
354
354
  custom: d = () => !0,
355
- searchTerm: s = "",
355
+ searchTerm: e = "",
356
356
  showSplits: c = !1
357
357
  } = l;
358
- return a.filter((i) => c ? !i.has_been_split : !i.parent_guid).filter((i) => !!e.find((S) => S === i.account_guid)).filter((i) => i.date >= O(A.start) && i.date <= O(A.end)).filter(d).filter((i) => {
359
- if (s === Z && i.has_been_split)
358
+ return a.filter((i) => c ? !i.has_been_split : !i.parent_guid).filter((i) => !!s.find((S) => S === i.account_guid)).filter((i) => i.date >= O(A.start) && i.date <= O(A.end)).filter(d).filter((i) => {
359
+ if (e === Z && i.has_been_split)
360
360
  return !1;
361
- if (/^spl/i.test(s) && (i.has_been_split || i.parent_guid))
361
+ if (/^spl/i.test(e) && (i.has_been_split || i.parent_guid))
362
362
  return !0;
363
- const E = i.tags.some(
364
- (w) => _(s, t.find((M) => M.guid === w)?.name)
365
- ), N = $(i.date);
366
- return _(s, i.payee) || _(s, i.feed_description) || _(s, i.category) || _(s, I(N, C.MONTH)) || _(s, I(N, C.DAY)) || _(s, I(N, C.FULL_MONTH_DAY)) || _(s, I(N, C.MONTH_DAY_YEAR)) || _(s, W(N, k)) || _(s, i.account) || _(s, `${i.amount}`) || _(s, i.memo) || E;
363
+ const N = i.tags.some(
364
+ (w) => _(e, t.find((M) => M.guid === w)?.name)
365
+ ), g = $(i.date);
366
+ return _(e, i.payee) || _(e, i.feed_description) || _(e, i.category) || _(e, I(g, C.MONTH)) || _(e, I(g, C.DAY)) || _(e, I(g, C.FULL_MONTH_DAY)) || _(e, I(g, C.MONTH_DAY_YEAR)) || _(e, W(g, k)) || _(e, i.account) || _(e, `${i.amount}`) || _(e, i.memo) || N;
367
367
  });
368
- }, Q = (l, t, a) => [...l].sort((e, A) => {
369
- const d = t, s = (e[d] || "") > (A[d] || "");
370
- let c = s ? -1 : 1, i = s ? 1 : -1;
371
- return (t === D.DATE || t === D.AMOUNT) && (c = s ? 1 : -1, i = s ? -1 : 1), a === G.ASC ? c : i;
368
+ }, Q = (l, t, a) => [...l].sort((s, A) => {
369
+ const d = t, e = (s[d] || "") > (A[d] || "");
370
+ let c = e ? -1 : 1, i = e ? 1 : -1;
371
+ return (t === L.DATE || t === L.AMOUNT) && (c = e ? 1 : -1, i = e ? -1 : 1), a === G.ASC ? c : i;
372
372
  }), _ = (l, t) => {
373
- const a = l.toLowerCase().split(" "), e = t?.toString().toLowerCase() ?? "";
374
- return a.every((A) => e.indexOf(A) > -1);
373
+ const a = l.toLowerCase().split(" "), s = t?.toString().toLowerCase() ?? "";
374
+ return a.every((A) => s.indexOf(A) > -1);
375
375
  }, tt = {
376
376
  account_guid: "",
377
377
  amount: 0,
@@ -430,8 +430,8 @@ class at {
430
430
  this.height = t, this.width = a;
431
431
  };
432
432
  toggleSplit = (t) => {
433
- const a = [...this.expandedSplits], e = this.expandedSplits.findIndex((A) => A === t);
434
- e >= 0 ? a.splice(e, 1) : a.push(t), this.expandedSplits = a;
433
+ const a = [...this.expandedSplits], s = this.expandedSplits.findIndex((A) => A === t);
434
+ s >= 0 ? a.splice(s, 1) : a.push(t), this.expandedSplits = a;
435
435
  };
436
436
  clearExpandedSplits = () => {
437
437
  this.expandedSplits.length !== 0 && (this.expandedSplits = []);
@@ -444,21 +444,26 @@ class pt {
444
444
  globalStore;
445
445
  uiStore;
446
446
  api = new u("/", "");
447
- beatApi = new L("/", "");
447
+ beatApi = new D("/", "");
448
448
  associatedBeats = [];
449
449
  associatedBeatsLoaded = !1;
450
+ associatedBeatsLoading = !1;
450
451
  transactions = [];
451
452
  transactionsLoaded = !1;
453
+ transactionsLoading = !1;
452
454
  taggings = [];
453
455
  taggingsLoaded = !1;
456
+ taggingsLoading = !1;
454
457
  tags = [];
455
458
  tagsLoaded = !1;
459
+ tagsLoading = !1;
456
460
  transactionRules = [];
457
461
  transactionRulesLoaded = !1;
458
- cachedStartDate = B(m(), 90);
462
+ transactionRulesLoading = !1;
463
+ cachedStartDate = v(m(), 90);
459
464
  filter = {};
460
465
  isLoading = !0;
461
- sortColumn = D.DATE;
466
+ sortColumn = L.DATE;
462
467
  sortDirection = G.DESC;
463
468
  onAnalyticEvent = X;
464
469
  constructor(t) {
@@ -466,7 +471,7 @@ class pt {
466
471
  t.endpoint,
467
472
  t.sessionToken,
468
473
  t.onError
469
- ), this.beatApi = new L(t.endpoint, t.sessionToken, t.onError), p(this);
474
+ ), this.beatApi = new D(t.endpoint, t.sessionToken, t.onError), p(this);
470
475
  }
471
476
  loadTransactionData = async () => {
472
477
  this.globalStore.accountStore.isAccountDataLoaded || await this.globalStore.accountStore.loadAccountData(), this.globalStore.categoryStore.categoriesLoaded || await this.globalStore.categoryStore.loadCategories(), await Promise.all([
@@ -503,19 +508,19 @@ class pt {
503
508
  return F(this.sortedTransactions, this.transactions);
504
509
  }
505
510
  setAssociatedBeats = (t) => {
506
- this.associatedBeats = t, this.associatedBeatsLoaded = !0;
511
+ this.associatedBeats = t, this.associatedBeatsLoading = !1, this.associatedBeatsLoaded = !0;
507
512
  };
508
513
  setTaggings = (t) => {
509
- this.taggings = t, this.taggingsLoaded = !0;
514
+ this.taggings = t, this.taggingsLoading = !1, this.taggingsLoaded = !0;
510
515
  };
511
516
  setTags = (t) => {
512
- this.tags = t, this.tagsLoaded = !0;
517
+ this.tags = t, this.tagsLoading = !1, this.tagsLoaded = !0;
513
518
  };
514
519
  setTransactionRules = (t) => {
515
- this.transactionRules = t, this.transactionRulesLoaded = !0;
520
+ this.transactionRules = t, this.transactionRulesLoading = !1, this.transactionRulesLoaded = !0;
516
521
  };
517
522
  setTransactions = (t) => {
518
- this.transactions = t, this.transactionsLoaded = !0;
523
+ this.transactions = t, this.transactionsLoading = !1, this.transactionsLoaded = !0;
519
524
  };
520
525
  addTag = async (t) => {
521
526
  await this.api.addTag({ name: t }), await this.loadTags();
@@ -527,11 +532,11 @@ class pt {
527
532
  });
528
533
  };
529
534
  addOrUpdateTransactionRule = async (t, a) => {
530
- const e = this.transactionRules.find(
535
+ const s = this.transactionRules.find(
531
536
  (A) => A.guid === a.user_transaction_rule_guid
532
537
  );
533
- e ? await this.api.updateTransactionRule({
534
- ...e,
538
+ s ? await this.api.updateTransactionRule({
539
+ ...s,
535
540
  category_guid: t,
536
541
  description: a.description
537
542
  }) : await this.api.addTransactionRule({
@@ -544,55 +549,67 @@ class pt {
544
549
  const a = await this.api.addTransaction(t);
545
550
  if (a) {
546
551
  this.setTransactions([a, ...this.transactions]);
547
- const e = a.transaction_type === b.CREDIT ? a.amount : -a.amount;
548
- this.globalStore.accountStore.updateAccountBalance(a.account_guid, e);
552
+ const s = a.transaction_type === b.CREDIT ? a.amount : -a.amount;
553
+ this.globalStore.accountStore.updateAccountBalance(a.account_guid, s);
549
554
  }
550
555
  };
551
556
  loadAssociatedBeats = async (t) => {
552
- const a = t ? V(t, { representation: "date" }) : void 0;
557
+ if (this.associatedBeatsLoading) return;
558
+ this.associatedBeatsLoading = !0;
559
+ const a = t ? U(t, { representation: "date" }) : void 0;
553
560
  try {
554
- const e = await this.beatApi.getBeatsWithAssociatedTransaction(a);
555
- this.setAssociatedBeats(e);
556
- } catch (e) {
557
- console.error(`Error occurred while loading associated beats: ${e}`);
561
+ const s = await this.beatApi.getBeatsWithAssociatedTransaction(a);
562
+ this.setAssociatedBeats(s);
563
+ } catch (s) {
564
+ console.error(`Error occurred while loading associated beats: ${s}`);
558
565
  }
559
566
  };
560
567
  loadTags = async () => {
561
- try {
562
- const t = await this.api.getTags();
563
- this.setTags(t);
564
- } catch (t) {
565
- console.error(`Error occurred while loading tags: ${t}`);
568
+ if (!this.tagsLoading) {
569
+ this.tagsLoading = !0;
570
+ try {
571
+ const t = await this.api.getTags();
572
+ this.setTags(t);
573
+ } catch (t) {
574
+ console.error(`Error occurred while loading tags: ${t}`);
575
+ }
566
576
  }
567
577
  };
568
578
  loadTaggings = async () => {
569
- try {
570
- const t = await this.api.getTaggings();
571
- this.setTaggings(t);
572
- } catch (t) {
573
- console.error(`Error occurred while loading taggings: ${t}`);
579
+ if (!this.taggingsLoading) {
580
+ this.taggingsLoading = !0;
581
+ try {
582
+ const t = await this.api.getTaggings();
583
+ this.setTaggings(t);
584
+ } catch (t) {
585
+ console.error(`Error occurred while loading taggings: ${t}`);
586
+ }
574
587
  }
575
588
  };
576
589
  loadTransactionRules = async () => {
590
+ if (this.transactionRulesLoading) return;
591
+ this.transactionRulesLoading = !0;
577
592
  const t = await this.api.getTransactionRules();
578
593
  this.setTransactionRules(t);
579
594
  };
580
595
  loadTransactions = async (t = this.cachedStartDate) => {
581
- this.setIsLoading(!0), this.transactions = [];
582
- try {
583
- const a = await this.api.getTransactionsByDateRange(
584
- O(t),
585
- O(f())
586
- );
587
- this.setTransactions(a);
588
- } catch (a) {
589
- console.error(`Error occurred while loading transactions: ${a}`);
596
+ if (!this.transactionsLoading) {
597
+ this.setIsLoading(!0), this.transactionsLoading = !0, this.transactions = [];
598
+ try {
599
+ const a = await this.api.getTransactionsByDateRange(
600
+ O(t),
601
+ O(f())
602
+ );
603
+ this.setTransactions(a);
604
+ } catch (a) {
605
+ console.error(`Error occurred while loading transactions: ${a}`);
606
+ }
607
+ this.setIsLoading(!1);
590
608
  }
591
- this.setIsLoading(!1);
592
609
  };
593
610
  modifyTransactionByAccountGuid = (t, a) => {
594
611
  this.transactions = this.transactions.map(
595
- (e) => e.account_guid === t ? { ...e, ...a } : e
612
+ (s) => s.account_guid === t ? { ...s, ...a } : s
596
613
  );
597
614
  };
598
615
  removeTag = async (t) => {
@@ -603,64 +620,64 @@ class pt {
603
620
  };
604
621
  removeTransaction = async (t) => {
605
622
  await this.api.removeTransaction(t);
606
- const a = this.transactions.findIndex((e) => e.guid === t);
623
+ const a = this.transactions.findIndex((s) => s.guid === t);
607
624
  if (a >= 0) {
608
- const e = [...this.transactions];
609
- e.splice(a, 1), this.setTransactions(e);
625
+ const s = [...this.transactions];
626
+ s.splice(a, 1), this.setTransactions(s);
610
627
  }
611
628
  };
612
629
  setFilter = (t) => {
613
- this.filter = t, t.dateRange && v(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start).then(() => {
630
+ this.filter = t, t.dateRange && V(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start).then(() => {
614
631
  t.dateRange && (this.cachedStartDate = t.dateRange.start);
615
632
  });
616
633
  };
617
634
  setIsLoading = (t) => this.isLoading = t;
618
635
  splitTransaction = async (t, a) => {
619
- const e = await this.api.updateTransaction(t), A = [];
620
- for (let s = 0; s < a.length; s++) {
621
- const c = await this.api.addTransaction(a[s]);
636
+ const s = await this.api.updateTransaction(t), A = [];
637
+ for (let e = 0; e < a.length; e++) {
638
+ const c = await this.api.addTransaction(a[e]);
622
639
  A.push(c);
623
640
  }
624
- const d = this.transactions.findIndex((s) => s.guid === t.guid);
641
+ const d = this.transactions.findIndex((e) => e.guid === t.guid);
625
642
  d >= 0 && this.setTransactions([
626
643
  ...this.transactions.slice(0, d),
627
- e,
644
+ s,
628
645
  ...this.transactions.slice(d + 1),
629
646
  ...A
630
647
  ]);
631
648
  };
632
649
  unSplitTransaction = async (t) => {
633
- const a = this.transactions.filter((s) => s.parent_guid === t);
650
+ const a = this.transactions.filter((e) => e.parent_guid === t);
634
651
  await this.api.removeTransactionSplit(t);
635
- const e = [...this.transactions];
636
- a.forEach((s) => {
637
- const c = e.findIndex((i) => i.guid === s.guid);
638
- c >= 0 && e.splice(c, 1);
652
+ const s = [...this.transactions];
653
+ a.forEach((e) => {
654
+ const c = s.findIndex((i) => i.guid === e.guid);
655
+ c >= 0 && s.splice(c, 1);
639
656
  });
640
- const A = e.findIndex((s) => s.guid === t), d = e[A];
657
+ const A = s.findIndex((e) => e.guid === t), d = s[A];
641
658
  d.has_been_split = !1, A >= 0 && this.setTransactions([
642
- ...e.slice(0, A),
659
+ ...s.slice(0, A),
643
660
  d,
644
- ...e.slice(A + 1)
661
+ ...s.slice(A + 1)
645
662
  ]);
646
663
  };
647
664
  updateTaggings = async (t, a) => {
648
- const e = this.taggings.filter((s) => s.transaction_guid === a), A = new Set(e.map((s) => s.tag_guid)), d = new Set(t);
649
- for (const s of t)
650
- A.has(s) || await this.addTagging(s, a);
651
- for (const s of e)
652
- d.has(s.tag_guid) || await this.removeTagging(s.guid);
665
+ const s = this.taggings.filter((e) => e.transaction_guid === a), A = new Set(s.map((e) => e.tag_guid)), d = new Set(t);
666
+ for (const e of t)
667
+ A.has(e) || await this.addTagging(e, a);
668
+ for (const e of s)
669
+ d.has(e.tag_guid) || await this.removeTagging(e.guid);
653
670
  await this.loadTaggings();
654
671
  };
655
672
  updateTag = async (t) => {
656
673
  await this.api.updateTag(t), await this.loadTags();
657
674
  };
658
675
  updateTransaction = async (t) => {
659
- const a = await this.api.updateTransaction(t), e = this.transactions.findIndex((A) => A.guid === t.guid);
660
- e >= 0 && this.setTransactions([
661
- ...this.transactions.slice(0, e),
676
+ const a = await this.api.updateTransaction(t), s = this.transactions.findIndex((A) => A.guid === t.guid);
677
+ s >= 0 && this.setTransactions([
678
+ ...this.transactions.slice(0, s),
662
679
  a,
663
- ...this.transactions.slice(e + 1)
680
+ ...this.transactions.slice(s + 1)
664
681
  ]);
665
682
  };
666
683
  }
@@ -0,0 +1,183 @@
1
+ import { jsxs as u, jsx as l } from "react/jsx-runtime";
2
+ import T from "react";
3
+ import x from "@mui/material/ListItem";
4
+ import S from "@mui/material/ListItemButton";
5
+ import f from "@mui/material/ListItemIcon";
6
+ import R from "@mui/material/ListItemText";
7
+ import h from "@mui/material/Stack";
8
+ import { Text as b } from "@mxenabled/mxui";
9
+ import { makeAutoObservable as A } from "mobx";
10
+ import { addSeconds as N } from "date-fns/addSeconds";
11
+ import { differenceInCalendarMonths as v } from "date-fns/differenceInCalendarMonths";
12
+ import { endOfMonth as D } from "date-fns/endOfMonth";
13
+ import { subMonths as w } from "date-fns/subMonths";
14
+ import { b as I, a as _, c as O } from "./Category-Ccoew_sA.mjs";
15
+ import { f as C, D as L } from "./Dialog-CWymUiuO.mjs";
16
+ const rt = ({
17
+ onClick: e,
18
+ leftIcon: t,
19
+ rightIcon: o,
20
+ title: r,
21
+ subtitle: n,
22
+ rightContent: a,
23
+ titleBold: i = !0,
24
+ rightContentBold: c = !0
25
+ }) => {
26
+ const g = /* @__PURE__ */ u(T.Fragment, { children: [
27
+ t && /* @__PURE__ */ l(f, { sx: { ml: 0 }, children: t }),
28
+ /* @__PURE__ */ l(R, { children: /* @__PURE__ */ u(
29
+ h,
30
+ {
31
+ sx: {
32
+ alignItems: "center",
33
+ flexDirection: "row",
34
+ marginLeft: 12
35
+ },
36
+ children: [
37
+ /* @__PURE__ */ u(h, { sx: { flex: 1, minWidth: 0 }, children: [
38
+ /* @__PURE__ */ l(b, { bold: i, variant: "body1", children: r }),
39
+ n && /* @__PURE__ */ l(b, { variant: "caption", children: n })
40
+ ] }),
41
+ /* @__PURE__ */ u(h, { sx: { flexDirection: "row", alignItems: "center", gap: 1 }, children: [
42
+ a && /* @__PURE__ */ l(b, { bold: c, display: "flex", variant: "body1", children: a }),
43
+ o && /* @__PURE__ */ l(f, { children: o })
44
+ ] })
45
+ ]
46
+ }
47
+ ) })
48
+ ] });
49
+ return /* @__PURE__ */ l(x, { sx: { bgcolor: "background.paper" }, children: e ? /* @__PURE__ */ l(
50
+ S,
51
+ {
52
+ onClick: e,
53
+ sx: {
54
+ py: 14
55
+ },
56
+ children: g
57
+ }
58
+ ) : /* @__PURE__ */ l(
59
+ h,
60
+ {
61
+ sx: {
62
+ py: 14,
63
+ px: 24,
64
+ width: "100%",
65
+ flexDirection: "row",
66
+ alignItems: "center"
67
+ },
68
+ children: g
69
+ }
70
+ ) });
71
+ }, E = (e) => _[e] ?? _.default, G = (e) => O[e];
72
+ function W(e, t) {
73
+ const o = [], r = new Date(e);
74
+ for (; r <= t; ) {
75
+ const n = r.getFullYear(), a = String(r.getMonth() + 1).padStart(2, "0");
76
+ o.push(+`${n}${a}`), r.setMonth(r.getMonth() + 1);
77
+ }
78
+ return o;
79
+ }
80
+ const F = (e) => e.reduce((t, o) => {
81
+ const r = {
82
+ top_level_category_guid: o.top_level_category_guid,
83
+ category_guid: o.category_guid,
84
+ amount: o.total,
85
+ year_month: o.year_month
86
+ }, { top_level_category_guid: n, category_guid: a } = r;
87
+ return t[a] || (t[a] = []), t[a].push(r), n !== a && (t[n] || (t[n] = []), t[n].push(r)), t;
88
+ }, {}), at = (e, t, o) => {
89
+ const r = F(e), n = W(t, o);
90
+ return Object.entries(r).map(([a, i]) => {
91
+ const c = i[0].top_level_category_guid, g = n.map((m) => {
92
+ const s = i.filter((y) => y.year_month === m).reduce((y, M) => y + Math.abs(M.amount), 0), d = Number(String(m).slice(0, 4)), p = Number(String(m).slice(4));
93
+ return { x: new Date(d, p - 1), y: s };
94
+ }).sort((m, s) => m.x.getTime() - s.x.getTime());
95
+ return {
96
+ top_level_category_guid: c,
97
+ category_guid: a,
98
+ category_name: G(a),
99
+ category_color: E(c),
100
+ dataset: g
101
+ };
102
+ });
103
+ }, nt = (e, t) => {
104
+ const o = typeof e == "string" ? parseFloat(e.replace(/[^0-9.-]+/g, "")) : e, r = typeof t == "string" ? parseFloat(t.replace(/[^0-9.-]+/g, "")) : t;
105
+ return (o || 0) - (r || 0);
106
+ }, st = (e, t) => e.indexOf("General") >= 0 ? 1 : e.localeCompare(t), $ = (e, t) => {
107
+ const o = e.subCategories.filter((a) => a.currentAmount !== 0), r = e.totalMonthlyAmounts.slice(-t), n = (a) => a.substring(0, 3) + " " + a.slice(-4);
108
+ return r.map((a) => {
109
+ const i = n(a.label), c = o.map((s) => {
110
+ const d = s.monthlyAmounts.slice(-t).find((p) => n(p.label) === i);
111
+ return {
112
+ label: s.name,
113
+ amount: Math.abs(d?.amount || 0),
114
+ header: i
115
+ };
116
+ }), g = e.monthlyAmounts.slice(-t).find((s) => n(s.label) === i);
117
+ return [{
118
+ label: e.name,
119
+ amount: Math.abs(g?.amount || 0),
120
+ header: i
121
+ }, ...c].sort((s, d) => d.amount - s.amount);
122
+ });
123
+ }, j = (e, t) => {
124
+ const o = e ? e.totalMonthlyAmounts.slice(-t).map((n) => ({
125
+ x: n.label.substring(0, 3),
126
+ y: Math.abs(n.amount)
127
+ })) : [], r = e ? $(e, t) : [];
128
+ return { monthlyAmounts: o, tooltipLabels: r };
129
+ }, k = (e) => e.slice().filter(
130
+ (t) => t.totalAmount !== 0 && !t.isTransfer && t.guid !== I.INVESTMENTS
131
+ ).sort((t, o) => Math.abs(o.totalAmount) - Math.abs(t.totalAmount));
132
+ class it {
133
+ globalStore;
134
+ selectedCategoryData = null;
135
+ selectedDateRange;
136
+ visibleListLength = 5;
137
+ constructor(t) {
138
+ this.globalStore = t, this.selectedDateRange = {
139
+ start: N(D(w(/* @__PURE__ */ new Date(), 6)), 1),
140
+ end: D(/* @__PURE__ */ new Date())
141
+ }, A(this);
142
+ }
143
+ setSelectedCategoryData = (t) => {
144
+ this.selectedCategoryData = t;
145
+ };
146
+ setSelectedDateRange = (t) => {
147
+ this.selectedDateRange = t;
148
+ };
149
+ setVisibleListLength = (t) => {
150
+ this.visibleListLength = t;
151
+ };
152
+ get sortedDetailedCategoriesWithTransactions() {
153
+ return k(
154
+ this.globalStore.categoryStore.detailedCategoriesWithTransactions
155
+ );
156
+ }
157
+ get selectedDateRangeMonthCount() {
158
+ return v(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
159
+ }
160
+ get selectedDateRangeMonthRange() {
161
+ const t = C(this.selectedDateRange.start, L.MONTH_LONG), o = C(this.selectedDateRange.end, L.MONTH_LONG);
162
+ return `${t} - ${o}`;
163
+ }
164
+ get visibleCategories() {
165
+ return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
166
+ }
167
+ get collapsedCategories() {
168
+ return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
169
+ }
170
+ get categoryDetailsChartData() {
171
+ return j(
172
+ this.selectedCategoryData,
173
+ this.selectedDateRangeMonthCount
174
+ );
175
+ }
176
+ }
177
+ export {
178
+ rt as L,
179
+ it as T,
180
+ nt as a,
181
+ st as c,
182
+ at as g
183
+ };