@metamask-previews/notification-services-controller 10.0.0-preview-5ff65365 → 10.0.0-preview-d327019
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 +0 -18
- package/dist/NotificationServicesController/NotificationServicesController.cjs +188 -78
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts +16 -10
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts +16 -10
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.mjs +189 -79
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
- package/dist/NotificationServicesController/constants/constants.cjs +7 -0
- package/dist/NotificationServicesController/constants/constants.cjs.map +1 -0
- package/dist/NotificationServicesController/constants/constants.d.cts +3 -0
- package/dist/NotificationServicesController/constants/constants.d.cts.map +1 -0
- package/dist/NotificationServicesController/constants/constants.d.mts +3 -0
- package/dist/NotificationServicesController/constants/constants.d.mts.map +1 -0
- package/dist/NotificationServicesController/constants/constants.mjs +4 -0
- package/dist/NotificationServicesController/constants/constants.mjs.map +1 -0
- package/dist/NotificationServicesController/constants/index.cjs +1 -0
- package/dist/NotificationServicesController/constants/index.cjs.map +1 -1
- package/dist/NotificationServicesController/constants/index.d.cts +1 -0
- package/dist/NotificationServicesController/constants/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/constants/index.d.mts +1 -0
- package/dist/NotificationServicesController/constants/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/constants/index.mjs +1 -0
- package/dist/NotificationServicesController/constants/index.mjs.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.cjs +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.cts +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.mts +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.mjs +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
- package/dist/NotificationServicesController/mocks/index.cjs +2 -0
- package/dist/NotificationServicesController/mocks/index.cjs.map +1 -1
- package/dist/NotificationServicesController/mocks/index.d.cts +2 -0
- package/dist/NotificationServicesController/mocks/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/mocks/index.d.mts +2 -0
- package/dist/NotificationServicesController/mocks/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/mocks/index.mjs +2 -0
- package/dist/NotificationServicesController/mocks/index.mjs.map +1 -1
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.cjs +22 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.cts +9 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.mts +9 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.mjs +18 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.cjs +82 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.cts +35 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.mts +35 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.mjs +76 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.cjs +9 -9
- package/dist/NotificationServicesController/mocks/mockResponses.cjs.map +1 -1
- package/dist/NotificationServicesController/mocks/mockResponses.d.cts +4 -7
- package/dist/NotificationServicesController/mocks/mockResponses.d.cts.map +1 -1
- package/dist/NotificationServicesController/mocks/mockResponses.d.mts +4 -7
- package/dist/NotificationServicesController/mocks/mockResponses.d.mts.map +1 -1
- package/dist/NotificationServicesController/mocks/mockResponses.mjs +7 -7
- package/dist/NotificationServicesController/mocks/mockResponses.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.cjs +1 -4
- package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.cts +0 -623
- package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.mts +0 -623
- package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.mjs +0 -2
- package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.cjs +140 -67
- package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.d.cts +31 -25
- package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.d.mts +31 -25
- package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.mjs +137 -65
- package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/types/index.cjs.map +1 -1
- package/dist/NotificationServicesController/types/index.d.cts +1 -0
- package/dist/NotificationServicesController/types/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/types/index.d.mts +1 -0
- package/dist/NotificationServicesController/types/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/types/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.cjs +3 -0
- package/dist/NotificationServicesController/types/user-storage/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.cts +2 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.mts +2 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.mjs +2 -0
- package/dist/NotificationServicesController/types/user-storage/index.mjs.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.cjs +3 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.cjs.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts +26 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts +26 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.mjs +2 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.mjs.map +1 -0
- package/dist/NotificationServicesController/ui/constants.cjs +0 -6
- package/dist/NotificationServicesController/ui/constants.cjs.map +1 -1
- package/dist/NotificationServicesController/ui/constants.d.cts +0 -6
- package/dist/NotificationServicesController/ui/constants.d.cts.map +1 -1
- package/dist/NotificationServicesController/ui/constants.d.mts +0 -6
- package/dist/NotificationServicesController/ui/constants.d.mts.map +1 -1
- package/dist/NotificationServicesController/ui/constants.mjs +0 -6
- package/dist/NotificationServicesController/ui/constants.mjs.map +1 -1
- package/dist/NotificationServicesController/utils/utils.cjs +350 -1
- package/dist/NotificationServicesController/utils/utils.cjs.map +1 -1
- package/dist/NotificationServicesController/utils/utils.d.cts +141 -0
- package/dist/NotificationServicesController/utils/utils.d.cts.map +1 -1
- package/dist/NotificationServicesController/utils/utils.d.mts +141 -0
- package/dist/NotificationServicesController/utils/utils.d.mts.map +1 -1
- package/dist/NotificationServicesController/utils/utils.mjs +337 -0
- package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +15 -22
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +5 -6
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +5 -6
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +16 -23
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.cjs +16 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.cjs.map +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts +7 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts +7 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.mjs +14 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.cjs +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.cts +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.mts +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.mjs +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.cjs +41 -18
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +33 -19
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +33 -19
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +39 -17
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/NotificationServicesController/services/notification-config-cache.cjs +0 -61
- package/dist/NotificationServicesController/services/notification-config-cache.cjs.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.d.cts +0 -15
- package/dist/NotificationServicesController/services/notification-config-cache.d.cts.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.d.mts +0 -15
- package/dist/NotificationServicesController/services/notification-config-cache.d.mts.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.mjs +0 -57
- package/dist/NotificationServicesController/services/notification-config-cache.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -9,26 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
9
9
|
|
|
10
10
|
### Changed
|
|
11
11
|
|
|
12
|
-
- **BREAKING:** Migrated to notification v2 endpoints ([#5945](https://github.com/MetaMask/core/pull/5945))
|
|
13
|
-
|
|
14
|
-
- `https://trigger.api.cx.metamask.io/api/v2` for managing out notification subscriptions
|
|
15
|
-
- `https://notification.api.cx.metamask.io/api/v2` for fetching notifications (in-app notifications)
|
|
16
|
-
- `https://push.api.cx.metamask.io/v2` for subscribing push notifications
|
|
17
|
-
- Renamed method `updateOnChainTriggersByAccount` to `enableAccounts` in `NotificationServicesController`
|
|
18
|
-
- Renamed method `deleteOnChainTriggersByAccount` to `disableAccounts` in `NotificationServicesController`
|
|
19
|
-
- Deprecated `updateTriggerPushNotifications` from `NotificationServicesPushController` and will be removed in a subsequent release.
|
|
20
|
-
|
|
21
12
|
- Bump `@metamask/controller-utils` to `^11.10.0` ([#5935](https://github.com/MetaMask/core/pull/5935))
|
|
22
13
|
|
|
23
|
-
### Removed
|
|
24
|
-
|
|
25
|
-
- **BREAKING:** Migrated to notification v2 endpoints ([#5945](https://github.com/MetaMask/core/pull/5945))
|
|
26
|
-
|
|
27
|
-
- removed `NotificationServicesPushController:updateTriggerPushNotifications` action from `NotificationServicesController`
|
|
28
|
-
- removed `UserStorageController:getStorageKey` action from `NotificationServicesController`
|
|
29
|
-
- removed `UserStorageController:performGetStorage` action from `NotificationServicesController`
|
|
30
|
-
- removed `UserStorageController:performSetStorage` action from `NotificationServicesController`
|
|
31
|
-
|
|
32
14
|
## [10.0.0]
|
|
33
15
|
|
|
34
16
|
### Changed
|
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _NotificationServicesController_instances, _NotificationServicesController_keyringController, _NotificationServicesController_auth, _NotificationServicesController_pushNotifications, _NotificationServicesController_accounts, _NotificationServicesController_featureAnnouncementEnv, _NotificationServicesController_registerMessageHandlers, _NotificationServicesController_clearLoadingStates, _NotificationServicesController_assertAuthEnabled, _NotificationServicesController_enableAuth,
|
|
39
|
+
var _NotificationServicesController_instances, _NotificationServicesController_keyringController, _NotificationServicesController_auth, _NotificationServicesController_storage, _NotificationServicesController_pushNotifications, _NotificationServicesController_accounts, _NotificationServicesController_featureAnnouncementEnv, _NotificationServicesController_registerMessageHandlers, _NotificationServicesController_clearLoadingStates, _NotificationServicesController_assertAuthEnabled, _NotificationServicesController_enableAuth, _NotificationServicesController_getValidStorageKeyAndBearerToken, _NotificationServicesController_assertUserStorage, _NotificationServicesController_getUserStorage, _NotificationServicesController_setIsUpdatingMetamaskNotifications, _NotificationServicesController_setIsFetchingMetamaskNotifications, _NotificationServicesController_setIsCheckingAccountsPresence, _NotificationServicesController_updateUpdatingAccountsState, _NotificationServicesController_clearUpdatingAccountsState;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.defaultState = void 0;
|
|
42
42
|
const base_controller_1 = require("@metamask/base-controller");
|
|
@@ -44,10 +44,12 @@ const controller_utils_1 = require("@metamask/controller-utils");
|
|
|
44
44
|
const keyring_controller_1 = require("@metamask/keyring-controller");
|
|
45
45
|
const utils_1 = require("@metamask/utils");
|
|
46
46
|
const loglevel_1 = __importDefault(require("loglevel"));
|
|
47
|
+
const constants_1 = require("./constants/constants.cjs");
|
|
47
48
|
const notification_schema_1 = require("./constants/notification-schema.cjs");
|
|
48
49
|
const process_notifications_1 = require("./processors/process-notifications.cjs");
|
|
49
50
|
const FeatureNotifications = __importStar(require("./services/feature-announcements.cjs"));
|
|
50
51
|
const OnChainNotifications = __importStar(require("./services/onchain-notifications.cjs"));
|
|
52
|
+
const Utils = __importStar(require("./utils/utils.cjs"));
|
|
51
53
|
// Unique name for the controller
|
|
52
54
|
const controllerName = 'NotificationServicesController';
|
|
53
55
|
const metadata = {
|
|
@@ -157,6 +159,17 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
157
159
|
return await this.messagingSystem.call('AuthenticationController:performSignIn');
|
|
158
160
|
},
|
|
159
161
|
});
|
|
162
|
+
_NotificationServicesController_storage.set(this, {
|
|
163
|
+
getStorageKey: () => {
|
|
164
|
+
return this.messagingSystem.call('UserStorageController:getStorageKey');
|
|
165
|
+
},
|
|
166
|
+
getNotificationStorage: async () => {
|
|
167
|
+
return await this.messagingSystem.call('UserStorageController:performGetStorage', 'notifications.notification_settings');
|
|
168
|
+
},
|
|
169
|
+
setNotificationStorage: async (state) => {
|
|
170
|
+
return await this.messagingSystem.call('UserStorageController:performSetStorage', 'notifications.notification_settings', state);
|
|
171
|
+
},
|
|
172
|
+
});
|
|
160
173
|
_NotificationServicesController_pushNotifications.set(this, {
|
|
161
174
|
// Flag to check is notifications have been setup when the browser/extension is initialized.
|
|
162
175
|
// We want to re-initialize push notifications when the browser/extension is refreshed
|
|
@@ -165,9 +178,9 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
165
178
|
subscribeToPushNotifications: async () => {
|
|
166
179
|
await this.messagingSystem.call('NotificationServicesPushController:subscribeToPushNotifications');
|
|
167
180
|
},
|
|
168
|
-
enablePushNotifications: async (
|
|
181
|
+
enablePushNotifications: async (UUIDs) => {
|
|
169
182
|
try {
|
|
170
|
-
await this.messagingSystem.call('NotificationServicesPushController:enablePushNotifications',
|
|
183
|
+
await this.messagingSystem.call('NotificationServicesPushController:enablePushNotifications', UUIDs);
|
|
171
184
|
}
|
|
172
185
|
catch (e) {
|
|
173
186
|
loglevel_1.default.error('Silently failed to enable push notifications', e);
|
|
@@ -181,6 +194,14 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
181
194
|
loglevel_1.default.error('Silently failed to disable push notifications', e);
|
|
182
195
|
}
|
|
183
196
|
},
|
|
197
|
+
updatePushNotifications: async (UUIDs) => {
|
|
198
|
+
try {
|
|
199
|
+
await this.messagingSystem.call('NotificationServicesPushController:updateTriggerPushNotifications', UUIDs);
|
|
200
|
+
}
|
|
201
|
+
catch (e) {
|
|
202
|
+
loglevel_1.default.error('Silently failed to update push notifications', e);
|
|
203
|
+
}
|
|
204
|
+
},
|
|
184
205
|
subscribe: () => {
|
|
185
206
|
this.messagingSystem.subscribe('NotificationServicesPushController:onNewNotifications', (notification) => {
|
|
186
207
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
@@ -215,7 +236,7 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
215
236
|
_NotificationServicesController_accounts.set(this, {
|
|
216
237
|
// Flag to ensure we only setup once
|
|
217
238
|
isNotificationAccountsSetup: false,
|
|
218
|
-
getNotificationAccounts: () => {
|
|
239
|
+
getNotificationAccounts: async () => {
|
|
219
240
|
const { keyrings } = this.messagingSystem.call('KeyringController:getState');
|
|
220
241
|
const firstHDKeyring = keyrings.find((k) => k.type === keyring_controller_1.KeyringTypes.hd.toString());
|
|
221
242
|
const keyringAccounts = firstHDKeyring?.accounts ?? null;
|
|
@@ -226,9 +247,9 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
226
247
|
*
|
|
227
248
|
* @returns addresses removed, added, and latest list of addresses
|
|
228
249
|
*/
|
|
229
|
-
listAccounts: () => {
|
|
250
|
+
listAccounts: async () => {
|
|
230
251
|
// Get previous and current account sets
|
|
231
|
-
const nonChecksumAccounts = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").getNotificationAccounts();
|
|
252
|
+
const nonChecksumAccounts = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").getNotificationAccounts();
|
|
232
253
|
if (!nonChecksumAccounts) {
|
|
233
254
|
return {
|
|
234
255
|
accountsAdded: [],
|
|
@@ -265,11 +286,13 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
265
286
|
},
|
|
266
287
|
/**
|
|
267
288
|
* Initializes the cache/previous list. This is handy so we have an accurate in-mem state of the previous list of accounts.
|
|
289
|
+
*
|
|
290
|
+
* @returns result from list accounts
|
|
268
291
|
*/
|
|
269
|
-
initialize: () => {
|
|
292
|
+
initialize: async () => {
|
|
270
293
|
if (__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked &&
|
|
271
294
|
!__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup) {
|
|
272
|
-
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
295
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
273
296
|
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup = true;
|
|
274
297
|
}
|
|
275
298
|
},
|
|
@@ -285,15 +308,15 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
285
308
|
!hasTotalAccountsChanged) {
|
|
286
309
|
return;
|
|
287
310
|
}
|
|
288
|
-
const { accountsAdded, accountsRemoved } = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
311
|
+
const { accountsAdded, accountsRemoved } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
289
312
|
const promises = [];
|
|
290
313
|
if (accountsAdded.length > 0) {
|
|
291
|
-
promises.push(this.
|
|
314
|
+
promises.push(this.updateOnChainTriggersByAccount(accountsAdded));
|
|
292
315
|
}
|
|
293
316
|
if (accountsRemoved.length > 0) {
|
|
294
|
-
promises.push(this.
|
|
317
|
+
promises.push(this.deleteOnChainTriggersByAccount(accountsRemoved));
|
|
295
318
|
}
|
|
296
|
-
await Promise.
|
|
319
|
+
await Promise.all(promises);
|
|
297
320
|
}, (state) => {
|
|
298
321
|
return (state?.keyrings?.flatMap?.((keyring) => keyring.accounts)?.length ??
|
|
299
322
|
0);
|
|
@@ -307,9 +330,10 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
307
330
|
}
|
|
308
331
|
init() {
|
|
309
332
|
__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").setupLockedStateSubscriptions(async () => {
|
|
310
|
-
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").initialize();
|
|
333
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").initialize();
|
|
311
334
|
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications();
|
|
312
335
|
});
|
|
336
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
313
337
|
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").initialize();
|
|
314
338
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
315
339
|
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications();
|
|
@@ -320,20 +344,13 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
320
344
|
* Public method to expose enabling push notifications
|
|
321
345
|
*/
|
|
322
346
|
async enablePushNotifications() {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
const addresses = addressesWithNotifications
|
|
328
|
-
.filter((a) => Boolean(a.enabled))
|
|
329
|
-
.map((a) => a.address);
|
|
330
|
-
if (addresses.length > 0) {
|
|
331
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(addresses);
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
catch (e) {
|
|
335
|
-
loglevel_1.default.error('Failed to enable push notifications', e);
|
|
347
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_enableAuth).call(this);
|
|
348
|
+
const storage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
349
|
+
if (!storage) {
|
|
350
|
+
throw new Error('Unable to get triggers');
|
|
336
351
|
}
|
|
352
|
+
const uuids = Utils.getAllUUIDs(storage);
|
|
353
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(uuids);
|
|
337
354
|
}
|
|
338
355
|
/**
|
|
339
356
|
* Public method to expose disabling push notifications
|
|
@@ -345,13 +362,10 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
345
362
|
try {
|
|
346
363
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsCheckingAccountsPresence).call(this, true);
|
|
347
364
|
// Retrieve user storage
|
|
348
|
-
const
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
|
|
352
|
-
result[a.address] = a.enabled;
|
|
353
|
-
});
|
|
354
|
-
return result;
|
|
365
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
366
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
367
|
+
const presence = Utils.checkAccountsPresence(userStorage, accounts);
|
|
368
|
+
return presence;
|
|
355
369
|
}
|
|
356
370
|
catch (error) {
|
|
357
371
|
loglevel_1.default.error('Failed to check accounts presence', error);
|
|
@@ -395,32 +409,40 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
395
409
|
async createOnChainTriggers(opts) {
|
|
396
410
|
try {
|
|
397
411
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
398
|
-
const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m",
|
|
399
|
-
const { accounts } = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
400
|
-
//
|
|
401
|
-
|
|
402
|
-
//
|
|
403
|
-
//
|
|
404
|
-
let
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
//
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
412
|
+
const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
|
|
413
|
+
const { accounts } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
414
|
+
// Attempt Get User Storage
|
|
415
|
+
// Will be null if entry does not exist, or a user is resetting their notifications
|
|
416
|
+
// Will be defined if entry exists
|
|
417
|
+
// Will throw if fails to get the user storage entry
|
|
418
|
+
let userStorage = opts?.resetNotifications
|
|
419
|
+
? null
|
|
420
|
+
: await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
421
|
+
// If userStorage does not exist, create a new one
|
|
422
|
+
// All the triggers created are set as: "disabled"
|
|
423
|
+
if (userStorage?.[constants_1.USER_STORAGE_VERSION_KEY] === undefined) {
|
|
424
|
+
userStorage = Utils.initializeUserStorage(accounts.map((account) => ({ address: account })), false);
|
|
425
|
+
// Write the userStorage
|
|
426
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
411
427
|
}
|
|
412
|
-
//
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
428
|
+
// Create the triggers
|
|
429
|
+
const triggers = Utils.traverseUserStorageTriggers(userStorage);
|
|
430
|
+
await OnChainNotifications.createOnChainTriggers(userStorage, storageKey, bearerToken, triggers);
|
|
431
|
+
// Create push notifications triggers in background
|
|
432
|
+
const allUUIDS = Utils.getAllUUIDs(userStorage);
|
|
433
|
+
// We do not want to wait for this request as it may take a while (e.g. for Firebase to setup)
|
|
434
|
+
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(allUUIDS).catch(() => {
|
|
416
435
|
// Do Nothing
|
|
417
436
|
});
|
|
437
|
+
// Write the new userStorage (triggers are now "enabled")
|
|
438
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
418
439
|
// Update the state of the controller
|
|
419
440
|
this.update((state) => {
|
|
420
441
|
state.isNotificationServicesEnabled = true;
|
|
421
442
|
state.isFeatureAnnouncementsEnabled = true;
|
|
422
443
|
state.isMetamaskNotificationsFeatureSeen = true;
|
|
423
444
|
});
|
|
445
|
+
return userStorage;
|
|
424
446
|
}
|
|
425
447
|
catch (err) {
|
|
426
448
|
loglevel_1.default.error('Failed to create On Chain triggers', err);
|
|
@@ -433,6 +455,10 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
433
455
|
/**
|
|
434
456
|
* Enables all MetaMask notifications for the user.
|
|
435
457
|
* This is identical flow when initializing notifications for the first time.
|
|
458
|
+
* 1. Enable Profile Syncing
|
|
459
|
+
* 2. Get or Create Notification User Storage
|
|
460
|
+
* 3. Upsert Triggers
|
|
461
|
+
* 4. Update Push notifications
|
|
436
462
|
*
|
|
437
463
|
* @throws {Error} If there is an error during the process of enabling notifications.
|
|
438
464
|
*/
|
|
@@ -480,11 +506,12 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
480
506
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
481
507
|
}
|
|
482
508
|
/**
|
|
483
|
-
* Deletes on-chain triggers associated with a specific account
|
|
509
|
+
* Deletes on-chain triggers associated with a specific account.
|
|
484
510
|
* This method performs several key operations:
|
|
485
|
-
* 1. Validates Auth
|
|
486
|
-
* 2.
|
|
487
|
-
*
|
|
511
|
+
* 1. Validates Auth & Storage
|
|
512
|
+
* 2. Finds and deletes all triggers associated with the account
|
|
513
|
+
* 3. Disables any related push notifications
|
|
514
|
+
* 4. Updates Storage to reflect new state.
|
|
488
515
|
*
|
|
489
516
|
* **Action** - When a user disables notifications for a given account in settings.
|
|
490
517
|
*
|
|
@@ -492,13 +519,29 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
492
519
|
* @returns A promise that resolves to void or an object containing a success message.
|
|
493
520
|
* @throws {Error} Throws an error if unauthenticated or from other operations.
|
|
494
521
|
*/
|
|
495
|
-
async
|
|
522
|
+
async deleteOnChainTriggersByAccount(accounts) {
|
|
496
523
|
try {
|
|
497
524
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_updateUpdatingAccountsState).call(this, accounts);
|
|
498
525
|
// Get and Validate BearerToken and User Storage Key
|
|
499
|
-
const { bearerToken } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m",
|
|
526
|
+
const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
|
|
527
|
+
// Get & Validate User Storage
|
|
528
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
529
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
530
|
+
// Get the UUIDs to delete
|
|
531
|
+
const UUIDs = accounts
|
|
532
|
+
.map((a) => Utils.getUUIDsForAccount(userStorage, a.toLowerCase()))
|
|
533
|
+
.flat();
|
|
534
|
+
if (UUIDs.length === 0) {
|
|
535
|
+
return userStorage;
|
|
536
|
+
}
|
|
500
537
|
// Delete these UUIDs (Mutates User Storage)
|
|
501
|
-
await OnChainNotifications.
|
|
538
|
+
await OnChainNotifications.deleteOnChainTriggers(userStorage, storageKey, bearerToken, UUIDs);
|
|
539
|
+
// Update Push Notifications with new list of IDs
|
|
540
|
+
const remainingTriggerIds = Utils.getAllUUIDs(userStorage);
|
|
541
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").updatePushNotifications(remainingTriggerIds);
|
|
542
|
+
// Update User Storage
|
|
543
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
544
|
+
return userStorage;
|
|
502
545
|
}
|
|
503
546
|
catch (err) {
|
|
504
547
|
loglevel_1.default.error('Failed to delete OnChain triggers', err);
|
|
@@ -523,11 +566,45 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
523
566
|
* @returns A promise that resolves to the updated user storage.
|
|
524
567
|
* @throws {Error} Throws an error if unauthenticated or from other operations.
|
|
525
568
|
*/
|
|
526
|
-
async
|
|
569
|
+
async updateOnChainTriggersByAccount(accounts) {
|
|
527
570
|
try {
|
|
528
571
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_updateUpdatingAccountsState).call(this, accounts);
|
|
529
|
-
|
|
530
|
-
|
|
572
|
+
// Get and Validate BearerToken and User Storage Key
|
|
573
|
+
const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
|
|
574
|
+
// Get & Validate User Storage
|
|
575
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
576
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
577
|
+
// Add any missing triggers
|
|
578
|
+
accounts.forEach((a) => Utils.upsertAddressTriggers(a, userStorage));
|
|
579
|
+
const newTriggers = Utils.traverseUserStorageTriggers(userStorage, {
|
|
580
|
+
mapTrigger: (t) => {
|
|
581
|
+
if (!t.enabled) {
|
|
582
|
+
return t;
|
|
583
|
+
}
|
|
584
|
+
return undefined;
|
|
585
|
+
},
|
|
586
|
+
});
|
|
587
|
+
// Create any missing triggers.
|
|
588
|
+
if (newTriggers.length > 0) {
|
|
589
|
+
// Write te updated userStorage (where triggers are disabled)
|
|
590
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
591
|
+
// Create the triggers
|
|
592
|
+
const triggers = Utils.traverseUserStorageTriggers(userStorage, {
|
|
593
|
+
mapTrigger: (t) => {
|
|
594
|
+
if (accounts.some((a) => a.toLowerCase() === t.address.toLowerCase())) {
|
|
595
|
+
return t;
|
|
596
|
+
}
|
|
597
|
+
return undefined;
|
|
598
|
+
},
|
|
599
|
+
});
|
|
600
|
+
await OnChainNotifications.createOnChainTriggers(userStorage, storageKey, bearerToken, triggers);
|
|
601
|
+
}
|
|
602
|
+
// Update Push Notifications Triggers
|
|
603
|
+
const UUIDs = Utils.getAllUUIDs(userStorage);
|
|
604
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").updatePushNotifications(UUIDs);
|
|
605
|
+
// Update the userStorage (where triggers are enabled)
|
|
606
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
607
|
+
return userStorage;
|
|
531
608
|
}
|
|
532
609
|
catch (err) {
|
|
533
610
|
loglevel_1.default.error('Failed to update OnChain triggers', err);
|
|
@@ -554,33 +631,37 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
554
631
|
// Not used by Snaps
|
|
555
632
|
const isGlobalNotifsEnabled = this.state.isNotificationServicesEnabled;
|
|
556
633
|
// Raw Feature Notifications
|
|
557
|
-
const
|
|
634
|
+
const rawFeatureAnnouncementNotifications = isGlobalNotifsEnabled && this.state.isFeatureAnnouncementsEnabled
|
|
558
635
|
? await FeatureNotifications.getFeatureAnnouncementNotifications(__classPrivateFieldGet(this, _NotificationServicesController_featureAnnouncementEnv, "f"), previewToken).catch(() => [])
|
|
559
636
|
: [];
|
|
560
637
|
// Raw On Chain Notifications
|
|
561
638
|
const rawOnChainNotifications = [];
|
|
562
639
|
if (isGlobalNotifsEnabled) {
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
const notifications = await OnChainNotifications.getOnChainNotifications(
|
|
640
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f")
|
|
641
|
+
.getNotificationStorage()
|
|
642
|
+
.then((s) => s && JSON.parse(s))
|
|
643
|
+
.catch(() => null);
|
|
644
|
+
const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken().catch(() => null);
|
|
645
|
+
if (userStorage && bearerToken) {
|
|
646
|
+
const notifications = await OnChainNotifications.getOnChainNotifications(userStorage, bearerToken).catch(() => []);
|
|
570
647
|
rawOnChainNotifications.push(...notifications);
|
|
571
648
|
}
|
|
572
|
-
catch {
|
|
573
|
-
// Do nothing
|
|
574
|
-
}
|
|
575
649
|
}
|
|
576
650
|
// Snap Notifications (original)
|
|
577
651
|
// We do not want to remove them
|
|
578
652
|
const snapNotifications = this.state.metamaskNotificationsList.filter((notification) => notification.type === notification_schema_1.TRIGGER_TYPES.SNAP);
|
|
653
|
+
// Process Notifications
|
|
579
654
|
const readIds = this.state.metamaskNotificationsReadList;
|
|
655
|
+
const isNotUndefined = (t) => Boolean(t);
|
|
656
|
+
const processAndFilter = (ns) => ns
|
|
657
|
+
.map((n) => (0, process_notifications_1.safeProcessNotification)(n, readIds))
|
|
658
|
+
.filter(isNotUndefined);
|
|
659
|
+
const featureAnnouncementNotifications = processAndFilter(rawFeatureAnnouncementNotifications);
|
|
660
|
+
const onChainNotifications = processAndFilter(rawOnChainNotifications);
|
|
580
661
|
// Combine Notifications
|
|
581
662
|
const metamaskNotifications = [
|
|
582
|
-
...
|
|
583
|
-
...
|
|
663
|
+
...featureAnnouncementNotifications,
|
|
664
|
+
...onChainNotifications,
|
|
584
665
|
...snapNotifications,
|
|
585
666
|
];
|
|
586
667
|
// Sort Notifications
|
|
@@ -748,7 +829,7 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
748
829
|
}
|
|
749
830
|
}
|
|
750
831
|
}
|
|
751
|
-
_NotificationServicesController_keyringController = new WeakMap(), _NotificationServicesController_auth = new WeakMap(), _NotificationServicesController_pushNotifications = new WeakMap(), _NotificationServicesController_accounts = new WeakMap(), _NotificationServicesController_featureAnnouncementEnv = new WeakMap(), _NotificationServicesController_instances = new WeakSet(), _NotificationServicesController_registerMessageHandlers = function _NotificationServicesController_registerMessageHandlers() {
|
|
832
|
+
_NotificationServicesController_keyringController = new WeakMap(), _NotificationServicesController_auth = new WeakMap(), _NotificationServicesController_storage = new WeakMap(), _NotificationServicesController_pushNotifications = new WeakMap(), _NotificationServicesController_accounts = new WeakMap(), _NotificationServicesController_featureAnnouncementEnv = new WeakMap(), _NotificationServicesController_instances = new WeakSet(), _NotificationServicesController_registerMessageHandlers = function _NotificationServicesController_registerMessageHandlers() {
|
|
752
833
|
this.messagingSystem.registerActionHandler(`${controllerName}:updateMetamaskNotificationsList`, this.updateMetamaskNotificationsList.bind(this));
|
|
753
834
|
this.messagingSystem.registerActionHandler(`${controllerName}:disableNotificationServices`, this.disableNotificationServices.bind(this));
|
|
754
835
|
this.messagingSystem.registerActionHandler(`${controllerName}:getNotificationsByType`, this.getNotificationsByType.bind(this));
|
|
@@ -772,13 +853,42 @@ _NotificationServicesController_keyringController = new WeakMap(), _Notification
|
|
|
772
853
|
if (!isSignedIn) {
|
|
773
854
|
await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").signIn();
|
|
774
855
|
}
|
|
775
|
-
},
|
|
856
|
+
}, _NotificationServicesController_getValidStorageKeyAndBearerToken = async function _NotificationServicesController_getValidStorageKeyAndBearerToken() {
|
|
776
857
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertAuthEnabled).call(this);
|
|
777
858
|
const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken();
|
|
778
|
-
|
|
779
|
-
|
|
859
|
+
const storageKey = await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").getStorageKey();
|
|
860
|
+
if (!bearerToken || !storageKey) {
|
|
861
|
+
throw new Error('Missing BearerToken or storage key');
|
|
862
|
+
}
|
|
863
|
+
return { bearerToken, storageKey };
|
|
864
|
+
}, _NotificationServicesController_assertUserStorage = function _NotificationServicesController_assertUserStorage(storage) {
|
|
865
|
+
if (!storage) {
|
|
866
|
+
throw new Error('User Storage does not exist');
|
|
867
|
+
}
|
|
868
|
+
}, _NotificationServicesController_getUserStorage =
|
|
869
|
+
/**
|
|
870
|
+
* Retrieves and parses the user storage from the storage key.
|
|
871
|
+
*
|
|
872
|
+
* This method attempts to retrieve the user storage using the specified storage key,
|
|
873
|
+
* then parses the JSON string to an object. If the storage is not found or cannot be parsed,
|
|
874
|
+
* it throws an error.
|
|
875
|
+
*
|
|
876
|
+
* @returns The parsed user storage object or null
|
|
877
|
+
*/
|
|
878
|
+
async function _NotificationServicesController_getUserStorage() {
|
|
879
|
+
const userStorageString = await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").getNotificationStorage();
|
|
880
|
+
if (!userStorageString) {
|
|
881
|
+
return null;
|
|
882
|
+
}
|
|
883
|
+
try {
|
|
884
|
+
const userStorage = JSON.parse(userStorageString);
|
|
885
|
+
Utils.cleanUserStorage(userStorage);
|
|
886
|
+
return userStorage;
|
|
887
|
+
}
|
|
888
|
+
catch {
|
|
889
|
+
loglevel_1.default.error('Unable to parse User Storage');
|
|
890
|
+
return null;
|
|
780
891
|
}
|
|
781
|
-
return { bearerToken };
|
|
782
892
|
}, _NotificationServicesController_setIsUpdatingMetamaskNotifications = function _NotificationServicesController_setIsUpdatingMetamaskNotifications(isUpdatingMetamaskNotifications) {
|
|
783
893
|
this.update((state) => {
|
|
784
894
|
state.isUpdatingMetamaskNotifications = isUpdatingMetamaskNotifications;
|