@mx-cartographer/experiences 6.26.18-alpha.mega4 → 6.26.18-alpha.sms2

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/dist/budgets/index.d.ts +1 -0
  2. package/dist/common/context/hooks.d.ts +13 -13
  3. package/dist/help/components/content/section/index.d.ts +15 -15
  4. package/dist/index.d.ts +22 -0
  5. package/dist/index.es.js +30336 -0
  6. package/dist/index.es.js.map +1 -0
  7. package/package.json +3 -155
  8. package/dist/Account-DM32_5k9.mjs +0 -30
  9. package/dist/AccountDetailsContent-B_qRSB8l.mjs +0 -677
  10. package/dist/AccountDetailsHeader-CAm6ADMq.mjs +0 -119
  11. package/dist/AccountFields-Bb4pds0q.mjs +0 -135
  12. package/dist/AccountListItem-G7iAesaO.mjs +0 -90
  13. package/dist/AccountStore-RSanus_m.mjs +0 -230
  14. package/dist/Accounts-BfAQRG8R.mjs +0 -9
  15. package/dist/BeatApi-DLu87ijw.mjs +0 -21
  16. package/dist/BeatStore-By4aGoRM.mjs +0 -81
  17. package/dist/BudgetUtil-DcqclhiQ.mjs +0 -101
  18. package/dist/CashflowStore-D9Dpuz7X.mjs +0 -91
  19. package/dist/Category-5S6uwuXz.mjs +0 -301
  20. package/dist/CategorySelectorDrawer-DgrePTRg.mjs +0 -397
  21. package/dist/CategoryStore-B5EW6I1d.mjs +0 -183
  22. package/dist/CategoryUtil-DRyruNgi.mjs +0 -78
  23. package/dist/ConnectDrawer-DPnfeIfn.mjs +0 -508
  24. package/dist/ConnectionsDrawer-BCzpuNsK.mjs +0 -52
  25. package/dist/CurrencyInput-DzsPiUsU.mjs +0 -83
  26. package/dist/CurrencyText-YUhH2caW.mjs +0 -20
  27. package/dist/DateUtil-BcuH7ErC.mjs +0 -48
  28. package/dist/DebtsStore-C6VcBnpG.mjs +0 -60
  29. package/dist/Dialog-CWW597AF.mjs +0 -123
  30. package/dist/Donut-1UMNcG67.mjs +0 -57
  31. package/dist/Drawer-kEE73B87.mjs +0 -113
  32. package/dist/EmptyState-Dcb-o2tl.mjs +0 -55
  33. package/dist/Fetch-CkFKy79O.mjs +0 -116
  34. package/dist/FinstrongStore-mkALvztw.mjs +0 -101
  35. package/dist/GoalStore-DyCr4wNc.mjs +0 -263
  36. package/dist/HeaderCell-DjuifqHJ.mjs +0 -6
  37. package/dist/Help-DhcC-C05.mjs +0 -320
  38. package/dist/Help-toqAK5eD.mjs +0 -3173
  39. package/dist/IconBacking-B9oC6uL2.mjs +0 -39
  40. package/dist/InvestmentUtil-jOyOgzIB.mjs +0 -134
  41. package/dist/LineChart-CQWu5KoO.mjs +0 -403
  42. package/dist/ListItemAction-Df3OPMOW.mjs +0 -69
  43. package/dist/Loader-Dp1P2gNw.mjs +0 -14
  44. package/dist/Localization-2MODESHW.mjs +0 -30
  45. package/dist/ManageIncome-BVt_XQbo.mjs +0 -535
  46. package/dist/MerchantStore-DVH-QOf0.mjs +0 -37
  47. package/dist/MicroWidgetContainer-DaLW43tE.mjs +0 -45
  48. package/dist/MiniWidgetContainer-BcNPxZt2.mjs +0 -39
  49. package/dist/NetWorthStore-DE8CQBMM.mjs +0 -150
  50. package/dist/Notification-AMGWM1Al.mjs +0 -78
  51. package/dist/NotificationSettings-CPZN0l8X.mjs +0 -667
  52. package/dist/NotificationStore-DHtSGySy.mjs +0 -67
  53. package/dist/NumberFormatting-CtWHhyBX.mjs +0 -40
  54. package/dist/OriginalBalanceAction-s9sUxofR.mjs +0 -115
  55. package/dist/RecurringSettings-DIEsympT.mjs +0 -57
  56. package/dist/RecurringTransactionsStore-BKLD3OWo.mjs +0 -263
  57. package/dist/RepeatingTransaction-BPWfaB3f.mjs +0 -282
  58. package/dist/SearchBox-B2_zLv8-.mjs +0 -42
  59. package/dist/SettingsStore-CE7jDVFL.mjs +0 -265
  60. package/dist/SingleSegmentDonut-BgbLgwHi.mjs +0 -69
  61. package/dist/SpendingData-ByFCw95X.mjs +0 -53
  62. package/dist/StatusBar-BK_uYHAB.mjs +0 -30
  63. package/dist/TabContentContainer-j01JYR_7.mjs +0 -21
  64. package/dist/Transaction-C-5-Iuab.mjs +0 -312
  65. package/dist/TransactionApi-DbbcjI2L.mjs +0 -86
  66. package/dist/TransactionDetails-B5qfs9Zh.mjs +0 -1283
  67. package/dist/TransactionStore-BWi6_2Ny.mjs +0 -669
  68. package/dist/TrendsStore-Borh98aN.mjs +0 -448
  69. package/dist/ViewMoreMicroCard-CAPFNz-J.mjs +0 -1959
  70. package/dist/WidgetContainer-CmGNZW0M.mjs +0 -548
  71. package/dist/accounts/index.es.js +0 -752
  72. package/dist/analytics/index.es.js +0 -171
  73. package/dist/budgets/index.es.js +0 -1070
  74. package/dist/cashflow/index.es.js +0 -1098
  75. package/dist/categories/index.es.js +0 -9
  76. package/dist/common/index.es.js +0 -1451
  77. package/dist/dashboard/index.es.js +0 -181
  78. package/dist/debts/index.es.js +0 -1460
  79. package/dist/exportTransactionsToCSV-j4g8bdVZ.mjs +0 -47
  80. package/dist/finstrong/index.es.js +0 -1455
  81. package/dist/goals/index.es.js +0 -1209
  82. package/dist/help/index.es.js +0 -14
  83. package/dist/hooks-ClhFlg78.mjs +0 -71
  84. package/dist/insights/index.d.ts +0 -1
  85. package/dist/insights/index.es.js +0 -4
  86. package/dist/investments/index.es.js +0 -1638
  87. package/dist/merchants/index.es.js +0 -79
  88. package/dist/microinsights/index.es.js +0 -16
  89. package/dist/networth/index.es.js +0 -542
  90. package/dist/notifications/index.es.js +0 -192
  91. package/dist/recurringtransactions/index.es.js +0 -879
  92. package/dist/settings/index.es.js +0 -879
  93. package/dist/spending/index.es.js +0 -570
  94. package/dist/transactions/index.es.js +0 -587
  95. package/dist/trends/index.es.js +0 -1103
  96. package/dist/useCombineEvents-DaDBSR_1.mjs +0 -92
  97. package/dist/useDimensions-27p2evRx.mjs +0 -36
  98. package/dist/useScreenSize-B6JyS_Lj.mjs +0 -36
@@ -1,67 +0,0 @@
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
- };
@@ -1,40 +0,0 @@
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
- };
@@ -1,115 +0,0 @@
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-Df3OPMOW.mjs";
6
- import { u as h, i as b } from "./hooks-ClhFlg78.mjs";
7
- import { a as T, f as S } from "./NumberFormatting-CtWHhyBX.mjs";
8
- import { C as f } from "./CurrencyInput-DzsPiUsU.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
- };
@@ -1,57 +0,0 @@
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-BVt_XQbo.mjs";
10
- import { u as l, f as E, g as u } from "./hooks-ClhFlg78.mjs";
11
- import { R as S, F as A } from "./RepeatingTransaction-BPWfaB3f.mjs";
12
- import { A as m } from "./WidgetContainer-CmGNZW0M.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
- };
@@ -1,263 +0,0 @@
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
- };