@mx-cartographer/experiences 9.6.8 → 9.6.10
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 +8 -0
- package/dist/core/stores/AccountStore.d.ts +1 -0
- package/dist/core/stores/AccountStore.es.js +47 -42
- package/dist/core/stores/AccountStore.es.js.map +1 -1
- package/dist/core/stores/AppDataStore.d.ts +1 -0
- package/dist/core/stores/AppDataStore.es.js +15 -11
- package/dist/core/stores/AppDataStore.es.js.map +1 -1
- package/dist/core/stores/BeatStore.d.ts +1 -0
- package/dist/core/stores/BeatStore.es.js +10 -6
- package/dist/core/stores/BeatStore.es.js.map +1 -1
- package/dist/core/stores/BudgetsStore.d.ts +1 -0
- package/dist/core/stores/BudgetsStore.es.js +37 -35
- package/dist/core/stores/BudgetsStore.es.js.map +1 -1
- package/dist/core/stores/CategoryStore.d.ts +1 -0
- package/dist/core/stores/CategoryStore.es.js +36 -32
- package/dist/core/stores/CategoryStore.es.js.map +1 -1
- package/dist/core/stores/GlobalCopyStore.d.ts +1 -0
- package/dist/core/stores/GlobalCopyStore.es.js +17 -13
- package/dist/core/stores/GlobalCopyStore.es.js.map +1 -1
- package/dist/core/stores/HoldingStore.d.ts +1 -0
- package/dist/core/stores/HoldingStore.es.js +6 -2
- package/dist/core/stores/HoldingStore.es.js.map +1 -1
- package/dist/core/stores/TransactionStore.d.ts +1 -0
- package/dist/core/stores/TransactionStore.es.js +71 -67
- package/dist/core/stores/TransactionStore.es.js.map +1 -1
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +1 -1
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js +6 -6
- package/dist/insights-v2/actionBlocks/MakeTransferActionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.d.ts +2 -2
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js +15 -15
- package/dist/insights-v2/actionBlocks/TransactionHistoryBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.d.ts +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.es.js +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.d.ts +1 -1
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js +16 -16
- package/dist/insights-v2/blocks/ChartBlocks/BarchartBlock/utils.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js +6 -7
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/AccountBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.d.ts +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js +14 -30
- package/dist/insights-v2/blocks/ComponentBlocks/AccountBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.d.ts +8 -8
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js +14 -14
- package/dist/insights-v2/blocks/ComponentBlocks/TransactionBlock/layout.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/UpcomingSubscriptionBlock.es.js.map +1 -1
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/layout.d.ts +4 -3
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/layout.es.js +2 -2
- package/dist/insights-v2/blocks/ComponentBlocks/UpcomingSubscriptionBlock/layout.es.js.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## [9.6.10] - 10-14-2026
|
|
2
|
+
|
|
3
|
+
- **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)
|
|
4
|
+
|
|
5
|
+
## [9.6.9] - 10-13-2026
|
|
6
|
+
|
|
7
|
+
- **CHANGED** - Renamed Insights V2 `instance_slot.variant` / CTA `variant` values from beat-specific names to behavior/design names so any beat can reuse them (ditto-contract changes — the backend must send the new values). AccountBlock: `transparent_overdraft`→`overdraft_warning`, `low_account_balance`→`low_balance_alert`, `monthly_credit_card_interest_summary`→`interest_charges_summary`, `celebrate_credit_card_payoff`→`payoff_celebration`, `savings_account_deposit`→`savings_deposit`, and `unified_deposit` + `unified_deposit_emergency_fund` collapsed into a single `deposit_received` (their layout configs were identical). TransactionBlock: `subscription_detected`→`info_wash`, `unexpected_subscription_payment`→`warning_wash`. TransactionHistoryBlock / BarchartBlock: `bill_amount_not_standard`→`not_standard_amount`, `savings_account_balances_summary`→`account_balance` (the `savings_account_balances_summary_drawer_title` copy key becomes `account_balance_drawer_title` — paired `mrs_content` change). MakeTransfer: payload keys `save_an_extra_100`→`save_extra`, `save_enough_to_live_on`→`save_enough` (aligning with the existing `save_extra_title`/`save_enough_title` copy). UpcomingSubscriptionBlock: `upcoming_subscription`→`hero`. Updated all layout maps, mock payloads, stories and tests; unrelated Settings notification copy keys that share these strings were left untouched
|
|
8
|
+
|
|
1
9
|
## [9.6.8] - 10-13-2026
|
|
2
10
|
|
|
3
11
|
- **ADDED** - Dashboard banner can open the Connect widget in-app: a connect-type banner (`deep_link_type`) opens `ConnectDrawer` instead of an external link, with banner and connect-widget analytics (MEW-3504)
|
|
@@ -57,6 +57,7 @@ export declare class AccountStore {
|
|
|
57
57
|
updateAccount: (account: Account) => Promise<boolean>;
|
|
58
58
|
updateAccountBalance: (accountGuid: string, balanceChange: number) => void;
|
|
59
59
|
updateAccountFilter: (accountMap: Map<string, boolean>) => Promise<void>;
|
|
60
|
+
private captureError;
|
|
60
61
|
}
|
|
61
62
|
declare class UiStore {
|
|
62
63
|
selectedAccount: Account;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AccountSubType as a, AccountType as
|
|
1
|
+
import { AccountSubType as a, AccountType as s } from "../types/Account.es.js";
|
|
2
2
|
import { AccountApi as h } from "../api/AccountApi.es.js";
|
|
3
3
|
import { upsertByGuid as p } from "../utils/upsertByGuid.es.js";
|
|
4
4
|
import { augmentAccounts as g } from "../utils/AccountUtils.es.js";
|
|
5
5
|
import { isFeatureEnabled as m } from "../utils/UserUtils.es.js";
|
|
6
|
-
import { makeAutoObservable as
|
|
7
|
-
var
|
|
6
|
+
import { makeAutoObservable as l, runInAction as d } from "mobx";
|
|
7
|
+
var L = class {
|
|
8
8
|
globalStore;
|
|
9
9
|
api = new h("/", "");
|
|
10
10
|
accounts = [];
|
|
@@ -18,7 +18,7 @@ var C = class {
|
|
|
18
18
|
membersLoading = !1;
|
|
19
19
|
uiStore;
|
|
20
20
|
constructor(t) {
|
|
21
|
-
this.globalStore = t, this.uiStore = new _(), this.api = new h(t.endpoint, t.sessionToken, t.onError),
|
|
21
|
+
this.globalStore = t, this.uiStore = new _(), this.api = new h(t.endpoint, t.sessionToken, t.onError), l(this);
|
|
22
22
|
}
|
|
23
23
|
loadAccountData = async () => {
|
|
24
24
|
await Promise.all([
|
|
@@ -31,48 +31,48 @@ var C = class {
|
|
|
31
31
|
return this.accountsLoaded && this.membersLoaded && this.institutionsLoaded;
|
|
32
32
|
}
|
|
33
33
|
get detailedAccounts() {
|
|
34
|
-
const t = this.globalStore.userStore.userFeatures, e = m(t, "MD_EXCLUDE_EXTERNAL_ACCOUNTS"),
|
|
35
|
-
return g(this.accounts, this.institutions, this.members, e,
|
|
34
|
+
const t = this.globalStore.userStore.userFeatures, e = m(t, "MD_EXCLUDE_EXTERNAL_ACCOUNTS"), c = this.globalStore.appConfig.config.display_only_external_accounts_in_accounts && this.globalStore.appConfig.options.subtype === "accounts";
|
|
35
|
+
return g(this.accounts, this.institutions, this.members, e, c);
|
|
36
36
|
}
|
|
37
37
|
get accountsByTypeMap() {
|
|
38
38
|
return this.detailedAccounts.reduce((t, e) => {
|
|
39
|
-
const
|
|
40
|
-
let n = t.get(
|
|
41
|
-
return n || (n = []), n.push(e), t.set(
|
|
39
|
+
const c = e.account_type;
|
|
40
|
+
let n = t.get(c);
|
|
41
|
+
return n || (n = []), n.push(e), t.set(c, n), t;
|
|
42
42
|
}, /* @__PURE__ */ new Map());
|
|
43
43
|
}
|
|
44
44
|
get cashAccounts() {
|
|
45
|
-
return this.detailedAccounts.filter((t) => t.account_type ===
|
|
45
|
+
return this.detailedAccounts.filter((t) => t.account_type === s.CASH || t.account_type === s.CHECKING || t.account_type === s.PREPAID || t.account_type === s.SAVINGS || t.account_type === s.CHECKING_LINE_OF_CREDIT);
|
|
46
46
|
}
|
|
47
47
|
get cashBalance() {
|
|
48
48
|
return this.cashAccounts.reduce((t, e) => t + (e?.balance || 0), 0);
|
|
49
49
|
}
|
|
50
50
|
get checkingAccounts() {
|
|
51
|
-
return this.detailedAccounts.filter((t) => t.account_type ===
|
|
51
|
+
return this.detailedAccounts.filter((t) => t.account_type === s.CHECKING);
|
|
52
52
|
}
|
|
53
53
|
get debtAccounts() {
|
|
54
|
-
return this.detailedAccounts.filter((t) => t.account_type ===
|
|
54
|
+
return this.detailedAccounts.filter((t) => t.account_type === s.CREDIT_CARD || t.account_type === s.LOAN || t.account_type === s.MORTGAGE || t.account_type === s.LINE_OF_CREDIT || t.account_type === s.CHECKING_LINE_OF_CREDIT);
|
|
55
55
|
}
|
|
56
56
|
get finstrongAccounts() {
|
|
57
57
|
const t = /* @__PURE__ */ new Set([
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
s.CHECKING,
|
|
59
|
+
s.SAVINGS,
|
|
60
|
+
s.CREDIT_CARD,
|
|
61
|
+
s.INVESTMENT
|
|
62
62
|
]);
|
|
63
63
|
return this.detailedAccounts.filter((e) => t.has(e.account_type));
|
|
64
64
|
}
|
|
65
65
|
get investmentAccounts() {
|
|
66
|
-
return this.detailedAccounts.filter((t) => t.account_type ===
|
|
66
|
+
return this.detailedAccounts.filter((t) => t.account_type === s.INVESTMENT);
|
|
67
67
|
}
|
|
68
68
|
get manualAccounts() {
|
|
69
69
|
return this.detailedAccounts.filter((t) => t.is_manual);
|
|
70
70
|
}
|
|
71
71
|
get savingsAccounts() {
|
|
72
|
-
return this.detailedAccounts.filter((t) => t.account_type ===
|
|
72
|
+
return this.detailedAccounts.filter((t) => t.account_type === s.SAVINGS);
|
|
73
73
|
}
|
|
74
74
|
get retirementAccounts() {
|
|
75
|
-
return this.detailedAccounts.filter((t) => t.account_type ===
|
|
75
|
+
return this.detailedAccounts.filter((t) => t.account_type === s.INVESTMENT || t.account_type === s.SAVINGS || t.account_type === s.CHECKING || t.account_type === s.CASH || t.account_type === s.PROPERTY || t.account_type === s.INSURANCE && (t.account_subtype === a.WHOLE_LIFE || t.account_subtype === a.UNIVERSAL_LIFE || t.account_subtype === a.VARIABLE_UNIVERSAL_LIFE));
|
|
76
76
|
}
|
|
77
77
|
get visibleAccounts() {
|
|
78
78
|
return this.detailedAccounts.filter((t) => !t.is_hidden && !t.is_closed);
|
|
@@ -105,7 +105,7 @@ var C = class {
|
|
|
105
105
|
return this.savingsAndCheckingAccounts.reduce((t, e) => t + (e?.balance || 0), 0);
|
|
106
106
|
}
|
|
107
107
|
get savingsAndCheckingAccounts() {
|
|
108
|
-
return this.accounts.filter((t) => t.account_type ===
|
|
108
|
+
return this.accounts.filter((t) => t.account_type === s.SAVINGS || t.account_type === s.CHECKING);
|
|
109
109
|
}
|
|
110
110
|
setAccounts = (t) => {
|
|
111
111
|
this.accounts = t, this.accountsLoading = !1, this.accountsLoaded = !0;
|
|
@@ -123,7 +123,7 @@ var C = class {
|
|
|
123
123
|
this.accounts = p(this.accounts, e);
|
|
124
124
|
});
|
|
125
125
|
} catch (e) {
|
|
126
|
-
|
|
126
|
+
this.captureError("addAccount", e);
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
129
|
loadAccounts = async () => {
|
|
@@ -133,7 +133,7 @@ var C = class {
|
|
|
133
133
|
const t = await this.api.getAccounts();
|
|
134
134
|
this.setAccounts(t);
|
|
135
135
|
} catch (t) {
|
|
136
|
-
|
|
136
|
+
this.captureError("loadAccounts", t), this.setAccounts([]);
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
139
|
};
|
|
@@ -144,7 +144,7 @@ var C = class {
|
|
|
144
144
|
const t = await this.api.getInstitutions();
|
|
145
145
|
this.setInstitutions(t);
|
|
146
146
|
} catch (t) {
|
|
147
|
-
|
|
147
|
+
this.captureError("loadInstitutions", t), this.setInstitutions([]);
|
|
148
148
|
}
|
|
149
149
|
}
|
|
150
150
|
};
|
|
@@ -155,21 +155,21 @@ var C = class {
|
|
|
155
155
|
const t = await this.api.getMembers();
|
|
156
156
|
this.setMembers(t);
|
|
157
157
|
} catch (t) {
|
|
158
|
-
|
|
158
|
+
this.captureError("loadMembers", t), this.setMembers([]);
|
|
159
159
|
}
|
|
160
160
|
}
|
|
161
161
|
};
|
|
162
162
|
mergeAccounts = async (t) => {
|
|
163
163
|
try {
|
|
164
|
-
const e = await this.api.mergeAccounts(t),
|
|
164
|
+
const e = await this.api.mergeAccounts(t), c = e[Object.keys(e)[0]];
|
|
165
165
|
d(() => {
|
|
166
166
|
const n = this.accounts.findIndex((o) => o.guid === t[1]);
|
|
167
167
|
this.accounts.splice(n, 1);
|
|
168
168
|
const i = this.accounts.findIndex((o) => o.guid === t[0]);
|
|
169
|
-
this.accounts.splice(i, 1,
|
|
169
|
+
this.accounts.splice(i, 1, c);
|
|
170
170
|
});
|
|
171
171
|
} catch (e) {
|
|
172
|
-
|
|
172
|
+
this.captureError("mergeAccounts", e);
|
|
173
173
|
}
|
|
174
174
|
};
|
|
175
175
|
refreshAccounts = async () => {
|
|
@@ -183,30 +183,30 @@ var C = class {
|
|
|
183
183
|
try {
|
|
184
184
|
await this.api.refreshAllMembers();
|
|
185
185
|
} catch (t) {
|
|
186
|
-
|
|
186
|
+
this.captureError("refreshMembers", t);
|
|
187
187
|
}
|
|
188
188
|
};
|
|
189
189
|
removeAccount = async (t) => {
|
|
190
190
|
try {
|
|
191
191
|
await this.api.deleteAccount(t);
|
|
192
|
-
const e = this.accounts.findIndex((
|
|
192
|
+
const e = this.accounts.findIndex((c) => c.guid === t);
|
|
193
193
|
this.accounts.splice(e, 1);
|
|
194
194
|
} catch (e) {
|
|
195
|
-
|
|
195
|
+
this.captureError("removeAccount", e);
|
|
196
196
|
}
|
|
197
197
|
};
|
|
198
198
|
updateAccount = async (t) => {
|
|
199
199
|
try {
|
|
200
|
-
const e = await this.api.updateAccount(t),
|
|
201
|
-
return this.accounts.splice(
|
|
200
|
+
const e = await this.api.updateAccount(t), c = this.accounts.findIndex((n) => n.guid === e.guid);
|
|
201
|
+
return this.accounts.splice(c, 1, e), !0;
|
|
202
202
|
} catch (e) {
|
|
203
|
-
return
|
|
203
|
+
return this.captureError("updateAccount", e), !1;
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
206
|
updateAccountBalance = (t, e) => {
|
|
207
|
-
const
|
|
208
|
-
|
|
209
|
-
|
|
207
|
+
const c = this.accounts.find((n) => n.guid === t);
|
|
208
|
+
c && d(() => {
|
|
209
|
+
c.balance = (c.balance || 0) + e;
|
|
210
210
|
});
|
|
211
211
|
};
|
|
212
212
|
updateAccountFilter = async (t) => {
|
|
@@ -219,30 +219,35 @@ var C = class {
|
|
|
219
219
|
...r,
|
|
220
220
|
is_excluded_from_accounts: !o
|
|
221
221
|
};
|
|
222
|
-
e.push(this.api.updateAccount(u).catch((
|
|
222
|
+
e.push(this.api.updateAccount(u).catch((A) => (this.captureError("updateAccountFilter", A, { guid: i }), null)));
|
|
223
223
|
}
|
|
224
224
|
}
|
|
225
|
-
const
|
|
226
|
-
for (const i of
|
|
225
|
+
const c = (await Promise.all(e)).filter((i) => i !== null), n = [...this.accounts];
|
|
226
|
+
for (const i of c) {
|
|
227
227
|
const o = n.findIndex((r) => r.guid === i.guid);
|
|
228
228
|
o !== -1 && n.splice(o, 1, i);
|
|
229
229
|
}
|
|
230
230
|
this.setAccounts(n);
|
|
231
231
|
} catch (e) {
|
|
232
|
-
|
|
232
|
+
this.captureError("updateAccountFilter", e);
|
|
233
233
|
}
|
|
234
234
|
};
|
|
235
|
+
captureError = (t, e, c) => this.globalStore.captureException(e, {
|
|
236
|
+
store: "AccountStore",
|
|
237
|
+
action: t,
|
|
238
|
+
...c
|
|
239
|
+
});
|
|
235
240
|
}, _ = class {
|
|
236
241
|
selectedAccount = {};
|
|
237
242
|
selectedMember = {};
|
|
238
243
|
constructor() {
|
|
239
|
-
|
|
244
|
+
l(this);
|
|
240
245
|
}
|
|
241
246
|
setSelectedAccount = (t) => this.selectedAccount = t;
|
|
242
247
|
setSelectedMember = (t) => this.selectedMember = t;
|
|
243
248
|
};
|
|
244
249
|
export {
|
|
245
|
-
|
|
250
|
+
L as AccountStore
|
|
246
251
|
};
|
|
247
252
|
|
|
248
253
|
//# sourceMappingURL=AccountStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AccountStore.es.js","names":[],"sources":["../../../src/core/stores/AccountStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AccountApi } from '../api'\nimport { upsertByGuid } from '../utils/upsertByGuid'\nimport {\n type Account,\n type DetailedAccount,\n type Institution,\n type Member,\n AccountType,\n AccountSubType,\n} from '../types'\nimport { augmentAccounts } from '../utils/AccountUtils'\nimport { isFeatureEnabled } from '../utils/UserUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class AccountStore {\n globalStore: GlobalStore\n api: AccountApi = new AccountApi('/', '')\n\n accounts: Account[] = []\n accountsLoaded: boolean = false\n accountsLoading: boolean = false\n institutions: Institution[] = []\n institutionsLoaded: boolean = false\n institutionsLoading: boolean = false\n members: Member[] = []\n membersLoaded: boolean = false\n membersLoading: boolean = false\n uiStore: UiStore\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new AccountApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadAccountData = async () => {\n await Promise.all([this.loadAccounts(), this.loadMembers(), this.loadInstitutions()])\n }\n\n get isAccountDataLoaded(): boolean {\n return this.accountsLoaded && this.membersLoaded && this.institutionsLoaded\n }\n\n get detailedAccounts(): DetailedAccount[] {\n const userFeatures = this.globalStore.userStore.userFeatures\n const excludeExternal = isFeatureEnabled(userFeatures, 'MD_EXCLUDE_EXTERNAL_ACCOUNTS')\n\n // Hide held account when this flag is toggled and this is the individual accounts widget\n const excludeHeld =\n this.globalStore.appConfig.config.display_only_external_accounts_in_accounts &&\n this.globalStore.appConfig.options.subtype === 'accounts' // Indicates this is an individual widget\n\n return augmentAccounts(\n this.accounts,\n this.institutions,\n this.members,\n excludeExternal,\n excludeHeld,\n )\n }\n\n get accountsByTypeMap(): Map<AccountType, DetailedAccount[]> {\n return this.detailedAccounts.reduce((typeMap: Map<AccountType, DetailedAccount[]>, account) => {\n const accountType = account.account_type\n\n let accounts = typeMap.get(accountType)\n if (!accounts) {\n accounts = []\n }\n accounts.push(account)\n typeMap.set(accountType, accounts)\n\n return typeMap\n }, new Map<AccountType, DetailedAccount[]>())\n }\n\n get cashAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.CASH ||\n account.account_type === AccountType.CHECKING ||\n account.account_type === AccountType.PREPAID ||\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING_LINE_OF_CREDIT,\n )\n }\n\n get cashBalance(): number {\n return this.cashAccounts.reduce((total, account) => total + (account?.balance || 0), 0)\n }\n\n get checkingAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => a.account_type === AccountType.CHECKING)\n }\n\n get debtAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.CREDIT_CARD ||\n account.account_type === AccountType.LOAN ||\n account.account_type === AccountType.MORTGAGE ||\n account.account_type === AccountType.LINE_OF_CREDIT ||\n account.account_type === AccountType.CHECKING_LINE_OF_CREDIT,\n )\n }\n\n get finstrongAccounts(): DetailedAccount[] {\n const eligibleTypes = new Set([\n AccountType.CHECKING,\n AccountType.SAVINGS,\n AccountType.CREDIT_CARD,\n AccountType.INVESTMENT,\n ])\n\n return this.detailedAccounts.filter((account) => eligibleTypes.has(account.account_type))\n }\n\n get investmentAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) => account.account_type === AccountType.INVESTMENT,\n )\n }\n\n get manualAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((account) => account.is_manual)\n }\n\n get savingsAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => a.account_type === AccountType.SAVINGS)\n }\n\n get retirementAccounts(): Account[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.INVESTMENT ||\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING ||\n account.account_type === AccountType.CASH ||\n account.account_type === AccountType.PROPERTY ||\n (account.account_type === AccountType.INSURANCE &&\n (account.account_subtype === AccountSubType.WHOLE_LIFE ||\n account.account_subtype === AccountSubType.UNIVERSAL_LIFE ||\n account.account_subtype === AccountSubType.VARIABLE_UNIVERSAL_LIFE)),\n )\n }\n\n get visibleAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => !a.is_hidden && !a.is_closed)\n }\n\n get visibleCashAccounts(): DetailedAccount[] {\n return this.cashAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleCashBalance(): number {\n return this.visibleCashAccounts.reduce((total, account) => total + (account?.balance || 0), 0)\n }\n\n get visibleCheckingAccounts(): DetailedAccount[] {\n return this.checkingAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleDebtAccounts(): DetailedAccount[] {\n return this.debtAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleFinstrongAccounts(): DetailedAccount[] {\n return this.finstrongAccounts.filter(\n (account: Account) => !(account.is_closed || account.is_deleted || account.is_hidden),\n )\n }\n\n get visibleRetirementAccounts(): Account[] {\n return this.retirementAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleInvestmentAccounts(): DetailedAccount[] {\n return this.investmentAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleSavingsAccounts(): DetailedAccount[] {\n return this.savingsAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get savingsAndCheckingAccountsBalance(): number {\n const savingsAndCheckingAccountsList = this.savingsAndCheckingAccounts\n\n return savingsAndCheckingAccountsList.reduce(\n (total, account) => total + (account?.balance || 0),\n 0,\n )\n }\n\n get savingsAndCheckingAccounts(): Account[] {\n const savingsAndCheckingAccounts = this.accounts.filter(\n (account: Account) =>\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING,\n )\n\n return savingsAndCheckingAccounts\n }\n\n setAccounts = (accounts: Account[]) => {\n this.accounts = accounts\n this.accountsLoading = false\n this.accountsLoaded = true\n }\n\n setMembers = (members: Member[]) => {\n this.members = members\n this.membersLoading = false\n this.membersLoaded = true\n }\n\n setInstitutions = (institutions: Institution[]) => {\n this.institutions = institutions\n this.institutionsLoading = false\n this.institutionsLoaded = true\n }\n\n addAccount = async (account: Account) => {\n try {\n const newAccount = await this.api.createAccount(account)\n\n runInAction(() => {\n this.accounts = upsertByGuid(this.accounts, newAccount)\n })\n } catch (error) {\n console.error('Error occurred while adding an account:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n loadAccounts = async () => {\n if (this.accountsLoading) return\n\n this.accountsLoading = true\n try {\n const accounts = await this.api.getAccounts()\n this.setAccounts(accounts)\n } catch (error) {\n console.error('Error occurred while loading accounts:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n this.setAccounts([])\n }\n }\n\n loadInstitutions = async () => {\n if (this.institutionsLoading) return\n\n this.institutionsLoading = true\n try {\n const institutions = await this.api.getInstitutions()\n this.setInstitutions(institutions)\n } catch (error) {\n console.error('Error occurred while loading institutions:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n this.setInstitutions([])\n }\n }\n\n loadMembers = async () => {\n if (this.membersLoading) return\n\n this.membersLoading = true\n try {\n const members = await this.api.getMembers()\n this.setMembers(members)\n } catch (error) {\n console.error('Error occurred while loading members:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n this.setMembers([])\n }\n }\n\n mergeAccounts = async (accountGuids: string[]) => {\n try {\n const response = await this.api.mergeAccounts(accountGuids)\n // the response from the api is a funky database key here, so this is essentially just getting the first item in the returned object\n // to prevent making multiple api calls here\n const mergedAccount = response[Object.keys(response)[0]]\n\n runInAction(() => {\n const account2Index = this.accounts.findIndex((account) => account.guid === accountGuids[1])\n this.accounts.splice(account2Index, 1)\n\n const account1Index = this.accounts.findIndex((account) => account.guid === accountGuids[0])\n this.accounts.splice(account1Index, 1, mergedAccount)\n })\n } catch (error) {\n console.error('Error occurred while merging accounts:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n /**\n * DEPRECATED: Use loadAccountData instead\n */\n refreshAccounts = async () => {\n await Promise.all([this.loadAccounts(), this.loadInstitutions(), this.loadMembers()])\n }\n\n refreshMembers = async () => {\n try {\n await this.api.refreshAllMembers()\n } catch (error) {\n console.error('Error occurred while refreshing members:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n removeAccount = async (accountGuid: string) => {\n try {\n await this.api.deleteAccount(accountGuid)\n\n const deletedIndex = this.accounts.findIndex((account) => account.guid === accountGuid)\n this.accounts.splice(deletedIndex, 1)\n } catch (error) {\n console.error('Error occurred while removing an account:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n\n /** Resolves `true` when the account was saved, `false` when the API call failed. */\n updateAccount = async (account: Account): Promise<boolean> => {\n try {\n const updatedAccount = await this.api.updateAccount(account)\n\n const updatedAccountIndex = this.accounts.findIndex(\n (account) => account.guid === updatedAccount.guid,\n )\n\n this.accounts.splice(updatedAccountIndex, 1, updatedAccount)\n return true\n } catch (error) {\n console.error('Error occurred while updating account:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n return false\n }\n }\n\n updateAccountBalance = (accountGuid: string, balanceChange: number) => {\n const account = this.accounts.find((a) => a.guid === accountGuid)\n\n if (account) {\n runInAction(() => {\n account.balance = (account.balance || 0) + balanceChange\n })\n }\n }\n\n updateAccountFilter = async (accountMap: Map<string, boolean>) => {\n try {\n const accountUpdates: Promise<Account | null>[] = []\n for (const [guid, isSelected] of accountMap.entries()) {\n const account = this.accounts.find((acc) => acc.guid === guid)\n\n if (account && account.is_excluded_from_accounts === isSelected) {\n const updatedPayload = { ...account, is_excluded_from_accounts: !isSelected }\n accountUpdates.push(\n this.api.updateAccount(updatedPayload).catch((error) => {\n console.error('Error occurred while updating account filter:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n return null\n }),\n )\n }\n }\n\n const results = await Promise.all(accountUpdates)\n const updatedAccounts: Account[] = results.filter((acc): acc is Account => acc !== null)\n\n const accounts = [...this.accounts]\n for (const updatedAccount of updatedAccounts) {\n const index = accounts.findIndex((acc) => acc.guid === updatedAccount.guid)\n if (index !== -1) {\n accounts.splice(index, 1, updatedAccount)\n }\n }\n this.setAccounts(accounts)\n } catch (error) {\n console.error('Error occurred while updating account filter:', error)\n this.globalStore.captureException(error, { store: 'AccountStore' })\n }\n }\n}\n\n// TODO: Move into AccountStore\nclass UiStore {\n selectedAccount: Account = {} as Account\n selectedMember: Member = {} as Member\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setSelectedAccount = (account: Account) => (this.selectedAccount = account)\n setSelectedMember = (member: Member) => (this.selectedMember = member)\n}\n"],"mappings":";;;;;;AAiBA,IAAa,IAAb,MAA0B;AA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AA,EACnE,oBAAA,CAAqB,MAAoB,KAAK,iBAAiB;AACjE"}
|
|
1
|
+
{"version":3,"file":"AccountStore.es.js","names":[],"sources":["../../../src/core/stores/AccountStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AccountApi } from '../api'\nimport { upsertByGuid } from '../utils/upsertByGuid'\nimport {\n type Account,\n type DetailedAccount,\n type Institution,\n type Member,\n AccountType,\n AccountSubType,\n} from '../types'\nimport { augmentAccounts } from '../utils/AccountUtils'\nimport { isFeatureEnabled } from '../utils/UserUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class AccountStore {\n globalStore: GlobalStore\n api: AccountApi = new AccountApi('/', '')\n\n accounts: Account[] = []\n accountsLoaded: boolean = false\n accountsLoading: boolean = false\n institutions: Institution[] = []\n institutionsLoaded: boolean = false\n institutionsLoading: boolean = false\n members: Member[] = []\n membersLoaded: boolean = false\n membersLoading: boolean = false\n uiStore: UiStore\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.uiStore = new UiStore()\n this.api = new AccountApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadAccountData = async () => {\n await Promise.all([this.loadAccounts(), this.loadMembers(), this.loadInstitutions()])\n }\n\n get isAccountDataLoaded(): boolean {\n return this.accountsLoaded && this.membersLoaded && this.institutionsLoaded\n }\n\n get detailedAccounts(): DetailedAccount[] {\n const userFeatures = this.globalStore.userStore.userFeatures\n const excludeExternal = isFeatureEnabled(userFeatures, 'MD_EXCLUDE_EXTERNAL_ACCOUNTS')\n\n // Hide held account when this flag is toggled and this is the individual accounts widget\n const excludeHeld =\n this.globalStore.appConfig.config.display_only_external_accounts_in_accounts &&\n this.globalStore.appConfig.options.subtype === 'accounts' // Indicates this is an individual widget\n\n return augmentAccounts(\n this.accounts,\n this.institutions,\n this.members,\n excludeExternal,\n excludeHeld,\n )\n }\n\n get accountsByTypeMap(): Map<AccountType, DetailedAccount[]> {\n return this.detailedAccounts.reduce((typeMap: Map<AccountType, DetailedAccount[]>, account) => {\n const accountType = account.account_type\n\n let accounts = typeMap.get(accountType)\n if (!accounts) {\n accounts = []\n }\n accounts.push(account)\n typeMap.set(accountType, accounts)\n\n return typeMap\n }, new Map<AccountType, DetailedAccount[]>())\n }\n\n get cashAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.CASH ||\n account.account_type === AccountType.CHECKING ||\n account.account_type === AccountType.PREPAID ||\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING_LINE_OF_CREDIT,\n )\n }\n\n get cashBalance(): number {\n return this.cashAccounts.reduce((total, account) => total + (account?.balance || 0), 0)\n }\n\n get checkingAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => a.account_type === AccountType.CHECKING)\n }\n\n get debtAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.CREDIT_CARD ||\n account.account_type === AccountType.LOAN ||\n account.account_type === AccountType.MORTGAGE ||\n account.account_type === AccountType.LINE_OF_CREDIT ||\n account.account_type === AccountType.CHECKING_LINE_OF_CREDIT,\n )\n }\n\n get finstrongAccounts(): DetailedAccount[] {\n const eligibleTypes = new Set([\n AccountType.CHECKING,\n AccountType.SAVINGS,\n AccountType.CREDIT_CARD,\n AccountType.INVESTMENT,\n ])\n\n return this.detailedAccounts.filter((account) => eligibleTypes.has(account.account_type))\n }\n\n get investmentAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter(\n (account: Account) => account.account_type === AccountType.INVESTMENT,\n )\n }\n\n get manualAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((account) => account.is_manual)\n }\n\n get savingsAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => a.account_type === AccountType.SAVINGS)\n }\n\n get retirementAccounts(): Account[] {\n return this.detailedAccounts.filter(\n (account: Account) =>\n account.account_type === AccountType.INVESTMENT ||\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING ||\n account.account_type === AccountType.CASH ||\n account.account_type === AccountType.PROPERTY ||\n (account.account_type === AccountType.INSURANCE &&\n (account.account_subtype === AccountSubType.WHOLE_LIFE ||\n account.account_subtype === AccountSubType.UNIVERSAL_LIFE ||\n account.account_subtype === AccountSubType.VARIABLE_UNIVERSAL_LIFE)),\n )\n }\n\n get visibleAccounts(): DetailedAccount[] {\n return this.detailedAccounts.filter((a: Account) => !a.is_hidden && !a.is_closed)\n }\n\n get visibleCashAccounts(): DetailedAccount[] {\n return this.cashAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleCashBalance(): number {\n return this.visibleCashAccounts.reduce((total, account) => total + (account?.balance || 0), 0)\n }\n\n get visibleCheckingAccounts(): DetailedAccount[] {\n return this.checkingAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleDebtAccounts(): DetailedAccount[] {\n return this.debtAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleFinstrongAccounts(): DetailedAccount[] {\n return this.finstrongAccounts.filter(\n (account: Account) => !(account.is_closed || account.is_deleted || account.is_hidden),\n )\n }\n\n get visibleRetirementAccounts(): Account[] {\n return this.retirementAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleInvestmentAccounts(): DetailedAccount[] {\n return this.investmentAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get visibleSavingsAccounts(): DetailedAccount[] {\n return this.savingsAccounts.filter((account: Account) => !account.is_hidden)\n }\n\n get savingsAndCheckingAccountsBalance(): number {\n const savingsAndCheckingAccountsList = this.savingsAndCheckingAccounts\n\n return savingsAndCheckingAccountsList.reduce(\n (total, account) => total + (account?.balance || 0),\n 0,\n )\n }\n\n get savingsAndCheckingAccounts(): Account[] {\n const savingsAndCheckingAccounts = this.accounts.filter(\n (account: Account) =>\n account.account_type === AccountType.SAVINGS ||\n account.account_type === AccountType.CHECKING,\n )\n\n return savingsAndCheckingAccounts\n }\n\n setAccounts = (accounts: Account[]) => {\n this.accounts = accounts\n this.accountsLoading = false\n this.accountsLoaded = true\n }\n\n setMembers = (members: Member[]) => {\n this.members = members\n this.membersLoading = false\n this.membersLoaded = true\n }\n\n setInstitutions = (institutions: Institution[]) => {\n this.institutions = institutions\n this.institutionsLoading = false\n this.institutionsLoaded = true\n }\n\n addAccount = async (account: Account) => {\n try {\n const newAccount = await this.api.createAccount(account)\n\n runInAction(() => {\n this.accounts = upsertByGuid(this.accounts, newAccount)\n })\n } catch (error) {\n this.captureError('addAccount', error)\n }\n }\n\n loadAccounts = async () => {\n if (this.accountsLoading) return\n\n this.accountsLoading = true\n try {\n const accounts = await this.api.getAccounts()\n this.setAccounts(accounts)\n } catch (error) {\n this.captureError('loadAccounts', error)\n this.setAccounts([])\n }\n }\n\n loadInstitutions = async () => {\n if (this.institutionsLoading) return\n\n this.institutionsLoading = true\n try {\n const institutions = await this.api.getInstitutions()\n this.setInstitutions(institutions)\n } catch (error) {\n this.captureError('loadInstitutions', error)\n this.setInstitutions([])\n }\n }\n\n loadMembers = async () => {\n if (this.membersLoading) return\n\n this.membersLoading = true\n try {\n const members = await this.api.getMembers()\n this.setMembers(members)\n } catch (error) {\n this.captureError('loadMembers', error)\n this.setMembers([])\n }\n }\n\n mergeAccounts = async (accountGuids: string[]) => {\n try {\n const response = await this.api.mergeAccounts(accountGuids)\n // the response from the api is a funky database key here, so this is essentially just getting the first item in the returned object\n // to prevent making multiple api calls here\n const mergedAccount = response[Object.keys(response)[0]]\n\n runInAction(() => {\n const account2Index = this.accounts.findIndex((account) => account.guid === accountGuids[1])\n this.accounts.splice(account2Index, 1)\n\n const account1Index = this.accounts.findIndex((account) => account.guid === accountGuids[0])\n this.accounts.splice(account1Index, 1, mergedAccount)\n })\n } catch (error) {\n this.captureError('mergeAccounts', error)\n }\n }\n\n /**\n * DEPRECATED: Use loadAccountData instead\n */\n refreshAccounts = async () => {\n await Promise.all([this.loadAccounts(), this.loadInstitutions(), this.loadMembers()])\n }\n\n refreshMembers = async () => {\n try {\n await this.api.refreshAllMembers()\n } catch (error) {\n this.captureError('refreshMembers', error)\n }\n }\n\n removeAccount = async (accountGuid: string) => {\n try {\n await this.api.deleteAccount(accountGuid)\n\n const deletedIndex = this.accounts.findIndex((account) => account.guid === accountGuid)\n this.accounts.splice(deletedIndex, 1)\n } catch (error) {\n this.captureError('removeAccount', error)\n }\n }\n\n /** Resolves `true` when the account was saved, `false` when the API call failed. */\n updateAccount = async (account: Account): Promise<boolean> => {\n try {\n const updatedAccount = await this.api.updateAccount(account)\n\n const updatedAccountIndex = this.accounts.findIndex(\n (account) => account.guid === updatedAccount.guid,\n )\n\n this.accounts.splice(updatedAccountIndex, 1, updatedAccount)\n return true\n } catch (error) {\n this.captureError('updateAccount', error)\n return false\n }\n }\n\n updateAccountBalance = (accountGuid: string, balanceChange: number) => {\n const account = this.accounts.find((a) => a.guid === accountGuid)\n\n if (account) {\n runInAction(() => {\n account.balance = (account.balance || 0) + balanceChange\n })\n }\n }\n\n updateAccountFilter = async (accountMap: Map<string, boolean>) => {\n try {\n const accountUpdates: Promise<Account | null>[] = []\n for (const [guid, isSelected] of accountMap.entries()) {\n const account = this.accounts.find((acc) => acc.guid === guid)\n\n if (account && account.is_excluded_from_accounts === isSelected) {\n const updatedPayload = { ...account, is_excluded_from_accounts: !isSelected }\n accountUpdates.push(\n this.api.updateAccount(updatedPayload).catch((error) => {\n this.captureError('updateAccountFilter', error, { guid })\n return null\n }),\n )\n }\n }\n\n const results = await Promise.all(accountUpdates)\n const updatedAccounts: Account[] = results.filter((acc): acc is Account => acc !== null)\n\n const accounts = [...this.accounts]\n for (const updatedAccount of updatedAccounts) {\n const index = accounts.findIndex((acc) => acc.guid === updatedAccount.guid)\n if (index !== -1) {\n accounts.splice(index, 1, updatedAccount)\n }\n }\n this.setAccounts(accounts)\n } catch (error) {\n this.captureError('updateAccountFilter', error)\n }\n }\n\n private captureError = (action: string, error: unknown, extra?: Record<string, string>) =>\n this.globalStore.captureException(error, { store: 'AccountStore', action, ...extra })\n}\n\n// TODO: Move into AccountStore\nclass UiStore {\n selectedAccount: Account = {} as Account\n selectedMember: Member = {} as Member\n\n constructor() {\n makeAutoObservable(this)\n }\n\n setSelectedAccount = (account: Account) => (this.selectedAccount = account)\n setSelectedMember = (member: Member) => (this.selectedMember = member)\n}\n"],"mappings":";;;;;;AAiBA,IAAa,IAAb,MAA0B;AAAA,EACxB;AAAA,EACA,MAAkB,IAAI,EAAW,KAAK,EAAE;AAAA,EAExC,WAAsB,CAAC;AAAA,EACvB,iBAA0B;AAAA,EAC1B,kBAA2B;AAAA,EAC3B,eAA8B,CAAC;AAAA,EAC/B,qBAA8B;AAAA,EAC9B,sBAA+B;AAAA,EAC/B,UAAoB,CAAC;AAAA,EACrB,gBAAyB;AAAA,EACzB,iBAA0B;AAAA,EAC1B;AAAA,EAEA,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,UAAU,IAAI,EAAQ,GAC3B,KAAK,MAAM,IAAI,EAAW,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE7F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,kBAAkB,YAAY;AAC5B,UAAM,QAAQ,IAAI;AAAA,MAAC,KAAK,aAAa;AAAA,MAAG,KAAK,YAAY;AAAA,MAAG,KAAK,iBAAiB;AAAA,IAAC,CAAC;AAAA,EACtF;AAAA,EAEA,IAAI,sBAA+B;AACjC,WAAO,KAAK,kBAAkB,KAAK,iBAAiB,KAAK;AAAA,EAC3D;AAAA,EAEA,IAAI,mBAAsC;AACxC,UAAM,IAAe,KAAK,YAAY,UAAU,cAC1C,IAAkB,EAAiB,GAAc,8BAA8B,GAG/E,IACJ,KAAK,YAAY,UAAU,OAAO,8CAClC,KAAK,YAAY,UAAU,QAAQ,YAAY;AAEjD,WAAO,EACL,KAAK,UACL,KAAK,cACL,KAAK,SACL,GACA,CACF;AAAA,EACF;AAAA,EAEA,IAAI,oBAAyD;AAC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|
|
2
2
|
import { BannerApi as e } from "../api/BannerApi.es.js";
|
|
3
|
-
import { makeAutoObservable as i, runInAction as
|
|
3
|
+
import { makeAutoObservable as i, runInAction as n } from "mobx";
|
|
4
4
|
var c = class {
|
|
5
5
|
globalStore;
|
|
6
|
-
api = new
|
|
6
|
+
api = new r("/", "");
|
|
7
7
|
bannerApi = new e("/");
|
|
8
8
|
appData = {};
|
|
9
9
|
isAppDataLoaded = !1;
|
|
10
10
|
banner = {};
|
|
11
11
|
constructor(t) {
|
|
12
|
-
this.globalStore = t, this.api = new
|
|
12
|
+
this.globalStore = t, this.api = new r(t.endpoint, t.sessionToken, t.onError), i(this);
|
|
13
13
|
}
|
|
14
14
|
get appConfig() {
|
|
15
15
|
return this.globalStore.appConfig;
|
|
@@ -37,29 +37,33 @@ var c = class {
|
|
|
37
37
|
const t = await this.api.getAppData();
|
|
38
38
|
this.setAppData(t);
|
|
39
39
|
} catch (t) {
|
|
40
|
-
|
|
40
|
+
this.captureError("loadAppData", t);
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
loadBanner = async () => {
|
|
44
44
|
try {
|
|
45
|
-
const t = this.user?.guid ?? null,
|
|
46
|
-
|
|
47
|
-
this.banner =
|
|
45
|
+
const t = this.user?.guid ?? null, a = t ? await this.bannerApi.getBanner(t) : {};
|
|
46
|
+
n(() => {
|
|
47
|
+
this.banner = a;
|
|
48
48
|
});
|
|
49
49
|
} catch (t) {
|
|
50
|
-
|
|
50
|
+
this.captureError("loadBanner", t);
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
53
|
markBannerClicked = async (t) => {
|
|
54
54
|
try {
|
|
55
55
|
await this.bannerApi.markClicked(t);
|
|
56
|
-
} catch (
|
|
57
|
-
|
|
56
|
+
} catch (a) {
|
|
57
|
+
this.captureError("markBannerClicked", a);
|
|
58
58
|
}
|
|
59
59
|
};
|
|
60
60
|
setUser = (t) => this.appData.user = t;
|
|
61
61
|
setUserCommunicationProfile = (t) => this.appData.user_communication_profile = t;
|
|
62
62
|
setUserProfile = (t) => this.appData.user_profile = t;
|
|
63
|
+
captureError = (t, a) => this.globalStore.captureException(a, {
|
|
64
|
+
store: "AppDataStore",
|
|
65
|
+
action: t
|
|
66
|
+
});
|
|
63
67
|
};
|
|
64
68
|
export {
|
|
65
69
|
c as AppDataStore
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppDataStore.es.js","names":[],"sources":["../../../src/core/stores/AppDataStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AppDataApi, BannerApi } from '../api'\nimport type {\n AppConfig,\n AppData,\n Banner,\n User,\n UserCommunicationProfile,\n UserProfile,\n} from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class AppDataStore {\n globalStore: GlobalStore\n api: AppDataApi = new AppDataApi('/', '')\n bannerApi: BannerApi = new BannerApi('/')\n\n appData: AppData = {} as AppData\n isAppDataLoaded: boolean = false\n banner: Banner = {}\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new AppDataApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n get appConfig(): AppConfig {\n return this.globalStore.appConfig\n }\n\n get clientCommunicationProfile() {\n return this.appData.client_communication_profile\n }\n\n get clientInsightProfile() {\n return this.appData.client_insight_profile\n }\n\n get user() {\n return this.appData.user\n }\n\n get userCommunicationProfile() {\n return this.appData.user_communication_profile\n }\n\n get userProfile() {\n return this.appData.user_profile\n }\n\n setAppData = (appData: AppData) => {\n this.appData = appData\n this.bannerApi = new BannerApi(appData.address?.bullseye || '/')\n this.isAppDataLoaded = true\n }\n\n loadAppData = async () => {\n try {\n const appData = await this.api.getAppData()\n this.setAppData(appData)\n } catch (error) {\n
|
|
1
|
+
{"version":3,"file":"AppDataStore.es.js","names":[],"sources":["../../../src/core/stores/AppDataStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { AppDataApi, BannerApi } from '../api'\nimport type {\n AppConfig,\n AppData,\n Banner,\n User,\n UserCommunicationProfile,\n UserProfile,\n} from '../types'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class AppDataStore {\n globalStore: GlobalStore\n api: AppDataApi = new AppDataApi('/', '')\n bannerApi: BannerApi = new BannerApi('/')\n\n appData: AppData = {} as AppData\n isAppDataLoaded: boolean = false\n banner: Banner = {}\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new AppDataApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n get appConfig(): AppConfig {\n return this.globalStore.appConfig\n }\n\n get clientCommunicationProfile() {\n return this.appData.client_communication_profile\n }\n\n get clientInsightProfile() {\n return this.appData.client_insight_profile\n }\n\n get user() {\n return this.appData.user\n }\n\n get userCommunicationProfile() {\n return this.appData.user_communication_profile\n }\n\n get userProfile() {\n return this.appData.user_profile\n }\n\n setAppData = (appData: AppData) => {\n this.appData = appData\n this.bannerApi = new BannerApi(appData.address?.bullseye || '/')\n this.isAppDataLoaded = true\n }\n\n loadAppData = async () => {\n try {\n const appData = await this.api.getAppData()\n this.setAppData(appData)\n } catch (error) {\n this.captureError('loadAppData', error)\n }\n }\n\n loadBanner = async () => {\n try {\n const userGuid = this.user?.guid ?? null\n const banner = userGuid ? await this.bannerApi.getBanner(userGuid) : {}\n\n runInAction(() => {\n this.banner = banner\n })\n } catch (error) {\n this.captureError('loadBanner', error)\n }\n }\n\n // Fire-and-forget click receipt for the deep-link banner path (see BannerApi).\n markBannerClicked = async (guid: string) => {\n try {\n await this.bannerApi.markClicked(guid)\n } catch (error) {\n this.captureError('markBannerClicked', error)\n }\n }\n\n setUser = (user: User) => (this.appData.user = user)\n\n setUserCommunicationProfile = (profile: UserCommunicationProfile) =>\n (this.appData.user_communication_profile = profile)\n\n setUserProfile = (userProfile: UserProfile) => (this.appData.user_profile = userProfile)\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.capture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AAK,SAAS;AAAA,MAChB,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,cAAc,CAAK;AAAA,IACvC;AAAA,EACF;AAAA,EAGA,oBAAoB,OAAO,MAAiB;AAC1C,QAAI;AACF,YAAM,KAAK,UAAU,YAAY,CAAI;AAAA,IACvC,SAAS,GAAO;AACd,WAAK,aAAa,qBAAqB,CAAK;AAAA,IAC9C;AAAA,EACF;AAAA,EAEA,UAAA,CAAW,MAAgB,KAAK,QAAQ,OAAO;AAAA,EAE/C,8BAAA,CAA+B,MAC5B,KAAK,QAAQ,6BAA6B;AAAA,EAE7C,iBAAA,CAAkB,MAA8B,KAAK,QAAQ,eAAe;AAAA,EAE5E,eAAA,CAAwB,GAAgB,MACtC,KAAK,YAAY,iBAAiB,GAAO;AAAA,IAAE,OAAO;AAAA,IAAgB,QAAA;AAAA,EAAO,CAAC;AAC9E"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { BeatApi as i } from "../api/BeatApi.es.js";
|
|
2
2
|
import { orderArray as o, transformOfferIntoBeatLikeObject as n } from "../utils/BeatUtils.es.js";
|
|
3
|
-
import { makeAutoObservable as
|
|
4
|
-
var
|
|
3
|
+
import { makeAutoObservable as f, runInAction as s } from "mobx";
|
|
4
|
+
var l = class {
|
|
5
5
|
globalStore;
|
|
6
6
|
api = new i("/", "");
|
|
7
7
|
beats = [];
|
|
8
8
|
isLoading = !1;
|
|
9
9
|
constructor(t) {
|
|
10
|
-
this.globalStore = t, this.api = new i(t.endpoint, t.sessionToken, t.onError),
|
|
10
|
+
this.globalStore = t, this.api = new i(t.endpoint, t.sessionToken, t.onError), f(this);
|
|
11
11
|
}
|
|
12
12
|
loadBeats = async () => {
|
|
13
13
|
this.isLoading = !0;
|
|
@@ -17,7 +17,7 @@ var u = class {
|
|
|
17
17
|
this.beats = o(t, e, "active_at", "desc");
|
|
18
18
|
});
|
|
19
19
|
} catch (t) {
|
|
20
|
-
|
|
20
|
+
this.captureError("loadBeats", t);
|
|
21
21
|
} finally {
|
|
22
22
|
s(() => {
|
|
23
23
|
this.isLoading = !1;
|
|
@@ -34,7 +34,7 @@ var u = class {
|
|
|
34
34
|
} : r);
|
|
35
35
|
}), e;
|
|
36
36
|
} catch (e) {
|
|
37
|
-
throw
|
|
37
|
+
throw this.captureError("updateOffer", e), e;
|
|
38
38
|
}
|
|
39
39
|
};
|
|
40
40
|
getFilteredBeats(t) {
|
|
@@ -48,9 +48,13 @@ var u = class {
|
|
|
48
48
|
filterBeatsByTemplate(t, e) {
|
|
49
49
|
return t.filter((r) => e.some((a) => r.template === a));
|
|
50
50
|
}
|
|
51
|
+
captureError = (t, e) => this.globalStore.captureException(e, {
|
|
52
|
+
store: "BeatStore",
|
|
53
|
+
action: t
|
|
54
|
+
});
|
|
51
55
|
};
|
|
52
56
|
export {
|
|
53
|
-
|
|
57
|
+
l as BeatStore
|
|
54
58
|
};
|
|
55
59
|
|
|
56
60
|
//# sourceMappingURL=BeatStore.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BeatStore.es.js","names":[],"sources":["../../../src/core/stores/BeatStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { BeatApi } from '../api'\nimport type { Beat, Offer } from '../types'\nimport { orderArray, transformOfferIntoBeatLikeObject } from '../utils/BeatUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class BeatStore {\n globalStore: GlobalStore\n api: BeatApi = new BeatApi('/', '')\n beats: Beat[] = []\n isLoading = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new BeatApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadBeats = async () => {\n this.isLoading = true\n try {\n const beats = await this.api.getBeats()\n const offers = await this.api.getOffers()\n const beatLikeOffers = offers.map((o: Offer) => transformOfferIntoBeatLikeObject(o))\n\n runInAction(() => {\n this.beats = orderArray(beats, beatLikeOffers, 'active_at', 'desc')\n })\n } catch (error) {\n
|
|
1
|
+
{"version":3,"file":"BeatStore.es.js","names":[],"sources":["../../../src/core/stores/BeatStore.ts"],"sourcesContent":["import { makeAutoObservable, runInAction } from 'mobx'\n\nimport { BeatApi } from '../api'\nimport type { Beat, Offer } from '../types'\nimport { orderArray, transformOfferIntoBeatLikeObject } from '../utils/BeatUtils'\n\nimport { GlobalStore } from './GlobalStore'\n\nexport class BeatStore {\n globalStore: GlobalStore\n api: BeatApi = new BeatApi('/', '')\n beats: Beat[] = []\n isLoading = false\n\n constructor(globalStore: GlobalStore) {\n this.globalStore = globalStore\n this.api = new BeatApi(globalStore.endpoint, globalStore.sessionToken, globalStore.onError)\n\n makeAutoObservable(this)\n }\n\n loadBeats = async () => {\n this.isLoading = true\n try {\n const beats = await this.api.getBeats()\n const offers = await this.api.getOffers()\n const beatLikeOffers = offers.map((o: Offer) => transformOfferIntoBeatLikeObject(o))\n\n runInAction(() => {\n this.beats = orderArray(beats, beatLikeOffers, 'active_at', 'desc')\n })\n } catch (error) {\n this.captureError('loadBeats', error)\n } finally {\n runInAction(() => {\n this.isLoading = false\n })\n }\n }\n\n /**\n * Persists changes to an offer-backed beat (pulse marketing offers, `PUT offers/:guid`),\n * e.g. flagging `has_been_clicked` when its CTA is pressed. Rethrows so callers driving\n * UI state can surface the failure.\n */\n updateOffer = async (beat: Beat) => {\n try {\n const updated = await this.api.updateOffer(beat)\n\n runInAction(() => {\n this.beats = this.beats.map((b) => (b.guid === beat.guid ? { ...b, ...updated } : b))\n })\n\n return updated\n } catch (error) {\n this.captureError('updateOffer', error)\n throw error\n }\n }\n\n getFilteredBeats(filter: { categoryGuids?: string[]; templates?: string[] }): Beat[] {\n const { categoryGuids, templates } = filter\n let filteredBeats = this.beats\n if (categoryGuids) filteredBeats = this.filterBeatsByCategory(filteredBeats, categoryGuids)\n if (templates) filteredBeats = this.filterBeatsByTemplate(filteredBeats, templates)\n return filteredBeats\n }\n\n // Return beats with any beat.category_guids that are in categoryGuids\n filterBeatsByCategory(beats: Beat[], categoryGuids: string[]): Beat[] {\n return beats.filter((beat) => {\n return beat.category_guids?.some((guid) => categoryGuids.includes(guid))\n })\n }\n\n // Return beats with a beat.template that is in templates\n filterBeatsByTemplate(beats: Beat[], templates: string[]): Beat[] {\n return beats.filter((beat) => {\n return templates.some((template) => beat.template === template)\n })\n }\n\n private captureError = (action: string, error: unknown) =>\n this.globalStore.captureException(error, { store: 'BeatStore', action })\n}\n"],"mappings":";;;AAQA,IAAa,IAAb,MAAuB;AAAA,EACrB;AAAA,EACA,MAAe,IAAI,EAAQ,KAAK,EAAE;AAAA,EAClC,QAAgB,CAAC;AAAA,EACjB,YAAY;AAAA,EAEZ,YAAY,GAA0B;AACpC,SAAK,cAAc,GACnB,KAAK,MAAM,IAAI,EAAQ,EAAY,UAAU,EAAY,cAAc,EAAY,OAAO,GAE1F,EAAmB,IAAI;AAAA,EACzB;AAAA,EAEA,YAAY,YAAY;AACtB,SAAK,YAAY;AACjB,QAAI;AACF,YAAM,IAAQ,MAAM,KAAK,IAAI,SAAS,GAEhC,KAAiB,MADF,KAAK,IAAI,UAAU,GACV,IAAA,CAAK,MAAa,EAAiC,CAAC,CAAC;AAEnF,MAAA,EAAA,MAAkB;AAChB,aAAK,QAAQ,EAAW,GAAO,GAAgB,aAAa,MAAM;AAAA,MACpE,CAAC;AAAA,IACH,SAAS,GAAO;AACd,WAAK,aAAa,aAAa,CAAK;AAAA,IACtC,UAAA;AACE,MAAA,EAAA,MAAkB;AAChB,aAAK,YAAY;AAAA,MACnB,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAOA,cAAc,OAAO,MAAe;AAClC,QAAI;AACF,YAAM,IAAU,MAAM,KAAK,IAAI,YAAY,CAAI;AAE/C,aAAA,EAAA,MAAkB;AAChB,aAAK,QAAQ,KAAK,MAAM,IAAA,CAAK,MAAO,EAAE,SAAS,EAAK,OAAO;AAAA,UAAE,GAAG;AAAA,UAAG,GAAG;AAAA,QAAQ,I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