@metamask/notification-services-controller 0.1.0 → 0.1.2
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 +31 -1
- package/dist/NotificationServicesController/NotificationServicesController.js +8 -8
- package/dist/NotificationServicesController/NotificationServicesController.mjs +7 -7
- 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 +18 -13
- package/dist/NotificationServicesController/index.mjs +17 -12
- 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 +4 -4
- package/dist/NotificationServicesController/services/feature-announcements.mjs +3 -3
- 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 +14 -0
- package/dist/NotificationServicesController/ui/constants.mjs +14 -0
- package/dist/NotificationServicesController/ui/index.js +15 -0
- package/dist/NotificationServicesController/ui/index.js.map +1 -0
- package/dist/NotificationServicesController/ui/index.mjs +15 -0
- package/dist/NotificationServicesController/ui/index.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 +20 -16
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +21 -17
- package/dist/NotificationServicesPushController/constants.js +1 -1
- package/dist/NotificationServicesPushController/constants.mjs +1 -1
- package/dist/NotificationServicesPushController/index.js +24 -20
- package/dist/NotificationServicesPushController/index.mjs +25 -21
- package/dist/NotificationServicesPushController/services/endpoints.js +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.mjs +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.js +16 -14
- package/dist/NotificationServicesPushController/services/push/push-web.mjs +15 -13
- package/dist/NotificationServicesPushController/services/services.js +17 -15
- package/dist/NotificationServicesPushController/services/services.mjs +16 -14
- 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 +16 -14
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +15 -13
- package/dist/NotificationServicesPushController/utils/index.js +17 -15
- package/dist/NotificationServicesPushController/utils/index.mjs +16 -14
- package/dist/{chunk-YRWUXGL3.js → chunk-2Z3NDVOV.js} +146 -114
- package/dist/chunk-2Z3NDVOV.js.map +1 -0
- package/dist/{chunk-RYAHBEX2.mjs → chunk-4VVOTF2Y.mjs} +51 -19
- package/dist/chunk-4VVOTF2Y.mjs.map +1 -0
- package/dist/{chunk-GFAESVZA.js → chunk-5FUMSWDD.js} +3 -3
- package/dist/chunk-5IPZMRR5.mjs +23 -0
- package/dist/chunk-5IPZMRR5.mjs.map +1 -0
- package/dist/{chunk-DKQBDI4C.js → chunk-5TUHE2FM.js} +41 -39
- package/dist/chunk-5TUHE2FM.js.map +1 -0
- 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-7SDGAI6Z.mjs +29 -0
- package/dist/chunk-7SDGAI6Z.mjs.map +1 -0
- 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-AQPBSNWA.js +23 -0
- package/dist/chunk-AQPBSNWA.js.map +1 -0
- package/dist/{chunk-PGMXFZ6Y.js → chunk-BUT7X5F2.js} +3 -3
- package/dist/chunk-D7VP2FPR.js +929 -0
- package/dist/chunk-D7VP2FPR.js.map +1 -0
- package/dist/{chunk-JLHFZ2UG.mjs → chunk-DCADU5QI.mjs} +3 -3
- package/dist/{chunk-VOZ7Y2OO.js → chunk-DNVD3CHQ.js} +8 -8
- package/dist/{chunk-FFQNSBPU.js → chunk-ENRKCWJ6.js} +7 -7
- package/dist/{chunk-UIRZIKC3.mjs → chunk-EZHMYHBX.mjs} +2 -2
- package/dist/{chunk-NMLYB3XT.js → chunk-GJHW5Z65.js} +4 -4
- package/dist/{chunk-ZMNXLHAC.js → chunk-HZEB53A6.js} +15 -35
- package/dist/chunk-HZEB53A6.js.map +1 -0
- package/dist/chunk-IGY2S5BC.js +36 -0
- package/dist/chunk-IGY2S5BC.js.map +1 -0
- package/dist/{chunk-SMKJEA45.mjs → chunk-ILPTPB4U.mjs} +4 -26
- package/dist/chunk-ILPTPB4U.mjs.map +1 -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-NXXY4CAP.js → chunk-MT4VCZEE.js} +11 -36
- package/dist/chunk-MT4VCZEE.js.map +1 -0
- package/dist/{chunk-PIZCE3JD.js → chunk-NOYP2T77.js} +8 -30
- package/dist/{chunk-PIZCE3JD.js.map → chunk-NOYP2T77.js.map} +1 -1
- package/dist/{chunk-EQWVJX6K.mjs → chunk-QFJZBLYQ.mjs} +14 -34
- package/dist/chunk-QFJZBLYQ.mjs.map +1 -0
- package/dist/chunk-QY4UST5V.js +37 -0
- package/dist/chunk-QY4UST5V.js.map +1 -0
- package/dist/{chunk-LFD7J7KR.mjs → chunk-R373BQEU.mjs} +10 -35
- package/dist/chunk-R373BQEU.mjs.map +1 -0
- package/dist/chunk-S2FM5DOS.js +29 -0
- package/dist/chunk-S2FM5DOS.js.map +1 -0
- package/dist/chunk-U5UIDVOO.mjs +36 -0
- package/dist/chunk-U5UIDVOO.mjs.map +1 -0
- 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-ODZ6V4PH.mjs → chunk-XVIUHFC3.mjs} +9 -7
- package/dist/chunk-XVIUHFC3.mjs.map +1 -0
- package/dist/chunk-YYWFWJTJ.mjs +929 -0
- package/dist/chunk-YYWFWJTJ.mjs.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 +22 -20
- package/dist/index.mjs +21 -19
- 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/__fixtures__/mock-raw-notifications.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/index.d.ts +1 -0
- package/dist/types/NotificationServicesController/index.d.ts.map +1 -1
- package/dist/types/NotificationServicesController/services/feature-announcements.d.ts.map +1 -1
- package/dist/types/NotificationServicesController/ui/constants.d.ts +20 -0
- package/dist/types/NotificationServicesController/ui/constants.d.ts.map +1 -0
- package/dist/types/NotificationServicesController/ui/index.d.ts +2 -0
- package/dist/types/NotificationServicesController/ui/index.d.ts.map +1 -0
- package/dist/types/NotificationServicesController/utils/utils.d.ts +1 -3
- package/dist/types/NotificationServicesController/utils/utils.d.ts.map +1 -1
- package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts +1 -0
- package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +1 -1
- package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts +0 -1
- package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts.map +1 -1
- package/package.json +6 -6
- 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-DKQBDI4C.js.map +0 -1
- package/dist/chunk-DY4ELDRQ.js.map +0 -1
- package/dist/chunk-EQWVJX6K.mjs.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-ODZ6V4PH.mjs.map +0 -1
- package/dist/chunk-RYAHBEX2.mjs.map +0 -1
- package/dist/chunk-SMKJEA45.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-ZMNXLHAC.js.map +0 -1
- /package/dist/{chunk-V46WVGWN.js.map → NotificationServicesController/ui/constants.js.map} +0 -0
- /package/dist/{chunk-26CCETCM.mjs.map → NotificationServicesController/ui/constants.mjs.map} +0 -0
- /package/dist/{chunk-GFAESVZA.js.map → chunk-5FUMSWDD.js.map} +0 -0
- /package/dist/{chunk-SSWX2N73.mjs.map → chunk-6GUOLD7O.mjs.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-VOZ7Y2OO.js.map → chunk-DNVD3CHQ.js.map} +0 -0
- /package/dist/{chunk-FFQNSBPU.js.map → chunk-ENRKCWJ6.js.map} +0 -0
- /package/dist/{chunk-UIRZIKC3.mjs.map → chunk-EZHMYHBX.mjs.map} +0 -0
- /package/dist/{chunk-NMLYB3XT.js.map → chunk-GJHW5Z65.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-QTK2RMF7.mjs.map → chunk-X42WN3FE.mjs.map} +0 -0
|
@@ -1,15 +1,15 @@
|
|
|
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
|
-
var
|
|
6
|
+
var _chunkHZEB53A6js = require('./chunk-HZEB53A6.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkDNVD3CHQjs = require('./chunk-DNVD3CHQ.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 _chunkNOYP2T77js = require('./chunk-NOYP2T77.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,50 @@ 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
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
208
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
209
|
+
return;
|
|
210
|
+
}
|
|
211
|
+
try {
|
|
212
|
+
await this.messagingSystem.call(
|
|
213
|
+
"NotificationServicesPushController:enablePushNotifications",
|
|
214
|
+
UUIDs
|
|
215
|
+
);
|
|
216
|
+
} catch (e) {
|
|
217
|
+
_loglevel2.default.error("Silently failed to enable push notifications", e);
|
|
218
|
+
}
|
|
209
219
|
},
|
|
210
220
|
disablePushNotifications: async (UUIDs) => {
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
221
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
222
|
+
return;
|
|
223
|
+
}
|
|
224
|
+
try {
|
|
225
|
+
await this.messagingSystem.call(
|
|
226
|
+
"NotificationServicesPushController:disablePushNotifications",
|
|
227
|
+
UUIDs
|
|
228
|
+
);
|
|
229
|
+
} catch (e) {
|
|
230
|
+
_loglevel2.default.error("Silently failed to disable push notifications", e);
|
|
231
|
+
}
|
|
215
232
|
},
|
|
216
233
|
updatePushNotifications: async (UUIDs) => {
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
234
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
await this.messagingSystem.call(
|
|
239
|
+
"NotificationServicesPushController:updateTriggerPushNotifications",
|
|
240
|
+
UUIDs
|
|
241
|
+
);
|
|
242
|
+
} catch (e) {
|
|
243
|
+
_loglevel2.default.error("Silently failed to update push notifications", e);
|
|
244
|
+
}
|
|
221
245
|
},
|
|
222
246
|
subscribe: () => {
|
|
247
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
223
250
|
this.messagingSystem.subscribe(
|
|
224
251
|
"NotificationServicesPushController:onNewNotifications",
|
|
225
252
|
(notification) => {
|
|
@@ -228,18 +255,21 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
228
255
|
);
|
|
229
256
|
},
|
|
230
257
|
initializePushNotifications: async () => {
|
|
258
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _isPushIntegrated)) {
|
|
259
|
+
return;
|
|
260
|
+
}
|
|
231
261
|
if (!this.state.isNotificationServicesEnabled) {
|
|
232
262
|
return;
|
|
233
263
|
}
|
|
234
|
-
const storage = await
|
|
264
|
+
const storage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
235
265
|
if (!storage) {
|
|
236
266
|
return;
|
|
237
267
|
}
|
|
238
|
-
const uuids =
|
|
239
|
-
await
|
|
268
|
+
const uuids = _chunkNOYP2T77js.getAllUUIDs.call(void 0, storage);
|
|
269
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).enablePushNotifications(uuids);
|
|
240
270
|
}
|
|
241
271
|
});
|
|
242
|
-
|
|
272
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _accounts, {
|
|
243
273
|
/**
|
|
244
274
|
* Used to get list of addresses from keyring (wallet addresses)
|
|
245
275
|
*
|
|
@@ -278,7 +308,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
278
308
|
* @returns result from list accounts
|
|
279
309
|
*/
|
|
280
310
|
initialize: () => {
|
|
281
|
-
return
|
|
311
|
+
return _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).listAccounts();
|
|
282
312
|
},
|
|
283
313
|
/**
|
|
284
314
|
* Subscription to any state change in the keyring controller (aka wallet accounts).
|
|
@@ -293,7 +323,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
293
323
|
if (!this.state.isNotificationServicesEnabled) {
|
|
294
324
|
return;
|
|
295
325
|
}
|
|
296
|
-
const { accountsAdded, accountsRemoved } = await
|
|
326
|
+
const { accountsAdded, accountsRemoved } = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).listAccounts();
|
|
297
327
|
const promises = [];
|
|
298
328
|
if (accountsAdded.length > 0) {
|
|
299
329
|
promises.push(this.updateOnChainTriggersByAccount(accountsAdded));
|
|
@@ -306,22 +336,23 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
306
336
|
);
|
|
307
337
|
}
|
|
308
338
|
});
|
|
309
|
-
|
|
310
|
-
|
|
339
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _featureAnnouncementEnv, void 0);
|
|
340
|
+
_chunkIGY2S5BCjs.__privateAdd.call(void 0, this, _performEnableProfileSyncing, async () => {
|
|
311
341
|
try {
|
|
312
|
-
await
|
|
342
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).enableProfileSyncing();
|
|
313
343
|
} catch (e) {
|
|
314
344
|
_loglevel2.default.error("Failed to enable profile syncing", e);
|
|
315
345
|
throw new Error("Failed to enable profile syncing");
|
|
316
346
|
}
|
|
317
347
|
});
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
348
|
+
_chunkIGY2S5BCjs.__privateSet.call(void 0, this, _isPushIntegrated, env.isPushIntegrated ?? true);
|
|
349
|
+
_chunkIGY2S5BCjs.__privateSet.call(void 0, this, _featureAnnouncementEnv, env.featureAnnouncements);
|
|
350
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _registerMessageHandlers, registerMessageHandlers_fn).call(this);
|
|
351
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _clearLoadingStates, clearLoadingStates_fn).call(this);
|
|
352
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).initialize();
|
|
353
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).initializePushNotifications();
|
|
354
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).subscribe();
|
|
355
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).subscribe();
|
|
325
356
|
}
|
|
326
357
|
/**
|
|
327
358
|
* Retrieves the current enabled state of MetaMask notifications.
|
|
@@ -336,16 +367,16 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
336
367
|
}
|
|
337
368
|
async checkAccountsPresence(accounts) {
|
|
338
369
|
try {
|
|
339
|
-
|
|
340
|
-
const userStorage = await
|
|
341
|
-
|
|
342
|
-
const presence =
|
|
370
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsCheckingAccountsPresence, setIsCheckingAccountsPresence_fn).call(this, true);
|
|
371
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
372
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertUserStorage, assertUserStorage_fn).call(this, userStorage);
|
|
373
|
+
const presence = _chunkNOYP2T77js.checkAccountsPresence.call(void 0, userStorage, accounts);
|
|
343
374
|
return presence;
|
|
344
375
|
} catch (error) {
|
|
345
376
|
_loglevel2.default.error("Failed to check accounts presence", error);
|
|
346
377
|
throw error;
|
|
347
378
|
} finally {
|
|
348
|
-
|
|
379
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsCheckingAccountsPresence, setIsCheckingAccountsPresence_fn).call(this, false);
|
|
349
380
|
}
|
|
350
381
|
}
|
|
351
382
|
/**
|
|
@@ -377,28 +408,28 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
377
408
|
*/
|
|
378
409
|
async createOnChainTriggers() {
|
|
379
410
|
try {
|
|
380
|
-
|
|
381
|
-
await
|
|
382
|
-
const { bearerToken, storageKey } = await
|
|
383
|
-
const { accounts } = await
|
|
384
|
-
let userStorage = await
|
|
411
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, true);
|
|
412
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _performEnableProfileSyncing).call(this);
|
|
413
|
+
const { bearerToken, storageKey } = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getValidStorageKeyAndBearerToken, getValidStorageKeyAndBearerToken_fn).call(this);
|
|
414
|
+
const { accounts } = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _accounts).listAccounts();
|
|
415
|
+
let userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
385
416
|
if (userStorage?.[_chunkTLX5QQK5js.USER_STORAGE_VERSION_KEY] === void 0) {
|
|
386
|
-
userStorage =
|
|
417
|
+
userStorage = _chunkNOYP2T77js.initializeUserStorage.call(void 0,
|
|
387
418
|
accounts.map((account) => ({ address: account })),
|
|
388
419
|
false
|
|
389
420
|
);
|
|
390
|
-
await
|
|
421
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
391
422
|
}
|
|
392
|
-
const triggers =
|
|
393
|
-
await
|
|
423
|
+
const triggers = _chunkNOYP2T77js.traverseUserStorageTriggers.call(void 0, userStorage);
|
|
424
|
+
await _chunkDNVD3CHQjs.createOnChainTriggers.call(void 0,
|
|
394
425
|
userStorage,
|
|
395
426
|
storageKey,
|
|
396
427
|
bearerToken,
|
|
397
428
|
triggers
|
|
398
429
|
);
|
|
399
|
-
const allUUIDS =
|
|
400
|
-
await
|
|
401
|
-
await
|
|
430
|
+
const allUUIDS = _chunkNOYP2T77js.getAllUUIDs.call(void 0, userStorage);
|
|
431
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).enablePushNotifications(allUUIDS);
|
|
432
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
402
433
|
this.update((state) => {
|
|
403
434
|
state.isNotificationServicesEnabled = true;
|
|
404
435
|
state.isFeatureAnnouncementsEnabled = true;
|
|
@@ -409,7 +440,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
409
440
|
_loglevel2.default.error("Failed to create On Chain triggers", err);
|
|
410
441
|
throw new Error("Failed to create On Chain triggers");
|
|
411
442
|
} finally {
|
|
412
|
-
|
|
443
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, false);
|
|
413
444
|
}
|
|
414
445
|
}
|
|
415
446
|
/**
|
|
@@ -424,13 +455,13 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
424
455
|
*/
|
|
425
456
|
async enableMetamaskNotifications() {
|
|
426
457
|
try {
|
|
427
|
-
|
|
458
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, true);
|
|
428
459
|
await this.createOnChainTriggers();
|
|
429
460
|
} catch (e) {
|
|
430
461
|
_loglevel2.default.error("Unable to enable notifications", e);
|
|
431
462
|
throw new Error("Unable to enable notifications");
|
|
432
463
|
} finally {
|
|
433
|
-
|
|
464
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, false);
|
|
434
465
|
}
|
|
435
466
|
}
|
|
436
467
|
/**
|
|
@@ -443,11 +474,11 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
443
474
|
*/
|
|
444
475
|
async disableNotificationServices() {
|
|
445
476
|
try {
|
|
446
|
-
|
|
447
|
-
const userStorage = await
|
|
448
|
-
|
|
449
|
-
const UUIDs =
|
|
450
|
-
await
|
|
477
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, true);
|
|
478
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
479
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertUserStorage, assertUserStorage_fn).call(this, userStorage);
|
|
480
|
+
const UUIDs = _chunkNOYP2T77js.getAllUUIDs.call(void 0, userStorage);
|
|
481
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).disablePushNotifications(UUIDs);
|
|
451
482
|
this.update((state) => {
|
|
452
483
|
state.isNotificationServicesEnabled = false;
|
|
453
484
|
state.isFeatureAnnouncementsEnabled = false;
|
|
@@ -457,7 +488,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
457
488
|
_loglevel2.default.error("Unable to disable notifications", e);
|
|
458
489
|
throw new Error("Unable to disable notifications");
|
|
459
490
|
} finally {
|
|
460
|
-
|
|
491
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsUpdatingMetamaskNotifications, setIsUpdatingMetamaskNotifications_fn).call(this, false);
|
|
461
492
|
}
|
|
462
493
|
}
|
|
463
494
|
/**
|
|
@@ -476,28 +507,28 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
476
507
|
*/
|
|
477
508
|
async deleteOnChainTriggersByAccount(accounts) {
|
|
478
509
|
try {
|
|
479
|
-
|
|
480
|
-
const { bearerToken, storageKey } = await
|
|
481
|
-
const userStorage = await
|
|
482
|
-
|
|
483
|
-
const UUIDs = accounts.map((a) =>
|
|
510
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _updateUpdatingAccountsState, updateUpdatingAccountsState_fn).call(this, accounts);
|
|
511
|
+
const { bearerToken, storageKey } = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getValidStorageKeyAndBearerToken, getValidStorageKeyAndBearerToken_fn).call(this);
|
|
512
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
513
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertUserStorage, assertUserStorage_fn).call(this, userStorage);
|
|
514
|
+
const UUIDs = accounts.map((a) => _chunkNOYP2T77js.getUUIDsForAccount.call(void 0, userStorage, a.toLowerCase())).flat();
|
|
484
515
|
if (UUIDs.length === 0) {
|
|
485
516
|
return userStorage;
|
|
486
517
|
}
|
|
487
|
-
await
|
|
518
|
+
await _chunkDNVD3CHQjs.deleteOnChainTriggers.call(void 0,
|
|
488
519
|
userStorage,
|
|
489
520
|
storageKey,
|
|
490
521
|
bearerToken,
|
|
491
522
|
UUIDs
|
|
492
523
|
);
|
|
493
|
-
await
|
|
494
|
-
await
|
|
524
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).disablePushNotifications(UUIDs);
|
|
525
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
495
526
|
return userStorage;
|
|
496
527
|
} catch (err) {
|
|
497
528
|
_loglevel2.default.error("Failed to delete OnChain triggers", err);
|
|
498
529
|
throw new Error("Failed to delete OnChain triggers");
|
|
499
530
|
} finally {
|
|
500
|
-
|
|
531
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _clearUpdatingAccountsState, clearUpdatingAccountsState_fn).call(this, accounts);
|
|
501
532
|
}
|
|
502
533
|
}
|
|
503
534
|
/**
|
|
@@ -517,12 +548,12 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
517
548
|
*/
|
|
518
549
|
async updateOnChainTriggersByAccount(accounts) {
|
|
519
550
|
try {
|
|
520
|
-
|
|
521
|
-
const { bearerToken, storageKey } = await
|
|
522
|
-
const userStorage = await
|
|
523
|
-
|
|
524
|
-
accounts.forEach((a) =>
|
|
525
|
-
const newTriggers =
|
|
551
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _updateUpdatingAccountsState, updateUpdatingAccountsState_fn).call(this, accounts);
|
|
552
|
+
const { bearerToken, storageKey } = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getValidStorageKeyAndBearerToken, getValidStorageKeyAndBearerToken_fn).call(this);
|
|
553
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _getUserStorage, getUserStorage_fn).call(this);
|
|
554
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertUserStorage, assertUserStorage_fn).call(this, userStorage);
|
|
555
|
+
accounts.forEach((a) => _chunkNOYP2T77js.upsertAddressTriggers.call(void 0, a, userStorage));
|
|
556
|
+
const newTriggers = _chunkNOYP2T77js.traverseUserStorageTriggers.call(void 0, userStorage, {
|
|
526
557
|
mapTrigger: (t) => {
|
|
527
558
|
if (!t.enabled) {
|
|
528
559
|
return t;
|
|
@@ -531,8 +562,8 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
531
562
|
}
|
|
532
563
|
});
|
|
533
564
|
if (newTriggers.length > 0) {
|
|
534
|
-
await
|
|
535
|
-
const triggers =
|
|
565
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
566
|
+
const triggers = _chunkNOYP2T77js.traverseUserStorageTriggers.call(void 0, userStorage, {
|
|
536
567
|
mapTrigger: (t) => {
|
|
537
568
|
if (accounts.some((a) => a.toLowerCase() === t.address.toLowerCase())) {
|
|
538
569
|
return t;
|
|
@@ -540,22 +571,22 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
540
571
|
return void 0;
|
|
541
572
|
}
|
|
542
573
|
});
|
|
543
|
-
await
|
|
574
|
+
await _chunkDNVD3CHQjs.createOnChainTriggers.call(void 0,
|
|
544
575
|
userStorage,
|
|
545
576
|
storageKey,
|
|
546
577
|
bearerToken,
|
|
547
578
|
triggers
|
|
548
579
|
);
|
|
549
580
|
}
|
|
550
|
-
const UUIDs =
|
|
551
|
-
await
|
|
552
|
-
await
|
|
581
|
+
const UUIDs = _chunkNOYP2T77js.getAllUUIDs.call(void 0, userStorage);
|
|
582
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _pushNotifications).updatePushNotifications(UUIDs);
|
|
583
|
+
await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).setNotificationStorage(JSON.stringify(userStorage));
|
|
553
584
|
return userStorage;
|
|
554
585
|
} catch (err) {
|
|
555
586
|
_loglevel2.default.error("Failed to update OnChain triggers", err);
|
|
556
587
|
throw new Error("Failed to update OnChain triggers");
|
|
557
588
|
} finally {
|
|
558
|
-
|
|
589
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _clearUpdatingAccountsState, clearUpdatingAccountsState_fn).call(this, accounts);
|
|
559
590
|
}
|
|
560
591
|
}
|
|
561
592
|
/**
|
|
@@ -568,15 +599,15 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
568
599
|
*/
|
|
569
600
|
async fetchAndUpdateMetamaskNotifications() {
|
|
570
601
|
try {
|
|
571
|
-
|
|
572
|
-
const rawFeatureAnnouncementNotifications = this.state.isFeatureAnnouncementsEnabled ? await
|
|
573
|
-
|
|
602
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn).call(this, true);
|
|
603
|
+
const rawFeatureAnnouncementNotifications = this.state.isFeatureAnnouncementsEnabled ? await _chunkHZEB53A6js.getFeatureAnnouncementNotifications.call(void 0,
|
|
604
|
+
_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _featureAnnouncementEnv)
|
|
574
605
|
).catch(() => []) : [];
|
|
575
606
|
const rawOnChainNotifications = [];
|
|
576
|
-
const userStorage = await
|
|
577
|
-
const bearerToken = await
|
|
607
|
+
const userStorage = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).getNotificationStorage().then((s) => s && JSON.parse(s)).catch(() => null);
|
|
608
|
+
const bearerToken = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).getBearerToken().catch(() => null);
|
|
578
609
|
if (userStorage && bearerToken) {
|
|
579
|
-
const notifications = await
|
|
610
|
+
const notifications = await _chunkDNVD3CHQjs.getOnChainNotifications.call(void 0,
|
|
580
611
|
userStorage,
|
|
581
612
|
bearerToken
|
|
582
613
|
).catch(() => []);
|
|
@@ -584,7 +615,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
584
615
|
}
|
|
585
616
|
const readIds = this.state.metamaskNotificationsReadList;
|
|
586
617
|
const isNotUndefined = (t) => Boolean(t);
|
|
587
|
-
const processAndFilter = (ns) => ns.map((n) =>
|
|
618
|
+
const processAndFilter = (ns) => ns.map((n) => _chunk5FUMSWDDjs.safeProcessNotification.call(void 0, n, readIds)).filter(isNotUndefined);
|
|
588
619
|
const featureAnnouncementNotifications = processAndFilter(
|
|
589
620
|
rawFeatureAnnouncementNotifications
|
|
590
621
|
);
|
|
@@ -599,10 +630,10 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
599
630
|
this.update((state) => {
|
|
600
631
|
state.metamaskNotificationsList = metamaskNotifications;
|
|
601
632
|
});
|
|
602
|
-
|
|
633
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn).call(this, false);
|
|
603
634
|
return metamaskNotifications;
|
|
604
635
|
} catch (err) {
|
|
605
|
-
|
|
636
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _setIsFetchingMetamaskNotifications, setIsFetchingMetamaskNotifications_fn).call(this, false);
|
|
606
637
|
_loglevel2.default.error("Failed to fetch notifications", err);
|
|
607
638
|
throw new Error("Failed to fetch notifications");
|
|
608
639
|
}
|
|
@@ -624,12 +655,12 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
624
655
|
(notification) => notification.type === "features_announcement" /* FEATURES_ANNOUNCEMENT */ && !notification.isRead
|
|
625
656
|
);
|
|
626
657
|
if (onChainNotifications.length > 0) {
|
|
627
|
-
const bearerToken = await
|
|
658
|
+
const bearerToken = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).getBearerToken();
|
|
628
659
|
if (bearerToken) {
|
|
629
660
|
onchainNotificationIds = onChainNotifications.map(
|
|
630
661
|
(notification) => notification.id
|
|
631
662
|
);
|
|
632
|
-
await
|
|
663
|
+
await _chunkDNVD3CHQjs.markNotificationsAsRead.call(void 0,
|
|
633
664
|
bearerToken,
|
|
634
665
|
onchainNotificationIds
|
|
635
666
|
).catch(() => {
|
|
@@ -673,7 +704,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
673
704
|
if (this.state.metamaskNotificationsList.some((n) => n.id === notification.id)) {
|
|
674
705
|
return;
|
|
675
706
|
}
|
|
676
|
-
const processedNotification =
|
|
707
|
+
const processedNotification = _chunk5FUMSWDDjs.safeProcessNotification.call(void 0, notification);
|
|
677
708
|
if (processedNotification) {
|
|
678
709
|
this.update((state) => {
|
|
679
710
|
const existingNotificationIds = new Set(
|
|
@@ -689,6 +720,7 @@ var NotificationServicesController = class extends _basecontroller.BaseControlle
|
|
|
689
720
|
}
|
|
690
721
|
}
|
|
691
722
|
};
|
|
723
|
+
_isPushIntegrated = new WeakMap();
|
|
692
724
|
_auth = new WeakMap();
|
|
693
725
|
_storage = new WeakMap();
|
|
694
726
|
_pushNotifications = new WeakMap();
|
|
@@ -720,7 +752,7 @@ clearLoadingStates_fn = function() {
|
|
|
720
752
|
};
|
|
721
753
|
_assertAuthEnabled = new WeakSet();
|
|
722
754
|
assertAuthEnabled_fn = function() {
|
|
723
|
-
if (!
|
|
755
|
+
if (!_chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).isSignedIn()) {
|
|
724
756
|
this.update((state) => {
|
|
725
757
|
state.isNotificationServicesEnabled = false;
|
|
726
758
|
});
|
|
@@ -729,9 +761,9 @@ assertAuthEnabled_fn = function() {
|
|
|
729
761
|
};
|
|
730
762
|
_getValidStorageKeyAndBearerToken = new WeakSet();
|
|
731
763
|
getValidStorageKeyAndBearerToken_fn = async function() {
|
|
732
|
-
|
|
733
|
-
const bearerToken = await
|
|
734
|
-
const storageKey = await
|
|
764
|
+
_chunkIGY2S5BCjs.__privateMethod.call(void 0, this, _assertAuthEnabled, assertAuthEnabled_fn).call(this);
|
|
765
|
+
const bearerToken = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _auth).getBearerToken();
|
|
766
|
+
const storageKey = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).getStorageKey();
|
|
735
767
|
if (!bearerToken || !storageKey) {
|
|
736
768
|
throw new Error("Missing BearerToken or storage key");
|
|
737
769
|
}
|
|
@@ -746,7 +778,7 @@ assertUserStorage_fn = function(storage) {
|
|
|
746
778
|
};
|
|
747
779
|
_getUserStorage = new WeakSet();
|
|
748
780
|
getUserStorage_fn = async function() {
|
|
749
|
-
const userStorageString = await
|
|
781
|
+
const userStorageString = await _chunkIGY2S5BCjs.__privateGet.call(void 0, this, _storage).getNotificationStorage();
|
|
750
782
|
if (!userStorageString) {
|
|
751
783
|
return null;
|
|
752
784
|
}
|
|
@@ -799,4 +831,4 @@ clearUpdatingAccountsState_fn = function(accounts) {
|
|
|
799
831
|
|
|
800
832
|
|
|
801
833
|
exports.defaultState = defaultState; exports.NotificationServicesController = NotificationServicesController;
|
|
802
|
-
//# sourceMappingURL=chunk-
|
|
834
|
+
//# sourceMappingURL=chunk-2Z3NDVOV.js.map
|