@mx-cartographer/experiences 8.0.25 → 8.1.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 (146) hide show
  1. package/CHANGELOG.md +4 -9
  2. package/dist/{AccountApi-ChQr5PAZ.mjs → AccountApi-WEM2M9tg.mjs} +1 -1
  3. package/dist/{AccountDetailsHeader-D9gbTbUt.mjs → AccountDetailsHeader-IPRH6Wja.mjs} +2 -2
  4. package/dist/{AccountFields-CxqONzjY.mjs → AccountFields-BbPSfzru.mjs} +3 -3
  5. package/dist/{AccountListItem-D9WJDbZ1.mjs → AccountListItem-qpACFl6i.mjs} +2 -2
  6. package/dist/{AccountStore-B7zfcad7.mjs → AccountStore-BeEiLNhW.mjs} +2 -2
  7. package/dist/Analytics-CjZ0emfs.mjs +53 -0
  8. package/dist/{Fetch-B6tMJC1r.mjs → ApiEndpoints-C5IA97i7.mjs} +48 -50
  9. package/dist/{BeatApi-EFHXULDx.mjs → BeatApi-C6pBa0Rb.mjs} +1 -1
  10. package/dist/{BeatStore-C6CAT-ce.mjs → BeatStore-DuvvrljY.mjs} +1 -1
  11. package/dist/{BudgetUtil-DZpOoZQa.mjs → BudgetUtil-CLh4xtj4.mjs} +60 -60
  12. package/dist/CategoryApi-CogDFScz.mjs +29 -0
  13. package/dist/{CategorySelectorDrawer-Dc9Widy9.mjs → CategorySelectorDrawer-BG04ByUx.mjs} +1 -1
  14. package/dist/CategoryStore-Bp1kO9Z-.mjs +160 -0
  15. package/dist/{CategoryUtil-BVixr0d5.mjs → CategoryUtil-DKRCegQv.mjs} +1 -1
  16. package/dist/{CurrencyInput-DuMktPu3.mjs → CurrencyInput-BkNVHxSV.mjs} +14 -13
  17. package/dist/{CurrencyText-CA-E5N_y.mjs → CurrencyText-oqd6cX3M.mjs} +1 -1
  18. package/dist/{DateFormats-BMpMrZpW.mjs → DateFormats-CaOj_4eI.mjs} +1 -1
  19. package/dist/{DateUtil-wcYTmDRD.mjs → DateUtil-C57sqxn4.mjs} +1 -1
  20. package/dist/{EmbeddedCard-qwIhF1VP.mjs → EmbeddedCard-j7IGx3s1.mjs} +5 -5
  21. package/dist/{ExportCsvAction-CHCmCCqf.mjs → ExportCsvAction-7sjz7AXQ.mjs} +1 -1
  22. package/dist/FinstrongApi-FpmsS_sy.mjs +19 -0
  23. package/dist/{FinstrongStore-BQxXxxYD.mjs → FinstrongStore-DgyDJTEP.mjs} +121 -137
  24. package/dist/GlobalCopyApi-DkS-2Zf_.mjs +41 -0
  25. package/dist/Goal-MFBpoOIC.mjs +29 -0
  26. package/dist/{GoalStore-fgXt--2Y.mjs → GoalStore-DcaT4fM6.mjs} +81 -104
  27. package/dist/{Help-BkmSY96v.mjs → Help-cTsMzSQh.mjs} +1 -1
  28. package/dist/{LineChart-EAr5ox5U.mjs → LineChart-DkD_s9NN.mjs} +1 -1
  29. package/dist/Localization-C_HZg9tJ.mjs +15 -0
  30. package/dist/Localization-CkQ49EKr.mjs +26 -0
  31. package/dist/{ManageIncome-DqqI9HB1.mjs → ManageIncome-DwSE_a8L.mjs} +20 -20
  32. package/dist/MerchantApi-D8ahYxiG.mjs +15 -0
  33. package/dist/MerchantStore-CyZTv-BM.mjs +26 -0
  34. package/dist/{NetWorthStore-BqZ44-4M.mjs → NetWorthStore-Ba3q3VcH.mjs} +1 -1
  35. package/dist/NotificationApi-DF0obHoR.mjs +20 -0
  36. package/dist/{NotificationSettings-DBT37CVB.mjs → NotificationSettings-DB-eNgSv.mjs} +3 -3
  37. package/dist/NotificationStore-DlAM5Ue0.mjs +69 -0
  38. package/dist/{NumberFormatting-QCaNwbjv.mjs → NumberFormatting-CyrvFgfd.mjs} +1 -1
  39. package/dist/{OriginalBalanceAction-DjpvVVFz.mjs → OriginalBalanceAction-AB1TGb5P.mjs} +2 -2
  40. package/dist/{RecurringSettings-OBGLelZQ.mjs → RecurringSettings-CZKeZC4m.mjs} +8 -8
  41. package/dist/{RecurringTransactions-BbZ6MQsX.mjs → RecurringTransactions-kzlU8OFY.mjs} +5 -5
  42. package/dist/{RecurringTransactionsStore-BE_eUfTC.mjs → RecurringTransactionsStore-D62Dt2BF.mjs} +76 -90
  43. package/dist/{RepeatingTransaction-DF4vJn_v.mjs → RepeatingTransaction-D2gmBTd0.mjs} +3 -3
  44. package/dist/RepeatingTransactionsApi-BNZgZPLs.mjs +17 -0
  45. package/dist/SettingsApi-D9d7SLhB.mjs +22 -0
  46. package/dist/{SettingsStore-BoIoiRLj.mjs → SettingsStore-Dsz1mvd3.mjs} +41 -60
  47. package/dist/{SpendingData-Bz1bCWAs.mjs → SpendingData-CoZOmlZD.mjs} +1 -1
  48. package/dist/{SpendingLegend-CypdabwS.mjs → SpendingLegend-DljKEG69.mjs} +2 -2
  49. package/dist/{Transaction-C3Pg9TKf.mjs → Transaction-Cn5_iFm0.mjs} +2 -2
  50. package/dist/{TransactionApi-Ck5Ua-7F.mjs → TransactionApi-CLG2eSNe.mjs} +1 -1
  51. package/dist/{TransactionDetails-I1ny1ecc.mjs → TransactionDetails-CN-yZkin.mjs} +9 -9
  52. package/dist/{TransactionStore-BUsgGRL1.mjs → TransactionStore-6ovFO8P1.mjs} +10 -10
  53. package/dist/{TrendsStore-CYdTo7cN.mjs → TrendsStore-DZa6cyQC.mjs} +1 -1
  54. package/dist/{ViewMoreMicroCard-BJOZcYnB.mjs → ViewMoreMicroCard-BsEitNRJ.mjs} +10 -9
  55. package/dist/WidgetApi-C0BA2cFX.mjs +102 -0
  56. package/dist/{WidgetContainer-DYKMArWw.mjs → WidgetContainer-Bc75FqK7.mjs} +1 -1
  57. package/dist/accounts/index.d.ts +0 -1
  58. package/dist/accounts/index.es.js +63 -65
  59. package/dist/accounts/stores/AccountStore.d.ts +1 -1
  60. package/dist/budgets/index.es.js +11 -11
  61. package/dist/budgets/store/BudgetsStore.d.ts +1 -1
  62. package/dist/cashflow/index.d.ts +0 -1
  63. package/dist/cashflow/index.es.js +428 -449
  64. package/dist/categories/index.es.js +2 -2
  65. package/dist/categories/stores/CategoryStore.d.ts +2 -1
  66. package/dist/common/constants/index.d.ts +0 -1
  67. package/dist/common/index.d.ts +0 -1
  68. package/dist/common/index.es.js +389 -521
  69. package/dist/common/stores/AppDataStore.d.ts +2 -2
  70. package/dist/common/stores/ConnectStore.d.ts +1 -1
  71. package/dist/common/stores/GlobalCopyStore.d.ts +1 -1
  72. package/dist/common/stores/UserStore.d.ts +1 -1
  73. package/dist/common/utils/Localization.d.ts +0 -9
  74. package/dist/common/utils/index.d.ts +1 -2
  75. package/dist/{accounts → core}/api/AccountApi.d.ts +2 -2
  76. package/dist/{common → core}/api/AnalyticsApi.d.ts +1 -1
  77. package/dist/{common → core}/api/AppDataApi.d.ts +2 -2
  78. package/dist/{common → core}/api/BannerApi.d.ts +1 -1
  79. package/dist/{common → core}/api/BeatApi.d.ts +2 -2
  80. package/dist/{budgets → core}/api/BudgetsApi.d.ts +2 -2
  81. package/dist/{common → core}/api/CategoryApi.d.ts +2 -2
  82. package/dist/{finstrong → core}/api/FinstrongApi.d.ts +2 -2
  83. package/dist/{common → core}/api/GlobalCopyApi.d.ts +2 -2
  84. package/dist/{goals → core}/api/GoalApi.d.ts +2 -2
  85. package/dist/{help → core}/api/HelpApi.d.ts +2 -2
  86. package/dist/{investments → core}/api/HoldingApi.d.ts +2 -2
  87. package/dist/{merchants → core}/api/MerchantApi.d.ts +2 -2
  88. package/dist/{common → core}/api/NotificationApi.d.ts +2 -2
  89. package/dist/{recurringtransactions → core}/api/RepeatingTransactionsApi.d.ts +2 -2
  90. package/dist/{common → core}/api/ScheduledPaymentsApi.d.ts +2 -2
  91. package/dist/{settings → core}/api/SettingsApi.d.ts +2 -2
  92. package/dist/{transactions → core}/api/TransactionApi.d.ts +2 -2
  93. package/dist/{common → core}/api/UserApi.d.ts +2 -2
  94. package/dist/{common → core}/api/WidgetApi.d.ts +1 -1
  95. package/dist/core/api/index.d.ts +20 -0
  96. package/dist/{common → core}/constants/ApiEndpoints.d.ts +0 -2
  97. package/dist/core/constants/index.d.ts +1 -0
  98. package/dist/core/index.d.ts +2 -0
  99. package/dist/core/index.es.js +90 -38
  100. package/dist/{common → core}/utils/Fetch.d.ts +1 -1
  101. package/dist/core/utils/Localization.d.ts +9 -0
  102. package/dist/core/utils/index.d.ts +2 -0
  103. package/dist/debts/index.es.js +7 -7
  104. package/dist/{exportTransactionsToCSV-DgdB3TBt.mjs → exportTransactionsToCSV-Dnd5lVq7.mjs} +2 -2
  105. package/dist/finstrong/index.d.ts +0 -1
  106. package/dist/finstrong/index.es.js +16 -17
  107. package/dist/finstrong/stores/FinstrongStore.d.ts +1 -1
  108. package/dist/goals/index.d.ts +0 -1
  109. package/dist/goals/index.es.js +50 -51
  110. package/dist/goals/stores/GoalStore.d.ts +1 -1
  111. package/dist/help/index.es.js +2 -2
  112. package/dist/help/store/HelpStore.d.ts +1 -1
  113. package/dist/insights/index.es.js +6 -6
  114. package/dist/insights/store/BeatStore.d.ts +1 -1
  115. package/dist/investments/index.es.js +2 -2
  116. package/dist/investments/stores/HoldingStore.d.ts +1 -1
  117. package/dist/merchants/index.es.js +1 -1
  118. package/dist/merchants/stores/MerchantStore.d.ts +1 -1
  119. package/dist/microinsights/index.es.js +1 -1
  120. package/dist/microinsights/stores/CopyStore.d.ts +1 -1
  121. package/dist/microinsights/stores/InsightsMicroWidgetStore.d.ts +1 -1
  122. package/dist/networth/index.es.js +8 -8
  123. package/dist/networth/stores/NetWorthStore.d.ts +1 -1
  124. package/dist/notifications/index.es.js +5 -5
  125. package/dist/notifications/stores/NotificationStore.d.ts +2 -1
  126. package/dist/recurringtransactions/index.es.js +26 -25
  127. package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +1 -1
  128. package/dist/settings/index.d.ts +0 -1
  129. package/dist/settings/index.es.js +65 -66
  130. package/dist/settings/stores/SettingsStore.d.ts +2 -2
  131. package/dist/spending/index.es.js +6 -6
  132. package/dist/transactions/index.d.ts +0 -1
  133. package/dist/transactions/index.es.js +22 -24
  134. package/dist/transactions/stores/TransactionStore.d.ts +3 -2
  135. package/dist/trends/index.es.js +14 -14
  136. package/package.json +1 -1
  137. package/dist/CategoryStore-FTxUbn0f.mjs +0 -186
  138. package/dist/Goal-0loDagc5.mjs +0 -6
  139. package/dist/Localization-CPkpIwIx.mjs +0 -37
  140. package/dist/MerchantStore-BzGi4JAZ.mjs +0 -37
  141. package/dist/NotificationStore-D_e8zo5M.mjs +0 -86
  142. package/dist/cashflow/api/CashflowApi.d.ts +0 -13
  143. package/dist/common/api/LocalizedCopyApi.d.ts +0 -8
  144. package/dist/common/api/index.d.ts +0 -10
  145. package/dist/repeatingTransactions-DHIG94pi.mjs +0 -4
  146. package/dist/useCombineEvents-Bqojlv8q.mjs +0 -92
@@ -0,0 +1,69 @@
1
+ import { makeAutoObservable as c, observable as f, runInAction as l } from "mobx";
2
+ import { N as s } from "./NotificationApi-DF0obHoR.mjs";
3
+ import { fromUnixTime as a, isSameDay as u } from "date-fns";
4
+ import { I as d } from "./Notification-DTNYSd8P.mjs";
5
+ let n = null;
6
+ const _ = () => (n || (n = new Set(
7
+ Object.values(d).filter(
8
+ (t) => typeof t == "number"
9
+ )
10
+ )), n), g = (t, i) => {
11
+ const e = a(i[t].delivered_at), o = a(i[t - 1]?.delivered_at);
12
+ return !u(e, o);
13
+ };
14
+ function h(t) {
15
+ const e = Math.floor(Date.now() / 1e3);
16
+ return t.filter((o) => {
17
+ const r = o.delivered_at;
18
+ return e - r <= 2592e3;
19
+ });
20
+ }
21
+ class v {
22
+ globalStore;
23
+ api = new s("/", "");
24
+ isLoading = !0;
25
+ notifications = [];
26
+ notificationsLoaded = !1;
27
+ constructor(i) {
28
+ this.globalStore = i, this.api = new s(
29
+ i.endpoint,
30
+ i.sessionToken,
31
+ i.onError
32
+ ), c(this, { notifications: f });
33
+ }
34
+ // Used in Money Dashboard
35
+ get newNotifications() {
36
+ return this.recentNotifications.filter((i) => !i.has_been_viewed);
37
+ }
38
+ get recentNotifications() {
39
+ return h(this.notifications);
40
+ }
41
+ setNotifications = (i) => {
42
+ this.notifications = i, this.notificationsLoaded = !0;
43
+ };
44
+ loadNotifications = async () => {
45
+ this.isLoading = !0;
46
+ try {
47
+ const i = await this.api.getNotifications();
48
+ this.setNotifications(i);
49
+ } catch (i) {
50
+ console.error(`Error occurred while loading notifications: ${i}`);
51
+ } finally {
52
+ l(() => {
53
+ this.isLoading = !1;
54
+ });
55
+ }
56
+ };
57
+ markAllAsViewed = async () => {
58
+ await this.api.markAllAsViewed();
59
+ };
60
+ updateNotification = async (i) => {
61
+ i.has_been_viewed = !0, await this.api.updateNotification(i);
62
+ };
63
+ }
64
+ export {
65
+ v as N,
66
+ h as f,
67
+ _ as g,
68
+ g as s
69
+ };
@@ -1,5 +1,5 @@
1
1
  import o from "numeral";
2
- import { g as a } from "./Localization-CPkpIwIx.mjs";
2
+ import { g as a } from "./Localization-C_HZg9tJ.mjs";
3
3
  const D = 9999999999e-2;
4
4
  var c = /* @__PURE__ */ ((t) => (t.CAD = "CAD", t.USD = "USD", t))(c || {});
5
5
  const h = (t, r, e) => {
@@ -4,8 +4,8 @@ import { observer as p } from "mobx-react-lite";
4
4
  import v from "@mui/material/TextField";
5
5
  import { L as y } from "./ListItemAction-4KB7P75M.mjs";
6
6
  import { u as h, k as b } from "./hooks-BxkfR-Ff.mjs";
7
- import { a as T, f as S } from "./NumberFormatting-QCaNwbjv.mjs";
8
- import { C as f } from "./CurrencyInput-DuMktPu3.mjs";
7
+ import { a as T, f as S } from "./NumberFormatting-CyrvFgfd.mjs";
8
+ import { C as f } from "./CurrencyInput-BkNVHxSV.mjs";
9
9
  const F = p(({ goal: e }) => {
10
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
11
  const n = { ...e, interest_rate: t };
@@ -1,15 +1,15 @@
1
- import { jsx as e, Fragment as x, jsxs as t } from "react/jsx-runtime";
1
+ import { jsx as e, Fragment as b, jsxs as t } from "react/jsx-runtime";
2
2
  import u from "react";
3
3
  import { observer as h } from "mobx-react-lite";
4
4
  import c from "@mui/material/Box";
5
5
  import p from "@mui/material/Tab";
6
- import R from "@mui/material/Tabs";
6
+ import x from "@mui/material/Tabs";
7
7
  import d from "@mui/material/Divider";
8
- import b from "@mui/material/List";
8
+ import R from "@mui/material/List";
9
9
  import T from "@mui/material/Stack";
10
- import { R as C, A as S, a as E, M as v } from "./ManageIncome-DqqI9HB1.mjs";
10
+ import { R as C, A as S, a as E, M as v } from "./ManageIncome-DwSE_a8L.mjs";
11
11
  import { u as _, i as A, g as f } from "./hooks-BxkfR-Ff.mjs";
12
- import { R as y, F as N } from "./RepeatingTransaction-DF4vJn_v.mjs";
12
+ import { b as y, F as N } from "./RepeatingTransaction-D2gmBTd0.mjs";
13
13
  import { A as m } from "./Analytics-0Xm_BjHU.mjs";
14
14
  const I = h(() => {
15
15
  const { recurring: g } = _(), { detailedRepeatingTransactions: n } = A(), { onEvent: a } = f(), l = (r) => {
@@ -21,7 +21,7 @@ const I = h(() => {
21
21
  }, i = n.filter(
22
22
  (r) => r.repeating_transaction_type !== y.Income && (r.transactions.length > 0 || r.recurrence_type === N.EveryYear)
23
23
  );
24
- return /* @__PURE__ */ e(x, { children: i.length !== 0 ? /* @__PURE__ */ t(
24
+ return /* @__PURE__ */ e(b, { children: i.length !== 0 ? /* @__PURE__ */ t(
25
25
  T,
26
26
  {
27
27
  sx: {
@@ -29,7 +29,7 @@ const I = h(() => {
29
29
  maxHeight: "calc(100vh - 109px)"
30
30
  },
31
31
  children: [
32
- /* @__PURE__ */ e(c, { sx: { flex: 1, overflow: "auto" }, children: /* @__PURE__ */ e(b, { sx: { bgcolor: "background.paper" }, children: i.map((r, s) => /* @__PURE__ */ t(u.Fragment, { children: [
32
+ /* @__PURE__ */ e(c, { sx: { flex: 1, overflow: "auto" }, children: /* @__PURE__ */ e(R, { sx: { bgcolor: "background.paper" }, children: i.map((r, s) => /* @__PURE__ */ t(u.Fragment, { children: [
33
33
  /* @__PURE__ */ e(C, { onClick: l, repeatingTransaction: r }),
34
34
  /* @__PURE__ */ e(
35
35
  d,
@@ -62,7 +62,7 @@ const I = h(() => {
62
62
  const [n, a] = u.useState(g), { onEvent: l } = f(), { recurring: o } = _();
63
63
  return /* @__PURE__ */ t(c, { bgcolor: "background.default", height: "100%", children: [
64
64
  /* @__PURE__ */ t(
65
- R,
65
+ x,
66
66
  {
67
67
  onChange: (r, s) => {
68
68
  a(s), l(
@@ -32,11 +32,11 @@ import { subMonths as X } from "date-fns/subMonths";
32
32
  import { subQuarters as B } from "date-fns/subQuarters";
33
33
  import { subWeeks as Z } from "date-fns/subWeeks";
34
34
  import { subYears as ee } from "date-fns/subYears";
35
- import { g as te, a as re, b as ae, c as oe, d as se, e as ne, f as ce } from "./DateUtil-wcYTmDRD.mjs";
36
- import { F as n, a as g, R as ie, b as Y } from "./RepeatingTransaction-DF4vJn_v.mjs";
37
- import { b as N } from "./NumberFormatting-QCaNwbjv.mjs";
38
- import { b as h } from "./Localization-CPkpIwIx.mjs";
39
- import { f as v, D as k } from "./DateFormats-BMpMrZpW.mjs";
35
+ import { g as te, a as re, b as ae, c as oe, d as se, e as ne, f as ce } from "./DateUtil-C57sqxn4.mjs";
36
+ import { F as n, R as g, b as ie, a as Y } from "./RepeatingTransaction-D2gmBTd0.mjs";
37
+ import { b as N } from "./NumberFormatting-CyrvFgfd.mjs";
38
+ import { b as h } from "./Localization-CkQ49EKr.mjs";
39
+ import { f as v, D as k } from "./DateFormats-CaOj_4eI.mjs";
40
40
  const ue = ({ iconName: e, label: o, onClick: r, value: a }) => {
41
41
  const t = /* @__PURE__ */ O(L, { children: [
42
42
  /* @__PURE__ */ d(F, { children: /* @__PURE__ */ d(R, { sx: { bgcolor: "neutral.light" }, variant: "rounded", children: /* @__PURE__ */ d(w, { name: e, sx: { color: "text.primary" } }) }) }),
@@ -1,47 +1,33 @@
1
- import { makeAutoObservable as R, runInAction as c } from "mobx";
1
+ import { makeAutoObservable as T, runInAction as o } from "mobx";
2
2
  import { endOfMonth as f } from "date-fns/endOfMonth";
3
- import { isAfter as g } from "date-fns/isAfter";
4
- import { isBefore as S } from "date-fns/isBefore";
5
- import { isSameDay as p } from "date-fns/isSameDay";
6
- import { isWithinInterval as m } from "date-fns/isWithinInterval";
7
- import { startOfMonth as y } from "date-fns/startOfMonth";
3
+ import { isAfter as u } from "date-fns/isAfter";
4
+ import { isBefore as R } from "date-fns/isBefore";
5
+ import { isSameDay as g } from "date-fns/isSameDay";
6
+ import { isWithinInterval as h } from "date-fns/isWithinInterval";
7
+ import { startOfMonth as x } from "date-fns/startOfMonth";
8
8
  import { startOfToday as i } from "date-fns/startOfToday";
9
- import { subDays as I } from "date-fns/subDays";
10
- import { F as x, A as o } from "./Fetch-B6tMJC1r.mjs";
11
- import { a as u, b as A } from "./RecurringTransactions-BbZ6MQsX.mjs";
12
- import { a as r, b as d } from "./RepeatingTransaction-DF4vJn_v.mjs";
13
- var E = /* @__PURE__ */ ((a) => (a.Small = "small", a.Medium = "medium", a.Large = "large", a))(E || {});
14
- const U = 44;
15
- class h {
16
- fetchInstance;
17
- constructor(t, e, n) {
18
- this.fetchInstance = new x(t, e, void 0, n);
19
- }
20
- addRepeatingTransaction = async (t) => this.fetchInstance.post(o.REPEATING_TRANSACTIONS, t).then((e) => e.repeating_transaction);
21
- getRepeatingTransactions = async () => this.fetchInstance.get(o.REPEATING_TRANSACTIONS).then((t) => t.repeating_transactions);
22
- updateRepeatingTransaction = async (t) => this.fetchInstance.put(
23
- `${o.REPEATING_TRANSACTIONS}/${t.guid}`,
24
- t
25
- ).then((e) => e.repeating_transaction);
26
- deleteRepeatingTransaction = async (t) => this.fetchInstance.delete(`${o.REPEATING_TRANSACTIONS}/${t}`).then((e) => e);
27
- }
28
- const l = (a, t) => m(t.expectedDate, a), s = (a, t) => a + t.amount;
29
- class F {
9
+ import { subDays as S } from "date-fns/subDays";
10
+ import { R as p } from "./RepeatingTransactionsApi-BNZgZPLs.mjs";
11
+ import { a as c, b as y } from "./RecurringTransactions-kzlU8OFY.mjs";
12
+ import { R as a, a as l } from "./RepeatingTransaction-D2gmBTd0.mjs";
13
+ var D = /* @__PURE__ */ ((n) => (n.Small = "small", n.Medium = "medium", n.Large = "large", n))(D || {});
14
+ const L = 44, d = (n, e) => h(e.expectedDate, n), s = (n, e) => n + e.amount;
15
+ class k {
30
16
  globalStore;
31
- api = new h("/", "");
17
+ api = new p("/", "");
32
18
  repeatingTransactions = [];
33
19
  isDataLoaded = !1;
34
20
  selectedDay;
35
- dateRange = { start: y(i()), end: f(i()) };
36
- constructor(t) {
37
- this.globalStore = t, this.api = new h(
38
- t.endpoint,
39
- t.sessionToken,
40
- t.onError
41
- ), R(this);
21
+ dateRange = { start: x(i()), end: f(i()) };
22
+ constructor(e) {
23
+ this.globalStore = e, this.api = new p(
24
+ e.endpoint,
25
+ e.sessionToken,
26
+ e.onError
27
+ ), T(this);
42
28
  }
43
29
  get detailedRepeatingTransactions() {
44
- return u(
30
+ return c(
45
31
  this.globalStore.accountStore.visibleAccounts,
46
32
  this.repeatingTransactions,
47
33
  this.globalStore.transactionStore.transactions
@@ -51,15 +37,15 @@ class F {
51
37
  * Returns all recurrences built from repeating transactions and filtered by accounts.
52
38
  */
53
39
  get recurrences() {
54
- const t = this.globalStore.accountStore.visibleAccounts;
55
- return A(this.detailedRepeatingTransactions, this.dateRange).filter((e) => t.some((n) => n.guid === e.accountGuid && !n.is_excluded_from_accounts)).filter((e) => m(e.expectedDate, this.dateRange));
40
+ const e = this.globalStore.accountStore.visibleAccounts;
41
+ return y(this.detailedRepeatingTransactions, this.dateRange).filter((t) => e.some((r) => r.guid === t.accountGuid && !r.is_excluded_from_accounts)).filter((t) => h(t.expectedDate, this.dateRange));
56
42
  }
57
43
  /**
58
44
  * Returns all recurrences that have occurred in the past, including those that are paid or missed
59
45
  */
60
46
  get pastRecurrences() {
61
47
  return this.recurrences.filter(
62
- (t) => t.status === r.Paid || t.status === r.Missed
48
+ (e) => e.status === a.Paid || e.status === a.Missed
63
49
  );
64
50
  }
65
51
  /**
@@ -68,7 +54,7 @@ class F {
68
54
  */
69
55
  get upcomingRecurrences() {
70
56
  return this.recurrences.filter(
71
- (t) => g(t.expectedDate, I(i(), 3)) && S(t.expectedDate, this.dateRange.end) && t.status === r.Upcoming
57
+ (e) => u(e.expectedDate, S(i(), 3)) && R(e.expectedDate, this.dateRange.end) && e.status === a.Upcoming
72
58
  );
73
59
  }
74
60
  /**
@@ -76,7 +62,7 @@ class F {
76
62
  */
77
63
  get expenses() {
78
64
  return this.recurrences.filter(
79
- (t) => t.type === d.Expense
65
+ (e) => e.type === l.Expense
80
66
  );
81
67
  }
82
68
  /**
@@ -84,7 +70,7 @@ class F {
84
70
  */
85
71
  get upcomingExpenses() {
86
72
  return this.expenses.filter(
87
- (t) => t.status === r.Upcoming
73
+ (e) => e.status === a.Upcoming
88
74
  );
89
75
  }
90
76
  /**
@@ -92,7 +78,7 @@ class F {
92
78
  */
93
79
  get income() {
94
80
  return this.recurrences.filter(
95
- (t) => t.type === d.Income
81
+ (e) => e.type === l.Income
96
82
  );
97
83
  }
98
84
  /**
@@ -100,18 +86,18 @@ class F {
100
86
  */
101
87
  get upcomingIncome() {
102
88
  return this.income.filter(
103
- (t) => t.status === r.Upcoming
89
+ (e) => e.status === a.Upcoming
104
90
  );
105
91
  }
106
92
  get nextIncomeRecurrence() {
107
- return this.upcomingIncome.find((t) => g(t.expectedDate, i()));
93
+ return this.upcomingIncome.find((e) => u(e.expectedDate, i()));
108
94
  }
109
95
  /**
110
96
  * Returns the expense recurrences for the current month.
111
97
  */
112
98
  get currentMonthExpenses() {
113
99
  return this.expenses.filter(
114
- (t) => l(this.dateRange, t)
100
+ (e) => d(this.dateRange, e)
115
101
  );
116
102
  }
117
103
  /**
@@ -119,7 +105,7 @@ class F {
119
105
  */
120
106
  get currentMonthIncome() {
121
107
  return this.income.filter(
122
- (t) => l(this.dateRange, t)
108
+ (e) => d(this.dateRange, e)
123
109
  );
124
110
  }
125
111
  /**
@@ -132,19 +118,19 @@ class F {
132
118
  * Calculates the total amount of all paid expenses for the current month.
133
119
  */
134
120
  get paidExpenseTotal() {
135
- return this.currentMonthExpenses.filter((t) => t.status === r.Paid).reduce(s, 0);
121
+ return this.currentMonthExpenses.filter((e) => e.status === a.Paid).reduce(s, 0);
136
122
  }
137
123
  /**
138
124
  * Calculates the total amount of all missed expenses for the current month.
139
125
  */
140
126
  get missedExpenseTotal() {
141
- return this.currentMonthExpenses.filter((t) => t.status === r.Missed).reduce(s, 0);
127
+ return this.currentMonthExpenses.filter((e) => e.status === a.Missed).reduce(s, 0);
142
128
  }
143
129
  /**
144
130
  * Calculates the total amount of all upcoming expenses for the current month.
145
131
  */
146
132
  get upcomingExpenseTotal() {
147
- return this.currentMonthExpenses.filter((t) => t.status === r.Upcoming).reduce(s, 0);
133
+ return this.currentMonthExpenses.filter((e) => e.status === a.Upcoming).reduce(s, 0);
148
134
  }
149
135
  /**
150
136
  * Calculates the total amount of all income for the current month.
@@ -156,36 +142,36 @@ class F {
156
142
  * Calculates the total amount of all paid income for the current month.
157
143
  */
158
144
  get paidIncomeTotal() {
159
- return this.currentMonthIncome.filter((t) => t.status === r.Paid).reduce(s, 0);
145
+ return this.currentMonthIncome.filter((e) => e.status === a.Paid).reduce(s, 0);
160
146
  }
161
147
  /**
162
148
  * Calculates the total amount of all upcoming income for the current month.
163
149
  */
164
150
  get upcomingIncomeTotal() {
165
- return this.currentMonthIncome.filter((t) => t.status === r.Upcoming).reduce(s, 0);
151
+ return this.currentMonthIncome.filter((e) => e.status === a.Upcoming).reduce(s, 0);
166
152
  }
167
153
  /**
168
154
  * Get the recurrences for the currently selected day.
169
155
  */
170
156
  get selectedDayRecurrences() {
171
157
  return this.selectedDay && this.recurrences.filter(
172
- (t) => this.selectedDay && p(t.occurredOnDate || t.expectedDate, this.selectedDay)
158
+ (e) => this.selectedDay && g(e.occurredOnDate || e.expectedDate, this.selectedDay)
173
159
  );
174
160
  }
175
- setRepeatingTransactions = (t) => {
176
- this.repeatingTransactions = t, this.isDataLoaded = !0;
161
+ setRepeatingTransactions = (e) => {
162
+ this.repeatingTransactions = e, this.isDataLoaded = !0;
177
163
  };
178
164
  /**
179
165
  * Set the date range for filtering recurrences.
180
166
  * @param dateRange - The date range to set.
181
167
  */
182
- setDateRange = (t) => this.dateRange = t;
168
+ setDateRange = (e) => this.dateRange = e;
183
169
  /**
184
170
  * Set the currently selected day.
185
171
  * @param day - The day to select.
186
172
  */
187
- setSelectedDay = (t) => {
188
- this.selectedDay = this.selectedDay && p(t, this.selectedDay) ? void 0 : t;
173
+ setSelectedDay = (e) => {
174
+ this.selectedDay = this.selectedDay && g(e, this.selectedDay) ? void 0 : e;
189
175
  };
190
176
  loadRepeatingTransactionData = async () => {
191
177
  await Promise.all([
@@ -199,10 +185,10 @@ class F {
199
185
  */
200
186
  loadRepeatingTransactions = async () => {
201
187
  try {
202
- const t = await this.api.getRepeatingTransactions();
203
- this.setRepeatingTransactions(t);
204
- } catch (t) {
205
- console.error(`Error occurred while getting repeating transactions: ${t}`);
188
+ const e = await this.api.getRepeatingTransactions();
189
+ this.setRepeatingTransactions(e);
190
+ } catch (e) {
191
+ console.error(`Error occurred while getting repeating transactions: ${e}`);
206
192
  }
207
193
  };
208
194
  /**
@@ -210,69 +196,69 @@ class F {
210
196
  * @param repeatingTransaction - The repeating transaction to add.
211
197
  * @param transaction - The transaction associated with the repeating transaction.
212
198
  */
213
- addRepeatingTransaction = async (t, e) => {
199
+ addRepeatingTransaction = async (e, t) => {
214
200
  try {
215
- const n = await this.api.addRepeatingTransaction(t);
201
+ const r = await this.api.addRepeatingTransaction(e);
216
202
  await this.globalStore.transactionStore.updateTransaction({
217
- ...e,
218
- repeating_transaction_guid: n.guid
219
- }), c(() => {
203
+ ...t,
204
+ repeating_transaction_guid: r.guid
205
+ }), o(() => {
220
206
  this.repeatingTransactions = [
221
207
  ...this.repeatingTransactions,
222
- ...u(
208
+ ...c(
223
209
  this.globalStore.accountStore.visibleAccounts,
224
- [n],
210
+ [r],
225
211
  this.globalStore.transactionStore.transactions
226
212
  )
227
213
  ];
228
214
  });
229
- } catch (n) {
230
- console.error(`Error occurred while adding repeating transaction: ${n}`);
215
+ } catch (r) {
216
+ console.error(`Error occurred while adding repeating transaction: ${r}`);
231
217
  }
232
218
  };
233
219
  /**
234
220
  * Delete a repeating transaction by its GUID.
235
221
  * @param guid - The GUID of the repeating transaction to delete.
236
222
  */
237
- deleteRepeatingTransaction = async (t) => {
223
+ deleteRepeatingTransaction = async (e) => {
238
224
  try {
239
- await this.api.deleteRepeatingTransaction(t), c(() => {
225
+ await this.api.deleteRepeatingTransaction(e), o(() => {
240
226
  this.repeatingTransactions = [
241
- ...this.repeatingTransactions.filter((e) => e.guid !== t)
227
+ ...this.repeatingTransactions.filter((t) => t.guid !== e)
242
228
  ];
243
229
  });
244
- } catch (e) {
245
- console.error(`Error occurred while deleting repeating transaction: ${e}`);
230
+ } catch (t) {
231
+ console.error(`Error occurred while deleting repeating transaction: ${t}`);
246
232
  }
247
233
  };
248
234
  /**
249
235
  * Update an existing repeating transaction.
250
236
  * @param transaction - The repeating transaction to update.
251
237
  */
252
- updateRepeatingTransaction = async (t) => {
238
+ updateRepeatingTransaction = async (e) => {
253
239
  try {
254
- const e = await this.api.updateRepeatingTransaction(t), n = this.repeatingTransactions.findIndex(
255
- (T) => T.guid === e.guid
240
+ const t = await this.api.updateRepeatingTransaction(e), r = this.repeatingTransactions.findIndex(
241
+ (m) => m.guid === t.guid
256
242
  );
257
- if (n < 0) return;
258
- c(() => {
243
+ if (r < 0) return;
244
+ o(() => {
259
245
  this.repeatingTransactions = [
260
- ...this.repeatingTransactions.slice(0, n),
261
- ...u(
246
+ ...this.repeatingTransactions.slice(0, r),
247
+ ...c(
262
248
  this.globalStore.accountStore.visibleAccounts,
263
- [e],
249
+ [t],
264
250
  this.globalStore.transactionStore.transactions
265
251
  ),
266
- ...this.repeatingTransactions.slice(n + 1)
252
+ ...this.repeatingTransactions.slice(r + 1)
267
253
  ];
268
254
  });
269
- } catch (e) {
270
- console.error(`Error occurred while updating repeating transaction: ${e}`);
255
+ } catch (t) {
256
+ console.error(`Error occurred while updating repeating transaction: ${t}`);
271
257
  }
272
258
  };
273
259
  }
274
260
  export {
275
- F as R,
276
- E as S,
277
- U as T
261
+ k as R,
262
+ D as S,
263
+ L as T
278
264
  };
@@ -1,7 +1,7 @@
1
1
  var v = /* @__PURE__ */ ((o) => (o[o.Unknown = 0] = "Unknown", o[o.EveryWeek = 1] = "EveryWeek", o[o.EveryOtherWeek = 2] = "EveryOtherWeek", o[o.EveryMonth = 3] = "EveryMonth", o[o.EveryOtherMonth = 4] = "EveryOtherMonth", o[o.EveryQuarter = 5] = "EveryQuarter", o[o.EveryOtherQuarter = 6] = "EveryOtherQuarter", o[o.EveryYear = 7] = "EveryYear", o[o.TwiceAMonth = 8] = "TwiceAMonth", o))(v || {}), r = /* @__PURE__ */ ((o) => (o[o.Paid = 0] = "Paid", o[o.Missed = 1] = "Missed", o[o.Upcoming = 2] = "Upcoming", o))(r || {}), E = /* @__PURE__ */ ((o) => (o[o.Expense = 0] = "Expense", o[o.Income = 1] = "Income", o))(E || {}), h = /* @__PURE__ */ ((o) => (o[o.Unknown = 0] = "Unknown", o[o.Subscription = 1] = "Subscription", o[o.Bill = 2] = "Bill", o[o.Income = 3] = "Income", o[o.Transfer = 4] = "Transfer", o))(h || {});
2
2
  export {
3
3
  v as F,
4
- h as R,
5
- r as a,
6
- E as b
4
+ r as R,
5
+ E as a,
6
+ h as b
7
7
  };
@@ -0,0 +1,17 @@
1
+ import { F as s, A as e } from "./ApiEndpoints-C5IA97i7.mjs";
2
+ class r {
3
+ fetchInstance;
4
+ constructor(t, n, a) {
5
+ this.fetchInstance = new s(t, n, void 0, a);
6
+ }
7
+ addRepeatingTransaction = async (t) => this.fetchInstance.post(e.REPEATING_TRANSACTIONS, t).then((n) => n.repeating_transaction);
8
+ getRepeatingTransactions = async () => this.fetchInstance.get(e.REPEATING_TRANSACTIONS).then((t) => t.repeating_transactions);
9
+ updateRepeatingTransaction = async (t) => this.fetchInstance.put(
10
+ `${e.REPEATING_TRANSACTIONS}/${t.guid}`,
11
+ t
12
+ ).then((n) => n.repeating_transaction);
13
+ deleteRepeatingTransaction = async (t) => this.fetchInstance.delete(`${e.REPEATING_TRANSACTIONS}/${t}`).then((n) => n);
14
+ }
15
+ export {
16
+ r as R
17
+ };
@@ -0,0 +1,22 @@
1
+ import { F as s, A as n } from "./ApiEndpoints-C5IA97i7.mjs";
2
+ class r {
3
+ fetchInstance;
4
+ constructor(e, t, i) {
5
+ this.fetchInstance = new s(e, t, void 0, i);
6
+ }
7
+ deleteDevice = async (e) => this.fetchInstance.delete(`${n.DEVICES}/${e}`).then((t) => t);
8
+ generateDeviceToken = async () => this.fetchInstance.get(`${n.USER}/mobile_token`).then((e) => e.mobile_token);
9
+ getDevices = async () => this.fetchInstance.get(n.DEVICES).then((e) => e.map((t) => t.device));
10
+ getNotificationProfiles = async () => this.fetchInstance.get(n.NOTIFICATION_PROFILES).then((e) => e.notification_profiles);
11
+ // verifications endpoints respond with HTTP status codes; they error otherwise
12
+ sendEmailVerification = async () => this.fetchInstance.post(n.EMAIL_VERIFICATIONS);
13
+ sendPhoneVerification = async () => this.fetchInstance.post(n.PHONE_VERIFICATIONS + "/deliver");
14
+ verifyPhoneToken = async (e) => this.fetchInstance.post(n.PHONE_VERIFICATIONS + "/verify", { sms_verification_token: e }).then((t) => ({ verified: t.verified }));
15
+ updateDevice = async (e) => this.fetchInstance.put(`${n.DEVICES}/${e.guid}`, e).then((t) => t.device);
16
+ updateNotificationProfile = async (e) => this.fetchInstance.put(`${n.NOTIFICATION_PROFILES}/${e.guid}`, e).then((t) => t.notification_profile);
17
+ updateUserCommunicationProfile = async (e) => this.fetchInstance.put(n.USER_COMMUNICATION_PROFILE, e).then((t) => t.user_communication_profile);
18
+ getInsightsNotificationProfiles = async () => this.fetchInstance.get(`${n.NOTIFICATION_PROFILES}/${n.INSIGHTS_NOTIFICATION_PROFILES}`).then((e) => e);
19
+ }
20
+ export {
21
+ r as S
22
+ };