@metamask-previews/notification-services-controller 0.1.0-preview-1f998a49 → 0.1.0-preview-30646c8e
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/NotificationServicesController/NotificationServicesController.js +7 -7
- package/dist/NotificationServicesController/NotificationServicesController.mjs +6 -6
- package/dist/NotificationServicesController/constants/constants.js +1 -1
- package/dist/NotificationServicesController/constants/constants.mjs +1 -1
- package/dist/NotificationServicesController/constants/index.js +6 -4
- package/dist/NotificationServicesController/constants/index.mjs +5 -3
- package/dist/NotificationServicesController/constants/notification-schema.js +5 -3
- package/dist/NotificationServicesController/constants/notification-schema.mjs +4 -2
- package/dist/NotificationServicesController/index.js +12 -12
- package/dist/NotificationServicesController/index.mjs +11 -11
- package/dist/NotificationServicesController/processors/index.js +5 -5
- package/dist/NotificationServicesController/processors/index.mjs +4 -4
- package/dist/NotificationServicesController/processors/process-feature-announcement.js +1 -1
- package/dist/NotificationServicesController/processors/process-feature-announcement.mjs +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.js +4 -4
- package/dist/NotificationServicesController/processors/process-notifications.mjs +3 -3
- package/dist/NotificationServicesController/processors/process-onchain-notifications.js +1 -1
- package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.js +2 -2
- package/dist/NotificationServicesController/services/feature-announcements.mjs +2 -2
- package/dist/NotificationServicesController/services/onchain-notifications.js +5 -5
- package/dist/NotificationServicesController/services/onchain-notifications.mjs +4 -4
- package/dist/NotificationServicesController/types/index.js +2 -2
- package/dist/NotificationServicesController/types/index.mjs +2 -2
- package/dist/NotificationServicesController/ui/constants.js +40 -0
- package/dist/NotificationServicesController/ui/constants.js.map +1 -0
- package/dist/NotificationServicesController/ui/constants.mjs +40 -0
- package/dist/NotificationServicesController/ui/constants.mjs.map +1 -0
- package/dist/NotificationServicesController/utils/utils.js +4 -4
- package/dist/NotificationServicesController/utils/utils.mjs +3 -3
- package/dist/NotificationServicesPushController/NotificationServicesPushController.js +15 -15
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +14 -14
- package/dist/NotificationServicesPushController/constants.js +1 -1
- package/dist/NotificationServicesPushController/constants.mjs +1 -1
- package/dist/NotificationServicesPushController/index.js +18 -18
- package/dist/NotificationServicesPushController/index.mjs +17 -17
- package/dist/NotificationServicesPushController/services/endpoints.js +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.mjs +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.js +13 -13
- package/dist/NotificationServicesPushController/services/push/push-web.mjs +12 -12
- package/dist/NotificationServicesPushController/services/services.js +14 -14
- package/dist/NotificationServicesPushController/services/services.mjs +13 -13
- package/dist/NotificationServicesPushController/utils/get-notification-data.js +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-data.mjs +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.js +13 -13
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +12 -12
- package/dist/NotificationServicesPushController/utils/index.js +14 -14
- package/dist/NotificationServicesPushController/utils/index.mjs +13 -13
- package/dist/{chunk-NXXY4CAP.js → chunk-3RRAJSTZ.js} +9 -36
- package/dist/chunk-3RRAJSTZ.js.map +1 -0
- package/dist/{chunk-RYAHBEX2.mjs → chunk-54BC2GAN.mjs} +29 -9
- package/dist/chunk-54BC2GAN.mjs.map +1 -0
- package/dist/{chunk-GFAESVZA.js → chunk-5FUMSWDD.js} +3 -3
- package/dist/chunk-5SY7FJXH.mjs +925 -0
- package/dist/chunk-5SY7FJXH.mjs.map +1 -0
- package/dist/{chunk-ODZ6V4PH.mjs → chunk-5WMDB2VE.mjs} +4 -4
- package/dist/{chunk-SSWX2N73.mjs → chunk-6GUOLD7O.mjs} +2 -2
- package/dist/{chunk-NJBJIZLR.js → chunk-72H2V4J5.js} +6 -7
- package/dist/chunk-72H2V4J5.js.map +1 -0
- package/dist/{chunk-SMKJEA45.mjs → chunk-7S6524FI.mjs} +2 -2
- package/dist/{chunk-PIZCE3JD.js → chunk-7U22ZANC.js} +5 -5
- package/dist/{chunk-52NKJDI2.mjs → chunk-A5QFYBTR.mjs} +5 -6
- package/dist/chunk-A5QFYBTR.mjs.map +1 -0
- package/dist/{chunk-TT56I53C.mjs → chunk-ADYRLXWY.mjs} +2 -2
- package/dist/{chunk-LFD7J7KR.mjs → chunk-B3OMMG46.mjs} +6 -33
- package/dist/chunk-B3OMMG46.mjs.map +1 -0
- package/dist/{chunk-PGMXFZ6Y.js → chunk-BUT7X5F2.js} +3 -3
- package/dist/{chunk-JLHFZ2UG.mjs → chunk-DCADU5QI.mjs} +3 -3
- package/dist/{chunk-FFQNSBPU.js → chunk-ENRKCWJ6.js} +7 -7
- package/dist/{chunk-NMLYB3XT.js → chunk-GJHW5Z65.js} +4 -4
- package/dist/chunk-IGY2S5BC.js +36 -0
- package/dist/{chunk-VC6J62JI.mjs → chunk-J4D2NH6Y.mjs} +4 -2
- package/dist/chunk-J4D2NH6Y.mjs.map +1 -0
- package/dist/{chunk-RQWUD2FB.mjs → chunk-KCWTVLMK.mjs} +2 -2
- package/dist/{chunk-UPVIT75F.js → chunk-KWTSMLND.js} +6 -6
- package/dist/{chunk-UIRZIKC3.mjs → chunk-PI2RUC6X.mjs} +2 -2
- package/dist/chunk-QY4UST5V.js +37 -0
- package/dist/chunk-QY4UST5V.js.map +1 -0
- package/dist/{chunk-YRWUXGL3.js → chunk-TITJWXKP.js} +123 -103
- package/dist/chunk-TITJWXKP.js.map +1 -0
- package/dist/{chunk-VOZ7Y2OO.js → chunk-TPGIXSC2.js} +8 -8
- package/dist/chunk-U5UIDVOO.mjs +36 -0
- package/dist/{chunk-DKQBDI4C.js → chunk-UAVQ6J3W.js} +35 -35
- package/dist/{chunk-DY4ELDRQ.js → chunk-V6P5JEPT.js} +5 -3
- package/dist/chunk-V6P5JEPT.js.map +1 -0
- package/dist/{chunk-QTK2RMF7.mjs → chunk-X42WN3FE.mjs} +3 -3
- package/dist/chunk-YI2IXXU6.js +925 -0
- package/dist/chunk-YI2IXXU6.js.map +1 -0
- package/dist/{chunk-VE4DTN4R.mjs → chunk-ZHAD55AN.mjs} +5 -3
- package/dist/{chunk-VE4DTN4R.mjs.map → chunk-ZHAD55AN.mjs.map} +1 -1
- package/dist/index.js +18 -18
- package/dist/index.mjs +17 -17
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/NotificationServicesController/NotificationServicesController.d.ts +2 -0
- package/dist/types/NotificationServicesController/NotificationServicesController.d.ts.map +1 -1
- package/dist/types/NotificationServicesController/__fixtures__/index.d.ts +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/index.d.ts.map +1 -1
- package/dist/types/NotificationServicesController/constants/notification-schema.d.ts +14 -8
- package/dist/types/NotificationServicesController/constants/notification-schema.d.ts.map +1 -1
- package/dist/types/NotificationServicesController/ui/constants.d.ts +29 -0
- package/dist/types/NotificationServicesController/ui/constants.d.ts.map +1 -0
- package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts +0 -1
- package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-26CCETCM.mjs +0 -70
- package/dist/chunk-4KZO4UUC.js +0 -4300
- package/dist/chunk-4KZO4UUC.js.map +0 -1
- package/dist/chunk-52NKJDI2.mjs.map +0 -1
- package/dist/chunk-CQ6CGSKZ.js +0 -35
- package/dist/chunk-CQ6CGSKZ.js.map +0 -1
- package/dist/chunk-DY4ELDRQ.js.map +0 -1
- package/dist/chunk-HCOBC2R5.mjs +0 -4300
- package/dist/chunk-HCOBC2R5.mjs.map +0 -1
- package/dist/chunk-LFD7J7KR.mjs.map +0 -1
- package/dist/chunk-NJBJIZLR.js.map +0 -1
- package/dist/chunk-NXXY4CAP.js.map +0 -1
- package/dist/chunk-RYAHBEX2.mjs.map +0 -1
- package/dist/chunk-V46WVGWN.js +0 -70
- package/dist/chunk-VC6J62JI.mjs.map +0 -1
- package/dist/chunk-YRWUXGL3.js.map +0 -1
- /package/dist/{chunk-GFAESVZA.js.map → chunk-5FUMSWDD.js.map} +0 -0
- /package/dist/{chunk-ODZ6V4PH.mjs.map → chunk-5WMDB2VE.mjs.map} +0 -0
- /package/dist/{chunk-SSWX2N73.mjs.map → chunk-6GUOLD7O.mjs.map} +0 -0
- /package/dist/{chunk-SMKJEA45.mjs.map → chunk-7S6524FI.mjs.map} +0 -0
- /package/dist/{chunk-PIZCE3JD.js.map → chunk-7U22ZANC.js.map} +0 -0
- /package/dist/{chunk-TT56I53C.mjs.map → chunk-ADYRLXWY.mjs.map} +0 -0
- /package/dist/{chunk-PGMXFZ6Y.js.map → chunk-BUT7X5F2.js.map} +0 -0
- /package/dist/{chunk-JLHFZ2UG.mjs.map → chunk-DCADU5QI.mjs.map} +0 -0
- /package/dist/{chunk-FFQNSBPU.js.map → chunk-ENRKCWJ6.js.map} +0 -0
- /package/dist/{chunk-NMLYB3XT.js.map → chunk-GJHW5Z65.js.map} +0 -0
- /package/dist/{chunk-V46WVGWN.js.map → chunk-IGY2S5BC.js.map} +0 -0
- /package/dist/{chunk-RQWUD2FB.mjs.map → chunk-KCWTVLMK.mjs.map} +0 -0
- /package/dist/{chunk-UPVIT75F.js.map → chunk-KWTSMLND.js.map} +0 -0
- /package/dist/{chunk-UIRZIKC3.mjs.map → chunk-PI2RUC6X.mjs.map} +0 -0
- /package/dist/{chunk-VOZ7Y2OO.js.map → chunk-TPGIXSC2.js.map} +0 -0
- /package/dist/{chunk-26CCETCM.mjs.map → chunk-U5UIDVOO.mjs.map} +0 -0
- /package/dist/{chunk-DKQBDI4C.js.map → chunk-UAVQ6J3W.js.map} +0 -0
- /package/dist/{chunk-QTK2RMF7.mjs.map → chunk-X42WN3FE.mjs.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5FUMSWDDjs = require('./chunk-5FUMSWDD.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkZMNXLHACjs = require('./chunk-ZMNXLHAC.js');
|
|
@@ -9,7 +9,7 @@ var _chunkZMNXLHACjs = require('./chunk-ZMNXLHAC.js');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkTPGIXSC2js = require('./chunk-TPGIXSC2.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
@@ -17,7 +17,7 @@ var _chunkVOZ7Y2OOjs = require('./chunk-VOZ7Y2OO.js');
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
|
|
20
|
-
var
|
|
20
|
+
var _chunk7U22ZANCjs = require('./chunk-7U22ZANC.js');
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
var _chunkTLX5QQK5js = require('./chunk-TLX5QQK5.js');
|
|
@@ -26,7 +26,7 @@ var _chunkTLX5QQK5js = require('./chunk-TLX5QQK5.js');
|
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
|
-
var
|
|
29
|
+
var _chunkIGY2S5BCjs = require('./chunk-IGY2S5BC.js');
|
|
30
30
|
|
|
31
31
|
// src/NotificationServicesController/NotificationServicesController.ts
|
|
32
32
|
var _basecontroller = require('@metamask/base-controller');
|
|
@@ -87,7 +87,7 @@ var defaultState = {
|
|
|
87
87
|
isUpdatingMetamaskNotificationsAccount: [],
|
|
88
88
|
isCheckingAccountsPresence: false
|
|
89
89
|
};
|
|
90
|
-
var _auth, _storage, _pushNotifications, _accounts, _featureAnnouncementEnv, _registerMessageHandlers, registerMessageHandlers_fn, _clearLoadingStates, clearLoadingStates_fn, _assertAuthEnabled, assertAuthEnabled_fn, _getValidStorageKeyAndBearerToken, getValidStorageKeyAndBearerToken_fn, _performEnableProfileSyncing, _assertUserStorage, assertUserStorage_fn, _getUserStorage, getUserStorage_fn, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn, _setIsCheckingAccountsPresence, setIsCheckingAccountsPresence_fn, _updateUpdatingAccountsState, updateUpdatingAccountsState_fn, _clearUpdatingAccountsState, clearUpdatingAccountsState_fn;
|
|
90
|
+
var _isPushIntegrated, _auth, _storage, _pushNotifications, _accounts, _featureAnnouncementEnv, _registerMessageHandlers, registerMessageHandlers_fn, _clearLoadingStates, clearLoadingStates_fn, _assertAuthEnabled, assertAuthEnabled_fn, _getValidStorageKeyAndBearerToken, getValidStorageKeyAndBearerToken_fn, _performEnableProfileSyncing, _assertUserStorage, assertUserStorage_fn, _getUserStorage, getUserStorage_fn, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn, _setIsCheckingAccountsPresence, setIsCheckingAccountsPresence_fn, _updateUpdatingAccountsState, updateUpdatingAccountsState_fn, _clearUpdatingAccountsState, clearUpdatingAccountsState_fn;
|
|
91
91
|
var NotificationServicesController = class extends _basecontroller.BaseController {
|
|
92
92
|
/**
|
|
93
93
|
* Creates a NotificationServicesController instance.
|
|
@@ -97,6 +97,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
97
97
|
* @param args.state - Initial state to set on this controller.
|
|
98
98
|
* @param args.env - environment variables for a given controller.
|
|
99
99
|
* @param args.env.featureAnnouncements - env variables for feature announcements.
|
|
100
|
+
* @param args.env.isPushIntegrated - toggle push notifications on/off if client has integrated them.
|
|
100
101
|
*/
|
|
101
102
|
constructor({
|
|
102
103
|
messenger,
|
|
@@ -109,11 +110,11 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
109
110
|
name: controllerName,
|
|
110
111
|
state: { ...defaultState, ...state }
|
|
111
112
|
});
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
113
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _registerMessageHandlers);
|
|
114
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _clearLoadingStates);
|
|
115
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _assertAuthEnabled);
|
|
116
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _getValidStorageKeyAndBearerToken);
|
|
117
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _assertUserStorage);
|
|
117
118
|
/**
|
|
118
119
|
* Retrieves and parses the user storage from the storage key.
|
|
119
120
|
*
|
|
@@ -123,7 +124,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
123
124
|
*
|
|
124
125
|
* @returns The parsed user storage object or null
|
|
125
126
|
*/
|
|
126
|
-
|
|
127
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _getUserStorage);
|
|
127
128
|
/**
|
|
128
129
|
* Sets the state of notification creation process.
|
|
129
130
|
*
|
|
@@ -134,7 +135,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
134
135
|
*
|
|
135
136
|
* @param isUpdatingMetamaskNotifications - A boolean value representing the new state of the notification creation process.
|
|
136
137
|
*/
|
|
137
|
-
|
|
138
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _setIsUpdatingMetamaskNotifications);
|
|
138
139
|
/**
|
|
139
140
|
* Updates the state to indicate whether fetching of MetaMask notifications is in progress.
|
|
140
141
|
*
|
|
@@ -143,7 +144,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
143
144
|
*
|
|
144
145
|
* @param isFetchingMetamaskNotifications - A boolean value representing the fetching state.
|
|
145
146
|
*/
|
|
146
|
-
|
|
147
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _setIsFetchingMetamaskNotifications);
|
|
147
148
|
/**
|
|
148
149
|
* Updates the state to indicate that the checking of accounts presence is in progress.
|
|
149
150
|
*
|
|
@@ -153,21 +154,23 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
153
154
|
*
|
|
154
155
|
* @param isCheckingAccountsPresence - A boolean value indicating whether the account presence check is currently active.
|
|
155
156
|
*/
|
|
156
|
-
|
|
157
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _setIsCheckingAccountsPresence);
|
|
157
158
|
/**
|
|
158
159
|
* Updates the state to indicate that account updates are in progress.
|
|
159
160
|
* Removes duplicate accounts before updating the state.
|
|
160
161
|
*
|
|
161
162
|
* @param accounts - The accounts being updated.
|
|
162
163
|
*/
|
|
163
|
-
|
|
164
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _updateUpdatingAccountsState);
|
|
164
165
|
/**
|
|
165
166
|
* Clears the state indicating that account updates are complete.
|
|
166
167
|
*
|
|
167
168
|
* @param accounts - The accounts that have finished updating.
|
|
168
169
|
*/
|
|
169
|
-
|
|
170
|
-
|
|
170
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _clearUpdatingAccountsState);
|
|
171
|
+
// Temporary boolean as push notifications are not yet enabled on mobile
|
|
172
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _isPushIntegrated, true);
|
|
173
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _auth, {
|
|
171
174
|
getBearerToken: async () => {
|
|
172
175
|
return await this.messagingSystem.call(
|
|
173
176
|
"AuthenticationController:getBearerToken"
|
|
@@ -177,7 +180,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
177
180
|
return this.messagingSystem.call("AuthenticationController:isSignedIn");
|
|
178
181
|
}
|
|
179
182
|
});
|
|
180
|
-
|
|
183
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _storage, {
|
|
181
184
|
enableProfileSyncing: async () => {
|
|
182
185
|
return await this.messagingSystem.call(
|
|
183
186
|
"UserStorageController:enableProfileSyncing"
|
|
@@ -200,26 +203,38 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
200
203
|
);
|
|
201
204
|
}
|
|
202
205
|
});
|
|
203
|
-
|
|
206
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _pushNotifications, {
|
|
204
207
|
enablePushNotifications: async (UUIDs) => {
|
|
205
|
-
|
|
208
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
await this.messagingSystem.call(
|
|
206
212
|
"NotificationServicesPushController:enablePushNotifications",
|
|
207
213
|
UUIDs
|
|
208
214
|
);
|
|
209
215
|
},
|
|
210
216
|
disablePushNotifications: async (UUIDs) => {
|
|
211
|
-
|
|
217
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
await this.messagingSystem.call(
|
|
212
221
|
"NotificationServicesPushController:disablePushNotifications",
|
|
213
222
|
UUIDs
|
|
214
223
|
);
|
|
215
224
|
},
|
|
216
225
|
updatePushNotifications: async (UUIDs) => {
|
|
217
|
-
|
|
226
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
227
|
+
return;
|
|
228
|
+
}
|
|
229
|
+
await this.messagingSystem.call(
|
|
218
230
|
"NotificationServicesPushController:updateTriggerPushNotifications",
|
|
219
231
|
UUIDs
|
|
220
232
|
);
|
|
221
233
|
},
|
|
222
234
|
subscribe: () => {
|
|
235
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
223
238
|
this.messagingSystem.subscribe(
|
|
224
239
|
"NotificationServicesPushController:onNewNotifications",
|
|
225
240
|
(notification) => {
|
|
@@ -228,18 +243,21 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
228
243
|
);
|
|
229
244
|
},
|
|
230
245
|
initializePushNotifications: async () => {
|
|
246
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
247
|
+
return;
|
|
248
|
+
}
|
|
231
249
|
if (!this.state.isNotificationServicesEnabled) {
|
|
232
250
|
return;
|
|
233
251
|
}
|
|
234
|
-
const storage = await
|
|
252
|
+
const storage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
235
253
|
if (!storage) {
|
|
236
254
|
return;
|
|
237
255
|
}
|
|
238
|
-
const uuids =
|
|
239
|
-
await
|
|
256
|
+
const uuids = _chunk7U22ZANCjs.getAllUUIDs.call(void 0, storage);
|
|
257
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).enablePushNotifications(uuids);
|
|
240
258
|
}
|
|
241
259
|
});
|
|
242
|
-
|
|
260
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _accounts, {
|
|
243
261
|
/**
|
|
244
262
|
* Used to get list of addresses from keyring (wallet addresses)
|
|
245
263
|
*
|
|
@@ -278,7 +296,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
278
296
|
* @returns result from list accounts
|
|
279
297
|
*/
|
|
280
298
|
initialize: () => {
|
|
281
|
-
return
|
|
299
|
+
return _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).listAccounts();
|
|
282
300
|
},
|
|
283
301
|
/**
|
|
284
302
|
* Subscription to any state change in the keyring controller (aka wallet accounts).
|
|
@@ -293,7 +311,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
293
311
|
if (!this.state.isNotificationServicesEnabled) {
|
|
294
312
|
return;
|
|
295
313
|
}
|
|
296
|
-
const { accountsAdded, accountsRemoved } = await
|
|
314
|
+
const { accountsAdded, accountsRemoved } = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).listAccounts();
|
|
297
315
|
const promises = [];
|
|
298
316
|
if (accountsAdded.length > 0) {
|
|
299
317
|
promises.push(this.updateOnChainTriggersByAccount(accountsAdded));
|
|
@@ -306,22 +324,23 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
306
324
|
);
|
|
307
325
|
}
|
|
308
326
|
});
|
|
309
|
-
|
|
310
|
-
|
|
327
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _featureAnnouncementEnv, void 0);
|
|
328
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _performEnableProfileSyncing, async () => {
|
|
311
329
|
try {
|
|
312
|
-
await
|
|
330
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).enableProfileSyncing();
|
|
313
331
|
} catch (e) {
|
|
314
332
|
_loglevel2.default.error("Failed to enable profile syncing", e);
|
|
315
333
|
throw new Error("Failed to enable profile syncing");
|
|
316
334
|
}
|
|
317
335
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
336
|
+
_chunkIGY2S5BCjs.__privateSet.call(void 0, this, _isPushIntegrated, env.isPushIntegrated ?? true);
|
|
337
|
+
_chunkIGY2S5BCjs.__privateSet.call(void 0, this, _featureAnnouncementEnv, env.featureAnnouncements);
|
|
338
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _registerMessageHandlers, registerMessageHandlers_fn).call(this);
|
|
339
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _clearLoadingStates, clearLoadingStates_fn).call(this);
|
|
340
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).initialize();
|
|
341
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).initializePushNotifications();
|
|
342
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).subscribe();
|
|
343
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).subscribe();
|
|
325
344
|
}
|
|
326
345
|
/**
|
|
327
346
|
* Retrieves the current enabled state of MetaMask notifications.
|
|
@@ -336,16 +355,16 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
336
355
|
}
|
|
337
356
|
async checkAccountsPresence(accounts) {
|
|
338
357
|
try {
|
|
339
|
-
|
|
340
|
-
const userStorage = await
|
|
341
|
-
|
|
342
|
-
const presence =
|
|
358
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsCheckingAccountsPresence, setIsCheckingAccountsPresence_fn).call(this, true);
|
|
359
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
360
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertUserStorage, assertUserStorage_fn).call(this, userStorage);
|
|
361
|
+
const presence = _chunk7U22ZANCjs.checkAccountsPresence.call(void 0, userStorage, accounts);
|
|
343
362
|
return presence;
|
|
344
363
|
} catch (error) {
|
|
345
364
|
_loglevel2.default.error("Failed to check accounts presence", error);
|
|
346
365
|
throw error;
|
|
347
366
|
} finally {
|
|
348
|
-
|
|
367
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsCheckingAccountsPresence, setIsCheckingAccountsPresence_fn).call(this, false);
|
|
349
368
|
}
|
|
350
369
|
}
|
|
351
370
|
/**
|
|
@@ -377,28 +396,28 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
377
396
|
*/
|
|
378
397
|
async createOnChainTriggers() {
|
|
379
398
|
try {
|
|
380
|
-
|
|
381
|
-
await
|
|
382
|
-
const { bearerToken, storageKey } = await
|
|
383
|
-
const { accounts } = await
|
|
384
|
-
let userStorage = await
|
|
399
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, true);
|
|
400
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _performEnableProfileSyncing).call(this);
|
|
401
|
+
const { bearerToken, storageKey } = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getValidStorageKeyAndBearerToken, getValidStorageKeyAndBearerToken_fn).call(this);
|
|
402
|
+
const { accounts } = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).listAccounts();
|
|
403
|
+
let userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
385
404
|
if (userStorage?.[_chunkTLX5QQK5js.USER_STORAGE_VERSION_KEY] === void 0) {
|
|
386
|
-
userStorage =
|
|
405
|
+
userStorage = _chunk7U22ZANCjs.initializeUserStorage.call(void 0,
|
|
387
406
|
accounts.map((account) => ({ address: account })),
|
|
388
407
|
false
|
|
389
408
|
);
|
|
390
|
-
await
|
|
409
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
391
410
|
}
|
|
392
|
-
const triggers =
|
|
393
|
-
await
|
|
411
|
+
const triggers = _chunk7U22ZANCjs.traverseUserStorageTriggers.call(void 0, userStorage);
|
|
412
|
+
await _chunkTPGIXSC2js.createOnChainTriggers.call(void 0,
|
|
394
413
|
userStorage,
|
|
395
414
|
storageKey,
|
|
396
415
|
bearerToken,
|
|
397
416
|
triggers
|
|
398
417
|
);
|
|
399
|
-
const allUUIDS =
|
|
400
|
-
await
|
|
401
|
-
await
|
|
418
|
+
const allUUIDS = _chunk7U22ZANCjs.getAllUUIDs.call(void 0, userStorage);
|
|
419
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).enablePushNotifications(allUUIDS);
|
|
420
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
402
421
|
this.update((state) => {
|
|
403
422
|
state.isNotificationServicesEnabled = true;
|
|
404
423
|
state.isFeatureAnnouncementsEnabled = true;
|
|
@@ -409,7 +428,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
409
428
|
_loglevel2.default.error("Failed to create On Chain triggers", err);
|
|
410
429
|
throw new Error("Failed to create On Chain triggers");
|
|
411
430
|
} finally {
|
|
412
|
-
|
|
431
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, false);
|
|
413
432
|
}
|
|
414
433
|
}
|
|
415
434
|
/**
|
|
@@ -424,13 +443,13 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
424
443
|
*/
|
|
425
444
|
async enableMetamaskNotifications() {
|
|
426
445
|
try {
|
|
427
|
-
|
|
446
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, true);
|
|
428
447
|
await this.createOnChainTriggers();
|
|
429
448
|
} catch (e) {
|
|
430
449
|
_loglevel2.default.error("Unable to enable notifications", e);
|
|
431
450
|
throw new Error("Unable to enable notifications");
|
|
432
451
|
} finally {
|
|
433
|
-
|
|
452
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, false);
|
|
434
453
|
}
|
|
435
454
|
}
|
|
436
455
|
/**
|
|
@@ -443,11 +462,11 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
443
462
|
*/
|
|
444
463
|
async disableNotificationServices() {
|
|
445
464
|
try {
|
|
446
|
-
|
|
447
|
-
const userStorage = await
|
|
448
|
-
|
|
449
|
-
const UUIDs =
|
|
450
|
-
await
|
|
465
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, true);
|
|
466
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
467
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertUserStorage, assertUserStorage_fn).call(this, userStorage);
|
|
468
|
+
const UUIDs = _chunk7U22ZANCjs.getAllUUIDs.call(void 0, userStorage);
|
|
469
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).disablePushNotifications(UUIDs);
|
|
451
470
|
this.update((state) => {
|
|
452
471
|
state.isNotificationServicesEnabled = false;
|
|
453
472
|
state.isFeatureAnnouncementsEnabled = false;
|
|
@@ -457,7 +476,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
457
476
|
_loglevel2.default.error("Unable to disable notifications", e);
|
|
458
477
|
throw new Error("Unable to disable notifications");
|
|
459
478
|
} finally {
|
|
460
|
-
|
|
479
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, false);
|
|
461
480
|
}
|
|
462
481
|
}
|
|
463
482
|
/**
|
|
@@ -476,28 +495,28 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
476
495
|
*/
|
|
477
496
|
async deleteOnChainTriggersByAccount(accounts) {
|
|
478
497
|
try {
|
|
479
|
-
|
|
480
|
-
const { bearerToken, storageKey } = await
|
|
481
|
-
const userStorage = await
|
|
482
|
-
|
|
483
|
-
const UUIDs = accounts.map((a) =>
|
|
498
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _updateUpdatingAccountsState, updateUpdatingAccountsState_fn).call(this, accounts);
|
|
499
|
+
const { bearerToken, storageKey } = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getValidStorageKeyAndBearerToken, getValidStorageKeyAndBearerToken_fn).call(this);
|
|
500
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
501
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertUserStorage, assertUserStorage_fn).call(this, userStorage);
|
|
502
|
+
const UUIDs = accounts.map((a) => _chunk7U22ZANCjs.getUUIDsForAccount.call(void 0, userStorage, a.toLowerCase())).flat();
|
|
484
503
|
if (UUIDs.length === 0) {
|
|
485
504
|
return userStorage;
|
|
486
505
|
}
|
|
487
|
-
await
|
|
506
|
+
await _chunkTPGIXSC2js.deleteOnChainTriggers.call(void 0,
|
|
488
507
|
userStorage,
|
|
489
508
|
storageKey,
|
|
490
509
|
bearerToken,
|
|
491
510
|
UUIDs
|
|
492
511
|
);
|
|
493
|
-
await
|
|
494
|
-
await
|
|
512
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).disablePushNotifications(UUIDs);
|
|
513
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
495
514
|
return userStorage;
|
|
496
515
|
} catch (err) {
|
|
497
516
|
_loglevel2.default.error("Failed to delete OnChain triggers", err);
|
|
498
517
|
throw new Error("Failed to delete OnChain triggers");
|
|
499
518
|
} finally {
|
|
500
|
-
|
|
519
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _clearUpdatingAccountsState, clearUpdatingAccountsState_fn).call(this, accounts);
|
|
501
520
|
}
|
|
502
521
|
}
|
|
503
522
|
/**
|
|
@@ -517,12 +536,12 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
517
536
|
*/
|
|
518
537
|
async updateOnChainTriggersByAccount(accounts) {
|
|
519
538
|
try {
|
|
520
|
-
|
|
521
|
-
const { bearerToken, storageKey } = await
|
|
522
|
-
const userStorage = await
|
|
523
|
-
|
|
524
|
-
accounts.forEach((a) =>
|
|
525
|
-
const newTriggers =
|
|
539
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _updateUpdatingAccountsState, updateUpdatingAccountsState_fn).call(this, accounts);
|
|
540
|
+
const { bearerToken, storageKey } = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getValidStorageKeyAndBearerToken, getValidStorageKeyAndBearerToken_fn).call(this);
|
|
541
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
542
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertUserStorage, assertUserStorage_fn).call(this, userStorage);
|
|
543
|
+
accounts.forEach((a) => _chunk7U22ZANCjs.upsertAddressTriggers.call(void 0, a, userStorage));
|
|
544
|
+
const newTriggers = _chunk7U22ZANCjs.traverseUserStorageTriggers.call(void 0, userStorage, {
|
|
526
545
|
mapTrigger: (t) => {
|
|
527
546
|
if (!t.enabled) {
|
|
528
547
|
return t;
|
|
@@ -531,8 +550,8 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
531
550
|
}
|
|
532
551
|
});
|
|
533
552
|
if (newTriggers.length > 0) {
|
|
534
|
-
await
|
|
535
|
-
const triggers =
|
|
553
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
554
|
+
const triggers = _chunk7U22ZANCjs.traverseUserStorageTriggers.call(void 0, userStorage, {
|
|
536
555
|
mapTrigger: (t) => {
|
|
537
556
|
if (accounts.some((a) => a.toLowerCase() === t.address.toLowerCase())) {
|
|
538
557
|
return t;
|
|
@@ -540,22 +559,22 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
540
559
|
return void 0;
|
|
541
560
|
}
|
|
542
561
|
});
|
|
543
|
-
await
|
|
562
|
+
await _chunkTPGIXSC2js.createOnChainTriggers.call(void 0,
|
|
544
563
|
userStorage,
|
|
545
564
|
storageKey,
|
|
546
565
|
bearerToken,
|
|
547
566
|
triggers
|
|
548
567
|
);
|
|
549
568
|
}
|
|
550
|
-
const UUIDs =
|
|
551
|
-
await
|
|
552
|
-
await
|
|
569
|
+
const UUIDs = _chunk7U22ZANCjs.getAllUUIDs.call(void 0, userStorage);
|
|
570
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).updatePushNotifications(UUIDs);
|
|
571
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
553
572
|
return userStorage;
|
|
554
573
|
} catch (err) {
|
|
555
574
|
_loglevel2.default.error("Failed to update OnChain triggers", err);
|
|
556
575
|
throw new Error("Failed to update OnChain triggers");
|
|
557
576
|
} finally {
|
|
558
|
-
|
|
577
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _clearUpdatingAccountsState, clearUpdatingAccountsState_fn).call(this, accounts);
|
|
559
578
|
}
|
|
560
579
|
}
|
|
561
580
|
/**
|
|
@@ -568,15 +587,15 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
568
587
|
*/
|
|
569
588
|
async fetchAndUpdateMetamaskNotifications() {
|
|
570
589
|
try {
|
|
571
|
-
|
|
590
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn).call(this, true);
|
|
572
591
|
const rawFeatureAnnouncementNotifications = this.state.isFeatureAnnouncementsEnabled ? await _chunkZMNXLHACjs.getFeatureAnnouncementNotifications.call(void 0,
|
|
573
|
-
|
|
592
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _featureAnnouncementEnv)
|
|
574
593
|
).catch(() => []) : [];
|
|
575
594
|
const rawOnChainNotifications = [];
|
|
576
|
-
const userStorage = await
|
|
577
|
-
const bearerToken = await
|
|
595
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).getNotificationStorage().then((s) => s && JSON.parse(s)).catch(() => null);
|
|
596
|
+
const bearerToken = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).getBearerToken().catch(() => null);
|
|
578
597
|
if (userStorage && bearerToken) {
|
|
579
|
-
const notifications = await
|
|
598
|
+
const notifications = await _chunkTPGIXSC2js.getOnChainNotifications.call(void 0,
|
|
580
599
|
userStorage,
|
|
581
600
|
bearerToken
|
|
582
601
|
).catch(() => []);
|
|
@@ -584,7 +603,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
584
603
|
}
|
|
585
604
|
const readIds = this.state.metamaskNotificationsReadList;
|
|
586
605
|
const isNotUndefined = (t) => Boolean(t);
|
|
587
|
-
const processAndFilter = (ns) => ns.map((n) =>
|
|
606
|
+
const processAndFilter = (ns) => ns.map((n) => _chunk5FUMSWDDjs.safeProcessNotification.call(void 0, n, readIds)).filter(isNotUndefined);
|
|
588
607
|
const featureAnnouncementNotifications = processAndFilter(
|
|
589
608
|
rawFeatureAnnouncementNotifications
|
|
590
609
|
);
|
|
@@ -599,10 +618,10 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
599
618
|
this.update((state) => {
|
|
600
619
|
state.metamaskNotificationsList = metamaskNotifications;
|
|
601
620
|
});
|
|
602
|
-
|
|
621
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn).call(this, false);
|
|
603
622
|
return metamaskNotifications;
|
|
604
623
|
} catch (err) {
|
|
605
|
-
|
|
624
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn).call(this, false);
|
|
606
625
|
_loglevel2.default.error("Failed to fetch notifications", err);
|
|
607
626
|
throw new Error("Failed to fetch notifications");
|
|
608
627
|
}
|
|
@@ -624,12 +643,12 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
624
643
|
(notification) => notification.type === "features_announcement" /* FEATURES_ANNOUNCEMENT */ && !notification.isRead
|
|
625
644
|
);
|
|
626
645
|
if (onChainNotifications.length > 0) {
|
|
627
|
-
const bearerToken = await
|
|
646
|
+
const bearerToken = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).getBearerToken();
|
|
628
647
|
if (bearerToken) {
|
|
629
648
|
onchainNotificationIds = onChainNotifications.map(
|
|
630
649
|
(notification) => notification.id
|
|
631
650
|
);
|
|
632
|
-
await
|
|
651
|
+
await _chunkTPGIXSC2js.markNotificationsAsRead.call(void 0,
|
|
633
652
|
bearerToken,
|
|
634
653
|
onchainNotificationIds
|
|
635
654
|
).catch(() => {
|
|
@@ -673,7 +692,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
673
692
|
if (this.state.metamaskNotificationsList.some((n) => n.id === notification.id)) {
|
|
674
693
|
return;
|
|
675
694
|
}
|
|
676
|
-
const processedNotification =
|
|
695
|
+
const processedNotification = _chunk5FUMSWDDjs.safeProcessNotification.call(void 0, notification);
|
|
677
696
|
if (processedNotification) {
|
|
678
697
|
this.update((state) => {
|
|
679
698
|
const existingNotificationIds = new Set(
|
|
@@ -689,6 +708,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
689
708
|
}
|
|
690
709
|
}
|
|
691
710
|
};
|
|
711
|
+
_isPushIntegrated = new WeakMap();
|
|
692
712
|
_auth = new WeakMap();
|
|
693
713
|
_storage = new WeakMap();
|
|
694
714
|
_pushNotifications = new WeakMap();
|
|
@@ -720,7 +740,7 @@ clearLoadingStates_fn = function() {
|
|
|
720
740
|
};
|
|
721
741
|
_assertAuthEnabled = new WeakSet();
|
|
722
742
|
assertAuthEnabled_fn = function() {
|
|
723
|
-
if (!
|
|
743
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).isSignedIn()) {
|
|
724
744
|
this.update((state) => {
|
|
725
745
|
state.isNotificationServicesEnabled = false;
|
|
726
746
|
});
|
|
@@ -729,9 +749,9 @@ assertAuthEnabled_fn = function() {
|
|
|
729
749
|
};
|
|
730
750
|
_getValidStorageKeyAndBearerToken = new WeakSet();
|
|
731
751
|
getValidStorageKeyAndBearerToken_fn = async function() {
|
|
732
|
-
|
|
733
|
-
const bearerToken = await
|
|
734
|
-
const storageKey = await
|
|
752
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertAuthEnabled, assertAuthEnabled_fn).call(this);
|
|
753
|
+
const bearerToken = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).getBearerToken();
|
|
754
|
+
const storageKey = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).getStorageKey();
|
|
735
755
|
if (!bearerToken || !storageKey) {
|
|
736
756
|
throw new Error("Missing BearerToken or storage key");
|
|
737
757
|
}
|
|
@@ -746,7 +766,7 @@ assertUserStorage_fn = function(storage) {
|
|
|
746
766
|
};
|
|
747
767
|
_getUserStorage = new WeakSet();
|
|
748
768
|
getUserStorage_fn = async function() {
|
|
749
|
-
const userStorageString = await
|
|
769
|
+
const userStorageString = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).getNotificationStorage();
|
|
750
770
|
if (!userStorageString) {
|
|
751
771
|
return null;
|
|
752
772
|
}
|
|
@@ -799,4 +819,4 @@ clearUpdatingAccountsState_fn = function(accounts) {
|
|
|
799
819
|
|
|
800
820
|
|
|
801
821
|
exports.defaultState = defaultState; exports.NotificationServicesController = NotificationServicesController;
|
|
802
|
-
//# sourceMappingURL=chunk-
|
|
822
|
+
//# sourceMappingURL=chunk-TITJWXKP.js.map
|