@mx-cartographer/experiences 9.4.29-alpha.al0 → 9.4.29
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 +9 -0
- package/dist/core/api/AccountApi.d.ts +2 -3
- package/dist/core/api/AccountApi.es.js +0 -1
- package/dist/core/api/AccountApi.es.js.map +1 -1
- package/dist/core/stores/NetWorthStore.d.ts +0 -3
- package/dist/core/stores/NetWorthStore.es.js +18 -30
- package/dist/core/stores/NetWorthStore.es.js.map +1 -1
- package/dist/core/types/Account.d.ts +0 -10
- package/dist/core/types/Account.es.js.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/core/types/localization/InvestmentsCopy.d.ts +1 -1
- package/dist/core/utils/NetWorthUtils.d.ts +1 -2
- package/dist/core/utils/NetWorthUtils.es.js +46 -58
- package/dist/core/utils/NetWorthUtils.es.js.map +1 -1
- package/dist/investments/components/allocation/InvestmentsAllocationChart.es.js +22 -23
- package/dist/investments/components/allocation/InvestmentsAllocationChart.es.js.map +1 -1
- package/dist/investments/components/allocation/util/createInvestementsAllocationData.es.js +85 -58
- package/dist/investments/components/allocation/util/createInvestementsAllocationData.es.js.map +1 -1
- package/dist/rum/rum.es.js +13 -9
- package/dist/rum/rum.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
## [9.4.29] - 09-17-2026
|
|
2
|
+
|
|
3
|
+
- **FIXED** - Investments Allocation donut misrepresented holdings with no Morningstar asset-class data as ~100% cash, because the ring's denominator was the sum of buckets-with-data instead of total portfolio value. The ring now uses total portfolio value and surfaces the gap as an explicit "Unclassified" slice (expandable into its real holdings), so ring, center total, and legend agree
|
|
4
|
+
- **FIXED** - The Allocation donut center no longer shows a dead "Click for details" prompt on a selected slice (it had no handler and the holdings already expand in the legend); it now shows the selected slice's share of the portfolio
|
|
5
|
+
|
|
6
|
+
## [9.4.28] - 09-16-2026
|
|
7
|
+
|
|
8
|
+
- **FIXED** - RUM `beforeSend` no longer drops the page's own `document` resource event (MEW-4052)
|
|
9
|
+
|
|
1
10
|
## [9.4.27] - 09-16-2026
|
|
2
11
|
|
|
3
12
|
- **FIXED** - Insights V2 `FeeDetected` and `LargeTransaction` CTAs opened the "Something went wrong" drawer instead of the transaction. [ditto!19](https://gitlab.com/mxtechnologies/mx/experiences/projects/ditto/-/merge_requests/19) renamed `primary_cta_block` from `view_charge` to `transaction_details`, naming the block for the drilldown it opens rather than the button copy (which tupac owns and can change). Neither name was registered here — `actionBlocksKey.TRANSACTION_DETAILS_ACTION_BLOCK` carried `TransactionDetailsBlock`, a name no backend ever sent. `ActionBlockLayer` resolves the CTA by exact match and `hasDrawerBlock()` returns true for any non-empty string, so an unregistered name opens the drawer onto the error state rather than failing silently. Points the registry key at the name ditto now sends, and updates the `FeeDetected`/`LargeTransaction` mock payloads to match. No alias is kept for `view_charge`: ditto no longer sends it and it was never registered (MEW2-3254)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Fetch } from '../utils';
|
|
2
|
-
import { Account, GlobalErrorHandler
|
|
2
|
+
import { Account, GlobalErrorHandler } from '..';
|
|
3
3
|
export declare class AccountApi {
|
|
4
4
|
fetchInstance: Fetch;
|
|
5
5
|
constructor(endpoint: string, token: string, onError?: GlobalErrorHandler);
|
|
@@ -8,8 +8,7 @@ export declare class AccountApi {
|
|
|
8
8
|
getAccounts: () => Promise<any>;
|
|
9
9
|
getInstitutions: () => Promise<any>;
|
|
10
10
|
getMembers: () => Promise<any>;
|
|
11
|
-
|
|
12
|
-
getMonthlyAccountBalances: (guid: string) => Promise<MonthlyAccountBalance[]>;
|
|
11
|
+
getMonthlyAccountBalances: (guid: string) => Promise<any>;
|
|
13
12
|
mergeAccounts: (accountGuids: string[]) => Promise<any>;
|
|
14
13
|
refreshAllMembers: () => Promise<any>;
|
|
15
14
|
updateAccount: (account: Account) => Promise<any>;
|
|
@@ -10,7 +10,6 @@ var h = class {
|
|
|
10
10
|
getAccounts = async () => this.fetchInstance.get(n.ACCOUNTS).then((t) => t.accounts);
|
|
11
11
|
getInstitutions = async () => this.fetchInstance.get(n.INSTITUTIONS).then((t) => t);
|
|
12
12
|
getMembers = async () => this.fetchInstance.get(n.MEMBERS).then((t) => t.members);
|
|
13
|
-
getHistoricalAccountBalances = async (t) => this.fetchInstance.get(`${n.ACCOUNTS}/${t}/historical_account_balances`).then((e) => e.historical_account_balances);
|
|
14
13
|
getMonthlyAccountBalances = async (t) => this.fetchInstance.get(`${n.ACCOUNTS}/${t}/monthly_account_balances`).then((e) => e.monthly_account_balances);
|
|
15
14
|
mergeAccounts = async (t) => this.fetchInstance.put(`${n.ACCOUNTS}/merge`, { accounts: t }).then((e) => e);
|
|
16
15
|
refreshAllMembers = async () => this.fetchInstance.get(`${n.MEMBERS}/refresh_all`).then((t) => t);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountApi.es.js","names":[],"sources":["../../../src/core/api/AccountApi.ts"],"sourcesContent":["import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type {
|
|
1
|
+
{"version":3,"file":"AccountApi.es.js","names":[],"sources":["../../../src/core/api/AccountApi.ts"],"sourcesContent":["import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type { Account, GlobalErrorHandler } from '..'\n\nexport class AccountApi {\n fetchInstance: Fetch\n\n constructor(endpoint: string, token: string, onError?: GlobalErrorHandler) {\n this.fetchInstance = new Fetch(endpoint, token, undefined, onError)\n }\n\n createAccount = async (account: Account) => {\n return this.fetchInstance.post(ApiEndpoints.ACCOUNTS, account).then((data) => data.account)\n }\n\n deleteAccount = async (accountGuid: string) => {\n return this.fetchInstance.delete(`${ApiEndpoints.ACCOUNTS}/${accountGuid}`)\n }\n\n getAccounts = async () => {\n return this.fetchInstance.get(ApiEndpoints.ACCOUNTS).then((data) => data.accounts)\n }\n\n getInstitutions = async () => {\n return this.fetchInstance.get(ApiEndpoints.INSTITUTIONS).then((data) => data)\n }\n\n getMembers = async () => {\n return this.fetchInstance.get(ApiEndpoints.MEMBERS).then((data) => data.members)\n }\n\n getMonthlyAccountBalances = async (guid: string) => {\n return this.fetchInstance\n .get(`${ApiEndpoints.ACCOUNTS}/${guid}/monthly_account_balances`)\n .then((data) => data.monthly_account_balances)\n }\n\n mergeAccounts = async (accountGuids: string[]) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.ACCOUNTS}/merge`, { accounts: accountGuids })\n .then((data) => data)\n }\n\n refreshAllMembers = async () => {\n return this.fetchInstance.get(`${ApiEndpoints.MEMBERS}/refresh_all`).then((data) => data)\n }\n\n updateAccount = async (account: Account) => {\n return this.fetchInstance\n .put(`${ApiEndpoints.ACCOUNTS}/${account.guid}`, account)\n .then((data) => data.account)\n }\n}\n"],"mappings":";;AAIA,IAAa,IAAb,MAAwB;AAAA,EACtB;AAAA,EAEA,YAAY,GAAkB,GAAe,GAA8B;AACzE,SAAK,gBAAgB,IAAI,EAAM,GAAU,GAAO,QAAW,CAAO;AAAA,EACpE;AAAA,EAEA,gBAAgB,OAAO,MACd,KAAK,cAAc,KAAK,EAAa,UAAU,CAAO,EAAE,KAAA,CAAM,MAAS,EAAK,OAAO;AAAA,EAG5F,gBAAgB,OAAO,MACd,KAAK,cAAc,OAAO,GAAG,EAAa,QAAA,IAAY,CAAA,EAAa;AAAA,EAG5E,cAAc,YACL,KAAK,cAAc,IAAI,EAAa,QAAQ,EAAE,KAAA,CAAM,MAAS,EAAK,QAAQ;AAAA,EAGnF,kBAAkB,YACT,KAAK,cAAc,IAAI,EAAa,YAAY,EAAE,KAAA,CAAM,MAAS,CAAI;AAAA,EAG9E,aAAa,YACJ,KAAK,cAAc,IAAI,EAAa,OAAO,EAAE,KAAA,CAAM,MAAS,EAAK,OAAO;AAAA,EAGjF,4BAA4B,OAAO,MAC1B,KAAK,cACT,IAAI,GAAG,EAAa,QAAA,IAAY,CAAA,2BAA+B,EAC/D,KAAA,CAAM,MAAS,EAAK,wBAAwB;AAAA,EAGjD,gBAAgB,OAAO,MACd,KAAK,cACT,IAAI,GAAG,EAAa,QAAA,UAAkB,EAAE,UAAU,EAAa,CAAC,EAChE,KAAA,CAAM,MAAS,CAAI;AAAA,EAGxB,oBAAoB,YACX,KAAK,cAAc,IAAI,GAAG,EAAa,OAAA,cAAqB,EAAE,KAAA,CAAM,MAAS,CAAI;AAAA,EAG1F,gBAAgB,OAAO,MACd,KAAK,cACT,IAAI,GAAG,EAAa,QAAA,IAAY,EAAQ,IAAA,IAAQ,CAAO,EACvD,KAAA,CAAM,MAAS,EAAK,OAAO;AAElC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { AccountApi } from '../api';
|
|
2
2
|
import { AssetsLiabilities, DetailedAccount, GainsLosses, MonthlyAccountBalance, NetWorth, NetWorthData } from '../types';
|
|
3
3
|
import { GlobalStore } from './GlobalStore';
|
|
4
|
-
export declare const HISTORICAL_ACCOUNT_BALANCES = "Historical account balances";
|
|
5
4
|
export declare class NetWorthStore {
|
|
6
5
|
globalStore: GlobalStore;
|
|
7
6
|
accountsApi: AccountApi;
|
|
@@ -18,11 +17,9 @@ export declare class NetWorthStore {
|
|
|
18
17
|
get selectedData(): NetWorth | undefined;
|
|
19
18
|
get hoveredData(): NetWorth | undefined;
|
|
20
19
|
get gainsLosses(): GainsLosses;
|
|
21
|
-
get isHistoricalBalancesEnabled(): boolean;
|
|
22
20
|
get assetsLiabilities(): AssetsLiabilities;
|
|
23
21
|
loadNetWorthData: () => Promise<void>;
|
|
24
22
|
getMonthlyAccountBalances: (accountGuid: string) => Promise<MonthlyAccountBalance[]>;
|
|
25
|
-
getHistoricalAccountBalances: (accountGuid: string) => Promise<MonthlyAccountBalance[]>;
|
|
26
23
|
setHoveredIndex: (index: number) => number;
|
|
27
24
|
setMonthlyAccountBalances: (balances: MonthlyAccountBalance[]) => void;
|
|
28
25
|
setSelectedIndex: (index: number) => number;
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { AccountApi as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
var m = "Historical account balances", W = class {
|
|
1
|
+
import { AccountApi as a } from "../api/AccountApi.es.js";
|
|
2
|
+
import { buildAssetsLiabilities as c, buildChartData as r, buildGainsLosses as h, filterAccounts as i, flattenBalances as l, getLatestNetWorthData as o, sortByYearMonthAscending as u } from "../utils/NetWorthUtils.es.js";
|
|
3
|
+
import { makeAutoObservable as d } from "mobx";
|
|
4
|
+
var y = class {
|
|
6
5
|
globalStore;
|
|
7
|
-
accountsApi = new
|
|
6
|
+
accountsApi = new a("/", "");
|
|
8
7
|
monthlyAccountBalances = [];
|
|
9
8
|
monthlyAccountBalancesLoaded = !1;
|
|
10
9
|
hoveredIndex = -1;
|
|
11
10
|
selectedIndex = -1;
|
|
12
11
|
timeframe = 6;
|
|
13
12
|
constructor(t) {
|
|
14
|
-
this.globalStore = t, this.accountsApi = new
|
|
13
|
+
this.globalStore = t, this.accountsApi = new a(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
15
14
|
}
|
|
16
15
|
get isNetWorthDataLoaded() {
|
|
17
16
|
return this.globalStore.accountStore.isAccountDataLoaded && this.monthlyAccountBalancesLoaded;
|
|
18
17
|
}
|
|
19
18
|
get netWorthAccounts() {
|
|
20
|
-
return
|
|
19
|
+
return i(this.globalStore.globalUiStore.selectedAccounts, this.globalStore.accountStore.members);
|
|
21
20
|
}
|
|
22
21
|
get netWorthData() {
|
|
23
22
|
return {
|
|
@@ -26,35 +25,32 @@ var m = "Historical account balances", W = class {
|
|
|
26
25
|
};
|
|
27
26
|
}
|
|
28
27
|
get netWorthChartData() {
|
|
29
|
-
return
|
|
28
|
+
return r(this.netWorthAccounts, this.monthlyAccountBalances, this.timeframe);
|
|
30
29
|
}
|
|
31
30
|
get selectedData() {
|
|
32
31
|
if (!(!this.netWorthChartData || this.netWorthChartData.length === 0))
|
|
33
|
-
return this.selectedIndex === -1 ?
|
|
32
|
+
return this.selectedIndex === -1 ? o(this.netWorthChartData) : this.netWorthChartData[this.selectedIndex];
|
|
34
33
|
}
|
|
35
34
|
get hoveredData() {
|
|
36
35
|
return this.hoveredIndex >= 0 ? this.netWorthChartData[this.hoveredIndex] : void 0;
|
|
37
36
|
}
|
|
38
37
|
get gainsLosses() {
|
|
39
|
-
return
|
|
40
|
-
}
|
|
41
|
-
get isHistoricalBalancesEnabled() {
|
|
42
|
-
return c(this.globalStore.userStore.userFeatures, m);
|
|
38
|
+
return h(this.selectedData);
|
|
43
39
|
}
|
|
44
40
|
get assetsLiabilities() {
|
|
45
|
-
const { assets: t, liabilities: e, totalAssets:
|
|
41
|
+
const { assets: t, liabilities: e, totalAssets: n, totalLiabilities: s } = c(this.netWorthData.accounts);
|
|
46
42
|
return {
|
|
47
|
-
netWorth:
|
|
43
|
+
netWorth: o(this.netWorthChartData),
|
|
48
44
|
assets: t,
|
|
49
45
|
liabilities: e,
|
|
50
|
-
totalAssets:
|
|
51
|
-
totalLiabilities:
|
|
46
|
+
totalAssets: n,
|
|
47
|
+
totalLiabilities: s
|
|
52
48
|
};
|
|
53
49
|
}
|
|
54
50
|
loadNetWorthData = async () => {
|
|
55
|
-
this.globalStore.accountStore.isAccountDataLoaded || await this.globalStore.accountStore.loadAccountData()
|
|
56
|
-
const t =
|
|
57
|
-
this.setMonthlyAccountBalances(
|
|
51
|
+
this.globalStore.accountStore.isAccountDataLoaded || await this.globalStore.accountStore.loadAccountData();
|
|
52
|
+
const t = (await Promise.all(this.netWorthAccounts.map((e) => this.getMonthlyAccountBalances(e.guid)))).reduce(l, []).sort(u);
|
|
53
|
+
this.setMonthlyAccountBalances(t);
|
|
58
54
|
};
|
|
59
55
|
getMonthlyAccountBalances = async (t) => {
|
|
60
56
|
try {
|
|
@@ -63,13 +59,6 @@ var m = "Historical account balances", W = class {
|
|
|
63
59
|
return console.error("Error occurred while fetching monthly account balances:", e), this.globalStore.captureException(e, { store: "NetWorthStore" }), [];
|
|
64
60
|
}
|
|
65
61
|
};
|
|
66
|
-
getHistoricalAccountBalances = async (t) => {
|
|
67
|
-
try {
|
|
68
|
-
return (await this.accountsApi.getHistoricalAccountBalances(t)).map(A);
|
|
69
|
-
} catch (e) {
|
|
70
|
-
return console.error("Error occurred while fetching historical account balances:", e), this.globalStore.captureException(e, { store: "NetWorthStore" }), [];
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
62
|
setHoveredIndex = (t) => this.hoveredIndex = t;
|
|
74
63
|
setMonthlyAccountBalances = (t) => {
|
|
75
64
|
this.monthlyAccountBalances = t, this.monthlyAccountBalancesLoaded = !0;
|
|
@@ -78,8 +67,7 @@ var m = "Historical account balances", W = class {
|
|
|
78
67
|
setTimeframe = (t) => this.timeframe = t;
|
|
79
68
|
};
|
|
80
69
|
export {
|
|
81
|
-
|
|
82
|
-
W as NetWorthStore
|
|
70
|
+
y as NetWorthStore
|
|
83
71
|
};
|
|
84
72
|
|
|
85
73
|
//# sourceMappingURL=NetWorthStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetWorthStore.es.js","names":[],"sources":["../../../src/core/stores/NetWorthStore.ts"],"sourcesContent":["import { makeAutoObservable } from 'mobx'\n\nimport { AccountApi } from '../api'\nimport type {\n Account,\n AssetsLiabilities,\n DetailedAccount,\n GainsLosses,\n
|
|
1
|
+
{"version":3,"file":"NetWorthStore.es.js","names":[],"sources":["../../../src/core/stores/NetWorthStore.ts"],"sourcesContent":["import { makeAutoObservable } from 'mobx'\n\nimport { AccountApi } from '../api'\nimport type {\n Account,\n AssetsLiabilities,\n DetailedAccount,\n GainsLosses,\n MonthlyAccountBalance,\n NetWorth,\n NetWorthData,\n} from '../types'\nimport {\n filterAccounts,\n flattenBalances,\n buildAssetsLiabilities,\n buildChartData,\n buildGainsLosses,\n getLatestNetWorthData,\n sortByYearMonthAscending,\n} from '../utils/NetWorthUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class NetWorthStore {\n globalStore: GlobalStore\n accountsApi: AccountApi = new AccountApi('/', '')\n\n monthlyAccountBalances: MonthlyAccountBalance[] = []\n monthlyAccountBalancesLoaded: boolean = false\n hoveredIndex: number = -1\n selectedIndex: number = -1\n timeframe: number = 6 // default timeframe is 6 months\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.accountsApi = new AccountApi(\n globalStore.endpoint,\n globalStore.sessionToken,\n globalStore.onError,\n )\n makeAutoObservable(this)\n }\n\n get isNetWorthDataLoaded(): boolean {\n return this.globalStore.accountStore.isAccountDataLoaded && this.monthlyAccountBalancesLoaded\n }\n\n get netWorthAccounts(): DetailedAccount[] {\n return filterAccounts(\n this.globalStore.globalUiStore.selectedAccounts,\n this.globalStore.accountStore.members,\n )\n }\n\n get netWorthData(): NetWorthData {\n return {\n accounts: this.netWorthAccounts,\n monthlyAccountBalances: this.monthlyAccountBalances,\n }\n }\n\n get netWorthChartData(): NetWorth[] {\n return buildChartData(this.netWorthAccounts, this.monthlyAccountBalances, this.timeframe)\n }\n\n get selectedData(): NetWorth | undefined {\n if (!this.netWorthChartData || this.netWorthChartData.length === 0) return undefined\n return this.selectedIndex === -1\n ? getLatestNetWorthData(this.netWorthChartData)\n : this.netWorthChartData[this.selectedIndex]\n }\n\n get hoveredData(): NetWorth | undefined {\n return this.hoveredIndex >= 0 ? this.netWorthChartData[this.hoveredIndex] : undefined\n }\n\n get gainsLosses(): GainsLosses {\n return buildGainsLosses(this.selectedData)\n }\n\n get assetsLiabilities(): AssetsLiabilities {\n const { assets, liabilities, totalAssets, totalLiabilities } = buildAssetsLiabilities(\n this.netWorthData.accounts,\n )\n return {\n netWorth: getLatestNetWorthData(this.netWorthChartData),\n assets,\n liabilities,\n totalAssets,\n totalLiabilities,\n }\n }\n\n loadNetWorthData = async () => {\n if (!this.globalStore.accountStore.isAccountDataLoaded) {\n await this.globalStore.accountStore.loadAccountData()\n }\n\n const accountBalances = await Promise.all(\n this.netWorthAccounts.map((account: Account) => this.getMonthlyAccountBalances(account.guid)),\n )\n\n const monthlyAccountBalances = accountBalances\n .reduce(flattenBalances, [])\n .sort(sortByYearMonthAscending)\n\n this.setMonthlyAccountBalances(monthlyAccountBalances)\n }\n\n getMonthlyAccountBalances = async (accountGuid: string) => {\n try {\n const balances = await this.accountsApi.getMonthlyAccountBalances(accountGuid)\n return balances as MonthlyAccountBalance[]\n } catch (error) {\n console.error('Error occurred while fetching monthly account balances:', error)\n this.globalStore.captureException(error, { store: 'NetWorthStore' })\n return []\n }\n }\n\n setHoveredIndex = (index: number) => (this.hoveredIndex = index)\n\n setMonthlyAccountBalances = (balances: MonthlyAccountBalance[]) => {\n this.monthlyAccountBalances = balances\n this.monthlyAccountBalancesLoaded = true\n }\n\n setSelectedIndex = (index: number) => (this.selectedIndex = index)\n setTimeframe = (months: number) => (this.timeframe = months)\n}\n"],"mappings":";;;AAwBA,IAAa,IAAb,MAA2B;AAAA,EACzB;AAAA,EACA,cAA0B,IAAI,EAAW,KAAK,EAAE;AAAA,EAEhD,yBAAkD,CAAC;AAAA,EACnD,+BAAwC;AAAA,EACxC,eAAuB;AAAA,EACvB,gBAAwB;AAAA,EACxB,YAAoB;AAAA,EAEpB,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,cAAc,IAAI,EACrB,EAAY,UACZ,EAAY,cACZ,EAAY,OACd,GACA,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,IAAI,uBAAgC;AAClC,WAAO,KAAK,YAAY,aAAa,uBAAuB,KAAK;AAAA,EACnE;AAAA,EAEA,IAAI,mBAAsC;AACxC,WAAO,EACL,KAAK,YAAY,cAAc,kBAC/B,KAAK,YAAY,aAAa,OAChC;AAAA,EACF;AAAA,EAEA,IAAI,eAA6B;AAC/B,WAAO;AAAA,MACL,UAAU,KAAK;AAAA,MACf,wBAAwB,KAAK;AAAA,IAC/B;AAAA,EACF;AAAA,EAEA,IAAI,oBAAgC;AAClC,WAAO,EAAe,KAAK,kBAAkB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CAAmB,MAAmB,KAAK,eAAe;AAAA,EAE1D,4BAAA,CAA6B,MAAsC;AACjE,SAAK,yBAAyB,GAC9B,KAAK,+BAA+B;AAAA,EACtC;AAAA,EAEA,mBAAA,CAAoB,MAAmB,KAAK,gBAAgB;AAAA,EAC5D,eAAA,CAAgB,MAAoB,KAAK,YAAY;AACvD"}
|
|
@@ -115,16 +115,6 @@ export interface MonthlyAccountBalance {
|
|
|
115
115
|
year: number;
|
|
116
116
|
year_month: number;
|
|
117
117
|
}
|
|
118
|
-
export interface HistoricalAccountBalance {
|
|
119
|
-
account_guid: string;
|
|
120
|
-
balance: number;
|
|
121
|
-
guid: string;
|
|
122
|
-
month: number;
|
|
123
|
-
transaction_total: number | null;
|
|
124
|
-
user_guid: string;
|
|
125
|
-
year: number;
|
|
126
|
-
year_month: number;
|
|
127
|
-
}
|
|
128
118
|
export declare enum AccountType {
|
|
129
119
|
ANY = 0,
|
|
130
120
|
CHECKING = 1,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Account.es.js","names":[],"sources":["../../../src/core/types/Account.ts"],"sourcesContent":["import { type Institution } from './Institution'\n\nexport interface Account {\n account_number?: string\n account_subtype?: AccountSubType\n account_type: AccountType\n apr?: number\n apy?: number\n available_balance?: number\n balance?: number\n balance_updated_at?: number\n cash_balance?: number\n credit_limit?: number\n current_balance?: number\n currency_code?: string\n day_payment_is_due?: number\n display_order?: number\n external_guid?: string\n feed_account_type?: number\n feed_apr?: number\n feed_apy?: number\n feed_credit_limit?: number\n feed_day_payment_is_due?: number\n feed_interest_rate?: number\n feed_is_closed?: boolean\n feed_localized_name?: string\n feed_name?: string\n feed_nickname?: string\n feed_original_balance?: number\n flags?: number\n guid: string\n institution_guid?: string\n interest_rate?: number\n interest_rate_set_by?: number\n interestRate?: number\n is_closed: boolean\n is_deleted: boolean\n is_excluded_from_accounts: boolean\n is_excluded_from_budgets: boolean\n is_excluded_from_cash_flow: boolean\n is_excluded_from_debts: boolean\n is_excluded_from_goals: boolean\n is_excluded_from_investments: boolean\n is_excluded_from_net_worth: boolean\n is_excluded_from_spending: boolean\n is_excluded_from_transactions: boolean\n is_excluded_from_trends: boolean\n is_hidden: boolean\n is_manual: boolean\n is_personal: boolean\n localized_name?: string\n member_guid?: string\n member_is_managed_by_user: boolean\n metadata?: string\n minimum_payment?: number\n name?: string\n nickname?: string\n original_balance?: number\n payment_due_at?: number\n pending_balance?: number\n property_type?: PropertyType\n revision?: number\n updated_at?: number\n user_guid?: string\n user_name?: string\n\n // TODO: STORE_REFACTOR Remove fields after switch to Detailed Accounts\n memberName?: string\n connectionStatus?: ConnectionStatus\n displayName?: string\n trucatedDisplayName?: string\n institutionName?: string\n}\n\nexport interface DetailedAccount extends Account {\n connectionStatus?: ConnectionStatus\n displayName?: string\n institutionName?: string // TODO: STORE_REFACTOR - Remove after all move to displayName\n member?: Member\n monthlyBalances?: MonthlyAccountBalance[]\n institution?: Institution\n}\n\nexport interface Member {\n aggregation_status: number\n connection_status: ConnectionStatusEnums\n guid: string\n institution_guid: string\n institution_name?: string\n institution_url?: string\n is_being_aggregated: boolean\n is_manual: boolean\n is_managed_by_user: boolean\n is_oauth: boolean\n last_job_guid?: string\n last_job_status?: string\n last_update_time?: number\n metadata?: string\n mfa: any\n most_recent_job_guid?: string\n needs_updated_credentials: boolean\n name: string\n process_status?: number\n revision: number\n user_guid: string\n oauth_window_uri?: string\n verification_is_enabled: boolean\n tax_statement_is_enabled: boolean\n successfully_aggregated_at?: number\n}\n\nexport interface MonthlyAccountBalance {\n account_guid: string\n balance: number\n credit_transaction_total: number\n debit_transaction_total: number\n id: string\n month: number\n transaction_total: number\n user_guid: string\n year: number\n year_month: number\n}\n\nexport interface HistoricalAccountBalance {\n account_guid: string\n balance: number\n guid: string\n month: number\n transaction_total: number | null\n user_guid: string\n year: number\n year_month: number\n}\n\nexport enum AccountType {\n ANY = 0,\n CHECKING = 1,\n SAVINGS = 2,\n LOAN = 3,\n CREDIT_CARD = 4,\n INVESTMENT = 5,\n LINE_OF_CREDIT = 6,\n MORTGAGE = 7,\n PROPERTY = 8,\n CASH = 9,\n INSURANCE = 10,\n PREPAID = 11,\n CHECKING_LINE_OF_CREDIT = 12,\n DIGITAL_WALLET = 13,\n}\n\nexport enum AccountSubType {\n NONE = 0,\n MONEY_MARKET = 1,\n CERTIFICATE_OF_DEPOSIT = 2,\n AUTO = 3,\n STUDENT = 4,\n SMALL_BUSINESS = 5,\n PERSONAL = 6,\n PERSONAL_WITH_COLLATERAL = 7,\n HOME_EQUITY = 8,\n PLAN_401_K = 9,\n PLAN_403_B = 10,\n PLAN_529 = 11,\n IRA = 12,\n ROLLOVER_IRA = 13,\n ROTH_IRA = 14,\n TAXABLE = 15,\n NON_TAXABLE = 16,\n BROKERAGE = 17,\n TRUST = 18,\n UNIFORM_GIFTS_TO_MINORS_ACT = 19,\n PLAN_457 = 20,\n PENSION = 21,\n EMPLOYEE_STOCK_OWNERSHIP_PLAN = 22,\n SIMPLIFIED_EMPLOYEE_PENSION = 23,\n SIMPLE_IRA = 24,\n BOAT = 25,\n POWERSPORTS = 26,\n RV = 27,\n HELOC = 28,\n PLAN_ROTH_401_K = 29,\n FIXED_ANNUITY = 30,\n VARIABLE_ANNUITY = 31,\n VEHICLE_INSURANCE = 32,\n DISABILITY = 33,\n HEALTH = 34,\n LONG_TERM_CARE = 35,\n PROPERTY_AND_CASUALTY = 36,\n UNIVERSAL_LIFE = 37,\n TERM_LIFE = 38,\n WHOLE_LIFE = 39,\n ACCIDENTAL_DEATH_AND_DISMEMBERMENT = 40,\n VARIABLE_UNIVERSAL_LIFE = 41,\n HSA = 42,\n TAX_FREE_SAVINGS_ACCOUNT = 43,\n INDIVIDUAL = 44,\n REGISTERED_RETIREMENT_INCOME_FUND = 45,\n CASH_MANAGEMENT_ACCOUNT = 46,\n EMPLOYEE_STOCK_PURCHASE_PLAN = 47,\n REGISTERED_EDUCATION_SAVINGS_PLAN = 48,\n PROFIT_SHARING_PLAN = 49,\n UNIFORM_TRANSFER_TO_MINORS_ACT = 50,\n PLAN_401_A = 51,\n SARSEP_IRA = 52,\n FIXED_ANNUITY_TRADITIONAL_IRA = 53,\n VARIABLE_ANNUITY_TRADITIONAL_IRA = 54,\n SEPP_IRA = 55,\n INHERITED_TRADITIONAL_IRA = 56,\n FIXED_ANNUITY_ROTH_IRA = 57,\n VARIABLE_ANNUITY_ROTH_IRA = 58,\n INHERITED_ROTH_IRA = 59,\n COVERDELL = 60,\n ADVISORY_ACCOUNT = 61,\n BROKERAGE_MARGIN = 62,\n CHARITABLE_GIFT_ACCOUNT = 63,\n CHURCH_ACCOUNT = 64,\n CONSERVATORSHIP = 65,\n CUSTODIAL = 66,\n DEFINED_BENEFIT_PLAN = 67,\n DEFINED_CONTRIBUTION_PLAN = 68,\n EDUCATIONAL = 69,\n ESTATE = 70,\n EXECUTOR = 71,\n GROUP_RETIREMENT_SAVINGS_PLAN = 72,\n GUARANTEED_INVESTMENT_CERTIFICATE = 73,\n HRA = 74,\n INDEXED_ANNUITY = 75,\n INVESTMENT_CLUB = 76,\n IRREVOCABLE_TRUST = 77,\n JOINT_TENANTS_BY_ENTIRITY = 78,\n JOINT_TENANTS_COMMUNITY_PROPERTY = 79,\n JOINT_TENANTS_IN_COMMON = 80,\n JOINT_TENANTS_WITH_RIGHTS_OF_SURVIVORSHIP = 81,\n KEOUGH_PLAN = 82,\n LIFE_INCOME_FUND = 83,\n LIVING_TRUST = 84,\n LOCKED_IN_RETIREMENT_ACCOUNT = 85,\n LOCKED_IN_RETIREMENT_INVESTMENT_FUND = 86,\n LOCKED_IN_RETIREMENT_SAVINGS_ACCOUNT = 87,\n MONEY_PURCHASE_PLAN = 88,\n PARTNERSHIP = 89,\n PLAN_409_A = 90,\n PLAN_ROTH_403_B = 91,\n REGISTERED_DISABILITY_SAVINGS_PLAN = 92,\n REGISTERED_LOCKED_IN_SAVINGS_PLAN = 93,\n REGISTERED_PENSION_PLAN = 94,\n REGISTERED_RETIREMENT_SAVINGS_PLAN = 95,\n REVOCABLE_TRUST = 96,\n ROTH_CONVERSION = 97,\n SOLE_PROPRIETORSHIP = 98,\n SPOUSAL_IRA = 99,\n SPOUSAL_ROTH_IRA = 100,\n TESTAMENTARY_TRUST = 101,\n THRIFT_SAVINGS_PLAN = 102,\n INHERITED_ANNUITY = 103,\n CORPORATE_ACCOUNT = 104,\n LIMITED_LIABILITY_ACCOUNT = 105,\n HSA_SAVINGS = 106,\n HSA_CHECKING = 107,\n}\n\nexport enum PropertyType {\n REAL_ESTATE = 0,\n VEHICLE = 1,\n ART = 2,\n JEWELRY = 3,\n FURNITURE = 4,\n APPLIANCES = 5,\n COMPUTER = 6,\n ELECTRONICS = 7,\n SPORTS_EQUIPMENT = 8,\n MISCELLANEOUS = 9,\n}\n\nexport enum ConnectionStatusEnums {\n CREATED = 0, // The member is new and has not aggregated yet\n PREVENTED = 1, // MX preventing aggregation until credentials are updated\n DENIED = 2, // Invalid credentials\n CHALLENGED = 3, // MFA presented\n REJECTED = 4, // MFA answered incorrectly\n LOCKED = 5, // Institution is preventing authentication, user must contact FI\n CONNECTED = 6, // Successfully authenticated and aggregating data\n IMPEDED = 7, // User attention is needed in online banking (marketing message, terms and conditions etc.)\n RECONNECTED = 8, // The connection has been migrated, we will not aggregate until user interacts with UI\n DEGRADED = 9, // Aggregation has failed for a short period with a minimum number of attempts\n DISCONNECTED = 10, // Aggregation has failed for an extended period of time with a minimum number of attempts\n DISCONTINUED = 11, // The connection to this institution is no longer available\n CLOSED = 12, // The user, MX, the client or partner have marked the account as closed\n DELAYED = 13, // Aggregation has taken longer than expected without being CONNECTED\n FAILED = 14, // Aggregation failed without being CONNECTED\n UPDATED = 15, // Credenitals have been updated, but the member has not yet been CONNECTED\n DISABLED = 16, // Aggregation has been momentarily paused, but the member is still CONNECTED\n IMPORTED = 17, // Member was imported from another provider using the MDX Migration API\n RESUMED = 18, // MFA has been answered and has not yet been CONNECTED\n EXPIRED = 19, // MFA has not been answered before job timed out\n IMPAIRED = 20, // Memeber is missing some or all credentials needed to connect\n PENDING = 21, // OAuth member created but waiting for authentication redirect // Not visible to user\n}\n\nexport const ProcessingStatuses = [\n ConnectionStatusEnums.CREATED,\n ConnectionStatusEnums.UPDATED,\n ConnectionStatusEnums.RESUMED,\n]\n\nexport const MfaStatuses = [ConnectionStatusEnums.CHALLENGED, ConnectionStatusEnums.REJECTED]\n\nexport const ErrorStatuses = [\n ConnectionStatusEnums.PREVENTED,\n ConnectionStatusEnums.DENIED,\n ConnectionStatusEnums.LOCKED,\n ConnectionStatusEnums.IMPEDED,\n ConnectionStatusEnums.DEGRADED,\n ConnectionStatusEnums.DISCONNECTED,\n ConnectionStatusEnums.DISCONTINUED,\n ConnectionStatusEnums.CLOSED,\n ConnectionStatusEnums.DELAYED,\n ConnectionStatusEnums.FAILED,\n ConnectionStatusEnums.DISABLED,\n ConnectionStatusEnums.IMPORTED,\n ConnectionStatusEnums.EXPIRED,\n ConnectionStatusEnums.IMPAIRED,\n]\n\nexport const NonConnectedStatuses = [...ErrorStatuses, ...MfaStatuses]\n\nexport enum ConnectionStatus {\n Connected = 'Connected',\n Error = 'Error',\n Processing = 'Processing',\n RequiresMfa = 'RequiresMfa',\n}\n\nexport const StatusName: any = {\n [ConnectionStatusEnums.CHALLENGED]: 'Challenged',\n [ConnectionStatusEnums.CLOSED]: 'Closed',\n [ConnectionStatusEnums.DEGRADED]: 'Degraded',\n [ConnectionStatusEnums.DELAYED]: 'Delayed',\n [ConnectionStatusEnums.DENIED]: 'Denied',\n [ConnectionStatusEnums.DISABLED]: 'Disabled',\n [ConnectionStatusEnums.DISCONNECTED]: 'Disconnected',\n [ConnectionStatusEnums.DISCONTINUED]: 'Discontinued',\n [ConnectionStatusEnums.EXPIRED]: 'Expired',\n [ConnectionStatusEnums.FAILED]: 'Failed',\n [ConnectionStatusEnums.IMPAIRED]: 'Impaired',\n [ConnectionStatusEnums.IMPEDED]: 'Impeded',\n [ConnectionStatusEnums.IMPORTED]: 'Imported',\n [ConnectionStatusEnums.LOCKED]: 'Locked',\n [ConnectionStatusEnums.PREVENTED]: 'Prevented',\n [ConnectionStatusEnums.REJECTED]: 'Rejected',\n}\n\nexport const AccountTypeName: any = {\n [AccountType.ANY]: 'Any',\n [AccountType.CASH]: 'Cash',\n [AccountType.CHECKING]: 'Checking',\n [AccountType.CHECKING_LINE_OF_CREDIT]: 'Checking Line of Credit',\n [AccountType.CREDIT_CARD]: 'Credit Card',\n [AccountType.DIGITAL_WALLET]: 'Digital Wallet',\n [AccountType.INSURANCE]: 'Insurance',\n [AccountType.INVESTMENT]: 'Investment',\n [AccountType.LINE_OF_CREDIT]: 'Line of Credit',\n [AccountType.LOAN]: 'Loan',\n [AccountType.MORTGAGE]: 'Mortgage',\n [AccountType.PREPAID]: 'Prepaid',\n [AccountType.PROPERTY]: 'Property',\n [AccountType.SAVINGS]: 'Savings',\n}\n\nexport const AccountIcon: any = {\n [AccountType.ANY]: 'account_balance',\n [AccountType.CASH]: 'monetization_on',\n [AccountType.CHECKING]: 'checkbook',\n [AccountType.CHECKING_LINE_OF_CREDIT]: 'checkbook', // Checking line of credit has the same icon as checking\n [AccountType.CREDIT_CARD]: 'credit_card',\n [AccountType.DIGITAL_WALLET]: 'wallet',\n [AccountType.INSURANCE]: 'monitor_heart',\n [AccountType.INVESTMENT]: 'trending_up',\n [AccountType.LINE_OF_CREDIT]: 'add_credit',\n [AccountType.LOAN]: 'loans',\n [AccountType.MORTGAGE]: 'house',\n [AccountType.PREPAID]: 'credit_card',\n [AccountType.PROPERTY]: 'key',\n [AccountType.SAVINGS]: 'savings',\n}\n\nexport const AccountIconVariants: any = {\n [AccountType.INVESTMENT]: 'bid_landscape',\n}\n\nexport const PropertyTypeName: any = {\n [PropertyType.REAL_ESTATE]: 'Real Estate',\n [PropertyType.VEHICLE]: 'Vehicle',\n [PropertyType.ART]: 'Art',\n [PropertyType.JEWELRY]: 'Jewelry',\n [PropertyType.FURNITURE]: 'Furniture',\n [PropertyType.APPLIANCES]: 'Appliances',\n [PropertyType.COMPUTER]: 'Computer',\n [PropertyType.ELECTRONICS]: 'Electronics',\n [PropertyType.SPORTS_EQUIPMENT]: 'Sports Equipment',\n [PropertyType.MISCELLANEOUS]: 'Miscellaneous',\n}\n\nexport const PropertyIcon: any = {\n [PropertyType.REAL_ESTATE]: 'home_work',\n [PropertyType.VEHICLE]: 'directions_car',\n [PropertyType.ART]: 'insert_photo',\n [PropertyType.JEWELRY]: 'diamond',\n [PropertyType.FURNITURE]: 'chair',\n [PropertyType.APPLIANCES]: 'kitchen',\n [PropertyType.COMPUTER]: 'computer',\n [PropertyType.ELECTRONICS]: 'camera_alt',\n [PropertyType.SPORTS_EQUIPMENT]: 'sports_baseball',\n [PropertyType.MISCELLANEOUS]: 'monetization_on',\n}\n"],"mappings":"AAuIA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,MAAA,CAAA,IAAA,OACA,EAAA,EAAA,WAAA,CAAA,IAAA,YACA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,cAAA,CAAA,IAAA,eACA,EAAA,EAAA,aAAA,CAAA,IAAA,cACA,EAAA,EAAA,iBAAA,CAAA,IAAA,kBACA,EAAA,EAAA,WAAA,CAAA,IAAA,YACA,EAAA,EAAA,WAAA,CAAA,IAAA,YACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,YAAA,EAAA,IAAA,aACA,EAAA,EAAA,UAAA,EAAA,IAAA,WACA,EAAA,EAAA,0BAAA,EAAA,IAAA,2BACA,EAAA,EAAA,iBAAA,EAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,eAAA,CAAA,IAAA,gBACA,EAAA,EAAA,yBAAA,CAAA,IAAA,0BACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAA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;AAAA,EACJ,GAAA;AAAA,EACJ,GAAA;AAAA,EACI,GAAA;AAAA,EACE,GAAA;AAAA,EACC,GAAA;AAAA,EACF,GAAA;AAAA,EACG,GAAA;AAAA,EACK,GAAA;AAAA,EACH,GAAA;AAChC,GAEa,IAAoB;AAAA,EACH,GAAA;AAAA,EACJ,GAAA;AAAA,EACJ,GAAA;AAAA,EACI,GAAA;AAAA,EACE,GAAA;AAAA,EACC,GAAA;AAAA,EACF,GAAA;AAAA,EACG,GAAA;AAAA,EACK,GAAA;AAAA,EACH,GAAA;AAChC"}
|
|
1
|
+
{"version":3,"file":"Account.es.js","names":[],"sources":["../../../src/core/types/Account.ts"],"sourcesContent":["import { type Institution } from './Institution'\n\nexport interface Account {\n account_number?: string\n account_subtype?: AccountSubType\n account_type: AccountType\n apr?: number\n apy?: number\n available_balance?: number\n balance?: number\n balance_updated_at?: number\n cash_balance?: number\n credit_limit?: number\n current_balance?: number\n currency_code?: string\n day_payment_is_due?: number\n display_order?: number\n external_guid?: string\n feed_account_type?: number\n feed_apr?: number\n feed_apy?: number\n feed_credit_limit?: number\n feed_day_payment_is_due?: number\n feed_interest_rate?: number\n feed_is_closed?: boolean\n feed_localized_name?: string\n feed_name?: string\n feed_nickname?: string\n feed_original_balance?: number\n flags?: number\n guid: string\n institution_guid?: string\n interest_rate?: number\n interest_rate_set_by?: number\n interestRate?: number\n is_closed: boolean\n is_deleted: boolean\n is_excluded_from_accounts: boolean\n is_excluded_from_budgets: boolean\n is_excluded_from_cash_flow: boolean\n is_excluded_from_debts: boolean\n is_excluded_from_goals: boolean\n is_excluded_from_investments: boolean\n is_excluded_from_net_worth: boolean\n is_excluded_from_spending: boolean\n is_excluded_from_transactions: boolean\n is_excluded_from_trends: boolean\n is_hidden: boolean\n is_manual: boolean\n is_personal: boolean\n localized_name?: string\n member_guid?: string\n member_is_managed_by_user: boolean\n metadata?: string\n minimum_payment?: number\n name?: string\n nickname?: string\n original_balance?: number\n payment_due_at?: number\n pending_balance?: number\n property_type?: PropertyType\n revision?: number\n updated_at?: number\n user_guid?: string\n user_name?: string\n\n // TODO: STORE_REFACTOR Remove fields after switch to Detailed Accounts\n memberName?: string\n connectionStatus?: ConnectionStatus\n displayName?: string\n trucatedDisplayName?: string\n institutionName?: string\n}\n\nexport interface DetailedAccount extends Account {\n connectionStatus?: ConnectionStatus\n displayName?: string\n institutionName?: string // TODO: STORE_REFACTOR - Remove after all move to displayName\n member?: Member\n monthlyBalances?: MonthlyAccountBalance[]\n institution?: Institution\n}\n\nexport interface Member {\n aggregation_status: number\n connection_status: ConnectionStatusEnums\n guid: string\n institution_guid: string\n institution_name?: string\n institution_url?: string\n is_being_aggregated: boolean\n is_manual: boolean\n is_managed_by_user: boolean\n is_oauth: boolean\n last_job_guid?: string\n last_job_status?: string\n last_update_time?: number\n metadata?: string\n mfa: any\n most_recent_job_guid?: string\n needs_updated_credentials: boolean\n name: string\n process_status?: number\n revision: number\n user_guid: string\n oauth_window_uri?: string\n verification_is_enabled: boolean\n tax_statement_is_enabled: boolean\n successfully_aggregated_at?: number\n}\n\nexport interface MonthlyAccountBalance {\n account_guid: string\n balance: number\n credit_transaction_total: number\n debit_transaction_total: number\n id: string\n month: number\n transaction_total: number\n user_guid: string\n year: number\n year_month: number\n}\n\nexport enum AccountType {\n ANY = 0,\n CHECKING = 1,\n SAVINGS = 2,\n LOAN = 3,\n CREDIT_CARD = 4,\n INVESTMENT = 5,\n LINE_OF_CREDIT = 6,\n MORTGAGE = 7,\n PROPERTY = 8,\n CASH = 9,\n INSURANCE = 10,\n PREPAID = 11,\n CHECKING_LINE_OF_CREDIT = 12,\n DIGITAL_WALLET = 13,\n}\n\nexport enum AccountSubType {\n NONE = 0,\n MONEY_MARKET = 1,\n CERTIFICATE_OF_DEPOSIT = 2,\n AUTO = 3,\n STUDENT = 4,\n SMALL_BUSINESS = 5,\n PERSONAL = 6,\n PERSONAL_WITH_COLLATERAL = 7,\n HOME_EQUITY = 8,\n PLAN_401_K = 9,\n PLAN_403_B = 10,\n PLAN_529 = 11,\n IRA = 12,\n ROLLOVER_IRA = 13,\n ROTH_IRA = 14,\n TAXABLE = 15,\n NON_TAXABLE = 16,\n BROKERAGE = 17,\n TRUST = 18,\n UNIFORM_GIFTS_TO_MINORS_ACT = 19,\n PLAN_457 = 20,\n PENSION = 21,\n EMPLOYEE_STOCK_OWNERSHIP_PLAN = 22,\n SIMPLIFIED_EMPLOYEE_PENSION = 23,\n SIMPLE_IRA = 24,\n BOAT = 25,\n POWERSPORTS = 26,\n RV = 27,\n HELOC = 28,\n PLAN_ROTH_401_K = 29,\n FIXED_ANNUITY = 30,\n VARIABLE_ANNUITY = 31,\n VEHICLE_INSURANCE = 32,\n DISABILITY = 33,\n HEALTH = 34,\n LONG_TERM_CARE = 35,\n PROPERTY_AND_CASUALTY = 36,\n UNIVERSAL_LIFE = 37,\n TERM_LIFE = 38,\n WHOLE_LIFE = 39,\n ACCIDENTAL_DEATH_AND_DISMEMBERMENT = 40,\n VARIABLE_UNIVERSAL_LIFE = 41,\n HSA = 42,\n TAX_FREE_SAVINGS_ACCOUNT = 43,\n INDIVIDUAL = 44,\n REGISTERED_RETIREMENT_INCOME_FUND = 45,\n CASH_MANAGEMENT_ACCOUNT = 46,\n EMPLOYEE_STOCK_PURCHASE_PLAN = 47,\n REGISTERED_EDUCATION_SAVINGS_PLAN = 48,\n PROFIT_SHARING_PLAN = 49,\n UNIFORM_TRANSFER_TO_MINORS_ACT = 50,\n PLAN_401_A = 51,\n SARSEP_IRA = 52,\n FIXED_ANNUITY_TRADITIONAL_IRA = 53,\n VARIABLE_ANNUITY_TRADITIONAL_IRA = 54,\n SEPP_IRA = 55,\n INHERITED_TRADITIONAL_IRA = 56,\n FIXED_ANNUITY_ROTH_IRA = 57,\n VARIABLE_ANNUITY_ROTH_IRA = 58,\n INHERITED_ROTH_IRA = 59,\n COVERDELL = 60,\n ADVISORY_ACCOUNT = 61,\n BROKERAGE_MARGIN = 62,\n CHARITABLE_GIFT_ACCOUNT = 63,\n CHURCH_ACCOUNT = 64,\n CONSERVATORSHIP = 65,\n CUSTODIAL = 66,\n DEFINED_BENEFIT_PLAN = 67,\n DEFINED_CONTRIBUTION_PLAN = 68,\n EDUCATIONAL = 69,\n ESTATE = 70,\n EXECUTOR = 71,\n GROUP_RETIREMENT_SAVINGS_PLAN = 72,\n GUARANTEED_INVESTMENT_CERTIFICATE = 73,\n HRA = 74,\n INDEXED_ANNUITY = 75,\n INVESTMENT_CLUB = 76,\n IRREVOCABLE_TRUST = 77,\n JOINT_TENANTS_BY_ENTIRITY = 78,\n JOINT_TENANTS_COMMUNITY_PROPERTY = 79,\n JOINT_TENANTS_IN_COMMON = 80,\n JOINT_TENANTS_WITH_RIGHTS_OF_SURVIVORSHIP = 81,\n KEOUGH_PLAN = 82,\n LIFE_INCOME_FUND = 83,\n LIVING_TRUST = 84,\n LOCKED_IN_RETIREMENT_ACCOUNT = 85,\n LOCKED_IN_RETIREMENT_INVESTMENT_FUND = 86,\n LOCKED_IN_RETIREMENT_SAVINGS_ACCOUNT = 87,\n MONEY_PURCHASE_PLAN = 88,\n PARTNERSHIP = 89,\n PLAN_409_A = 90,\n PLAN_ROTH_403_B = 91,\n REGISTERED_DISABILITY_SAVINGS_PLAN = 92,\n REGISTERED_LOCKED_IN_SAVINGS_PLAN = 93,\n REGISTERED_PENSION_PLAN = 94,\n REGISTERED_RETIREMENT_SAVINGS_PLAN = 95,\n REVOCABLE_TRUST = 96,\n ROTH_CONVERSION = 97,\n SOLE_PROPRIETORSHIP = 98,\n SPOUSAL_IRA = 99,\n SPOUSAL_ROTH_IRA = 100,\n TESTAMENTARY_TRUST = 101,\n THRIFT_SAVINGS_PLAN = 102,\n INHERITED_ANNUITY = 103,\n CORPORATE_ACCOUNT = 104,\n LIMITED_LIABILITY_ACCOUNT = 105,\n HSA_SAVINGS = 106,\n HSA_CHECKING = 107,\n}\n\nexport enum PropertyType {\n REAL_ESTATE = 0,\n VEHICLE = 1,\n ART = 2,\n JEWELRY = 3,\n FURNITURE = 4,\n APPLIANCES = 5,\n COMPUTER = 6,\n ELECTRONICS = 7,\n SPORTS_EQUIPMENT = 8,\n MISCELLANEOUS = 9,\n}\n\nexport enum ConnectionStatusEnums {\n CREATED = 0, // The member is new and has not aggregated yet\n PREVENTED = 1, // MX preventing aggregation until credentials are updated\n DENIED = 2, // Invalid credentials\n CHALLENGED = 3, // MFA presented\n REJECTED = 4, // MFA answered incorrectly\n LOCKED = 5, // Institution is preventing authentication, user must contact FI\n CONNECTED = 6, // Successfully authenticated and aggregating data\n IMPEDED = 7, // User attention is needed in online banking (marketing message, terms and conditions etc.)\n RECONNECTED = 8, // The connection has been migrated, we will not aggregate until user interacts with UI\n DEGRADED = 9, // Aggregation has failed for a short period with a minimum number of attempts\n DISCONNECTED = 10, // Aggregation has failed for an extended period of time with a minimum number of attempts\n DISCONTINUED = 11, // The connection to this institution is no longer available\n CLOSED = 12, // The user, MX, the client or partner have marked the account as closed\n DELAYED = 13, // Aggregation has taken longer than expected without being CONNECTED\n FAILED = 14, // Aggregation failed without being CONNECTED\n UPDATED = 15, // Credenitals have been updated, but the member has not yet been CONNECTED\n DISABLED = 16, // Aggregation has been momentarily paused, but the member is still CONNECTED\n IMPORTED = 17, // Member was imported from another provider using the MDX Migration API\n RESUMED = 18, // MFA has been answered and has not yet been CONNECTED\n EXPIRED = 19, // MFA has not been answered before job timed out\n IMPAIRED = 20, // Memeber is missing some or all credentials needed to connect\n PENDING = 21, // OAuth member created but waiting for authentication redirect // Not visible to user\n}\n\nexport const ProcessingStatuses = [\n ConnectionStatusEnums.CREATED,\n ConnectionStatusEnums.UPDATED,\n ConnectionStatusEnums.RESUMED,\n]\n\nexport const MfaStatuses = [ConnectionStatusEnums.CHALLENGED, ConnectionStatusEnums.REJECTED]\n\nexport const ErrorStatuses = [\n ConnectionStatusEnums.PREVENTED,\n ConnectionStatusEnums.DENIED,\n ConnectionStatusEnums.LOCKED,\n ConnectionStatusEnums.IMPEDED,\n ConnectionStatusEnums.DEGRADED,\n ConnectionStatusEnums.DISCONNECTED,\n ConnectionStatusEnums.DISCONTINUED,\n ConnectionStatusEnums.CLOSED,\n ConnectionStatusEnums.DELAYED,\n ConnectionStatusEnums.FAILED,\n ConnectionStatusEnums.DISABLED,\n ConnectionStatusEnums.IMPORTED,\n ConnectionStatusEnums.EXPIRED,\n ConnectionStatusEnums.IMPAIRED,\n]\n\nexport const NonConnectedStatuses = [...ErrorStatuses, ...MfaStatuses]\n\nexport enum ConnectionStatus {\n Connected = 'Connected',\n Error = 'Error',\n Processing = 'Processing',\n RequiresMfa = 'RequiresMfa',\n}\n\nexport const StatusName: any = {\n [ConnectionStatusEnums.CHALLENGED]: 'Challenged',\n [ConnectionStatusEnums.CLOSED]: 'Closed',\n [ConnectionStatusEnums.DEGRADED]: 'Degraded',\n [ConnectionStatusEnums.DELAYED]: 'Delayed',\n [ConnectionStatusEnums.DENIED]: 'Denied',\n [ConnectionStatusEnums.DISABLED]: 'Disabled',\n [ConnectionStatusEnums.DISCONNECTED]: 'Disconnected',\n [ConnectionStatusEnums.DISCONTINUED]: 'Discontinued',\n [ConnectionStatusEnums.EXPIRED]: 'Expired',\n [ConnectionStatusEnums.FAILED]: 'Failed',\n [ConnectionStatusEnums.IMPAIRED]: 'Impaired',\n [ConnectionStatusEnums.IMPEDED]: 'Impeded',\n [ConnectionStatusEnums.IMPORTED]: 'Imported',\n [ConnectionStatusEnums.LOCKED]: 'Locked',\n [ConnectionStatusEnums.PREVENTED]: 'Prevented',\n [ConnectionStatusEnums.REJECTED]: 'Rejected',\n}\n\nexport const AccountTypeName: any = {\n [AccountType.ANY]: 'Any',\n [AccountType.CASH]: 'Cash',\n [AccountType.CHECKING]: 'Checking',\n [AccountType.CHECKING_LINE_OF_CREDIT]: 'Checking Line of Credit',\n [AccountType.CREDIT_CARD]: 'Credit Card',\n [AccountType.DIGITAL_WALLET]: 'Digital Wallet',\n [AccountType.INSURANCE]: 'Insurance',\n [AccountType.INVESTMENT]: 'Investment',\n [AccountType.LINE_OF_CREDIT]: 'Line of Credit',\n [AccountType.LOAN]: 'Loan',\n [AccountType.MORTGAGE]: 'Mortgage',\n [AccountType.PREPAID]: 'Prepaid',\n [AccountType.PROPERTY]: 'Property',\n [AccountType.SAVINGS]: 'Savings',\n}\n\nexport const AccountIcon: any = {\n [AccountType.ANY]: 'account_balance',\n [AccountType.CASH]: 'monetization_on',\n [AccountType.CHECKING]: 'checkbook',\n [AccountType.CHECKING_LINE_OF_CREDIT]: 'checkbook', // Checking line of credit has the same icon as checking\n [AccountType.CREDIT_CARD]: 'credit_card',\n [AccountType.DIGITAL_WALLET]: 'wallet',\n [AccountType.INSURANCE]: 'monitor_heart',\n [AccountType.INVESTMENT]: 'trending_up',\n [AccountType.LINE_OF_CREDIT]: 'add_credit',\n [AccountType.LOAN]: 'loans',\n [AccountType.MORTGAGE]: 'house',\n [AccountType.PREPAID]: 'credit_card',\n [AccountType.PROPERTY]: 'key',\n [AccountType.SAVINGS]: 'savings',\n}\n\nexport const AccountIconVariants: any = {\n [AccountType.INVESTMENT]: 'bid_landscape',\n}\n\nexport const PropertyTypeName: any = {\n [PropertyType.REAL_ESTATE]: 'Real Estate',\n [PropertyType.VEHICLE]: 'Vehicle',\n [PropertyType.ART]: 'Art',\n [PropertyType.JEWELRY]: 'Jewelry',\n [PropertyType.FURNITURE]: 'Furniture',\n [PropertyType.APPLIANCES]: 'Appliances',\n [PropertyType.COMPUTER]: 'Computer',\n [PropertyType.ELECTRONICS]: 'Electronics',\n [PropertyType.SPORTS_EQUIPMENT]: 'Sports Equipment',\n [PropertyType.MISCELLANEOUS]: 'Miscellaneous',\n}\n\nexport const PropertyIcon: any = {\n [PropertyType.REAL_ESTATE]: 'home_work',\n [PropertyType.VEHICLE]: 'directions_car',\n [PropertyType.ART]: 'insert_photo',\n [PropertyType.JEWELRY]: 'diamond',\n [PropertyType.FURNITURE]: 'chair',\n [PropertyType.APPLIANCES]: 'kitchen',\n [PropertyType.COMPUTER]: 'computer',\n [PropertyType.ELECTRONICS]: 'camera_alt',\n [PropertyType.SPORTS_EQUIPMENT]: 'sports_baseball',\n [PropertyType.MISCELLANEOUS]: 'monetization_on',\n}\n"],"mappings":"AA4HA,IAAY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,MAAA,CAAA,IAAA,OACA,EAAA,EAAA,WAAA,CAAA,IAAA,YACA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,cAAA,CAAA,IAAA,eACA,EAAA,EAAA,aAAA,CAAA,IAAA,cACA,EAAA,EAAA,iBAAA,CAAA,IAAA,kBACA,EAAA,EAAA,WAAA,CAAA,IAAA,YACA,EAAA,EAAA,WAAA,CAAA,IAAA,YACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,YAAA,EAAA,IAAA,aACA,EAAA,EAAA,UAAA,EAAA,IAAA,WACA,EAAA,EAAA,0BAAA,EAAA,IAAA,2BACA,EAAA,EAAA,iBAAA,EAAA,IAAA;AACF,GAAA,CAAA,CAAA,GAEY,IAAL,0BAAA,GAAA;AACL,SAAA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,eAAA,CAAA,IAAA,gBACA,EAAA,EAAA,yBAAA,CAAA,IAAA,0BACA,EAAA,EAAA,OAAA,CAAA,IAAA,QACA,EAAA,EAAA,UAAA,CAAA,IAAA,WACA,EAAA,EAAA,iBAAA,CAAA,IAAA,kBACA,EAAA,EAAA,WAAA,CAAA,IAAA,YACA,EAAA,EAAA,2BAAA,CAAA,IAAA,4BACA,EAAA,EAAA,cAAA,CAAA,IAAA,eACA,EAAA,EAAA,aAAA,CAAA,IAAA,cACA,EAAA,EAAA,aAAA,EAAA,IAAA,cACA,EAAA,EAAA,WAAA,EAAA,IAAA,YACA,EAAA,EAAA,MAAA,EAAA,IAAA,OACA,EAAA,EAAA,eAAA,EAAA,IAAA,gBACA,EAAA,EA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@ -1,4 +1,4 @@
|
|
|
1
|
-
export type { Account, DetailedAccount,
|
|
1
|
+
export type { Account, DetailedAccount, Member, MonthlyAccountBalance } from './Account';
|
|
2
2
|
export { AccountIcon, AccountIconVariants, AccountSubType, AccountType, AccountTypeName, ConnectionStatus, ConnectionStatusEnums, ErrorStatuses, MfaStatuses, NonConnectedStatuses, ProcessingStatuses, PropertyType, PropertyTypeName, StatusName, } from './Account';
|
|
3
3
|
export type { AnalyticsEvent, AnalyticsPageview, BasicAnalyticsEvent, BasicAnalyticsPageview, AnalyticsSession, AnalyticEventFunction, AnalyticPageviewFunction, AnalyticsSessionInstance, } from './Analytics';
|
|
4
4
|
export type { AppConfig, AppData, Banner, ClientConfig, Config, Options, StyleConfig, } from './AppData';
|
|
@@ -2,11 +2,11 @@ export interface InvestmentAllocationCopy {
|
|
|
2
2
|
allocations_list: DynamicKeyValue;
|
|
3
3
|
cash_balance_display_name: string;
|
|
4
4
|
empty_data: string;
|
|
5
|
-
pie_chart_centered_click_for_details: string;
|
|
6
5
|
pie_chart_centered_text: string;
|
|
7
6
|
tabs_label_dollar: string;
|
|
8
7
|
tabs_label_percent: string;
|
|
9
8
|
total_label_text: string;
|
|
9
|
+
unclassified_display_name: string;
|
|
10
10
|
}
|
|
11
11
|
interface DynamicKeyValue {
|
|
12
12
|
[key: string]: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Account, AccountGroup, FinancialAccount,
|
|
1
|
+
import { Account, AccountGroup, FinancialAccount, Member, MonthlyAccountBalance, NetWorth } from '../types';
|
|
2
2
|
export declare const filterAccounts: (accounts: Account[], members: Member[]) => Account[];
|
|
3
3
|
export declare const flattenBalances: (allBalances: MonthlyAccountBalance[], currentBalances: MonthlyAccountBalance[]) => MonthlyAccountBalance[];
|
|
4
4
|
export declare const getLatestNetWorthData: (chartData: NetWorth[]) => NetWorth | undefined;
|
|
@@ -23,5 +23,4 @@ export declare const buildAssetsLiabilities: (accounts: Account[]) => {
|
|
|
23
23
|
totalAssets: number;
|
|
24
24
|
totalLiabilities: number;
|
|
25
25
|
};
|
|
26
|
-
export declare const toMonthlyAccountBalance: (hab: HistoricalAccountBalance) => MonthlyAccountBalance;
|
|
27
26
|
export declare const groupAccounts: (accounts: FinancialAccount[]) => AccountGroup[];
|
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
import { AccountIcon as
|
|
2
|
-
import { isAccountLiability as
|
|
3
|
-
import { format as
|
|
1
|
+
import { AccountIcon as p, AccountIconVariants as b, AccountTypeName as y } from "../types/Account.es.js";
|
|
2
|
+
import { isAccountLiability as f } from "./AccountUtils.es.js";
|
|
3
|
+
import { format as _ } from "date-fns/format";
|
|
4
4
|
import { startOfMonth as v } from "date-fns/startOfMonth";
|
|
5
5
|
import { subMonths as A } from "date-fns/subMonths";
|
|
6
6
|
import { fromUnixTime as M } from "date-fns/fromUnixTime";
|
|
7
|
-
var
|
|
8
|
-
const { is_closed: a, is_deleted: s, is_hidden:
|
|
9
|
-
return a || s ||
|
|
7
|
+
var c = 13, W = (e, r) => e.filter((t) => {
|
|
8
|
+
const { is_closed: a, is_deleted: s, is_hidden: n, is_manual: o } = t;
|
|
9
|
+
return a || s || n ? !1 : o || !t.guid ? !0 : r.some((g) => e.some((m) => g.guid === m.member_guid));
|
|
10
10
|
}), G = (e, r) => [...e, ...r], R = (e) => {
|
|
11
11
|
if (e && e.length > 0) return e[e.length - 1];
|
|
12
|
-
}, U = (e, r) => e.year_month - r.year_month, N = () => Array.from({ length:
|
|
13
|
-
const
|
|
14
|
-
const l =
|
|
12
|
+
}, U = (e, r) => e.year_month - r.year_month, N = () => Array.from({ length: c }, (e, r) => Math.floor(v(A(/* @__PURE__ */ new Date(), r)).getTime() / 1e3)).sort(), j = (e, r, t) => !e.length || !r.length ? [] : N().reduceRight((a, s) => {
|
|
13
|
+
const n = r.filter(({ year_month: i }) => i === parseInt(_(M(s), "yyyyMM"))), o = e.map((i) => {
|
|
14
|
+
const l = n.find((u) => u.account_guid === i.guid), h = {
|
|
15
15
|
change: 0,
|
|
16
16
|
guid: i.guid,
|
|
17
17
|
name: i.name,
|
|
18
18
|
type: i.account_type,
|
|
19
19
|
balance: 0
|
|
20
20
|
};
|
|
21
|
-
if (!l && a.length === 0 && !i.balance) return
|
|
21
|
+
if (!l && a.length === 0 && !i.balance) return h;
|
|
22
22
|
if (!l && a.length === 0) return {
|
|
23
|
-
...
|
|
24
|
-
value:
|
|
23
|
+
...h,
|
|
24
|
+
value: f(i) ? -(i.balance ?? 0) : i.balance ?? 0
|
|
25
25
|
};
|
|
26
26
|
if (!l) {
|
|
27
|
-
const u = a[0].accounts.find((
|
|
28
|
-
return u ||
|
|
27
|
+
const u = a[0].accounts.find((d) => d.guid === i.guid);
|
|
28
|
+
return u || h;
|
|
29
29
|
}
|
|
30
30
|
return {
|
|
31
31
|
change: l.transaction_total,
|
|
@@ -34,7 +34,7 @@ var h = 13, W = (e, r) => e.filter((n) => {
|
|
|
34
34
|
type: i.account_type,
|
|
35
35
|
value: l.balance
|
|
36
36
|
};
|
|
37
|
-
}), { y: g, change:
|
|
37
|
+
}), { y: g, change: m } = o.reduce((i, l) => ({
|
|
38
38
|
y: i.y + (l.value || 0),
|
|
39
39
|
change: i.change + (l.change || 0)
|
|
40
40
|
}), {
|
|
@@ -45,70 +45,59 @@ var h = 13, W = (e, r) => e.filter((n) => {
|
|
|
45
45
|
accounts: o,
|
|
46
46
|
x: s,
|
|
47
47
|
y: g,
|
|
48
|
-
change:
|
|
48
|
+
change: m
|
|
49
49
|
}, ...a];
|
|
50
|
-
}, []).slice(
|
|
51
|
-
const r = [],
|
|
50
|
+
}, []).slice(c - t), k = (e) => {
|
|
51
|
+
const r = [], t = [];
|
|
52
52
|
let a = 0, s = 0;
|
|
53
|
-
return e?.accounts.forEach((
|
|
54
|
-
|
|
55
|
-
accountName:
|
|
56
|
-
gain:
|
|
57
|
-
}), a +=
|
|
58
|
-
accountName:
|
|
59
|
-
loss:
|
|
60
|
-
}), s +=
|
|
53
|
+
return e?.accounts.forEach((n) => {
|
|
54
|
+
n.change > 0 && (r.push({
|
|
55
|
+
accountName: n.name,
|
|
56
|
+
gain: n.change
|
|
57
|
+
}), a += n.change), n.change < 0 && (t.push({
|
|
58
|
+
accountName: n.name,
|
|
59
|
+
loss: n.change
|
|
60
|
+
}), s += n.change);
|
|
61
61
|
}), {
|
|
62
62
|
netWorth: e,
|
|
63
63
|
gains: r,
|
|
64
|
-
losses:
|
|
64
|
+
losses: t,
|
|
65
65
|
totalGains: a,
|
|
66
66
|
totalLosses: s
|
|
67
67
|
};
|
|
68
68
|
}, w = (e) => {
|
|
69
|
-
const r = [],
|
|
69
|
+
const r = [], t = [];
|
|
70
70
|
let a = 0, s = 0;
|
|
71
|
-
return e.forEach((
|
|
72
|
-
if (
|
|
73
|
-
const o =
|
|
74
|
-
|
|
75
|
-
accountName:
|
|
76
|
-
accountType:
|
|
71
|
+
return e.forEach((n) => {
|
|
72
|
+
if (f(n)) {
|
|
73
|
+
const o = n.balance ?? 0;
|
|
74
|
+
t.push({
|
|
75
|
+
accountName: n.name,
|
|
76
|
+
accountType: n.account_type,
|
|
77
77
|
balance: o
|
|
78
78
|
}), s += o;
|
|
79
79
|
} else {
|
|
80
|
-
const o =
|
|
80
|
+
const o = n.balance ?? 0;
|
|
81
81
|
r.push({
|
|
82
|
-
accountName:
|
|
83
|
-
accountType:
|
|
82
|
+
accountName: n.name,
|
|
83
|
+
accountType: n.account_type,
|
|
84
84
|
balance: o
|
|
85
85
|
}), a += o;
|
|
86
86
|
}
|
|
87
87
|
}), {
|
|
88
88
|
assets: r,
|
|
89
|
-
liabilities:
|
|
89
|
+
liabilities: t,
|
|
90
90
|
totalAssets: a,
|
|
91
91
|
totalLiabilities: s
|
|
92
92
|
};
|
|
93
|
-
}, x = (e) =>
|
|
94
|
-
|
|
95
|
-
balance: e.balance,
|
|
96
|
-
credit_transaction_total: 0,
|
|
97
|
-
debit_transaction_total: 0,
|
|
98
|
-
id: e.guid,
|
|
99
|
-
month: e.month,
|
|
100
|
-
transaction_total: e.transaction_total ?? 0,
|
|
101
|
-
user_guid: e.user_guid,
|
|
102
|
-
year: e.year,
|
|
103
|
-
year_month: e.year_month
|
|
104
|
-
}), z = (e) => {
|
|
105
|
-
const r = e.reduce((n, a) => {
|
|
93
|
+
}, x = (e) => {
|
|
94
|
+
const r = e.reduce((t, a) => {
|
|
106
95
|
const s = a.accountType;
|
|
107
|
-
return
|
|
96
|
+
return t[s] || (t[s] = []), t[s].push(a), t;
|
|
108
97
|
}, {});
|
|
109
|
-
return Object.entries(r).map(([
|
|
110
|
-
icon:
|
|
111
|
-
name: y[+
|
|
98
|
+
return Object.entries(r).map(([t, a]) => ({
|
|
99
|
+
icon: b[+t] || p[+t],
|
|
100
|
+
name: y[+t],
|
|
112
101
|
accounts: a
|
|
113
102
|
}));
|
|
114
103
|
};
|
|
@@ -119,9 +108,8 @@ export {
|
|
|
119
108
|
W as filterAccounts,
|
|
120
109
|
G as flattenBalances,
|
|
121
110
|
R as getLatestNetWorthData,
|
|
122
|
-
|
|
123
|
-
U as sortByYearMonthAscending
|
|
124
|
-
x as toMonthlyAccountBalance
|
|
111
|
+
x as groupAccounts,
|
|
112
|
+
U as sortByYearMonthAscending
|
|
125
113
|
};
|
|
126
114
|
|
|
127
115
|
//# sourceMappingURL=NetWorthUtils.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NetWorthUtils.es.js","names":[],"sources":["../../../src/core/utils/NetWorthUtils.ts"],"sourcesContent":["import { format } from 'date-fns/format'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport type {\n Account,\n AccountGroup,\n FinancialAccount,\n
|
|
1
|
+
{"version":3,"file":"NetWorthUtils.es.js","names":[],"sources":["../../../src/core/utils/NetWorthUtils.ts"],"sourcesContent":["import { format } from 'date-fns/format'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { startOfMonth } from 'date-fns/startOfMonth'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport type {\n Account,\n AccountGroup,\n FinancialAccount,\n Member,\n MonthlyAccountBalance,\n NetWorth,\n} from '../types'\nimport { AccountTypeName, AccountIcon, AccountIconVariants } from '../types'\nimport { isAccountLiability } from '../utils/AccountUtils'\n\nconst MAX_NUMBER_MONTHS = 13\n\nexport const filterAccounts = (accounts: Account[], members: Member[]) => {\n return accounts.filter((account) => {\n const { is_closed, is_deleted, is_hidden, is_manual } = account\n\n if (is_closed || is_deleted || is_hidden) return false\n if (is_manual || !account.guid) return true\n\n return members.some((member) => {\n return accounts.some((account) => {\n return member.guid === account.member_guid\n })\n })\n })\n}\n\nexport const flattenBalances = (\n allBalances: MonthlyAccountBalance[],\n currentBalances: MonthlyAccountBalance[],\n) => {\n return [...allBalances, ...currentBalances]\n}\n\nexport const getLatestNetWorthData = (chartData: NetWorth[]) => {\n if (chartData && chartData.length > 0) {\n return chartData[chartData.length - 1]\n } else return undefined\n}\n\nexport const sortByYearMonthAscending = (a: MonthlyAccountBalance, b: MonthlyAccountBalance) =>\n a.year_month - b.year_month\n\nconst buildDateTicks = () => {\n return Array.from({ length: MAX_NUMBER_MONTHS }, (_, count) => {\n return Math.floor(startOfMonth(subMonths(new Date(), count)).getTime() / 1000)\n }).sort()\n}\n\nexport const buildChartData = (\n accounts: Account[],\n monthlyAccountBalances: MonthlyAccountBalance[],\n numberOfMonths: number,\n) => {\n if (!accounts.length || !monthlyAccountBalances.length) return []\n const dateTicks = buildDateTicks()\n return dateTicks\n .reduceRight((result: any, x) => {\n const balances = monthlyAccountBalances.filter(\n ({ year_month }) => year_month === parseInt(format(fromUnixTime(x), 'yyyyMM')),\n )\n const accountsWithBalances = accounts.map((account) => {\n const balance = balances.find((balance) => balance.account_guid === account.guid)\n\n const zeroBalance = {\n change: 0,\n guid: account.guid,\n name: account.name,\n type: account.account_type,\n balance: 0,\n }\n\n if (!balance && result.length === 0 && !account.balance) return zeroBalance\n\n // The servers return the monthly account balances in Utah time. Frontend starts all the date calculations\n // in UTC. We get into overlaps for a few hours depending on the timezone with no monthly account balances\n // for all accounts.\n if (!balance && result.length === 0) {\n return {\n ...zeroBalance,\n value: isAccountLiability(account) ? -(account.balance ?? 0) : (account.balance ?? 0),\n }\n }\n\n if (!balance) {\n const lastBalance = result[0].accounts.find((acc: Account) => acc.guid === account.guid)\n\n return lastBalance ? lastBalance : zeroBalance\n }\n\n return {\n change: balance.transaction_total,\n guid: account.guid,\n name: account.name,\n type: account.account_type,\n value: balance.balance,\n }\n })\n\n const { y, change } = accountsWithBalances.reduce(\n (acc, current) => {\n return {\n y: acc.y + (current.value || 0),\n change: acc.change + (current.change || 0),\n }\n },\n { y: 0, change: 0 },\n )\n\n return [\n {\n accounts: accountsWithBalances,\n x,\n y,\n change,\n },\n ...result,\n ]\n }, [])\n .slice(MAX_NUMBER_MONTHS - numberOfMonths)\n}\n\nexport const buildGainsLosses = (selectedData?: NetWorth) => {\n const gains: { accountName: string; gain: number }[] = []\n const losses: { accountName: string; loss: number }[] = []\n let totalGains = 0\n let totalLosses = 0\n\n selectedData?.accounts.forEach((account) => {\n if (account.change > 0) {\n gains.push({ accountName: account.name, gain: account.change })\n totalGains += account.change\n }\n if (account.change < 0) {\n losses.push({ accountName: account.name, loss: account.change })\n totalLosses += account.change\n }\n })\n\n return { netWorth: selectedData, gains, losses, totalGains, totalLosses }\n}\n\nexport const buildAssetsLiabilities = (accounts: Account[]) => {\n const assets: FinancialAccount[] = []\n const liabilities: FinancialAccount[] = []\n let totalAssets = 0\n let totalLiabilities = 0\n\n accounts.forEach((account) => {\n if (isAccountLiability(account)) {\n const balance = account.balance ?? 0\n liabilities.push({ accountName: account.name, accountType: account.account_type, balance })\n totalLiabilities += balance\n } else {\n const balance = account.balance ?? 0\n assets.push({ accountName: account.name, accountType: account.account_type, balance })\n totalAssets += balance\n }\n })\n\n return { assets, liabilities, totalAssets, totalLiabilities }\n}\n// groups accounts by account type\n// returns array of account groups, each with an icon, name, and the grouped accounts\nexport const groupAccounts = (accounts: FinancialAccount[]): AccountGroup[] => {\n const groupedAccounts = accounts.reduce<{ [key: number]: FinancialAccount[] }>((acc, account) => {\n const accountType = account.accountType\n if (!acc[accountType]) {\n acc[accountType] = []\n }\n acc[accountType].push(account)\n return acc\n }, {})\n\n return Object.entries(groupedAccounts).map(([accountType, accounts]) => ({\n icon: AccountIconVariants[+accountType] || AccountIcon[+accountType],\n name: AccountTypeName[+accountType],\n accounts,\n }))\n}\n"],"mappings":";;;;;;AAgBA,IAAM,IAAoB,IAEb,IAAA,CAAkB,GAAqB,MAC3C,EAAS,OAAA,CAAQ,MAAY;AAClC,QAAM,EAAE,WAAA,GAAW,YAAA,GAAY,WAAA,GAAW,WAAA,EAAA,IAAc;AAExD,SAAI,KAAa,KAAc,IAAkB,KAC7C,KAAa,CAAC,EAAQ,OAAa,KAEhC,EAAQ,KAAA,CAAM,MACZ,EAAS,KAAA,CAAM,MACb,EAAO,SAAS,EAAQ,WAChC,CACF;AACH,CAAC,GAGU,IAAA,CACX,GACA,MAEO,CAAC,GAAG,GAAa,GAAG,CAAe,GAG/B,IAAA,CAAyB,MAA0B;AAC9D,MAAI,KAAa,EAAU,SAAS,EAClC,QAAO,EAAU,EAAU,SAAS,CAAA;AAExC,GAEa,IAAA,CAA4B,GAA0B,MACjE,EAAE,aAAa,EAAE,YAEb,IAAA,MACG,MAAM,KAAK,EAAE,QAAQ,EAAkB,GAAA,CAAI,GAAG,MAC5C,KAAK,MAAM,EAAa,EAAU,oBAAI,KAAK,GAAG,CAAK,CAAC,EAAE,QAAQ,IAAI,GAAI,CAC9E,EAAE,KAAK,GAGG,IAAA,CACX,GACA,GACA,MAEI,CAAC,EAAS,UAAU,CAAC,EAAuB,SAAe,CAAC,IAC9C,EACX,EACJ,YAAA,CAAa,GAAa,MAAM;AAC/B,QAAM,IAAW,EAAuB,OAAA,CACrC,EAAE,YAAA,EAAA,MAAiB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,MAAY;AAC/F,UAAM,IAAc,EAAQ;AAC5B,WAAK,EAAI,CAAA,MACP,EAAI,CAAA,IAAe,CAAC,IAEtB,EAAI,CAAA,EAAa,KAAK,CAAO,GACtB;AAAA,EACT,GAAG,CAAC,CAAC;AAEL,SAAO,OAAO,QAAQ,CAAe,EAAE,IAAA,CAAK,CAAC,GAAa,CAAA,OAAe;AAAA,IACvE,MAAM,EAAoB,CAAC,CAAA,KAAgB,EAAY,CAAC,CAAA;AAAA,IACxD,MAAM,EAAgB,CAAC,CAAA;AAAA,IACvB,UAAA;AAAA,EACF,EAAE;AACJ"}
|
|
@@ -1,23 +1,22 @@
|
|
|
1
1
|
import b from "../../../common/components/charts/Donut.es.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import m from "react";
|
|
2
|
+
import { currencyDisplay as c, percentageDisplay as m } from "./util/createInvestementsAllocationData.es.js";
|
|
3
|
+
import p from "react";
|
|
5
4
|
import r from "@mui/material/Stack";
|
|
6
|
-
import { P as
|
|
7
|
-
import { Icon as
|
|
8
|
-
import { jsx as e, jsxs as
|
|
9
|
-
import { useTheme as
|
|
10
|
-
var
|
|
11
|
-
const s =
|
|
5
|
+
import { P as k, Text as u } from "@mxenabled/mxui";
|
|
6
|
+
import { Icon as I } from "@mxenabled/mx-icons";
|
|
7
|
+
import { jsx as e, jsxs as g } from "react/jsx-runtime";
|
|
8
|
+
import { useTheme as j } from "@mui/material/styles";
|
|
9
|
+
var N = ({ data: t, hoveredId: h, isPercentage: f, onMouseEnter: x, onMouseLeave: y, onSelected: D, selectedId: o, size: i = 150, totalLabel: d }) => {
|
|
10
|
+
const s = j(), a = s.palette.mode === "dark", n = p.useMemo(() => o ? t.investmentsData.find(({ guid: A }) => A === o) : void 0, [o]), v = p.useMemo(() => t.donutData.length > 0 ? t.donutData : [{
|
|
12
11
|
id: "0",
|
|
13
12
|
color: s.palette.neutral.light,
|
|
14
13
|
value: 100
|
|
15
|
-
}], [t, s]),
|
|
14
|
+
}], [t, s]), L = a ? "#0AC295" : "#09A57F", C = a ? "grey.300" : "grey.700", G = () => n ? m(n.percentage) : t.totalGainLossAvailable ? f ? m(t.totalGainLossPercentage) : c(t.totalGainLoss) : "—", l = n ? "text.secondary" : t.totalGainLossAvailable ? t.totalGainLoss >= 0 ? L : C : "text.secondary";
|
|
16
15
|
return /* @__PURE__ */ e(b, {
|
|
17
|
-
data:
|
|
16
|
+
data: v,
|
|
18
17
|
hoveredId: h,
|
|
19
|
-
onClick:
|
|
20
|
-
onMouseEnter:
|
|
18
|
+
onClick: D,
|
|
19
|
+
onMouseEnter: x,
|
|
21
20
|
onMouseLeave: y,
|
|
22
21
|
selectedId: o,
|
|
23
22
|
size: i,
|
|
@@ -31,7 +30,7 @@ var V = ({ data: t, hoveredId: h, isPercentage: g, onMouseEnter: f, onMouseLeave
|
|
|
31
30
|
justifyContent: "center",
|
|
32
31
|
minHeight: i,
|
|
33
32
|
minWidth: i,
|
|
34
|
-
children: /* @__PURE__ */
|
|
33
|
+
children: /* @__PURE__ */ g(r, {
|
|
35
34
|
alignItems: "center",
|
|
36
35
|
sx: {
|
|
37
36
|
gap: {
|
|
@@ -44,33 +43,33 @@ var V = ({ data: t, hoveredId: h, isPercentage: g, onMouseEnter: f, onMouseLeave
|
|
|
44
43
|
}
|
|
45
44
|
},
|
|
46
45
|
children: [
|
|
47
|
-
/* @__PURE__ */ e(
|
|
46
|
+
/* @__PURE__ */ e(u, {
|
|
48
47
|
color: "text.secondary",
|
|
49
48
|
noWrap: !0,
|
|
50
49
|
children: n?.displayName ?? d
|
|
51
50
|
}),
|
|
52
|
-
/* @__PURE__ */ e(
|
|
51
|
+
/* @__PURE__ */ e(k, {
|
|
53
52
|
color: "text.primary",
|
|
54
53
|
variant: "h1",
|
|
55
54
|
children: c(n?.value ?? t.totalMarketValue)
|
|
56
55
|
}),
|
|
57
|
-
/* @__PURE__ */
|
|
56
|
+
/* @__PURE__ */ g(r, {
|
|
58
57
|
sx: {
|
|
59
58
|
alignItems: "center",
|
|
60
59
|
flexDirection: "row",
|
|
61
60
|
gap: 4
|
|
62
61
|
},
|
|
63
|
-
children: [!n && t.totalGainLossAvailable && /* @__PURE__ */ e(
|
|
62
|
+
children: [!n && t.totalGainLossAvailable && /* @__PURE__ */ e(I, {
|
|
64
63
|
name: t.totalGainLoss >= 0 ? "trending_up" : "trending_down",
|
|
65
64
|
size: 20,
|
|
66
|
-
sx: { color:
|
|
67
|
-
}), /* @__PURE__ */ e(
|
|
65
|
+
sx: { color: l }
|
|
66
|
+
}), /* @__PURE__ */ e(u, {
|
|
68
67
|
sx: {
|
|
69
|
-
color:
|
|
68
|
+
color: l,
|
|
70
69
|
fontWeight: 700
|
|
71
70
|
},
|
|
72
71
|
variant: "body2",
|
|
73
|
-
children:
|
|
72
|
+
children: G()
|
|
74
73
|
})]
|
|
75
74
|
})
|
|
76
75
|
]
|
|
@@ -80,7 +79,7 @@ var V = ({ data: t, hoveredId: h, isPercentage: g, onMouseEnter: f, onMouseLeave
|
|
|
80
79
|
});
|
|
81
80
|
};
|
|
82
81
|
export {
|
|
83
|
-
|
|
82
|
+
N as InvestementsAllocationChart
|
|
84
83
|
};
|
|
85
84
|
|
|
86
85
|
//# sourceMappingURL=InvestmentsAllocationChart.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InvestmentsAllocationChart.es.js","names":[],"sources":["../../../../src/investments/components/allocation/InvestmentsAllocationChart.tsx"],"sourcesContent":["import React from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { P, Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport
|
|
1
|
+
{"version":3,"file":"InvestmentsAllocationChart.es.js","names":[],"sources":["../../../../src/investments/components/allocation/InvestmentsAllocationChart.tsx"],"sourcesContent":["import React from 'react'\n\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { P, Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\n\nimport Donut from '../../../common/components/charts/Donut'\n\nimport {\n currencyDisplay,\n InvestmentsAllocationData,\n percentageDisplay,\n} from './util/createInvestementsAllocationData'\n\nexport interface DonutData {\n id: string\n label?: string\n color: string\n value: number\n}\nexport interface InvestmentsData {\n investmentsData: InvestmentsAllocationData[]\n donutData: DonutData[]\n totalAmount: number\n totalGainLoss: number\n totalGainLossAvailable: boolean\n totalMarketValue: number\n totalGainLossPercentage: number\n}\ninterface InvestementAllocationProps {\n data: InvestmentsData\n hoveredId?: string\n isPercentage?: boolean\n onSelected: (id: string) => void\n onMouseEnter: (id: string) => void\n onMouseLeave: (id: string) => void\n selectedId?: string\n size?: number\n totalLabel: string\n}\n\nexport const InvestementsAllocationChart: React.FC<InvestementAllocationProps> = ({\n data,\n hoveredId,\n isPercentage,\n onMouseEnter,\n onMouseLeave,\n onSelected,\n selectedId,\n size = 150,\n totalLabel,\n}) => {\n const theme = useTheme()\n const isDarkMode = theme.palette.mode === 'dark'\n\n const selectedInvestments = React.useMemo(\n () =>\n selectedId\n ? data.investmentsData.find(({ guid }: InvestmentsAllocationData) => guid === selectedId)\n : undefined,\n [selectedId],\n )\n const donutData = React.useMemo(() => {\n if (data.donutData.length > 0) return data.donutData\n\n // Empty Donut zero state\n return [{ id: '0', color: theme.palette.neutral.light, value: 100 }]\n }, [data, theme])\n\n const gainDisplayColor = isDarkMode ? '#0AC295' : '#09A57F'\n const lossDisplayColor = isDarkMode ? 'grey.300' : 'grey.700'\n\n const getGainLossDisplay = () => {\n if (selectedInvestments) return percentageDisplay(selectedInvestments.percentage)\n if (!data.totalGainLossAvailable) return '—'\n if (isPercentage) return percentageDisplay(data.totalGainLossPercentage)\n return currencyDisplay(data.totalGainLoss)\n }\n\n const gainLossDisplayColor = selectedInvestments\n ? 'text.secondary'\n : !data.totalGainLossAvailable\n ? 'text.secondary'\n : data.totalGainLoss >= 0\n ? gainDisplayColor\n : lossDisplayColor\n\n return (\n <Donut\n data={donutData}\n hoveredId={hoveredId}\n onClick={onSelected}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n selectedId={selectedId}\n size={size}\n >\n <Stack alignItems=\"center\" height=\"100%\" justifyContent=\"center\" width=\"100%\">\n <Stack alignItems=\"center\" justifyContent=\"center\" minHeight={size} minWidth={size}>\n <Stack alignItems=\"center\" sx={{ gap: { xs: 4, xl: 8 }, mb: { xs: 4, xl: 8 } }}>\n <Text color=\"text.secondary\" noWrap={true}>\n {selectedInvestments?.displayName ?? totalLabel}\n </Text>\n <P color=\"text.primary\" variant=\"h1\">\n {currencyDisplay(selectedInvestments?.value ?? data.totalMarketValue)}\n </P>\n\n <Stack sx={{ alignItems: 'center', flexDirection: 'row', gap: 4 }}>\n {!selectedInvestments && data.totalGainLossAvailable && (\n <Icon\n name={data.totalGainLoss >= 0 ? 'trending_up' : 'trending_down'}\n size={20}\n sx={{ color: gainLossDisplayColor }}\n />\n )}\n <Text\n sx={{\n color: gainLossDisplayColor,\n fontWeight: 700,\n }}\n variant=\"body2\"\n >\n {getGainLossDisplay()}\n </Text>\n </Stack>\n </Stack>\n </Stack>\n </Stack>\n </Donut>\n )\n}\n"],"mappings":";;;;;;;;AA2CA,IAAa,IAAA,CAAqE,EAChF,MAAA,GACA,WAAA,GACA,cAAA,GACA,cAAA,GACA,cAAA,GACA,YAAA,GACA,YAAA,GACA,MAAA,IAAO,KACP,YAAA,EAAA,MACI;AACJ,QAAM,IAAQ,EAAS,GACjB,IAAa,EAAM,QAAQ,SAAS,QAEpC,IAAsB,EAAM,QAAA,MAE9B,IACI,EAAK,gBAAgB,KAAA,CAAM,EAAE,MAAA,EAAA,MAAsC,MAAS,CAAU,IACtF,QACN,CAAC,CAAU,CACb,GACM,IAAY,EAAM,QAAA,MAClB,EAAK,UAAU,SAAS,IAAU,EAAK,YAGpC,CAAC;AAAA,IAAE,IAAI;AAAA,IAAK,OAAO,EAAM,QAAQ,QAAQ;AAAA,IAAO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YAAY;AAAA,gBAAU,eAAe;AAAA,gBAAO,KAAK;AAAA,cAAE;AAAA,cAAhE,UAAA,CACG,CAAC,KAAuB,EAAK,0BAC5B,gBAAA,EAAC,GAAD;AAAA,gBACE,MAAM,EAAK,iBAAiB,IAAI,gBAAgB;AAAA,gBAChD,MAAM;AAAA,gBACN,IAAI,EAAE,OAAO,EAAqB;AAAA,cACnC,CAAA,GAEH,gBAAA,EAAC,GAAD;AAAA,gBACE,IAAI;AAAA,kBACF,OAAO;AAAA,kBACP,YAAY;AAAA,gBACd;AAAA,gBACA,SAAQ;AAAA,gBAEP,UAAA,EAAmB;AAAA,cAChB,CAAA,CACD;AAAA;UACF;AAAA;MACF,CAAA;AAAA,IACF,CAAA;AAAA,EACF,CAAA;AAEX"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { formatCurrency as
|
|
2
|
-
import { ALLOCATION_KEYS as
|
|
3
|
-
import { getHoldingGainLoss as
|
|
4
|
-
var
|
|
1
|
+
import { formatCurrency as b, formatPercentage as M } from "../../../../core/utils/NumberFormatting.es.js";
|
|
2
|
+
import { ALLOCATION_KEYS as N } from "../../../../core/constants/Investments.es.js";
|
|
3
|
+
import { getHoldingGainLoss as h, getHoldingMarketValue as D } from "../../../../core/utils/InvestmentUtil.es.js";
|
|
4
|
+
var O = {
|
|
5
5
|
allocations_cash: "#AEDCCC",
|
|
6
6
|
allocations_convertible: "#80CAD0",
|
|
7
7
|
allocations_foreign_bond: "#51B9D4",
|
|
@@ -11,88 +11,115 @@ var G = {
|
|
|
11
11
|
allocations_unknown: "#161D6A",
|
|
12
12
|
allocations_us_bond: "#254995",
|
|
13
13
|
allocations_us_stock: "#1E2D84"
|
|
14
|
-
},
|
|
15
|
-
const
|
|
16
|
-
return e >= Math.min(
|
|
17
|
-
},
|
|
18
|
-
const
|
|
19
|
-
let
|
|
20
|
-
return
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
return
|
|
14
|
+
}, F = N.map((e) => ({ name: e })), y = "allocations_unclassified", P = "#B7BFC9", T = (e, r, i) => {
|
|
15
|
+
const p = i === void 0 ? 0 : r, n = i === void 0 ? r : i;
|
|
16
|
+
return e >= Math.min(p, n) && e < Math.max(p, n);
|
|
17
|
+
}, U = (e, r, i) => {
|
|
18
|
+
const p = [...new Set(e.map((c) => c.name.toLowerCase()))];
|
|
19
|
+
let n;
|
|
20
|
+
return p.map((c) => {
|
|
21
|
+
const v = e.reduce((m, o) => {
|
|
22
|
+
const L = o.name;
|
|
23
|
+
return L.toLowerCase() === c ? (n = L, D(o) * o[r] / 100 + m) : m;
|
|
24
24
|
}, 0);
|
|
25
25
|
return {
|
|
26
|
-
displayName:
|
|
27
|
-
name:
|
|
28
|
-
value:
|
|
29
|
-
percentage:
|
|
26
|
+
displayName: n,
|
|
27
|
+
name: n,
|
|
28
|
+
value: v,
|
|
29
|
+
percentage: v / i
|
|
30
30
|
};
|
|
31
31
|
});
|
|
32
|
-
},
|
|
33
|
-
const
|
|
32
|
+
}, K = (e, r, i) => {
|
|
33
|
+
const p = Object.values(r.allocations_list), n = [];
|
|
34
34
|
let c = 0;
|
|
35
|
-
const
|
|
35
|
+
const v = new Set(e.map(({ guid: a }) => a)), m = i.filter(({ account_guid: a }) => v.has(a)).map((a) => ({
|
|
36
36
|
...a,
|
|
37
37
|
name: a.symbol || a.description,
|
|
38
|
-
gainLoss:
|
|
39
|
-
})), { cashBalance: o, totalAccountBalance:
|
|
40
|
-
cashBalance: a.cashBalance + (
|
|
41
|
-
totalAccountBalance: a.totalAccountBalance + (
|
|
38
|
+
gainLoss: h(a).gainLoss
|
|
39
|
+
})), { cashBalance: o, totalAccountBalance: L } = e.reduce((a, t) => ({
|
|
40
|
+
cashBalance: a.cashBalance + (t.cash_balance || 0),
|
|
41
|
+
totalAccountBalance: a.totalAccountBalance + (t.balance || 0)
|
|
42
42
|
}), {
|
|
43
43
|
cashBalance: 0,
|
|
44
44
|
totalAccountBalance: 0
|
|
45
|
-
}), { marketValue:
|
|
46
|
-
marketValue: a.marketValue +
|
|
47
|
-
totalGainLoss: a.totalGainLoss +
|
|
45
|
+
}), { marketValue: S, totalGainLoss: C } = m.reduce((a, t) => ({
|
|
46
|
+
marketValue: a.marketValue + D(t),
|
|
47
|
+
totalGainLoss: a.totalGainLoss + t.gainLoss
|
|
48
48
|
}), {
|
|
49
49
|
marketValue: 0,
|
|
50
50
|
totalGainLoss: 0
|
|
51
|
-
}),
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
51
|
+
}), u = S + o, k = (a, t) => {
|
|
52
|
+
const d = [...new Set(a.map((g) => g.name.toLowerCase()))], s = [];
|
|
53
|
+
return d.forEach((g) => {
|
|
54
|
+
let l = "";
|
|
55
|
+
const _ = a.reduce((B, A) => {
|
|
56
|
+
if (A.name.toLowerCase() !== g) return B;
|
|
57
|
+
l = A.name;
|
|
58
|
+
const G = N.reduce((H, I) => H + (Number(A[I]) || 0), 0), V = Math.max(0, 100 - G) / 100;
|
|
59
|
+
return B + D(A) * V;
|
|
60
|
+
}, 0);
|
|
61
|
+
_ > 0.01 && s.push({
|
|
62
|
+
displayName: l,
|
|
63
|
+
name: l,
|
|
64
|
+
value: _,
|
|
65
|
+
percentage: t > 0 ? _ / t : 0
|
|
66
|
+
});
|
|
67
|
+
}), s;
|
|
68
|
+
};
|
|
69
|
+
F.forEach((a, t) => {
|
|
70
|
+
const d = m.filter((l) => !!l[a.name]);
|
|
71
|
+
let s = d.reduce((l, _) => l + D(_) * _[a.name] / 100, 0);
|
|
72
|
+
const g = U(d, a.name, s);
|
|
56
73
|
if (a.name === "allocations_cash" && o > 0) {
|
|
57
74
|
s += o;
|
|
58
|
-
const
|
|
59
|
-
displayName:
|
|
75
|
+
const l = {
|
|
76
|
+
displayName: r.cash_balance_display_name,
|
|
60
77
|
name: "allocations_name",
|
|
61
78
|
value: o,
|
|
62
|
-
percentage: o /
|
|
79
|
+
percentage: o / u
|
|
63
80
|
};
|
|
64
|
-
|
|
81
|
+
g.push(l);
|
|
65
82
|
}
|
|
66
|
-
s > 0 && (
|
|
83
|
+
s > 0 && (n.push({
|
|
67
84
|
name: a.name,
|
|
68
|
-
displayName:
|
|
69
|
-
guid: `${a.name}-${
|
|
70
|
-
holdings:
|
|
71
|
-
percentage: s /
|
|
85
|
+
displayName: p[t],
|
|
86
|
+
guid: `${a.name}-${t}`,
|
|
87
|
+
holdings: g,
|
|
88
|
+
percentage: s / u,
|
|
72
89
|
value: s,
|
|
73
|
-
color:
|
|
90
|
+
color: O[a.name]
|
|
74
91
|
}), c += s);
|
|
75
92
|
});
|
|
76
|
-
const
|
|
77
|
-
|
|
78
|
-
|
|
93
|
+
const f = u - c;
|
|
94
|
+
f > 0.01 && (n.push({
|
|
95
|
+
name: y,
|
|
96
|
+
displayName: r.unclassified_display_name,
|
|
97
|
+
guid: y,
|
|
98
|
+
holdings: k(m, f),
|
|
99
|
+
percentage: f / u,
|
|
100
|
+
value: f,
|
|
101
|
+
color: P
|
|
102
|
+
}), c += f);
|
|
103
|
+
const E = n.map(({ displayName: a, guid: t, color: d, value: s }) => ({
|
|
104
|
+
id: t,
|
|
105
|
+
color: d,
|
|
79
106
|
label: a,
|
|
80
|
-
value: s /
|
|
81
|
-
})),
|
|
107
|
+
value: u > 0 ? s / u * 100 : 0
|
|
108
|
+
})), w = m.some((a) => h(a).available);
|
|
82
109
|
return {
|
|
83
|
-
investmentsData:
|
|
84
|
-
donutData:
|
|
110
|
+
investmentsData: n,
|
|
111
|
+
donutData: E,
|
|
85
112
|
totalAmount: c,
|
|
86
|
-
totalGainLoss:
|
|
87
|
-
totalGainLossAvailable:
|
|
88
|
-
totalMarketValue:
|
|
89
|
-
totalGainLossPercentage:
|
|
113
|
+
totalGainLoss: C,
|
|
114
|
+
totalGainLossAvailable: w,
|
|
115
|
+
totalMarketValue: u,
|
|
116
|
+
totalGainLossPercentage: C / L
|
|
90
117
|
};
|
|
91
|
-
},
|
|
118
|
+
}, R = (e) => e < 1e-3 ? "< 0.1%" : M(e), Y = (e) => e === 0 ? b(e, "0,0.00") : T(e, -0.01, 0.01) ? "< $0.01" : b(e, "0,0.00");
|
|
92
119
|
export {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
120
|
+
K as createInvestmentsAllocationData,
|
|
121
|
+
Y as currencyDisplay,
|
|
122
|
+
R as percentageDisplay
|
|
96
123
|
};
|
|
97
124
|
|
|
98
125
|
//# sourceMappingURL=createInvestementsAllocationData.es.js.map
|
package/dist/investments/components/allocation/util/createInvestementsAllocationData.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createInvestementsAllocationData.es.js","names":[],"sources":["../../../../../src/investments/components/allocation/util/createInvestementsAllocationData.tsx"],"sourcesContent":["import { Account, Holding } from '../../../../core'\nimport { ALLOCATION_KEYS, type AllocationKey } from '../../../../core/constants/Investments'\nimport { InvestmentAllocationCopy } from '../../../../core/types/localization/InvestmentsCopy'\nimport type { DonutData } from '../InvestmentsAllocationChart'\nimport { formatCurrency, formatPercentage } from '../../../../core/utils/NumberFormatting'\nimport { getHoldingGainLoss, getHoldingMarketValue } from '../../../../core/utils/InvestmentUtil'\n\nexport interface InvestmentsAllocationData {\n name: string\n displayName: string\n guid: string\n holdings: InvestmentAllocationTotals[]\n percentage: number\n value: number\n color: string\n}\nexport interface InvestmentAllocationTotals {\n displayName: string\n name: string\n value: number\n percentage: number\n}\n\nconst allocationColors: Record<AllocationKey, string> = {\n allocations_cash: '#AEDCCC',\n allocations_convertible: '#80CAD0',\n allocations_foreign_bond: '#51B9D4',\n allocations_foreign_stock: '#3DA0C9',\n allocations_other: '#3583B8',\n allocations_preferred: '#2D66A7',\n allocations_unknown: '#161D6A',\n allocations_us_bond: '#254995',\n allocations_us_stock: '#1E2D84',\n}\nconst allocationsList = ALLOCATION_KEYS.map((name) => ({ name }))\n\nconst inRange = (n: number, start: number, end?: number) => {\n const rangeStart = end === undefined ? 0 : start\n const rangeEnd = end === undefined ? start : end\n return n >= Math.min(rangeStart, rangeEnd) && n < Math.max(rangeStart, rangeEnd)\n}\n\nconst createHoldingsData = (\n holdings: Holding[],\n allocationName: string,\n allocationValue: number,\n) => {\n const uniqueHoldings = [\n ...new Set(holdings.map((holding: Holding) => holding.name.toLowerCase())),\n ]\n let displayName: string\n const investmentAllocationTotals = uniqueHoldings.map((holdingName) => {\n // sum all the holdings with the same \"name\"\n const holdingsTotalValue = holdings.reduce((acc, hold: Holding) => {\n const name = hold.name\n\n if (name.toLowerCase() === holdingName) {\n // Since we lose the capitalization with the unique names, we take it from the last match.\n displayName = name\n return (\n (getHoldingMarketValue(hold) * hold[allocationName as keyof typeof allocationColors]) /\n 100 +\n acc\n )\n }\n\n return acc\n }, 0)\n\n return {\n displayName,\n name: displayName,\n value: holdingsTotalValue,\n percentage: holdingsTotalValue / allocationValue,\n }\n })\n return investmentAllocationTotals\n}\n\nexport const createInvestmentsAllocationData = (\n accounts: Account[],\n copy: InvestmentAllocationCopy,\n holdings: Holding[],\n) => {\n const allocationListDisplayNames = Object.values(copy.allocations_list)\n const investementAllocationData: InvestmentsAllocationData[] = []\n\n let totalAmount = 0\n\n const accountGuids = new Set(accounts.map(({ guid }) => guid))\n const updatedHoldings: Holding[] = holdings\n .filter(({ account_guid }) => accountGuids.has(account_guid))\n .map((eachHolding) => {\n return {\n ...eachHolding,\n name: eachHolding.symbol || eachHolding.description,\n // Falls back to purchase_price when cost_basis is unset, and contributes\n // 0 (not a fabricated gain) only when no basis is known at all.\n gainLoss: getHoldingGainLoss(eachHolding).gainLoss,\n }\n })\n\n const { cashBalance, totalAccountBalance } = accounts.reduce(\n (sum, account) => {\n return {\n cashBalance: sum.cashBalance + (account.cash_balance || 0),\n totalAccountBalance: sum.totalAccountBalance + (account.balance || 0),\n }\n },\n { cashBalance: 0, totalAccountBalance: 0 },\n )\n const { marketValue, totalGainLoss } = updatedHoldings.reduce(\n (acc, holding) => {\n return {\n marketValue: acc.marketValue + getHoldingMarketValue(holding),\n totalGainLoss: acc.totalGainLoss + holding.gainLoss,\n }\n },\n { marketValue: 0, totalGainLoss: 0 },\n )\n const totalMarketValue = marketValue + cashBalance\n\n allocationsList.forEach((allocation, index) => {\n const filteredHoldings = updatedHoldings.filter(\n (eachHolding) => !!eachHolding[allocation.name as keyof typeof allocationColors],\n )\n let holdingsTotal = filteredHoldings.reduce(\n (sum, holding) =>\n sum +\n (getHoldingMarketValue(holding) *\n holding[allocation.name as keyof typeof allocationColors]) /\n 100,\n 0,\n )\n const investmentAllocationTotals = createHoldingsData(\n filteredHoldings,\n allocation.name,\n holdingsTotal,\n )\n if (allocation.name === 'allocations_cash' && cashBalance > 0) {\n // Updating holdingsTotal to include cash balance\n // This affects the holdingsTotal and percentage for this allocation\n holdingsTotal += cashBalance\n\n // Creating a holding item for cash balance\n const cashBalanceHolding = {\n displayName: copy.cash_balance_display_name,\n name: 'allocations_name',\n value: cashBalance,\n percentage: cashBalance / totalMarketValue,\n }\n\n investmentAllocationTotals.push(cashBalanceHolding)\n }\n\n // Shows allocation if holdingsTotal is greater than zero\n if (holdingsTotal > 0) {\n investementAllocationData.push({\n name: allocation.name,\n displayName: allocationListDisplayNames[index],\n guid: `${allocation.name}-${index}`,\n holdings: investmentAllocationTotals,\n percentage: holdingsTotal / totalMarketValue,\n value: holdingsTotal,\n color: allocationColors[allocation.name as keyof typeof allocationColors],\n })\n totalAmount += holdingsTotal\n }\n })\n const donutData: DonutData[] = investementAllocationData.map(\n ({ displayName, guid, color, value }) => ({\n id: guid,\n color: color,\n label: displayName,\n value: (value / totalAmount) * 100,\n }),\n )\n\n // When no holding in the filtered set has a known basis, the donut center\n // renders \"—\" rather than a fabricated $0.00 / 0% gain.\n const totalGainLossAvailable = updatedHoldings.some(\n (holding) => getHoldingGainLoss(holding).available,\n )\n\n return {\n investmentsData: investementAllocationData,\n donutData,\n totalAmount,\n totalGainLoss,\n totalGainLossAvailable,\n totalMarketValue,\n totalGainLossPercentage: totalGainLoss / totalAccountBalance,\n }\n}\n\nexport const percentageDisplay = (value: number) =>\n value < 0.001 ? '< 0.1%' : formatPercentage(value)\n\nexport const currencyDisplay = (value: number) => {\n if (value === 0) return formatCurrency(value, '0,0.00')\n return inRange(value, -0.01, 0.01) ? '< $0.01' : formatCurrency(value, '0,0.00')\n}\n"],"mappings":";;;AAuBA,IAAM,IAAkD;AAAA,EACtD,kBAAkB;AAAA,EAClB,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,sBAAsB;AACxB,GACM,IAAkB,EAAgB,IAAA,CAAK,OAAU,EAAE,MAAA,EAAK,EAAE,GAE1D,IAAA,CAAW,GAAW,GAAe,MAAiB;AAC1D,QAAM,IAAa,MAAQ,SAAY,IAAI,GACrC,IAAW,MAAQ,SAAY,IAAQ;AAC7C,SAAO,KAAK,KAAK,IAAI,GAAY,CAAQ,KAAK,IAAI,KAAK,IAAI,GAAY,CAAQ;AACjF,GAEM,IAAA,CACJ,GACA,GACA,MACG;AACH,QAAM,IAAiB,CACrB,GAAG,IAAI,IAAI,EAAS,IAAA,CAAK,MAAqB,EAAQ,KAAK,YAAY,CAAC,CAAC,CAC3E;AACA,MAAI;AA0BJ,SAzBmC,EAAe,IAAA,CAAK,MAAgB;AAErE,UAAM,IAAqB,EAAS,OAAA,CAAQ,GAAK,MAAkB;AACjE,YAAM,IAAO,EAAK;AAElB,aAAI,EAAK,YAAY,MAAM,KAEzB,IAAc,GAEX,EAAsB,CAAI,IAAI,EAAK,CAAA,IAClC,MACF,KAIG;AAAA,IACT,GAAG,CAAC;AAEJ,WAAO;AAAA,MACL,aAAA;AAAA,MACA,MAAM;AAAA,MACN,OAAO;AAAA,MACP,YAAY,IAAqB;AAAA,IACnC;AAAA,EACF,CACO;AACT,GAEa,IAAA,CACX,GACA,GACA,MACG;AACH,QAAM,IAA6B,OAAO,OAA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K;AAAA,QAClB,MAAM;AAAA,QACN,OAAO;AAAA,QACP,YAAY,IAAc;AAAA,MAC5B;AAEA,MAAA,EAA2B,KAAK,CAAkB;AAAA,IACpD;AAGA,IAAI,IAAgB,MAClB,EAA0B,KAAK;AAAA,MAC7B,MAAM,EAAW;AAAA,MACjB,aAAa,EAA2B,CAAA;AAAA,MACxC,MAAM,GAAG,EAAW,IAAA,IAAQ,CAAA;AAAA,MAC5B,UAAU;AAAA,MACV,YAAY,IAAgB;AAAA,MAC5B,OAAO;AAAA,MACP,OAAO,EAAiB,EAAW,IAAA;AAAA,IACrC,CAAC,GACD,KAAe;AAAA,EAEnB,CAAC;AACD,QAAM,IAAyB,EAA0B,IAAA,CACtD,EAAE,aAAA,GAAa,MAAA,GAAM,OAAA,GAAO,OAAA,EAAA,OAAa;AAAA,IACxC,IAAI;AAAA,IACG,OAAA;AAAA,IACP,OAAO;AAAA,IACP,OAAQ,IAAQ,IAAe;AAAA,EACjC,EACF,GAIM,IAAyB,EAAgB,KAAA,CAC5C,MAAY,EAAmB,CAAO,EAAE,SAC3C;AAEA,SAAO;AAAA,IACL,iBAAiB;AAAA,IACjB,WAAA;AAAA,IACA,aAAA;AAAA,IACA,eAAA;AAAA,IACA,wBAAA;AAAA,IACA,kBAAA;AAAA,IACA,yBAAyB,IAAgB;AAAA,EAC3C;AACF,GAEa,IAAA,CAAqB,MAChC,IAAQ,OAAQ,WAAW,EAAiB,CAAK,GAEtC,IAAA,CAAmB,MAC1B,MAAU,IAAU,EAAe,GAAO,QAAQ,IAC/C,EAAQ,GAAO,OAAO,IAAI,IAAI,YAAY,EAAe,GAAO,QAAQ"}
|
|
1
|
+
{"version":3,"file":"createInvestementsAllocationData.es.js","names":[],"sources":["../../../../../src/investments/components/allocation/util/createInvestementsAllocationData.tsx"],"sourcesContent":["import { Account, Holding } from '../../../../core'\nimport { ALLOCATION_KEYS, type AllocationKey } from '../../../../core/constants/Investments'\nimport { InvestmentAllocationCopy } from '../../../../core/types/localization/InvestmentsCopy'\nimport type { DonutData } from '../InvestmentsAllocationChart'\nimport { formatCurrency, formatPercentage } from '../../../../core/utils/NumberFormatting'\nimport { getHoldingGainLoss, getHoldingMarketValue } from '../../../../core/utils/InvestmentUtil'\n\nexport interface InvestmentsAllocationData {\n name: string\n displayName: string\n guid: string\n holdings: InvestmentAllocationTotals[]\n percentage: number\n value: number\n color: string\n}\nexport interface InvestmentAllocationTotals {\n displayName: string\n name: string\n value: number\n percentage: number\n}\n\nconst allocationColors: Record<AllocationKey, string> = {\n allocations_cash: '#AEDCCC',\n allocations_convertible: '#80CAD0',\n allocations_foreign_bond: '#51B9D4',\n allocations_foreign_stock: '#3DA0C9',\n allocations_other: '#3583B8',\n allocations_preferred: '#2D66A7',\n allocations_unknown: '#161D6A',\n allocations_us_bond: '#254995',\n allocations_us_stock: '#1E2D84',\n}\nconst allocationsList = ALLOCATION_KEYS.map((name) => ({ name }))\n\n// Synthetic bucket for the portion of holdings with no Morningstar asset-class\n// data. The money IS invested (the slice expands into real holdings); we just\n// can't break it into stock/bond/cash — hence \"Unclassified\", not \"Unallocated\".\nconst UNCLASSIFIED_KEY = 'allocations_unclassified'\nconst UNCLASSIFIED_COLOR = '#B7BFC9'\n\nconst inRange = (n: number, start: number, end?: number) => {\n const rangeStart = end === undefined ? 0 : start\n const rangeEnd = end === undefined ? start : end\n return n >= Math.min(rangeStart, rangeEnd) && n < Math.max(rangeStart, rangeEnd)\n}\n\nconst createHoldingsData = (\n holdings: Holding[],\n allocationName: string,\n allocationValue: number,\n) => {\n const uniqueHoldings = [\n ...new Set(holdings.map((holding: Holding) => holding.name.toLowerCase())),\n ]\n let displayName: string\n const investmentAllocationTotals = uniqueHoldings.map((holdingName) => {\n // sum all the holdings with the same \"name\"\n const holdingsTotalValue = holdings.reduce((acc, hold: Holding) => {\n const name = hold.name\n\n if (name.toLowerCase() === holdingName) {\n // Since we lose the capitalization with the unique names, we take it from the last match.\n displayName = name\n return (\n (getHoldingMarketValue(hold) * hold[allocationName as keyof typeof allocationColors]) /\n 100 +\n acc\n )\n }\n\n return acc\n }, 0)\n\n return {\n displayName,\n name: displayName,\n value: holdingsTotalValue,\n percentage: holdingsTotalValue / allocationValue,\n }\n })\n return investmentAllocationTotals\n}\n\nexport const createInvestmentsAllocationData = (\n accounts: Account[],\n copy: InvestmentAllocationCopy,\n holdings: Holding[],\n) => {\n const allocationListDisplayNames = Object.values(copy.allocations_list)\n const investementAllocationData: InvestmentsAllocationData[] = []\n\n let totalAmount = 0\n\n const accountGuids = new Set(accounts.map(({ guid }) => guid))\n const updatedHoldings: Holding[] = holdings\n .filter(({ account_guid }) => accountGuids.has(account_guid))\n .map((eachHolding) => {\n return {\n ...eachHolding,\n name: eachHolding.symbol || eachHolding.description,\n // Falls back to purchase_price when cost_basis is unset, and contributes\n // 0 (not a fabricated gain) only when no basis is known at all.\n gainLoss: getHoldingGainLoss(eachHolding).gainLoss,\n }\n })\n\n const { cashBalance, totalAccountBalance } = accounts.reduce(\n (sum, account) => {\n return {\n cashBalance: sum.cashBalance + (account.cash_balance || 0),\n totalAccountBalance: sum.totalAccountBalance + (account.balance || 0),\n }\n },\n { cashBalance: 0, totalAccountBalance: 0 },\n )\n const { marketValue, totalGainLoss } = updatedHoldings.reduce(\n (acc, holding) => {\n return {\n marketValue: acc.marketValue + getHoldingMarketValue(holding),\n totalGainLoss: acc.totalGainLoss + holding.gainLoss,\n }\n },\n { marketValue: 0, totalGainLoss: 0 },\n )\n const totalMarketValue = marketValue + cashBalance\n\n // The unclassified portion of each holding (allocation weights sum to < 100%),\n // grouped by name so the slice can expand in the legend like a real bucket.\n const createUnclassifiedHoldingsData = (holdings: Holding[], unclassifiedTotal: number) => {\n const uniqueHoldings = [...new Set(holdings.map((holding) => holding.name.toLowerCase()))]\n const totals: InvestmentAllocationTotals[] = []\n\n uniqueHoldings.forEach((holdingName) => {\n let displayName = ''\n const unclassifiedValue = holdings.reduce((acc, hold) => {\n if (hold.name.toLowerCase() !== holdingName) return acc\n displayName = hold.name\n const allocationSum = ALLOCATION_KEYS.reduce(\n (sum, key) => sum + (Number(hold[key]) || 0),\n 0,\n )\n const unclassifiedPercentage = Math.max(0, 100 - allocationSum) / 100\n return acc + getHoldingMarketValue(hold) * unclassifiedPercentage\n }, 0)\n\n // Guard with the same sub-cent epsilon as the outer slice so a\n // fully-classified holding whose weights sum to ~100 (float error) doesn't\n // produce a phantom \"< $0.01\" row in the breakdown.\n if (unclassifiedValue > 0.01) {\n totals.push({\n displayName,\n name: displayName,\n value: unclassifiedValue,\n percentage: unclassifiedTotal > 0 ? unclassifiedValue / unclassifiedTotal : 0,\n })\n }\n })\n\n return totals\n }\n\n allocationsList.forEach((allocation, index) => {\n const filteredHoldings = updatedHoldings.filter(\n (eachHolding) => !!eachHolding[allocation.name as keyof typeof allocationColors],\n )\n let holdingsTotal = filteredHoldings.reduce(\n (sum, holding) =>\n sum +\n (getHoldingMarketValue(holding) *\n holding[allocation.name as keyof typeof allocationColors]) /\n 100,\n 0,\n )\n const investmentAllocationTotals = createHoldingsData(\n filteredHoldings,\n allocation.name,\n holdingsTotal,\n )\n if (allocation.name === 'allocations_cash' && cashBalance > 0) {\n // Updating holdingsTotal to include cash balance\n // This affects the holdingsTotal and percentage for this allocation\n holdingsTotal += cashBalance\n\n // Creating a holding item for cash balance\n const cashBalanceHolding = {\n displayName: copy.cash_balance_display_name,\n name: 'allocations_name',\n value: cashBalance,\n percentage: cashBalance / totalMarketValue,\n }\n\n investmentAllocationTotals.push(cashBalanceHolding)\n }\n\n // Shows allocation if holdingsTotal is greater than zero\n if (holdingsTotal > 0) {\n investementAllocationData.push({\n name: allocation.name,\n displayName: allocationListDisplayNames[index],\n guid: `${allocation.name}-${index}`,\n holdings: investmentAllocationTotals,\n percentage: holdingsTotal / totalMarketValue,\n value: holdingsTotal,\n color: allocationColors[allocation.name as keyof typeof allocationColors],\n })\n totalAmount += holdingsTotal\n }\n })\n // Without this, holdings lacking asset-class data are dropped from the ring,\n // scaling the buckets that DO have data up to a misleading 100%. Surface the\n // gap as an explicit slice so the ring matches the center total and legend.\n const unclassifiedAmount = totalMarketValue - totalAmount\n if (unclassifiedAmount > 0.01) {\n investementAllocationData.push({\n name: UNCLASSIFIED_KEY,\n displayName: copy.unclassified_display_name,\n guid: UNCLASSIFIED_KEY,\n holdings: createUnclassifiedHoldingsData(updatedHoldings, unclassifiedAmount),\n percentage: unclassifiedAmount / totalMarketValue,\n value: unclassifiedAmount,\n color: UNCLASSIFIED_COLOR,\n })\n totalAmount += unclassifiedAmount\n }\n\n const donutData: DonutData[] = investementAllocationData.map(\n ({ displayName, guid, color, value }) => ({\n id: guid,\n color: color,\n label: displayName,\n value: totalMarketValue > 0 ? (value / totalMarketValue) * 100 : 0,\n }),\n )\n\n // When no holding in the filtered set has a known basis, the donut center\n // renders \"—\" rather than a fabricated $0.00 / 0% gain.\n const totalGainLossAvailable = updatedHoldings.some(\n (holding) => getHoldingGainLoss(holding).available,\n )\n\n return {\n investmentsData: investementAllocationData,\n donutData,\n totalAmount,\n totalGainLoss,\n totalGainLossAvailable,\n totalMarketValue,\n totalGainLossPercentage: totalGainLoss / totalAccountBalance,\n }\n}\n\nexport const percentageDisplay = (value: number) =>\n value < 0.001 ? '< 0.1%' : formatPercentage(value)\n\nexport const currencyDisplay = (value: number) => {\n if (value === 0) return formatCurrency(value, '0,0.00')\n return inRange(value, -0.01, 0.01) ? '< $0.01' : formatCurrency(value, '0,0.00')\n}\n"],"mappings":";;;AAuBA,IAAM,IAAkD;AAAA,EACtD,kBAAkB;AAAA,EAClB,yBAAyB;AAAA,EACzB,0BAA0B;AAAA,EAC1B,2BAA2B;AAAA,EAC3B,mBAAmB;AAAA,EACnB,uBAAuB;AAAA,EACvB,qBAAqB;AAAA,EACrB,qBAAqB;AAAA,EACrB,sBAAsB;AACxB,GACM,IAAkB,EAAgB,IAAA,CAAK,OAAU,EAAE,MAAA,EAAK,EAAE,GAK1D,IAAmB,4BACnB,IAAqB,WAErB,IAAA,CAA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A,IACjB,WAAA;AAAA,IACA,aAAA;AAAA,IACA,eAAA;AAAA,IACA,wBAAA;AAAA,IACA,kBAAA;AAAA,IACA,yBAAyB,IAAgB;AAAA,EAC3C;AACF,GAEa,IAAA,CAAqB,MAChC,IAAQ,OAAQ,WAAW,EAAiB,CAAK,GAEtC,IAAA,CAAmB,MAC1B,MAAU,IAAU,EAAe,GAAO,QAAQ,IAC/C,EAAQ,GAAO,OAAO,IAAI,IAAI,YAAY,EAAe,GAAO,QAAQ"}
|
package/dist/rum/rum.es.js
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
1
|
+
var s = /(\/(?:md\/[^/?#]+|login)\/)[^?#]+/g, t = (e) => typeof e == "string" ? e.replace(s, "$1REDACTED") : e, i = /* @__PURE__ */ new Set([
|
|
2
|
+
"xhr",
|
|
3
|
+
"fetch",
|
|
4
|
+
"document"
|
|
5
|
+
]);
|
|
6
|
+
function c({ scrubSsoPaths: e = !1 } = {}) {
|
|
3
7
|
return (r) => {
|
|
4
|
-
if (e && (r.view.url =
|
|
8
|
+
if (e && (r.view.url = t(r.view.url), r.view.referrer = t(r.view.referrer), r.type === "resource" && (r.resource.url = t(r.resource.url)), r.type === "error" && r.error.resource && (r.error.resource.url = t(r.error.resource.url))), r.type !== "resource" || i.has(r.resource.type)) return !0;
|
|
5
9
|
const u = r.resource.status_code;
|
|
6
10
|
return !(u !== void 0 && u > 0 && u < 400);
|
|
7
11
|
};
|
|
8
12
|
}
|
|
9
|
-
var
|
|
10
|
-
function
|
|
13
|
+
var f = 50;
|
|
14
|
+
function l(e = 50) {
|
|
11
15
|
const r = [];
|
|
12
16
|
return {
|
|
13
17
|
push(u, o) {
|
|
@@ -28,10 +32,10 @@ function f(e = 50) {
|
|
|
28
32
|
};
|
|
29
33
|
}
|
|
30
34
|
export {
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
f as DEFAULT_RUM_ERROR_BUFFER_SIZE,
|
|
36
|
+
c as buildRumBeforeSend,
|
|
37
|
+
l as createRumErrorBuffer,
|
|
38
|
+
t as redactSsoPath
|
|
35
39
|
};
|
|
36
40
|
|
|
37
41
|
//# sourceMappingURL=rum.es.js.map
|
package/dist/rum/rum.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rum.es.js","names":[],"sources":["../../src/rum/rum.ts"],"sourcesContent":["import type { RumEvent, RumInitConfiguration } from '@datadog/browser-rum'\n\n// scrub the really long sso token because it's unhelpful and noisy in events\nconst SSO_PATH_PATTERN = /(\\/(?:md\\/[^/?#]+|login)\\/)[^?#]+/g\n\nexport const redactSsoPath = <T extends string | undefined>(value: T): T =>\n typeof value === 'string' ? (value.replace(SSO_PATH_PATTERN, '$1REDACTED') as T) : value\n\nexport interface RumBeforeSendOptions {\n scrubSsoPaths?: boolean\n}\n\n// runs on every RUM event before it is sent to Datadog\nexport function buildRumBeforeSend({\n scrubSsoPaths = false,\n}: RumBeforeSendOptions = {}): NonNullable<RumInitConfiguration['beforeSend']> {\n return (event: RumEvent) => {\n if (scrubSsoPaths) {\n event.view.url = redactSsoPath(event.view.url)\n event.view.referrer = redactSsoPath(event.view.referrer)\n if (event.type === 'resource') event.resource.url = redactSsoPath(event.resource.url)\n if (event.type === 'error' && event.error.resource) {\n event.error.resource.url = redactSsoPath(event.error.resource.url)\n }\n }\n\n if (event.type !== 'resource') return true\n if (
|
|
1
|
+
{"version":3,"file":"rum.es.js","names":[],"sources":["../../src/rum/rum.ts"],"sourcesContent":["import type { RumEvent, RumInitConfiguration } from '@datadog/browser-rum'\n\n// scrub the really long sso token because it's unhelpful and noisy in events\nconst SSO_PATH_PATTERN = /(\\/(?:md\\/[^/?#]+|login)\\/)[^?#]+/g\n\nexport const redactSsoPath = <T extends string | undefined>(value: T): T =>\n typeof value === 'string' ? (value.replace(SSO_PATH_PATTERN, '$1REDACTED') as T) : value\n\nexport interface RumBeforeSendOptions {\n scrubSsoPaths?: boolean\n}\n\n// API calls and the page's own navigation timing are always kept; only successful static assets are dropped\nconst KEPT_RESOURCE_TYPES = new Set(['xhr', 'fetch', 'document'])\n\n// runs on every RUM event before it is sent to Datadog\nexport function buildRumBeforeSend({\n scrubSsoPaths = false,\n}: RumBeforeSendOptions = {}): NonNullable<RumInitConfiguration['beforeSend']> {\n return (event: RumEvent) => {\n if (scrubSsoPaths) {\n event.view.url = redactSsoPath(event.view.url)\n event.view.referrer = redactSsoPath(event.view.referrer)\n if (event.type === 'resource') event.resource.url = redactSsoPath(event.resource.url)\n if (event.type === 'error' && event.error.resource) {\n event.error.resource.url = redactSsoPath(event.error.resource.url)\n }\n }\n\n if (event.type !== 'resource') return true\n if (KEPT_RESOURCE_TYPES.has(event.resource.type)) return true\n const status = event.resource.status_code\n return !(status !== undefined && status > 0 && status < 400)\n }\n}\n\n// Holds errors that happen before Datadog RUM has started up, so they aren't lost\nexport interface RumErrorBuffer<Context = Record<string, unknown>> {\n push(error: unknown, context?: Context): boolean\n flush(send: (error: unknown, context?: Context) => void): void\n readonly size: number\n}\n\nexport const DEFAULT_RUM_ERROR_BUFFER_SIZE = 50\n\nexport function createRumErrorBuffer<Context = Record<string, unknown>>(\n maxSize: number = DEFAULT_RUM_ERROR_BUFFER_SIZE,\n): RumErrorBuffer<Context> {\n const items: Array<{ error: unknown; context?: Context }> = []\n return {\n push(error, context) {\n if (items.length >= maxSize) return false\n items.push({ error, context })\n return true\n },\n flush(send) {\n while (items.length > 0) {\n const item = items.shift()\n if (item) send(item.error, item.context)\n }\n },\n get size() {\n return items.length\n },\n }\n}\n"],"mappings":"AAGA,IAAM,IAAmB,sCAEZ,IAAA,CAA+C,MAC1D,OAAO,KAAU,WAAY,EAAM,QAAQ,GAAkB,YAAY,IAAU,GAO/E,IAAsB,oBAAI,IAAI;AAAA,EAAC;AAAA,EAAO;AAAA,EAAS;AAAU,CAAC;AAGhE,SAAgB,EAAmB,EACjC,eAAA,IAAgB,GAAA,IACQ,CA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