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

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 (62) hide show
  1. package/dist/{Account-vp_TAbGt.mjs → Account-Bxw0_4FU.mjs} +1 -1
  2. package/dist/{AccountDetailsContent-Vj4LO6cx.mjs → AccountDetailsContent-CAM9y39M.mjs} +6 -6
  3. package/dist/{AccountDetailsHeader-Df1JkzYi.mjs → AccountDetailsHeader-JtSX6Uf9.mjs} +4 -4
  4. package/dist/{AccountFields-DUToRRqW.mjs → AccountFields-C9FlatNb.mjs} +2 -2
  5. package/dist/{AccountListItem-CeY_WIpj.mjs → AccountListItem-JFMZROh7.mjs} +7 -7
  6. package/dist/{AccountStore-BkoLK9Tq.mjs → AccountStore-BgNOyMdp.mjs} +74 -100
  7. package/dist/Accounts-BRf_YeTf.mjs +27 -0
  8. package/dist/CategoryStore-yHI0hWmK.mjs +174 -0
  9. package/dist/CategoryUtil-pZRIYOgN.mjs +80 -0
  10. package/dist/{ConnectDrawer-Bw5s6Dw1.mjs → ConnectDrawer-BQNs-hjk.mjs} +9 -9
  11. package/dist/{ConnectionsDrawer-BDvVuJQf.mjs → ConnectionsDrawer-ByGQE7D5.mjs} +3 -3
  12. package/dist/{DebtsStore-BD_XwsI7.mjs → DebtsStore-C9bblOgW.mjs} +1 -1
  13. package/dist/{GoalStore-DZ_Jvsa_.mjs → GoalStore-D-aB35SY.mjs} +151 -111
  14. package/dist/{ManageIncome-B9yGuahc.mjs → ManageIncome-1s_q5W4X.mjs} +3 -3
  15. package/dist/{NetWorthStore-D1NiDUcc.mjs → NetWorthStore-DCsTZpuS.mjs} +2 -2
  16. package/dist/{NotificationStore-C6PH6MKm.mjs → NotificationStore-BxP_P2dA.mjs} +23 -15
  17. package/dist/{RecurringSettings-D9GFcsXV.mjs → RecurringSettings-A_rAGCTP.mjs} +3 -3
  18. package/dist/{RecurringTransactions-ej39mgA6.mjs → RecurringTransactions-DK8dWldr.mjs} +3 -3
  19. package/dist/{RecurringTransactionsStore-DrzS1LmF.mjs → RecurringTransactionsStore-C4YOD7_D.mjs} +29 -26
  20. package/dist/{TransactionDetails-BqCr2FTh.mjs → TransactionDetails-oP1eSuiS.mjs} +43 -43
  21. package/dist/TransactionStore-ai3uII_r.mjs +690 -0
  22. package/dist/{WidgetContainer-EbrN1oIo.mjs → WidgetContainer-BHWANqT4.mjs} +1 -1
  23. package/dist/accounts/index.es.js +29 -29
  24. package/dist/accounts/stores/AccountStore.d.ts +25 -22
  25. package/dist/accounts/utils/Accounts.d.ts +2 -1
  26. package/dist/budgets/index.es.js +4 -4
  27. package/dist/budgets/store/BudgetsStore.d.ts +1 -0
  28. package/dist/cashflow/index.es.js +6 -6
  29. package/dist/categories/index.es.js +1 -1
  30. package/dist/categories/stores/CategoryStore.d.ts +5 -1
  31. package/dist/categories/util/CategoryUtil.d.ts +3 -2
  32. package/dist/common/index.es.js +206 -219
  33. package/dist/common/stores/AppDataStore.d.ts +3 -1
  34. package/dist/common/stores/GlobalCopyStore.d.ts +0 -1
  35. package/dist/common/stores/GlobalStore.d.ts +3 -6
  36. package/dist/common/stores/UserStore.d.ts +3 -2
  37. package/dist/common/types/Account.d.ts +9 -6
  38. package/dist/dashboard/index.es.js +1 -1
  39. package/dist/debts/index.es.js +5 -5
  40. package/dist/finstrong/index.es.js +4 -4
  41. package/dist/goals/index.es.js +7 -7
  42. package/dist/goals/stores/GoalStore.d.ts +17 -4
  43. package/dist/help/index.es.js +1 -1
  44. package/dist/investments/index.es.js +2 -2
  45. package/dist/investments/stores/HoldingStore.d.ts +1 -0
  46. package/dist/networth/index.es.js +4 -4
  47. package/dist/notifications/index.es.js +2 -2
  48. package/dist/notifications/stores/NotificationStore.d.ts +3 -1
  49. package/dist/recurringtransactions/index.es.js +8 -8
  50. package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +3 -2
  51. package/dist/settings/index.es.js +1 -1
  52. package/dist/spending/index.es.js +3 -3
  53. package/dist/transactions/components/shared/transactiondetails/actions/DateAction.d.ts +2 -2
  54. package/dist/transactions/index.es.js +6 -6
  55. package/dist/transactions/stores/TransactionStore.d.ts +21 -77
  56. package/dist/trends/index.es.js +4 -4
  57. package/dist/{useAccountDisplayName-jS05A6-6.mjs → useAccountDisplayName-BUAApBIb.mjs} +1 -1
  58. package/package.json +4 -4
  59. package/dist/Accounts-C1QxUB-e.mjs +0 -9
  60. package/dist/CategoryStore-BCcpI3oJ.mjs +0 -183
  61. package/dist/CategoryUtil-BR3H5i6n.mjs +0 -78
  62. package/dist/TransactionStore-RGu9PZK8.mjs +0 -677
@@ -1,4 +1,4 @@
1
- import { A as C } from "./ConnectDrawer-Bw5s6Dw1.mjs";
1
+ import { A as C } from "./ConnectDrawer-BQNs-hjk.mjs";
2
2
  const I = [
3
3
  C.ANY,
4
4
  C.CASH,
@@ -11,10 +11,10 @@ import M from "@mui/material/Divider";
11
11
  import v from "@mui/material/ListItem";
12
12
  import N from "@mui/material/ListItemButton";
13
13
  import w from "@mui/material/ListItemText";
14
- import { u as D } from "./AccountDetailsHeader-Df1JkzYi.mjs";
14
+ import { u as D } from "./AccountDetailsHeader-JtSX6Uf9.mjs";
15
15
  import { d as z, u as E, g as O, h as X } from "./hooks-D6XlXHf4.mjs";
16
- import { A as at } from "./AccountListItem-CeY_WIpj.mjs";
17
- import { A as k } from "./WidgetContainer-EbrN1oIo.mjs";
16
+ import { A as at } from "./AccountListItem-JFMZROh7.mjs";
17
+ import { A as k } from "./WidgetContainer-BHWANqT4.mjs";
18
18
  import { a as V, f as B, D as K } from "./Dialog-CWW597AF.mjs";
19
19
  import { b as h } from "./Localization-2MODESHW.mjs";
20
20
  import { D as J } from "./Drawer-kEE73B87.mjs";
@@ -22,7 +22,7 @@ import P from "@mui/material/ListItemAvatar";
22
22
  import ct from "@mui/material/Stack";
23
23
  import st from "@mui/material/styles/useTheme";
24
24
  import { Error as q, CheckCircle as it, Language as rt } from "@mxenabled/mx-icons";
25
- import { n as m, N as Q, l as Z, F as R } from "./ConnectDrawer-Bw5s6Dw1.mjs";
25
+ import { n as m, N as Q, l as Z, F as R } from "./ConnectDrawer-BQNs-hjk.mjs";
26
26
  import { fromUnixTime as lt } from "date-fns/fromUnixTime";
27
27
  import { isToday as dt } from "date-fns/isToday";
28
28
  import { isYesterday as ut } from "date-fns/isYesterday";
@@ -38,13 +38,13 @@ import bt from "@mui/material/MenuItem";
38
38
  import At from "@mui/material/Select";
39
39
  import Tt from "@mui/material/TextField";
40
40
  import { C as St } from "./CurrencyInput-DUsQbkXb.mjs";
41
- import { b as Dt } from "./AccountFields-DUToRRqW.mjs";
41
+ import { b as Dt } from "./AccountFields-C9FlatNb.mjs";
42
42
  import Et from "@mui/material/Alert";
43
43
  import yt from "@mui/material/AlertTitle";
44
44
  import xt from "@mui/material/Link";
45
45
  import wt from "@mui/material/Paper";
46
46
  import { subDays as kt, startOfToday as It, endOfToday as Mt } from "date-fns";
47
- import { T as vt, a as Lt } from "./TransactionDetails-BqCr2FTh.mjs";
47
+ import { T as vt, a as Lt } from "./TransactionDetails-oP1eSuiS.mjs";
48
48
  import { T as j } from "./TabContentContainer-j01JYR_7.mjs";
49
49
  const U = ({
50
50
  children: e,
@@ -2,7 +2,7 @@ import { jsx as e, jsxs as u } from "react/jsx-runtime";
2
2
  import { observer as p } from "mobx-react-lite";
3
3
  import d from "@mui/material/Stack";
4
4
  import { H3 as w, InstitutionLogo as I, Text as m, H2 as L } from "@mxenabled/mxui";
5
- import { g as v } from "./AccountFields-DUToRRqW.mjs";
5
+ import { g as v } from "./AccountFields-C9FlatNb.mjs";
6
6
  import h from "react";
7
7
  import { G as E, d as y, m as S, u as _, f as G } from "./hooks-D6XlXHf4.mjs";
8
8
  import O from "@mui/material/Card";
@@ -11,11 +11,11 @@ import M from "@mui/material/CardHeader";
11
11
  import { useTheme as B } from "@mui/material/styles";
12
12
  import { g as H, a as U, b as j } from "./SpendingData-D5vsfYKo.mjs";
13
13
  import { L as z } from "./LineChart-D4GI7nVh.mjs";
14
- import { I as f, P as g, S as C } from "./Account-vp_TAbGt.mjs";
15
- import { A } from "./ConnectDrawer-Bw5s6Dw1.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
16
  import { L as Y } from "./Loader-DUaFpDGv.mjs";
17
17
  import { f as R, D as $ } from "./Dialog-CWW597AF.mjs";
18
- import { u as k } from "./useAccountDisplayName-jS05A6-6.mjs";
18
+ import { u as k } from "./useAccountDisplayName-BUAApBIb.mjs";
19
19
  import { f as F } from "./NumberFormatting-Buh7u8Oi.mjs";
20
20
  const b = () => {
21
21
  if (!h.useContext(E))
@@ -1,7 +1,7 @@
1
1
  import { jsx as u } from "react/jsx-runtime";
2
2
  import { Icon as p, Text as y } from "@mxenabled/mxui";
3
- import { F as m, A as d, a as v, P as h, b as F } from "./ConnectDrawer-Bw5s6Dw1.mjs";
4
- import { i as T, u as D, a as A, b as g, c as O } from "./Accounts-C1QxUB-e.mjs";
3
+ import { F as m, A as d, a as v, P as h, b as F } from "./ConnectDrawer-BQNs-hjk.mjs";
4
+ import { i as T, u as D, a as A, b as g, c as O } from "./Accounts-BRf_YeTf.mjs";
5
5
  import { f as _, i as b, a as N, b as S } from "./NumberFormatting-Buh7u8Oi.mjs";
6
6
  import { b as i } from "./Localization-2MODESHW.mjs";
7
7
  import { f as o, D as f } from "./Dialog-CWW597AF.mjs";
@@ -4,16 +4,16 @@ import I from "@mui/material/Badge";
4
4
  import m from "@mui/material/Box";
5
5
  import S from "@mui/material/ListItem";
6
6
  import v from "@mui/material/ListItemAvatar";
7
- import _ from "@mui/material/ListItemButton";
8
- import C from "@mui/material/ListItemText";
7
+ import C from "@mui/material/ListItemButton";
8
+ import _ from "@mui/material/ListItemText";
9
9
  import B from "@mui/material/styles/useTheme";
10
10
  import { InstitutionLogo as L, Text as o } from "@mxenabled/mxui";
11
11
  import { Error as A } from "@mxenabled/mx-icons";
12
12
  import { I as j } from "./IconBacking-B9oC6uL2.mjs";
13
- import { g as T } from "./AccountFields-DUToRRqW.mjs";
14
- import { u as X } from "./useAccountDisplayName-jS05A6-6.mjs";
15
- import { d } from "./ConnectDrawer-Bw5s6Dw1.mjs";
13
+ import { g as T } from "./AccountFields-C9FlatNb.mjs";
14
+ import { u as X } from "./useAccountDisplayName-BUAApBIb.mjs";
16
15
  import { u as $ } from "./hooks-D6XlXHf4.mjs";
16
+ import { C as d } from "./ConnectDrawer-BQNs-hjk.mjs";
17
17
  import { f as k } from "./NumberFormatting-Buh7u8Oi.mjs";
18
18
  const w = {
19
19
  gridRow: 1,
@@ -45,7 +45,7 @@ const w = {
45
45
  }
46
46
  ) }),
47
47
  /* @__PURE__ */ e(
48
- C,
48
+ _,
49
49
  {
50
50
  disableTypography: !0,
51
51
  primary: /* @__PURE__ */ r(
@@ -81,7 +81,7 @@ const w = {
81
81
  {
82
82
  sx: { backgroundColor: "background.paper", color: t.is_closed ? "grey.700" : "" },
83
83
  ...c,
84
- children: s ? /* @__PURE__ */ e(_, { alignItems: "flex-start", onClick: s, sx: { px: 24 }, children: a }) : a
84
+ children: s ? /* @__PURE__ */ e(C, { alignItems: "flex-start", onClick: s, sx: { px: 24 }, children: a }) : a
85
85
  }
86
86
  );
87
87
  }, Z = b(M);
@@ -1,11 +1,12 @@
1
- import { makeAutoObservable as A, runInAction as a } from "mobx";
2
- import { i as f } from "./User-BQUxBeZV.mjs";
3
- import { F as p, A as i } from "./Fetch-87LIQbEA.mjs";
4
- import { A as c, h as d, d as h, E as y, i as I, j as b } from "./ConnectDrawer-Bw5s6Dw1.mjs";
5
- class _ {
1
+ import { makeAutoObservable as l, runInAction as a } from "mobx";
2
+ import { i as A } from "./User-BQUxBeZV.mjs";
3
+ import { F as g, A as i } from "./Fetch-87LIQbEA.mjs";
4
+ import { d as m } from "./Accounts-BRf_YeTf.mjs";
5
+ import { A as c, j as u } from "./ConnectDrawer-BQNs-hjk.mjs";
6
+ class d {
6
7
  fetchInstance;
7
- constructor(t, e, n) {
8
- this.fetchInstance = new p(t, e, void 0, n);
8
+ constructor(t, e, s) {
9
+ this.fetchInstance = new g(t, e, void 0, s);
9
10
  }
10
11
  createAccount = async (t) => this.fetchInstance.post(i.ACCOUNTS, t).then((e) => e.account).catch((e) => e);
11
12
  deleteAccount = async (t) => this.fetchInstance.delete(`${i.ACCOUNTS}/${t}`).catch((e) => e);
@@ -17,35 +18,42 @@ class _ {
17
18
  refreshAllMembers = async () => this.fetchInstance.get(`${i.MEMBERS}/refresh_all`).then((t) => t).catch((t) => t);
18
19
  updateAccount = async (t) => this.fetchInstance.put(`${i.ACCOUNTS}/${t.guid}`, t).then((e) => e.account).catch((e) => e);
19
20
  }
20
- class E {
21
+ class p {
21
22
  isLoading = !1;
22
23
  selectedAccount = {};
23
24
  selectedMember = {};
24
25
  constructor() {
25
- A(this);
26
+ l(this);
26
27
  }
27
28
  setIsLoading = (t) => this.isLoading = t;
28
29
  setSelectedAccount = (t) => this.selectedAccount = t;
29
30
  setSelectedMember = (t) => this.selectedMember = t;
30
31
  }
31
- class T {
32
+ class E {
32
33
  globalStore;
33
- api = new _("/", "");
34
+ api = new d("/", "");
34
35
  accounts = [];
36
+ accountsLoaded = !1;
35
37
  institutions = [];
38
+ institutionsLoaded = !1;
36
39
  members = [];
40
+ membersLoaded = !1;
37
41
  uiStore;
38
42
  constructor(t) {
39
- this.globalStore = t, this.uiStore = new E(), this.api = new _(t.endpoint, t.sessionToken, t.onError), A(this);
43
+ this.globalStore = t, this.uiStore = new p(), this.api = new d(t.endpoint, t.sessionToken, t.onError), l(this);
40
44
  }
41
- loadAccountData = async ({
42
- accounts: t,
43
- institutions: e
44
- } = {}) => {
45
- await Promise.all([this.loadAccounts(t), this.loadInstitutions(e)]);
45
+ loadAccountData = async () => {
46
+ await Promise.all([this.loadAccounts(), this.loadMembers(), this.loadInstitutions()]);
46
47
  };
48
+ get isAccountDataLoaded() {
49
+ return this.accountsLoaded && this.membersLoaded && this.institutionsLoaded;
50
+ }
51
+ get detailedAccounts() {
52
+ const t = this.globalStore.userStore.userFeatures, e = A(t, "MD_EXCLUDE_EXTERNAL_ACCOUNTS");
53
+ return m(this.accounts, this.institutions, this.members, e);
54
+ }
47
55
  get cashAccounts() {
48
- return this.accounts.filter(
56
+ return this.detailedAccounts.filter(
49
57
  (t) => t.account_type === c.CASH || t.account_type === c.CHECKING || t.account_type === c.PREPAID || t.account_type === c.SAVINGS || t.account_type === c.CHECKING_LINE_OF_CREDIT
50
58
  );
51
59
  }
@@ -53,10 +61,10 @@ class T {
53
61
  return this.cashAccounts.reduce((t, e) => t + (e?.balance || 0), 0);
54
62
  }
55
63
  get checkingAccounts() {
56
- return this.accounts.filter((t) => t.account_type === c.CHECKING);
64
+ return this.detailedAccounts.filter((t) => t.account_type === c.CHECKING);
57
65
  }
58
66
  get debtAccounts() {
59
- return this.accounts.filter(
67
+ return this.detailedAccounts.filter(
60
68
  (t) => t.account_type === c.CREDIT_CARD || t.account_type === c.LOAN || t.account_type === c.MORTGAGE || t.account_type === c.LINE_OF_CREDIT || t.account_type === c.CHECKING_LINE_OF_CREDIT
61
69
  );
62
70
  }
@@ -67,23 +75,23 @@ class T {
67
75
  c.CREDIT_CARD,
68
76
  c.INVESTMENT
69
77
  ]);
70
- return this.accounts.filter((e) => t.has(e.account_type));
78
+ return this.detailedAccounts.filter((e) => t.has(e.account_type));
71
79
  }
72
80
  get investmentAccounts() {
73
- return this.accounts.filter(
81
+ return this.detailedAccounts.filter(
74
82
  (t) => t.account_type === c.INVESTMENT
75
83
  );
76
84
  }
77
85
  get savingsAccounts() {
78
- return this.accounts.filter((t) => t.account_type === c.SAVINGS);
86
+ return this.detailedAccounts.filter((t) => t.account_type === c.SAVINGS);
79
87
  }
80
88
  get retirementAccounts() {
81
- return this.accounts.filter(
82
- (t) => t.account_type === c.INVESTMENT || t.account_type === c.SAVINGS || t.account_type === c.CHECKING || t.account_type === c.CASH || t.account_type === c.PROPERTY || t.account_type === c.INSURANCE && (t.account_subtype === d.WHOLE_LIFE || t.account_subtype === d.UNIVERSAL_LIFE || t.account_subtype === d.VARIABLE_UNIVERSAL_LIFE)
89
+ return this.detailedAccounts.filter(
90
+ (t) => t.account_type === c.INVESTMENT || t.account_type === c.SAVINGS || t.account_type === c.CHECKING || t.account_type === c.CASH || t.account_type === c.PROPERTY || t.account_type === c.INSURANCE && (t.account_subtype === u.WHOLE_LIFE || t.account_subtype === u.UNIVERSAL_LIFE || t.account_subtype === u.VARIABLE_UNIVERSAL_LIFE)
83
91
  );
84
92
  }
85
93
  get visibleAccounts() {
86
- return this.accounts.filter((t) => !t.is_hidden);
94
+ return this.detailedAccounts.filter((t) => !t.is_hidden);
87
95
  }
88
96
  get visibleCashAccounts() {
89
97
  return this.cashAccounts.filter((t) => !t.is_hidden);
@@ -111,6 +119,15 @@ class T {
111
119
  get visibleSavingsAccounts() {
112
120
  return this.savingsAccounts.filter((t) => !t.is_hidden);
113
121
  }
122
+ setAccounts = (t) => {
123
+ this.accounts = t, this.accountsLoaded = !0;
124
+ };
125
+ setMembers = (t) => {
126
+ this.members = t, this.membersLoaded = !0;
127
+ };
128
+ setInstitutions = (t) => {
129
+ this.institutions = t, this.institutionsLoaded = !0;
130
+ };
114
131
  addAccount = async (t) => {
115
132
  try {
116
133
  const e = await this.api.createAccount(t);
@@ -121,77 +138,45 @@ class T {
121
138
  console.error(`Error occurred while adding an account: ${e}`);
122
139
  }
123
140
  };
124
- augmentAccounts = (t = this.accounts) => {
125
- const e = [], n = this.globalStore.userStore.userFeatures, s = f(
126
- n,
127
- "MD_EXCLUDE_EXTERNAL_ACCOUNTS"
128
- );
129
- for (const r of t) {
130
- if (s && r.member_is_managed_by_user) continue;
131
- const o = this.members.find((g) => g.guid === r.member_guid);
132
- if (!o) continue;
133
- let u = h.Connected;
134
- y.includes(o.connection_status) ? u = h.Error : I.includes(o.connection_status) ? u = h.Processing : b.includes(o.connection_status) && (u = h.RequiresMfa);
135
- const m = [
136
- r.user_name || r.feed_name || "",
137
- r.account_number ? `*${r.account_number}` : ""
138
- ].join(" ").trim();
139
- e.push({
140
- ...r,
141
- connectionStatus: u,
142
- institutionName: m,
143
- memberName: o.name
144
- }), o.connectionStatus = u;
145
- }
146
- return e;
147
- };
148
- loadAccounts = async (t) => {
149
- await this.loadMembers();
141
+ loadAccounts = async () => {
150
142
  try {
151
- const e = t || await this.api.getAccounts();
152
- a(() => {
153
- this.accounts = this.sortAccounts(this.augmentAccounts(e));
154
- });
155
- } catch (e) {
156
- console.error(`Error occurred while loading accounts: ${e}`);
143
+ const t = await this.api.getAccounts();
144
+ this.setAccounts(t);
145
+ } catch (t) {
146
+ console.error(`Error occurred while loading accounts: ${t}`);
157
147
  }
158
148
  };
159
- loadInstitutions = async (t) => {
149
+ loadInstitutions = async () => {
160
150
  try {
161
- const e = t || await this.api.getInstitutions();
162
- a(() => {
163
- this.institutions = e;
164
- });
165
- } catch (e) {
166
- console.error(`Error occurred while loading institutions: ${e}`);
151
+ const t = await this.api.getInstitutions();
152
+ this.setInstitutions(t);
153
+ } catch (t) {
154
+ console.error(`Error occurred while loading institutions: ${t}`);
167
155
  }
168
156
  };
169
157
  loadMembers = async () => {
170
158
  try {
171
159
  const t = await this.api.getMembers();
172
- a(() => {
173
- this.members = t;
174
- });
160
+ this.setMembers(t);
175
161
  } catch (t) {
176
162
  console.error(`Error occurred while loading members: ${t}`);
177
163
  }
178
164
  };
179
165
  mergeAccounts = async (t) => {
180
166
  try {
181
- const e = await this.api.mergeAccounts(t), n = e[Object.keys(e)[0]];
167
+ const e = await this.api.mergeAccounts(t), s = e[Object.keys(e)[0]];
182
168
  a(() => {
183
- const s = this.accounts.findIndex((o) => o.guid === t[1]);
184
- this.accounts.splice(s, 1);
169
+ const n = this.accounts.findIndex((o) => o.guid === t[1]);
170
+ this.accounts.splice(n, 1);
185
171
  const r = this.accounts.findIndex((o) => o.guid === t[0]);
186
- this.accounts.splice(r, 1, n);
172
+ this.accounts.splice(r, 1, s);
187
173
  });
188
174
  } catch (e) {
189
175
  console.error(`Error occurred while merging accounts: ${e}`);
190
176
  }
191
177
  };
192
- sortAccounts = (t = this.accounts) => t.sort((e, n) => e.account_type > n.account_type ? 1 : e.account_type < n.account_type ? -1 : (e.name || "") > (n.name || "") ? 1 : (e.name || "") < (n.name || "") ? -1 : 0);
193
178
  refreshAccounts = async () => {
194
- this.uiStore.setIsLoading(!0), await Promise.all([this.loadAccounts(), this.loadInstitutions()]), this.uiStore.setIsLoading(!1);
179
+ this.uiStore.setIsLoading(!0), await Promise.all([this.loadAccounts(), this.loadInstitutions(), this.loadMembers()]), this.uiStore.setIsLoading(!1);
195
180
  };
196
181
  refreshMembers = async () => {
197
182
  try {
@@ -202,48 +187,37 @@ class T {
202
187
  };
203
188
  removeAccount = async (t) => {
204
189
  try {
205
- await this.api.deleteAccount(t), a(() => {
206
- const e = this.accounts.findIndex((n) => n.guid === t);
207
- this.accounts.splice(e, 1);
208
- });
190
+ await this.api.deleteAccount(t);
191
+ const e = this.accounts.findIndex((s) => s.guid === t);
192
+ this.accounts.splice(e, 1);
209
193
  } catch (e) {
210
194
  console.error(`Error occurred while removing an account: ${e}`);
211
195
  }
212
196
  };
213
197
  updateAccount = async (t) => {
214
198
  try {
215
- const e = await this.api.updateAccount(t);
216
- a(() => {
217
- const n = this.accounts.findIndex(
218
- (s) => s.guid === e.guid
219
- );
220
- this.accounts.splice(n, 1, e), this.accounts = this.augmentAccounts(this.accounts);
221
- });
199
+ const e = await this.api.updateAccount(t), s = this.accounts.findIndex(
200
+ (n) => n.guid === e.guid
201
+ );
202
+ this.accounts.splice(s, 1, e);
222
203
  } catch (e) {
223
204
  console.error(`Error occurred while updating account: ${e}`);
224
205
  }
225
206
  };
226
207
  updateAccountBalance = (t, e) => {
227
- const n = this.accounts.find((s) => s.guid === t);
228
- n && a(() => {
229
- n.balance = (n.balance || 0) + e;
208
+ const s = this.accounts.find((n) => n.guid === t);
209
+ s && a(() => {
210
+ s.balance = (s.balance || 0) + e;
230
211
  });
231
212
  };
232
213
  updateAccountFiltering = async (t, e) => {
233
- for (const n of t) {
234
- const s = this.accounts.find((r) => r.guid === n);
235
- if (s) {
236
- s.is_excluded_from_accounts = e, s.is_excluded_from_budgets = e, s.is_excluded_from_cash_flow = e, s.is_excluded_from_debts = e, s.is_excluded_from_goals = e, s.is_excluded_from_investments = e, s.is_excluded_from_net_worth = e, s.is_excluded_from_spending = e, s.is_excluded_from_transactions = e, s.is_excluded_from_trends = e;
237
- try {
238
- this.updateAccount(s);
239
- } catch (r) {
240
- console.error(`Failed to update account ${n} (added):`, r);
241
- }
242
- }
214
+ for (const s of t) {
215
+ const n = this.accounts.find((r) => r.guid === s);
216
+ n && (n.is_excluded_from_accounts = e, await this.updateAccount(n));
243
217
  }
244
218
  };
245
219
  }
246
220
  export {
247
- _ as A,
248
- T as a
221
+ d as A,
222
+ E as a
249
223
  };
@@ -0,0 +1,27 @@
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
+ };
@@ -0,0 +1,174 @@
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
+ };