@mx-cartographer/experiences 9.6.10 → 9.6.12
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 +12 -0
- package/dist/core/stores/FinstrongStore.d.ts +1 -0
- package/dist/core/stores/FinstrongStore.es.js +42 -38
- package/dist/core/stores/FinstrongStore.es.js.map +1 -1
- package/dist/core/stores/GoalStore.d.ts +1 -0
- package/dist/core/stores/GoalStore.es.js +104 -100
- package/dist/core/stores/GoalStore.es.js.map +1 -1
- package/dist/core/stores/HelpStore.d.ts +1 -0
- package/dist/core/stores/HelpStore.es.js +10 -6
- package/dist/core/stores/HelpStore.es.js.map +1 -1
- package/dist/core/stores/InsightsV2Store.d.ts +1 -1
- package/dist/core/stores/InsightsV2Store.es.js.map +1 -1
- package/dist/core/stores/NetWorthStore.d.ts +1 -0
- package/dist/core/stores/NetWorthStore.es.js +12 -8
- package/dist/core/stores/NetWorthStore.es.js.map +1 -1
- package/dist/core/stores/NotificationStore.d.ts +1 -0
- package/dist/core/stores/NotificationStore.es.js +11 -7
- package/dist/core/stores/NotificationStore.es.js.map +1 -1
- package/dist/core/stores/SettingsStore.d.ts +1 -0
- package/dist/core/stores/SettingsStore.es.js +23 -19
- package/dist/core/stores/SettingsStore.es.js.map +1 -1
- package/dist/core/stores/UserStore.d.ts +1 -0
- package/dist/core/stores/UserStore.es.js +10 -6
- package/dist/core/stores/UserStore.es.js.map +1 -1
- package/dist/core/types/Insights.d.ts +17 -0
- package/dist/core/types/Insights.es.js.map +1 -1
- package/dist/core/types/index.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js +21 -21
- package/dist/insights-v2/actionBlocks/ActionBlockLayer.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js +63 -61
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/TransactionHistoryBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +59 -38
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/util.d.ts +2 -2
- package/dist/insights-v2/actionBlocks/util.es.js +3 -3
- package/dist/insights-v2/actionBlocks/util.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +57 -55
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.d.ts +4 -2
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js +54 -23
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/IconComponent.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +2 -0
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +14 -10
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/components/BaseLayout.es.js +119 -99
- package/dist/insights-v2/components/BaseLayout.es.js.map +1 -1
- package/dist/insights-v2/components/statusIcon.d.ts +7 -0
- package/dist/insights-v2/components/statusIcon.es.js +10 -0
- package/dist/insights-v2/components/statusIcon.es.js.map +1 -0
- package/dist/microinsights/cards/InsightCard.es.js +78 -73
- package/dist/microinsights/cards/InsightCard.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [9.6.12] - 10-15-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - `account_block` reads the Insights 2.0 slot contract (`instance_slot.data`) for a new variant, falling back to the flat legacy fields: `low_balance` (the existing red tile, its institution logo badged per the layout's new `badge` field; no amount is drawn when the slot sends none). A new `statusIconName` helper maps `ICO-<name>` to an mx-icons name and rejects anything else. `low_balance` shares `low_balance_alert`'s layout entry (WEC-1903)
|
|
4
|
+
- **ADDED** - `insights_payload.in_description_cta` (`{ label, block?, variant?, action_key? }`): on the full card `BaseLayout` renders it as the description link when it names a block and opens that block through a new `inDescriptionCta` drawer trigger, which resolves the link's `variant` like a CTA's. On mini and micro, where ditto ≥ 1.4.3 sends the card's action as `in_description_cta` instead of `primary_cta`, the action label reads `primary_cta?.label ?? in_description_cta?.label` and stays the card's tap (`carousel/cta` / `micro-carousel/cta`), never a drawer. The micro card draws the slot's `ICO-` icon in the legacy tinted error tile when the block has no row logo (Figma Micro | Low Account Balance). V1 beats keep the legacy `beat.in_description_cta` field. Needs a backend on ditto ≥ 1.4.3 (the in-description CTA keys); against an older one the full card loses its link and mini/micro their action label, and the card still renders (WEC-1903)
|
|
5
|
+
- **ADDED** - `low_balance` drilldown variant on `TransactionHistoryBlock` (`top: 'list'`, no chart): one account's transactions for the `drilldown_data` window (`account_guid`, `from_date`, `to_date`), as the filter's own `dateRange` on UTC calendar days; a beat missing the account or window lists no rows rather than every account (Low Account Balance's "Transactions" drawer) (WEC-1903)
|
|
6
|
+
- **ADDED** - Low Account Balance full and mini stories and the `AccountBlockPayload.json` fixture, matching tupac's envelopes (WEC-1903)
|
|
7
|
+
- **CHANGED** - Exported types widened: `ActionDrawerTrigger` gains `'inDescriptionCta'`, `DrillDownVariantConfig['top']` gains `'list'`, and `InDescriptionCTA` is newly exported from `core` (WEC-1903)
|
|
8
|
+
|
|
9
|
+
## [9.6.11] - 10-14-2026
|
|
10
|
+
|
|
11
|
+
- **FIXED** - double error reporting from the Settings, Goal, Finstrong, User, Net Worth, Notification and Help stores. Their errors now surface only through `onCaptureException`. This completes the migration started in 9.6.10 (MEW-4182)
|
|
12
|
+
|
|
1
13
|
## [9.6.10] - 10-14-2026
|
|
2
14
|
|
|
3
15
|
- **FIXED** - double error reporting from the Transaction, Account, Budgets, Category, Beat, App Data, Holding and Global Copy stores. Their errors now surface only through `onCaptureException` (MEW-4182)
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { FinstrongApi as
|
|
2
|
-
import { augmentChartData as
|
|
1
|
+
import { FinstrongApi as r } from "../api/FinstrongApi.es.js";
|
|
2
|
+
import { augmentChartData as i, augmentSpendingFeeTransactions as o } from "../utils/FinstrongUtils.es.js";
|
|
3
3
|
import { format as c } from "date-fns/format";
|
|
4
4
|
import { subMonths as h } from "date-fns/subMonths";
|
|
5
|
-
import { fromUnixTime as
|
|
6
|
-
import { getUnixTime as
|
|
7
|
-
import { makeAutoObservable as
|
|
8
|
-
var
|
|
9
|
-
api = new
|
|
5
|
+
import { fromUnixTime as d } from "date-fns/fromUnixTime";
|
|
6
|
+
import { getUnixTime as s } from "date-fns/getUnixTime";
|
|
7
|
+
import { makeAutoObservable as l, runInAction as a } from "mobx";
|
|
8
|
+
var C = class {
|
|
9
|
+
api = new r("/", "");
|
|
10
10
|
augmentedChartData = [];
|
|
11
11
|
averageHealthScores = [];
|
|
12
12
|
monthlySummaries = [];
|
|
@@ -22,7 +22,7 @@ var b = class {
|
|
|
22
22
|
isSpendingInitialized = !1;
|
|
23
23
|
isIncomeInitialized = !1;
|
|
24
24
|
constructor(e) {
|
|
25
|
-
this.globalStore = e, this.api = new
|
|
25
|
+
this.globalStore = e, this.api = new r(e.endpoint, e.sessionToken, e.onError), l(this);
|
|
26
26
|
}
|
|
27
27
|
setSpendingInitialized = (e) => {
|
|
28
28
|
this.isSpendingInitialized = e;
|
|
@@ -33,106 +33,106 @@ var b = class {
|
|
|
33
33
|
calculateHealthScore = async (e = !0) => {
|
|
34
34
|
try {
|
|
35
35
|
const t = await this.api.calculateHealthScore();
|
|
36
|
-
let
|
|
37
|
-
e && await this.loadHealthScoreChangeReports(),
|
|
38
|
-
this.healthScore = t, this.healthScoreChange =
|
|
36
|
+
let n = 0;
|
|
37
|
+
e && await this.loadHealthScoreChangeReports(), n = (t?.health_score || 0) - (this.healthScoreChangeReports.at(-1)?.older_health_score || 0), a(() => {
|
|
38
|
+
this.healthScore = t, this.healthScoreChange = n;
|
|
39
39
|
});
|
|
40
40
|
} catch (t) {
|
|
41
|
-
|
|
41
|
+
this.captureError("calculateHealthScore", t);
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
loadAverageHealthScores = async () => {
|
|
45
45
|
try {
|
|
46
46
|
const e = await this.api.getAverageHealthScores();
|
|
47
|
-
|
|
47
|
+
a(() => {
|
|
48
48
|
this.averageHealthScores = e;
|
|
49
49
|
});
|
|
50
50
|
} catch (e) {
|
|
51
|
-
|
|
51
|
+
this.captureError("loadAverageHealthScores", e);
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
54
|
loadMonthlySummaries = async () => {
|
|
55
55
|
try {
|
|
56
56
|
const e = await this.api.getMonthlySummaries();
|
|
57
|
-
|
|
57
|
+
a(() => {
|
|
58
58
|
this.monthlySummaries = e;
|
|
59
59
|
});
|
|
60
60
|
} catch (e) {
|
|
61
|
-
|
|
61
|
+
this.captureError("loadMonthlySummaries", e);
|
|
62
62
|
}
|
|
63
63
|
};
|
|
64
64
|
loadDebtSpend = async () => {
|
|
65
65
|
try {
|
|
66
66
|
const e = await this.api.getDebtSpend();
|
|
67
|
-
|
|
67
|
+
a(() => {
|
|
68
68
|
this.debtSpendTransactions = e;
|
|
69
69
|
});
|
|
70
70
|
} catch (e) {
|
|
71
|
-
|
|
71
|
+
this.captureError("loadDebtSpend", e);
|
|
72
72
|
}
|
|
73
73
|
};
|
|
74
74
|
loadIncome = async () => {
|
|
75
75
|
this.setIncomeInitialized(!1);
|
|
76
76
|
try {
|
|
77
77
|
const e = await this.api.getIncome();
|
|
78
|
-
|
|
78
|
+
a(() => {
|
|
79
79
|
this.incomeTransactions = e, this.setIncomeInitialized(!0);
|
|
80
80
|
});
|
|
81
81
|
} catch (e) {
|
|
82
|
-
|
|
82
|
+
this.captureError("loadIncome", e);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
loadHealthScoreChangeReports = async () => {
|
|
86
|
-
const e =
|
|
86
|
+
const e = s(h(/* @__PURE__ */ new Date(), 2)), t = s(/* @__PURE__ */ new Date());
|
|
87
87
|
try {
|
|
88
|
-
const
|
|
89
|
-
|
|
90
|
-
this.healthScoreChangeReports =
|
|
88
|
+
const n = await this.api.getHealthScoreChangeReports(e, t);
|
|
89
|
+
a(() => {
|
|
90
|
+
this.healthScoreChangeReports = n;
|
|
91
91
|
});
|
|
92
|
-
} catch (
|
|
93
|
-
|
|
92
|
+
} catch (n) {
|
|
93
|
+
this.captureError("loadHealthScoreChangeReports", n);
|
|
94
94
|
}
|
|
95
95
|
};
|
|
96
96
|
loadPeerScore = async () => {
|
|
97
|
-
const e = c(
|
|
97
|
+
const e = c(d(this.globalStore.appDataStore.user.birthday), "yyyy");
|
|
98
98
|
try {
|
|
99
99
|
const t = await this.api.getPeerScore(e);
|
|
100
|
-
|
|
100
|
+
a(() => {
|
|
101
101
|
this.peerScore = t;
|
|
102
102
|
});
|
|
103
103
|
} catch (t) {
|
|
104
|
-
|
|
104
|
+
this.captureError("loadPeerScore", t);
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
loadAugmentedChartData = async () => {
|
|
108
108
|
try {
|
|
109
109
|
const e = await this.api.getAverageHealthScores();
|
|
110
|
-
|
|
111
|
-
this.augmentedChartData =
|
|
110
|
+
a(() => {
|
|
111
|
+
this.augmentedChartData = i(e);
|
|
112
112
|
});
|
|
113
113
|
} catch (e) {
|
|
114
|
-
|
|
114
|
+
this.captureError("loadAugmentedChartData", e);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
117
|
getSpendingFeeTransactions = async () => {
|
|
118
118
|
try {
|
|
119
|
-
const e = await this.api.getSpendingFeeTransactions(), t =
|
|
120
|
-
|
|
119
|
+
const e = await this.api.getSpendingFeeTransactions(), t = o(e);
|
|
120
|
+
a(() => {
|
|
121
121
|
this.spendingFeeTransactions = t;
|
|
122
122
|
});
|
|
123
123
|
} catch (e) {
|
|
124
|
-
|
|
124
|
+
this.captureError("getSpendingFeeTransactions", e);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
127
|
loadSpendTransactions = async () => {
|
|
128
128
|
this.setSpendingInitialized(!1);
|
|
129
129
|
try {
|
|
130
130
|
const e = await this.api.getStandardSpend();
|
|
131
|
-
|
|
131
|
+
a(() => {
|
|
132
132
|
this.spendTransactions = [...e], this.setSpendingInitialized(!0);
|
|
133
133
|
});
|
|
134
134
|
} catch (e) {
|
|
135
|
-
|
|
135
|
+
this.captureError("loadSpendTransactions", e);
|
|
136
136
|
}
|
|
137
137
|
};
|
|
138
138
|
get spendAndDebtTransactions() {
|
|
@@ -148,9 +148,13 @@ var b = class {
|
|
|
148
148
|
}
|
|
149
149
|
handleFinstrongWidgetPrimaryCtaClick = (e) => () => {
|
|
150
150
|
};
|
|
151
|
+
captureError = (e, t) => this.globalStore.captureException(t, {
|
|
152
|
+
store: "FinstrongStore",
|
|
153
|
+
action: e
|
|
154
|
+
});
|
|
151
155
|
};
|
|
152
156
|
export {
|
|
153
|
-
|
|
157
|
+
C as FinstrongStore
|
|
154
158
|
};
|
|
155
159
|
|
|
156
160
|
//# sourceMappingURL=FinstrongStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FinstrongStore.es.js","names":[],"sources":["../../../src/core/stores/FinstrongStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { format } from 'date-fns/format'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport { FinstrongApi } from '../api'\nimport type {\n MonthlySummaries,\n HealthScore,\n HealthScoreReport,\n MonthlyHealthScore,\n Transaction,\n} from '../types'\nimport type { FinstrongTransaction, PeerAverage } from '../types/Finstrong'\nimport { augmentChartData, augmentSpendingFeeTransactions } from '../utils/FinstrongUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class FinstrongStore {\n api = new FinstrongApi('/', '')\n augmentedChartData: { x: string; y: number }[] = []\n averageHealthScores: MonthlyHealthScore[] = []\n monthlySummaries: MonthlySummaries[] = []\n incomeTransactions: FinstrongTransaction[] = []\n debtSpendTransactions: FinstrongTransaction[] = []\n spendingFeeTransactions: Transaction[] = []\n spendTransactions: FinstrongTransaction[] = []\n globalStore: GlobalStore\n healthScore: HealthScore = {} as HealthScore\n healthScoreChange?: number\n healthScoreChangeReports: HealthScoreReport[] = []\n peerScore: PeerAverage | null = null\n isSpendingInitialized: boolean = false\n isIncomeInitialized: boolean = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new FinstrongApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n makeAutoObservable(this)\n }\n\n setSpendingInitialized = (isSpendingInitialized: boolean) => {\n this.isSpendingInitialized = isSpendingInitialized\n }\n\n setIncomeInitialized = (isIncomeInitialized: boolean) => {\n this.isIncomeInitialized = isIncomeInitialized\n }\n\n calculateHealthScore = async (needHealthScoreChangeReport: boolean = true) => {\n try {\n const healthScore = await this.api.calculateHealthScore()\n\n let healthScoreChange = 0\n\n if (needHealthScoreChangeReport) {\n await this.loadHealthScoreChangeReports()\n }\n\n const currentScore = healthScore?.health_score || 0\n const oldScore = this.healthScoreChangeReports.at(-1)?.older_health_score || 0\n healthScoreChange = currentScore - oldScore\n\n runInAction(() => {\n this.healthScore = healthScore\n this.healthScoreChange = healthScoreChange\n })\n } catch (e) {\n console.error('Error calculating health score:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadAverageHealthScores = async () => {\n try {\n const averageHealthScores = await this.api.getAverageHealthScores()\n runInAction(() => {\n this.averageHealthScores = averageHealthScores\n })\n } catch (e) {\n console.error('Error loading average health scores:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadMonthlySummaries = async () => {\n try {\n const monthlySummaries = await this.api.getMonthlySummaries()\n runInAction(() => {\n this.monthlySummaries = monthlySummaries\n })\n } catch (e) {\n console.error('Error loading monthly summaries:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadDebtSpend = async () => {\n try {\n const debtSpend = await this.api.getDebtSpend()\n runInAction(() => {\n this.debtSpendTransactions = debtSpend\n })\n } catch (e) {\n console.error('Error loading debt spend:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadIncome = async () => {\n this.setIncomeInitialized(false)\n try {\n const income = await this.api.getIncome()\n runInAction(() => {\n this.incomeTransactions = income\n this.setIncomeInitialized(true)\n })\n } catch (e) {\n console.error('Error loading income:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadHealthScoreChangeReports = async () => {\n const startDate = getUnixTime(subMonths(new Date(), 2))\n const endDate = getUnixTime(new Date())\n\n try {\n const healthScoreChangeReports = await this.api.getHealthScoreChangeReports(\n startDate,\n endDate,\n )\n runInAction(() => {\n this.healthScoreChangeReports = healthScoreChangeReports\n })\n } catch (e) {\n console.error('Error loading health score change reports:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadPeerScore = async () => {\n const birthYear = format(fromUnixTime(this.globalStore.appDataStore.user.birthday!), 'yyyy')\n\n try {\n const peerScore = await this.api.getPeerScore(birthYear)\n runInAction(() => {\n this.peerScore = peerScore\n })\n } catch (e) {\n console.error('Error loading peer score:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n loadAugmentedChartData = async () => {\n try {\n const augmentedChartData = await this.api.getAverageHealthScores()\n\n runInAction(() => {\n this.augmentedChartData = augmentChartData(augmentedChartData)\n })\n } catch (error) {\n console.error('Error occurred while getting augmented chart data:', error)\n this.globalStore.captureException(error, { store: 'FinstrongStore' })\n }\n }\n\n getSpendingFeeTransactions = async () => {\n try {\n const spendingFeeTransaction = await this.api.getSpendingFeeTransactions()\n const organizedSpendingFeeTransactions =\n augmentSpendingFeeTransactions(spendingFeeTransaction)\n runInAction(() => {\n this.spendingFeeTransactions = organizedSpendingFeeTransactions\n })\n } catch (error) {\n console.error('Error occurred while getting spending fee transactions:', error)\n this.globalStore.captureException(error, { store: 'FinstrongStore' })\n }\n }\n\n loadSpendTransactions = async () => {\n this.setSpendingInitialized(false)\n try {\n const spendTransaction = await this.api.getStandardSpend()\n runInAction(() => {\n this.spendTransactions = [...spendTransaction]\n this.setSpendingInitialized(true)\n })\n } catch (e) {\n console.error('Error loading spend transactions:', e)\n this.globalStore.captureException(e, { store: 'FinstrongStore' })\n }\n }\n\n get spendAndDebtTransactions() {\n return [...this.spendTransactions, ...this.debtSpendTransactions]\n }\n\n get allTransactions() {\n return {\n income: this.incomeTransactions,\n debtSpend: this.debtSpendTransactions,\n spendingFee: this.spendingFeeTransactions,\n spend: this.spendTransactions,\n }\n }\n handleFinstrongWidgetPrimaryCtaClick = (value: string) => () => {\n // eslint-disable-next-line no-void\n void value\n }\n}\n"],"mappings":";;;;;;;AAoBA,IAAa,IAAb,MAA4B;AAAA,EAC1B,MAAM,IAAI,EAAa,KAAK,EAAE;AAAA,EAC9B,qBAAiD,CAAC;AAAA,EAClD,sBAA4C,CAAC;AAAA,EAC7C,mBAAuC,CAAC;AAAA,EACxC,qBAA6C,CAAC;AAAA,EAC9C,wBAAgD,CAAC;AAAA,EACjD,0BAAyC,CAAC;AAAA,EAC1C,oBAA4C,CAAC;AAAA,EAC7C;AAAA,EACA,cAA2B,CAAC;AAAA,EAC5B;AAAA,EACA,2BAAgD,CAAC;AAAA,EACjD,YAAgC;AAAA,EAChC,wBAAiC;AAAA,EACjC,sBAA+B;AAAA,EAE/B,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAa,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAC/F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,yBAAA,CAA0B,MAAmC;AAC3D,SAAK,wBAAwB;AAAA,EAC/B;AAAA,EAEA,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,MAAwB;AAAA,EAGhE;AACF"}
|
|
1
|
+
{"version":3,"file":"FinstrongStore.es.js","names":[],"sources":["../../../src/core/stores/FinstrongStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { format } from 'date-fns/format'\nimport { fromUnixTime } from 'date-fns/fromUnixTime'\nimport { getUnixTime } from 'date-fns/getUnixTime'\nimport { subMonths } from 'date-fns/subMonths'\n\nimport { FinstrongApi } from '../api'\nimport type {\n MonthlySummaries,\n HealthScore,\n HealthScoreReport,\n MonthlyHealthScore,\n Transaction,\n} from '../types'\nimport type { FinstrongTransaction, PeerAverage } from '../types/Finstrong'\nimport { augmentChartData, augmentSpendingFeeTransactions } from '../utils/FinstrongUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class FinstrongStore {\n api = new FinstrongApi('/', '')\n augmentedChartData: { x: string; y: number }[] = []\n averageHealthScores: MonthlyHealthScore[] = []\n monthlySummaries: MonthlySummaries[] = []\n incomeTransactions: FinstrongTransaction[] = []\n debtSpendTransactions: FinstrongTransaction[] = []\n spendingFeeTransactions: Transaction[] = []\n spendTransactions: FinstrongTransaction[] = []\n globalStore: GlobalStore\n healthScore: HealthScore = {} as HealthScore\n healthScoreChange?: number\n healthScoreChangeReports: HealthScoreReport[] = []\n peerScore: PeerAverage | null = null\n isSpendingInitialized: boolean = false\n isIncomeInitialized: boolean = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new FinstrongApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n makeAutoObservable(this)\n }\n\n setSpendingInitialized = (isSpendingInitialized: boolean) => {\n this.isSpendingInitialized = isSpendingInitialized\n }\n\n setIncomeInitialized = (isIncomeInitialized: boolean) => {\n this.isIncomeInitialized = isIncomeInitialized\n }\n\n calculateHealthScore = async (needHealthScoreChangeReport: boolean = true) => {\n try {\n const healthScore = await this.api.calculateHealthScore()\n\n let healthScoreChange = 0\n\n if (needHealthScoreChangeReport) {\n await this.loadHealthScoreChangeReports()\n }\n\n const currentScore = healthScore?.health_score || 0\n const oldScore = this.healthScoreChangeReports.at(-1)?.older_health_score || 0\n healthScoreChange = currentScore - oldScore\n\n runInAction(() => {\n this.healthScore = healthScore\n this.healthScoreChange = healthScoreChange\n })\n } catch (e) {\n this.captureError('calculateHealthScore', e)\n }\n }\n\n loadAverageHealthScores = async () => {\n try {\n const averageHealthScores = await this.api.getAverageHealthScores()\n runInAction(() => {\n this.averageHealthScores = averageHealthScores\n })\n } catch (e) {\n this.captureError('loadAverageHealthScores', e)\n }\n }\n\n loadMonthlySummaries = async () => {\n try {\n const monthlySummaries = await this.api.getMonthlySummaries()\n runInAction(() => {\n this.monthlySummaries = monthlySummaries\n })\n } catch (e) {\n this.captureError('loadMonthlySummaries', e)\n }\n }\n\n loadDebtSpend = async () => {\n try {\n const debtSpend = await this.api.getDebtSpend()\n runInAction(() => {\n this.debtSpendTransactions = debtSpend\n })\n } catch (e) {\n this.captureError('loadDebtSpend', e)\n }\n }\n\n loadIncome = async () => {\n this.setIncomeInitialized(false)\n try {\n const income = await this.api.getIncome()\n runInAction(() => {\n this.incomeTransactions = income\n this.setIncomeInitialized(true)\n })\n } catch (e) {\n this.captureError('loadIncome', e)\n }\n }\n\n loadHealthScoreChangeReports = async () => {\n const startDate = getUnixTime(subMonths(new Date(), 2))\n const endDate = getUnixTime(new Date())\n\n try {\n const healthScoreChangeReports = await this.api.getHealthScoreChangeReports(\n startDate,\n endDate,\n )\n runInAction(() => {\n this.healthScoreChangeReports = healthScoreChangeReports\n })\n } catch (e) {\n this.captureError('loadHealthScoreChangeReports', e)\n }\n }\n\n loadPeerScore = async () => {\n const birthYear = format(fromUnixTime(this.globalStore.appDataStore.user.birthday!), 'yyyy')\n\n try {\n const peerScore = await this.api.getPeerScore(birthYear)\n runInAction(() => {\n this.peerScore = peerScore\n })\n } catch (e) {\n this.captureError('loadPeerScore', e)\n }\n }\n\n loadAugmentedChartData = async () => {\n try {\n const augmentedChartData = await this.api.getAverageHealthScores()\n\n runInAction(() => {\n this.augmentedChartData = augmentChartData(augmentedChartData)\n })\n } catch (error) {\n this.captureError('loadAugmentedChartData', error)\n }\n }\n\n getSpendingFeeTransactions = async () => {\n try {\n const spendingFeeTransaction = await this.api.getSpendingFeeTransactions()\n const organizedSpendingFeeTransactions =\n augmentSpendingFeeTransactions(spendingFeeTransaction)\n runInAction(() => {\n this.spendingFeeTransactions = organizedSpendingFeeTransactions\n })\n } catch (error) {\n this.captureError('getSpendingFeeTransactions', error)\n }\n }\n\n loadSpendTransactions = async () => {\n this.setSpendingInitialized(false)\n try {\n const spendTransaction = await this.api.getStandardSpend()\n runInAction(() => {\n this.spendTransactions = [...spendTransaction]\n this.setSpendingInitialized(true)\n })\n } catch (e) {\n this.captureError('loadSpendTransactions', e)\n }\n }\n\n get spendAndDebtTransactions() {\n return [...this.spendTransactions, ...this.debtSpendTransactions]\n }\n\n get allTransactions() {\n return {\n income: this.incomeTransactions,\n debtSpend: this.debtSpendTransactions,\n spendingFee: this.spendingFeeTransactions,\n spend: this.spendTransactions,\n }\n }\n handleFinstrongWidgetPrimaryCtaClick = (value: string) => () => {\n // eslint-disable-next-line no-void\n void value\n }\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.captureException(error, { store: 'FinstrongStore', action })\n}\n"],"mappings":";;;;;;;AAoBA,IAAa,IAAb,MAA4B;AAAA,EAC1B,MAAM,IAAI,EAAa,KAAK,EAAE;AAAA,EAC9B,qBAAiD,CAAC;AAAA,EAClD,sBAA4C,CAAC;AAAA,EAC7C,mBAAuC,CAAC;AAAA,EACxC,qBAA6C,CAAC;AAAA,EAC9C,wBAAgD,CAAC;AAAA,EACjD,0BAAyC,CAAC;AAAA,EAC1C,oBAA4C,CAAC;AAAA,EAC7C;AAAA,EACA,cAA2B,CAAC;AAAA,EAC5B;AAAA,EACA,2BAAgD,CAAC;AAAA,EACjD,YAAgC;AAAA,EAChC,wBAAiC;AAAA,EACjC,sBAA+B;AAAA,EAE/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A,EACF;AAAA,EAEA,6BAA6B,YAAY;AACvC,QAAI;AACF,YAAM,IAAyB,MAAM,KAAK,IAAI,2BAA2B,GACnE,IACJ,EAA+B,CAAsB;AACvD,MAAA,EAAA,MAAkB;AAChB,aAAK,0BAA0B;AAAA,MACjC,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,8BAA8B,CAAK;AAAA,IACvD;AAAA,EACF;AAAA,EAEA,wBAAwB,YAAY;AAClC,SAAK,uBAAuB,EAAK;AACjC,QAAI;AACF,YAAM,IAAmB,MAAM,KAAK,IAAI,iBAAiB;AACzD,MAAA,EAAA,MAAkB;AAChB,aAAK,oBAAoB,CAAC,GAAG,CAAgB,GAC7C,KAAK,uBAAuB,EAAI;AAAA,MAClC,CAAC;AAAA,IACH,SAAS,GAAG;AACV,WAAK,aAAa,yBAAyB,CAAC;AAAA,IAC9C;AAAA,EACF;AAAA,EAEA,IAAI,2BAA2B;AAC7B,WAAO,CAAC,GAAG,KAAK,mBAAmB,GAAG,KAAK,qBAAqB;AAAA,EAClE;AAAA,EAEA,IAAI,kBAAkB;AACpB,WAAO;AAAA,MACL,QAAQ,KAAK;AAAA,MACb,WAAW,KAAK;AAAA,MAChB,aAAa,KAAK;AAAA,MAClB,OAAO,KAAK;AAAA,IACd;AAAA,EACF;AAAA,EACA,uCAAA,CAAwC,MAAA,MAAwB;AAAA,EAGhE;AAAA,EAEA,eAAA,CAAwB,GAAgB,MACtC,KAAK,YAAY,iBAAiB,GAAO;AAAA,IAAE,OAAO;AAAA,IAAkB,QAAA;AAAA,EAAO,CAAC;AAChF"}
|
|
@@ -3,7 +3,7 @@ import { GoalApi as n } from "../api/GoalApi.es.js";
|
|
|
3
3
|
import { upsertByGuid as l } from "../utils/upsertByGuid.es.js";
|
|
4
4
|
import { getProjectedRetirementDate as c } from "../utils/GoalsUtil.es.js";
|
|
5
5
|
import { makeAutoObservable as d, runInAction as s } from "mobx";
|
|
6
|
-
var
|
|
6
|
+
var y = class {
|
|
7
7
|
globalStore;
|
|
8
8
|
api = new n("/", "");
|
|
9
9
|
goals = [];
|
|
@@ -17,54 +17,54 @@ var g = class {
|
|
|
17
17
|
newRetirementGoalAccounts = [];
|
|
18
18
|
alert = "";
|
|
19
19
|
selectedGoal = void 0;
|
|
20
|
-
constructor(
|
|
21
|
-
this.globalStore =
|
|
20
|
+
constructor(t) {
|
|
21
|
+
this.globalStore = t, this.api = new n(t.endpoint, t.sessionToken, t.onError), d(this);
|
|
22
22
|
}
|
|
23
23
|
get allGoals() {
|
|
24
24
|
if (!this.isAllGoalDataLoaded) return [];
|
|
25
|
-
const
|
|
25
|
+
const t = this.globalStore.copyStore.copy.goals, e = this.globalStore.userStore.user.birthday;
|
|
26
26
|
return [...this.goals, ...this.retirementGoals.map((o) => ({
|
|
27
27
|
...o,
|
|
28
28
|
amount: o.target_amount,
|
|
29
|
-
name:
|
|
29
|
+
name: t.retirement,
|
|
30
30
|
track_type: a.RETIREMENT_TRACK,
|
|
31
|
-
projected_to_complete_at: o.retirement_age &&
|
|
31
|
+
projected_to_complete_at: o.retirement_age && e ? c(o.retirement_age, e) : void 0
|
|
32
32
|
}))];
|
|
33
33
|
}
|
|
34
34
|
get orderedGoals() {
|
|
35
|
-
return this.allGoals.slice().sort((
|
|
35
|
+
return this.allGoals.slice().sort((t, e) => t.position - e.position);
|
|
36
36
|
}
|
|
37
37
|
get debtGoals() {
|
|
38
|
-
return this.orderedGoals.filter((
|
|
38
|
+
return this.orderedGoals.filter((t) => t.track_type === a.DEBT_TRACK);
|
|
39
39
|
}
|
|
40
40
|
get retirmentGoals() {
|
|
41
|
-
return this.orderedGoals.filter((
|
|
41
|
+
return this.orderedGoals.filter((t) => t.track_type === a.RETIREMENT_TRACK);
|
|
42
42
|
}
|
|
43
43
|
get savingGoals() {
|
|
44
|
-
return this.orderedGoals.filter((
|
|
44
|
+
return this.orderedGoals.filter((t) => t.track_type === a.SAVINGS_TRACK);
|
|
45
45
|
}
|
|
46
46
|
get ongoingGoalsForMicroWidget() {
|
|
47
|
-
const
|
|
47
|
+
const t = this.allGoals.filter((o) => !o.is_complete && o.track_type !== a.EMERGENCY_FUND_TRACK && o.track_type !== null), e = [
|
|
48
48
|
a.SAVINGS_TRACK,
|
|
49
49
|
a.DEBT_TRACK,
|
|
50
50
|
a.RETIREMENT_TRACK
|
|
51
51
|
];
|
|
52
|
-
return
|
|
52
|
+
return t.sort((o, r) => (o.track_type ? e.indexOf(o.track_type) : -1) - (r.track_type ? e.indexOf(r.track_type) : -1)).slice(0, 3);
|
|
53
53
|
}
|
|
54
54
|
get isAllGoalDataLoaded() {
|
|
55
55
|
return this.goalsLoaded && this.retirementGoalsLoaded && this.retirementGoalAccountsLoaded && this.monthlyCashFlowProfileLoaded;
|
|
56
56
|
}
|
|
57
|
-
setGoals = (
|
|
58
|
-
this.goals =
|
|
57
|
+
setGoals = (t) => {
|
|
58
|
+
this.goals = t, this.goalsLoaded = !0;
|
|
59
59
|
};
|
|
60
|
-
setRetirementGoals = (
|
|
61
|
-
this.retirementGoals =
|
|
60
|
+
setRetirementGoals = (t) => {
|
|
61
|
+
this.retirementGoals = t, this.retirementGoalsLoaded = !0;
|
|
62
62
|
};
|
|
63
|
-
setRetirementGoalAccounts = (
|
|
64
|
-
this.retirementGoalAccounts =
|
|
63
|
+
setRetirementGoalAccounts = (t) => {
|
|
64
|
+
this.retirementGoalAccounts = t, this.retirementGoalAccountsLoaded = !0;
|
|
65
65
|
};
|
|
66
|
-
setMonthlyCashFlowProfile = (
|
|
67
|
-
this.monthlyCashFlowProfile =
|
|
66
|
+
setMonthlyCashFlowProfile = (t) => {
|
|
67
|
+
this.monthlyCashFlowProfile = t, this.monthlyCashFlowProfileLoaded = !0;
|
|
68
68
|
};
|
|
69
69
|
loadGoalData = async () => {
|
|
70
70
|
await Promise.all([
|
|
@@ -76,154 +76,158 @@ var g = class {
|
|
|
76
76
|
};
|
|
77
77
|
loadGoals = async () => {
|
|
78
78
|
try {
|
|
79
|
-
const
|
|
80
|
-
this.setGoals(
|
|
81
|
-
} catch (
|
|
82
|
-
|
|
79
|
+
const t = await this.api.getGoals();
|
|
80
|
+
this.setGoals(t);
|
|
81
|
+
} catch (t) {
|
|
82
|
+
this.captureError("loadGoals", t);
|
|
83
83
|
}
|
|
84
84
|
};
|
|
85
85
|
loadRetirementGoals = async () => {
|
|
86
86
|
try {
|
|
87
|
-
const
|
|
88
|
-
this.setRetirementGoals(
|
|
89
|
-
} catch (
|
|
90
|
-
|
|
87
|
+
const t = await this.api.getRetirementGoals();
|
|
88
|
+
this.setRetirementGoals(t);
|
|
89
|
+
} catch (t) {
|
|
90
|
+
this.captureError("loadRetirementGoals", t);
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
93
|
loadRetirementGoalAccounts = async () => {
|
|
94
94
|
try {
|
|
95
|
-
const
|
|
96
|
-
this.setRetirementGoalAccounts(
|
|
97
|
-
} catch (
|
|
98
|
-
|
|
95
|
+
const t = await this.api.getRetirementGoalAccounts();
|
|
96
|
+
this.setRetirementGoalAccounts(t);
|
|
97
|
+
} catch (t) {
|
|
98
|
+
this.captureError("loadRetirementGoalAccounts", t);
|
|
99
99
|
}
|
|
100
100
|
};
|
|
101
101
|
loadMonthlyCashFlowProfile = async () => {
|
|
102
102
|
try {
|
|
103
|
-
const
|
|
104
|
-
this.setMonthlyCashFlowProfile(
|
|
105
|
-
} catch (
|
|
106
|
-
|
|
103
|
+
const t = await this.api.getMonthlyCashFlowProfile();
|
|
104
|
+
this.setMonthlyCashFlowProfile(t);
|
|
105
|
+
} catch (t) {
|
|
106
|
+
this.captureError("loadMonthlyCashFlowProfile", t);
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
addGoal = async (
|
|
109
|
+
addGoal = async (t) => {
|
|
110
110
|
try {
|
|
111
|
-
const
|
|
112
|
-
this.setGoals(l(this.goals,
|
|
113
|
-
} catch (
|
|
114
|
-
|
|
111
|
+
const e = await this.api.addGoal(t);
|
|
112
|
+
this.setGoals(l(this.goals, e));
|
|
113
|
+
} catch (e) {
|
|
114
|
+
this.captureError("addGoal", e);
|
|
115
115
|
}
|
|
116
116
|
};
|
|
117
|
-
addRetirementGoal = async (
|
|
117
|
+
addRetirementGoal = async (t) => {
|
|
118
118
|
try {
|
|
119
|
-
const
|
|
119
|
+
const e = await this.api.addRetirementGoal(t), o = [];
|
|
120
120
|
for (const r of this.newRetirementGoalAccounts) {
|
|
121
121
|
const i = await this.api.addRetirementGoalAccount({
|
|
122
122
|
...r,
|
|
123
|
-
retirement_goal_guid:
|
|
123
|
+
retirement_goal_guid: e.guid
|
|
124
124
|
});
|
|
125
125
|
o.push(i);
|
|
126
126
|
}
|
|
127
127
|
this.setNewRetirementGoalAccounts([]), s(() => {
|
|
128
|
-
this.setRetirementGoals(l(this.retirementGoals,
|
|
128
|
+
this.setRetirementGoals(l(this.retirementGoals, e)), this.setRetirementGoalAccounts(o.reduce((r, i) => l(r, i), this.retirementGoalAccounts));
|
|
129
129
|
});
|
|
130
|
-
} catch (
|
|
131
|
-
|
|
130
|
+
} catch (e) {
|
|
131
|
+
this.captureError("addRetirementGoal", e);
|
|
132
132
|
}
|
|
133
133
|
};
|
|
134
|
-
addRetirementGoalAccount = async (
|
|
134
|
+
addRetirementGoalAccount = async (t) => {
|
|
135
135
|
try {
|
|
136
|
-
const
|
|
136
|
+
const e = await this.api.addRetirementGoalAccount(t);
|
|
137
137
|
s(() => {
|
|
138
|
-
this.retirementGoalAccounts = l(this.retirementGoalAccounts,
|
|
138
|
+
this.retirementGoalAccounts = l(this.retirementGoalAccounts, e);
|
|
139
139
|
});
|
|
140
|
-
} catch (
|
|
141
|
-
|
|
140
|
+
} catch (e) {
|
|
141
|
+
this.captureError("addRetirementGoalAccount", e);
|
|
142
142
|
}
|
|
143
143
|
};
|
|
144
|
-
deleteGoal = async (
|
|
144
|
+
deleteGoal = async (t) => {
|
|
145
145
|
try {
|
|
146
|
-
await this.api.removeGoal(
|
|
147
|
-
const
|
|
148
|
-
|
|
149
|
-
} catch (
|
|
150
|
-
|
|
146
|
+
await this.api.removeGoal(t);
|
|
147
|
+
const e = this.goals.findIndex((o) => o.guid === t);
|
|
148
|
+
e >= 0 && this.goals.splice(e, 1);
|
|
149
|
+
} catch (e) {
|
|
150
|
+
this.captureError("deleteGoal", e);
|
|
151
151
|
}
|
|
152
152
|
};
|
|
153
|
-
deleteRetirementGoal = async (
|
|
153
|
+
deleteRetirementGoal = async (t) => {
|
|
154
154
|
try {
|
|
155
|
-
const
|
|
156
|
-
for (const r of
|
|
157
|
-
await this.api.removeRetirementGoal(
|
|
158
|
-
const o = this.retirementGoals.findIndex((r) => r.guid ===
|
|
155
|
+
const e = this.retirementGoalAccounts.filter((r) => r.retirement_goal_guid === t.guid);
|
|
156
|
+
for (const r of e) await this.deleteRetirementGoalAccount(r.guid);
|
|
157
|
+
await this.api.removeRetirementGoal(t.guid);
|
|
158
|
+
const o = this.retirementGoals.findIndex((r) => r.guid === t.guid);
|
|
159
159
|
o >= 0 && this.retirementGoals.splice(o, 1);
|
|
160
|
-
} catch (
|
|
161
|
-
|
|
160
|
+
} catch (e) {
|
|
161
|
+
this.captureError("deleteRetirementGoal", e);
|
|
162
162
|
}
|
|
163
163
|
};
|
|
164
|
-
deleteRetirementGoalAccount = async (
|
|
164
|
+
deleteRetirementGoalAccount = async (t) => {
|
|
165
165
|
try {
|
|
166
|
-
await this.api.removeRetirementGoalAccount(
|
|
167
|
-
const
|
|
168
|
-
|
|
169
|
-
} catch (
|
|
170
|
-
|
|
166
|
+
await this.api.removeRetirementGoalAccount(t);
|
|
167
|
+
const e = this.retirementGoalAccounts.findIndex((o) => o.guid === t);
|
|
168
|
+
e >= 0 && this.retirementGoalAccounts.splice(e, 1);
|
|
169
|
+
} catch (e) {
|
|
170
|
+
this.captureError("deleteRetirementGoalAccount", e);
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
reorderGoals = async (
|
|
173
|
+
reorderGoals = async (t) => {
|
|
174
174
|
try {
|
|
175
|
-
const
|
|
175
|
+
const e = await this.api.reorderGoals(t);
|
|
176
176
|
s(() => {
|
|
177
|
-
for (const o of
|
|
177
|
+
for (const o of e) {
|
|
178
178
|
const r = this.goals.findIndex((i) => i.guid === o.guid);
|
|
179
179
|
r >= 0 && (this.goals[r].position = o.position);
|
|
180
180
|
}
|
|
181
181
|
});
|
|
182
|
-
} catch (
|
|
183
|
-
|
|
182
|
+
} catch (e) {
|
|
183
|
+
this.captureError("reorderGoals", e);
|
|
184
184
|
}
|
|
185
185
|
};
|
|
186
|
-
setAlert = (
|
|
187
|
-
setNewRetirementGoalAccounts = (
|
|
188
|
-
this.newRetirementGoalAccounts =
|
|
186
|
+
setAlert = (t) => this.alert = t;
|
|
187
|
+
setNewRetirementGoalAccounts = (t) => {
|
|
188
|
+
this.newRetirementGoalAccounts = t;
|
|
189
189
|
};
|
|
190
|
-
setSelectedGoal = (
|
|
191
|
-
updateGoal = async (
|
|
190
|
+
setSelectedGoal = (t) => this.selectedGoal = t;
|
|
191
|
+
updateGoal = async (t) => {
|
|
192
192
|
try {
|
|
193
|
-
const
|
|
193
|
+
const e = await this.api.updateGoal(t);
|
|
194
194
|
s(() => {
|
|
195
|
-
const o = this.goals.findIndex((r) => r.guid ===
|
|
196
|
-
o >= 0 && (this.goals[o] =
|
|
195
|
+
const o = this.goals.findIndex((r) => r.guid === t.guid);
|
|
196
|
+
o >= 0 && (this.goals[o] = e), this.selectedGoal?.guid === t.guid && this.setSelectedGoal(e);
|
|
197
197
|
});
|
|
198
|
-
} catch (
|
|
199
|
-
|
|
198
|
+
} catch (e) {
|
|
199
|
+
this.captureError("updateGoal", e);
|
|
200
200
|
}
|
|
201
201
|
};
|
|
202
|
-
updateRetirementGoal = async (
|
|
202
|
+
updateRetirementGoal = async (t) => {
|
|
203
203
|
try {
|
|
204
|
-
const
|
|
205
|
-
...
|
|
206
|
-
target_amount:
|
|
204
|
+
const e = await this.api.updateRetirementGoal({
|
|
205
|
+
...t,
|
|
206
|
+
target_amount: t.amount
|
|
207
207
|
});
|
|
208
208
|
s(() => {
|
|
209
|
-
const o = this.retirementGoals.findIndex((r) => r.guid ===
|
|
210
|
-
o >= 0 && (this.retirementGoals[o] =
|
|
209
|
+
const o = this.retirementGoals.findIndex((r) => r.guid === t.guid);
|
|
210
|
+
o >= 0 && (this.retirementGoals[o] = e), this.selectedGoal?.guid === t.guid && this.setSelectedGoal(this.allGoals.find((r) => r.guid === t.guid));
|
|
211
211
|
});
|
|
212
|
-
} catch (
|
|
213
|
-
|
|
212
|
+
} catch (e) {
|
|
213
|
+
this.captureError("updateRetirementGoal", e);
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
|
-
updateMonthlyCashFlowProfile = async (
|
|
216
|
+
updateMonthlyCashFlowProfile = async (t) => {
|
|
217
217
|
try {
|
|
218
|
-
const
|
|
219
|
-
this.setMonthlyCashFlowProfile(
|
|
220
|
-
} catch (
|
|
221
|
-
|
|
218
|
+
const e = await this.api.updateMonthlyCashFlowProfile(t);
|
|
219
|
+
this.setMonthlyCashFlowProfile(e);
|
|
220
|
+
} catch (e) {
|
|
221
|
+
this.captureError("updateMonthlyCashFlowProfile", e);
|
|
222
222
|
}
|
|
223
223
|
};
|
|
224
|
+
captureError = (t, e) => this.globalStore.captureException(e, {
|
|
225
|
+
store: "GoalStore",
|
|
226
|
+
action: t
|
|
227
|
+
});
|
|
224
228
|
};
|
|
225
229
|
export {
|
|
226
|
-
|
|
230
|
+
y as GoalStore
|
|
227
231
|
};
|
|
228
232
|
|
|
229
233
|
//# sourceMappingURL=GoalStore.es.js.map
|