@metamask-previews/notification-services-controller 0.18.0-preview-442894ce → 0.18.0-preview-43593c4e
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.cjs +49 -48
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts +5 -5
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts +5 -5
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.mjs +49 -48
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
- package/dist/NotificationServicesController/index.cjs +0 -1
- package/dist/NotificationServicesController/index.cjs.map +1 -1
- package/dist/NotificationServicesController/index.d.cts +0 -1
- package/dist/NotificationServicesController/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/index.d.mts +0 -1
- package/dist/NotificationServicesController/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/index.mjs +0 -1
- package/dist/NotificationServicesController/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +40 -43
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +23 -21
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +23 -21
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +41 -44
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/{types/push-service-interface.cjs → services/push/index.cjs} +1 -1
- package/dist/NotificationServicesPushController/services/push/index.cjs.map +1 -0
- package/dist/NotificationServicesPushController/services/push/index.d.cts +6 -0
- package/dist/NotificationServicesPushController/services/push/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/services/push/index.d.mts +6 -0
- package/dist/NotificationServicesPushController/services/push/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/services/push/index.mjs +2 -0
- package/dist/NotificationServicesPushController/services/push/index.mjs.map +1 -0
- package/dist/NotificationServicesPushController/{web/push-helpers.cjs → services/push/push-web.cjs} +8 -37
- package/dist/NotificationServicesPushController/services/push/push-web.cjs.map +1 -0
- package/dist/NotificationServicesPushController/services/push/push-web.d.cts +33 -0
- package/dist/NotificationServicesPushController/services/push/push-web.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/services/push/push-web.d.mts +33 -0
- package/dist/NotificationServicesPushController/services/push/push-web.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/{web/push-helpers.mjs → services/push/push-web.mjs} +7 -37
- package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +1 -0
- package/dist/NotificationServicesPushController/services/services.cjs +28 -3
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +15 -1
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +15 -1
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +26 -2
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/dist/NotificationServicesPushController/types/index.cjs +15 -0
- package/dist/NotificationServicesPushController/types/index.cjs.map +1 -1
- package/dist/NotificationServicesPushController/types/index.d.cts +1 -2
- package/dist/NotificationServicesPushController/types/index.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/types/index.d.mts +1 -2
- package/dist/NotificationServicesPushController/types/index.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/types/index.mjs +1 -1
- package/dist/NotificationServicesPushController/types/index.mjs.map +1 -1
- package/package.json +2 -12
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.cjs +0 -14
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.cts +0 -3
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.mts +0 -3
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.mjs +0 -10
- package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.mjs.map +0 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.cjs.map +0 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.d.cts +0 -30
- package/dist/NotificationServicesPushController/types/push-service-interface.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.d.mts +0 -30
- package/dist/NotificationServicesPushController/types/push-service-interface.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.mjs +0 -2
- package/dist/NotificationServicesPushController/types/push-service-interface.mjs.map +0 -1
- package/dist/NotificationServicesPushController/web/index.cjs +0 -8
- package/dist/NotificationServicesPushController/web/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/web/index.d.cts +0 -2
- package/dist/NotificationServicesPushController/web/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/web/index.d.mts +0 -2
- package/dist/NotificationServicesPushController/web/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/web/index.mjs +0 -2
- package/dist/NotificationServicesPushController/web/index.mjs.map +0 -1
- package/dist/NotificationServicesPushController/web/push-helpers.cjs.map +0 -1
- package/dist/NotificationServicesPushController/web/push-helpers.d.cts +0 -37
- package/dist/NotificationServicesPushController/web/push-helpers.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/web/push-helpers.d.mts +0 -37
- package/dist/NotificationServicesPushController/web/push-helpers.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/web/push-helpers.mjs.map +0 -1
- package/push-services/web/package.json +0 -9
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationServicesController.d.cts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"NotificationServicesController.d.cts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAE3D,OAAO,KAAK,EACV,kCAAkC,EAClC,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC7B,qCAAqC;AACtC,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACtB,0CAA0C;AAK3C,OAAO,EAAE,aAAa,EAAE,4CAAwC;AAIhE,OAAO,KAAK,EACV,aAAa,EACb,4BAA4B,EAE7B,8CAA0C;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,8CAA0C;AAKrE,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,4DAA4D,CAAC;IACnE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,6DAA6D,CAAC;IACpE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,gEAAgE,GAAG;IAC7E,IAAI,EAAE,mEAAmE,CAAC;IAC1E,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,0DAA0D,GA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W,CAAC;IA+DxB;;;;;;;;;OASG;IACU,2BAA2B;IAYxC;;;;;;;OAOG;IACU,2BAA2B;IA8BxC;;;;;;;;;;;;;OAaG;IACU,8BAA8B,CACzC,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,WAAW,CAAC;IA0CvB;;;;;;;;;;;;;;OAcG;IACU,8BAA8B,CACzC,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,WAAW,CAAC;IA8DvB;;;;;;;;OAQG;IACU,mCAAmC,CAC9C,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,EAAE,CAAC;IAuF3B;;;;;;OAMG;IACI,sBAAsB,CAAC,IAAI,EAAE,aAAa;IAUjD;;;;;;;OAOG;IACU,sBAAsB,CAAC,EAAE,EAAE,MAAM;IA6B9C;;;;;;;OAOG;IACU,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE;IAWlD;;;;;OAKG;IACU,+BAA+B,CAC1C,aAAa,EAAE,4BAA4B,GAC1C,OAAO,CAAC,IAAI,CAAC;IA2GhB;;;;;;OAMG;IACU,+BAA+B,CAC1C,YAAY,EAAE,aAAa,GAC1B,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RestrictedMessenger, ControllerGetStateAction, ControllerStateChangeEvent } from "@metamask/base-controller";
|
|
2
2
|
import { BaseController } from "@metamask/base-controller";
|
|
3
3
|
import type { KeyringControllerGetAccountsAction, KeyringControllerStateChangeEvent, KeyringControllerGetStateAction, KeyringControllerLockEvent, KeyringControllerUnlockEvent } from "@metamask/keyring-controller";
|
|
4
4
|
import type { AuthenticationController, UserStorageController } from "@metamask/profile-sync-controller";
|
|
5
5
|
import { TRIGGER_TYPES } from "./constants/notification-schema.mjs";
|
|
6
6
|
import type { INotification, MarkAsReadNotificationsParam } from "./types/notification/notification.mjs";
|
|
7
7
|
import type { UserStorage } from "./types/user-storage/user-storage.mjs";
|
|
8
|
-
import type { NotificationServicesPushControllerStateChangeEvent } from "../NotificationServicesPushController/index.mjs";
|
|
9
8
|
export type NotificationServicesPushControllerEnablePushNotifications = {
|
|
10
9
|
type: `NotificationServicesPushController:enablePushNotifications`;
|
|
11
10
|
handler: (UUIDs: string[]) => Promise<void>;
|
|
@@ -109,8 +108,8 @@ export type MarkNotificationsAsReadEvent = {
|
|
|
109
108
|
payload: [INotification[]];
|
|
110
109
|
};
|
|
111
110
|
export type Events = NotificationServicesControllerStateChangeEvent | NotificationListUpdatedEvent | MarkNotificationsAsReadEvent;
|
|
112
|
-
export type AllowedEvents = KeyringControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | NotificationServicesPushControllerOnNewNotification
|
|
113
|
-
export type NotificationServicesControllerMessenger =
|
|
111
|
+
export type AllowedEvents = KeyringControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | NotificationServicesPushControllerOnNewNotification;
|
|
112
|
+
export type NotificationServicesControllerMessenger = RestrictedMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
|
|
114
113
|
type FeatureAnnouncementEnv = {
|
|
115
114
|
spaceId: string;
|
|
116
115
|
accessToken: string;
|
|
@@ -129,12 +128,14 @@ export default class NotificationServicesController extends BaseController<typeo
|
|
|
129
128
|
* @param args.state - Initial state to set on this controller.
|
|
130
129
|
* @param args.env - environment variables for a given controller.
|
|
131
130
|
* @param args.env.featureAnnouncements - env variables for feature announcements.
|
|
131
|
+
* @param args.env.isPushIntegrated - toggle push notifications on/off if client has integrated them.
|
|
132
132
|
*/
|
|
133
133
|
constructor({ messenger, state, env, }: {
|
|
134
134
|
messenger: NotificationServicesControllerMessenger;
|
|
135
135
|
state?: Partial<NotificationServicesControllerState>;
|
|
136
136
|
env: {
|
|
137
137
|
featureAnnouncements: FeatureAnnouncementEnv;
|
|
138
|
+
isPushIntegrated?: boolean;
|
|
138
139
|
};
|
|
139
140
|
});
|
|
140
141
|
/**
|
|
@@ -230,7 +231,6 @@ export default class NotificationServicesController extends BaseController<typeo
|
|
|
230
231
|
*
|
|
231
232
|
* @param previewToken - the preview token to use if needed
|
|
232
233
|
* @throws {Error} Throws an error if unauthenticated or from other operations.
|
|
233
|
-
* @returns updated notification list
|
|
234
234
|
*/
|
|
235
235
|
fetchAndUpdateMetamaskNotifications(previewToken?: string): Promise<INotification[]>;
|
|
236
236
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NotificationServicesController.d.mts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"NotificationServicesController.d.mts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAE3D,OAAO,KAAK,EACV,kCAAkC,EAClC,iCAAiC,EACjC,+BAA+B,EAC/B,0BAA0B,EAC1B,4BAA4B,EAC7B,qCAAqC;AACtC,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACtB,0CAA0C;AAK3C,OAAO,EAAE,aAAa,EAAE,4CAAwC;AAIhE,OAAO,KAAK,EACV,aAAa,EACb,4BAA4B,EAE7B,8CAA0C;AAE3C,OAAO,KAAK,EAAE,WAAW,EAAE,8CAA0C;AAKrE,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,4DAA4D,CAAC;IACnE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,0DAA0D,GAAG;IACvE,IAAI,EAAE,6DAA6D,CAAC;IACpE,OAAO,EAAE,CAAC,KAAK,EAA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EAAE,GACjB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAkBnC;;;;;;;;OAQG;IACU,8BAA8B,CACzC,2BAA2B,EAAE,OAAO;IAYtC;;;;;;;;;;OAUG;IACU,qBAAqB,CAAC,IAAI,CAAC,EAAE;QACxC,kBAAkB,CAAC,EAAE,OAAO,CAAC;KAC9B,GAAG,OAAO,CAAC,WAAW,CAAC;IA+DxB;;;;;;;;;OASG;IACU,2BAA2B;IAYxC;;;;;;;OAOG;IACU,2BAA2B;IA8BxC;;;;;;;;;;;;;OAaG;IACU,8BAA8B,CACzC,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,WAAW,CAAC;IA0CvB;;;;;;;;;;;;;;OAcG;IACU,8BAA8B,CACzC,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,WAAW,CAAC;IA8DvB;;;;;;;;OAQG;IACU,mCAAmC,CAC9C,YAAY,CAAC,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,EAAE,CAAC;IAuF3B;;;;;;OAMG;IACI,sBAAsB,CAAC,IAAI,EAAE,aAAa;IAUjD;;;;;;;OAOG;IACU,sBAAsB,CAAC,EAAE,EAAE,MAAM;IA6B9C;;;;;;;OAOG;IACU,uBAAuB,CAAC,GAAG,EAAE,MAAM,EAAE;IAWlD;;;;;OAKG;IACU,+BAA+B,CAC1C,aAAa,EAAE,4BAA4B,GAC1C,OAAO,CAAC,IAAI,CAAC;IA2GhB;;;;;;OAMG;IACU,+BAA+B,CAC1C,YAAY,EAAE,aAAa,GAC1B,OAAO,CAAC,IAAI,CAAC;CA6BjB"}
|
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _NotificationServicesController_instances, _NotificationServicesController_isPushNotificationsSetup, _NotificationServicesController_isUnlocked, _NotificationServicesController_keyringController, _NotificationServicesController_auth, _NotificationServicesController_storage, _NotificationServicesController_pushNotifications, _NotificationServicesController_accounts, _NotificationServicesController_featureAnnouncementEnv, _NotificationServicesController_registerMessageHandlers, _NotificationServicesController_clearLoadingStates, _NotificationServicesController_assertAuthEnabled, _NotificationServicesController_getValidStorageKeyAndBearerToken, _NotificationServicesController_performEnableProfileSyncing, _NotificationServicesController_assertUserStorage, _NotificationServicesController_getUserStorage, _NotificationServicesController_setIsUpdatingMetamaskNotifications, _NotificationServicesController_setIsFetchingMetamaskNotifications, _NotificationServicesController_setIsCheckingAccountsPresence, _NotificationServicesController_updateUpdatingAccountsState, _NotificationServicesController_clearUpdatingAccountsState;
|
|
12
|
+
var _NotificationServicesController_instances, _NotificationServicesController_isPushIntegrated, _NotificationServicesController_isPushNotificationsSetup, _NotificationServicesController_isUnlocked, _NotificationServicesController_keyringController, _NotificationServicesController_auth, _NotificationServicesController_storage, _NotificationServicesController_pushNotifications, _NotificationServicesController_accounts, _NotificationServicesController_featureAnnouncementEnv, _NotificationServicesController_registerMessageHandlers, _NotificationServicesController_clearLoadingStates, _NotificationServicesController_assertAuthEnabled, _NotificationServicesController_getValidStorageKeyAndBearerToken, _NotificationServicesController_performEnableProfileSyncing, _NotificationServicesController_assertUserStorage, _NotificationServicesController_getUserStorage, _NotificationServicesController_setIsUpdatingMetamaskNotifications, _NotificationServicesController_setIsFetchingMetamaskNotifications, _NotificationServicesController_setIsCheckingAccountsPresence, _NotificationServicesController_updateUpdatingAccountsState, _NotificationServicesController_clearUpdatingAccountsState;
|
|
13
13
|
function $importDefault(module) {
|
|
14
14
|
if (module?.__esModule) {
|
|
15
15
|
return module.default;
|
|
@@ -98,6 +98,7 @@ class NotificationServicesController extends BaseController {
|
|
|
98
98
|
* @param args.state - Initial state to set on this controller.
|
|
99
99
|
* @param args.env - environment variables for a given controller.
|
|
100
100
|
* @param args.env.featureAnnouncements - env variables for feature announcements.
|
|
101
|
+
* @param args.env.isPushIntegrated - toggle push notifications on/off if client has integrated them.
|
|
101
102
|
*/
|
|
102
103
|
constructor({ messenger, state, env, }) {
|
|
103
104
|
super({
|
|
@@ -107,6 +108,8 @@ class NotificationServicesController extends BaseController {
|
|
|
107
108
|
state: { ...defaultState, ...state },
|
|
108
109
|
});
|
|
109
110
|
_NotificationServicesController_instances.add(this);
|
|
111
|
+
// Temporary boolean as push notifications are not yet enabled on mobile
|
|
112
|
+
_NotificationServicesController_isPushIntegrated.set(this, true);
|
|
110
113
|
// Flag to check is notifications have been setup when the browser/extension is initialized.
|
|
111
114
|
// We want to re-initialize push notifications when the browser/extension is refreshed
|
|
112
115
|
// To ensure we subscribe to the most up-to-date notifications
|
|
@@ -151,30 +154,13 @@ class NotificationServicesController extends BaseController {
|
|
|
151
154
|
},
|
|
152
155
|
});
|
|
153
156
|
_NotificationServicesController_pushNotifications.set(this, {
|
|
154
|
-
subscribeToPushEnabled: async () => {
|
|
155
|
-
this.messagingSystem.subscribe('NotificationServicesPushController:stateChange',
|
|
156
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
157
|
-
async (newVal, prevVal) => {
|
|
158
|
-
try {
|
|
159
|
-
// Push notifications were enabled
|
|
160
|
-
if (prevVal === false && newVal) {
|
|
161
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications();
|
|
162
|
-
return;
|
|
163
|
-
}
|
|
164
|
-
// Push notifications were disabled
|
|
165
|
-
if (prevVal === true && !newVal) {
|
|
166
|
-
__classPrivateFieldSet(this, _NotificationServicesController_isPushNotificationsSetup, false, "f");
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
catch {
|
|
170
|
-
// Do nothing, silently fail push notifications
|
|
171
|
-
}
|
|
172
|
-
}, (state) => state.isPushEnabled);
|
|
173
|
-
},
|
|
174
157
|
subscribeToPushNotifications: async () => {
|
|
175
158
|
await this.messagingSystem.call('NotificationServicesPushController:subscribeToPushNotifications');
|
|
176
159
|
},
|
|
177
160
|
enablePushNotifications: async (UUIDs) => {
|
|
161
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
178
164
|
try {
|
|
179
165
|
await this.messagingSystem.call('NotificationServicesPushController:enablePushNotifications', UUIDs);
|
|
180
166
|
}
|
|
@@ -183,6 +169,9 @@ class NotificationServicesController extends BaseController {
|
|
|
183
169
|
}
|
|
184
170
|
},
|
|
185
171
|
disablePushNotifications: async (UUIDs) => {
|
|
172
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
186
175
|
try {
|
|
187
176
|
await this.messagingSystem.call('NotificationServicesPushController:disablePushNotifications', UUIDs);
|
|
188
177
|
}
|
|
@@ -191,6 +180,9 @@ class NotificationServicesController extends BaseController {
|
|
|
191
180
|
}
|
|
192
181
|
},
|
|
193
182
|
updatePushNotifications: async (UUIDs) => {
|
|
183
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
194
186
|
try {
|
|
195
187
|
await this.messagingSystem.call('NotificationServicesPushController:updateTriggerPushNotifications', UUIDs);
|
|
196
188
|
}
|
|
@@ -199,12 +191,18 @@ class NotificationServicesController extends BaseController {
|
|
|
199
191
|
}
|
|
200
192
|
},
|
|
201
193
|
subscribe: () => {
|
|
194
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
195
|
+
return;
|
|
196
|
+
}
|
|
202
197
|
this.messagingSystem.subscribe('NotificationServicesPushController:onNewNotifications', (notification) => {
|
|
203
198
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
204
199
|
this.updateMetamaskNotificationsList(notification);
|
|
205
200
|
});
|
|
206
201
|
},
|
|
207
202
|
initializePushNotifications: async () => {
|
|
203
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
208
206
|
if (!this.state.isNotificationServicesEnabled) {
|
|
209
207
|
return;
|
|
210
208
|
}
|
|
@@ -294,6 +292,16 @@ class NotificationServicesController extends BaseController {
|
|
|
294
292
|
},
|
|
295
293
|
});
|
|
296
294
|
_NotificationServicesController_featureAnnouncementEnv.set(this, void 0);
|
|
295
|
+
_NotificationServicesController_performEnableProfileSyncing.set(this, async () => {
|
|
296
|
+
try {
|
|
297
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").enableProfileSyncing();
|
|
298
|
+
}
|
|
299
|
+
catch (e) {
|
|
300
|
+
log.error('Failed to enable profile syncing', e);
|
|
301
|
+
throw new Error('Failed to enable profile syncing');
|
|
302
|
+
}
|
|
303
|
+
});
|
|
304
|
+
__classPrivateFieldSet(this, _NotificationServicesController_isPushIntegrated, env.isPushIntegrated ?? true, "f");
|
|
297
305
|
__classPrivateFieldSet(this, _NotificationServicesController_featureAnnouncementEnv, env.featureAnnouncements, "f");
|
|
298
306
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_registerMessageHandlers).call(this);
|
|
299
307
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearLoadingStates).call(this);
|
|
@@ -367,7 +375,7 @@ class NotificationServicesController extends BaseController {
|
|
|
367
375
|
async createOnChainTriggers(opts) {
|
|
368
376
|
try {
|
|
369
377
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
370
|
-
await __classPrivateFieldGet(this,
|
|
378
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_performEnableProfileSyncing, "f").call(this);
|
|
371
379
|
const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
|
|
372
380
|
const { accounts } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
373
381
|
// Attempt Get User Storage
|
|
@@ -440,28 +448,30 @@ class NotificationServicesController extends BaseController {
|
|
|
440
448
|
* @throws {Error} If the user is not authenticated or if there is an error during the process.
|
|
441
449
|
*/
|
|
442
450
|
async disableNotificationServices() {
|
|
443
|
-
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
444
|
-
// Attempt Disable Push Notifications
|
|
445
451
|
try {
|
|
452
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
453
|
+
// Disable Push Notifications
|
|
446
454
|
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
447
455
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
448
456
|
const UUIDs = Utils.getAllUUIDs(userStorage);
|
|
449
457
|
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications(UUIDs);
|
|
458
|
+
const snapNotifications = this.state.metamaskNotificationsList.filter((notification) => notification.type === TRIGGER_TYPES.SNAP);
|
|
459
|
+
// Clear Notification States (toggles and list)
|
|
460
|
+
this.update((state) => {
|
|
461
|
+
state.isNotificationServicesEnabled = false;
|
|
462
|
+
state.isFeatureAnnouncementsEnabled = false;
|
|
463
|
+
// reassigning the notifications list with just snaps
|
|
464
|
+
// since the disable shouldn't affect snaps notifications
|
|
465
|
+
state.metamaskNotificationsList = snapNotifications;
|
|
466
|
+
});
|
|
450
467
|
}
|
|
451
|
-
catch {
|
|
452
|
-
|
|
468
|
+
catch (e) {
|
|
469
|
+
log.error('Unable to disable notifications', e);
|
|
470
|
+
throw new Error('Unable to disable notifications');
|
|
471
|
+
}
|
|
472
|
+
finally {
|
|
473
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
453
474
|
}
|
|
454
|
-
// Update State: remove non-permitted notifications & disable flags
|
|
455
|
-
const snapNotifications = this.state.metamaskNotificationsList.filter((notification) => notification.type === TRIGGER_TYPES.SNAP);
|
|
456
|
-
this.update((state) => {
|
|
457
|
-
state.isNotificationServicesEnabled = false;
|
|
458
|
-
state.isFeatureAnnouncementsEnabled = false;
|
|
459
|
-
// reassigning the notifications list with just snaps
|
|
460
|
-
// since the disable shouldn't affect snaps notifications
|
|
461
|
-
state.metamaskNotificationsList = snapNotifications;
|
|
462
|
-
});
|
|
463
|
-
// Finish Updating State
|
|
464
|
-
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
465
475
|
}
|
|
466
476
|
/**
|
|
467
477
|
* Deletes on-chain triggers associated with a specific account.
|
|
@@ -579,7 +589,6 @@ class NotificationServicesController extends BaseController {
|
|
|
579
589
|
*
|
|
580
590
|
* @param previewToken - the preview token to use if needed
|
|
581
591
|
* @throws {Error} Throws an error if unauthenticated or from other operations.
|
|
582
|
-
* @returns updated notification list
|
|
583
592
|
*/
|
|
584
593
|
async fetchAndUpdateMetamaskNotifications(previewToken) {
|
|
585
594
|
try {
|
|
@@ -786,7 +795,7 @@ class NotificationServicesController extends BaseController {
|
|
|
786
795
|
}
|
|
787
796
|
}
|
|
788
797
|
}
|
|
789
|
-
_NotificationServicesController_isPushNotificationsSetup = new WeakMap(), _NotificationServicesController_isUnlocked = new WeakMap(), _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() {
|
|
798
|
+
_NotificationServicesController_isPushIntegrated = new WeakMap(), _NotificationServicesController_isPushNotificationsSetup = new WeakMap(), _NotificationServicesController_isUnlocked = new WeakMap(), _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_performEnableProfileSyncing = new WeakMap(), _NotificationServicesController_instances = new WeakSet(), _NotificationServicesController_registerMessageHandlers = function _NotificationServicesController_registerMessageHandlers() {
|
|
790
799
|
this.messagingSystem.registerActionHandler(`${controllerName}:updateMetamaskNotificationsList`, this.updateMetamaskNotificationsList.bind(this));
|
|
791
800
|
this.messagingSystem.registerActionHandler(`${controllerName}:disableNotificationServices`, this.disableNotificationServices.bind(this));
|
|
792
801
|
this.messagingSystem.registerActionHandler(`${controllerName}:selectIsNotificationServicesEnabled`, this.selectIsNotificationServicesEnabled.bind(this));
|
|
@@ -814,14 +823,6 @@ _NotificationServicesController_isPushNotificationsSetup = new WeakMap(), _Notif
|
|
|
814
823
|
throw new Error('Missing BearerToken or storage key');
|
|
815
824
|
}
|
|
816
825
|
return { bearerToken, storageKey };
|
|
817
|
-
}, _NotificationServicesController_performEnableProfileSyncing = async function _NotificationServicesController_performEnableProfileSyncing() {
|
|
818
|
-
try {
|
|
819
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").enableProfileSyncing();
|
|
820
|
-
}
|
|
821
|
-
catch (e) {
|
|
822
|
-
log.error('Failed to enable profile syncing', e);
|
|
823
|
-
throw new Error('Failed to enable profile syncing');
|
|
824
|
-
}
|
|
825
826
|
}, _NotificationServicesController_assertUserStorage = function _NotificationServicesController_assertUserStorage(storage) {
|
|
826
827
|
if (!storage) {
|
|
827
828
|
throw new Error('User Storage does not exist');
|
|
@@ -845,7 +846,7 @@ async function _NotificationServicesController_getUserStorage() {
|
|
|
845
846
|
const userStorage = JSON.parse(userStorageString);
|
|
846
847
|
return userStorage;
|
|
847
848
|
}
|
|
848
|
-
catch {
|
|
849
|
+
catch (error) {
|
|
849
850
|
log.error('Unable to parse User Storage');
|
|
850
851
|
return null;
|
|
851
852
|
}
|