@mx-cartographer/experiences 9.1.0-alpha.bb1 → 9.1.1
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.
- package/CHANGELOG.md +80 -0
- package/README.md +10 -10
- package/dist/Account-DR7Plrqy.mjs +119 -0
- package/dist/Account-DR7Plrqy.mjs.map +1 -0
- package/dist/AccountDetailsDrawer-C1hhmlmI.mjs +922 -0
- package/dist/AccountDetailsDrawer-C1hhmlmI.mjs.map +1 -0
- package/dist/AccountDetailsHeader-BliEZhz7.mjs +230 -0
- package/dist/AccountDetailsHeader-BliEZhz7.mjs.map +1 -0
- package/dist/AccountUtils-Cbh8r9cP.mjs +29 -0
- package/dist/AccountUtils-Cbh8r9cP.mjs.map +1 -0
- package/dist/Analytics-CkYXKvco.mjs +54 -0
- package/dist/Analytics-CkYXKvco.mjs.map +1 -0
- package/dist/Analytics-WeZYytR0.mjs +140 -0
- package/dist/Analytics-WeZYytR0.mjs.map +1 -0
- package/dist/ApiEndpoints-DXwIYNUV.mjs +50 -0
- package/dist/ApiEndpoints-DXwIYNUV.mjs.map +1 -0
- package/dist/BeatMaterialIcon-1KOfRZrA.mjs +27 -0
- package/dist/BeatMaterialIcon-1KOfRZrA.mjs.map +1 -0
- package/dist/BudgetUtil-Bg2AQJpQ.mjs +75 -0
- package/dist/BudgetUtil-Bg2AQJpQ.mjs.map +1 -0
- package/dist/Category-DEKZGLYe.mjs +302 -0
- package/dist/Category-DEKZGLYe.mjs.map +1 -0
- package/dist/CategorySelectorDrawer-NJsFsKP1.mjs +431 -0
- package/dist/CategorySelectorDrawer-NJsFsKP1.mjs.map +1 -0
- package/dist/Connect-BH0Pt6zc.mjs +43 -0
- package/dist/Connect-BH0Pt6zc.mjs.map +1 -0
- package/dist/ConnectCard-D7uxoH5Y.mjs +55 -0
- package/dist/ConnectCard-D7uxoH5Y.mjs.map +1 -0
- package/dist/ConnectDrawer-CW4LA3H3.mjs +58 -0
- package/dist/ConnectDrawer-CW4LA3H3.mjs.map +1 -0
- package/dist/ConnectionsDrawer-CZU9ku-k.mjs +54 -0
- package/dist/ConnectionsDrawer-CZU9ku-k.mjs.map +1 -0
- package/dist/CurrencyDialog-DumQCTPO.mjs +374 -0
- package/dist/CurrencyDialog-DumQCTPO.mjs.map +1 -0
- package/dist/CurrencyInput-DaGEQaLW.mjs +88 -0
- package/dist/CurrencyInput-DaGEQaLW.mjs.map +1 -0
- package/dist/CurrencyText-CCbE6MmF.mjs +21 -0
- package/dist/CurrencyText-CCbE6MmF.mjs.map +1 -0
- package/dist/DateFormats-HudZ3Bjs.mjs +65 -0
- package/dist/DateFormats-HudZ3Bjs.mjs.map +1 -0
- package/dist/DateUtil-CzBmbjmA.mjs +75 -0
- package/dist/DateUtil-CzBmbjmA.mjs.map +1 -0
- package/dist/DebtUtils-i4pI2Uoe.mjs +154 -0
- package/dist/DebtUtils-i4pI2Uoe.mjs.map +1 -0
- package/dist/Dialog-Bvd2n8hz.mjs +67 -0
- package/dist/Dialog-Bvd2n8hz.mjs.map +1 -0
- package/dist/Donut-SzzfZDHF.mjs +89 -0
- package/dist/Donut-SzzfZDHF.mjs.map +1 -0
- package/dist/Drawer-DsnW2o0v.mjs +175 -0
- package/dist/Drawer-DsnW2o0v.mjs.map +1 -0
- package/dist/EmbeddedCard-DH8vQ3qN.mjs +859 -0
- package/dist/EmbeddedCard-DH8vQ3qN.mjs.map +1 -0
- package/dist/EmptyState-CJUDc3kD.mjs +85 -0
- package/dist/EmptyState-CJUDc3kD.mjs.map +1 -0
- package/dist/Error-Dtw6yxkf.mjs +85 -0
- package/dist/Error-Dtw6yxkf.mjs.map +1 -0
- package/dist/ErrorBoundary-CsdOcnJ9.mjs +24 -0
- package/dist/ErrorBoundary-CsdOcnJ9.mjs.map +1 -0
- package/dist/ExportCsvAction-C9KWH3Az.mjs +25 -0
- package/dist/ExportCsvAction-C9KWH3Az.mjs.map +1 -0
- package/dist/GlobalAccountFilter-BhzR5Vb1.mjs +230 -0
- package/dist/GlobalAccountFilter-BhzR5Vb1.mjs.map +1 -0
- package/dist/GlobalCopyApi-wcnDUzMV.mjs +129 -0
- package/dist/GlobalCopyApi-wcnDUzMV.mjs.map +1 -0
- package/dist/GoalsUtil-C9EnLWvC.mjs +108 -0
- package/dist/GoalsUtil-C9EnLWvC.mjs.map +1 -0
- package/dist/HeaderCell-P8w6CmfO.mjs +7 -0
- package/dist/HeaderCell-P8w6CmfO.mjs.map +1 -0
- package/dist/Help-CkQTjORd.mjs +300 -0
- package/dist/Help-CkQTjORd.mjs.map +1 -0
- package/dist/Help-aERwhajy.mjs +3210 -0
- package/dist/Help-aERwhajy.mjs.map +1 -0
- package/dist/IconBacking-DgT8DCeh.mjs +40 -0
- package/dist/IconBacking-DgT8DCeh.mjs.map +1 -0
- package/dist/InformationTooltip-4su8bn1e.mjs +42 -0
- package/dist/InformationTooltip-4su8bn1e.mjs.map +1 -0
- package/dist/InvestmentUtil-BItV7uEs.mjs +135 -0
- package/dist/InvestmentUtil-BItV7uEs.mjs.map +1 -0
- package/dist/LineChart-CUfiH86G.mjs +613 -0
- package/dist/LineChart-CUfiH86G.mjs.map +1 -0
- package/dist/ListItemAction-BqUCLj_w.mjs +70 -0
- package/dist/ListItemAction-BqUCLj_w.mjs.map +1 -0
- package/dist/ListItemRow-kH1rn8Xu.mjs +68 -0
- package/dist/ListItemRow-kH1rn8Xu.mjs.map +1 -0
- package/dist/ListItemWrapper-DRse79Iu.mjs +44 -0
- package/dist/ListItemWrapper-DRse79Iu.mjs.map +1 -0
- package/dist/Loader-CxeBwuPG.mjs +22 -0
- package/dist/Loader-CxeBwuPG.mjs.map +1 -0
- package/dist/Localization-DnoVyBNK.mjs +39 -0
- package/dist/Localization-DnoVyBNK.mjs.map +1 -0
- package/dist/ManageIncome-Be9WHv-s.mjs +906 -0
- package/dist/ManageIncome-Be9WHv-s.mjs.map +1 -0
- package/dist/MicroWidgetContainer-B2NnKBgW.mjs +46 -0
- package/dist/MicroWidgetContainer-B2NnKBgW.mjs.map +1 -0
- package/dist/MiniWidgetContainer-Bmv_WeUd.mjs +67 -0
- package/dist/MiniWidgetContainer-Bmv_WeUd.mjs.map +1 -0
- package/dist/NetWorthUtils-Dj7CgAg2.mjs +96 -0
- package/dist/NetWorthUtils-Dj7CgAg2.mjs.map +1 -0
- package/dist/Notification-DTNYSd8P.mjs +8 -0
- package/dist/Notification-DTNYSd8P.mjs.map +1 -0
- package/dist/NotificationSettings-CW7okUrk.mjs +678 -0
- package/dist/NotificationSettings-CW7okUrk.mjs.map +1 -0
- package/dist/NotificationUtils-BRGFTePr.mjs +24 -0
- package/dist/NotificationUtils-BRGFTePr.mjs.map +1 -0
- package/dist/NumberFormatting--XMeeBfr.mjs +50 -0
- package/dist/NumberFormatting--XMeeBfr.mjs.map +1 -0
- package/dist/OriginalBalanceAction-YrvxBYAl.mjs +115 -0
- package/dist/OriginalBalanceAction-YrvxBYAl.mjs.map +1 -0
- package/dist/RecurringSettings-kRqAViNn.mjs +89 -0
- package/dist/RecurringSettings-kRqAViNn.mjs.map +1 -0
- package/dist/RecurringTransactionsUtil-CHWmqvW5.mjs +299 -0
- package/dist/RecurringTransactionsUtil-CHWmqvW5.mjs.map +1 -0
- package/dist/ResponsiveButton-CC9F_Ezk.mjs +46 -0
- package/dist/ResponsiveButton-CC9F_Ezk.mjs.map +1 -0
- package/dist/SearchBox-Cpgu_gdO.mjs +51 -0
- package/dist/SearchBox-Cpgu_gdO.mjs.map +1 -0
- package/dist/Select-CSpkK5cR.mjs +62 -0
- package/dist/Select-CSpkK5cR.mjs.map +1 -0
- package/dist/SelectionBox-B4xELRgp.mjs +49 -0
- package/dist/SelectionBox-B4xELRgp.mjs.map +1 -0
- package/dist/SingleSegmentDonut-7Uy6VEld.mjs +70 -0
- package/dist/SingleSegmentDonut-7Uy6VEld.mjs.map +1 -0
- package/dist/Sizes-DISGrlUg.mjs +7 -0
- package/dist/Sizes-DISGrlUg.mjs.map +1 -0
- package/dist/SkeletonLoader-BaNboJjD.mjs +39 -0
- package/dist/SkeletonLoader-BaNboJjD.mjs.map +1 -0
- package/dist/SpendingData-Fii_xATx.mjs +54 -0
- package/dist/SpendingData-Fii_xATx.mjs.map +1 -0
- package/dist/SpendingLegend-CxvNOg3c.mjs +204 -0
- package/dist/SpendingLegend-CxvNOg3c.mjs.map +1 -0
- package/dist/StatusBar-CPfSXe80.mjs +31 -0
- package/dist/StatusBar-CPfSXe80.mjs.map +1 -0
- package/dist/TabContentContainer-B0eYJP5p.mjs +49 -0
- package/dist/TabContentContainer-B0eYJP5p.mjs.map +1 -0
- package/dist/ToggleListItem-Dl1lXNwj.mjs +92 -0
- package/dist/ToggleListItem-Dl1lXNwj.mjs.map +1 -0
- package/dist/TransactionDetails-roZ5xLq8.mjs +1708 -0
- package/dist/TransactionDetails-roZ5xLq8.mjs.map +1 -0
- package/dist/TransactionUtils-BphBJBbU.mjs +235 -0
- package/dist/TransactionUtils-BphBJBbU.mjs.map +1 -0
- package/dist/TrendsUtil-D9z3kIj_.mjs +70 -0
- package/dist/TrendsUtil-D9z3kIj_.mjs.map +1 -0
- package/dist/UserStore-BjnNCO5a.mjs +3121 -0
- package/dist/UserStore-BjnNCO5a.mjs.map +1 -0
- package/dist/ViewMoreMicroCard-fnwE0hqd.mjs +1280 -0
- package/dist/ViewMoreMicroCard-fnwE0hqd.mjs.map +1 -0
- package/dist/WidgetContainer-DJnp6t6c.mjs +483 -0
- package/dist/WidgetContainer-DJnp6t6c.mjs.map +1 -0
- package/dist/accounts/components/detailsdrawer/Accounts/AccountDetailsDrawer.d.ts +6 -0
- package/dist/accounts/index.d.ts +1 -0
- package/dist/accounts/index.es.js +784 -12
- package/dist/accounts/index.es.js.map +1 -0
- package/dist/analytics/index.es.js +140 -155
- package/dist/analytics/index.es.js.map +1 -0
- package/dist/budgets/index.es.js +1267 -1317
- package/dist/budgets/index.es.js.map +1 -0
- package/dist/cashflow/context/hooks.d.ts +7 -6
- package/dist/cashflow/index.es.js +944 -1076
- package/dist/cashflow/index.es.js.map +1 -0
- package/dist/categories/index.es.js +5 -4
- package/dist/categories/index.es.js.map +1 -0
- package/dist/common/components/DataRow.d.ts +1 -0
- package/dist/common/components/ListItemWrapper.d.ts +2 -1
- package/dist/common/constants/Analytics.d.ts +3 -0
- package/dist/common/index.es.js +310 -101
- package/dist/common/index.es.js.map +1 -0
- package/dist/core/index.es.js +105 -80
- package/dist/core/index.es.js.map +1 -0
- package/dist/core/stores/CashflowStore.d.ts +8 -7
- package/dist/core/stores/RecurringTransactionsStore.d.ts +53 -1
- package/dist/core/stores/TransactionStore.d.ts +1 -0
- package/dist/core/types/localization/RecurringCopy.d.ts +14 -1
- package/dist/core/types/localization/SpendingCopy.d.ts +1 -0
- package/dist/core/utils/AccountUtils.d.ts +8 -0
- package/dist/core/utils/DateUtil.d.ts +2 -0
- package/dist/core/utils/RecurringTransactionsUtil.d.ts +2 -1
- package/dist/dashboard/index.es.js +142 -185
- package/dist/dashboard/index.es.js.map +1 -0
- package/dist/debts/index.es.js +1273 -1384
- package/dist/debts/index.es.js.map +1 -0
- package/dist/finstrong/index.es.js +3473 -3367
- package/dist/finstrong/index.es.js.map +1 -0
- package/dist/goals/index.es.js +984 -1103
- package/dist/goals/index.es.js.map +1 -0
- package/dist/help/index.es.js +26 -3
- package/dist/help/index.es.js.map +1 -0
- package/dist/hooks-97sNJ_lf.mjs +78 -0
- package/dist/hooks-97sNJ_lf.mjs.map +1 -0
- package/dist/insights/components/insights/WeeklyNoSpendDays/BubbleWeek.d.ts +4 -1
- package/dist/insights/components/insights/WeeklyNoSpendDays/WeeklyNoSpendDays.d.ts +4 -2
- package/dist/insights/index.es.js +4871 -93
- package/dist/insights/index.es.js.map +1 -0
- package/dist/investments/index.es.js +1523 -1533
- package/dist/investments/index.es.js.map +1 -0
- package/dist/merchants/index.es.js +65 -75
- package/dist/merchants/index.es.js.map +1 -0
- package/dist/microinsights/index.es.js +826 -15
- package/dist/microinsights/index.es.js.map +1 -0
- package/dist/networth/index.es.js +504 -550
- package/dist/networth/index.es.js.map +1 -0
- package/dist/notifications/index.es.js +162 -169
- package/dist/notifications/index.es.js.map +1 -0
- package/dist/recurringtransactions/components/RecurringTransactionDetails.d.ts +3 -2
- package/dist/recurringtransactions/components/RecurringTransactionDetailsDrawer.d.ts +3 -0
- package/dist/recurringtransactions/components/RecurringTransactionList.d.ts +11 -0
- package/dist/recurringtransactions/components/UpcomingRecurrenceCard.d.ts +8 -0
- package/dist/recurringtransactions/components/actions/LinkTransactionDrawer.d.ts +10 -0
- package/dist/recurringtransactions/components/actions/MarkAsPaidDialog.d.ts +7 -0
- package/dist/recurringtransactions/components/actions/MarkAsUnpaidDialog.d.ts +7 -0
- package/dist/recurringtransactions/index.es.js +1012 -10
- package/dist/recurringtransactions/index.es.js.map +1 -0
- package/dist/settings/index.es.js +892 -13
- package/dist/settings/index.es.js.map +1 -0
- package/dist/spending/index.es.js +457 -400
- package/dist/spending/index.es.js.map +1 -0
- package/dist/transactions/components/shared/transactionlist/TransactionRow.d.ts +1 -0
- package/dist/transactions/index.es.js +604 -10
- package/dist/transactions/index.es.js.map +1 -0
- package/dist/trends/index.es.js +1408 -1268
- package/dist/trends/index.es.js.map +1 -0
- package/dist/useAccountDisplayName-BsiXA0qf.mjs +24 -0
- package/dist/useAccountDisplayName-BsiXA0qf.mjs.map +1 -0
- package/dist/useAriaLive-MkYebyUR.mjs +36 -0
- package/dist/useAriaLive-MkYebyUR.mjs.map +1 -0
- package/dist/useDimensions-CeDR9V8N.mjs +37 -0
- package/dist/useDimensions-CeDR9V8N.mjs.map +1 -0
- package/dist/useInsightsEnabled-D5Sdm0TJ.mjs +12 -0
- package/dist/useInsightsEnabled-D5Sdm0TJ.mjs.map +1 -0
- package/dist/useScreenSize-mWpmnh5w.mjs +37 -0
- package/dist/useScreenSize-mWpmnh5w.mjs.map +1 -0
- package/dist/useWidgetLoadTimer-B0tB-yzL.mjs +20 -0
- package/dist/useWidgetLoadTimer-B0tB-yzL.mjs.map +1 -0
- package/package.json +30 -30
- package/dist/Analytics-BKzTPees.mjs +0 -61
- package/dist/GlobalCopyApi-BeXzaDH9.mjs +0 -487
- package/dist/HeaderCell-EhCUSjvj.mjs +0 -10
- package/dist/Loader-BlVzRtUd.mjs +0 -73
- package/dist/MiniWidgetContainer-COwnjfy7.mjs +0 -110
- package/dist/OriginalBalanceAction-sbiqaxok.mjs +0 -110
- package/dist/SpendingLegend-D15ixlQ1.mjs +0 -222
- package/dist/accounts-DkyAiLpg.mjs +0 -15632
- package/dist/core-BexP5oiV.mjs +0 -4047
- package/dist/help-CctDYrAH.mjs +0 -2308
- package/dist/insights/components/insights/P2pCategorization/_tests_/P2pCategorizationMultipleTransaction.test.d.ts +0 -0
- package/dist/insights/components/insights/P2pCategorization/_tests_/P2pCategorizationSingleTransaction.test.d.ts +0 -0
- package/dist/microinsights-CRf3ChsJ.mjs +0 -1814
- package/dist/recurringtransactions-gbJ_NA8u.mjs +0 -1564
- package/dist/settings-ZMHe439l.mjs +0 -1526
|
@@ -0,0 +1,3121 @@
|
|
|
1
|
+
import { makeAutoObservable as d, runInAction as c, reaction as ut, autorun as St, observable as Tt } from "mobx";
|
|
2
|
+
import { d as At, g as wt } from "./AccountUtils-Cbh8r9cP.mjs";
|
|
3
|
+
import { i as bt, f as It, b as Ct, c as W } from "./BudgetUtil-Bg2AQJpQ.mjs";
|
|
4
|
+
import { c as h, d as O } from "./Account-DR7Plrqy.mjs";
|
|
5
|
+
import { F as g, B as $, G as V } from "./GlobalCopyApi-wcnDUzMV.mjs";
|
|
6
|
+
import { A as i } from "./ApiEndpoints-DXwIYNUV.mjs";
|
|
7
|
+
import Et from "posthog-js";
|
|
8
|
+
import { endOfMonth as T } from "date-fns/endOfMonth";
|
|
9
|
+
import { startOfMonth as E } from "date-fns/startOfMonth";
|
|
10
|
+
import { startOfToday as y } from "date-fns/startOfToday";
|
|
11
|
+
import { C as w, b as Rt } from "./Category-DEKZGLYe.mjs";
|
|
12
|
+
import { addDays as Dt } from "date-fns/addDays";
|
|
13
|
+
import { differenceInDays as Lt } from "date-fns/differenceInDays";
|
|
14
|
+
import { isBefore as H } from "date-fns/isBefore";
|
|
15
|
+
import { getUnixTime as m } from "date-fns/getUnixTime";
|
|
16
|
+
import { subMonths as G } from "date-fns/subMonths";
|
|
17
|
+
import { c as vt, d as $t, C as Gt, h as Nt, i as Bt, s as xt, j as Mt, T as Ot, D as Pt } from "./TransactionUtils-BphBJBbU.mjs";
|
|
18
|
+
import { l as Ft, D as Ut } from "./DebtUtils-i4pI2Uoe.mjs";
|
|
19
|
+
import { format as kt } from "date-fns/format";
|
|
20
|
+
import { fromUnixTime as Ht } from "date-fns/fromUnixTime";
|
|
21
|
+
import { f as U, D as k } from "./DateFormats-HudZ3Bjs.mjs";
|
|
22
|
+
import { T as S, c as z } from "./GoalsUtil-C9EnLWvC.mjs";
|
|
23
|
+
import { A as Wt, m as Vt, a as zt, b as Kt } from "./InvestmentUtil-BItV7uEs.mjs";
|
|
24
|
+
import { f as Qt, b as qt, a as K, c as Yt, d as jt, e as Xt, s as Jt } from "./NetWorthUtils-Dj7CgAg2.mjs";
|
|
25
|
+
import { f as Zt } from "./NotificationUtils-BRGFTePr.mjs";
|
|
26
|
+
import { isAfter as P } from "date-fns/isAfter";
|
|
27
|
+
import { isSameDay as Q } from "date-fns/isSameDay";
|
|
28
|
+
import { isWithinInterval as gt } from "date-fns/isWithinInterval";
|
|
29
|
+
import { subDays as pt } from "date-fns/subDays";
|
|
30
|
+
import { f as F, h as te, b as L, a as f } from "./RecurringTransactionsUtil-CHWmqvW5.mjs";
|
|
31
|
+
import { I as u, A as _, B as N } from "./Notification-DTNYSd8P.mjs";
|
|
32
|
+
import { endOfToday as q } from "date-fns/endOfToday";
|
|
33
|
+
import { formatISO as ee } from "date-fns/formatISO";
|
|
34
|
+
import { addSeconds as se } from "date-fns/addSeconds";
|
|
35
|
+
import { differenceInCalendarMonths as ae } from "date-fns/differenceInCalendarMonths";
|
|
36
|
+
import { f as ne, b as ie } from "./TrendsUtil-D9z3kIj_.mjs";
|
|
37
|
+
import { addMonths as re } from "date-fns/addMonths";
|
|
38
|
+
import { getMonth as v } from "date-fns/getMonth";
|
|
39
|
+
import { a as oe } from "./Help-CkQTjORd.mjs";
|
|
40
|
+
class B {
|
|
41
|
+
fetchInstance;
|
|
42
|
+
constructor(t, e, s) {
|
|
43
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
44
|
+
}
|
|
45
|
+
createAccount = async (t) => this.fetchInstance.post(i.ACCOUNTS, t).then((e) => e.account).catch((e) => e);
|
|
46
|
+
deleteAccount = async (t) => this.fetchInstance.delete(`${i.ACCOUNTS}/${t}`).catch((e) => e);
|
|
47
|
+
getAccounts = async () => this.fetchInstance.get(i.ACCOUNTS).then((t) => t.accounts).catch((t) => t);
|
|
48
|
+
getInstitutions = async () => this.fetchInstance.get(i.INSTITUTIONS).then((t) => t).catch((t) => t);
|
|
49
|
+
getMembers = async () => this.fetchInstance.get(i.MEMBERS).then((t) => t.members).catch((t) => t);
|
|
50
|
+
getMonthlyAccountBalances = async (t) => this.fetchInstance.get(`${i.ACCOUNTS}/${t}/monthly_account_balances`).then((e) => e.monthly_account_balances).catch((e) => e);
|
|
51
|
+
mergeAccounts = async (t) => this.fetchInstance.put(`${i.ACCOUNTS}/merge`, { accounts: t }).then((e) => e).catch((e) => e);
|
|
52
|
+
refreshAllMembers = async () => this.fetchInstance.get(`${i.MEMBERS}/refresh_all`).then((t) => t).catch((t) => t);
|
|
53
|
+
updateAccount = async (t) => this.fetchInstance.put(`${i.ACCOUNTS}/${t.guid}`, t).then((e) => e.account).catch((e) => e);
|
|
54
|
+
}
|
|
55
|
+
class Y {
|
|
56
|
+
fetchInstance;
|
|
57
|
+
constructor(t, e, s) {
|
|
58
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
59
|
+
}
|
|
60
|
+
getAppData = async () => this.fetchInstance.get(i.APP_DATA).then((t) => t);
|
|
61
|
+
}
|
|
62
|
+
class j {
|
|
63
|
+
fetchInstance;
|
|
64
|
+
constructor(t) {
|
|
65
|
+
this.fetchInstance = new g(t, "", {
|
|
66
|
+
Accept: "application/json",
|
|
67
|
+
"Content-Type": "application/json"
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
getBanner = async (t) => {
|
|
71
|
+
try {
|
|
72
|
+
const e = `/banner/${t}/account_widget_banner`;
|
|
73
|
+
return this.fetchInstance?.get(e).then((s) => s.banner) ?? {};
|
|
74
|
+
} catch (e) {
|
|
75
|
+
return console.error("Error fetching banner:", e), null;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
class X {
|
|
80
|
+
fetchInstance;
|
|
81
|
+
constructor(t, e, s) {
|
|
82
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
83
|
+
}
|
|
84
|
+
addBudget = async (t, e, s = null) => this.fetchInstance.post(i.BUDGETS, {
|
|
85
|
+
amount: e,
|
|
86
|
+
category_guid: t.guid,
|
|
87
|
+
category_name: t.name,
|
|
88
|
+
parent_guid: s
|
|
89
|
+
}).then((a) => a.budget).catch((a) => {
|
|
90
|
+
throw a;
|
|
91
|
+
});
|
|
92
|
+
deleteBudget = async (t) => this.fetchInstance.delete(`${i.BUDGETS}/${t}`).then((e) => e).catch((e) => {
|
|
93
|
+
throw e;
|
|
94
|
+
});
|
|
95
|
+
getBudgets = async () => this.fetchInstance.get(i.BUDGETS).then((t) => t.budgets).catch((t) => t);
|
|
96
|
+
updateBudget = async (t) => this.fetchInstance.put(`${i.BUDGETS}/${t.guid}`, t).then((e) => e.budget).catch((e) => {
|
|
97
|
+
throw e;
|
|
98
|
+
});
|
|
99
|
+
addMerchantBudget = async (t, e) => this.fetchInstance.post(i.MERCHANT_BUDGETS, {
|
|
100
|
+
amount: e,
|
|
101
|
+
merchant_guid: t
|
|
102
|
+
}).then((s) => s.merchant_budget).catch((s) => {
|
|
103
|
+
throw s;
|
|
104
|
+
});
|
|
105
|
+
updateMerchantBudget = async (t, e) => this.fetchInstance.put(`${i.MERCHANT_BUDGETS}/${t}`, {
|
|
106
|
+
amount: e
|
|
107
|
+
}).then((s) => s.merchant_budget).catch((s) => {
|
|
108
|
+
throw s;
|
|
109
|
+
});
|
|
110
|
+
deleteMerchantBudget = async (t) => this.fetchInstance.delete(`${i.MERCHANT_BUDGETS}/${t}`).then((e) => e).catch((e) => {
|
|
111
|
+
throw e;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
class J {
|
|
115
|
+
fetchInstance;
|
|
116
|
+
constructor(t, e, s) {
|
|
117
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
118
|
+
}
|
|
119
|
+
addCategory = async (t) => this.fetchInstance.post(i.CATEGORIES, t).then((e) => e.category);
|
|
120
|
+
getCategories = async () => this.fetchInstance.get(i.CATEGORIES).then((t) => t.categories);
|
|
121
|
+
getDateRangeCategoryTotals = async (t, e, s) => s.length === 0 ? [] : this.fetchInstance.post(`${i.DATE_RANGE_CATEGORY_TOTALS}/from/${t}/to/${e}`, {
|
|
122
|
+
account_guid: s.map((a) => a.guid)
|
|
123
|
+
}).then((a) => a.date_range_category_totals);
|
|
124
|
+
getMonthlyCategoryTotals = async (t, e, s) => {
|
|
125
|
+
try {
|
|
126
|
+
const a = `${i.MONTHLY_CATEGORY_TOTALS}/from/${t}/to/${e}`;
|
|
127
|
+
if (s) {
|
|
128
|
+
const o = s.length === 0 ? [""] : s.map((l) => l.guid);
|
|
129
|
+
return (await this.fetchInstance.post(a, { account_guid: o })).monthly_category_totals;
|
|
130
|
+
} else
|
|
131
|
+
return (await this.fetchInstance.get(a)).monthly_category_totals;
|
|
132
|
+
} catch (a) {
|
|
133
|
+
throw console.error("Error fetching monthly category totals:", a), a;
|
|
134
|
+
}
|
|
135
|
+
};
|
|
136
|
+
removeCategory = async (t) => this.fetchInstance.delete(`${i.CATEGORIES}/${t}`);
|
|
137
|
+
updateCategory = async (t) => this.fetchInstance.put(`${i.CATEGORIES}/${t.guid}`, t).then((e) => e.category);
|
|
138
|
+
}
|
|
139
|
+
class Z {
|
|
140
|
+
fetchInstance;
|
|
141
|
+
constructor(t, e, s) {
|
|
142
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
143
|
+
}
|
|
144
|
+
calculateHealthScore = async () => this.fetchInstance.post(`${i.HEALTH_SCORES}/calculate`).then((t) => t.health_score);
|
|
145
|
+
getAverageHealthScores = async () => this.fetchInstance.get(`${i.HEALTH_SCORES}/monthly_averages`).then((t) => t);
|
|
146
|
+
getDebtSpend = async () => this.fetchInstance.get(`${i.HEALTH_SCORES}/transactions/debt_spend`).then((t) => t);
|
|
147
|
+
getIncome = async () => this.fetchInstance.get(`${i.HEALTH_SCORES}/transactions/income`).then((t) => t);
|
|
148
|
+
getMonthlySummaries = async () => this.fetchInstance.get(`${i.HEALTH_SCORES}/monthly_summaries`).then((t) => t);
|
|
149
|
+
getHealthScoreChangeReports = async (t, e) => this.fetchInstance.get(`${i.HEALTH_SCORES}/change_report/from/${t}/to/${e}`).then((s) => s);
|
|
150
|
+
getPeerScore = async (t) => this.fetchInstance.get(`${i.HEALTH_SCORES}/average/${t}`).then((e) => e);
|
|
151
|
+
getSpendingFeeTransactions = async () => this.fetchInstance.get(`${i.HEALTH_SCORES}/transactions/spending_fee`).then((t) => t);
|
|
152
|
+
getStandardSpend = async () => this.fetchInstance.get(`${i.HEALTH_SCORES}/transactions/standard_spend`).then((t) => t);
|
|
153
|
+
}
|
|
154
|
+
class tt {
|
|
155
|
+
fetchInstance;
|
|
156
|
+
constructor(t, e, s) {
|
|
157
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
158
|
+
}
|
|
159
|
+
addGoal = async (t) => this.fetchInstance.post(i.GOALS, t).then((e) => e.goal);
|
|
160
|
+
addRetirementGoal = async (t) => this.fetchInstance.post(i.RETIREMENT_GOALS, t).then((e) => e.retirement_goal);
|
|
161
|
+
addRetirementGoalAccount = async (t) => this.fetchInstance.post(i.RETIREMENT_GOAL_ACCOUNTS, t).then((e) => e.retirement_goal_account);
|
|
162
|
+
getGoalByGuid = async (t) => this.fetchInstance.get(`${i.GOALS}/${t}`).then((e) => e.goal);
|
|
163
|
+
getGoals = async () => this.fetchInstance.get(i.GOALS).then((t) => t.goals);
|
|
164
|
+
getMonthlyCashFlowProfile = async () => this.fetchInstance.get(i.MONTHLY_CASH_FLOW_PROFILE).then((t) => t.monthly_cash_flow_profile);
|
|
165
|
+
getRetirementGoals = async () => this.fetchInstance.get(i.RETIREMENT_GOALS).then((t) => t.retirement_goals);
|
|
166
|
+
getRetirementGoalAccounts = async () => this.fetchInstance.get(i.RETIREMENT_GOAL_ACCOUNTS).then((t) => t.retirement_goal_accounts);
|
|
167
|
+
removeGoal = async (t) => this.fetchInstance.delete(`${i.GOALS}/${t}`).then((e) => e);
|
|
168
|
+
removeRetirementGoal = async (t) => this.fetchInstance.delete(`${i.RETIREMENT_GOALS}/${t}`).then((e) => e);
|
|
169
|
+
removeRetirementGoalAccount = async (t) => this.fetchInstance.delete(`${i.RETIREMENT_GOAL_ACCOUNTS}/${t}`).then((e) => e);
|
|
170
|
+
reorderGoals = async (t) => this.fetchInstance.post(`${i.GOALS}/reposition`, { goals: t }).then((e) => e.goals);
|
|
171
|
+
updateGoal = async (t) => this.fetchInstance.put(`${i.GOALS}/${t.guid}`, t).then((e) => e.goal);
|
|
172
|
+
updateMonthlyCashFlowProfile = async (t) => this.fetchInstance.put(`${i.MONTHLY_CASH_FLOW_PROFILE}`, t).then((e) => e.monthly_cash_flow_profile);
|
|
173
|
+
updateRetirementGoal = async (t) => this.fetchInstance.put(`${i.RETIREMENT_GOALS}/${t.guid}`, t).then((e) => e.retirement_goal);
|
|
174
|
+
}
|
|
175
|
+
class et {
|
|
176
|
+
fetchInstance;
|
|
177
|
+
constructor(t, e, s) {
|
|
178
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
179
|
+
}
|
|
180
|
+
createSupportTicket = async (t) => this.fetchInstance.post(i.SUPPORT_TICKETS, t).then((e) => e);
|
|
181
|
+
}
|
|
182
|
+
class st {
|
|
183
|
+
fetchInstance;
|
|
184
|
+
constructor(t, e, s) {
|
|
185
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
186
|
+
}
|
|
187
|
+
getHoldings = async () => this.fetchInstance.get(i.HOLDINGS).then((t) => t.holdings);
|
|
188
|
+
updateHoldings = async (t) => this.fetchInstance.put(`${i.HOLDINGS}/${t.guid}`, t).then((e) => e.holding);
|
|
189
|
+
}
|
|
190
|
+
class at {
|
|
191
|
+
fetchInstance;
|
|
192
|
+
constructor(t, e, s) {
|
|
193
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
194
|
+
}
|
|
195
|
+
getMerchants = async (t = [], e = [], s = 1, a = 25) => {
|
|
196
|
+
let o = i.MERCHANTS;
|
|
197
|
+
return o += `?page=${s}&per_page=${a}`, t.length && t.forEach((r) => o += `&fuzzy_name[]=${r}`), e.length && e.forEach((r) => o += `&guid[]=${r}`), this.fetchInstance.get(o).then((r) => r.merchants);
|
|
198
|
+
};
|
|
199
|
+
getMerchantByGuid = async (t) => this.fetchInstance.get(`${i.MERCHANTS}/${t}`).then((e) => e.merchant);
|
|
200
|
+
}
|
|
201
|
+
class nt {
|
|
202
|
+
fetchInstance;
|
|
203
|
+
constructor(t, e, s) {
|
|
204
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
205
|
+
}
|
|
206
|
+
getNotifications = () => this.fetchInstance.get(i.NOTIFICATIONS).then(
|
|
207
|
+
(t) => t.notifications.map((e) => e.notification)
|
|
208
|
+
).finally();
|
|
209
|
+
updateNotification = (t) => this.fetchInstance.put(`${i.NOTIFICATIONS}/${t.guid}`, {
|
|
210
|
+
guid: t.guid,
|
|
211
|
+
has_been_viewed: t.has_been_viewed
|
|
212
|
+
}).then((e) => e.notification).finally();
|
|
213
|
+
// Note: The notifications/mark_all_as_viewed endpoint is broken, but still returns 202.
|
|
214
|
+
// A bug ticket has been filed to fix it, but should not require any changes here.
|
|
215
|
+
markAllAsViewed = (t) => this.fetchInstance.put(`${i.NOTIFICATIONS}/mark_all_as_viewed`, { channel: t }).finally();
|
|
216
|
+
}
|
|
217
|
+
class it {
|
|
218
|
+
fetchInstance;
|
|
219
|
+
constructor(t, e, s) {
|
|
220
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
221
|
+
}
|
|
222
|
+
addRepeatingTransaction = async (t) => this.fetchInstance.post(i.REPEATING_TRANSACTIONS, t).then((e) => e.repeating_transaction);
|
|
223
|
+
getRepeatingTransactions = async () => this.fetchInstance.get(i.REPEATING_TRANSACTIONS).then((t) => t.repeating_transactions);
|
|
224
|
+
updateRepeatingTransaction = async (t) => this.fetchInstance.put(
|
|
225
|
+
`${i.REPEATING_TRANSACTIONS}/${t.guid}`,
|
|
226
|
+
t
|
|
227
|
+
).then((e) => e.repeating_transaction);
|
|
228
|
+
deleteRepeatingTransaction = async (t) => this.fetchInstance.delete(`${i.REPEATING_TRANSACTIONS}/${t}`).then((e) => e);
|
|
229
|
+
}
|
|
230
|
+
class rt {
|
|
231
|
+
fetchInstance;
|
|
232
|
+
constructor(t, e, s) {
|
|
233
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
234
|
+
}
|
|
235
|
+
deleteDevice = async (t) => this.fetchInstance.delete(`${i.DEVICES}/${t}`).then((e) => e);
|
|
236
|
+
generateDeviceToken = async () => this.fetchInstance.get(`${i.USER}/mobile_token`).then((t) => t.mobile_token);
|
|
237
|
+
getDevices = async () => this.fetchInstance.get(i.DEVICES).then((t) => t.map((e) => e.device));
|
|
238
|
+
getNotificationProfiles = async () => this.fetchInstance.get(i.NOTIFICATION_PROFILES).then((t) => t.notification_profiles);
|
|
239
|
+
// verifications endpoints respond with HTTP status codes; they error otherwise
|
|
240
|
+
sendEmailVerification = async () => this.fetchInstance.post(i.EMAIL_VERIFICATIONS);
|
|
241
|
+
sendPhoneVerification = async () => this.fetchInstance.post(i.PHONE_VERIFICATIONS + "/deliver");
|
|
242
|
+
verifyPhoneToken = async (t) => this.fetchInstance.post(i.PHONE_VERIFICATIONS + "/verify", { sms_verification_token: t }).then((e) => ({ verified: e.verified }));
|
|
243
|
+
updateDevice = async (t) => this.fetchInstance.put(`${i.DEVICES}/${t.guid}`, t).then((e) => e.device);
|
|
244
|
+
updateNotificationProfile = async (t) => this.fetchInstance.put(`${i.NOTIFICATION_PROFILES}/${t.guid}`, t).then((e) => e.notification_profile);
|
|
245
|
+
updateUserCommunicationProfile = async (t) => this.fetchInstance.put(i.USER_COMMUNICATION_PROFILE, t).then((e) => e.user_communication_profile);
|
|
246
|
+
getInsightsNotificationProfiles = async () => this.fetchInstance.get(`${i.NOTIFICATION_PROFILES}/${i.INSIGHTS_NOTIFICATION_PROFILES}`).then((t) => t);
|
|
247
|
+
}
|
|
248
|
+
class x {
|
|
249
|
+
fetchInstance;
|
|
250
|
+
constructor(t, e, s) {
|
|
251
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
252
|
+
}
|
|
253
|
+
addTag = async (t) => this.fetchInstance.post(i.TAGS, t).then((e) => e.tag).catch((e) => e);
|
|
254
|
+
addTagging = async (t) => this.fetchInstance.post(i.TAGGINGS, t).then((e) => e.tagging).catch((e) => e);
|
|
255
|
+
addTransaction = async (t) => this.fetchInstance.post(i.TRANSACTIONS, t).then((e) => e.transaction).catch((e) => e);
|
|
256
|
+
addTransactionRule = async (t) => this.fetchInstance.post(i.TRANSACTION_RULES, t).then((e) => e).catch((e) => e);
|
|
257
|
+
getTaggings = async () => this.fetchInstance.get(i.TAGGINGS).then((t) => t.map((e) => e.tagging));
|
|
258
|
+
getTags = async () => this.fetchInstance.get(i.TAGS).then((t) => t.map((e) => e.tag));
|
|
259
|
+
getTransactionRules = async () => this.fetchInstance.get(i.TRANSACTION_RULES).then((t) => t.transaction_rules);
|
|
260
|
+
getTransactionsByDateRange = async (t, e) => this.fetchInstance.get(`${i.TRANSACTIONS}/by_date/${t}/${e}`).then((s) => s.map((a) => a.transaction));
|
|
261
|
+
// DEPRECATED
|
|
262
|
+
getTransactionsByAccountsAndDateRange = async (t, e, s) => {
|
|
263
|
+
console.warn("DEPRECATED: getTransactionsByAccountsAndDateRange will be removed");
|
|
264
|
+
const a = t.reduce(
|
|
265
|
+
(o, r, l) => `${o}account_guids[]=${r}${l !== t.length - 1 ? "&" : ""}`,
|
|
266
|
+
""
|
|
267
|
+
);
|
|
268
|
+
return this.fetchInstance.get(`${i.TRANSACTIONS}/by_date/${e}/${s}?${a}`).then((o) => o.map((r) => r.transaction));
|
|
269
|
+
};
|
|
270
|
+
// DEPRECATED
|
|
271
|
+
getTransactionsByGuids = async (t) => (console.warn("DEPRECATED: getTransactionsByGuids will be removed"), this.fetchInstance.post(`${i.TRANSACTIONS}/by_guids`, { guids: t.join("+") }).then((e) => e.map((s) => s.transaction)));
|
|
272
|
+
// DEPRECATED
|
|
273
|
+
getTransactionsByCategoryAndDate = async (t, e, s) => (console.warn("DEPRECATED: getTransactionsByCategoryAndDate will be removed"), this.fetchInstance.get(
|
|
274
|
+
`${i.TRANSACTIONS}/by_category_guid/${t}/by_date/${e}/${s}`
|
|
275
|
+
).then((a) => a.map((o) => o.transaction)));
|
|
276
|
+
// DEPRECATED
|
|
277
|
+
getTransactionsByCategoryDateAndAccounts = async (t, e, s, a) => {
|
|
278
|
+
console.warn("DEPRECATED: getTransactionsByCategoryDateAndAccounts will be removed");
|
|
279
|
+
const o = a.reduce(
|
|
280
|
+
(r, l, p) => `${r}account_guids[]=${l}${p !== a.length - 1 ? "&" : ""}`,
|
|
281
|
+
""
|
|
282
|
+
);
|
|
283
|
+
return this.fetchInstance.get(
|
|
284
|
+
`${i.TRANSACTIONS}/by_category_guid/${t}/by_date/${e}/${s}?${o}`
|
|
285
|
+
).then((r) => r.map((l) => l.transaction));
|
|
286
|
+
};
|
|
287
|
+
// DEPRECATED
|
|
288
|
+
getTransactionsByCategoriesDateAndAccounts = async (t, e, s, a) => {
|
|
289
|
+
console.warn("DEPRECATED: getTransactionsByCategoriesDateAndAccounts will be removed");
|
|
290
|
+
const o = a.reduce(
|
|
291
|
+
(r, l, p) => `${r}account_guids[]=${l}${p !== a.length - 1 ? "&" : ""}`,
|
|
292
|
+
""
|
|
293
|
+
);
|
|
294
|
+
return this.fetchInstance.get(
|
|
295
|
+
`${i.TRANSACTIONS}/by_category_guids/${t.join(
|
|
296
|
+
"+"
|
|
297
|
+
)}/by_date/${e}/${s}?${o}`
|
|
298
|
+
).then((r) => r.map((l) => l.transaction));
|
|
299
|
+
};
|
|
300
|
+
/**
|
|
301
|
+
* DEPRECATED
|
|
302
|
+
* Get all transactions by the top level category, between begin date and end date, and optionally
|
|
303
|
+
* filtered by accounts
|
|
304
|
+
* @param categoryGuid The top level category guid
|
|
305
|
+
* @param beginDate the start date
|
|
306
|
+
* @param endDate the end date
|
|
307
|
+
* @param accountGuids an optional list of account guids
|
|
308
|
+
*/
|
|
309
|
+
getTransactionsByTopLevelCategoryAndDate = async (t, e, s, a = []) => {
|
|
310
|
+
console.warn("DEPRECATED: getTransactionsByTopLevelCategoryAndDate will be removed");
|
|
311
|
+
let o = `${i.TRANSACTIONS}/by_top_level_category_guid/${t}/by_date/${e}/${s}`;
|
|
312
|
+
if (a.length > 0) {
|
|
313
|
+
const r = a.reduce(
|
|
314
|
+
(l, p, b) => `${l}account_guids[]=${p}${b !== a.length - 1 ? "&" : ""}`,
|
|
315
|
+
""
|
|
316
|
+
);
|
|
317
|
+
o += `?${r}`;
|
|
318
|
+
}
|
|
319
|
+
return this.fetchInstance.get(o).then((r) => r.map((l) => l.transaction));
|
|
320
|
+
};
|
|
321
|
+
removeTag = async (t) => this.fetchInstance.delete(`${i.TAGS}/${t}`).then((e) => e).catch((e) => e);
|
|
322
|
+
removeTagging = async (t) => this.fetchInstance.delete(`${i.TAGGINGS}/${t}`).then((e) => e).catch((e) => e);
|
|
323
|
+
removeTransaction = async (t) => this.fetchInstance.delete(`${i.TRANSACTIONS}/${t}`).then((e) => e);
|
|
324
|
+
removeTransactionRule = async (t) => this.fetchInstance.delete(`${i.TRANSACTION_RULES}/${t}`).catch((e) => e);
|
|
325
|
+
removeTransactionSplit = async (t) => this.fetchInstance.delete(`${i.TRANSACTIONS}/${t}/unsplit`).then((e) => e).catch((e) => e);
|
|
326
|
+
updateTransactionRule = async (t) => this.fetchInstance.put(`${i.TRANSACTION_RULES}/${t.guid}`, t).then((e) => e).catch((e) => e);
|
|
327
|
+
updateTag = async (t) => this.fetchInstance.put(`${i.TAGS}/${t.guid}`, t).then((e) => e.tag).catch((e) => e);
|
|
328
|
+
updateTransaction = async (t) => this.fetchInstance.put(`${i.TRANSACTIONS}/${t.guid}`, t).then((e) => e.transaction).catch((e) => e);
|
|
329
|
+
}
|
|
330
|
+
class ot {
|
|
331
|
+
fetchInstance;
|
|
332
|
+
constructor(t, e, s) {
|
|
333
|
+
this.fetchInstance = new g(t, e, void 0, s);
|
|
334
|
+
}
|
|
335
|
+
getUserFeatures = async () => this.fetchInstance.get(i.USER_FEATURES).then((t) => t.user_features).catch((t) => t);
|
|
336
|
+
updateUser = async (t) => this.fetchInstance.put(i.USER, t).then((e) => e.user);
|
|
337
|
+
updateUserProfile = async (t) => this.fetchInstance.put(`${i.USER_PROFILES}/${t.guid}`, t).then((e) => e.user_profile);
|
|
338
|
+
}
|
|
339
|
+
class ct {
|
|
340
|
+
fetchInstance;
|
|
341
|
+
constructor(t, e) {
|
|
342
|
+
this.fetchInstance = new g(t, e);
|
|
343
|
+
}
|
|
344
|
+
requestWidgetUrl = async (t) => this.fetchInstance.post(i.WIDGET_URLS, t).then((e) => e.widget_url);
|
|
345
|
+
}
|
|
346
|
+
class ce {
|
|
347
|
+
globalStore;
|
|
348
|
+
api = new B("/", "");
|
|
349
|
+
accounts = [];
|
|
350
|
+
accountsLoaded = !1;
|
|
351
|
+
accountsLoading = !1;
|
|
352
|
+
institutions = [];
|
|
353
|
+
institutionsLoaded = !1;
|
|
354
|
+
institutionsLoading = !1;
|
|
355
|
+
members = [];
|
|
356
|
+
membersLoaded = !1;
|
|
357
|
+
membersLoading = !1;
|
|
358
|
+
uiStore;
|
|
359
|
+
constructor(t) {
|
|
360
|
+
this.globalStore = t, this.uiStore = new le(), this.api = new B(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
361
|
+
}
|
|
362
|
+
loadAccountData = async () => {
|
|
363
|
+
await Promise.all([this.loadAccounts(), this.loadMembers(), this.loadInstitutions()]);
|
|
364
|
+
};
|
|
365
|
+
get isAccountDataLoaded() {
|
|
366
|
+
return this.accountsLoaded && this.membersLoaded && this.institutionsLoaded;
|
|
367
|
+
}
|
|
368
|
+
get detailedAccounts() {
|
|
369
|
+
const t = this.globalStore.userStore.userFeatures, e = bt(t, "MD_EXCLUDE_EXTERNAL_ACCOUNTS"), s = this.globalStore.appConfig.config.display_only_external_accounts_in_accounts && this.globalStore.appConfig.options.subtype === "accounts";
|
|
370
|
+
return At(
|
|
371
|
+
this.accounts,
|
|
372
|
+
this.institutions,
|
|
373
|
+
this.members,
|
|
374
|
+
e,
|
|
375
|
+
s
|
|
376
|
+
);
|
|
377
|
+
}
|
|
378
|
+
get accountsByTypeMap() {
|
|
379
|
+
return this.detailedAccounts.reduce((t, e) => {
|
|
380
|
+
const s = e.account_type;
|
|
381
|
+
let a = t.get(s);
|
|
382
|
+
return a || (a = []), a.push(e), t.set(s, a), t;
|
|
383
|
+
}, /* @__PURE__ */ new Map());
|
|
384
|
+
}
|
|
385
|
+
get cashAccounts() {
|
|
386
|
+
return this.detailedAccounts.filter(
|
|
387
|
+
(t) => t.account_type === h.CASH || t.account_type === h.CHECKING || t.account_type === h.PREPAID || t.account_type === h.SAVINGS || t.account_type === h.CHECKING_LINE_OF_CREDIT
|
|
388
|
+
);
|
|
389
|
+
}
|
|
390
|
+
get cashBalance() {
|
|
391
|
+
return this.cashAccounts.reduce((t, e) => t + (e?.balance || 0), 0);
|
|
392
|
+
}
|
|
393
|
+
get checkingAccounts() {
|
|
394
|
+
return this.detailedAccounts.filter((t) => t.account_type === h.CHECKING);
|
|
395
|
+
}
|
|
396
|
+
get debtAccounts() {
|
|
397
|
+
return this.detailedAccounts.filter(
|
|
398
|
+
(t) => t.account_type === h.CREDIT_CARD || t.account_type === h.LOAN || t.account_type === h.MORTGAGE || t.account_type === h.LINE_OF_CREDIT || t.account_type === h.CHECKING_LINE_OF_CREDIT
|
|
399
|
+
);
|
|
400
|
+
}
|
|
401
|
+
get finstrongAccounts() {
|
|
402
|
+
const t = /* @__PURE__ */ new Set([
|
|
403
|
+
h.CHECKING,
|
|
404
|
+
h.SAVINGS,
|
|
405
|
+
h.CREDIT_CARD,
|
|
406
|
+
h.INVESTMENT
|
|
407
|
+
]);
|
|
408
|
+
return this.detailedAccounts.filter((e) => t.has(e.account_type));
|
|
409
|
+
}
|
|
410
|
+
get investmentAccounts() {
|
|
411
|
+
return this.detailedAccounts.filter(
|
|
412
|
+
(t) => t.account_type === h.INVESTMENT
|
|
413
|
+
);
|
|
414
|
+
}
|
|
415
|
+
get manualAccounts() {
|
|
416
|
+
return this.detailedAccounts.filter((t) => t.is_manual);
|
|
417
|
+
}
|
|
418
|
+
get savingsAccounts() {
|
|
419
|
+
return this.detailedAccounts.filter((t) => t.account_type === h.SAVINGS);
|
|
420
|
+
}
|
|
421
|
+
get retirementAccounts() {
|
|
422
|
+
return this.detailedAccounts.filter(
|
|
423
|
+
(t) => t.account_type === h.INVESTMENT || t.account_type === h.SAVINGS || t.account_type === h.CHECKING || t.account_type === h.CASH || t.account_type === h.PROPERTY || t.account_type === h.INSURANCE && (t.account_subtype === O.WHOLE_LIFE || t.account_subtype === O.UNIVERSAL_LIFE || t.account_subtype === O.VARIABLE_UNIVERSAL_LIFE)
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
get visibleAccounts() {
|
|
427
|
+
return this.detailedAccounts.filter((t) => !t.is_hidden && !t.is_closed);
|
|
428
|
+
}
|
|
429
|
+
get visibleCashAccounts() {
|
|
430
|
+
return this.cashAccounts.filter((t) => !t.is_hidden);
|
|
431
|
+
}
|
|
432
|
+
get visibleCashBalance() {
|
|
433
|
+
return this.visibleCashAccounts.reduce((t, e) => t + (e?.balance || 0), 0);
|
|
434
|
+
}
|
|
435
|
+
get visibleCheckingAccounts() {
|
|
436
|
+
return this.checkingAccounts.filter((t) => !t.is_hidden);
|
|
437
|
+
}
|
|
438
|
+
get visibleDebtAccounts() {
|
|
439
|
+
return this.debtAccounts.filter((t) => !t.is_hidden);
|
|
440
|
+
}
|
|
441
|
+
get visibleFinstrongAccounts() {
|
|
442
|
+
return this.finstrongAccounts.filter(
|
|
443
|
+
(t) => !(t.is_closed || t.is_deleted || t.is_hidden)
|
|
444
|
+
);
|
|
445
|
+
}
|
|
446
|
+
get visibleRetirementAccounts() {
|
|
447
|
+
return this.retirementAccounts.filter((t) => !t.is_hidden);
|
|
448
|
+
}
|
|
449
|
+
get visibleInvestmentAccounts() {
|
|
450
|
+
return this.investmentAccounts.filter((t) => !t.is_hidden);
|
|
451
|
+
}
|
|
452
|
+
get visibleSavingsAccounts() {
|
|
453
|
+
return this.savingsAccounts.filter((t) => !t.is_hidden);
|
|
454
|
+
}
|
|
455
|
+
get savingsAndCheckingAccountsBalance() {
|
|
456
|
+
return this.savingsAndCheckingAccounts.reduce(
|
|
457
|
+
(e, s) => e + (s?.balance || 0),
|
|
458
|
+
0
|
|
459
|
+
);
|
|
460
|
+
}
|
|
461
|
+
get savingsAndCheckingAccounts() {
|
|
462
|
+
return this.accounts.filter(
|
|
463
|
+
(e) => e.account_type === h.SAVINGS || e.account_type === h.CHECKING
|
|
464
|
+
);
|
|
465
|
+
}
|
|
466
|
+
setAccounts = (t) => {
|
|
467
|
+
this.accounts = t, this.accountsLoading = !1, this.accountsLoaded = !0;
|
|
468
|
+
};
|
|
469
|
+
setMembers = (t) => {
|
|
470
|
+
this.members = t, this.membersLoading = !1, this.membersLoaded = !0;
|
|
471
|
+
};
|
|
472
|
+
setInstitutions = (t) => {
|
|
473
|
+
this.institutions = t, this.institutionsLoading = !1, this.institutionsLoaded = !0;
|
|
474
|
+
};
|
|
475
|
+
addAccount = async (t) => {
|
|
476
|
+
try {
|
|
477
|
+
const e = await this.api.createAccount(t);
|
|
478
|
+
c(() => {
|
|
479
|
+
this.accounts = [...this.accounts, e];
|
|
480
|
+
});
|
|
481
|
+
} catch (e) {
|
|
482
|
+
console.error(`Error occurred while adding an account: ${e}`);
|
|
483
|
+
}
|
|
484
|
+
};
|
|
485
|
+
loadAccounts = async () => {
|
|
486
|
+
if (!this.accountsLoading) {
|
|
487
|
+
this.accountsLoading = !0;
|
|
488
|
+
try {
|
|
489
|
+
const t = await this.api.getAccounts();
|
|
490
|
+
this.setAccounts(t);
|
|
491
|
+
} catch (t) {
|
|
492
|
+
console.error(`Error occurred while loading accounts: ${t}`);
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
};
|
|
496
|
+
loadInstitutions = async () => {
|
|
497
|
+
if (!this.institutionsLoading) {
|
|
498
|
+
this.institutionsLoading = !0;
|
|
499
|
+
try {
|
|
500
|
+
const t = await this.api.getInstitutions();
|
|
501
|
+
this.setInstitutions(t);
|
|
502
|
+
} catch (t) {
|
|
503
|
+
console.error(`Error occurred while loading institutions: ${t}`);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
loadMembers = async () => {
|
|
508
|
+
if (!this.membersLoading) {
|
|
509
|
+
this.membersLoading = !0;
|
|
510
|
+
try {
|
|
511
|
+
const t = await this.api.getMembers();
|
|
512
|
+
this.setMembers(t);
|
|
513
|
+
} catch (t) {
|
|
514
|
+
console.error(`Error occurred while loading members: ${t}`);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
mergeAccounts = async (t) => {
|
|
519
|
+
try {
|
|
520
|
+
const e = await this.api.mergeAccounts(t), s = e[Object.keys(e)[0]];
|
|
521
|
+
c(() => {
|
|
522
|
+
const a = this.accounts.findIndex((r) => r.guid === t[1]);
|
|
523
|
+
this.accounts.splice(a, 1);
|
|
524
|
+
const o = this.accounts.findIndex((r) => r.guid === t[0]);
|
|
525
|
+
this.accounts.splice(o, 1, s);
|
|
526
|
+
});
|
|
527
|
+
} catch (e) {
|
|
528
|
+
console.error(`Error occurred while merging accounts: ${e}`);
|
|
529
|
+
}
|
|
530
|
+
};
|
|
531
|
+
/**
|
|
532
|
+
* DEPRECATED: Use loadAccountData instead
|
|
533
|
+
*/
|
|
534
|
+
refreshAccounts = async () => {
|
|
535
|
+
await Promise.all([this.loadAccounts(), this.loadInstitutions(), this.loadMembers()]);
|
|
536
|
+
};
|
|
537
|
+
refreshMembers = async () => {
|
|
538
|
+
try {
|
|
539
|
+
await this.api.refreshAllMembers();
|
|
540
|
+
} catch (t) {
|
|
541
|
+
console.error(`Error occurredwhile refreshing members: ${t}`);
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
removeAccount = async (t) => {
|
|
545
|
+
try {
|
|
546
|
+
await this.api.deleteAccount(t);
|
|
547
|
+
const e = this.accounts.findIndex((s) => s.guid === t);
|
|
548
|
+
this.accounts.splice(e, 1);
|
|
549
|
+
} catch (e) {
|
|
550
|
+
console.error(`Error occurred while removing an account: ${e}`);
|
|
551
|
+
}
|
|
552
|
+
};
|
|
553
|
+
updateAccount = async (t) => {
|
|
554
|
+
try {
|
|
555
|
+
const e = await this.api.updateAccount(t), s = this.accounts.findIndex(
|
|
556
|
+
(a) => a.guid === e.guid
|
|
557
|
+
);
|
|
558
|
+
this.accounts.splice(s, 1, e);
|
|
559
|
+
} catch (e) {
|
|
560
|
+
console.error(`Error occurred while updating account: ${e}`);
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
updateAccountBalance = (t, e) => {
|
|
564
|
+
const s = this.accounts.find((a) => a.guid === t);
|
|
565
|
+
s && c(() => {
|
|
566
|
+
s.balance = (s.balance || 0) + e;
|
|
567
|
+
});
|
|
568
|
+
};
|
|
569
|
+
updateAccountFilter = async (t) => {
|
|
570
|
+
const e = [];
|
|
571
|
+
for (const [o, r] of t.entries()) {
|
|
572
|
+
const l = this.accounts.find((p) => p.guid === o);
|
|
573
|
+
l && l.is_excluded_from_accounts === r && (l.is_excluded_from_accounts = !r, e.push(this.api.updateAccount(l)));
|
|
574
|
+
}
|
|
575
|
+
const s = await Promise.all(e), a = [...this.accounts];
|
|
576
|
+
for (const o of s) {
|
|
577
|
+
const r = a.findIndex((l) => l.guid === o.guid);
|
|
578
|
+
r !== -1 && a.splice(r, 1, o);
|
|
579
|
+
}
|
|
580
|
+
this.setAccounts(a);
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
let le = class {
|
|
584
|
+
selectedAccount = {};
|
|
585
|
+
selectedMember = {};
|
|
586
|
+
constructor() {
|
|
587
|
+
d(this);
|
|
588
|
+
}
|
|
589
|
+
setSelectedAccount = (t) => this.selectedAccount = t;
|
|
590
|
+
setSelectedMember = (t) => this.selectedMember = t;
|
|
591
|
+
};
|
|
592
|
+
class de {
|
|
593
|
+
globalStore;
|
|
594
|
+
api = new Y("/", "");
|
|
595
|
+
bannerApi = new j("/");
|
|
596
|
+
appData = {};
|
|
597
|
+
isAppDataLoaded = !1;
|
|
598
|
+
banner = {};
|
|
599
|
+
constructor(t) {
|
|
600
|
+
this.globalStore = t, this.api = new Y(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
601
|
+
}
|
|
602
|
+
get appConfig() {
|
|
603
|
+
return this.globalStore.appConfig;
|
|
604
|
+
}
|
|
605
|
+
get clientCommunicationProfile() {
|
|
606
|
+
return this.appData.client_communication_profile;
|
|
607
|
+
}
|
|
608
|
+
get clientInsightProfile() {
|
|
609
|
+
return this.appData.client_insight_profile;
|
|
610
|
+
}
|
|
611
|
+
get user() {
|
|
612
|
+
return this.appData.user;
|
|
613
|
+
}
|
|
614
|
+
get userCommunicationProfile() {
|
|
615
|
+
return this.appData.user_communication_profile;
|
|
616
|
+
}
|
|
617
|
+
get userProfile() {
|
|
618
|
+
return this.appData.user_profile;
|
|
619
|
+
}
|
|
620
|
+
setAppData = (t) => {
|
|
621
|
+
this.appData = t, this.bannerApi = new j(t.address?.bullseye || "/"), this.isAppDataLoaded = !0;
|
|
622
|
+
};
|
|
623
|
+
loadAppData = async () => {
|
|
624
|
+
try {
|
|
625
|
+
const t = await this.api.getAppData();
|
|
626
|
+
this.setAppData(t);
|
|
627
|
+
} catch (t) {
|
|
628
|
+
console.error(`Error loading app data: ${t}`);
|
|
629
|
+
}
|
|
630
|
+
};
|
|
631
|
+
loadBanner = async () => {
|
|
632
|
+
try {
|
|
633
|
+
const t = this.user?.guid ?? null, e = t ? await this.bannerApi.getBanner(t) : {};
|
|
634
|
+
c(() => {
|
|
635
|
+
this.banner = e;
|
|
636
|
+
});
|
|
637
|
+
} catch (t) {
|
|
638
|
+
console.error(`Error loading banner: ${t}`);
|
|
639
|
+
}
|
|
640
|
+
};
|
|
641
|
+
setUser = (t) => this.appData.user = t;
|
|
642
|
+
setUserCommunicationProfile = (t) => this.appData.user_communication_profile = t;
|
|
643
|
+
setUserProfile = (t) => this.appData.user_profile = t;
|
|
644
|
+
}
|
|
645
|
+
class he {
|
|
646
|
+
globalStore;
|
|
647
|
+
survey = null;
|
|
648
|
+
currentQuestionIndex = 0;
|
|
649
|
+
question = null;
|
|
650
|
+
response = null;
|
|
651
|
+
responses = {};
|
|
652
|
+
constructor(t) {
|
|
653
|
+
this.globalStore = t, d(this);
|
|
654
|
+
}
|
|
655
|
+
get isLastQuestion() {
|
|
656
|
+
return this.currentQuestionIndex === this.surveyQuestions.length - 1;
|
|
657
|
+
}
|
|
658
|
+
get questionCount() {
|
|
659
|
+
return `${this.currentQuestionIndex + 1}/${this.surveyQuestions.length}`;
|
|
660
|
+
}
|
|
661
|
+
get responsePayload() {
|
|
662
|
+
return {
|
|
663
|
+
$survey_id: this.surveyId,
|
|
664
|
+
...this.responses
|
|
665
|
+
};
|
|
666
|
+
}
|
|
667
|
+
// TODO hardcode elsewhere
|
|
668
|
+
get surveyId() {
|
|
669
|
+
return window.app?.postHogPublicKey === "phc_KclQGnOZEaYCttkpiVpuyOYeBlixGo6xNphYgWV4CXo" ? "0196caa6-9b37-0000-98a7-f04e8d56faf5" : "0196a6b0-ccde-0000-b980-0b84ea2fef4a";
|
|
670
|
+
}
|
|
671
|
+
get surveyQuestions() {
|
|
672
|
+
return this.survey ? this.survey.questions : [];
|
|
673
|
+
}
|
|
674
|
+
loadSurvey = (t = !1) => {
|
|
675
|
+
Et.getActiveMatchingSurveys((e) => {
|
|
676
|
+
c(() => {
|
|
677
|
+
if (e.length > 0) {
|
|
678
|
+
const s = e.find((a) => a.id === this.surveyId);
|
|
679
|
+
s && (this.survey = s, this.currentQuestionIndex = 0, this.question = s.questions[0], this.response = null, this.responses = {});
|
|
680
|
+
}
|
|
681
|
+
});
|
|
682
|
+
}, t);
|
|
683
|
+
};
|
|
684
|
+
nextQuestion = () => {
|
|
685
|
+
this.currentQuestionIndex < this.surveyQuestions.length - 1 && (this.currentQuestionIndex += 1), this.response = null, this.question = this.surveyQuestions[this.currentQuestionIndex];
|
|
686
|
+
};
|
|
687
|
+
resetStore = () => {
|
|
688
|
+
this.survey = null, this.currentQuestionIndex = 0, this.question = null, this.response = null, this.responses = {};
|
|
689
|
+
};
|
|
690
|
+
setResponse = (t) => {
|
|
691
|
+
this.response = t, this.question && (this.responses[`$survey_response_${this.question.id}`] = t);
|
|
692
|
+
};
|
|
693
|
+
}
|
|
694
|
+
function ue(n, t, e, s = "asc") {
|
|
695
|
+
const a = s === "desc" ? -1 : 1;
|
|
696
|
+
return [...n, ...t].sort((o, r) => o[e] < r[e] ? -1 * a : o[e] > r[e] ? 1 * a : 0);
|
|
697
|
+
}
|
|
698
|
+
const ge = (n) => ({
|
|
699
|
+
...n,
|
|
700
|
+
//fields that are offer specific, adding here for visibility
|
|
701
|
+
image_url: n.image_url,
|
|
702
|
+
guid: n.guid,
|
|
703
|
+
created_at: n.created_at,
|
|
704
|
+
dismissed_at: n.dismissed_at,
|
|
705
|
+
active_at: n.campaign_activated_at,
|
|
706
|
+
displayed_at: n.has_been_viewed,
|
|
707
|
+
post_message_secondary: n.pulse_post_message_secondary,
|
|
708
|
+
//offer fields mapped to beat fields for functionality
|
|
709
|
+
title: n.pulse_title || n.campaign_name,
|
|
710
|
+
html_title: n.pulse_title || n.campaign_name,
|
|
711
|
+
short_title: n.pulse_title || n.campaign_name,
|
|
712
|
+
html_short_title: n.pulse_title || n.campaign_name,
|
|
713
|
+
micro_title: n.pulse_title || n.campaign_name,
|
|
714
|
+
html_micro_title: n.pulse_title || n.campaign_name,
|
|
715
|
+
supporting_action: n.pulse_call_to_action_text_secondary,
|
|
716
|
+
description: n.pulse_body,
|
|
717
|
+
html_description: n.pulse_body,
|
|
718
|
+
micro_description: n.pulse_body,
|
|
719
|
+
html_micro_description: n.pulse_body,
|
|
720
|
+
call_to_action: n.pulse_call_to_action_text,
|
|
721
|
+
html_micro_call_to_action: n.pulse_call_to_action_text,
|
|
722
|
+
micro_call_to_action: n.pulse_call_to_action_text,
|
|
723
|
+
is_dismissed: n.has_been_dismissed,
|
|
724
|
+
icon_type: 5,
|
|
725
|
+
template: "MarketingOffer",
|
|
726
|
+
//beat fields we null out
|
|
727
|
+
account_guids: [],
|
|
728
|
+
data_series: {},
|
|
729
|
+
has_been_displayed: !1,
|
|
730
|
+
is_obsolete: !1,
|
|
731
|
+
is_refreshable: !1,
|
|
732
|
+
is_sampled: !1,
|
|
733
|
+
merchant_guids: [],
|
|
734
|
+
payload: {},
|
|
735
|
+
pulse_campaign_name: n.campaign_name,
|
|
736
|
+
scheduled_payment_guids: [],
|
|
737
|
+
transaction_guids: [],
|
|
738
|
+
user_guid: "",
|
|
739
|
+
user_verification: 0
|
|
740
|
+
});
|
|
741
|
+
class pe {
|
|
742
|
+
globalStore;
|
|
743
|
+
api = new $("/", "");
|
|
744
|
+
beats = [];
|
|
745
|
+
isLoading = !1;
|
|
746
|
+
constructor(t) {
|
|
747
|
+
this.globalStore = t, this.api = new $(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
748
|
+
}
|
|
749
|
+
loadBeats = async () => {
|
|
750
|
+
this.isLoading = !0;
|
|
751
|
+
const t = await this.api.getBeats(), s = (await this.api.getOffers()).map((a) => ge(a));
|
|
752
|
+
c(() => {
|
|
753
|
+
this.beats = ue(t, s, "active_at", "desc"), this.isLoading = !1;
|
|
754
|
+
});
|
|
755
|
+
};
|
|
756
|
+
getFilteredBeats(t) {
|
|
757
|
+
const { categoryGuids: e, templates: s } = t;
|
|
758
|
+
let a = this.beats;
|
|
759
|
+
return e && (a = this.filterBeatsByCategory(a, e)), s && (a = this.filterBeatsByTemplate(a, s)), a;
|
|
760
|
+
}
|
|
761
|
+
// Return beats with any beat.category_guids that are in categoryGuids
|
|
762
|
+
filterBeatsByCategory(t, e) {
|
|
763
|
+
return t.filter((s) => s.category_guids?.some((a) => e.includes(a)));
|
|
764
|
+
}
|
|
765
|
+
// Return beats with a beat.template that is in templates
|
|
766
|
+
filterBeatsByTemplate(t, e) {
|
|
767
|
+
return t.filter((s) => e.some((a) => s.template === a));
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
class _e {
|
|
771
|
+
api = new X("/", "");
|
|
772
|
+
globalStore;
|
|
773
|
+
alert = "";
|
|
774
|
+
dateRange = { start: E(y()), end: T(y()) };
|
|
775
|
+
budgets = [];
|
|
776
|
+
selectedBudget;
|
|
777
|
+
selectedSubBudget;
|
|
778
|
+
isDataLoaded = !1;
|
|
779
|
+
theme = {};
|
|
780
|
+
merchantBudgets = [];
|
|
781
|
+
constructor(t) {
|
|
782
|
+
this.globalStore = t, this.api = new X(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
783
|
+
}
|
|
784
|
+
loadBudgetData = async () => {
|
|
785
|
+
this.globalStore.recurringTransactionsStore.isDataLoaded || await this.globalStore.recurringTransactionsStore.loadRepeatingTransactionData(), await this.loadBudgets(), ut(
|
|
786
|
+
() => this.detailedBudgets,
|
|
787
|
+
(t) => {
|
|
788
|
+
if (t) {
|
|
789
|
+
const e = this.selectedBudget;
|
|
790
|
+
e && (this.selectedBudget = It(t, e.guid));
|
|
791
|
+
const s = this.selectedSubBudget;
|
|
792
|
+
s && s.parent_guid && (this.selectedSubBudget = Ct(
|
|
793
|
+
t,
|
|
794
|
+
s.guid,
|
|
795
|
+
s.parent_guid
|
|
796
|
+
));
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
);
|
|
800
|
+
};
|
|
801
|
+
get detailedBudgets() {
|
|
802
|
+
return W(
|
|
803
|
+
this.budgets.filter(
|
|
804
|
+
(t) => t.category_guid !== w.INCOME && t.category_guid !== w.TRANSFER && t.category_guid !== w.INVESTMENTS
|
|
805
|
+
),
|
|
806
|
+
this.globalStore.categoryStore.detailedCategories,
|
|
807
|
+
this.globalStore.copyStore.copy.budgets,
|
|
808
|
+
this.theme
|
|
809
|
+
).sort((t, e) => t.percentage > e.percentage ? -1 : t.percentage < e.percentage ? 1 : 0);
|
|
810
|
+
}
|
|
811
|
+
// TODO: Replace this with income from recurring transactions. Income budgets are deprecated.
|
|
812
|
+
get incomeBudget() {
|
|
813
|
+
return W(
|
|
814
|
+
this.budgets.filter((s) => !s.parent_guid),
|
|
815
|
+
this.globalStore.categoryStore.detailedCategories,
|
|
816
|
+
this.globalStore.copyStore.copy.budgets,
|
|
817
|
+
this.theme
|
|
818
|
+
).reduce(
|
|
819
|
+
(s, a) => a.category_guid !== w.INCOME ? s : !s || a.percentage > s.percentage ? a : s,
|
|
820
|
+
void 0
|
|
821
|
+
)?.amount;
|
|
822
|
+
}
|
|
823
|
+
get unbudgetedCategories() {
|
|
824
|
+
return this.globalStore.categoryStore.spendCategories.filter(
|
|
825
|
+
(t) => !this.detailedBudgets.find((e) => e.category_guid === t.guid)
|
|
826
|
+
);
|
|
827
|
+
}
|
|
828
|
+
get totalBudgeted() {
|
|
829
|
+
return this.detailedBudgets.reduce((t, e) => t + e.amount, 0);
|
|
830
|
+
}
|
|
831
|
+
addBudget = async (t, e, s = null) => {
|
|
832
|
+
try {
|
|
833
|
+
const a = await this.api.addBudget(t, e, s);
|
|
834
|
+
c(() => {
|
|
835
|
+
this.budgets.push(a);
|
|
836
|
+
});
|
|
837
|
+
} catch (a) {
|
|
838
|
+
console.error(`Error adding budget: ${a}`);
|
|
839
|
+
}
|
|
840
|
+
};
|
|
841
|
+
deleteBudget = async (t) => {
|
|
842
|
+
try {
|
|
843
|
+
await this.api.deleteBudget(t), c(() => {
|
|
844
|
+
const e = this.budgets.findIndex((s) => s.guid === t);
|
|
845
|
+
e >= 0 && this.budgets.splice(e, 1);
|
|
846
|
+
});
|
|
847
|
+
} catch (e) {
|
|
848
|
+
console.error(`Error deleting budget: ${e}`);
|
|
849
|
+
}
|
|
850
|
+
};
|
|
851
|
+
loadBudgets = async () => {
|
|
852
|
+
try {
|
|
853
|
+
const t = await this.api.getBudgets();
|
|
854
|
+
this.setBudgets(t);
|
|
855
|
+
} catch (t) {
|
|
856
|
+
throw console.error(`Error occurred while loading budgets: ${t}`), t;
|
|
857
|
+
}
|
|
858
|
+
};
|
|
859
|
+
setAlert = (t) => this.alert = t;
|
|
860
|
+
setBudgets = (t) => {
|
|
861
|
+
this.budgets = t, this.isDataLoaded = !0;
|
|
862
|
+
};
|
|
863
|
+
setDateRange = (t) => this.dateRange = t;
|
|
864
|
+
setSelectedBudget = (t) => this.selectedBudget = t;
|
|
865
|
+
setSelectedSubBudget = (t) => this.selectedSubBudget = t;
|
|
866
|
+
setTheme = (t) => this.theme = t;
|
|
867
|
+
/**
|
|
868
|
+
* Recalculate budget by using the average amount from top-level categories
|
|
869
|
+
* @param categories Detailed categories
|
|
870
|
+
*/
|
|
871
|
+
recalculateBudgets = async (t) => {
|
|
872
|
+
try {
|
|
873
|
+
for (const s of t) {
|
|
874
|
+
const a = this.budgets.find((o) => o.category_guid === s.guid);
|
|
875
|
+
a ? await this.api.updateBudget({
|
|
876
|
+
...a,
|
|
877
|
+
amount: s.totalAverageAmount
|
|
878
|
+
}) : await this.api.addBudget(s, s.totalAverageAmount);
|
|
879
|
+
}
|
|
880
|
+
const e = this.budgets.filter(
|
|
881
|
+
(s) => !t.find((a) => a.guid === s.category_guid)
|
|
882
|
+
);
|
|
883
|
+
for (const s of e)
|
|
884
|
+
await this.api.deleteBudget(s.guid);
|
|
885
|
+
return await this.loadBudgets(), { data: this.budgets, isSuccess: !0 };
|
|
886
|
+
} catch (e) {
|
|
887
|
+
return console.error("error recalculating budgets", e), { data: [], isSuccess: !1 };
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
updateBudget = async (t) => {
|
|
891
|
+
try {
|
|
892
|
+
const e = await this.api.updateBudget(t);
|
|
893
|
+
c(() => {
|
|
894
|
+
const s = this.budgets.findIndex((a) => a.guid === t.guid);
|
|
895
|
+
s >= 0 && (this.budgets[s] = e);
|
|
896
|
+
});
|
|
897
|
+
} catch (e) {
|
|
898
|
+
console.error(`Error updating budget: ${e}`);
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
getMerchantBudgetByMerchantGuid = (t) => this.merchantBudgets.find(
|
|
902
|
+
(e) => e?.merchant_guid === t
|
|
903
|
+
);
|
|
904
|
+
setMerchantBudgets = (t) => {
|
|
905
|
+
this.merchantBudgets = t;
|
|
906
|
+
};
|
|
907
|
+
addMerchantBudget = async (t, e) => {
|
|
908
|
+
try {
|
|
909
|
+
const s = await this.api.addMerchantBudget(t, e);
|
|
910
|
+
return c(() => {
|
|
911
|
+
this.merchantBudgets.push(s);
|
|
912
|
+
}), { isSuccess: !0 };
|
|
913
|
+
} catch (s) {
|
|
914
|
+
return console.error(`Error adding merchant budget: ${s}`), { isSuccess: !1 };
|
|
915
|
+
}
|
|
916
|
+
};
|
|
917
|
+
updateMerchantBudget = async (t) => {
|
|
918
|
+
try {
|
|
919
|
+
const { guid: e, amount: s } = t, a = await this.api.updateMerchantBudget(e, s);
|
|
920
|
+
return c(() => {
|
|
921
|
+
const o = this.merchantBudgets.findIndex((r) => r.guid === t.guid);
|
|
922
|
+
o >= 0 && (this.merchantBudgets[o] = a);
|
|
923
|
+
}), { isSuccess: !0 };
|
|
924
|
+
} catch (e) {
|
|
925
|
+
return console.error(`Error updating merchant budget: ${e}`), { isSuccess: !1 };
|
|
926
|
+
}
|
|
927
|
+
};
|
|
928
|
+
deleteMerchantBudget = async (t) => {
|
|
929
|
+
try {
|
|
930
|
+
return await this.api.deleteMerchantBudget(t), c(() => {
|
|
931
|
+
this.merchantBudgets = this.merchantBudgets.filter((e) => e.guid !== t);
|
|
932
|
+
}), { isSuccess: !0 };
|
|
933
|
+
} catch (e) {
|
|
934
|
+
return console.error(`Error deleting merchant budget: ${e}`), { isSuccess: !1 };
|
|
935
|
+
}
|
|
936
|
+
};
|
|
937
|
+
}
|
|
938
|
+
class fe {
|
|
939
|
+
globalStore;
|
|
940
|
+
uiStore;
|
|
941
|
+
constructor(t) {
|
|
942
|
+
this.globalStore = t, this.uiStore = new ye(t), d(this);
|
|
943
|
+
}
|
|
944
|
+
completeOnboarding = async () => {
|
|
945
|
+
const t = {
|
|
946
|
+
...this.globalStore.userStore.userProfile,
|
|
947
|
+
has_completed_cash_flow_onboarding: !0
|
|
948
|
+
};
|
|
949
|
+
await this.globalStore.userStore.updateUserProfile(t);
|
|
950
|
+
};
|
|
951
|
+
}
|
|
952
|
+
let ye = class {
|
|
953
|
+
globalStore;
|
|
954
|
+
// Cashflow is hard-coded to display 30 days starting from today. This is the
|
|
955
|
+
// single source of truth for Cash Flow's window; it intentionally does NOT
|
|
956
|
+
// mutate RecurringTransactionsStore.dateRange, so Cash Flow stays decoupled
|
|
957
|
+
// from other widgets (e.g. Recurring Transactions) that drive that shared range.
|
|
958
|
+
dateRange = { start: y(), end: Dt(y(), 30) };
|
|
959
|
+
isDirty = !1;
|
|
960
|
+
constructor(t) {
|
|
961
|
+
this.globalStore = t, d(this);
|
|
962
|
+
}
|
|
963
|
+
// Recurrence data scoped to Cash Flow's own dateRange, sourced from the
|
|
964
|
+
// range-parameterized helpers on RecurringTransactionsStore. Computeds (not
|
|
965
|
+
// component state) per the project's MobX conventions.
|
|
966
|
+
get income() {
|
|
967
|
+
return this.globalStore.recurringTransactionsStore.incomeForRange(this.dateRange);
|
|
968
|
+
}
|
|
969
|
+
get upcomingIncome() {
|
|
970
|
+
return this.globalStore.recurringTransactionsStore.upcomingIncomeForRange(this.dateRange);
|
|
971
|
+
}
|
|
972
|
+
get upcomingExpenses() {
|
|
973
|
+
return this.globalStore.recurringTransactionsStore.upcomingExpensesForRange(this.dateRange);
|
|
974
|
+
}
|
|
975
|
+
get nextIncome() {
|
|
976
|
+
return this.globalStore.recurringTransactionsStore.nextIncomeForRange(this.dateRange);
|
|
977
|
+
}
|
|
978
|
+
// Visible cash accounts that are currently selected in the account filter.
|
|
979
|
+
// Computed (single source of truth) so it stays in sync with account data and
|
|
980
|
+
// the filter without effect-based syncing in components.
|
|
981
|
+
get selectedCashAccounts() {
|
|
982
|
+
const { selectedAccountGuids: t } = this.globalStore.globalUiStore;
|
|
983
|
+
return this.globalStore.accountStore.visibleCashAccounts.filter(
|
|
984
|
+
(e) => t.includes(e.guid)
|
|
985
|
+
);
|
|
986
|
+
}
|
|
987
|
+
// Total spendable/starting balance across the selected cash accounts, using
|
|
988
|
+
// the shared per-account balance rule (available vs current balance).
|
|
989
|
+
get selectedCashBalance() {
|
|
990
|
+
const t = this.globalStore.appConfig.config.display_available_balance_in_accounts;
|
|
991
|
+
return this.selectedCashAccounts.reduce(
|
|
992
|
+
(e, s) => e + wt(s, t),
|
|
993
|
+
0
|
|
994
|
+
);
|
|
995
|
+
}
|
|
996
|
+
// Returns the number of days until the next income activity or 0 if there is no income activity
|
|
997
|
+
get daysUntilNextIncome() {
|
|
998
|
+
return this.nextIncome ? Math.abs(Lt(y(), this.nextIncome.expectedDate)) : 0;
|
|
999
|
+
}
|
|
1000
|
+
// Returns the expenses (Activities) until the next income activity or the end of the month
|
|
1001
|
+
// if there is no income activity
|
|
1002
|
+
get expensesTilNextIncome() {
|
|
1003
|
+
return this.upcomingExpenses.filter(
|
|
1004
|
+
(t) => H(t.expectedDate, this.nextIncome?.expectedDate || T(/* @__PURE__ */ new Date()))
|
|
1005
|
+
);
|
|
1006
|
+
}
|
|
1007
|
+
};
|
|
1008
|
+
class me {
|
|
1009
|
+
globalStore;
|
|
1010
|
+
uiStore;
|
|
1011
|
+
api = new J("/", "");
|
|
1012
|
+
categories = [];
|
|
1013
|
+
categoriesLoaded = !1;
|
|
1014
|
+
categoriesLoading = !1;
|
|
1015
|
+
dateRangeCategoryTotals = [];
|
|
1016
|
+
monthlyCategoryTotals = [];
|
|
1017
|
+
dateRangeTotalsLoaded = !1;
|
|
1018
|
+
dateRangeTotalsLoading = !1;
|
|
1019
|
+
monthlyTotalsLoaded = !1;
|
|
1020
|
+
monthlyTotalsLoading = !1;
|
|
1021
|
+
constructor(t) {
|
|
1022
|
+
this.globalStore = t, this.uiStore = new Se(), this.api = new J(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
1023
|
+
}
|
|
1024
|
+
get detailedCategories() {
|
|
1025
|
+
return this.globalStore.isInitialized ? vt(
|
|
1026
|
+
this.categories,
|
|
1027
|
+
this.globalStore.copyStore.copy.categories,
|
|
1028
|
+
this.dateRangeCategoryTotals,
|
|
1029
|
+
this.monthlyCategoryTotals
|
|
1030
|
+
) : [];
|
|
1031
|
+
}
|
|
1032
|
+
get detailedCategoriesWithTransactions() {
|
|
1033
|
+
return $t(
|
|
1034
|
+
this.detailedCategories,
|
|
1035
|
+
this.globalStore.transactionStore.sortedTransactions
|
|
1036
|
+
);
|
|
1037
|
+
}
|
|
1038
|
+
get incomeCategories() {
|
|
1039
|
+
return this.detailedCategories.filter((t) => t.is_income);
|
|
1040
|
+
}
|
|
1041
|
+
get spendCategories() {
|
|
1042
|
+
return this.detailedCategories.filter(
|
|
1043
|
+
(t) => !t.is_income && !t.isTransfer && t.guid !== w.INVESTMENTS
|
|
1044
|
+
);
|
|
1045
|
+
}
|
|
1046
|
+
get transferCategories() {
|
|
1047
|
+
return this.detailedCategories.filter((t) => t.isTransfer);
|
|
1048
|
+
}
|
|
1049
|
+
setCategories = (t) => {
|
|
1050
|
+
this.categories = t, this.categoriesLoading = !1, this.categoriesLoaded = !0;
|
|
1051
|
+
};
|
|
1052
|
+
setMonthlyCategoryTotals = (t) => {
|
|
1053
|
+
this.monthlyCategoryTotals = t, this.monthlyTotalsLoading = !1, this.monthlyTotalsLoaded = !0;
|
|
1054
|
+
};
|
|
1055
|
+
setDateRangeCategoryTotals = (t) => {
|
|
1056
|
+
this.dateRangeCategoryTotals = t, this.dateRangeTotalsLoading = !1, this.dateRangeTotalsLoaded = !0;
|
|
1057
|
+
};
|
|
1058
|
+
get trendsCategories() {
|
|
1059
|
+
return this.detailedCategories.filter((t) => t.totalAmount !== 0).filter((t) => t.guid !== w.INVESTMENTS && t.guid !== w.TRANSFER);
|
|
1060
|
+
}
|
|
1061
|
+
addCategory = async (t, e) => {
|
|
1062
|
+
const s = { name: t, parent_guid: e };
|
|
1063
|
+
try {
|
|
1064
|
+
await this.api.addCategory(s), await this.loadCategories();
|
|
1065
|
+
} catch (a) {
|
|
1066
|
+
console.error(`Error occurred while adding category: ${a}`);
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
loadCategories = async () => {
|
|
1070
|
+
if (!this.categoriesLoading) {
|
|
1071
|
+
this.categoriesLoading = !0;
|
|
1072
|
+
try {
|
|
1073
|
+
const t = await this.api.getCategories();
|
|
1074
|
+
this.setCategories(t);
|
|
1075
|
+
} catch (t) {
|
|
1076
|
+
console.error(`Error occurred while getting categories: ${t}`);
|
|
1077
|
+
}
|
|
1078
|
+
}
|
|
1079
|
+
};
|
|
1080
|
+
loadDateRangeCategoryTotals = async (t, e, s) => {
|
|
1081
|
+
if (!this.dateRangeTotalsLoading) {
|
|
1082
|
+
this.dateRangeTotalsLoading = !0;
|
|
1083
|
+
try {
|
|
1084
|
+
const a = await this.api.getDateRangeCategoryTotals(
|
|
1085
|
+
m(e),
|
|
1086
|
+
m(s),
|
|
1087
|
+
t
|
|
1088
|
+
);
|
|
1089
|
+
this.setDateRangeCategoryTotals(a);
|
|
1090
|
+
} catch (a) {
|
|
1091
|
+
console.error(`Error occurred while getting date range category totals: ${a}`);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
};
|
|
1095
|
+
loadMonthlyCategoryTotals = async (t = this.globalStore.globalUiStore.selectedAccounts, e, s) => {
|
|
1096
|
+
if (this.monthlyTotalsLoading) return;
|
|
1097
|
+
this.monthlyTotalsLoading = !0;
|
|
1098
|
+
const a = m(E(e ?? G(/* @__PURE__ */ new Date(), 11))), o = m(T(s ?? /* @__PURE__ */ new Date()));
|
|
1099
|
+
try {
|
|
1100
|
+
const r = await this.api.getMonthlyCategoryTotals(a, o, t);
|
|
1101
|
+
this.setMonthlyCategoryTotals(r);
|
|
1102
|
+
} catch (r) {
|
|
1103
|
+
console.error(`Error occurred while getting monthly category totals: ${r}`);
|
|
1104
|
+
}
|
|
1105
|
+
};
|
|
1106
|
+
reloadCategoryTotals = async (t, e, s) => {
|
|
1107
|
+
const a = e ?? G(/* @__PURE__ */ new Date(), 11), o = s ?? T(/* @__PURE__ */ new Date());
|
|
1108
|
+
try {
|
|
1109
|
+
await Promise.all([
|
|
1110
|
+
this.loadMonthlyCategoryTotals(t, a, o),
|
|
1111
|
+
this.loadDateRangeCategoryTotals(t, a, o)
|
|
1112
|
+
]);
|
|
1113
|
+
} catch (r) {
|
|
1114
|
+
console.error(`Error occurred while getting category totals: ${r}`);
|
|
1115
|
+
}
|
|
1116
|
+
};
|
|
1117
|
+
removeCategory = async (t) => {
|
|
1118
|
+
try {
|
|
1119
|
+
await this.api.removeCategory(t), await this.loadCategories();
|
|
1120
|
+
} catch (e) {
|
|
1121
|
+
console.error(`Error occurred while removing category: ${e}`);
|
|
1122
|
+
}
|
|
1123
|
+
};
|
|
1124
|
+
updateCategory = async (t) => {
|
|
1125
|
+
try {
|
|
1126
|
+
await this.api.updateCategory(t), await this.loadCategories();
|
|
1127
|
+
} catch (e) {
|
|
1128
|
+
console.error(`Error occurred while updating category: ${e}`);
|
|
1129
|
+
}
|
|
1130
|
+
};
|
|
1131
|
+
// TODO: Remove this after refactoring Trends components to use detailedCategories
|
|
1132
|
+
getCategoryName = (t) => this.categories.find((s) => s.guid === t)?.name ?? Rt[t];
|
|
1133
|
+
}
|
|
1134
|
+
let Se = class {
|
|
1135
|
+
expandedGuid = null;
|
|
1136
|
+
selectedGuid = null;
|
|
1137
|
+
searchValue = "";
|
|
1138
|
+
showSelected = !0;
|
|
1139
|
+
shouldDisableDrawerScroll = !1;
|
|
1140
|
+
unselectable = [];
|
|
1141
|
+
unselectableText = "";
|
|
1142
|
+
savedOnSelect;
|
|
1143
|
+
// todo
|
|
1144
|
+
constructor() {
|
|
1145
|
+
d(this);
|
|
1146
|
+
}
|
|
1147
|
+
setExpandedGuid = (t) => this.expandedGuid = t;
|
|
1148
|
+
setSelectedGuid = (t) => this.selectedGuid = t;
|
|
1149
|
+
setSearchValue = (t) => this.searchValue = t;
|
|
1150
|
+
setShouldDisableDrawerScroll = (t) => this.shouldDisableDrawerScroll = t;
|
|
1151
|
+
setShowSelected = (t) => this.showSelected = t;
|
|
1152
|
+
setUnselectable = (t) => this.unselectable = t;
|
|
1153
|
+
setUnselectableText = (t) => this.unselectableText = t;
|
|
1154
|
+
onSelect = (t) => this.savedOnSelect(t);
|
|
1155
|
+
setOnSelect = (t) => this.savedOnSelect = t;
|
|
1156
|
+
};
|
|
1157
|
+
class Te {
|
|
1158
|
+
globalStore;
|
|
1159
|
+
widgetApi = new ct("/", "");
|
|
1160
|
+
constructor(t) {
|
|
1161
|
+
this.globalStore = t, this.widgetApi = new ct(t.endpoint, t.sessionToken), d(this);
|
|
1162
|
+
}
|
|
1163
|
+
loadWidget = async ({ widget: t = "connect_widget", mode: e = "light", ...s }) => await this.widgetApi.requestWidgetUrl({
|
|
1164
|
+
widget_url: { widget_type: t, color_scheme: e, ...s }
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
class Ae {
|
|
1168
|
+
globalStore;
|
|
1169
|
+
uiStore;
|
|
1170
|
+
constructor(t) {
|
|
1171
|
+
this.globalStore = t, this.uiStore = new we(), d(this);
|
|
1172
|
+
}
|
|
1173
|
+
get debts() {
|
|
1174
|
+
const { visibleDebtAccounts: t } = this.globalStore.accountStore, { selectedAccountGuids: e } = this.globalStore.globalUiStore, { debtGoals: s } = this.globalStore.goalStore, a = e.length ? t.filter((o) => e.includes(o.guid)) : t;
|
|
1175
|
+
return Ft(a, s);
|
|
1176
|
+
}
|
|
1177
|
+
get totalMonthlyPayments() {
|
|
1178
|
+
return this.debts.map((e) => Number(e.monthly_payment)).filter((e) => !isNaN(e)).reduce((e, s) => e + s, 0);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
let we = class {
|
|
1182
|
+
isLoading = !1;
|
|
1183
|
+
selectedDebtChartData = {};
|
|
1184
|
+
selectedDebtPriority = Ut.LOWEST_BALANCE;
|
|
1185
|
+
constructor() {
|
|
1186
|
+
d(this);
|
|
1187
|
+
}
|
|
1188
|
+
get showError() {
|
|
1189
|
+
const { interest_rate: t, monthly_payment: e } = this.selectedDebtChartData;
|
|
1190
|
+
return t === void 0 || e === void 0;
|
|
1191
|
+
}
|
|
1192
|
+
get showCompleted() {
|
|
1193
|
+
return this.selectedDebtChartData.is_paid_off;
|
|
1194
|
+
}
|
|
1195
|
+
setIsLoading = (t) => this.isLoading = t;
|
|
1196
|
+
setSelectedDebtChartData = (t) => this.selectedDebtChartData = t;
|
|
1197
|
+
setSelectedDebtPriority = (t) => this.selectedDebtPriority = t;
|
|
1198
|
+
};
|
|
1199
|
+
const be = (n) => n.sort((t, e) => t.monthly_health_score_average.year !== e.monthly_health_score_average.year ? t.monthly_health_score_average.year - e.monthly_health_score_average.year : t.monthly_health_score_average.month - e.monthly_health_score_average.month).map((t) => ({
|
|
1200
|
+
x: U(
|
|
1201
|
+
new Date(0, t.monthly_health_score_average.month - 1, 1),
|
|
1202
|
+
k.MONTH_SHORT
|
|
1203
|
+
),
|
|
1204
|
+
y: Math.round(t.monthly_health_score_average.average_health_score)
|
|
1205
|
+
})), Ie = (n) => n.map(({ transaction: e }) => ({
|
|
1206
|
+
...e
|
|
1207
|
+
})).sort((e, s) => s.date - e.date);
|
|
1208
|
+
class Ce {
|
|
1209
|
+
api = new Z("/", "");
|
|
1210
|
+
augmentedChartData = [];
|
|
1211
|
+
averageHealthScores = [];
|
|
1212
|
+
monthlySummaries = [];
|
|
1213
|
+
incomeTransactions = [];
|
|
1214
|
+
debtSpendTransactions = [];
|
|
1215
|
+
spendingFeeTransactions = [];
|
|
1216
|
+
spendTransactions = [];
|
|
1217
|
+
globalStore;
|
|
1218
|
+
healthScore = {};
|
|
1219
|
+
healthScoreChange;
|
|
1220
|
+
healthScoreChangeReports = [];
|
|
1221
|
+
peerScore = null;
|
|
1222
|
+
isSpendingInitialized = !1;
|
|
1223
|
+
isIncomeInitialized = !1;
|
|
1224
|
+
constructor(t) {
|
|
1225
|
+
this.globalStore = t, this.api = new Z(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
1226
|
+
}
|
|
1227
|
+
setSpendingInitialized = (t) => {
|
|
1228
|
+
this.isSpendingInitialized = t;
|
|
1229
|
+
};
|
|
1230
|
+
setIncomeInitialized = (t) => {
|
|
1231
|
+
this.isIncomeInitialized = t;
|
|
1232
|
+
};
|
|
1233
|
+
calculateHealthScore = async (t = !0) => {
|
|
1234
|
+
try {
|
|
1235
|
+
const e = await this.api.calculateHealthScore();
|
|
1236
|
+
let s = 0;
|
|
1237
|
+
t && await this.loadHealthScoreChangeReports();
|
|
1238
|
+
const a = e?.health_score || 0, o = this.healthScoreChangeReports.at(-1)?.older_health_score || 0;
|
|
1239
|
+
s = a - o, c(() => {
|
|
1240
|
+
this.healthScore = e, this.healthScoreChange = s;
|
|
1241
|
+
});
|
|
1242
|
+
} catch (e) {
|
|
1243
|
+
console.error("Error calculating health score:", e);
|
|
1244
|
+
}
|
|
1245
|
+
};
|
|
1246
|
+
loadAverageHealthScores = async () => {
|
|
1247
|
+
try {
|
|
1248
|
+
const t = await this.api.getAverageHealthScores();
|
|
1249
|
+
c(() => {
|
|
1250
|
+
this.averageHealthScores = t;
|
|
1251
|
+
});
|
|
1252
|
+
} catch (t) {
|
|
1253
|
+
console.error("Error loading average health scores:", t);
|
|
1254
|
+
}
|
|
1255
|
+
};
|
|
1256
|
+
loadMonthlySummaries = async () => {
|
|
1257
|
+
try {
|
|
1258
|
+
const t = await this.api.getMonthlySummaries();
|
|
1259
|
+
c(() => {
|
|
1260
|
+
this.monthlySummaries = t;
|
|
1261
|
+
});
|
|
1262
|
+
} catch (t) {
|
|
1263
|
+
console.error("Error loading monthly summaries:", t);
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
loadDebtSpend = async () => {
|
|
1267
|
+
try {
|
|
1268
|
+
const t = await this.api.getDebtSpend();
|
|
1269
|
+
c(() => {
|
|
1270
|
+
this.debtSpendTransactions = t;
|
|
1271
|
+
});
|
|
1272
|
+
} catch (t) {
|
|
1273
|
+
console.error("Error loading debt spend:", t);
|
|
1274
|
+
}
|
|
1275
|
+
};
|
|
1276
|
+
loadIncome = async () => {
|
|
1277
|
+
this.setIncomeInitialized(!1);
|
|
1278
|
+
try {
|
|
1279
|
+
const t = await this.api.getIncome();
|
|
1280
|
+
c(() => {
|
|
1281
|
+
this.incomeTransactions = t, this.setIncomeInitialized(!0);
|
|
1282
|
+
});
|
|
1283
|
+
} catch (t) {
|
|
1284
|
+
console.error("Error loading income:", t);
|
|
1285
|
+
}
|
|
1286
|
+
};
|
|
1287
|
+
loadHealthScoreChangeReports = async () => {
|
|
1288
|
+
const t = m(G(/* @__PURE__ */ new Date(), 2)), e = m(/* @__PURE__ */ new Date());
|
|
1289
|
+
try {
|
|
1290
|
+
const s = await this.api.getHealthScoreChangeReports(
|
|
1291
|
+
t,
|
|
1292
|
+
e
|
|
1293
|
+
);
|
|
1294
|
+
c(() => {
|
|
1295
|
+
this.healthScoreChangeReports = s;
|
|
1296
|
+
});
|
|
1297
|
+
} catch (s) {
|
|
1298
|
+
console.error("Error loading health score change reports:", s);
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1301
|
+
loadPeerScore = async () => {
|
|
1302
|
+
const t = kt(Ht(this.globalStore.appDataStore.user.birthday), "yyyy");
|
|
1303
|
+
try {
|
|
1304
|
+
const e = await this.api.getPeerScore(t);
|
|
1305
|
+
c(() => {
|
|
1306
|
+
this.peerScore = e;
|
|
1307
|
+
});
|
|
1308
|
+
} catch (e) {
|
|
1309
|
+
console.error("Error loading peer score:", e);
|
|
1310
|
+
}
|
|
1311
|
+
};
|
|
1312
|
+
loadAugmentedChartData = async () => {
|
|
1313
|
+
try {
|
|
1314
|
+
const t = await this.api.getAverageHealthScores();
|
|
1315
|
+
c(() => {
|
|
1316
|
+
this.augmentedChartData = be(t);
|
|
1317
|
+
});
|
|
1318
|
+
} catch (t) {
|
|
1319
|
+
console.error(`Error occurred while getting augmented chart data: ${t}`);
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
getSpendingFeeTransactions = async () => {
|
|
1323
|
+
try {
|
|
1324
|
+
const t = await this.api.getSpendingFeeTransactions(), e = Ie(t);
|
|
1325
|
+
c(() => {
|
|
1326
|
+
this.spendingFeeTransactions = e;
|
|
1327
|
+
});
|
|
1328
|
+
} catch (t) {
|
|
1329
|
+
console.error(`Error occurred while getting spending fee transactions: ${t}`);
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1332
|
+
loadSpendTransactions = async () => {
|
|
1333
|
+
this.setSpendingInitialized(!1);
|
|
1334
|
+
try {
|
|
1335
|
+
const t = await this.api.getStandardSpend();
|
|
1336
|
+
c(() => {
|
|
1337
|
+
this.spendTransactions = [...t], this.setSpendingInitialized(!0);
|
|
1338
|
+
});
|
|
1339
|
+
} catch (t) {
|
|
1340
|
+
console.error("Error loading spend transactions:", t);
|
|
1341
|
+
}
|
|
1342
|
+
};
|
|
1343
|
+
get spendAndDebtTransactions() {
|
|
1344
|
+
return [...this.spendTransactions, ...this.debtSpendTransactions];
|
|
1345
|
+
}
|
|
1346
|
+
get allTransactions() {
|
|
1347
|
+
return {
|
|
1348
|
+
income: this.incomeTransactions,
|
|
1349
|
+
debtSpend: this.debtSpendTransactions,
|
|
1350
|
+
spendingFee: this.spendingFeeTransactions,
|
|
1351
|
+
spend: this.spendTransactions
|
|
1352
|
+
};
|
|
1353
|
+
}
|
|
1354
|
+
handleFinstrongWidgetPrimaryCtaClick = (t) => () => {
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
const lt = {
|
|
1358
|
+
clientConfig: {},
|
|
1359
|
+
clientStyleProfile: {},
|
|
1360
|
+
config: {
|
|
1361
|
+
assets_prefix: "/assets",
|
|
1362
|
+
bundle: "widgetLoader",
|
|
1363
|
+
client_guid: "",
|
|
1364
|
+
dashboard_accounts_index: 6,
|
|
1365
|
+
dashboard_accounts_location: 0,
|
|
1366
|
+
dashboard_activity_index: 2,
|
|
1367
|
+
dashboard_activity_location: 0,
|
|
1368
|
+
dashboard_budgets_index: 5,
|
|
1369
|
+
dashboard_budgets_location: 1,
|
|
1370
|
+
dashboard_cash_flow_index: 0,
|
|
1371
|
+
dashboard_cash_flow_location: 0,
|
|
1372
|
+
dashboard_connect_index: 7,
|
|
1373
|
+
dashboard_connect_location: 1,
|
|
1374
|
+
dashboard_insights_index: 3,
|
|
1375
|
+
dashboard_insights_location: 1,
|
|
1376
|
+
dashboard_spending_index: 1,
|
|
1377
|
+
dashboard_spending_location: 1,
|
|
1378
|
+
dashboard_survey_index: 8,
|
|
1379
|
+
dashboard_survey_location: 1,
|
|
1380
|
+
dashboard_trends_index: 4,
|
|
1381
|
+
dashboard_trends_location: 0,
|
|
1382
|
+
display_account_number_in_accounts: !0,
|
|
1383
|
+
display_add_manual_transaction_in_transactions: !0,
|
|
1384
|
+
display_available_balance_in_accounts: !0,
|
|
1385
|
+
display_email_edit_field_in_settings: !0,
|
|
1386
|
+
display_mobile_devices_in_settings: !0,
|
|
1387
|
+
display_notification_settings_in_settings: !0,
|
|
1388
|
+
display_only_external_accounts_in_accounts: !1,
|
|
1389
|
+
display_password_options_in_settings: !0,
|
|
1390
|
+
display_sms_edit_field_in_settings: !0,
|
|
1391
|
+
display_terms_and_conditions: !0,
|
|
1392
|
+
display_user_profile_in_settings: !0,
|
|
1393
|
+
display_user_transaction_rules_in_settings: !0,
|
|
1394
|
+
display_widget_headings: !0,
|
|
1395
|
+
enable_add_account_in_zero_state: !0,
|
|
1396
|
+
enable_aggregation_prompts: !0,
|
|
1397
|
+
enable_external_accounts_in_goals_widget: !0,
|
|
1398
|
+
enable_funds_transfers_in_goals_widget: !1,
|
|
1399
|
+
enable_manual_accounts: !0,
|
|
1400
|
+
enable_mark_account_closed_for_held_accounts: !0,
|
|
1401
|
+
enable_mark_account_duplicate_for_held_accounts: !0,
|
|
1402
|
+
enable_renaming_home_accounts: !0,
|
|
1403
|
+
enable_support_requests: !1,
|
|
1404
|
+
language: "en-US",
|
|
1405
|
+
product_name: "Money Dashboard",
|
|
1406
|
+
session_token: "",
|
|
1407
|
+
show_account_nicknames_in_master: !1,
|
|
1408
|
+
show_accounts_widget_in_master: !0,
|
|
1409
|
+
show_budgets_widget_in_master: !0,
|
|
1410
|
+
show_carousel_card_border_in_pulse_micro_widget: !1,
|
|
1411
|
+
show_cash_flow_widget_in_master: !0,
|
|
1412
|
+
show_connections_widget_in_master: !0,
|
|
1413
|
+
show_debts_widget_in_master: !0,
|
|
1414
|
+
show_finstrong_widget_in_master: !0,
|
|
1415
|
+
show_full_experience_link_in_pulse_micro_widget: !1,
|
|
1416
|
+
show_full_experience_link_in_pulse_mini_widget: !1,
|
|
1417
|
+
show_goals_widget_in_master: !0,
|
|
1418
|
+
show_help_widget_in_master: !0,
|
|
1419
|
+
show_horizontal_padding_in_pulse_micro_widget: !0,
|
|
1420
|
+
show_icon_in_pulse_micro_widget: !0,
|
|
1421
|
+
show_insights_widget_in_master: !0,
|
|
1422
|
+
show_investments_widget_in_master: !1,
|
|
1423
|
+
show_mx_branding: !0,
|
|
1424
|
+
show_navigation_controls_in_pulse_micro_widget: !0,
|
|
1425
|
+
show_net_worth_widget_in_master: !0,
|
|
1426
|
+
show_notifications_widget_in_master: !0,
|
|
1427
|
+
show_recurring_transactions_widget_in_master: !0,
|
|
1428
|
+
show_settings_widget_in_master: !0,
|
|
1429
|
+
show_spending_plan_widget_in_master: !1,
|
|
1430
|
+
show_spending_widget_in_master: !0,
|
|
1431
|
+
show_transactions_widget_in_master: !0,
|
|
1432
|
+
show_trends_widget_in_master: !0,
|
|
1433
|
+
type: "money-dashboard",
|
|
1434
|
+
websocket: {
|
|
1435
|
+
hmac: "",
|
|
1436
|
+
token: "",
|
|
1437
|
+
url: ""
|
|
1438
|
+
},
|
|
1439
|
+
widgets_display_name: "Money Dashboard "
|
|
1440
|
+
},
|
|
1441
|
+
honeyBadgerPublicKey: "",
|
|
1442
|
+
options: {
|
|
1443
|
+
assets_prefix: "/assets",
|
|
1444
|
+
brokaw_auth: {
|
|
1445
|
+
token: "",
|
|
1446
|
+
hmac: "",
|
|
1447
|
+
url: ""
|
|
1448
|
+
},
|
|
1449
|
+
brokaw_websocket_url: "",
|
|
1450
|
+
bundle: "widgetLoader",
|
|
1451
|
+
custom_copy_namespace: "",
|
|
1452
|
+
language: "en-US",
|
|
1453
|
+
product_name: "Master Widget",
|
|
1454
|
+
session_token: "",
|
|
1455
|
+
subtype: "master",
|
|
1456
|
+
type: "money_dashboard"
|
|
1457
|
+
},
|
|
1458
|
+
postHogPublicKey: "phc_1fVYJICC69TpW4wagp9o2XqQ8E7X98cAmcR5psSpfkE",
|
|
1459
|
+
userFeatures: []
|
|
1460
|
+
};
|
|
1461
|
+
class Ns {
|
|
1462
|
+
// Global properties
|
|
1463
|
+
appConfig = lt;
|
|
1464
|
+
endpoint = "/";
|
|
1465
|
+
sessionToken = "";
|
|
1466
|
+
onError;
|
|
1467
|
+
onStoreUpdate;
|
|
1468
|
+
// Data Stores
|
|
1469
|
+
accountStore;
|
|
1470
|
+
appDataStore;
|
|
1471
|
+
analyticsStore;
|
|
1472
|
+
beatStore;
|
|
1473
|
+
budgetsStore;
|
|
1474
|
+
cashflowStore;
|
|
1475
|
+
categoryStore;
|
|
1476
|
+
connectStore;
|
|
1477
|
+
copyStore;
|
|
1478
|
+
debtsStore;
|
|
1479
|
+
finstrongStore;
|
|
1480
|
+
goalStore;
|
|
1481
|
+
helpStore;
|
|
1482
|
+
holdingStore;
|
|
1483
|
+
merchantStore;
|
|
1484
|
+
netWorthStore;
|
|
1485
|
+
notificationStore;
|
|
1486
|
+
recurringTransactionsStore;
|
|
1487
|
+
settingsStore;
|
|
1488
|
+
transactionStore;
|
|
1489
|
+
trendsStore;
|
|
1490
|
+
userStore;
|
|
1491
|
+
// UI Stores
|
|
1492
|
+
globalUiStore;
|
|
1493
|
+
constructor(t = lt, e = "/", s, a) {
|
|
1494
|
+
this.appConfig = t, this.endpoint = e, this.sessionToken = t.options.session_token ?? "", this.onError = s, this.onStoreUpdate = a, this.accountStore = new ce(this), this.appDataStore = new de(this), this.analyticsStore = new he(this), this.beatStore = new pe(this), this.budgetsStore = new _e(this), this.cashflowStore = new fe(this), this.categoryStore = new me(this), this.connectStore = new Te(this), this.copyStore = new Re(this), this.debtsStore = new Ae(this), this.finstrongStore = new Ce(this), this.goalStore = new De(this), this.helpStore = new $e(this), this.holdingStore = new Ge(this), this.merchantStore = new Ne(this), this.netWorthStore = new Be(this), this.notificationStore = new xe(this), this.recurringTransactionsStore = new Me(this), this.settingsStore = new Fe(this), this.transactionStore = new Ue(this), this.trendsStore = new He(this), this.userStore = new We(this), this.globalUiStore = new Ee(this), d(this), St(() => {
|
|
1495
|
+
const { transactions: o } = this.transactionStore;
|
|
1496
|
+
this.emitUpdate({
|
|
1497
|
+
transactions: o
|
|
1498
|
+
});
|
|
1499
|
+
});
|
|
1500
|
+
}
|
|
1501
|
+
get isInitialized() {
|
|
1502
|
+
return this.globalUiStore.isInitialized;
|
|
1503
|
+
}
|
|
1504
|
+
// emits change triggered in the autorun
|
|
1505
|
+
emitUpdate = (t) => {
|
|
1506
|
+
this.onStoreUpdate?.(t);
|
|
1507
|
+
};
|
|
1508
|
+
loadConfigData = async () => {
|
|
1509
|
+
await Promise.all([
|
|
1510
|
+
// Load copy, config and user data
|
|
1511
|
+
this.copyStore.loadCopy(),
|
|
1512
|
+
this.appDataStore.loadAppData(),
|
|
1513
|
+
this.accountStore.refreshMembers(),
|
|
1514
|
+
this.userStore.loadUserFeatures()
|
|
1515
|
+
]);
|
|
1516
|
+
};
|
|
1517
|
+
loadData = async ({
|
|
1518
|
+
accounts: t,
|
|
1519
|
+
appData: e,
|
|
1520
|
+
associatedBeats: s,
|
|
1521
|
+
categories: a,
|
|
1522
|
+
institutions: o,
|
|
1523
|
+
transactionRules: r,
|
|
1524
|
+
transactions: l,
|
|
1525
|
+
userFeatures: p,
|
|
1526
|
+
merchantBudgets: b
|
|
1527
|
+
} = {}) => {
|
|
1528
|
+
(!e || !p) && await this.loadConfigData(), e && this.appDataStore.setAppData(e), p && this.userStore.setUserFeatures(p), t && (await this.accountStore.loadMembers(), o && this.accountStore.setInstitutions(o), this.accountStore.setAccounts(t)), s && this.transactionStore.setAssociatedBeats(s), a && this.categoryStore.setCategories(a), l && this.transactionStore.setTransactions(l), r && this.transactionStore.setTransactionRules(r), b && this.budgetsStore.setMerchantBudgets(b);
|
|
1529
|
+
};
|
|
1530
|
+
}
|
|
1531
|
+
class Ee {
|
|
1532
|
+
globalStore;
|
|
1533
|
+
accountFilterMap = /* @__PURE__ */ new Map();
|
|
1534
|
+
displayedDate = /* @__PURE__ */ new Date();
|
|
1535
|
+
displayedDateRange = {
|
|
1536
|
+
start: E(this.displayedDate),
|
|
1537
|
+
end: T(this.displayedDate)
|
|
1538
|
+
};
|
|
1539
|
+
constructor(t) {
|
|
1540
|
+
d(this), this.globalStore = t, ut(
|
|
1541
|
+
() => this.globalStore.accountStore.visibleAccounts,
|
|
1542
|
+
(e) => {
|
|
1543
|
+
this.populateAccountFilterMap(e);
|
|
1544
|
+
}
|
|
1545
|
+
);
|
|
1546
|
+
}
|
|
1547
|
+
get allSelectedAccounts() {
|
|
1548
|
+
return this.globalStore.accountStore.detailedAccounts.filter(
|
|
1549
|
+
(t) => !t.is_excluded_from_accounts
|
|
1550
|
+
);
|
|
1551
|
+
}
|
|
1552
|
+
get selectedAccounts() {
|
|
1553
|
+
return this.globalStore.accountStore.visibleAccounts.filter(
|
|
1554
|
+
(t) => !t.is_excluded_from_accounts
|
|
1555
|
+
);
|
|
1556
|
+
}
|
|
1557
|
+
get selectedAccountGuids() {
|
|
1558
|
+
return this.selectedAccounts.map((t) => t.guid);
|
|
1559
|
+
}
|
|
1560
|
+
get isCopyLoaded() {
|
|
1561
|
+
return this.globalStore.copyStore.isInitialized;
|
|
1562
|
+
}
|
|
1563
|
+
get isConfigLoaded() {
|
|
1564
|
+
return this.globalStore.appDataStore.isAppDataLoaded;
|
|
1565
|
+
}
|
|
1566
|
+
get areUserFeaturesLoaded() {
|
|
1567
|
+
return this.globalStore.userStore.userFeaturesLoaded;
|
|
1568
|
+
}
|
|
1569
|
+
get isInitialized() {
|
|
1570
|
+
return this.isCopyLoaded && this.isConfigLoaded && this.areUserFeaturesLoaded;
|
|
1571
|
+
}
|
|
1572
|
+
populateAccountFilterMap = (t) => {
|
|
1573
|
+
t && t.forEach((e) => {
|
|
1574
|
+
this.accountFilterMap.set(e.guid, !e.is_excluded_from_accounts);
|
|
1575
|
+
});
|
|
1576
|
+
};
|
|
1577
|
+
resetAccountFilterMap = () => {
|
|
1578
|
+
this.accountFilterMap.clear(), this.populateAccountFilterMap(this.globalStore.accountStore.visibleAccounts);
|
|
1579
|
+
};
|
|
1580
|
+
updateAccountFilterMap = (t, e) => {
|
|
1581
|
+
this.accountFilterMap.set(t, e);
|
|
1582
|
+
};
|
|
1583
|
+
setDisplayedDate = (t, e) => {
|
|
1584
|
+
this.displayedDate = e, this.displayedDateRange = {
|
|
1585
|
+
start: t,
|
|
1586
|
+
end: e
|
|
1587
|
+
};
|
|
1588
|
+
};
|
|
1589
|
+
get shouldDisableNextDate() {
|
|
1590
|
+
const t = v(this.displayedDate), e = v(re(/* @__PURE__ */ new Date(), 1));
|
|
1591
|
+
return t === e;
|
|
1592
|
+
}
|
|
1593
|
+
get shouldDisablePrevDate() {
|
|
1594
|
+
const t = v(this.displayedDate), e = v(/* @__PURE__ */ new Date());
|
|
1595
|
+
return t === e;
|
|
1596
|
+
}
|
|
1597
|
+
}
|
|
1598
|
+
class Re {
|
|
1599
|
+
globalStore;
|
|
1600
|
+
api = new V("/", "");
|
|
1601
|
+
copy = {};
|
|
1602
|
+
featureNamespace = "experiences";
|
|
1603
|
+
isInitialized = !1;
|
|
1604
|
+
constructor(t) {
|
|
1605
|
+
this.globalStore = t, this.api = new V(
|
|
1606
|
+
t.endpoint,
|
|
1607
|
+
t.sessionToken,
|
|
1608
|
+
t.onError
|
|
1609
|
+
), d(this);
|
|
1610
|
+
}
|
|
1611
|
+
loadCopy = async () => {
|
|
1612
|
+
await this.getCopy(this.featureNamespace), c(() => {
|
|
1613
|
+
this.isInitialized = !0;
|
|
1614
|
+
});
|
|
1615
|
+
};
|
|
1616
|
+
getCopy = async (t, e = "") => {
|
|
1617
|
+
try {
|
|
1618
|
+
const s = await this.api.getGlobalCopy(t, e);
|
|
1619
|
+
c(() => {
|
|
1620
|
+
this.copy = s[t];
|
|
1621
|
+
});
|
|
1622
|
+
} catch (s) {
|
|
1623
|
+
console.error(`Error occurred while fetching ${this.featureNamespace} copy: ${s}`);
|
|
1624
|
+
}
|
|
1625
|
+
};
|
|
1626
|
+
}
|
|
1627
|
+
class De {
|
|
1628
|
+
globalStore;
|
|
1629
|
+
api = new tt("/", "");
|
|
1630
|
+
goals = [];
|
|
1631
|
+
goalsLoaded = !1;
|
|
1632
|
+
retirementGoals = [];
|
|
1633
|
+
retirementGoalsLoaded = !1;
|
|
1634
|
+
retirementGoalAccounts = [];
|
|
1635
|
+
retirementGoalAccountsLoaded = !1;
|
|
1636
|
+
monthlyCashFlowProfile = void 0;
|
|
1637
|
+
monthlyCashFlowProfileLoaded = !1;
|
|
1638
|
+
newRetirementGoalAccounts = [];
|
|
1639
|
+
alert = "";
|
|
1640
|
+
selectedGoal = void 0;
|
|
1641
|
+
constructor(t) {
|
|
1642
|
+
this.globalStore = t, this.api = new tt(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
1643
|
+
}
|
|
1644
|
+
get allGoals() {
|
|
1645
|
+
if (!this.isAllGoalDataLoaded) return [];
|
|
1646
|
+
const t = this.globalStore.copyStore.copy.goals, e = this.globalStore.userStore.user.birthday;
|
|
1647
|
+
return [
|
|
1648
|
+
...this.goals,
|
|
1649
|
+
...this.retirementGoals.map((s) => ({
|
|
1650
|
+
...s,
|
|
1651
|
+
amount: s.target_amount,
|
|
1652
|
+
name: t.retirement,
|
|
1653
|
+
track_type: S.RETIREMENT_TRACK,
|
|
1654
|
+
projected_to_complete_at: s.retirement_age && e ? z(s.retirement_age, e) : void 0
|
|
1655
|
+
}))
|
|
1656
|
+
];
|
|
1657
|
+
}
|
|
1658
|
+
get orderedGoals() {
|
|
1659
|
+
return this.allGoals.slice().sort((t, e) => t.position - e.position);
|
|
1660
|
+
}
|
|
1661
|
+
get debtGoals() {
|
|
1662
|
+
return this.orderedGoals.filter((t) => t.track_type === S.DEBT_TRACK);
|
|
1663
|
+
}
|
|
1664
|
+
get retirmentGoals() {
|
|
1665
|
+
return this.orderedGoals.filter((t) => t.track_type === S.RETIREMENT_TRACK);
|
|
1666
|
+
}
|
|
1667
|
+
get savingGoals() {
|
|
1668
|
+
return this.orderedGoals.filter((t) => t.track_type === S.SAVINGS_TRACK);
|
|
1669
|
+
}
|
|
1670
|
+
get ongoingGoalsForMicroWidget() {
|
|
1671
|
+
const t = this.allGoals.filter(
|
|
1672
|
+
(s) => !s.is_complete && s.track_type !== S.EMERGENCY_FUND_TRACK && s.track_type !== null
|
|
1673
|
+
), e = [
|
|
1674
|
+
S.SAVINGS_TRACK,
|
|
1675
|
+
S.DEBT_TRACK,
|
|
1676
|
+
S.RETIREMENT_TRACK
|
|
1677
|
+
];
|
|
1678
|
+
return t.sort((s, a) => {
|
|
1679
|
+
const o = s.track_type ? e.indexOf(s.track_type) : -1, r = a.track_type ? e.indexOf(a.track_type) : -1;
|
|
1680
|
+
return o - r;
|
|
1681
|
+
}).slice(0, 3);
|
|
1682
|
+
}
|
|
1683
|
+
get isAllGoalDataLoaded() {
|
|
1684
|
+
return this.goalsLoaded && this.retirementGoalsLoaded && this.retirementGoalAccountsLoaded && this.monthlyCashFlowProfileLoaded;
|
|
1685
|
+
}
|
|
1686
|
+
setGoals = (t) => {
|
|
1687
|
+
this.goals = t, this.goalsLoaded = !0;
|
|
1688
|
+
};
|
|
1689
|
+
setRetirementGoals = (t) => {
|
|
1690
|
+
this.retirementGoals = t, this.retirementGoalsLoaded = !0;
|
|
1691
|
+
};
|
|
1692
|
+
setRetirementGoalAccounts = (t) => {
|
|
1693
|
+
this.retirementGoalAccounts = t, this.retirementGoalAccountsLoaded = !0;
|
|
1694
|
+
};
|
|
1695
|
+
setMonthlyCashFlowProfile = (t) => {
|
|
1696
|
+
this.monthlyCashFlowProfile = t, this.monthlyCashFlowProfileLoaded = !0;
|
|
1697
|
+
};
|
|
1698
|
+
loadGoalData = async () => {
|
|
1699
|
+
await Promise.all([
|
|
1700
|
+
this.loadGoals(),
|
|
1701
|
+
this.loadRetirementGoals(),
|
|
1702
|
+
this.loadRetirementGoalAccounts(),
|
|
1703
|
+
this.loadMonthlyCashFlowProfile()
|
|
1704
|
+
]);
|
|
1705
|
+
};
|
|
1706
|
+
loadGoals = async () => {
|
|
1707
|
+
try {
|
|
1708
|
+
const t = await this.api.getGoals();
|
|
1709
|
+
this.setGoals(t);
|
|
1710
|
+
} catch (t) {
|
|
1711
|
+
console.error(`Error occured while getting goals: ${t}`);
|
|
1712
|
+
}
|
|
1713
|
+
};
|
|
1714
|
+
loadRetirementGoals = async () => {
|
|
1715
|
+
try {
|
|
1716
|
+
const t = await this.api.getRetirementGoals();
|
|
1717
|
+
this.setRetirementGoals(t);
|
|
1718
|
+
} catch (t) {
|
|
1719
|
+
console.error(`Error occurred while loading retirement goals: ${t}`);
|
|
1720
|
+
}
|
|
1721
|
+
};
|
|
1722
|
+
loadRetirementGoalAccounts = async () => {
|
|
1723
|
+
try {
|
|
1724
|
+
const t = await this.api.getRetirementGoalAccounts();
|
|
1725
|
+
this.setRetirementGoalAccounts(t);
|
|
1726
|
+
} catch (t) {
|
|
1727
|
+
console.error(`Error occurred while loading retirement goal accounts: ${t}`);
|
|
1728
|
+
}
|
|
1729
|
+
};
|
|
1730
|
+
loadMonthlyCashFlowProfile = async () => {
|
|
1731
|
+
try {
|
|
1732
|
+
const t = await this.api.getMonthlyCashFlowProfile();
|
|
1733
|
+
this.setMonthlyCashFlowProfile(t);
|
|
1734
|
+
} catch (t) {
|
|
1735
|
+
console.error(`Error occurred while loading monthly cash flow profile: ${t}`);
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
addGoal = async (t) => {
|
|
1739
|
+
try {
|
|
1740
|
+
const e = await this.api.addGoal(t);
|
|
1741
|
+
this.setGoals([...this.goals, e]);
|
|
1742
|
+
} catch (e) {
|
|
1743
|
+
console.error(`Error occurred while adding goal: ${e}`);
|
|
1744
|
+
}
|
|
1745
|
+
};
|
|
1746
|
+
addRetirementGoal = async (t) => {
|
|
1747
|
+
const e = this.globalStore.copyStore.copy.goals;
|
|
1748
|
+
try {
|
|
1749
|
+
const s = await this.api.addRetirementGoal(t), a = [], o = this.globalStore.userStore.user.birthday;
|
|
1750
|
+
for (const r of this.newRetirementGoalAccounts) {
|
|
1751
|
+
const l = await this.api.addRetirementGoalAccount({
|
|
1752
|
+
...r,
|
|
1753
|
+
retirement_goal_guid: s.guid
|
|
1754
|
+
});
|
|
1755
|
+
a.push(l);
|
|
1756
|
+
}
|
|
1757
|
+
this.setNewRetirementGoalAccounts([]), this.retirementGoals = [
|
|
1758
|
+
...this.retirementGoals,
|
|
1759
|
+
{
|
|
1760
|
+
...s,
|
|
1761
|
+
amount: s.target_amount,
|
|
1762
|
+
name: e.retirement,
|
|
1763
|
+
track_type: S.RETIREMENT_TRACK,
|
|
1764
|
+
projected_to_complete_at: s.retirement_age && o ? z(s.retirement_age, o) : void 0
|
|
1765
|
+
}
|
|
1766
|
+
], this.setRetirementGoalAccounts([...this.retirementGoalAccounts, ...a]);
|
|
1767
|
+
} catch (s) {
|
|
1768
|
+
console.error(`Error occurred while adding retirement goal: ${s}`);
|
|
1769
|
+
}
|
|
1770
|
+
};
|
|
1771
|
+
addRetirementGoalAccount = async (t) => {
|
|
1772
|
+
try {
|
|
1773
|
+
const e = await this.api.addRetirementGoalAccount(t);
|
|
1774
|
+
c(() => {
|
|
1775
|
+
this.retirementGoalAccounts = [...this.retirementGoalAccounts, e];
|
|
1776
|
+
});
|
|
1777
|
+
} catch (e) {
|
|
1778
|
+
console.error(`Error occurred while adding retirement goal account: ${e}`);
|
|
1779
|
+
}
|
|
1780
|
+
};
|
|
1781
|
+
deleteGoal = async (t) => {
|
|
1782
|
+
try {
|
|
1783
|
+
await this.api.removeGoal(t);
|
|
1784
|
+
const e = this.goals.findIndex((s) => s.guid === t);
|
|
1785
|
+
e >= 0 && this.goals.splice(e, 1);
|
|
1786
|
+
} catch (e) {
|
|
1787
|
+
console.error(`Error occured while deleting goal: ${e}`);
|
|
1788
|
+
}
|
|
1789
|
+
};
|
|
1790
|
+
deleteRetirementGoal = async (t) => {
|
|
1791
|
+
try {
|
|
1792
|
+
const e = this.retirementGoalAccounts.filter(
|
|
1793
|
+
(a) => a.retirement_goal_guid === t.guid
|
|
1794
|
+
);
|
|
1795
|
+
for (const a of e)
|
|
1796
|
+
await this.deleteRetirementGoalAccount(a.guid);
|
|
1797
|
+
await this.api.removeRetirementGoal(t.guid);
|
|
1798
|
+
const s = this.retirementGoals.findIndex((a) => a.guid === t.guid);
|
|
1799
|
+
s >= 0 && this.retirementGoals.splice(s, 1);
|
|
1800
|
+
} catch (e) {
|
|
1801
|
+
console.error(`Error deleting retirement goal: ${e}`);
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
deleteRetirementGoalAccount = async (t) => {
|
|
1805
|
+
try {
|
|
1806
|
+
await this.api.removeRetirementGoalAccount(t);
|
|
1807
|
+
const e = this.retirementGoalAccounts.findIndex((s) => s.guid === t);
|
|
1808
|
+
e >= 0 && this.retirementGoalAccounts.splice(e, 1);
|
|
1809
|
+
} catch (e) {
|
|
1810
|
+
console.error(`Error deleting retirement goal account: ${e}`);
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1813
|
+
reorderGoals = async (t) => {
|
|
1814
|
+
try {
|
|
1815
|
+
const e = await this.api.reorderGoals(t);
|
|
1816
|
+
c(() => {
|
|
1817
|
+
for (const s of e) {
|
|
1818
|
+
const a = this.goals.findIndex((o) => o.guid === s.guid);
|
|
1819
|
+
a >= 0 && (this.goals[a].position = s.position);
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
} catch (e) {
|
|
1823
|
+
console.error(`Error reordering goals: ${e}`);
|
|
1824
|
+
}
|
|
1825
|
+
};
|
|
1826
|
+
setAlert = (t) => this.alert = t;
|
|
1827
|
+
setNewRetirementGoalAccounts = (t) => {
|
|
1828
|
+
this.newRetirementGoalAccounts = t;
|
|
1829
|
+
};
|
|
1830
|
+
setSelectedGoal = (t) => this.selectedGoal = t;
|
|
1831
|
+
updateGoal = async (t) => {
|
|
1832
|
+
try {
|
|
1833
|
+
const e = await this.api.updateGoal(t);
|
|
1834
|
+
c(() => {
|
|
1835
|
+
const s = this.goals.findIndex((a) => a.guid === t.guid);
|
|
1836
|
+
s >= 0 && (this.goals[s] = e), this.selectedGoal?.guid === t.guid && this.setSelectedGoal(e);
|
|
1837
|
+
});
|
|
1838
|
+
} catch (e) {
|
|
1839
|
+
console.error(`Error occurred while updating goal: ${e}`);
|
|
1840
|
+
}
|
|
1841
|
+
};
|
|
1842
|
+
updateRetirementGoal = async (t) => {
|
|
1843
|
+
try {
|
|
1844
|
+
const e = await this.api.updateRetirementGoal({
|
|
1845
|
+
...t,
|
|
1846
|
+
target_amount: t.amount
|
|
1847
|
+
});
|
|
1848
|
+
c(() => {
|
|
1849
|
+
const s = this.retirementGoals.findIndex((a) => a.guid === t.guid);
|
|
1850
|
+
s >= 0 && (this.retirementGoals[s] = e), this.selectedGoal?.guid === t.guid && this.setSelectedGoal(this.allGoals.find((a) => a.guid === t.guid));
|
|
1851
|
+
});
|
|
1852
|
+
} catch (e) {
|
|
1853
|
+
console.error(`Error occurred while updating goal: ${e}`);
|
|
1854
|
+
}
|
|
1855
|
+
};
|
|
1856
|
+
updateMonthlyCashFlowProfile = async (t) => {
|
|
1857
|
+
try {
|
|
1858
|
+
const e = await this.api.updateMonthlyCashFlowProfile(t);
|
|
1859
|
+
this.setMonthlyCashFlowProfile(e);
|
|
1860
|
+
} catch (e) {
|
|
1861
|
+
console.error(`Error occurred while updating monthly Cash Flow profile: ${e}`);
|
|
1862
|
+
}
|
|
1863
|
+
};
|
|
1864
|
+
}
|
|
1865
|
+
const Le = (n, t) => n.guid === "general" || n.guid === "insights" ? !0 : n.flags ? n.flags.every((e) => t[e]) : !1, ve = (n, t) => {
|
|
1866
|
+
const e = [];
|
|
1867
|
+
for (const s of oe) {
|
|
1868
|
+
const a = t[s.guid];
|
|
1869
|
+
if (!a) continue;
|
|
1870
|
+
const o = {
|
|
1871
|
+
...s,
|
|
1872
|
+
title: a.label,
|
|
1873
|
+
topics: s.topics.map(({ topicKey: r }, l) => ({
|
|
1874
|
+
topicKey: r,
|
|
1875
|
+
label: a.topics[l]
|
|
1876
|
+
}))
|
|
1877
|
+
};
|
|
1878
|
+
Le(o, n) && e.push(o);
|
|
1879
|
+
}
|
|
1880
|
+
return e;
|
|
1881
|
+
};
|
|
1882
|
+
class $e {
|
|
1883
|
+
alert = { message: "", severity: void 0 };
|
|
1884
|
+
api = new et("/", "");
|
|
1885
|
+
appConfig;
|
|
1886
|
+
globalStore;
|
|
1887
|
+
isLoading = !1;
|
|
1888
|
+
constructor(t) {
|
|
1889
|
+
this.globalStore = t, this.api = new et(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
1890
|
+
}
|
|
1891
|
+
createSupportTicket = async (t) => {
|
|
1892
|
+
try {
|
|
1893
|
+
this.isLoading = !0, await this.api.createSupportTicket(t), this.setAlert(this.copy.request_support_submit_success_message, "success");
|
|
1894
|
+
} catch (e) {
|
|
1895
|
+
this.setAlert(this.copy.request_support_submit_failure_message, "error"), console.error("Error occurred while submitting:", e);
|
|
1896
|
+
} finally {
|
|
1897
|
+
this.isLoading = !1;
|
|
1898
|
+
}
|
|
1899
|
+
};
|
|
1900
|
+
setAlert = (t, e = void 0) => this.alert = { message: t, severity: e };
|
|
1901
|
+
get copy() {
|
|
1902
|
+
return this.globalStore.copyStore.copy.help;
|
|
1903
|
+
}
|
|
1904
|
+
get helpCategories() {
|
|
1905
|
+
const { client_communication_profile: t, client_profile: e } = this.globalStore.appDataStore.appData, {
|
|
1906
|
+
help: { category_list: s }
|
|
1907
|
+
} = this.globalStore.copyStore.copy;
|
|
1908
|
+
return ve(
|
|
1909
|
+
{
|
|
1910
|
+
...t,
|
|
1911
|
+
...e,
|
|
1912
|
+
...this.globalStore.appConfig.config
|
|
1913
|
+
},
|
|
1914
|
+
s
|
|
1915
|
+
);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
class Ge {
|
|
1919
|
+
analysisType = Wt.Stocks;
|
|
1920
|
+
api = new st("/", "");
|
|
1921
|
+
holdings = [];
|
|
1922
|
+
holdingsLoaded = !1;
|
|
1923
|
+
globalStore;
|
|
1924
|
+
showConnectionsWidget = !1;
|
|
1925
|
+
constructor(t) {
|
|
1926
|
+
this.globalStore = t, this.api = new st(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
1927
|
+
}
|
|
1928
|
+
get analysisChartData() {
|
|
1929
|
+
return Vt(zt(this.visibleHoldings), this.analysisType);
|
|
1930
|
+
}
|
|
1931
|
+
get analysisDetails() {
|
|
1932
|
+
return Kt(this.visibleHoldings)[this.analysisType] || {};
|
|
1933
|
+
}
|
|
1934
|
+
get visibleHoldings() {
|
|
1935
|
+
return this.holdings.filter(
|
|
1936
|
+
(t) => this.globalStore.globalUiStore.selectedAccountGuids.includes(t.account_guid)
|
|
1937
|
+
);
|
|
1938
|
+
}
|
|
1939
|
+
setHoldings = (t) => {
|
|
1940
|
+
this.holdings = t, this.holdingsLoaded = !0;
|
|
1941
|
+
};
|
|
1942
|
+
setShowConnectionsWidget = (t) => {
|
|
1943
|
+
this.showConnectionsWidget = t;
|
|
1944
|
+
};
|
|
1945
|
+
loadHoldings = async () => {
|
|
1946
|
+
try {
|
|
1947
|
+
const t = await this.api.getHoldings();
|
|
1948
|
+
this.setHoldings(t);
|
|
1949
|
+
} catch (t) {
|
|
1950
|
+
console.error(`Error occured while getting holdings: ${t}`);
|
|
1951
|
+
}
|
|
1952
|
+
};
|
|
1953
|
+
setAnalysisType = (t) => {
|
|
1954
|
+
this.analysisType = t;
|
|
1955
|
+
};
|
|
1956
|
+
updateHoldings = async (t) => {
|
|
1957
|
+
this.holdingsLoaded = !1;
|
|
1958
|
+
try {
|
|
1959
|
+
const e = await this.api.updateHoldings(t), s = this.holdings.findIndex(({ guid: a }) => a === t.guid);
|
|
1960
|
+
if (s >= 0) {
|
|
1961
|
+
const a = [...this.holdings];
|
|
1962
|
+
a[s] = e, c(() => {
|
|
1963
|
+
this.holdings = a, this.holdingsLoaded = !0;
|
|
1964
|
+
});
|
|
1965
|
+
}
|
|
1966
|
+
} catch (e) {
|
|
1967
|
+
console.error(`Error occurred while updating holding: ${e}`);
|
|
1968
|
+
}
|
|
1969
|
+
};
|
|
1970
|
+
}
|
|
1971
|
+
class Ne {
|
|
1972
|
+
globalStore;
|
|
1973
|
+
api = new at("/", "");
|
|
1974
|
+
merchant = null;
|
|
1975
|
+
merchants = [];
|
|
1976
|
+
isLoading = !1;
|
|
1977
|
+
constructor(t) {
|
|
1978
|
+
this.globalStore = t, this.api = new at(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
1979
|
+
}
|
|
1980
|
+
loadMerchants = async (t = "") => {
|
|
1981
|
+
this.isLoading = !0;
|
|
1982
|
+
const e = await this.api.getMerchants([t]);
|
|
1983
|
+
c(() => {
|
|
1984
|
+
this.merchants = e, this.isLoading = !1;
|
|
1985
|
+
});
|
|
1986
|
+
};
|
|
1987
|
+
loadMerchantByGuid = async (t) => {
|
|
1988
|
+
const e = await this.api.getMerchantByGuid(t);
|
|
1989
|
+
c(() => this.merchant = e);
|
|
1990
|
+
};
|
|
1991
|
+
}
|
|
1992
|
+
class Be {
|
|
1993
|
+
globalStore;
|
|
1994
|
+
accountsApi = new B("/", "");
|
|
1995
|
+
monthlyAccountBalances = [];
|
|
1996
|
+
monthlyAccountBalancesLoaded = !1;
|
|
1997
|
+
hoveredIndex = -1;
|
|
1998
|
+
selectedIndex = -1;
|
|
1999
|
+
timeframe = 6;
|
|
2000
|
+
// default timeframe is 6 months
|
|
2001
|
+
constructor(t) {
|
|
2002
|
+
this.globalStore = t, this.accountsApi = new B(
|
|
2003
|
+
t.endpoint,
|
|
2004
|
+
t.sessionToken,
|
|
2005
|
+
t.onError
|
|
2006
|
+
), d(this);
|
|
2007
|
+
}
|
|
2008
|
+
get isNetWorthDataLoaded() {
|
|
2009
|
+
return this.globalStore.accountStore.isAccountDataLoaded && this.monthlyAccountBalancesLoaded;
|
|
2010
|
+
}
|
|
2011
|
+
get netWorthAccounts() {
|
|
2012
|
+
return Qt(
|
|
2013
|
+
this.globalStore.globalUiStore.selectedAccounts,
|
|
2014
|
+
this.globalStore.accountStore.members
|
|
2015
|
+
);
|
|
2016
|
+
}
|
|
2017
|
+
get netWorthData() {
|
|
2018
|
+
return {
|
|
2019
|
+
accounts: this.netWorthAccounts,
|
|
2020
|
+
monthlyAccountBalances: this.monthlyAccountBalances
|
|
2021
|
+
};
|
|
2022
|
+
}
|
|
2023
|
+
get netWorthChartData() {
|
|
2024
|
+
return qt(this.netWorthAccounts, this.monthlyAccountBalances, this.timeframe);
|
|
2025
|
+
}
|
|
2026
|
+
get selectedData() {
|
|
2027
|
+
if (!(!this.netWorthChartData || this.netWorthChartData.length === 0))
|
|
2028
|
+
return this.selectedIndex === -1 ? K(this.netWorthChartData) : this.netWorthChartData[this.selectedIndex];
|
|
2029
|
+
}
|
|
2030
|
+
get hoveredData() {
|
|
2031
|
+
return this.hoveredIndex >= 0 ? this.netWorthChartData[this.hoveredIndex] : void 0;
|
|
2032
|
+
}
|
|
2033
|
+
get gainsLosses() {
|
|
2034
|
+
return Yt(this.selectedData);
|
|
2035
|
+
}
|
|
2036
|
+
get assetsLiabilities() {
|
|
2037
|
+
const { assets: t, liabilities: e, totalAssets: s, totalLiabilities: a } = jt(
|
|
2038
|
+
this.netWorthData.accounts
|
|
2039
|
+
);
|
|
2040
|
+
return {
|
|
2041
|
+
netWorth: K(this.netWorthChartData),
|
|
2042
|
+
assets: t,
|
|
2043
|
+
liabilities: e,
|
|
2044
|
+
totalAssets: s,
|
|
2045
|
+
totalLiabilities: a
|
|
2046
|
+
};
|
|
2047
|
+
}
|
|
2048
|
+
loadNetWorthData = async () => {
|
|
2049
|
+
this.globalStore.accountStore.isAccountDataLoaded || await this.globalStore.accountStore.loadAccountData();
|
|
2050
|
+
const e = (await Promise.all(
|
|
2051
|
+
this.netWorthAccounts.map((s) => this.getMonthlyAccountBalances(s.guid))
|
|
2052
|
+
)).reduce(Xt, []).sort(Jt);
|
|
2053
|
+
this.setMonthlyAccountBalances(e);
|
|
2054
|
+
};
|
|
2055
|
+
getMonthlyAccountBalances = async (t) => {
|
|
2056
|
+
try {
|
|
2057
|
+
return await this.accountsApi.getMonthlyAccountBalances(t);
|
|
2058
|
+
} catch (e) {
|
|
2059
|
+
return console.error(`Error occured while fetching monthly account balances: ${e}`), [];
|
|
2060
|
+
}
|
|
2061
|
+
};
|
|
2062
|
+
setHoveredIndex = (t) => this.hoveredIndex = t;
|
|
2063
|
+
setMonthlyAccountBalances = (t) => {
|
|
2064
|
+
this.monthlyAccountBalances = t, this.monthlyAccountBalancesLoaded = !0;
|
|
2065
|
+
};
|
|
2066
|
+
setSelectedIndex = (t) => this.selectedIndex = t;
|
|
2067
|
+
setTimeframe = (t) => this.timeframe = t;
|
|
2068
|
+
}
|
|
2069
|
+
class xe {
|
|
2070
|
+
globalStore;
|
|
2071
|
+
api = new nt("/", "");
|
|
2072
|
+
isLoading = !0;
|
|
2073
|
+
notifications = [];
|
|
2074
|
+
notificationsLoaded = !1;
|
|
2075
|
+
constructor(t) {
|
|
2076
|
+
this.globalStore = t, this.api = new nt(
|
|
2077
|
+
t.endpoint,
|
|
2078
|
+
t.sessionToken,
|
|
2079
|
+
t.onError
|
|
2080
|
+
), d(this, { notifications: Tt });
|
|
2081
|
+
}
|
|
2082
|
+
// Used in Money Dashboard
|
|
2083
|
+
get newNotifications() {
|
|
2084
|
+
return this.recentNotifications.filter((t) => !t.has_been_viewed);
|
|
2085
|
+
}
|
|
2086
|
+
get recentNotifications() {
|
|
2087
|
+
return Zt(this.notifications);
|
|
2088
|
+
}
|
|
2089
|
+
setNotifications = (t) => {
|
|
2090
|
+
this.notifications = t, this.notificationsLoaded = !0;
|
|
2091
|
+
};
|
|
2092
|
+
loadNotifications = async () => {
|
|
2093
|
+
this.isLoading = !0;
|
|
2094
|
+
try {
|
|
2095
|
+
const t = await this.api.getNotifications();
|
|
2096
|
+
this.setNotifications(t);
|
|
2097
|
+
} catch (t) {
|
|
2098
|
+
console.error(`Error occurred while loading notifications: ${t}`);
|
|
2099
|
+
} finally {
|
|
2100
|
+
c(() => {
|
|
2101
|
+
this.isLoading = !1;
|
|
2102
|
+
});
|
|
2103
|
+
}
|
|
2104
|
+
};
|
|
2105
|
+
markAllAsViewed = async () => {
|
|
2106
|
+
await this.api.markAllAsViewed();
|
|
2107
|
+
};
|
|
2108
|
+
updateNotification = async (t) => {
|
|
2109
|
+
t.has_been_viewed = !0, await this.api.updateNotification(t);
|
|
2110
|
+
};
|
|
2111
|
+
}
|
|
2112
|
+
const dt = (n, t) => gt(t.expectedDate, n), A = (n, t) => n + t.amount;
|
|
2113
|
+
class Me {
|
|
2114
|
+
globalStore;
|
|
2115
|
+
api = new it("/", "");
|
|
2116
|
+
repeatingTransactions = [];
|
|
2117
|
+
isDataLoaded = !1;
|
|
2118
|
+
selectedDay;
|
|
2119
|
+
dateRange = { start: E(y()), end: T(y()) };
|
|
2120
|
+
selectedRepeatingTransactionGuid = null;
|
|
2121
|
+
selectedRecurrence = null;
|
|
2122
|
+
alert = { message: "", severity: void 0 };
|
|
2123
|
+
constructor(t) {
|
|
2124
|
+
this.globalStore = t, this.api = new it(
|
|
2125
|
+
t.endpoint,
|
|
2126
|
+
t.sessionToken,
|
|
2127
|
+
t.onError
|
|
2128
|
+
), d(this, {
|
|
2129
|
+
recurrencesForRange: !1,
|
|
2130
|
+
upcomingExpensesForRange: !1,
|
|
2131
|
+
upcomingIncomeForRange: !1,
|
|
2132
|
+
incomeForRange: !1,
|
|
2133
|
+
nextIncomeForRange: !1
|
|
2134
|
+
});
|
|
2135
|
+
}
|
|
2136
|
+
get copy() {
|
|
2137
|
+
return this.globalStore.copyStore.copy.recurring;
|
|
2138
|
+
}
|
|
2139
|
+
get detailedRepeatingTransactions() {
|
|
2140
|
+
return F(
|
|
2141
|
+
this.globalStore.accountStore.visibleAccounts,
|
|
2142
|
+
this.repeatingTransactions,
|
|
2143
|
+
this.globalStore.transactionStore.transactions
|
|
2144
|
+
);
|
|
2145
|
+
}
|
|
2146
|
+
/**
|
|
2147
|
+
* Returns all recurrences built from repeating transactions and filtered by
|
|
2148
|
+
* accounts, scoped to the supplied date range. This is the range-parameterized
|
|
2149
|
+
* core used by both the shared getters (which pass this.dateRange) and by
|
|
2150
|
+
* consumers such as Cash Flow that need their own independent window without
|
|
2151
|
+
* mutating the shared dateRange.
|
|
2152
|
+
*/
|
|
2153
|
+
recurrencesForRange = (t) => {
|
|
2154
|
+
const e = this.globalStore.accountStore.visibleAccounts;
|
|
2155
|
+
return te(this.detailedRepeatingTransactions, t).filter((s) => e.some((a) => a.guid === s.accountGuid && !a.is_excluded_from_accounts)).filter((s) => gt(s.expectedDate, t));
|
|
2156
|
+
};
|
|
2157
|
+
/**
|
|
2158
|
+
* Returns the upcoming expense recurrences scoped to the supplied date range.
|
|
2159
|
+
*/
|
|
2160
|
+
upcomingExpensesForRange = (t) => this.recurrencesForRange(t).filter(
|
|
2161
|
+
(e) => e.type === L.Expense && e.status === f.Upcoming
|
|
2162
|
+
);
|
|
2163
|
+
/**
|
|
2164
|
+
* Returns the income recurrences scoped to the supplied date range.
|
|
2165
|
+
*/
|
|
2166
|
+
incomeForRange = (t) => this.recurrencesForRange(t).filter(
|
|
2167
|
+
(e) => e.type === L.Income
|
|
2168
|
+
);
|
|
2169
|
+
/**
|
|
2170
|
+
* Returns the upcoming income recurrences scoped to the supplied date range.
|
|
2171
|
+
*/
|
|
2172
|
+
upcomingIncomeForRange = (t) => this.incomeForRange(t).filter(
|
|
2173
|
+
(e) => e.status === f.Upcoming
|
|
2174
|
+
);
|
|
2175
|
+
/**
|
|
2176
|
+
* Returns the next upcoming income recurrence scoped to the supplied range.
|
|
2177
|
+
*/
|
|
2178
|
+
nextIncomeForRange = (t) => this.upcomingIncomeForRange(t).find(
|
|
2179
|
+
(e) => P(e.expectedDate, y())
|
|
2180
|
+
);
|
|
2181
|
+
/**
|
|
2182
|
+
* Returns all recurrences built from repeating transactions and filtered by accounts.
|
|
2183
|
+
*/
|
|
2184
|
+
get recurrences() {
|
|
2185
|
+
return this.recurrencesForRange(this.dateRange);
|
|
2186
|
+
}
|
|
2187
|
+
/**
|
|
2188
|
+
* Returns all recurrences that have occurred in the past, including those that are paid or missed
|
|
2189
|
+
*/
|
|
2190
|
+
get pastRecurrences() {
|
|
2191
|
+
return this.recurrences.filter(
|
|
2192
|
+
(t) => t.status === f.Paid || t.status === f.Missed
|
|
2193
|
+
);
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* Returns all recurrences that are expected to occur through the end of the month
|
|
2197
|
+
* or should have occurred in the last 3 days.
|
|
2198
|
+
*/
|
|
2199
|
+
get upcomingRecurrences() {
|
|
2200
|
+
return this.recurrences.filter(
|
|
2201
|
+
(t) => P(t.expectedDate, pt(y(), 3)) && H(t.expectedDate, this.dateRange.end) && t.status === f.Upcoming
|
|
2202
|
+
);
|
|
2203
|
+
}
|
|
2204
|
+
/**
|
|
2205
|
+
* Returns all expense recurrences.
|
|
2206
|
+
*/
|
|
2207
|
+
get expenses() {
|
|
2208
|
+
return this.recurrences.filter(
|
|
2209
|
+
(t) => t.type === L.Expense
|
|
2210
|
+
);
|
|
2211
|
+
}
|
|
2212
|
+
/**
|
|
2213
|
+
* Returns the upcoming expense recurrences.
|
|
2214
|
+
*/
|
|
2215
|
+
get upcomingExpenses() {
|
|
2216
|
+
return this.expenses.filter(
|
|
2217
|
+
(t) => t.status === f.Upcoming
|
|
2218
|
+
);
|
|
2219
|
+
}
|
|
2220
|
+
/**
|
|
2221
|
+
* Returns all income recurrences.
|
|
2222
|
+
*/
|
|
2223
|
+
get income() {
|
|
2224
|
+
return this.recurrences.filter(
|
|
2225
|
+
(t) => t.type === L.Income
|
|
2226
|
+
);
|
|
2227
|
+
}
|
|
2228
|
+
/**
|
|
2229
|
+
* Returns the upcoming income recurrences.
|
|
2230
|
+
*/
|
|
2231
|
+
get upcomingIncome() {
|
|
2232
|
+
return this.income.filter(
|
|
2233
|
+
(t) => t.status === f.Upcoming
|
|
2234
|
+
);
|
|
2235
|
+
}
|
|
2236
|
+
get nextIncomeRecurrence() {
|
|
2237
|
+
return this.upcomingIncome.find((t) => P(t.expectedDate, y()));
|
|
2238
|
+
}
|
|
2239
|
+
/**
|
|
2240
|
+
* Returns the expense recurrences for the current month.
|
|
2241
|
+
*/
|
|
2242
|
+
get currentMonthExpenses() {
|
|
2243
|
+
return this.expenses.filter(
|
|
2244
|
+
(t) => dt(this.dateRange, t)
|
|
2245
|
+
);
|
|
2246
|
+
}
|
|
2247
|
+
/**
|
|
2248
|
+
* Returns the income recurrences for the current month.
|
|
2249
|
+
*/
|
|
2250
|
+
get currentMonthIncome() {
|
|
2251
|
+
return this.income.filter(
|
|
2252
|
+
(t) => dt(this.dateRange, t)
|
|
2253
|
+
);
|
|
2254
|
+
}
|
|
2255
|
+
/**
|
|
2256
|
+
* Calculates the total amount of all expenses for the current month.
|
|
2257
|
+
*/
|
|
2258
|
+
get expenseTotal() {
|
|
2259
|
+
return this.currentMonthExpenses.reduce(A, 0);
|
|
2260
|
+
}
|
|
2261
|
+
/**
|
|
2262
|
+
* Calculates the total amount of all paid expenses for the current month.
|
|
2263
|
+
*/
|
|
2264
|
+
get paidExpenseTotal() {
|
|
2265
|
+
return this.currentMonthExpenses.filter((t) => t.status === f.Paid).reduce(A, 0);
|
|
2266
|
+
}
|
|
2267
|
+
/**
|
|
2268
|
+
* Calculates the total amount of all missed expenses for the current month.
|
|
2269
|
+
*/
|
|
2270
|
+
get missedExpenseTotal() {
|
|
2271
|
+
return this.currentMonthExpenses.filter((t) => t.status === f.Missed).reduce(A, 0);
|
|
2272
|
+
}
|
|
2273
|
+
/**
|
|
2274
|
+
* Calculates the total amount of all upcoming expenses for the current month.
|
|
2275
|
+
*/
|
|
2276
|
+
get upcomingExpenseTotal() {
|
|
2277
|
+
return this.currentMonthExpenses.filter((t) => t.status === f.Upcoming).reduce(A, 0);
|
|
2278
|
+
}
|
|
2279
|
+
/**
|
|
2280
|
+
* Calculates the total amount of all income for the current month.
|
|
2281
|
+
*/
|
|
2282
|
+
get incomeTotal() {
|
|
2283
|
+
return this.currentMonthIncome.reduce(A, 0);
|
|
2284
|
+
}
|
|
2285
|
+
/**
|
|
2286
|
+
* Calculates the total amount of all paid income for the current month.
|
|
2287
|
+
*/
|
|
2288
|
+
get paidIncomeTotal() {
|
|
2289
|
+
return this.currentMonthIncome.filter((t) => t.status === f.Paid).reduce(A, 0);
|
|
2290
|
+
}
|
|
2291
|
+
/**
|
|
2292
|
+
* Calculates the total amount of all upcoming income for the current month.
|
|
2293
|
+
*/
|
|
2294
|
+
get upcomingIncomeTotal() {
|
|
2295
|
+
return this.currentMonthIncome.filter((t) => t.status === f.Upcoming).reduce(A, 0);
|
|
2296
|
+
}
|
|
2297
|
+
/**
|
|
2298
|
+
* Get the recurrences for the currently selected day.
|
|
2299
|
+
*/
|
|
2300
|
+
get selectedDayRecurrences() {
|
|
2301
|
+
return this.selectedDay && this.recurrences.filter(
|
|
2302
|
+
(t) => this.selectedDay && Q(t.occurredOnDate || t.expectedDate, this.selectedDay)
|
|
2303
|
+
);
|
|
2304
|
+
}
|
|
2305
|
+
get selectedRepeatingTransaction() {
|
|
2306
|
+
return this.selectedRepeatingTransactionGuid ? this.detailedRepeatingTransactions.find(
|
|
2307
|
+
(t) => t.guid === this.selectedRepeatingTransactionGuid
|
|
2308
|
+
) : void 0;
|
|
2309
|
+
}
|
|
2310
|
+
setSelectedRepeatingTransactionGuid = (t) => this.selectedRepeatingTransactionGuid = t;
|
|
2311
|
+
setSelectedRecurrence = (t) => this.selectedRecurrence = t;
|
|
2312
|
+
setRepeatingTransactions = (t) => {
|
|
2313
|
+
this.repeatingTransactions = t, this.isDataLoaded = !0;
|
|
2314
|
+
};
|
|
2315
|
+
/**
|
|
2316
|
+
* Set the date range for filtering recurrences.
|
|
2317
|
+
* @param dateRange - The date range to set.
|
|
2318
|
+
*/
|
|
2319
|
+
setDateRange = (t) => this.dateRange = t;
|
|
2320
|
+
/**
|
|
2321
|
+
* Set the currently selected day.
|
|
2322
|
+
* @param day - The day to select.
|
|
2323
|
+
*/
|
|
2324
|
+
setSelectedDay = (t) => {
|
|
2325
|
+
this.selectedDay = this.selectedDay && Q(t, this.selectedDay) ? void 0 : t;
|
|
2326
|
+
};
|
|
2327
|
+
loadRepeatingTransactionData = async () => {
|
|
2328
|
+
await Promise.all([
|
|
2329
|
+
this.globalStore.accountStore.loadAccountData(),
|
|
2330
|
+
this.globalStore.categoryStore.loadCategories(),
|
|
2331
|
+
this.globalStore.transactionStore.loadTransactionData()
|
|
2332
|
+
]), await this.loadRepeatingTransactions();
|
|
2333
|
+
};
|
|
2334
|
+
/**
|
|
2335
|
+
* Load repeating transactions and augment them with additional data.
|
|
2336
|
+
*/
|
|
2337
|
+
loadRepeatingTransactions = async () => {
|
|
2338
|
+
try {
|
|
2339
|
+
const t = await this.api.getRepeatingTransactions();
|
|
2340
|
+
this.setRepeatingTransactions(t);
|
|
2341
|
+
} catch (t) {
|
|
2342
|
+
console.error(`Error occurred while getting repeating transactions: ${t}`);
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
/**
|
|
2346
|
+
* Add a new repeating transaction and link it to the associated transaction.
|
|
2347
|
+
* @param repeatingTransaction - The repeating transaction to add.
|
|
2348
|
+
* @param transaction - The transaction associated with the repeating transaction.
|
|
2349
|
+
*/
|
|
2350
|
+
addRepeatingTransaction = async (t, e) => {
|
|
2351
|
+
try {
|
|
2352
|
+
const s = await this.api.addRepeatingTransaction(t);
|
|
2353
|
+
await this.globalStore.transactionStore.updateTransaction({
|
|
2354
|
+
...e,
|
|
2355
|
+
repeating_transaction_guid: s.guid
|
|
2356
|
+
}), c(() => {
|
|
2357
|
+
this.repeatingTransactions = [
|
|
2358
|
+
...this.repeatingTransactions,
|
|
2359
|
+
...F(
|
|
2360
|
+
this.globalStore.accountStore.visibleAccounts,
|
|
2361
|
+
[s],
|
|
2362
|
+
this.globalStore.transactionStore.transactions
|
|
2363
|
+
)
|
|
2364
|
+
];
|
|
2365
|
+
});
|
|
2366
|
+
} catch (s) {
|
|
2367
|
+
console.error(`Error occurred while adding repeating transaction: ${s}`);
|
|
2368
|
+
}
|
|
2369
|
+
};
|
|
2370
|
+
/**
|
|
2371
|
+
* Delete a repeating transaction by its GUID.
|
|
2372
|
+
* @param guid - The GUID of the repeating transaction to delete.
|
|
2373
|
+
*/
|
|
2374
|
+
deleteRepeatingTransaction = async (t) => {
|
|
2375
|
+
try {
|
|
2376
|
+
await this.api.deleteRepeatingTransaction(t), c(() => {
|
|
2377
|
+
this.repeatingTransactions = [
|
|
2378
|
+
...this.repeatingTransactions.filter((e) => e.guid !== t)
|
|
2379
|
+
];
|
|
2380
|
+
});
|
|
2381
|
+
} catch (e) {
|
|
2382
|
+
console.error(`Error occurred while deleting repeating transaction: ${e}`);
|
|
2383
|
+
}
|
|
2384
|
+
};
|
|
2385
|
+
/**
|
|
2386
|
+
* Update an existing repeating transaction.
|
|
2387
|
+
* @param transaction - The repeating transaction to update.
|
|
2388
|
+
*/
|
|
2389
|
+
updateRepeatingTransaction = async (t) => {
|
|
2390
|
+
try {
|
|
2391
|
+
const e = await this.api.updateRepeatingTransaction(t), s = this.repeatingTransactions.findIndex(
|
|
2392
|
+
(a) => a.guid === e.guid
|
|
2393
|
+
);
|
|
2394
|
+
if (s < 0) return;
|
|
2395
|
+
c(() => {
|
|
2396
|
+
this.repeatingTransactions = [
|
|
2397
|
+
...this.repeatingTransactions.slice(0, s),
|
|
2398
|
+
...F(
|
|
2399
|
+
this.globalStore.accountStore.visibleAccounts,
|
|
2400
|
+
[e],
|
|
2401
|
+
this.globalStore.transactionStore.transactions
|
|
2402
|
+
),
|
|
2403
|
+
...this.repeatingTransactions.slice(s + 1)
|
|
2404
|
+
];
|
|
2405
|
+
});
|
|
2406
|
+
} catch (e) {
|
|
2407
|
+
console.error(`Error occurred while updating repeating transaction: ${e}`);
|
|
2408
|
+
}
|
|
2409
|
+
};
|
|
2410
|
+
/**
|
|
2411
|
+
* Mark a recurrence as paid by linking a transaction to the repeating transaction.
|
|
2412
|
+
* @param repeatingTransactionGuid - The GUID of the repeating transaction.
|
|
2413
|
+
* @param transaction - The transaction to link.
|
|
2414
|
+
*/
|
|
2415
|
+
markRecurrenceAsPaid = async (t, e) => {
|
|
2416
|
+
try {
|
|
2417
|
+
await this.globalStore.transactionStore.updateTransaction({
|
|
2418
|
+
...e,
|
|
2419
|
+
repeating_transaction_guid: t
|
|
2420
|
+
}), await this.loadRepeatingTransactions(), this.setSelectedRecurrence(null), this.setAlert(this.copy.link_transaction_success, "success");
|
|
2421
|
+
} catch (s) {
|
|
2422
|
+
console.error(`Error occurred while marking recurrence as paid: ${s}`), this.setAlert(this.copy.link_transaction_error, "error");
|
|
2423
|
+
}
|
|
2424
|
+
};
|
|
2425
|
+
/**
|
|
2426
|
+
* Mark a recurrence as unpaid by unlinking the associated transaction from the repeating transaction.
|
|
2427
|
+
* @param transaction - The transaction to unlink.
|
|
2428
|
+
*/
|
|
2429
|
+
markRecurrenceAsUnpaid = async (t) => {
|
|
2430
|
+
try {
|
|
2431
|
+
await this.globalStore.transactionStore.updateTransaction({
|
|
2432
|
+
...t,
|
|
2433
|
+
repeating_transaction_guid: null
|
|
2434
|
+
}), await this.loadRepeatingTransactions(), this.setSelectedRecurrence(null), this.setAlert(this.copy.unlink_transaction_success, "success");
|
|
2435
|
+
} catch (e) {
|
|
2436
|
+
console.error(`Error occurred while marking recurrence as unpaid: ${e}`), this.setAlert(this.copy.unlink_transaction_error, "error");
|
|
2437
|
+
}
|
|
2438
|
+
};
|
|
2439
|
+
setAlert = (t, e = void 0) => this.alert = { message: t, severity: e };
|
|
2440
|
+
}
|
|
2441
|
+
const ht = "PARENT-ENTITY", Oe = (n, t) => ({
|
|
2442
|
+
[N.BudgetExceeded]: t.notification_budget_exceeded,
|
|
2443
|
+
[N.BudgetOffTarget]: t.notification_budget_off_target,
|
|
2444
|
+
[_.DebtPaymentReminder]: t.notification_debt_payment_reminder,
|
|
2445
|
+
[_.AccountBalanceLow]: t.notification_low_balance,
|
|
2446
|
+
[_.AccountDepositLargePosted]: t.notification_large_deposit,
|
|
2447
|
+
[_.AccountDepositLarge]: t.notification_large_deposit,
|
|
2448
|
+
[_.TransactionExpenseLarge]: t.notification_large_expense,
|
|
2449
|
+
[_.TransactionFeeCharge]: t.notification_transaction_fee,
|
|
2450
|
+
[_.InternationalTransaction]: t.notification_transaction_is_international,
|
|
2451
|
+
[u.AccountBalanceLow]: t.account_balance_low,
|
|
2452
|
+
[u.BillAmountNotStandard]: t.bill_amount_not_standard,
|
|
2453
|
+
[u.CategorySpending]: t.category_spending,
|
|
2454
|
+
[u.CreditCardCloseToLimit]: t.credit_card_close_to_limit,
|
|
2455
|
+
[u.DebtPaymentReminder]: t.debt_payment_reminder,
|
|
2456
|
+
[u.DuplicatePayment]: t.duplicate_payment,
|
|
2457
|
+
[u.MonthlySpendComparison]: t.monthly_spend_comparison,
|
|
2458
|
+
[u.MonthlySpendToIncomeComparison]: t.monthly_spend_to_income_comparison,
|
|
2459
|
+
[u.MonthlySubscriptionAggregate]: t.monthly_subscription_aggregate,
|
|
2460
|
+
[u.MonthlyTopMerchantSpending]: t.monthly_top_merchant_spending,
|
|
2461
|
+
[u.SaveAnExtra100Dollars]: t.save_an_extra_100_dollars,
|
|
2462
|
+
[u.SavingsOpportunity]: t.savings_opportunity,
|
|
2463
|
+
[u.SetUpDirectDeposit]: t.set_up_direct_deposit,
|
|
2464
|
+
[u.SwitchDirectDeposit]: t.switch_direct_deposit,
|
|
2465
|
+
[u.UncategorizedTransactions]: t.uncategorized_transactions,
|
|
2466
|
+
[u.UnifiedDeposit]: t.unified_deposit,
|
|
2467
|
+
[u.UpcomingBill]: t.upcoming_bill,
|
|
2468
|
+
[u.WeekendSpendingSummary]: t.weekend_spending_summary,
|
|
2469
|
+
[u.WeeklyNewMerchants]: t.weekly_new_merchants,
|
|
2470
|
+
[u.DiscoveredAccounts]: t.discovered_account,
|
|
2471
|
+
[u.TransactionExpenseLarge]: t.large_transaction,
|
|
2472
|
+
[u.PromotionalCampaignMessages]: t.promotional_campaign_messages,
|
|
2473
|
+
[u.TransparentOverdraft]: t.transparent_overdraft
|
|
2474
|
+
})[n] || "", Pe = (n, t, e, s, a, o) => {
|
|
2475
|
+
const r = [], {
|
|
2476
|
+
email_notifications_enabled: l,
|
|
2477
|
+
sms_notifications_enabled: p,
|
|
2478
|
+
push_notifications_enabled: b
|
|
2479
|
+
} = t, {
|
|
2480
|
+
opted_out_of_email_notifications: _t,
|
|
2481
|
+
opted_out_of_sms_notifications: ft,
|
|
2482
|
+
opted_out_of_push_notifications: yt
|
|
2483
|
+
} = a;
|
|
2484
|
+
for (const I of s.filter((R) => R.entity_guid === ht)) {
|
|
2485
|
+
const R = Oe(I.notification_type, e), mt = s.filter(
|
|
2486
|
+
(C) => C.entity_guid !== ht && C.notification_type === I.notification_type && n.some((M) => M.guid === C.entity_guid)
|
|
2487
|
+
), D = [];
|
|
2488
|
+
l && !_t && I.email_channel && o.email && D.push(e.delivery_method_email_label), p && !ft && I.sms_channel && o.phone && D.push(e.delivery_method_sms_label), b && !yt && I.push_channel && D.push(e.delivery_method_push_label), r.push({
|
|
2489
|
+
...I,
|
|
2490
|
+
children: mt.map((C) => ({
|
|
2491
|
+
...C,
|
|
2492
|
+
account: n.find((M) => M.guid === C.entity_guid),
|
|
2493
|
+
label: R
|
|
2494
|
+
})),
|
|
2495
|
+
deliveryMethodsLabel: D.join(", "),
|
|
2496
|
+
label: R
|
|
2497
|
+
});
|
|
2498
|
+
}
|
|
2499
|
+
return r;
|
|
2500
|
+
};
|
|
2501
|
+
class Fe {
|
|
2502
|
+
globalStore;
|
|
2503
|
+
api = new rt("/", "");
|
|
2504
|
+
transactionApi = new x("/", "");
|
|
2505
|
+
alert = { message: "", severity: void 0 };
|
|
2506
|
+
devices = [];
|
|
2507
|
+
notificationProfiles = [];
|
|
2508
|
+
selectedRule = void 0;
|
|
2509
|
+
transactionRules = [];
|
|
2510
|
+
constructor(t) {
|
|
2511
|
+
this.globalStore = t, this.api = new rt(t.endpoint, t.sessionToken, t.onError), this.transactionApi = new x(
|
|
2512
|
+
t.endpoint,
|
|
2513
|
+
t.sessionToken,
|
|
2514
|
+
t.onError
|
|
2515
|
+
), d(this);
|
|
2516
|
+
}
|
|
2517
|
+
get accountProfiles() {
|
|
2518
|
+
const t = this.globalStore.appDataStore.clientCommunicationProfile;
|
|
2519
|
+
return this.detailedNotificationProfiles.filter(
|
|
2520
|
+
(e) => e.notification_type === _.DebtPaymentReminder && t.debt_payment_reminder_notifications_enabled || e.notification_type === _.AccountBalanceLow && t.low_balance_notifications_enabled || e.notification_type === _.AccountDepositLarge && t.large_deposit_notifications_enabled || e.notification_type === _.TransactionExpenseLarge && t.large_expense_notifications_enabled || e.notification_type === _.TransactionFeeCharge && t.transaction_fee_notifications_enabled || e.notification_type === _.InternationalTransaction && t.transaction_is_international_notifications_enabled || e.notification_type === _.AccountDepositLargePosted && t.large_deposit_posted_notifications_enabled
|
|
2521
|
+
);
|
|
2522
|
+
}
|
|
2523
|
+
get budgetProfiles() {
|
|
2524
|
+
const t = this.globalStore.appDataStore.clientCommunicationProfile;
|
|
2525
|
+
return this.detailedNotificationProfiles.filter(
|
|
2526
|
+
(e) => e.notification_type === N.BudgetExceeded && t.budget_exceeded_notifications_enabled || e.notification_type === N.BudgetOffTarget && t.budget_off_target_notifications_enabled
|
|
2527
|
+
);
|
|
2528
|
+
}
|
|
2529
|
+
get insightsProfiles() {
|
|
2530
|
+
return this.detailedNotificationProfiles.filter(
|
|
2531
|
+
(t) => Object.values(u).includes(t.notification_type)
|
|
2532
|
+
);
|
|
2533
|
+
}
|
|
2534
|
+
get clientCommunicationProfile() {
|
|
2535
|
+
return this.globalStore.appDataStore.clientCommunicationProfile;
|
|
2536
|
+
}
|
|
2537
|
+
get copy() {
|
|
2538
|
+
return this.globalStore.copyStore.copy.settings;
|
|
2539
|
+
}
|
|
2540
|
+
get detailedNotificationProfiles() {
|
|
2541
|
+
return this.globalStore.isInitialized ? Pe(
|
|
2542
|
+
this.globalStore.accountStore.accounts,
|
|
2543
|
+
this.clientCommunicationProfile,
|
|
2544
|
+
this.copy,
|
|
2545
|
+
this.notificationProfiles,
|
|
2546
|
+
this.userCommunicationsProfile,
|
|
2547
|
+
this.globalStore.userStore.user
|
|
2548
|
+
) : [];
|
|
2549
|
+
}
|
|
2550
|
+
get userCommunicationsProfile() {
|
|
2551
|
+
return this.globalStore.appDataStore.userCommunicationProfile;
|
|
2552
|
+
}
|
|
2553
|
+
deleteDevice = async (t) => {
|
|
2554
|
+
try {
|
|
2555
|
+
await this.api.deleteDevice(t);
|
|
2556
|
+
const e = this.devices.findIndex((s) => s.guid === t);
|
|
2557
|
+
return e >= 0 && c(() => {
|
|
2558
|
+
this.devices.splice(e, 1);
|
|
2559
|
+
}), { success: !0 };
|
|
2560
|
+
} catch {
|
|
2561
|
+
return console.error(`Error deleting device: ${t}`), { success: !1 };
|
|
2562
|
+
}
|
|
2563
|
+
};
|
|
2564
|
+
deleteTransactionRule = async () => {
|
|
2565
|
+
this.selectedRule && this.transactionApi.removeTransactionRule(this.selectedRule?.guid).then(() => {
|
|
2566
|
+
this.setAlert(this.copy.delete_rule_success, "success"), this.loadTransactionRules();
|
|
2567
|
+
}).catch(() => {
|
|
2568
|
+
this.setAlert(this.copy.delete_rule_error, "error");
|
|
2569
|
+
});
|
|
2570
|
+
};
|
|
2571
|
+
generateDeviceToken = async () => {
|
|
2572
|
+
try {
|
|
2573
|
+
return await this.api.generateDeviceToken();
|
|
2574
|
+
} catch (t) {
|
|
2575
|
+
console.error(`Error generating device token: ${t}`);
|
|
2576
|
+
}
|
|
2577
|
+
};
|
|
2578
|
+
loadDevices = async () => {
|
|
2579
|
+
try {
|
|
2580
|
+
const t = await this.api.getDevices();
|
|
2581
|
+
c(() => {
|
|
2582
|
+
this.devices = t;
|
|
2583
|
+
});
|
|
2584
|
+
} catch (t) {
|
|
2585
|
+
console.error(`Error loading devices: ${t}`);
|
|
2586
|
+
}
|
|
2587
|
+
};
|
|
2588
|
+
loadNotificationProfiles = async () => {
|
|
2589
|
+
try {
|
|
2590
|
+
const t = await this.api.getNotificationProfiles();
|
|
2591
|
+
c(() => {
|
|
2592
|
+
this.notificationProfiles = t;
|
|
2593
|
+
});
|
|
2594
|
+
} catch (t) {
|
|
2595
|
+
console.error(`Error loading notification profiles: ${t}`);
|
|
2596
|
+
}
|
|
2597
|
+
};
|
|
2598
|
+
loadTransactionRules = async () => {
|
|
2599
|
+
try {
|
|
2600
|
+
const t = await this.transactionApi.getTransactionRules();
|
|
2601
|
+
c(() => {
|
|
2602
|
+
this.transactionRules = t;
|
|
2603
|
+
});
|
|
2604
|
+
} catch (t) {
|
|
2605
|
+
console.error(`Error loading transaction rules: ${t}`);
|
|
2606
|
+
}
|
|
2607
|
+
};
|
|
2608
|
+
sendEmailVerification = async () => {
|
|
2609
|
+
try {
|
|
2610
|
+
await this.api.sendEmailVerification(), this.setAlert(this.copy.verification_sent_success, "success");
|
|
2611
|
+
} catch (t) {
|
|
2612
|
+
console.error(`Error sending email verification: ${t}`), this.setAlert(this.copy.verification_sent_error, "error");
|
|
2613
|
+
}
|
|
2614
|
+
};
|
|
2615
|
+
sendPhoneVerification = async () => {
|
|
2616
|
+
try {
|
|
2617
|
+
await this.api.sendPhoneVerification(), this.setAlert(this.copy.verification_sent_success, "success");
|
|
2618
|
+
} catch (t) {
|
|
2619
|
+
console.error(`Error sending phone verification: ${t}`), this.setAlert(this.copy.verification_sent_error, "error");
|
|
2620
|
+
}
|
|
2621
|
+
};
|
|
2622
|
+
setAlert = (t, e = void 0) => this.alert = { message: t, severity: e };
|
|
2623
|
+
setSelectedRule = (t) => {
|
|
2624
|
+
this.selectedRule = t;
|
|
2625
|
+
};
|
|
2626
|
+
updateDevice = async (t) => {
|
|
2627
|
+
try {
|
|
2628
|
+
const e = await this.api.updateDevice(t), s = this.devices.findIndex((a) => a.guid === t.guid);
|
|
2629
|
+
return s >= 0 && c(() => {
|
|
2630
|
+
this.devices[s] = e;
|
|
2631
|
+
}), { success: !0 };
|
|
2632
|
+
} catch (e) {
|
|
2633
|
+
return console.error(`Error updating device: ${e}`), { success: !1 };
|
|
2634
|
+
}
|
|
2635
|
+
};
|
|
2636
|
+
updateNotificationProfile = async (t) => {
|
|
2637
|
+
try {
|
|
2638
|
+
const e = await this.api.updateNotificationProfile(t), s = this.notificationProfiles.findIndex((a) => a.guid === t.guid);
|
|
2639
|
+
s >= 0 && c(() => {
|
|
2640
|
+
this.notificationProfiles[s] = e;
|
|
2641
|
+
});
|
|
2642
|
+
} catch (e) {
|
|
2643
|
+
console.error(`Error updating notification profile: ${e}`);
|
|
2644
|
+
}
|
|
2645
|
+
};
|
|
2646
|
+
updateRuleCategory = async (t) => {
|
|
2647
|
+
this.transactionApi.updateTransactionRule(t).then(() => {
|
|
2648
|
+
this.loadTransactionRules();
|
|
2649
|
+
});
|
|
2650
|
+
};
|
|
2651
|
+
updateRulePayee = async (t) => {
|
|
2652
|
+
this.transactionApi.updateTransactionRule(t).then(() => {
|
|
2653
|
+
this.setAlert(this.copy.edit_payee_success, "success"), this.loadTransactionRules();
|
|
2654
|
+
}).catch(() => {
|
|
2655
|
+
this.setAlert(this.copy.edit_payee_error, "error");
|
|
2656
|
+
});
|
|
2657
|
+
};
|
|
2658
|
+
updateUser = async (t) => {
|
|
2659
|
+
this.globalStore.userStore.updateUser(t).then(() => {
|
|
2660
|
+
this.setAlert(this.copy.information_updated_success, "success");
|
|
2661
|
+
}).catch(() => {
|
|
2662
|
+
this.setAlert(this.copy.information_updated_error, "error");
|
|
2663
|
+
});
|
|
2664
|
+
};
|
|
2665
|
+
updateUserCommunicationProfile = async (t) => {
|
|
2666
|
+
try {
|
|
2667
|
+
const e = await this.api.updateUserCommunicationProfile(t);
|
|
2668
|
+
this.globalStore.appDataStore.setUserCommunicationProfile(e);
|
|
2669
|
+
} catch (e) {
|
|
2670
|
+
console.error(`Error occurred while updating user communication profile: ${e}`);
|
|
2671
|
+
}
|
|
2672
|
+
};
|
|
2673
|
+
verifyPhoneToken = async (t) => {
|
|
2674
|
+
try {
|
|
2675
|
+
const { verified: e } = await this.api.verifyPhoneToken(t);
|
|
2676
|
+
if (!e)
|
|
2677
|
+
throw new Error();
|
|
2678
|
+
this.setAlert(this.copy.verified_phone_success, "success");
|
|
2679
|
+
} catch (e) {
|
|
2680
|
+
console.error(`Error verifying phone token: ${e}`), this.setAlert(this.copy.verified_phone_error, "error");
|
|
2681
|
+
}
|
|
2682
|
+
};
|
|
2683
|
+
}
|
|
2684
|
+
class Ue {
|
|
2685
|
+
globalStore;
|
|
2686
|
+
uiStore;
|
|
2687
|
+
api = new x("/", "");
|
|
2688
|
+
beatApi = new $("/", "");
|
|
2689
|
+
associatedBeats = [];
|
|
2690
|
+
associatedBeatsLoaded = !1;
|
|
2691
|
+
associatedBeatsLoading = !1;
|
|
2692
|
+
transactions = [];
|
|
2693
|
+
transactionsLoaded = !1;
|
|
2694
|
+
transactionsLoading = !1;
|
|
2695
|
+
taggings = [];
|
|
2696
|
+
taggingsLoaded = !1;
|
|
2697
|
+
taggingsLoading = !1;
|
|
2698
|
+
tags = [];
|
|
2699
|
+
tagsLoaded = !1;
|
|
2700
|
+
tagsLoading = !1;
|
|
2701
|
+
transactionRules = [];
|
|
2702
|
+
transactionRulesLoaded = !1;
|
|
2703
|
+
transactionRulesLoading = !1;
|
|
2704
|
+
transactionSplitting = !1;
|
|
2705
|
+
cachedStartDate = pt(y(), 90);
|
|
2706
|
+
filter = {};
|
|
2707
|
+
isLoading = !0;
|
|
2708
|
+
alert = "";
|
|
2709
|
+
sortColumn = Gt.DATE;
|
|
2710
|
+
sortDirection = Nt.DESC;
|
|
2711
|
+
constructor(t) {
|
|
2712
|
+
this.globalStore = t, this.uiStore = new ke(), this.api = new x(
|
|
2713
|
+
t.endpoint,
|
|
2714
|
+
t.sessionToken,
|
|
2715
|
+
t.onError
|
|
2716
|
+
), this.beatApi = new $(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
2717
|
+
}
|
|
2718
|
+
loadTransactionData = async () => {
|
|
2719
|
+
this.globalStore.accountStore.isAccountDataLoaded || await this.globalStore.accountStore.loadAccountData(), this.globalStore.categoryStore.categoriesLoaded || await this.globalStore.categoryStore.loadCategories(), await Promise.all([
|
|
2720
|
+
this.loadAssociatedBeats(E(/* @__PURE__ */ new Date())),
|
|
2721
|
+
this.loadTags(),
|
|
2722
|
+
this.loadTaggings(),
|
|
2723
|
+
this.loadTransactionRules(),
|
|
2724
|
+
// By default loads 90 days of transactions
|
|
2725
|
+
this.loadTransactions(this.cachedStartDate)
|
|
2726
|
+
]);
|
|
2727
|
+
};
|
|
2728
|
+
get isTransactionDataLoaded() {
|
|
2729
|
+
return this.associatedBeatsLoaded && this.tagsLoaded && this.taggingsLoaded && this.transactionRulesLoaded && this.transactionsLoaded;
|
|
2730
|
+
}
|
|
2731
|
+
get detailedTransactions() {
|
|
2732
|
+
return this.isTransactionDataLoaded ? Bt(
|
|
2733
|
+
this.transactions,
|
|
2734
|
+
this.globalStore.accountStore.visibleAccounts,
|
|
2735
|
+
this.globalStore.categoryStore.categories,
|
|
2736
|
+
this.taggings
|
|
2737
|
+
) : [];
|
|
2738
|
+
}
|
|
2739
|
+
get sortedTransactions() {
|
|
2740
|
+
return xt(
|
|
2741
|
+
this.filter,
|
|
2742
|
+
this.uiStore.expandedSplits,
|
|
2743
|
+
this.sortColumn,
|
|
2744
|
+
this.sortDirection,
|
|
2745
|
+
this.tags,
|
|
2746
|
+
this.detailedTransactions
|
|
2747
|
+
);
|
|
2748
|
+
}
|
|
2749
|
+
get sortedTransactionsWithSplits() {
|
|
2750
|
+
return Mt(this.sortedTransactions, this.detailedTransactions);
|
|
2751
|
+
}
|
|
2752
|
+
setAssociatedBeats = (t) => {
|
|
2753
|
+
this.associatedBeats = t, this.associatedBeatsLoading = !1, this.associatedBeatsLoaded = !0;
|
|
2754
|
+
};
|
|
2755
|
+
setTaggings = (t) => {
|
|
2756
|
+
this.taggings = t, this.taggingsLoading = !1, this.taggingsLoaded = !0;
|
|
2757
|
+
};
|
|
2758
|
+
setTags = (t) => {
|
|
2759
|
+
this.tags = t, this.tagsLoading = !1, this.tagsLoaded = !0;
|
|
2760
|
+
};
|
|
2761
|
+
setTransactionRules = (t) => {
|
|
2762
|
+
this.transactionRules = t, this.transactionRulesLoading = !1, this.transactionRulesLoaded = !0;
|
|
2763
|
+
};
|
|
2764
|
+
setTransactions = (t) => {
|
|
2765
|
+
this.transactions = t, this.transactionsLoading = !1, this.transactionsLoaded = !0;
|
|
2766
|
+
};
|
|
2767
|
+
setAlert = (t) => {
|
|
2768
|
+
this.alert = t;
|
|
2769
|
+
};
|
|
2770
|
+
addTag = async (t) => {
|
|
2771
|
+
await this.api.addTag({ name: t }), await this.loadTags();
|
|
2772
|
+
};
|
|
2773
|
+
addTagging = async (t, e) => {
|
|
2774
|
+
await this.api.addTagging({
|
|
2775
|
+
tag_guid: t,
|
|
2776
|
+
transaction_guid: e
|
|
2777
|
+
});
|
|
2778
|
+
};
|
|
2779
|
+
addOrUpdateTransactionRule = async (t, e) => {
|
|
2780
|
+
const s = this.transactionRules.find(
|
|
2781
|
+
(a) => a.guid === e.user_transaction_rule_guid
|
|
2782
|
+
);
|
|
2783
|
+
s ? await this.api.updateTransactionRule({
|
|
2784
|
+
...s,
|
|
2785
|
+
category_guid: t,
|
|
2786
|
+
description: e.description
|
|
2787
|
+
}) : await this.api.addTransactionRule({
|
|
2788
|
+
category_guid: t,
|
|
2789
|
+
description: e.description,
|
|
2790
|
+
match_description: e.description
|
|
2791
|
+
}), await this.loadTransactionRules();
|
|
2792
|
+
};
|
|
2793
|
+
addTransaction = async (t) => {
|
|
2794
|
+
const e = await this.api.addTransaction(t);
|
|
2795
|
+
if (e) {
|
|
2796
|
+
this.setTransactions([e, ...this.transactions]);
|
|
2797
|
+
const s = e.transaction_type === Ot.CREDIT ? e.amount : -e.amount;
|
|
2798
|
+
this.globalStore.accountStore.updateAccountBalance(e.account_guid, s);
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2801
|
+
loadAssociatedBeats = async (t) => {
|
|
2802
|
+
if (this.associatedBeatsLoading) return;
|
|
2803
|
+
this.associatedBeatsLoading = !0;
|
|
2804
|
+
const e = t ? ee(t, { representation: "date" }) : void 0;
|
|
2805
|
+
try {
|
|
2806
|
+
const s = await this.beatApi.getBeatsWithAssociatedTransaction(e);
|
|
2807
|
+
this.setAssociatedBeats(s);
|
|
2808
|
+
} catch (s) {
|
|
2809
|
+
console.error(`Error occurred while loading associated beats: ${s}`);
|
|
2810
|
+
}
|
|
2811
|
+
};
|
|
2812
|
+
loadTags = async () => {
|
|
2813
|
+
if (!this.tagsLoading) {
|
|
2814
|
+
this.tagsLoading = !0;
|
|
2815
|
+
try {
|
|
2816
|
+
const t = await this.api.getTags();
|
|
2817
|
+
this.setTags(t);
|
|
2818
|
+
} catch (t) {
|
|
2819
|
+
console.error(`Error occurred while loading tags: ${t}`);
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2822
|
+
};
|
|
2823
|
+
loadTaggings = async () => {
|
|
2824
|
+
if (!this.taggingsLoading) {
|
|
2825
|
+
this.taggingsLoading = !0;
|
|
2826
|
+
try {
|
|
2827
|
+
const t = await this.api.getTaggings();
|
|
2828
|
+
this.setTaggings(t);
|
|
2829
|
+
} catch (t) {
|
|
2830
|
+
console.error(`Error occurred while loading taggings: ${t}`);
|
|
2831
|
+
}
|
|
2832
|
+
}
|
|
2833
|
+
};
|
|
2834
|
+
loadTransactionRules = async () => {
|
|
2835
|
+
if (this.transactionRulesLoading) return;
|
|
2836
|
+
this.transactionRulesLoading = !0;
|
|
2837
|
+
const t = await this.api.getTransactionRules();
|
|
2838
|
+
this.setTransactionRules(t);
|
|
2839
|
+
};
|
|
2840
|
+
loadTransactions = async (t = this.cachedStartDate) => {
|
|
2841
|
+
if (!this.transactionsLoading) {
|
|
2842
|
+
this.setIsLoading(!0), this.transactionsLoading = !0, this.transactions = [];
|
|
2843
|
+
try {
|
|
2844
|
+
const e = await this.api.getTransactionsByDateRange(
|
|
2845
|
+
m(t),
|
|
2846
|
+
m(q())
|
|
2847
|
+
);
|
|
2848
|
+
this.setTransactions(e);
|
|
2849
|
+
} catch (e) {
|
|
2850
|
+
console.error(`Error occurred while loading transactions: ${e}`);
|
|
2851
|
+
}
|
|
2852
|
+
this.setIsLoading(!1);
|
|
2853
|
+
}
|
|
2854
|
+
};
|
|
2855
|
+
modifyTransactionByAccountGuid = (t, e) => {
|
|
2856
|
+
this.transactions = this.transactions.map(
|
|
2857
|
+
(s) => s.account_guid === t ? { ...s, ...e } : s
|
|
2858
|
+
);
|
|
2859
|
+
};
|
|
2860
|
+
removeTag = async (t) => {
|
|
2861
|
+
await this.api.removeTag(t), await this.loadTags();
|
|
2862
|
+
};
|
|
2863
|
+
removeTagging = async (t) => {
|
|
2864
|
+
await this.api.removeTagging(t);
|
|
2865
|
+
};
|
|
2866
|
+
removeTransaction = async (t) => {
|
|
2867
|
+
await this.api.removeTransaction(t);
|
|
2868
|
+
const e = this.transactions.findIndex((s) => s.guid === t);
|
|
2869
|
+
if (e >= 0) {
|
|
2870
|
+
const s = [...this.transactions];
|
|
2871
|
+
s.splice(e, 1), this.setTransactions(s);
|
|
2872
|
+
}
|
|
2873
|
+
};
|
|
2874
|
+
setFilter = (t) => {
|
|
2875
|
+
this.filter = t, t.dateRange && H(t.dateRange.start, this.cachedStartDate) && this.loadTransactions(t.dateRange.start).then(() => {
|
|
2876
|
+
t.dateRange && (this.cachedStartDate = t.dateRange.start);
|
|
2877
|
+
});
|
|
2878
|
+
};
|
|
2879
|
+
setIsLoading = (t) => this.isLoading = t;
|
|
2880
|
+
splitTransaction = async (t, e) => {
|
|
2881
|
+
if (!this.transactionSplitting) {
|
|
2882
|
+
this.transactionSplitting = !0;
|
|
2883
|
+
try {
|
|
2884
|
+
const s = await this.api.updateTransaction(t), a = [];
|
|
2885
|
+
for (let r = 0; r < e.length; r++) {
|
|
2886
|
+
const l = await this.api.addTransaction(e[r]);
|
|
2887
|
+
a.push(l);
|
|
2888
|
+
}
|
|
2889
|
+
const o = this.transactions.findIndex((r) => r.guid === t.guid);
|
|
2890
|
+
if (o >= 0) {
|
|
2891
|
+
const r = this.transactions.filter(
|
|
2892
|
+
(l) => l.guid !== t.guid && l.parent_guid !== t.guid
|
|
2893
|
+
);
|
|
2894
|
+
this.setTransactions([
|
|
2895
|
+
...r.slice(0, o),
|
|
2896
|
+
s,
|
|
2897
|
+
...a,
|
|
2898
|
+
...r.slice(o)
|
|
2899
|
+
]);
|
|
2900
|
+
}
|
|
2901
|
+
} finally {
|
|
2902
|
+
this.transactionSplitting = !1;
|
|
2903
|
+
}
|
|
2904
|
+
}
|
|
2905
|
+
};
|
|
2906
|
+
unSplitTransaction = async (t) => {
|
|
2907
|
+
const e = this.transactions.filter((r) => r.parent_guid === t);
|
|
2908
|
+
await this.api.removeTransactionSplit(t);
|
|
2909
|
+
const s = [...this.transactions];
|
|
2910
|
+
e.forEach((r) => {
|
|
2911
|
+
const l = s.findIndex((p) => p.guid === r.guid);
|
|
2912
|
+
l >= 0 && s.splice(l, 1);
|
|
2913
|
+
});
|
|
2914
|
+
const a = s.findIndex((r) => r.guid === t), o = s[a];
|
|
2915
|
+
o.has_been_split = !1, a >= 0 && this.setTransactions([
|
|
2916
|
+
...s.slice(0, a),
|
|
2917
|
+
o,
|
|
2918
|
+
...s.slice(a + 1)
|
|
2919
|
+
]);
|
|
2920
|
+
};
|
|
2921
|
+
updateTaggings = async (t, e) => {
|
|
2922
|
+
const s = this.taggings.filter((r) => r.transaction_guid === e), a = new Set(s.map((r) => r.tag_guid)), o = new Set(t);
|
|
2923
|
+
for (const r of t)
|
|
2924
|
+
a.has(r) || await this.addTagging(r, e);
|
|
2925
|
+
for (const r of s)
|
|
2926
|
+
o.has(r.tag_guid) || await this.removeTagging(r.guid);
|
|
2927
|
+
await this.loadTaggings();
|
|
2928
|
+
};
|
|
2929
|
+
updateTag = async (t) => {
|
|
2930
|
+
await this.api.updateTag(t), await this.loadTags();
|
|
2931
|
+
};
|
|
2932
|
+
updateTransaction = async (t) => {
|
|
2933
|
+
const e = await this.api.updateTransaction(t), s = this.transactions.findIndex((a) => a.guid === t.guid);
|
|
2934
|
+
s >= 0 && this.setTransactions([
|
|
2935
|
+
...this.transactions.slice(0, s),
|
|
2936
|
+
e,
|
|
2937
|
+
...this.transactions.slice(s + 1)
|
|
2938
|
+
]);
|
|
2939
|
+
};
|
|
2940
|
+
// This is used for loading the transactions list on demand, on clicking the different transactions of the insightful beats.
|
|
2941
|
+
loadEmbeddedInstanceTransactions = async (t) => {
|
|
2942
|
+
try {
|
|
2943
|
+
const e = await this.api.getTransactionsByDateRange(
|
|
2944
|
+
m(t),
|
|
2945
|
+
m(q())
|
|
2946
|
+
);
|
|
2947
|
+
this.cachedStartDate = t, this.transactions = e;
|
|
2948
|
+
} catch (e) {
|
|
2949
|
+
console.error(`Error occurred while loading embedded instance transactions: ${e}`);
|
|
2950
|
+
}
|
|
2951
|
+
};
|
|
2952
|
+
}
|
|
2953
|
+
class ke {
|
|
2954
|
+
beginDate = E(/* @__PURE__ */ new Date());
|
|
2955
|
+
endDate = T(/* @__PURE__ */ new Date());
|
|
2956
|
+
expandedSplits = [];
|
|
2957
|
+
height = 550;
|
|
2958
|
+
width = 1e3;
|
|
2959
|
+
shouldDisableDrawerScroll = !1;
|
|
2960
|
+
searchValue = "";
|
|
2961
|
+
selectedAccountGuids = [];
|
|
2962
|
+
manualTransaction = Pt;
|
|
2963
|
+
isAmountValid = !1;
|
|
2964
|
+
showInsights = !1;
|
|
2965
|
+
constructor() {
|
|
2966
|
+
d(this);
|
|
2967
|
+
}
|
|
2968
|
+
setDateRange = (t, e) => {
|
|
2969
|
+
this.beginDate = t, this.endDate = e;
|
|
2970
|
+
};
|
|
2971
|
+
setIsAmountValid = (t) => this.isAmountValid = t;
|
|
2972
|
+
setSearchValue = (t) => this.searchValue = t;
|
|
2973
|
+
setSelectedAccountGuids = (t) => this.selectedAccountGuids = t;
|
|
2974
|
+
setShouldDisableDrawerScroll = (t) => this.shouldDisableDrawerScroll = t;
|
|
2975
|
+
setShowInsights = (t) => {
|
|
2976
|
+
this.showInsights = t;
|
|
2977
|
+
};
|
|
2978
|
+
setSize = (t, e) => {
|
|
2979
|
+
this.height = t, this.width = e;
|
|
2980
|
+
};
|
|
2981
|
+
toggleSplit = (t) => {
|
|
2982
|
+
const e = [...this.expandedSplits], s = this.expandedSplits.findIndex((a) => a === t);
|
|
2983
|
+
s >= 0 ? e.splice(s, 1) : e.push(t), this.expandedSplits = e;
|
|
2984
|
+
};
|
|
2985
|
+
clearExpandedSplits = () => {
|
|
2986
|
+
this.expandedSplits.length !== 0 && (this.expandedSplits = []);
|
|
2987
|
+
};
|
|
2988
|
+
updateManualTransaction = (t) => {
|
|
2989
|
+
this.manualTransaction = t;
|
|
2990
|
+
};
|
|
2991
|
+
}
|
|
2992
|
+
class He {
|
|
2993
|
+
globalStore;
|
|
2994
|
+
selectedCategoryData = null;
|
|
2995
|
+
selectedDateRange;
|
|
2996
|
+
visibleListLength = 5;
|
|
2997
|
+
constructor(t) {
|
|
2998
|
+
this.globalStore = t, this.selectedDateRange = {
|
|
2999
|
+
start: se(T(G(/* @__PURE__ */ new Date(), 6)), 1),
|
|
3000
|
+
end: T(/* @__PURE__ */ new Date())
|
|
3001
|
+
}, d(this);
|
|
3002
|
+
}
|
|
3003
|
+
setSelectedCategoryData = (t) => {
|
|
3004
|
+
this.selectedCategoryData = t;
|
|
3005
|
+
};
|
|
3006
|
+
setSelectedDateRange = (t) => {
|
|
3007
|
+
this.selectedDateRange = t;
|
|
3008
|
+
};
|
|
3009
|
+
setVisibleListLength = (t) => {
|
|
3010
|
+
this.visibleListLength = t;
|
|
3011
|
+
};
|
|
3012
|
+
get sortedDetailedCategoriesWithTransactions() {
|
|
3013
|
+
return ne(
|
|
3014
|
+
this.globalStore.categoryStore.detailedCategoriesWithTransactions
|
|
3015
|
+
);
|
|
3016
|
+
}
|
|
3017
|
+
get selectedDateRangeMonthCount() {
|
|
3018
|
+
return ae(this.selectedDateRange.end, this.selectedDateRange.start) + 1;
|
|
3019
|
+
}
|
|
3020
|
+
get selectedDateRangeMonthRange() {
|
|
3021
|
+
const t = U(this.selectedDateRange.start, k.MONTH_LONG), e = U(this.selectedDateRange.end, k.MONTH_LONG);
|
|
3022
|
+
return `${t} - ${e}`;
|
|
3023
|
+
}
|
|
3024
|
+
get visibleCategories() {
|
|
3025
|
+
return this.sortedDetailedCategoriesWithTransactions.slice(0, this.visibleListLength);
|
|
3026
|
+
}
|
|
3027
|
+
get collapsedCategories() {
|
|
3028
|
+
return this.sortedDetailedCategoriesWithTransactions.slice(this.visibleListLength);
|
|
3029
|
+
}
|
|
3030
|
+
get categoryDetailsChartData() {
|
|
3031
|
+
return ie(
|
|
3032
|
+
this.selectedCategoryData,
|
|
3033
|
+
this.selectedDateRangeMonthCount
|
|
3034
|
+
);
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3037
|
+
class We {
|
|
3038
|
+
globalStore;
|
|
3039
|
+
api = new ot("/", "");
|
|
3040
|
+
userFeatures = [];
|
|
3041
|
+
userFeaturesLoaded = !1;
|
|
3042
|
+
constructor(t) {
|
|
3043
|
+
this.globalStore = t, this.api = new ot(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
3044
|
+
}
|
|
3045
|
+
get userProfile() {
|
|
3046
|
+
return this.globalStore.appDataStore.userProfile;
|
|
3047
|
+
}
|
|
3048
|
+
get user() {
|
|
3049
|
+
return this.globalStore.appDataStore.user;
|
|
3050
|
+
}
|
|
3051
|
+
setUserFeatures = (t) => {
|
|
3052
|
+
this.userFeatures = t, this.userFeaturesLoaded = !0;
|
|
3053
|
+
};
|
|
3054
|
+
loadUserFeatures = async () => {
|
|
3055
|
+
try {
|
|
3056
|
+
const t = await this.api.getUserFeatures();
|
|
3057
|
+
this.setUserFeatures(t);
|
|
3058
|
+
} catch (t) {
|
|
3059
|
+
console.error(`Error occurred while loading user features: ${t}`);
|
|
3060
|
+
}
|
|
3061
|
+
};
|
|
3062
|
+
updateUser = async (t) => {
|
|
3063
|
+
try {
|
|
3064
|
+
const e = await this.api.updateUser(t);
|
|
3065
|
+
this.globalStore.appDataStore.setUser(e);
|
|
3066
|
+
} catch (e) {
|
|
3067
|
+
console.error(`Error updating User: ${e}`);
|
|
3068
|
+
}
|
|
3069
|
+
};
|
|
3070
|
+
updateUserProfile = async (t) => {
|
|
3071
|
+
try {
|
|
3072
|
+
const e = await this.api.updateUserProfile(t);
|
|
3073
|
+
this.globalStore.appDataStore.setUserProfile(e);
|
|
3074
|
+
} catch (e) {
|
|
3075
|
+
console.error(`Error occurred while updating user profile: ${e}`);
|
|
3076
|
+
}
|
|
3077
|
+
};
|
|
3078
|
+
}
|
|
3079
|
+
export {
|
|
3080
|
+
B as A,
|
|
3081
|
+
j as B,
|
|
3082
|
+
fe as C,
|
|
3083
|
+
Ae as D,
|
|
3084
|
+
Z as F,
|
|
3085
|
+
Re as G,
|
|
3086
|
+
et as H,
|
|
3087
|
+
at as M,
|
|
3088
|
+
Be as N,
|
|
3089
|
+
Me as R,
|
|
3090
|
+
rt as S,
|
|
3091
|
+
x as T,
|
|
3092
|
+
ot as U,
|
|
3093
|
+
ct as W,
|
|
3094
|
+
ce as a,
|
|
3095
|
+
he as b,
|
|
3096
|
+
Y as c,
|
|
3097
|
+
de as d,
|
|
3098
|
+
pe as e,
|
|
3099
|
+
X as f,
|
|
3100
|
+
_e as g,
|
|
3101
|
+
J as h,
|
|
3102
|
+
me as i,
|
|
3103
|
+
Te as j,
|
|
3104
|
+
Ce as k,
|
|
3105
|
+
Ns as l,
|
|
3106
|
+
Ee as m,
|
|
3107
|
+
tt as n,
|
|
3108
|
+
De as o,
|
|
3109
|
+
$e as p,
|
|
3110
|
+
st as q,
|
|
3111
|
+
Ge as r,
|
|
3112
|
+
Ne as s,
|
|
3113
|
+
nt as t,
|
|
3114
|
+
xe as u,
|
|
3115
|
+
it as v,
|
|
3116
|
+
Fe as w,
|
|
3117
|
+
Ue as x,
|
|
3118
|
+
He as y,
|
|
3119
|
+
We as z
|
|
3120
|
+
};
|
|
3121
|
+
//# sourceMappingURL=UserStore-BjnNCO5a.mjs.map
|