@mx-cartographer/experiences 3.7.0-alpha.al14 → 3.7.0-alpha.al2

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/dist/index.es.js CHANGED
@@ -9911,9 +9911,17 @@ class Tr {
9911
9911
  };
9912
9912
  getAccounts = async () => this.fetchInstance.get(N.ACCOUNTS).then((e) => e.accounts).catch((e) => e);
9913
9913
  getMembers = async () => this.fetchInstance.get(N.MEMBERS).then((e) => e.members).catch((e) => e);
9914
- getMonthlyAccountBalances = async (e) => this.fetchInstance.get(`${N.ACCOUNTS}/${e.guid}/monthly_account_balances`).then((n) => (console.log(n), n.monthly_account_balances)).catch((n) => n);
9914
+ getMonthlyAccountBalances = async (e) => this.fetchInstance.get(`${N.ACCOUNTS}/${e.guid}/monthly_account_balances`).then((n) => {
9915
+ const a = n.reduce(this._flattenBalances, []), r = n.sort(a, (i) => i.year_month);
9916
+ return console.log(a), r;
9917
+ }).catch((n) => n);
9915
9918
  getNetWorthChartData = async () => wr.map((n) => ({ x: this.formatMonth(n.x), y: n.y }));
9916
9919
  getNetWorthMonthlyList = async () => wr;
9920
+ _flattenBalances = (e, n) => [
9921
+ //todo: balance is a response object
9922
+ ...e,
9923
+ ...n.data.monthly_account_balances
9924
+ ];
9917
9925
  }
9918
9926
  class Yu {
9919
9927
  api = new Tr("/", "");
@@ -9927,17 +9935,11 @@ class Yu {
9927
9935
  initialize = async (e, n) => {
9928
9936
  this.api = new Tr(e, n), await this.loadNetWorth();
9929
9937
  };
9930
- /*eslint-disable no-console*/
9931
9938
  loadNetWorth = async () => {
9932
9939
  try {
9933
- const e = await this.api.getAccounts(), n = e.map((i) => this.api.getMonthlyAccountBalances(i));
9934
- console.log(n);
9935
- const a = await this.api.getNetWorthMonthlyList(), r = await this.api.getNetWorthChartData();
9940
+ const e = await this.api.getAccounts(), n = e.map((i) => this.api.getMonthlyAccountBalances(i)), a = await this.api.getNetWorthMonthlyList(), r = await this.api.getNetWorthChartData();
9936
9941
  V(() => {
9937
- this.netWorthData = {
9938
- accounts: e,
9939
- monthlyAccountBalances: n
9940
- }, this.netWorthMonthlyList = a, this.netWorthChartData = r;
9942
+ this.netWorthData = { accounts: e, monthlyAccountBalances: n }, this.netWorthMonthlyList = a, this.netWorthChartData = r;
9941
9943
  });
9942
9944
  } catch (e) {
9943
9945
  console.error(`Error occured while loading net worth: ${e}`);