@mx-cartographer/experiences 6.26.32 → 7.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 (98) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/Account-DY6nxO7y.mjs +30 -0
  3. package/dist/AccountDetailsContent-DvPs81kL.mjs +677 -0
  4. package/dist/AccountDetailsHeader-W2U7ZVm_.mjs +119 -0
  5. package/dist/AccountFields-DAVcbZy5.mjs +135 -0
  6. package/dist/AccountListItem-DFlbdcmT.mjs +90 -0
  7. package/dist/AccountStore-CU7qV3vg.mjs +230 -0
  8. package/dist/Accounts-BLlrQA5m.mjs +9 -0
  9. package/dist/BeatApi-DLu87ijw.mjs +21 -0
  10. package/dist/BeatStore-By4aGoRM.mjs +81 -0
  11. package/dist/BudgetUtil-Ci1TN0J5.mjs +101 -0
  12. package/dist/CashflowStore-D9Dpuz7X.mjs +91 -0
  13. package/dist/Category-5S6uwuXz.mjs +301 -0
  14. package/dist/CategorySelectorDrawer-rHyHHYuh.mjs +397 -0
  15. package/dist/CategoryStore-B5EW6I1d.mjs +183 -0
  16. package/dist/CategoryUtil-DRyruNgi.mjs +78 -0
  17. package/dist/ConnectDrawer-D9cR5phc.mjs +508 -0
  18. package/dist/ConnectionsDrawer-BzGqljSp.mjs +52 -0
  19. package/dist/CurrencyInput-D74cemI2.mjs +83 -0
  20. package/dist/CurrencyText-YUhH2caW.mjs +20 -0
  21. package/dist/DateUtil-BcuH7ErC.mjs +48 -0
  22. package/dist/DebtsStore-S0l9kr0r.mjs +60 -0
  23. package/dist/Dialog-CWW597AF.mjs +123 -0
  24. package/dist/Donut-1UMNcG67.mjs +57 -0
  25. package/dist/Drawer-kEE73B87.mjs +113 -0
  26. package/dist/EmptyState-Dcb-o2tl.mjs +55 -0
  27. package/dist/Fetch-CkFKy79O.mjs +116 -0
  28. package/dist/FinstrongStore-mkALvztw.mjs +101 -0
  29. package/dist/GoalStore-DioeeL-s.mjs +263 -0
  30. package/dist/HeaderCell-DjuifqHJ.mjs +6 -0
  31. package/dist/Help-DhcC-C05.mjs +320 -0
  32. package/dist/Help-DpYRO8oA.mjs +3181 -0
  33. package/dist/IconBacking-B9oC6uL2.mjs +39 -0
  34. package/dist/InvestmentUtil-jOyOgzIB.mjs +134 -0
  35. package/dist/LineChart-CcyX38kK.mjs +499 -0
  36. package/dist/ListItemAction-BabpYivr.mjs +69 -0
  37. package/dist/Loader-Dp1P2gNw.mjs +14 -0
  38. package/dist/Localization-2MODESHW.mjs +30 -0
  39. package/dist/ManageIncome-ndMuhJMG.mjs +535 -0
  40. package/dist/MerchantStore-DVH-QOf0.mjs +37 -0
  41. package/dist/MicroWidgetContainer-CsvHLYKX.mjs +45 -0
  42. package/dist/MiniWidgetContainer-BoOp-A05.mjs +39 -0
  43. package/dist/NetWorthStore-PD-RUe09.mjs +150 -0
  44. package/dist/Notification-AMGWM1Al.mjs +78 -0
  45. package/dist/NotificationSettings-VhHuMAFU.mjs +667 -0
  46. package/dist/NotificationStore-DHtSGySy.mjs +67 -0
  47. package/dist/NumberFormatting-CtWHhyBX.mjs +40 -0
  48. package/dist/OriginalBalanceAction-D39mx6uE.mjs +115 -0
  49. package/dist/RecurringSettings-D_HnMYZP.mjs +57 -0
  50. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +263 -0
  51. package/dist/RepeatingTransaction-BPWfaB3f.mjs +282 -0
  52. package/dist/SearchBox-B2_zLv8-.mjs +42 -0
  53. package/dist/SettingsStore-CE7jDVFL.mjs +265 -0
  54. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +69 -0
  55. package/dist/SpendingData-BkrxzHdr.mjs +55 -0
  56. package/dist/StatusBar-BK_uYHAB.mjs +30 -0
  57. package/dist/TabContentContainer-j01JYR_7.mjs +21 -0
  58. package/dist/Transaction-CA0FW2Ij.mjs +312 -0
  59. package/dist/TransactionApi-DbbcjI2L.mjs +86 -0
  60. package/dist/TransactionDetails-WBHFmbxL.mjs +1283 -0
  61. package/dist/TransactionStore-CeLdmVnC.mjs +669 -0
  62. package/dist/TrendsStore-BHJUapXF.mjs +487 -0
  63. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +1959 -0
  64. package/dist/WidgetContainer-DWCusxYI.mjs +556 -0
  65. package/dist/accounts/index.es.js +752 -0
  66. package/dist/analytics/index.es.js +171 -0
  67. package/dist/budgets/index.es.js +1075 -0
  68. package/dist/cashflow/index.es.js +1098 -0
  69. package/dist/categories/index.es.js +9 -0
  70. package/dist/common/context/hooks.d.ts +13 -13
  71. package/dist/common/index.es.js +1451 -0
  72. package/dist/dashboard/index.es.js +181 -0
  73. package/dist/debts/index.es.js +1460 -0
  74. package/dist/exportTransactionsToCSV-CmwsKl2D.mjs +47 -0
  75. package/dist/finstrong/index.es.js +1455 -0
  76. package/dist/goals/index.es.js +1209 -0
  77. package/dist/help/components/content/section/index.d.ts +15 -15
  78. package/dist/help/index.es.js +14 -0
  79. package/dist/hooks-30y_BLwc.mjs +71 -0
  80. package/dist/index.d.ts +0 -22
  81. package/dist/insights/index.d.ts +1 -0
  82. package/dist/insights/index.es.js +4 -0
  83. package/dist/investments/index.es.js +1638 -0
  84. package/dist/merchants/index.es.js +79 -0
  85. package/dist/microinsights/index.es.js +16 -0
  86. package/dist/networth/index.es.js +576 -0
  87. package/dist/notifications/index.es.js +192 -0
  88. package/dist/recurringtransactions/index.es.js +879 -0
  89. package/dist/settings/index.es.js +879 -0
  90. package/dist/spending/index.es.js +570 -0
  91. package/dist/transactions/index.es.js +587 -0
  92. package/dist/trends/index.es.js +1086 -0
  93. package/dist/useCombineEvents-DaDBSR_1.mjs +92 -0
  94. package/dist/useDimensions-27p2evRx.mjs +36 -0
  95. package/dist/useScreenSize-B6JyS_Lj.mjs +36 -0
  96. package/package.json +155 -3
  97. package/dist/index.es.js +0 -30508
  98. package/dist/index.es.js.map +0 -1
@@ -0,0 +1,67 @@
1
+ import { makeAutoObservable as c, observable as f, runInAction as h } from "mobx";
2
+ import { fromUnixTime as o, isSameDay as d } from "date-fns";
3
+ import { F as l, A as n } from "./Fetch-CkFKy79O.mjs";
4
+ class s {
5
+ fetchInstance;
6
+ constructor(t, i) {
7
+ this.fetchInstance = new l(t, i);
8
+ }
9
+ getNotifications = () => this.fetchInstance.get(n.NOTIFICATIONS).then(
10
+ (t) => t.notifications.map((i) => i.notification)
11
+ ).finally();
12
+ updateNotification = (t) => this.fetchInstance.put(`${n.NOTIFICATIONS}/${t.guid}`, {
13
+ guid: t.guid,
14
+ has_been_viewed: t.has_been_viewed
15
+ }).then((i) => i.notification).finally();
16
+ // Note: The notifications/mark_all_as_viewed endpoint is broken, but still returns 202.
17
+ // A bug ticket has been filed to fix it, but should not require any changes here.
18
+ markAllAsViewed = (t) => this.fetchInstance.put(`${n.NOTIFICATIONS}/mark_all_as_viewed`, { channel: t }).finally();
19
+ }
20
+ const w = (e, t) => {
21
+ const i = o(t[e].delivered_at), a = o(t[e - 1]?.delivered_at);
22
+ return !d(i, a);
23
+ };
24
+ function u(e) {
25
+ const i = Math.floor(Date.now() / 1e3);
26
+ return e.filter((a) => {
27
+ const r = a.delivered_at;
28
+ return i - r <= 604800;
29
+ });
30
+ }
31
+ class A {
32
+ globalStore;
33
+ api = new s("/", "");
34
+ isLoading = !0;
35
+ notifications = [];
36
+ recentNotifications = [];
37
+ constructor(t) {
38
+ this.globalStore = t, this.api = new s(t.endpoint, t.sessionToken), c(this, { notifications: f });
39
+ }
40
+ // Used in Money Dashboard
41
+ get newNotifications() {
42
+ return this.recentNotifications.filter((t) => !t.has_been_viewed);
43
+ }
44
+ loadNotifications = async () => {
45
+ try {
46
+ this.isLoading = !0;
47
+ const t = await this.api.getNotifications();
48
+ h(() => {
49
+ this.notifications = t, this.recentNotifications = u(t), this.isLoading = !1;
50
+ });
51
+ } catch (t) {
52
+ console.error(`Error occurred while loading notifications: ${t}`);
53
+ }
54
+ };
55
+ markAllAsViewed = async () => {
56
+ this.notifications.forEach((t) => t.has_been_viewed = !0), await this.api.markAllAsViewed(), await this.loadNotifications();
57
+ };
58
+ updateNotification = async (t) => {
59
+ t.has_been_viewed = !0, await this.api.updateNotification(t);
60
+ };
61
+ }
62
+ export {
63
+ A as N,
64
+ s as a,
65
+ u as f,
66
+ w as s
67
+ };
@@ -0,0 +1,40 @@
1
+ import n from "numeral";
2
+ import { g as s } from "./Localization-2MODESHW.mjs";
3
+ const u = 9999999999e-2;
4
+ var a = /* @__PURE__ */ ((t) => (t.CAD = "CAD", t.USD = "USD", t))(a || {});
5
+ const d = (t, r, e) => {
6
+ switch (s()) {
7
+ case "fr-ca":
8
+ return n(t).format(`${r} $`, e);
9
+ default:
10
+ return n(t).format(`$${r}`, e);
11
+ }
12
+ }, D = () => {
13
+ switch (s()) {
14
+ case "fr-ca":
15
+ return a.CAD;
16
+ default:
17
+ return a.USD;
18
+ }
19
+ }, c = (t) => t != null && t !== "" && isFinite(t), i = {
20
+ style: "percent",
21
+ minimumFractionDigits: 2,
22
+ maximumFractionDigits: 2
23
+ }, g = (t, r = i) => c(t) ? new Intl.NumberFormat(s(), r).format(Number(t)) : t, l = (t) => new Intl.PluralRules(s(), t), w = (t, r = { type: "ordinal" }, e = {
24
+ one: "st",
25
+ two: "nd",
26
+ few: "rd",
27
+ other: "th"
28
+ }) => {
29
+ const o = l(r).select(t);
30
+ return `${t}${e[o]}`;
31
+ };
32
+ export {
33
+ a as C,
34
+ u as M,
35
+ g as a,
36
+ w as b,
37
+ d as f,
38
+ D as g,
39
+ c as i
40
+ };
@@ -0,0 +1,115 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import _ from "react";
3
+ import { observer as p } from "mobx-react-lite";
4
+ import v from "@mui/material/TextField";
5
+ import { L as y } from "./ListItemAction-BabpYivr.mjs";
6
+ import { u as h, i as b } from "./hooks-30y_BLwc.mjs";
7
+ import { a as T, f as S } from "./NumberFormatting-CtWHhyBX.mjs";
8
+ import { C as f } from "./CurrencyInput-D74cemI2.mjs";
9
+ const F = p(({ goal: e }) => {
10
+ const { goals: a } = h(), { setAlert: r, setSelectedGoal: l, updateGoal: m } = b(), [t, s] = _.useState(e.interest_rate ?? 0), c = !e.guid, i = t < 0, d = async () => {
11
+ const n = { ...e, interest_rate: t };
12
+ e.interest_rate = t, c ? l(n) : (await m(n), r(a.alert_goal_updated_interest_rate));
13
+ }, u = () => {
14
+ setTimeout(() => {
15
+ s(e.interest_rate ?? 0);
16
+ }, 250);
17
+ };
18
+ return /* @__PURE__ */ o(
19
+ y,
20
+ {
21
+ isDisabled: e.is_complete,
22
+ isSaveDisabled: i,
23
+ label: `${a.details_interest_rate} (%)`,
24
+ onCancel: u,
25
+ onSave: d,
26
+ primaryText: a.details_interest_rate,
27
+ secondaryText: T(Number(e.interest_rate) / 100),
28
+ zeroStateText: e.interest_rate ? void 0 : a.add_interest_rate,
29
+ children: /* @__PURE__ */ o(
30
+ v,
31
+ {
32
+ error: i,
33
+ fullWidth: !0,
34
+ label: a.details_goal_name,
35
+ onChange: (n) => s(isNaN(parseFloat(n.target.value)) ? 0 : parseFloat(n.target.value)),
36
+ type: "number",
37
+ value: t
38
+ }
39
+ )
40
+ }
41
+ );
42
+ }), B = p(({ goal: e }) => {
43
+ const { goals: a } = h(), { setAlert: r, setSelectedGoal: l, updateGoal: m } = b(), [t, s] = _.useState(e.monthly_payment ?? 0), c = !e.guid, i = t < 0 || t > 9999999999e-2, d = async () => {
44
+ const n = { ...e, monthly_payment: t };
45
+ e.monthly_payment = t, c ? l(n) : (await m({ ...e, monthly_payment: t }), r(a.alert_goal_updated_payment));
46
+ }, u = () => {
47
+ setTimeout(() => {
48
+ s(e.monthly_payment || 0);
49
+ }, 250);
50
+ };
51
+ return /* @__PURE__ */ o(
52
+ y,
53
+ {
54
+ isDisabled: e.is_complete,
55
+ isSaveDisabled: i,
56
+ label: a.details_monthly_payment,
57
+ onCancel: u,
58
+ onSave: d,
59
+ primaryText: a.details_monthly_payment,
60
+ secondaryText: S(e.monthly_payment, "0,0"),
61
+ zeroStateText: e.monthly_payment ? void 0 : a.add_monthly_payment,
62
+ children: /* @__PURE__ */ o(
63
+ f,
64
+ {
65
+ amount: t,
66
+ autoFocus: !0,
67
+ error: i,
68
+ fullWidth: !0,
69
+ minAmount: 0,
70
+ setAmount: (n) => s(isNaN(Number(n)) ? t : Number(n)),
71
+ sx: { ".MuiTypography-Body": { p: 0 } }
72
+ }
73
+ )
74
+ }
75
+ );
76
+ }), M = p(({ goal: e }) => {
77
+ const { goals: a } = h(), { setAlert: r, setSelectedGoal: l, updateGoal: m } = b(), [t, s] = _.useState(e.initial_amount), c = !e.guid, i = t < 0 || t > 9999999999e-2, d = async () => {
78
+ const n = { ...e, initial_amount: t };
79
+ e.initial_amount = t, c ? l(n) : (await m({ ...e, initial_amount: t }), r(a.alert_goal_updated_balance));
80
+ }, u = () => {
81
+ setTimeout(() => {
82
+ s(e.initial_amount);
83
+ }, 250);
84
+ };
85
+ return /* @__PURE__ */ o(
86
+ y,
87
+ {
88
+ isDisabled: e.is_complete,
89
+ isSaveDisabled: i,
90
+ label: a.details_original_balance,
91
+ onCancel: u,
92
+ onSave: d,
93
+ primaryText: a.details_original_balance,
94
+ secondaryText: S(e.initial_amount, "0,0"),
95
+ zeroStateText: !e.initial_amount && !e.is_complete ? a.add_original_balance : void 0,
96
+ children: /* @__PURE__ */ o(
97
+ f,
98
+ {
99
+ amount: t,
100
+ autoFocus: !0,
101
+ error: i,
102
+ fullWidth: !0,
103
+ minAmount: 0,
104
+ setAmount: (n) => s(isNaN(Number(n)) ? t : Number(n)),
105
+ sx: { ".MuiTypography-Body": { p: 0 } }
106
+ }
107
+ )
108
+ }
109
+ );
110
+ });
111
+ export {
112
+ F as I,
113
+ B as M,
114
+ M as O
115
+ };
@@ -0,0 +1,57 @@
1
+ import { jsxs as s, jsx as r } from "react/jsx-runtime";
2
+ import p from "react";
3
+ import { observer as d } from "mobx-react-lite";
4
+ import _ from "@mui/material/Box";
5
+ import g from "@mui/material/Tab";
6
+ import R from "@mui/material/Tabs";
7
+ import T from "@mui/material/Divider";
8
+ import b from "@mui/material/List";
9
+ import { R as f, A as h, M as C } from "./ManageIncome-ndMuhJMG.mjs";
10
+ import { u as l, f as E, g as u } from "./hooks-30y_BLwc.mjs";
11
+ import { R as S, F as A } from "./RepeatingTransaction-BPWfaB3f.mjs";
12
+ import { A as m } from "./WidgetContainer-DWCusxYI.mjs";
13
+ const v = d(() => {
14
+ const { recurring: n } = l(), { repeatingTransactions: a } = E(), { onEvent: o } = u(), t = (e) => {
15
+ o(m.RECURRING_TRANSACTIONS_CLICK_EXPENSE, {
16
+ repeating_transaction_guid: e.guid
17
+ });
18
+ }, c = () => {
19
+ o(m.RECURRING_TRANSACTIONS_CLICK_ADD_EXPENSE);
20
+ };
21
+ return /* @__PURE__ */ s(b, { sx: { bgcolor: "background.paper" }, children: [
22
+ a.filter(
23
+ (e) => e.repeating_transaction_type !== S.Income && (e.transactions.length > 0 || e.recurrence_type === A.EveryYear)
24
+ ).map((e, i) => /* @__PURE__ */ s(p.Fragment, { children: [
25
+ /* @__PURE__ */ r(f, { onClick: t, repeatingTransaction: e }),
26
+ /* @__PURE__ */ r(T, { variant: i < a.length - 1 ? "inset" : "fullWidth" })
27
+ ] }, e.guid)),
28
+ /* @__PURE__ */ r(h, { label: n.add_expense, onAddRecurringTransaction: c })
29
+ ] });
30
+ }), K = d(() => {
31
+ const [n, a] = p.useState(0), { onEvent: o } = u(), { recurring: t } = l();
32
+ return /* @__PURE__ */ s(_, { bgcolor: "background.default", height: "100%", children: [
33
+ /* @__PURE__ */ s(
34
+ R,
35
+ {
36
+ onChange: (e, i) => {
37
+ a(i), o(
38
+ i === 0 ? "recurring_transactions_widget_manage_expenses" : "recurring_transactions_widget_edit_income"
39
+ );
40
+ },
41
+ sx: { bgcolor: "background.paper" },
42
+ value: n,
43
+ variant: "fullWidth",
44
+ children: [
45
+ /* @__PURE__ */ r(g, { label: t.manage_expenses }),
46
+ /* @__PURE__ */ r(g, { label: t.manage_income })
47
+ ]
48
+ }
49
+ ),
50
+ n === 0 && /* @__PURE__ */ r(v, {}),
51
+ n === 1 && /* @__PURE__ */ r(C, {})
52
+ ] });
53
+ });
54
+ export {
55
+ v as M,
56
+ K as R
57
+ };
@@ -0,0 +1,263 @@
1
+ import { makeAutoObservable as f, runInAction as i } from "mobx";
2
+ import { endOfMonth as R } from "date-fns/endOfMonth";
3
+ import { isAfter as p } from "date-fns/isAfter";
4
+ import { isBefore as S } from "date-fns/isBefore";
5
+ import { isSameDay as g } from "date-fns/isSameDay";
6
+ import { isWithinInterval as m } from "date-fns/isWithinInterval";
7
+ import { startOfMonth as I } from "date-fns/startOfMonth";
8
+ import { startOfToday as c } from "date-fns/startOfToday";
9
+ import { subDays as y } from "date-fns/subDays";
10
+ import { F as x, A as o } from "./Fetch-CkFKy79O.mjs";
11
+ import { b as A, a, c as h, d as u } from "./RepeatingTransaction-BPWfaB3f.mjs";
12
+ var E = /* @__PURE__ */ ((r) => (r.Small = "small", r.Medium = "medium", r.Large = "large", r))(E || {});
13
+ const U = 44;
14
+ class d {
15
+ fetchInstance;
16
+ constructor(e, t) {
17
+ this.fetchInstance = new x(e, t);
18
+ }
19
+ addRepeatingTransaction = async (e) => this.fetchInstance.post(o.REPEATING_TRANSACTIONS, e).then((t) => t.repeating_transaction);
20
+ getRepeatingTransactions = async () => this.fetchInstance.get(o.REPEATING_TRANSACTIONS).then((e) => e.repeating_transactions);
21
+ updateRepeatingTransaction = async (e) => this.fetchInstance.put(
22
+ `${o.REPEATING_TRANSACTIONS}/${e.guid}`,
23
+ e
24
+ ).then((t) => t.repeating_transaction);
25
+ deleteRepeatingTransaction = async (e) => this.fetchInstance.delete(`${o.REPEATING_TRANSACTIONS}/${e}`).then((t) => t);
26
+ }
27
+ const l = (r, e) => m(e.expectedDate, r), s = (r, e) => r + e.amount;
28
+ class C {
29
+ globalStore;
30
+ api = new d("/", "");
31
+ transactions = [];
32
+ repeatingTransactions = [];
33
+ selectedDay;
34
+ dateRange = { start: I(c()), end: R(c()) };
35
+ isDataLoaded = !1;
36
+ constructor(e) {
37
+ this.globalStore = e, this.api = new d(e.endpoint, e.sessionToken), f(this);
38
+ }
39
+ /**
40
+ * Returns all recurrences built from repeating transactions and filtered by accounts.
41
+ */
42
+ get recurrences() {
43
+ const e = this.globalStore.accountStore.visibleAccounts;
44
+ return A(this.repeatingTransactions, this.dateRange).filter((t) => e.some((n) => n.guid === t.accountGuid && !n.is_excluded_from_accounts)).filter((t) => m(t.expectedDate, this.dateRange));
45
+ }
46
+ /**
47
+ * Returns all recurrences that have occurred in the past, including those that are paid or missed
48
+ */
49
+ get pastRecurrences() {
50
+ return this.recurrences.filter(
51
+ (e) => e.status === a.Paid || e.status === a.Missed
52
+ );
53
+ }
54
+ /**
55
+ * Returns all recurrences that are expected to occur through the end of the month
56
+ * or should have occurred in the last 3 days.
57
+ */
58
+ get upcomingRecurrences() {
59
+ return this.recurrences.filter(
60
+ (e) => p(e.expectedDate, y(c(), 3)) && S(e.expectedDate, this.dateRange.end) && e.status === a.Upcoming
61
+ );
62
+ }
63
+ /**
64
+ * Returns all expense recurrences.
65
+ */
66
+ get expenses() {
67
+ return this.recurrences.filter(
68
+ (e) => e.type === h.Expense
69
+ );
70
+ }
71
+ /**
72
+ * Returns the upcoming expense recurrences.
73
+ */
74
+ get upcomingExpenses() {
75
+ return this.expenses.filter(
76
+ (e) => e.status === a.Upcoming
77
+ );
78
+ }
79
+ /**
80
+ * Returns all income recurrences.
81
+ */
82
+ get income() {
83
+ return this.recurrences.filter(
84
+ (e) => e.type === h.Income
85
+ );
86
+ }
87
+ /**
88
+ * Returns the upcoming income recurrences.
89
+ */
90
+ get upcomingIncome() {
91
+ return this.income.filter(
92
+ (e) => e.status === a.Upcoming
93
+ );
94
+ }
95
+ get nextIncomeRecurrence() {
96
+ return this.upcomingIncome.find((e) => p(e.expectedDate, c()));
97
+ }
98
+ /**
99
+ * Returns the expense recurrences for the current month.
100
+ */
101
+ get currentMonthExpenses() {
102
+ return this.expenses.filter(
103
+ (e) => l(this.dateRange, e)
104
+ );
105
+ }
106
+ /**
107
+ * Returns the income recurrences for the current month.
108
+ */
109
+ get currentMonthIncome() {
110
+ return this.income.filter(
111
+ (e) => l(this.dateRange, e)
112
+ );
113
+ }
114
+ /**
115
+ * Calculates the total amount of all expenses for the current month.
116
+ */
117
+ get expenseTotal() {
118
+ return this.currentMonthExpenses.reduce(s, 0);
119
+ }
120
+ /**
121
+ * Calculates the total amount of all paid expenses for the current month.
122
+ */
123
+ get paidExpenseTotal() {
124
+ return this.currentMonthExpenses.filter((e) => e.status === a.Paid).reduce(s, 0);
125
+ }
126
+ /**
127
+ * Calculates the total amount of all missed expenses for the current month.
128
+ */
129
+ get missedExpenseTotal() {
130
+ return this.currentMonthExpenses.filter((e) => e.status === a.Missed).reduce(s, 0);
131
+ }
132
+ /**
133
+ * Calculates the total amount of all upcoming expenses for the current month.
134
+ */
135
+ get upcomingExpenseTotal() {
136
+ return this.currentMonthExpenses.filter((e) => e.status === a.Upcoming).reduce(s, 0);
137
+ }
138
+ /**
139
+ * Calculates the total amount of all income for the current month.
140
+ */
141
+ get incomeTotal() {
142
+ return this.currentMonthIncome.reduce(s, 0);
143
+ }
144
+ /**
145
+ * Calculates the total amount of all paid income for the current month.
146
+ */
147
+ get paidIncomeTotal() {
148
+ return this.currentMonthIncome.filter((e) => e.status === a.Paid).reduce(s, 0);
149
+ }
150
+ /**
151
+ * Calculates the total amount of all upcoming income for the current month.
152
+ */
153
+ get upcomingIncomeTotal() {
154
+ return this.currentMonthIncome.filter((e) => e.status === a.Upcoming).reduce(s, 0);
155
+ }
156
+ /**
157
+ * Get the recurrences for the currently selected day.
158
+ */
159
+ get selectedDayRecurrences() {
160
+ return this.selectedDay && this.recurrences.filter(
161
+ (e) => this.selectedDay && g(e.occurredOnDate || e.expectedDate, this.selectedDay)
162
+ );
163
+ }
164
+ /**
165
+ * Set the date range for filtering recurrences.
166
+ * @param dateRange - The date range to set.
167
+ */
168
+ setDateRange = (e) => this.dateRange = e;
169
+ /**
170
+ * Set the currently selected day.
171
+ * @param day - The day to select.
172
+ */
173
+ setSelectedDay = (e) => {
174
+ this.selectedDay = this.selectedDay && g(e, this.selectedDay) ? void 0 : e;
175
+ };
176
+ /**
177
+ * Load repeating transactions and augment them with additional data.
178
+ */
179
+ loadRepeatingTransactions = async () => {
180
+ try {
181
+ const e = await this.api.getRepeatingTransactions();
182
+ i(() => {
183
+ this.repeatingTransactions = u(
184
+ this.globalStore.accountStore.visibleAccounts,
185
+ e,
186
+ this.globalStore.transactionStore.transactions
187
+ ), this.isDataLoaded = !0;
188
+ });
189
+ } catch (e) {
190
+ console.error(`Error occurred while getting repeating transactions: ${e}`);
191
+ }
192
+ };
193
+ /**
194
+ * Add a new repeating transaction and link it to the associated transaction.
195
+ * @param repeatingTransaction - The repeating transaction to add.
196
+ * @param transaction - The transaction associated with the repeating transaction.
197
+ */
198
+ addRepeatingTransaction = async (e, t) => {
199
+ try {
200
+ const n = await this.api.addRepeatingTransaction(e);
201
+ await this.globalStore.transactionStore.updateTransaction({
202
+ ...t,
203
+ repeating_transaction_guid: n.guid
204
+ }), i(() => {
205
+ this.repeatingTransactions = [
206
+ ...this.repeatingTransactions,
207
+ ...u(
208
+ this.globalStore.accountStore.visibleAccounts,
209
+ [n],
210
+ this.globalStore.transactionStore.transactions
211
+ )
212
+ ];
213
+ });
214
+ } catch (n) {
215
+ console.error(`Error occurred while adding repeating transaction: ${n}`);
216
+ }
217
+ };
218
+ /**
219
+ * Delete a repeating transaction by its GUID.
220
+ * @param guid - The GUID of the repeating transaction to delete.
221
+ */
222
+ deleteRepeatingTransaction = async (e) => {
223
+ try {
224
+ await this.api.deleteRepeatingTransaction(e), i(() => {
225
+ this.repeatingTransactions = [
226
+ ...this.repeatingTransactions.filter((t) => t.guid !== e)
227
+ ];
228
+ });
229
+ } catch (t) {
230
+ console.error(`Error occurred while deleting repeating transaction: ${t}`);
231
+ }
232
+ };
233
+ /**
234
+ * Update an existing repeating transaction.
235
+ * @param transaction - The repeating transaction to update.
236
+ */
237
+ updateRepeatingTransaction = async (e) => {
238
+ try {
239
+ const t = await this.api.updateRepeatingTransaction(e), n = this.repeatingTransactions.findIndex(
240
+ (T) => T.guid === t.guid
241
+ );
242
+ if (n < 0) return;
243
+ i(() => {
244
+ this.repeatingTransactions = [
245
+ ...this.repeatingTransactions.slice(0, n),
246
+ ...u(
247
+ this.globalStore.accountStore.visibleAccounts,
248
+ [t],
249
+ this.globalStore.transactionStore.transactions
250
+ ),
251
+ ...this.repeatingTransactions.slice(n + 1)
252
+ ];
253
+ });
254
+ } catch (t) {
255
+ console.error(`Error occurred while updating repeating transaction: ${t}`);
256
+ }
257
+ };
258
+ }
259
+ export {
260
+ C as R,
261
+ E as S,
262
+ U as T
263
+ };