@mx-cartographer/experiences 7.7.2 → 7.8.0-alpha-ram-goal-bug
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 +18 -0
- package/dist/Account-BiB1F8lL.mjs +118 -0
- package/dist/{Account-BfkKlfsW.mjs → Account-DuOz1a27.mjs} +1 -1
- package/dist/AccountApi-DgZ8ILj1.mjs +19 -0
- package/dist/{AccountDetailsHeader-DqYIuhOs.mjs → AccountDetailsHeader-Cf2TUJnM.mjs} +4 -4
- package/dist/AccountDisplayName-CO7z3v99.mjs +11 -0
- package/dist/{AccountFields-yP8QdgPd.mjs → AccountFields-UdOvbQ5H.mjs} +7 -6
- package/dist/{AccountListItem-DMbu9ehd.mjs → AccountListItem-BPVxmNT_.mjs} +7 -7
- package/dist/AccountStore-BbPWe2C9.mjs +244 -0
- package/dist/Accounts-M-LTzStv.mjs +27 -0
- package/dist/{CategoryStore-Cnw9yUys.mjs → CategoryStore-BYICdb9m.mjs} +73 -73
- package/dist/CategoryUtil-meuejJqP.mjs +80 -0
- package/dist/{ConnectionsDrawer-BqR6FWJO.mjs → ConnectionsDrawer-BDpVTTSe.mjs} +1 -1
- package/dist/{DebtsStore-DuSdXM1k.mjs → DebtsStore-BIbOVCPe.mjs} +12 -12
- package/dist/{ExportCsvAction-HK5CeZWR.mjs → ExportCsvAction-CDuzTva1.mjs} +2 -2
- package/dist/GlobalAccountFilter-DQCPNc95.mjs +316 -0
- package/dist/GoalStore-B4LVt_kH.mjs +422 -0
- package/dist/{ManageIncome-BrTrlplL.mjs → ManageIncome-CL3hv8i9.mjs} +44 -44
- package/dist/NetWorthStore-yV43kJro.mjs +168 -0
- package/dist/{NotificationSettings-D4Vh3z8I.mjs → NotificationSettings-SPg3pwbX.mjs} +171 -169
- package/dist/{NotificationStore-CDX_kqHa.mjs → NotificationStore-Ck2KdNmT.mjs} +22 -14
- package/dist/{RecurringSettings-D2V6l77l.mjs → RecurringSettings-Bmnnpb48.mjs} +16 -16
- package/dist/{RecurringTransactionsStore-Caf1cq4v.mjs → RecurringTransactionsStore-BQBEJOPP.mjs} +91 -81
- package/dist/{RecurringTransactions-Bf4lX0Cn.mjs → RepeatingTransaction-miZVnk_A.mjs} +4 -4
- package/dist/{SettingsStore-krIRNwHK.mjs → SettingsStore-BHpuyujx.mjs} +1 -1
- package/dist/SkeletonLoader-BaNboJjD.mjs +38 -0
- package/dist/{SpendingLegend-gTCJLLkV.mjs → SpendingLegend-CD60HCYS.mjs} +33 -33
- package/dist/{TransactionDetails-7MHOshKQ.mjs → TransactionDetails-BDhz3DLT.mjs} +2 -2
- package/dist/TransactionStore-BSp5bOKg.mjs +705 -0
- package/dist/{User-LJpEwPtn.mjs → User-B0LnmiKO.mjs} +21 -20
- package/dist/WidgetContainer-BbPS3Yxz.mjs +555 -0
- package/dist/accounts/index.es.js +421 -391
- package/dist/accounts/stores/AccountStore.d.ts +30 -23
- package/dist/accounts/utils/Accounts.d.ts +2 -1
- package/dist/budgets/index.es.js +546 -540
- package/dist/budgets/store/BudgetsStore.d.ts +1 -0
- package/dist/cashflow/index.es.js +444 -457
- package/dist/categories/index.es.js +1 -1
- package/dist/categories/stores/CategoryStore.d.ts +10 -5
- package/dist/categories/util/CategoryUtil.d.ts +3 -2
- package/dist/common/components/GlobalAccountFilter.d.ts +11 -0
- package/dist/common/components/SkeletonLoader.d.ts +7 -0
- package/dist/common/components/WidgetContainer.d.ts +7 -6
- package/dist/common/components/globalaccountfilter/GlobalAccountFilterList.d.ts +7 -0
- package/dist/common/components/index.d.ts +2 -2
- package/dist/common/hooks/useAriaLive.d.ts +1 -1
- package/dist/common/index.es.js +459 -445
- package/dist/common/stores/AppDataStore.d.ts +3 -1
- package/dist/common/stores/GlobalCopyStore.d.ts +0 -1
- package/dist/common/stores/GlobalStore.d.ts +3 -3
- package/dist/common/stores/GlobalUiStore.d.ts +10 -6
- package/dist/common/stores/UserStore.d.ts +3 -2
- package/dist/common/types/Account.d.ts +9 -6
- package/dist/dashboard/index.es.js +84 -116
- package/dist/debts/index.es.js +417 -413
- package/dist/{exportTransactionsToCSV-BrTYdSgJ.mjs → exportTransactionsToCSV-DtQ7ovAR.mjs} +1 -1
- package/dist/finstrong/index.es.js +1167 -1110
- package/dist/goals/index.es.js +618 -598
- package/dist/goals/stores/GoalStore.d.ts +19 -4
- package/dist/help/index.es.js +13 -13
- package/dist/investments/index.es.js +330 -325
- package/dist/investments/stores/HoldingStore.d.ts +1 -0
- package/dist/networth/components/NetWorthChart.d.ts +3 -2
- package/dist/networth/components/NetWorthList.d.ts +3 -3
- package/dist/networth/index.es.js +423 -433
- package/dist/networth/stores/NetWorthStore.d.ts +20 -9
- package/dist/networth/utils/NetWorthUtils.d.ts +2 -2
- package/dist/notifications/index.es.js +90 -91
- package/dist/notifications/stores/NotificationStore.d.ts +3 -1
- package/dist/recurringtransactions/components/MicroWidgetContent.d.ts +3 -0
- package/dist/recurringtransactions/index.es.js +543 -562
- package/dist/recurringtransactions/stores/RecurringTransactionsStore.d.ts +4 -2
- package/dist/settings/index.es.js +253 -248
- package/dist/spending/index.es.js +282 -301
- package/dist/transactions/index.es.js +269 -263
- package/dist/transactions/stores/TransactionStore.d.ts +26 -77
- package/dist/transactions/stores/UiStore.d.ts +0 -2
- package/dist/trends/index.es.js +708 -699
- package/dist/{useAccountDisplayName-BTvP_pw6.mjs → useAccountDisplayName-Bot2tb4n.mjs} +1 -1
- package/package.json +3 -3
- package/dist/AccountStore-CWFzg8-E.mjs +0 -260
- package/dist/Accounts-CWt-NRq8.mjs +0 -9
- package/dist/CategoryUtil-DZflYFam.mjs +0 -78
- package/dist/ConnectDrawer-BOjfI6rz.mjs +0 -563
- package/dist/GoalStore-C7ahxxLi.mjs +0 -364
- package/dist/NetWorthStore-xWIo9CYU.mjs +0 -150
- package/dist/TransactionStore-DJwPaZuM.mjs +0 -677
- package/dist/WidgetContainer-CrK6tyHr.mjs +0 -572
- package/dist/common/components/accountfilter/AccountFilter.d.ts +0 -20
- package/dist/common/components/accountfilter/AccountFilterOptions.d.ts +0 -31
- package/dist/common/components/accountfilter/index.d.ts +0 -1
- package/dist/{ToggleListItem-ciFTiqRS.mjs → Notification-Bs1fdbzI.mjs} +1 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { makeAutoObservable as p } from "mobx";
|
|
2
|
+
import { A as m } from "./AccountApi-DgZ8ILj1.mjs";
|
|
3
|
+
import { format as B } from "date-fns/format";
|
|
4
|
+
import { fromUnixTime as W } from "date-fns/fromUnixTime";
|
|
5
|
+
import { startOfMonth as D } from "date-fns/startOfMonth";
|
|
6
|
+
import { subMonths as _ } from "date-fns/subMonths";
|
|
7
|
+
import { a as f } from "./Accounts-M-LTzStv.mjs";
|
|
8
|
+
import { e as L, a as M, f as v } from "./Account-BiB1F8lL.mjs";
|
|
9
|
+
const A = 13, I = (n, t) => n.filter((e) => {
|
|
10
|
+
const { is_closed: o, is_deleted: s, is_hidden: a, is_manual: c } = e;
|
|
11
|
+
return o || s || a ? !1 : c || !e.guid ? !0 : t.some((l) => n.some((u) => l.guid === u.member_guid));
|
|
12
|
+
}), N = (n, t) => [...n, ...t], g = (n) => {
|
|
13
|
+
if (n && n.length > 0)
|
|
14
|
+
return n[n.length - 1];
|
|
15
|
+
}, S = (n, t) => n.year_month - t.year_month, x = () => Array.from({ length: A }, (n, t) => Math.floor(D(_(/* @__PURE__ */ new Date(), t)).getTime() / 1e3)).sort(), T = (n, t, e) => !n.length || !t.length ? [] : x().reduceRight((s, a) => {
|
|
16
|
+
const c = t.filter(
|
|
17
|
+
({ year_month: r }) => r === parseInt(B(W(a), "yyyyMM"))
|
|
18
|
+
), l = n.map((r) => {
|
|
19
|
+
const i = c.find((h) => h.account_guid === r.guid), d = {
|
|
20
|
+
change: 0,
|
|
21
|
+
guid: r.guid,
|
|
22
|
+
name: r.name,
|
|
23
|
+
type: r.account_type,
|
|
24
|
+
balance: 0
|
|
25
|
+
};
|
|
26
|
+
if (!i && s.length === 0 && !r.balance) return d;
|
|
27
|
+
if (!i && s.length === 0)
|
|
28
|
+
return {
|
|
29
|
+
...d,
|
|
30
|
+
value: f(r) ? -(r.balance ?? 0) : r.balance ?? 0
|
|
31
|
+
};
|
|
32
|
+
if (!i) {
|
|
33
|
+
const h = s[0].accounts.find((b) => b.guid === r.guid);
|
|
34
|
+
return h || d;
|
|
35
|
+
}
|
|
36
|
+
return {
|
|
37
|
+
change: i.transaction_total,
|
|
38
|
+
guid: r.guid,
|
|
39
|
+
name: r.name,
|
|
40
|
+
type: r.account_type,
|
|
41
|
+
value: i.balance
|
|
42
|
+
};
|
|
43
|
+
}), { y: u, change: y } = l.reduce(
|
|
44
|
+
(r, i) => ({
|
|
45
|
+
y: r.y + (i.value || 0),
|
|
46
|
+
change: r.change + (i.change || 0)
|
|
47
|
+
}),
|
|
48
|
+
{ y: 0, change: 0 }
|
|
49
|
+
);
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
accounts: l,
|
|
53
|
+
x: a,
|
|
54
|
+
y: u,
|
|
55
|
+
change: y
|
|
56
|
+
},
|
|
57
|
+
...s
|
|
58
|
+
];
|
|
59
|
+
}, []).slice(A - e), C = (n) => {
|
|
60
|
+
const t = [], e = [];
|
|
61
|
+
let o = 0, s = 0;
|
|
62
|
+
return n?.accounts.forEach((a) => {
|
|
63
|
+
a.change > 0 && (t.push({ accountName: a.name, gain: a.change }), o += a.change), a.change < 0 && (e.push({ accountName: a.name, loss: a.change }), s += a.change);
|
|
64
|
+
}), { netWorth: n, gains: t, losses: e, totalGains: o, totalLosses: s };
|
|
65
|
+
}, w = (n) => {
|
|
66
|
+
const t = [], e = [];
|
|
67
|
+
let o = 0, s = 0;
|
|
68
|
+
return n.forEach((a) => {
|
|
69
|
+
if (f(a)) {
|
|
70
|
+
const c = a.balance ?? 0;
|
|
71
|
+
e.push({ accountName: a.name, accountType: a.account_type, balance: c }), s += c;
|
|
72
|
+
} else {
|
|
73
|
+
const c = a.balance ?? 0;
|
|
74
|
+
t.push({ accountName: a.name, accountType: a.account_type, balance: c }), o += c;
|
|
75
|
+
}
|
|
76
|
+
}), { assets: t, liabilities: e, totalAssets: o, totalLiabilities: s };
|
|
77
|
+
}, z = (n) => {
|
|
78
|
+
const t = n.reduce((e, o) => {
|
|
79
|
+
const s = o.accountType;
|
|
80
|
+
return e[s] || (e[s] = []), e[s].push(o), e;
|
|
81
|
+
}, {});
|
|
82
|
+
return Object.entries(t).map(([e, o]) => ({
|
|
83
|
+
icon: L[+e] || M[+e],
|
|
84
|
+
name: v[+e],
|
|
85
|
+
accounts: o
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
class P {
|
|
89
|
+
globalStore;
|
|
90
|
+
accountsApi = new m("/", "");
|
|
91
|
+
monthlyAccountBalances = [];
|
|
92
|
+
monthlyAccountBalancesLoaded = !1;
|
|
93
|
+
hoveredIndex = -1;
|
|
94
|
+
selectedIndex = -1;
|
|
95
|
+
timeframe = 6;
|
|
96
|
+
// default timeframe is 6 months
|
|
97
|
+
constructor(t) {
|
|
98
|
+
this.globalStore = t, this.accountsApi = new m(
|
|
99
|
+
t.endpoint,
|
|
100
|
+
t.sessionToken,
|
|
101
|
+
t.onError
|
|
102
|
+
), p(this);
|
|
103
|
+
}
|
|
104
|
+
get isNetWorthDataLoaded() {
|
|
105
|
+
return this.globalStore.accountStore.isAccountDataLoaded && this.monthlyAccountBalancesLoaded;
|
|
106
|
+
}
|
|
107
|
+
get netWorthAccounts() {
|
|
108
|
+
return I(
|
|
109
|
+
this.globalStore.globalUiStore.selectedAccounts,
|
|
110
|
+
this.globalStore.accountStore.members
|
|
111
|
+
);
|
|
112
|
+
}
|
|
113
|
+
get netWorthData() {
|
|
114
|
+
return {
|
|
115
|
+
accounts: this.netWorthAccounts,
|
|
116
|
+
monthlyAccountBalances: this.monthlyAccountBalances
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
get netWorthChartData() {
|
|
120
|
+
return T(this.netWorthAccounts, this.monthlyAccountBalances, this.timeframe);
|
|
121
|
+
}
|
|
122
|
+
get selectedData() {
|
|
123
|
+
if (!(!this.netWorthChartData || this.netWorthChartData.length === 0))
|
|
124
|
+
return this.selectedIndex === -1 ? g(this.netWorthChartData) : this.netWorthChartData[this.selectedIndex];
|
|
125
|
+
}
|
|
126
|
+
get hoveredData() {
|
|
127
|
+
return this.hoveredIndex >= 0 ? this.netWorthChartData[this.hoveredIndex] : void 0;
|
|
128
|
+
}
|
|
129
|
+
get gainsLosses() {
|
|
130
|
+
return C(this.selectedData);
|
|
131
|
+
}
|
|
132
|
+
get assetsLiabilities() {
|
|
133
|
+
const { assets: t, liabilities: e, totalAssets: o, totalLiabilities: s } = w(
|
|
134
|
+
this.netWorthData.accounts
|
|
135
|
+
);
|
|
136
|
+
return {
|
|
137
|
+
netWorth: g(this.netWorthChartData),
|
|
138
|
+
assets: t,
|
|
139
|
+
liabilities: e,
|
|
140
|
+
totalAssets: o,
|
|
141
|
+
totalLiabilities: s
|
|
142
|
+
};
|
|
143
|
+
}
|
|
144
|
+
loadNetWorthData = async () => {
|
|
145
|
+
this.globalStore.accountStore.isAccountDataLoaded || await this.globalStore.accountStore.loadAccountData();
|
|
146
|
+
const e = (await Promise.all(
|
|
147
|
+
this.netWorthAccounts.map((o) => this.getMonthlyAccountBalances(o.guid))
|
|
148
|
+
)).reduce(N, []).sort(S);
|
|
149
|
+
this.setMonthlyAccountBalances(e);
|
|
150
|
+
};
|
|
151
|
+
getMonthlyAccountBalances = async (t) => {
|
|
152
|
+
try {
|
|
153
|
+
return await this.accountsApi.getMonthlyAccountBalances(t);
|
|
154
|
+
} catch (e) {
|
|
155
|
+
return console.error(`Error occured while fetching monthly account balances: ${e}`), [];
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
setHoveredIndex = (t) => this.hoveredIndex = t;
|
|
159
|
+
setMonthlyAccountBalances = (t) => {
|
|
160
|
+
this.monthlyAccountBalances = t, this.monthlyAccountBalancesLoaded = !0;
|
|
161
|
+
};
|
|
162
|
+
setSelectedIndex = (t) => this.selectedIndex = t;
|
|
163
|
+
setTimeframe = (t) => this.timeframe = t;
|
|
164
|
+
}
|
|
165
|
+
export {
|
|
166
|
+
P as N,
|
|
167
|
+
z as g
|
|
168
|
+
};
|