@mx-cartographer/experiences 9.4.31 → 9.4.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +11 -0
  2. package/dist/core/api/AccountApi.d.ts +3 -2
  3. package/dist/core/api/AccountApi.es.js +1 -0
  4. package/dist/core/api/AccountApi.es.js.map +1 -1
  5. package/dist/core/stores/NetWorthStore.d.ts +3 -0
  6. package/dist/core/stores/NetWorthStore.es.js +30 -18
  7. package/dist/core/stores/NetWorthStore.es.js.map +1 -1
  8. package/dist/core/types/Account.d.ts +10 -0
  9. package/dist/core/types/Account.es.js.map +1 -1
  10. package/dist/core/types/Insights.d.ts +4 -0
  11. package/dist/core/types/index.d.ts +1 -1
  12. package/dist/core/utils/NetWorthUtils.d.ts +2 -1
  13. package/dist/core/utils/NetWorthUtils.es.js +58 -46
  14. package/dist/core/utils/NetWorthUtils.es.js.map +1 -1
  15. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +20 -19
  16. package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
  17. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js +34 -31
  18. package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/BarchartBlock.es.js.map +1 -1
  19. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js +21 -18
  20. package/dist/insights-v2/blocks/ChartBlocks/DoubleBarChartBlock/DoubleBarChartBlock.es.js.map +1 -1
  21. package/dist/insights-v2/components/BaseLayout.es.js +53 -53
  22. package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
  23. package/dist/insights-v2/components/DismissInsightDialog.es.js +34 -32
  24. package/dist/insights-v2/components/DismissInsightDialog.es.js.map +1 -1
  25. package/dist/insights-v2/components/FeedbackDialog.es.js +10 -7
  26. package/dist/insights-v2/components/FeedbackDialog.es.js.map +1 -1
  27. package/dist/insights-v2/components/InsightOptionsMenu.es.js +23 -23
  28. package/dist/insights-v2/components/InsightOptionsMenu.es.js.map +1 -1
  29. package/dist/insights-v2/hooks/useBeatFeedbackFlow.es.js +33 -33
  30. package/dist/insights-v2/hooks/useBeatFeedbackFlow.es.js.map +1 -1
  31. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ ## [9.4.33] - 09-21-2026
2
+
3
+ - **CHANGED** - Insights V2 components and hooks migrated to use `insights_payload` keys instead of accessing properties directly from `beat`. `BaseLayout`, `ActionBlockLayer`, and the `useBeatFeedbackFlow` hook now destructure and read content properties (`guid`, `user_guid`, `dismissed_at`, `title`, `sub_title`, `description.html_text`, etc.) from `insights_payload` instead of `beat`. `BaseLayout` also updated to use `insights_payload.guid` instead of `beat.guid` when passing to block components. Updated `InsightsPayload` type with mandatory fields (`guid`, `user_guid`, `dismissed_at`, `is_dismissed`), component implementations, test fixtures (BaseLayout tests cover 37 scenarios), and mock data. Added TODO comment for `in_description_cta` migration pending backend support (WEC-1807)
4
+ - **CHANGED** - `BarchartBlock` and `DoubleBarChartBlock` now guard drawer opening on `widget_type !== 'full'`, preventing drilldown on mini/micro widgets. Added `widget_type` to payload destructuring, formatted `onBarClick` handlers, and added comprehensive test coverage for widget_type behavior in both blocks (WEC-1807)
5
+ - **CHANGED** - `DismissInsightDialog`, `FeedbackDialog`, and `InsightOptionsMenu` UI improvements: updated styling for better accessibility and consistency (color theme adjustments for Radio buttons, dialog borders, and icon colors) (WEC-1807)
6
+ - **CHANGED** - Updated 16 Storybook story files with proper `insights_payload` mock data structure to support component testing and documentation (WEC-1807)
7
+
8
+ ## [9.4.32] - 09-18-2026
9
+
10
+ - **ADDED** - Historical account balances to net worth widget
11
+
1
12
  ## [9.4.31] - 09-18-2026
2
13
 
3
14
  - **FIXED** - Mini widget containers now expose a labelled `region` landmark, so screen readers announce the widget name (and a short summary, for Budgets) when the browse cursor lands on it instead of staying silent (MEW-3709)
@@ -1,5 +1,5 @@
1
1
  import { Fetch } from '../utils';
2
- import { Account, GlobalErrorHandler } from '..';
2
+ import { Account, GlobalErrorHandler, HistoricalAccountBalance, MonthlyAccountBalance } from '..';
3
3
  export declare class AccountApi {
4
4
  fetchInstance: Fetch;
5
5
  constructor(endpoint: string, token: string, onError?: GlobalErrorHandler);
@@ -8,7 +8,8 @@ export declare class AccountApi {
8
8
  getAccounts: () => Promise<any>;
9
9
  getInstitutions: () => Promise<any>;
10
10
  getMembers: () => Promise<any>;
11
- getMonthlyAccountBalances: (guid: string) => Promise<any>;
11
+ getHistoricalAccountBalances: (guid: string) => Promise<HistoricalAccountBalance[]>;
12
+ getMonthlyAccountBalances: (guid: string) => Promise<MonthlyAccountBalance[]>;
12
13
  mergeAccounts: (accountGuids: string[]) => Promise<any>;
13
14
  refreshAllMembers: () => Promise<any>;
14
15
  updateAccount: (account: Account) => Promise<any>;
@@ -10,6 +10,7 @@ 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);
13
14
  getMonthlyAccountBalances = async (t) => this.fetchInstance.get(`${n.ACCOUNTS}/${t}/monthly_account_balances`).then((e) => e.monthly_account_balances);
14
15
  mergeAccounts = async (t) => this.fetchInstance.put(`${n.ACCOUNTS}/merge`, { accounts: t }).then((e) => e);
15
16
  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 { 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
+ {"version":3,"file":"AccountApi.es.js","names":[],"sources":["../../../src/core/api/AccountApi.ts"],"sourcesContent":["import { Fetch } from '../utils'\nimport { ApiEndpoints } from '../constants'\nimport type {\n Account,\n GlobalErrorHandler,\n HistoricalAccountBalance,\n MonthlyAccountBalance,\n} 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 getHistoricalAccountBalances = async (guid: string): Promise<HistoricalAccountBalance[]> => {\n return this.fetchInstance\n .get(`${ApiEndpoints.ACCOUNTS}/${guid}/historical_account_balances`)\n .then((data) => data.historical_account_balances)\n }\n\n getMonthlyAccountBalances = async (guid: string): Promise<MonthlyAccountBalance[]> => {\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":";;AASA,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,+BAA+B,OAAO,MAC7B,KAAK,cACT,IAAI,GAAG,EAAa,QAAA,IAAY,CAAA,8BAAkC,EAClE,KAAA,CAAM,MAAS,EAAK,2BAA2B;AAAA,EAGpD,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,6 +1,7 @@
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";
4
5
  export declare class NetWorthStore {
5
6
  globalStore: GlobalStore;
6
7
  accountsApi: AccountApi;
@@ -17,9 +18,11 @@ export declare class NetWorthStore {
17
18
  get selectedData(): NetWorth | undefined;
18
19
  get hoveredData(): NetWorth | undefined;
19
20
  get gainsLosses(): GainsLosses;
21
+ get isHistoricalBalancesEnabled(): boolean;
20
22
  get assetsLiabilities(): AssetsLiabilities;
21
23
  loadNetWorthData: () => Promise<void>;
22
24
  getMonthlyAccountBalances: (accountGuid: string) => Promise<MonthlyAccountBalance[]>;
25
+ getHistoricalAccountBalances: (accountGuid: string) => Promise<MonthlyAccountBalance[]>;
23
26
  setHoveredIndex: (index: number) => number;
24
27
  setMonthlyAccountBalances: (balances: MonthlyAccountBalance[]) => void;
25
28
  setSelectedIndex: (index: number) => number;
@@ -1,22 +1,23 @@
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 {
1
+ import { AccountApi as o } from "../api/AccountApi.es.js";
2
+ import { isFeatureEnabled as c } from "../utils/UserUtils.es.js";
3
+ import { buildAssetsLiabilities as n, buildChartData as i, buildGainsLosses as l, filterAccounts as h, flattenBalances as u, getLatestNetWorthData as s, sortByYearMonthAscending as d, toMonthlyAccountBalance as A } from "../utils/NetWorthUtils.es.js";
4
+ import { makeAutoObservable as g } from "mobx";
5
+ var m = "Historical account balances", W = class {
5
6
  globalStore;
6
- accountsApi = new a("/", "");
7
+ accountsApi = new o("/", "");
7
8
  monthlyAccountBalances = [];
8
9
  monthlyAccountBalancesLoaded = !1;
9
10
  hoveredIndex = -1;
10
11
  selectedIndex = -1;
11
12
  timeframe = 6;
12
13
  constructor(t) {
13
- this.globalStore = t, this.accountsApi = new a(t.endpoint, t.sessionToken, t.onError), d(this);
14
+ this.globalStore = t, this.accountsApi = new o(t.endpoint, t.sessionToken, t.onError), g(this);
14
15
  }
15
16
  get isNetWorthDataLoaded() {
16
17
  return this.globalStore.accountStore.isAccountDataLoaded && this.monthlyAccountBalancesLoaded;
17
18
  }
18
19
  get netWorthAccounts() {
19
- return i(this.globalStore.globalUiStore.selectedAccounts, this.globalStore.accountStore.members);
20
+ return h(this.globalStore.globalUiStore.selectedAccounts, this.globalStore.accountStore.members);
20
21
  }
21
22
  get netWorthData() {
22
23
  return {
@@ -25,32 +26,35 @@ var y = class {
25
26
  };
26
27
  }
27
28
  get netWorthChartData() {
28
- return r(this.netWorthAccounts, this.monthlyAccountBalances, this.timeframe);
29
+ return i(this.netWorthAccounts, this.monthlyAccountBalances, this.timeframe);
29
30
  }
30
31
  get selectedData() {
31
32
  if (!(!this.netWorthChartData || this.netWorthChartData.length === 0))
32
- return this.selectedIndex === -1 ? o(this.netWorthChartData) : this.netWorthChartData[this.selectedIndex];
33
+ return this.selectedIndex === -1 ? s(this.netWorthChartData) : this.netWorthChartData[this.selectedIndex];
33
34
  }
34
35
  get hoveredData() {
35
36
  return this.hoveredIndex >= 0 ? this.netWorthChartData[this.hoveredIndex] : void 0;
36
37
  }
37
38
  get gainsLosses() {
38
- return h(this.selectedData);
39
+ return l(this.selectedData);
40
+ }
41
+ get isHistoricalBalancesEnabled() {
42
+ return c(this.globalStore.userStore.userFeatures, m);
39
43
  }
40
44
  get assetsLiabilities() {
41
- const { assets: t, liabilities: e, totalAssets: n, totalLiabilities: s } = c(this.netWorthData.accounts);
45
+ const { assets: t, liabilities: e, totalAssets: a, totalLiabilities: r } = n(this.netWorthData.accounts);
42
46
  return {
43
- netWorth: o(this.netWorthChartData),
47
+ netWorth: s(this.netWorthChartData),
44
48
  assets: t,
45
49
  liabilities: e,
46
- totalAssets: n,
47
- totalLiabilities: s
50
+ totalAssets: a,
51
+ totalLiabilities: r
48
52
  };
49
53
  }
50
54
  loadNetWorthData = async () => {
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);
55
+ this.globalStore.accountStore.isAccountDataLoaded || await this.globalStore.accountStore.loadAccountData(), this.globalStore.userStore.userFeaturesLoaded || await this.globalStore.userStore.loadUserFeatures();
56
+ const t = this.isHistoricalBalancesEnabled ? (a) => this.getHistoricalAccountBalances(a) : (a) => this.getMonthlyAccountBalances(a), e = (await Promise.all(this.netWorthAccounts.map((a) => t(a.guid)))).reduce(u, []).sort(d);
57
+ this.setMonthlyAccountBalances(e);
54
58
  };
55
59
  getMonthlyAccountBalances = async (t) => {
56
60
  try {
@@ -59,6 +63,13 @@ var y = class {
59
63
  return console.error("Error occurred while fetching monthly account balances:", e), this.globalStore.captureException(e, { store: "NetWorthStore" }), [];
60
64
  }
61
65
  };
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
+ };
62
73
  setHoveredIndex = (t) => this.hoveredIndex = t;
63
74
  setMonthlyAccountBalances = (t) => {
64
75
  this.monthlyAccountBalances = t, this.monthlyAccountBalancesLoaded = !0;
@@ -67,7 +78,8 @@ var y = class {
67
78
  setTimeframe = (t) => this.timeframe = t;
68
79
  };
69
80
  export {
70
- y as NetWorthStore
81
+ m as HISTORICAL_ACCOUNT_BALANCES,
82
+ W as NetWorthStore
71
83
  };
72
84
 
73
85
  //# 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 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,kBAA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A,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"}
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 HistoricalAccountBalance,\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 toMonthlyAccountBalance,\n} from '../utils/NetWorthUtils'\nimport { isFeatureEnabled } from '../utils/UserUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\n// Looks wrong next to the MD_* flags, but isn't: this is the seeded feature_name. Do not rename.\nexport const HISTORICAL_ACCOUNT_BALANCES = 'Historical account balances'\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 isHistoricalBalancesEnabled(): boolean {\n return isFeatureEnabled(this.globalStore.userStore.userFeatures, HISTORICAL_ACCOUNT_BALANCES)\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 if (!this.globalStore.userStore.userFeaturesLoaded) {\n await this.globalStore.userStore.loadUserFeatures()\n }\n\n const fetchBalances = this.isHistoricalBalancesEnabled\n ? (guid: string) => this.getHistoricalAccountBalances(guid)\n : (guid: string) => this.getMonthlyAccountBalances(guid)\n\n const accountBalances = await Promise.all(\n this.netWorthAccounts.map((account: Account) => fetchBalances(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 getHistoricalAccountBalances = async (accountGuid: string): Promise<MonthlyAccountBalance[]> => {\n try {\n const balances: HistoricalAccountBalance[] =\n await this.accountsApi.getHistoricalAccountBalances(accountGuid)\n return balances.map(toMonthlyAccountBalance)\n } catch (error) {\n console.error('Error occurred while fetching historical 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":";;;;AA4BA,IAAa,IAA8B,+BAE9B,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,oBA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B,CAAsB;AAAA,EACvD;AAAA,EAEA,4BAA4B,OAAO,MAAwB;AACzD,QAAI;AAEF,aAAO,MADgB,KAAK,YAAY,0BAA0B,CAAW;AAAA,IAE/E,SAAS,GAAO;AACd,qBAAQ,MAAM,2DAA2D,CAAK,GAC9E,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,gBAAgB,CAAC,GAC5D,CAAC;AAAA,IACV;AAAA,EACF;AAAA,EAEA,+BAA+B,OAAO,MAA0D;AAC9F,QAAI;AAGF,cAAO,MADC,KAAK,YAAY,6BAA6B,CAAW,GACjD,IAAI,CAAuB;AAAA,IAC7C,SAAS,GAAO;AACd,qBAAQ,MAAM,8DAA8D,CAAK,GACjF,KAAK,YAAY,iBAAiB,GAAO,EAAE,OAAO,gBAAgB,CAAC,GAC5D,CAAC;AAAA,IACV;AAAA,EACF;AAAA,EAEA,kBAAA,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,6 +115,16 @@ 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
+ }
118
128
  export declare enum AccountType {
119
129
  ANY = 0,
120
130
  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 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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B,GAEa,IAAmB;AAAA,EACX,GAAA;AAAA,EACC,GAAA;AAAA,EACI,GAAA;AAAA,EACe,IAAA;AAAA,EACZ,GAAA;AAAA,EACG,IAAA;AAAA,EACL,IAAA;AAAA,EACC,GAAA;AAAA,EACI,GAAA;AAAA,EACV,GAAA;AAAA,EACI,GAAA;AAAA,EACD,IAAA;AAAA,EACC,GAAA;AAAA,EACD,GAAA;AACzB,GAEa,IAA2B,EAAA,GACZ,gBAC5B,GAEa,IAAwB;AAAA,EACP,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,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 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,I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EAAA,GACZ,gBAC5B,GAEa,IAAwB;AAAA,EACP,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,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"}
@@ -25,6 +25,10 @@ export interface InsightsPayload {
25
25
  title?: string;
26
26
  sub_title?: Subtitle;
27
27
  footer?: Footer;
28
+ guid: string;
29
+ user_guid: string;
30
+ dismissed_at: number | null;
31
+ is_dismissed: boolean;
28
32
  }
29
33
  export interface Legends {
30
34
  label: string;
@@ -1,4 +1,4 @@
1
- export type { Account, DetailedAccount, Member, MonthlyAccountBalance } from './Account';
1
+ export type { Account, DetailedAccount, HistoricalAccountBalance, 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';
@@ -1,4 +1,4 @@
1
- import { Account, AccountGroup, FinancialAccount, Member, MonthlyAccountBalance, NetWorth } from '../types';
1
+ import { Account, AccountGroup, FinancialAccount, HistoricalAccountBalance, 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,4 +23,5 @@ export declare const buildAssetsLiabilities: (accounts: Account[]) => {
23
23
  totalAssets: number;
24
24
  totalLiabilities: number;
25
25
  };
26
+ export declare const toMonthlyAccountBalance: (hab: HistoricalAccountBalance) => MonthlyAccountBalance;
26
27
  export declare const groupAccounts: (accounts: FinancialAccount[]) => AccountGroup[];
@@ -1,31 +1,31 @@
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";
1
+ import { AccountIcon as _, AccountIconVariants as p, AccountTypeName as y } from "../types/Account.es.js";
2
+ import { isAccountLiability as d } from "./AccountUtils.es.js";
3
+ import { format as b } 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 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));
7
+ var h = 13, W = (e, r) => e.filter((n) => {
8
+ const { is_closed: a, is_deleted: s, is_hidden: t, is_manual: o } = n;
9
+ return a || s || t ? !1 : o || !n.guid ? !0 : r.some((g) => e.some((c) => g.guid === c.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: 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 = {
12
+ }, U = (e, r) => e.year_month - r.year_month, N = () => Array.from({ length: h }, (e, r) => Math.floor(v(A(/* @__PURE__ */ new Date(), r)).getTime() / 1e3)).sort(), j = (e, r, n) => !e.length || !r.length ? [] : N().reduceRight((a, s) => {
13
+ const t = r.filter(({ year_month: i }) => i === parseInt(b(M(s), "yyyyMM"))), o = e.map((i) => {
14
+ const l = t.find((u) => u.account_guid === i.guid), m = {
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 h;
21
+ if (!l && a.length === 0 && !i.balance) return m;
22
22
  if (!l && a.length === 0) return {
23
- ...h,
24
- value: f(i) ? -(i.balance ?? 0) : i.balance ?? 0
23
+ ...m,
24
+ value: d(i) ? -(i.balance ?? 0) : i.balance ?? 0
25
25
  };
26
26
  if (!l) {
27
- const u = a[0].accounts.find((d) => d.guid === i.guid);
28
- return u || h;
27
+ const u = a[0].accounts.find((f) => f.guid === i.guid);
28
+ return u || m;
29
29
  }
30
30
  return {
31
31
  change: l.transaction_total,
@@ -34,7 +34,7 @@ var c = 13, W = (e, r) => e.filter((t) => {
34
34
  type: i.account_type,
35
35
  value: l.balance
36
36
  };
37
- }), { y: g, change: m } = o.reduce((i, l) => ({
37
+ }), { y: g, change: c } = o.reduce((i, l) => ({
38
38
  y: i.y + (l.value || 0),
39
39
  change: i.change + (l.change || 0)
40
40
  }), {
@@ -45,59 +45,70 @@ var c = 13, W = (e, r) => e.filter((t) => {
45
45
  accounts: o,
46
46
  x: s,
47
47
  y: g,
48
- change: m
48
+ change: c
49
49
  }, ...a];
50
- }, []).slice(c - t), k = (e) => {
51
- const r = [], t = [];
50
+ }, []).slice(h - n), k = (e) => {
51
+ const r = [], n = [];
52
52
  let a = 0, s = 0;
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);
53
+ return e?.accounts.forEach((t) => {
54
+ t.change > 0 && (r.push({
55
+ accountName: t.name,
56
+ gain: t.change
57
+ }), a += t.change), t.change < 0 && (n.push({
58
+ accountName: t.name,
59
+ loss: t.change
60
+ }), s += t.change);
61
61
  }), {
62
62
  netWorth: e,
63
63
  gains: r,
64
- losses: t,
64
+ losses: n,
65
65
  totalGains: a,
66
66
  totalLosses: s
67
67
  };
68
68
  }, w = (e) => {
69
- const r = [], t = [];
69
+ const r = [], n = [];
70
70
  let a = 0, s = 0;
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,
71
+ return e.forEach((t) => {
72
+ if (d(t)) {
73
+ const o = t.balance ?? 0;
74
+ n.push({
75
+ accountName: t.name,
76
+ accountType: t.account_type,
77
77
  balance: o
78
78
  }), s += o;
79
79
  } else {
80
- const o = n.balance ?? 0;
80
+ const o = t.balance ?? 0;
81
81
  r.push({
82
- accountName: n.name,
83
- accountType: n.account_type,
82
+ accountName: t.name,
83
+ accountType: t.account_type,
84
84
  balance: o
85
85
  }), a += o;
86
86
  }
87
87
  }), {
88
88
  assets: r,
89
- liabilities: t,
89
+ liabilities: n,
90
90
  totalAssets: a,
91
91
  totalLiabilities: s
92
92
  };
93
- }, x = (e) => {
94
- const r = e.reduce((t, a) => {
93
+ }, x = (e) => ({
94
+ account_guid: e.account_guid,
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) => {
95
106
  const s = a.accountType;
96
- return t[s] || (t[s] = []), t[s].push(a), t;
107
+ return n[s] || (n[s] = []), n[s].push(a), n;
97
108
  }, {});
98
- return Object.entries(r).map(([t, a]) => ({
99
- icon: b[+t] || p[+t],
100
- name: y[+t],
109
+ return Object.entries(r).map(([n, a]) => ({
110
+ icon: p[+n] || _[+n],
111
+ name: y[+n],
101
112
  accounts: a
102
113
  }));
103
114
  };
@@ -108,8 +119,9 @@ export {
108
119
  W as filterAccounts,
109
120
  G as flattenBalances,
110
121
  R as getLatestNetWorthData,
111
- x as groupAccounts,
112
- U as sortByYearMonthAscending
122
+ z as groupAccounts,
123
+ U as sortByYearMonthAscending,
124
+ x as toMonthlyAccountBalance
113
125
  };
114
126
 
115
127
  //# 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 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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M,IAA6B,CAAC,GAC9B,IAAkC,CAAC;AACzC,MAAI,IAAc,GACd,IAAmB;AAEvB,SAAA,EAAS,QAAA,CAAS,MAAY;AAC5B,QAAI,EAAmB,CAAO,GAAG;AAC/B,YAAM,IAAU,EAAQ,WAAW;AACnC,MAAA,EAAY,KAAK;AAAA,QAAE,aAAa,EAAQ;AAAA,QAAM,aAAa,EAAQ;AAAA,QAAc,SAAA;AAAA,MAAQ,CAAC,GAC1F,KAAoB;AAAA,IACtB,OAAO;AACL,YAAM,IAAU,EAAQ,WAAW;AACnC,MAAA,EAAO,KAAK;AAAA,QAAE,aAAa,EAAQ;AAAA,QAAM,aAAa,EAAQ;AAAA,QAAc,SAAA;AAAA,MAAQ,CAAC,GACrF,KAAe;AAAA,IACjB;AAAA,EACF,CAAC,GAEM;AAAA,IAAE,QAAA;AAAA,IAAQ,aAAA;AAAA,IAAa,aAAA;AAAA,IAAa,kBAAA;AAAA,EAAiB;AAC9D,GAGa,IAAA,CAAiB,MAAiD;AAC7E,QAAM,IAAkB,EAAS,OAAA,CAA+C,GAAK,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
+ {"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 HistoricalAccountBalance,\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}\nexport const toMonthlyAccountBalance = (hab: HistoricalAccountBalance): MonthlyAccountBalance => ({\n account_guid: hab.account_guid,\n balance: hab.balance,\n credit_transaction_total: 0,\n debit_transaction_total: 0,\n id: hab.guid,\n month: hab.month,\n transaction_total: hab.transaction_total ?? 0,\n user_guid: hab.user_guid,\n year: hab.year,\n year_month: hab.year_month,\n})\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":";;;;;;AAiBA,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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