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