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

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 (104) hide show
  1. package/CHANGELOG.md +71 -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-DZ10CbWd.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-C1oyQCZK.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-7bVS7KXf.mjs → exportTransactionsToCSV-B8qpk5MU.mjs} +14 -13
  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 +282 -281
  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 +4 -4
  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/useAriaLive-B3_pRUio.mjs +0 -35
@@ -1,6 +1,6 @@
1
1
  import s from "react";
2
- import { g as e } from "./ConnectDrawer-BQNs-hjk.mjs";
3
- import { a as n } from "./hooks-D6XlXHf4.mjs";
2
+ import { g as e } from "./ConnectDrawer-CbxHKlRv.mjs";
3
+ import { a as n } from "./hooks-Cy8JnjCg.mjs";
4
4
  const i = (o) => {
5
5
  const { config: a } = n();
6
6
  return s.useMemo(
@@ -1,6 +1,6 @@
1
1
  import { getUnixTime as l } from "date-fns/getUnixTime";
2
2
  import A from "bowser";
3
- import { F as u, A as r } from "./Fetch-87LIQbEA.mjs";
3
+ import { F as u, A as r } from "./Fetch-DecPFeGU.mjs";
4
4
  import y from "react";
5
5
  const g = async (o, t, n = "1.0.0", s = "Experiences") => {
6
6
  const a = new _(o, t), { analytics_session: i } = await a.initializeAnalyticsSession(
@@ -1,5 +1,5 @@
1
1
  import { useState as n, useEffect as a } from "react";
2
- import { f as o } from "./hooks-D6XlXHf4.mjs";
2
+ import { f as o } from "./hooks-Cy8JnjCg.mjs";
3
3
  const f = () => {
4
4
  const { isInitialized: e, appDataStore: t } = o(), [s, i] = n(!1);
5
5
  return a(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mx-cartographer/experiences",
3
- "version": "7.3.0-alpha.sms1",
3
+ "version": "7.3.0",
4
4
  "description": "Library containing experience widgets",
5
5
  "author": "MX",
6
6
  "license": "MIT",
@@ -186,7 +186,7 @@
186
186
  "@mui/x-date-pickers-pro": "^7.29.4",
187
187
  "@mxenabled/cssinjs": "^0.6.0",
188
188
  "@mxenabled/mx-icons": "^1.5.1",
189
- "@mxenabled/mxui": "^1.5.8",
189
+ "@mxenabled/mxui": "^1.5.6",
190
190
  "@mxenabled/web-widget-sdk": "^0.0.13",
191
191
  "@tanstack/react-virtual": "^3.13.2",
192
192
  "bowser": "^2.11.0",
@@ -252,7 +252,7 @@
252
252
  "storybook-dark-mode": "4.0.1",
253
253
  "typescript": "^5.8.2",
254
254
  "vi-canvas-mock": "^1.0.0",
255
- "vite": "^5.4.21",
255
+ "vite": "^5.4.19",
256
256
  "vite-plugin-dts": "^4.5.3",
257
257
  "vite-tsconfig-paths": "^5.1.4",
258
258
  "vitest": "^3.0.8"
@@ -272,5 +272,5 @@
272
272
  "CHANGELOG.md",
273
273
  "README.md"
274
274
  ],
275
- "packageManager": "yarn@4.11.0"
275
+ "packageManager": "yarn@4.9.2"
276
276
  }
@@ -1,120 +0,0 @@
1
- import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
- import { observer as p } from "mobx-react-lite";
3
- import d from "@mui/material/Stack";
4
- import { H3 as w, InstitutionLogo as I, Text as m, H2 as L } from "@mxenabled/mxui";
5
- import { g as v } from "./AccountFields-C9FlatNb.mjs";
6
- import h from "react";
7
- import { G as E, d as y, m as S, u as _, f as G } from "./hooks-D6XlXHf4.mjs";
8
- import O from "@mui/material/Card";
9
- import P from "@mui/material/CardContent";
10
- import M from "@mui/material/CardHeader";
11
- import { useTheme as B } from "@mui/material/styles";
12
- import { g as H, a as U, b as j } from "./SpendingData-D5vsfYKo.mjs";
13
- import { L as z } from "./LineChart-D4GI7nVh.mjs";
14
- import { I as f, P as g, S as C } from "./Account-Bxw0_4FU.mjs";
15
- import { A } from "./ConnectDrawer-BQNs-hjk.mjs";
16
- import { L as Y } from "./Loader-DUaFpDGv.mjs";
17
- import { f as R, D as $ } from "./Dialog-CWW597AF.mjs";
18
- import { u as k } from "./useAccountDisplayName-BUAApBIb.mjs";
19
- import { f as F } from "./NumberFormatting-Buh7u8Oi.mjs";
20
- const b = () => {
21
- if (!h.useContext(E))
22
- throw new Error("useCategoryUiStore() must be used within the GlobalDataContext");
23
- return y().uiStore;
24
- }, V = (o, n) => {
25
- const t = f.includes(n) ? H(o) : [], a = g.includes(n) ? U(o) : [], r = C.includes(n) ? j(o) : [];
26
- return [t, a, r].filter((s) => s.length > 0);
27
- }, W = (o, n, t) => {
28
- const [a, r] = o, s = a, c = r ?? a, i = [];
29
- if (s && c && f.includes(n)) {
30
- const l = s[s.length - 1].y;
31
- i.push({ label: t.income_label, amount: l });
32
- } else if (g.includes(n)) {
33
- const l = s[s.length - 1].y;
34
- i.push({ label: t.payments_label, amount: l });
35
- }
36
- if (c && C.includes(n)) {
37
- const l = c[c.length - 1].y;
38
- i.push({ label: t.spending_label, amount: l });
39
- }
40
- return i;
41
- }, q = () => {
42
- const o = B(), { selectedAccount: n } = b(), { monthlyCategoryTotals: t } = S(), { trends: a } = _(), r = [o.palette.chart?.chart1, o.palette.chart?.chart2], s = V(t, n.account_type), c = W(s, n.account_type, a), i = [A.LOAN, A.MORTGAGE].includes(n.account_type);
43
- return /* @__PURE__ */ e("div", { "data-testid": "TrendsChart", children: /* @__PURE__ */ e(
44
- z,
45
- {
46
- colors: r,
47
- datasets: s,
48
- height: 185,
49
- labels: c,
50
- showAverage: i,
51
- showBars: i,
52
- showLegend: !0,
53
- valueFormatterString: "0,0"
54
- }
55
- ) });
56
- }, J = p(q), K = ({ sx: o }) => {
57
- const { loadMonthlyCategoryTotals: n } = S(), { isInitialized: t } = G(), { selectedAccount: a } = b(), [r, s] = h.useState(!1);
58
- return h.useEffect(() => {
59
- t && n([a]).finally(() => {
60
- s(!0);
61
- });
62
- }, [t, a]), !t || !r ? /* @__PURE__ */ e(Y, {}) : /* @__PURE__ */ u(
63
- O,
64
- {
65
- sx: {
66
- "& .MuiCardContent-root:last-child": {
67
- pb: 0
68
- },
69
- ...o
70
- },
71
- children: [
72
- /* @__PURE__ */ e(
73
- M,
74
- {
75
- sx: { pb: 0 },
76
- title: /* @__PURE__ */ e(w, { sx: { pb: 4 }, children: R(/* @__PURE__ */ new Date(), $.MONTH_LONG) })
77
- }
78
- ),
79
- /* @__PURE__ */ e(P, { sx: { p: 0 }, children: /* @__PURE__ */ e(J, {}) })
80
- ]
81
- }
82
- );
83
- }, Q = p(K), X = ({ customDetailsChart: o }) => {
84
- const { institutions: n } = y(), { selectedAccount: t } = b(), { accounts: a } = _(), { firstSubtitle: r, firstValue: s, hasAvailableBalance: c, secondSubtitle: i, secondValue: l } = v(t, a), T = n.find(
85
- (N) => N.guid === t?.institution_guid
86
- ), D = [
87
- ...f,
88
- ...g,
89
- ...C
90
- ].includes(t.account_type), x = k(t);
91
- return /* @__PURE__ */ u(d, { bgcolor: "background.default", p: 24, children: [
92
- /* @__PURE__ */ u(d, { gap: 12, children: [
93
- /* @__PURE__ */ e(
94
- I,
95
- {
96
- alt: a.institution_logo_alt,
97
- institutionGuid: t.institution_guid || "",
98
- size: 64
99
- }
100
- ),
101
- /* @__PURE__ */ e(m, { variant: "Small", children: T?.name })
102
- ] }),
103
- /* @__PURE__ */ u(d, { gap: 8, mb: 24, mt: 4, children: [
104
- /* @__PURE__ */ e(L, { children: x }),
105
- /* @__PURE__ */ u(d, { direction: "row", justifyContent: "space-between", children: [
106
- /* @__PURE__ */ e(m, { bold: c, variant: "Body", children: r }),
107
- /* @__PURE__ */ e(m, { bold: !0, variant: "Body", children: F(s, "0,0.00") })
108
- ] }),
109
- /* @__PURE__ */ u(d, { direction: "row", justifyContent: "space-between", children: [
110
- /* @__PURE__ */ e(m, { variant: "Small", children: i }),
111
- /* @__PURE__ */ e(m, { variant: "Small", children: l })
112
- ] })
113
- ] }),
114
- D && /* @__PURE__ */ e(d, { children: o || /* @__PURE__ */ e(Q, {}) })
115
- ] });
116
- }, bt = p(X);
117
- export {
118
- bt as A,
119
- b as u
120
- };
@@ -1,27 +0,0 @@
1
- import { A as e, C as u, E as r, c as p, M as y } from "./ConnectDrawer-BQNs-hjk.mjs";
2
- const l = (t) => t && (t.account_type === e.CREDIT_CARD || t.account_type === e.LOAN || t.account_type === e.MORTGAGE || t.account_type === e.LINE_OF_CREDIT || t.account_type === e.CHECKING_LINE_OF_CREDIT), I = (t) => t.is_manual || !t.guid, R = (t) => t.account_type === e.LINE_OF_CREDIT || t.account_type === e.CREDIT_CARD || t.account_type === e.CHECKING_LINE_OF_CREDIT, f = (t) => t.account_type === e.SAVINGS || t.account_type === e.CHECKING || t.account_type === e.LINE_OF_CREDIT || t.account_type === e.CREDIT_CARD || t.account_type === e.LOAN || t.account_type === e.MORTGAGE, m = (t) => t.account_type === e.LOAN || t.account_type === e.MORTGAGE, A = (t, n, s, _) => t.filter((i) => !(i.member_is_managed_by_user && _)).sort(d).map((i) => {
3
- const c = n.find((a) => a.guid === i.institution_guid), o = s.find((a) => a.guid === i.member_guid);
4
- return E(i, c, o);
5
- }), E = (t, n, s) => {
6
- let _ = u.Connected;
7
- s && (r.includes(s.connection_status) ? _ = u.Error : p.includes(s.connection_status) ? _ = u.Processing : y.includes(s.connection_status) && (_ = u.RequiresMfa));
8
- const i = [
9
- t.user_name || t.feed_name || "",
10
- t.account_number ? `*${t.account_number}` : ""
11
- ].join(" ").trim();
12
- return {
13
- ...t,
14
- connectionStatus: _,
15
- displayName: i,
16
- institution: n,
17
- member: s
18
- };
19
- }, d = (t, n) => t.account_type > n.account_type ? 1 : t.account_type < n.account_type ? -1 : (t.name || "") > (n.name || "") ? 1 : (t.name || "") < (n.name || "") ? -1 : 0;
20
- export {
21
- l as a,
22
- R as b,
23
- m as c,
24
- A as d,
25
- I as i,
26
- f as u
27
- };
@@ -1,174 +0,0 @@
1
- import { makeAutoObservable as g } from "mobx";
2
- import { getUnixTime as n } from "date-fns/getUnixTime";
3
- import { subMonths as d } from "date-fns/subMonths";
4
- import { startOfMonth as y } from "date-fns/startOfMonth";
5
- import { endOfMonth as u } from "date-fns/endOfMonth";
6
- import { a as C, g as T } from "./CategoryUtil-pZRIYOgN.mjs";
7
- import { F as m, A as r } from "./Fetch-87LIQbEA.mjs";
8
- import { b as p, c as f } from "./Category-CevNQ03n.mjs";
9
- class c {
10
- fetchInstance;
11
- constructor(t, e, a) {
12
- this.fetchInstance = new m(t, e, void 0, a);
13
- }
14
- addCategory = async (t) => this.fetchInstance.post(r.CATEGORIES, t).then((e) => e.category);
15
- getCategories = async () => this.fetchInstance.get(r.CATEGORIES).then((t) => t.categories);
16
- getDateRangeCategoryTotals = async (t, e, a) => a.length === 0 ? [] : this.fetchInstance.post(`${r.DATE_RANGE_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
17
- account_guid: a.map((o) => o.guid)
18
- }).then((o) => o.date_range_category_totals);
19
- getMonthlyCategoryTotals = async (t, e, a) => {
20
- try {
21
- const o = `${r.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`;
22
- if (a) {
23
- const s = a.length === 0 ? [""] : a.map((h) => h.guid);
24
- return (await this.fetchInstance.post(o, { account_guid: s })).monthly_category_totals;
25
- } else
26
- return (await this.fetchInstance.get(o)).monthly_category_totals;
27
- } catch (o) {
28
- throw console.error("Error fetching monthly category totals:", o), o;
29
- }
30
- };
31
- removeCategory = async (t) => this.fetchInstance.delete(`${r.CATEGORIES}/${t}`);
32
- updateCategory = async (t) => this.fetchInstance.put(`${r.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
- g(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 L {
58
- globalStore;
59
- uiStore;
60
- api = new c("/", "");
61
- categories = [];
62
- categoriesLoaded = !1;
63
- dateRangeCategoryTotals = [];
64
- monthlyCategoryTotals = [];
65
- dataRangeTotalsLoaded = !1;
66
- isLoadingCategoryTotals = !1;
67
- monthlyTotalsLoaded = !1;
68
- constructor(t) {
69
- this.globalStore = t, this.uiStore = new w(), this.api = new c(t.endpoint, t.sessionToken, t.onError), g(this);
70
- }
71
- get detailedCategories() {
72
- return C(
73
- this.categories,
74
- this.globalStore.copyStore.copy.categories,
75
- this.dateRangeCategoryTotals,
76
- this.monthlyCategoryTotals
77
- );
78
- }
79
- get detailedCategoriesWithTransactions() {
80
- return T(
81
- this.detailedCategories,
82
- this.globalStore.transactionStore.sortedTransactions
83
- );
84
- }
85
- get incomeCategories() {
86
- return this.detailedCategories.filter((t) => t.is_income);
87
- }
88
- get spendCategories() {
89
- return this.detailedCategories.filter(
90
- (t) => !t.is_income && !t.isTransfer && t.guid !== p.INVESTMENTS
91
- );
92
- }
93
- get transferCategories() {
94
- return this.detailedCategories.filter((t) => t.isTransfer);
95
- }
96
- setCategories = (t) => {
97
- this.categories = t, this.categoriesLoaded = !0;
98
- };
99
- setMonthlyCategoryTotals = (t) => {
100
- this.monthlyCategoryTotals = t, this.monthlyTotalsLoaded = !0;
101
- };
102
- setDateRangeCategoryTotals = (t) => {
103
- this.dateRangeCategoryTotals = t, this.dataRangeTotalsLoaded = !0;
104
- };
105
- addCategory = async (t, e) => {
106
- const a = { name: t, parent_guid: e };
107
- try {
108
- await this.api.addCategory(a), await this.loadCategories();
109
- } catch (o) {
110
- console.error(`Error occurred while adding category: ${o}`);
111
- }
112
- };
113
- loadCategories = async () => {
114
- try {
115
- const t = await this.api.getCategories();
116
- this.setCategories(t);
117
- } catch (t) {
118
- console.error(`Error occurred while getting categories: ${t}`);
119
- }
120
- };
121
- loadDateRangeCategoryTotals = async (t, e, a) => {
122
- this.setIsLoadingCategoryTotals(!0);
123
- try {
124
- const o = await this.api.getDateRangeCategoryTotals(
125
- n(e),
126
- n(a),
127
- t
128
- );
129
- this.setDateRangeCategoryTotals(o), this.setIsLoadingCategoryTotals(!1);
130
- } catch (o) {
131
- this.setIsLoadingCategoryTotals(!1), console.error(`Error occurred while getting date range category totals: ${o}`);
132
- }
133
- };
134
- loadMonthlyCategoryTotals = async (t = this.globalStore.globalUiStore.selectedAccounts, e, a) => {
135
- const o = n(y(e ?? d(/* @__PURE__ */ new Date(), 11))), s = n(u(a ?? /* @__PURE__ */ new Date()));
136
- try {
137
- const i = await this.api.getMonthlyCategoryTotals(o, s, t);
138
- this.setMonthlyCategoryTotals(i);
139
- } catch (i) {
140
- console.error(`Error occurred while getting monthly category totals: ${i}`);
141
- }
142
- };
143
- reloadCategoryTotals = async (t, e, a) => {
144
- this.setIsLoadingCategoryTotals(!0);
145
- try {
146
- await this.loadMonthlyCategoryTotals(t, e, a), await this.loadDateRangeCategoryTotals(t, e, a);
147
- } catch (o) {
148
- console.error(`Error occurred while getting category totals: ${o}`);
149
- }
150
- };
151
- removeCategory = async (t) => {
152
- try {
153
- await this.api.removeCategory(t), await this.loadCategories();
154
- } catch (e) {
155
- console.error(`Error occurred while removing category: ${e}`);
156
- }
157
- };
158
- setIsLoadingCategoryTotals = (t) => {
159
- this.isLoadingCategoryTotals = t;
160
- };
161
- updateCategory = async (t) => {
162
- try {
163
- await this.api.updateCategory(t), await this.loadCategories();
164
- } catch (e) {
165
- console.error(`Error occurred while updating category: ${e}`);
166
- }
167
- };
168
- // TODO: Remove this after refactoring Trends components to use detailedCategories
169
- getCategoryName = (t) => this.categories.find((a) => a.guid === t)?.name ?? f[t];
170
- }
171
- export {
172
- L as C,
173
- c as a
174
- };
@@ -1,80 +0,0 @@
1
- import { format as d } from "date-fns/format";
2
- import { startOfMonth as T } from "date-fns/startOfMonth";
3
- import { startOfToday as C } from "date-fns/startOfToday";
4
- import { subMonths as N } from "date-fns/subMonths";
5
- import { CategoryIconList as O } from "@mxenabled/mxui";
6
- import { C as b, a as D, b as E } from "./Category-CevNQ03n.mjs";
7
- import { f as R, D as v } from "./Dialog-CWW597AF.mjs";
8
- const H = 3, f = 12, k = (t, o, e, r) => t.filter((n) => !n.parent_guid).map(
9
- (n) => p(
10
- n,
11
- o,
12
- e,
13
- r,
14
- t.filter((s) => s.parent_guid === n.guid)
15
- )
16
- ), z = (t, o) => {
17
- const e = O.find((r) => r.guid === t);
18
- return e ? o.palette.categories[e.colorName] || "" : o.palette.categories.uncategorized || "";
19
- }, p = (t, o, e, r, n = []) => {
20
- const s = t.guid, i = t.parent_guid || s, u = s === i, c = e.find((a) => a.category_guid === s)?.total || 0, m = y(
21
- r.filter((a) => a.category_guid === s)
22
- ), g = y(
23
- r.filter(
24
- (a) => a.category_guid === s || a.top_level_category_guid === s
25
- )
26
- ), l = n.map(
27
- (a) => p(a, o, e, r)
28
- ), A = l.reduce(
29
- (a, M) => a + M.currentAmount,
30
- c
31
- ), h = o.default_categories[t.guid] ? o.default_categories[t.guid].replace(/&amp;/g, "&") : t.name;
32
- return {
33
- ...t,
34
- currentAmount: c,
35
- averageAmount: _(m),
36
- color: b[i],
37
- icon: D[i],
38
- isTransfer: i === E.TRANSFER,
39
- monthlyAmounts: m,
40
- name: h,
41
- subCategories: l,
42
- totalAmount: u ? A : 0,
43
- totalAverageAmount: _(g),
44
- totalMonthlyAmounts: u ? g : []
45
- };
46
- }, B = (t, o) => t.map((e) => {
47
- const r = o.filter(
48
- (n) => n.category_guid === e.guid || n.top_level_category_guid === e.guid
49
- );
50
- return {
51
- ...e,
52
- transactions: r
53
- };
54
- }), _ = (t, o = H) => {
55
- const e = o > history.length ? history.length : o;
56
- return Math.ceil(
57
- Math.max(
58
- 0,
59
- t.slice(-e).reduce((r, n) => r + n.amount, 0) / e
60
- )
61
- );
62
- }, y = (t) => {
63
- const o = [], e = C();
64
- for (let r = 0; r <= f; r++) {
65
- const n = T(N(e, f - r)), i = t.filter(
66
- (u) => u.year_month === Number(d(n, "yyyyMM"))
67
- ).reduce((u, c) => u + c.total, 0);
68
- o.push({
69
- amount: i,
70
- isoDate: d(n, "yyyy-MM-dd"),
71
- label: R(n, v.MONTH_YEAR)
72
- });
73
- }
74
- return o;
75
- };
76
- export {
77
- k as a,
78
- z as b,
79
- B as g
80
- };
@@ -1,86 +0,0 @@
1
- import { F as T, A as e } from "./Fetch-87LIQbEA.mjs";
2
- class u {
3
- fetchInstance;
4
- constructor(t, n, a) {
5
- this.fetchInstance = new T(t, n, void 0, a);
6
- }
7
- addTag = async (t) => this.fetchInstance.post(e.TAGS, t).then((n) => n.tag);
8
- addTagging = async (t) => this.fetchInstance.post(e.TAGGINGS, t).then((n) => n.tagging);
9
- addTransaction = async (t) => this.fetchInstance.post(e.TRANSACTIONS, t).then((n) => n.transaction);
10
- addTransactionRule = async (t) => this.fetchInstance.post(e.TRANSACTION_RULES, t).then((n) => n);
11
- getTaggings = async () => this.fetchInstance.get(e.TAGGINGS).then((t) => t.map((n) => n.tagging));
12
- getTags = async () => this.fetchInstance.get(e.TAGS).then((t) => t.map((n) => n.tag));
13
- getTransactionRules = async () => this.fetchInstance.get(e.TRANSACTION_RULES).then((t) => t.transaction_rules);
14
- getTransactionsByDateRange = async (t, n) => this.fetchInstance.get(`${e.TRANSACTIONS}/by_date/${t}/${n}`).then((a) => a.map((s) => s.transaction));
15
- // DEPRECATED
16
- getTransactionsByAccountsAndDateRange = async (t, n, a) => {
17
- console.warn("DEPRECATED: getTransactionsByAccountsAndDateRange will be removed");
18
- const s = t.reduce(
19
- (o, c, r) => `${o}account_guids[]=${c}${r !== t.length - 1 ? "&" : ""}`,
20
- ""
21
- );
22
- return this.fetchInstance.get(`${e.TRANSACTIONS}/by_date/${n}/${a}?${s}`).then((o) => o.map((c) => c.transaction));
23
- };
24
- // DEPRECATED
25
- getTransactionsByGuids = async (t) => (console.warn("DEPRECATED: getTransactionsByGuids will be removed"), this.fetchInstance.post(`${e.TRANSACTIONS}/by_guids`, { guids: t.join("+") }).then((n) => n.map((a) => a.transaction)));
26
- // DEPRECATED
27
- getTransactionsByCategoryAndDate = async (t, n, a) => (console.warn("DEPRECATED: getTransactionsByCategoryAndDate will be removed"), this.fetchInstance.get(
28
- `${e.TRANSACTIONS}/by_category_guid/${t}/by_date/${n}/${a}`
29
- ).then((s) => s.map((o) => o.transaction)));
30
- // DEPRECATED
31
- getTransactionsByCategoryDateAndAccounts = async (t, n, a, s) => {
32
- console.warn("DEPRECATED: getTransactionsByCategoryDateAndAccounts will be removed");
33
- const o = s.reduce(
34
- (c, r, i) => `${c}account_guids[]=${r}${i !== s.length - 1 ? "&" : ""}`,
35
- ""
36
- );
37
- return this.fetchInstance.get(
38
- `${e.TRANSACTIONS}/by_category_guid/${t}/by_date/${n}/${a}?${o}`
39
- ).then((c) => c.map((r) => r.transaction));
40
- };
41
- // DEPRECATED
42
- getTransactionsByCategoriesDateAndAccounts = async (t, n, a, s) => {
43
- console.warn("DEPRECATED: getTransactionsByCategoriesDateAndAccounts will be removed");
44
- const o = s.reduce(
45
- (c, r, i) => `${c}account_guids[]=${r}${i !== s.length - 1 ? "&" : ""}`,
46
- ""
47
- );
48
- return this.fetchInstance.get(
49
- `${e.TRANSACTIONS}/by_category_guids/${t.join(
50
- "+"
51
- )}/by_date/${n}/${a}?${o}`
52
- ).then((c) => c.map((r) => r.transaction));
53
- };
54
- /**
55
- * DEPRECATED
56
- * Get all transactions by the top level category, between begin date and end date, and optionally
57
- * filtered by accounts
58
- * @param categoryGuid The top level category guid
59
- * @param beginDate the start date
60
- * @param endDate the end date
61
- * @param accountGuids an optional list of account guids
62
- */
63
- getTransactionsByTopLevelCategoryAndDate = async (t, n, a, s = []) => {
64
- console.warn("DEPRECATED: getTransactionsByTopLevelCategoryAndDate will be removed");
65
- let o = `${e.TRANSACTIONS}/by_top_level_category_guid/${t}/by_date/${n}/${a}`;
66
- if (s.length > 0) {
67
- const c = s.reduce(
68
- (r, i, g) => `${r}account_guids[]=${i}${g !== s.length - 1 ? "&" : ""}`,
69
- ""
70
- );
71
- o += `?${c}`;
72
- }
73
- return this.fetchInstance.get(o).then((c) => c.map((r) => r.transaction));
74
- };
75
- removeTag = async (t) => this.fetchInstance.delete(`${e.TAGS}/${t}`).then((n) => n);
76
- removeTagging = async (t) => this.fetchInstance.delete(`${e.TAGGINGS}/${t}`).then((n) => n);
77
- removeTransaction = async (t) => this.fetchInstance.delete(`${e.TRANSACTIONS}/${t}`).then((n) => n);
78
- removeTransactionRule = async (t) => this.fetchInstance.delete(`${e.TRANSACTION_RULES}/${t}`);
79
- removeTransactionSplit = async (t) => this.fetchInstance.delete(`${e.TRANSACTIONS}/${t}/unsplit`).then((n) => n);
80
- updateTransactionRule = async (t) => this.fetchInstance.put(`${e.TRANSACTION_RULES}/${t.guid}`, t).then((n) => n);
81
- updateTag = async (t) => this.fetchInstance.put(`${e.TAGS}/${t.guid}`, t).then((n) => n.tag);
82
- updateTransaction = async (t) => this.fetchInstance.put(`${e.TRANSACTIONS}/${t.guid}`, t).then((n) => n.transaction);
83
- }
84
- export {
85
- u as T
86
- };