@metamask-previews/notification-services-controller 0.17.0-preview-a7846907 → 0.18.0-preview-442894ce

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.
Files changed (88) hide show
  1. package/CHANGELOG.md +8 -1
  2. package/dist/NotificationServicesController/NotificationServicesController.cjs +48 -49
  3. package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
  4. package/dist/NotificationServicesController/NotificationServicesController.d.cts +3 -3
  5. package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
  6. package/dist/NotificationServicesController/NotificationServicesController.d.mts +3 -3
  7. package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
  8. package/dist/NotificationServicesController/NotificationServicesController.mjs +48 -49
  9. package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
  10. package/dist/NotificationServicesController/index.cjs +1 -0
  11. package/dist/NotificationServicesController/index.cjs.map +1 -1
  12. package/dist/NotificationServicesController/index.d.cts +1 -0
  13. package/dist/NotificationServicesController/index.d.cts.map +1 -1
  14. package/dist/NotificationServicesController/index.d.mts +1 -0
  15. package/dist/NotificationServicesController/index.d.mts.map +1 -1
  16. package/dist/NotificationServicesController/index.mjs +1 -0
  17. package/dist/NotificationServicesController/index.mjs.map +1 -1
  18. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +43 -40
  19. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
  20. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +19 -21
  21. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
  22. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +19 -21
  23. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
  24. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +44 -41
  25. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
  26. package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.cjs +14 -0
  27. package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.cjs.map +1 -0
  28. package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.cts +3 -0
  29. package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.cts.map +1 -0
  30. package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.mts +3 -0
  31. package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.d.mts.map +1 -0
  32. package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.mjs +10 -0
  33. package/dist/NotificationServicesPushController/__fixtures__/mockMessenger.mjs.map +1 -0
  34. package/dist/NotificationServicesPushController/services/services.cjs +3 -28
  35. package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
  36. package/dist/NotificationServicesPushController/services/services.d.cts +1 -15
  37. package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
  38. package/dist/NotificationServicesPushController/services/services.d.mts +1 -15
  39. package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
  40. package/dist/NotificationServicesPushController/services/services.mjs +2 -26
  41. package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
  42. package/dist/NotificationServicesPushController/types/index.cjs +0 -15
  43. package/dist/NotificationServicesPushController/types/index.cjs.map +1 -1
  44. package/dist/NotificationServicesPushController/types/index.d.cts +2 -1
  45. package/dist/NotificationServicesPushController/types/index.d.cts.map +1 -1
  46. package/dist/NotificationServicesPushController/types/index.d.mts +2 -1
  47. package/dist/NotificationServicesPushController/types/index.d.mts.map +1 -1
  48. package/dist/NotificationServicesPushController/types/index.mjs +1 -1
  49. package/dist/NotificationServicesPushController/types/index.mjs.map +1 -1
  50. package/dist/NotificationServicesPushController/{services/push/index.cjs → types/push-service-interface.cjs} +1 -1
  51. package/dist/NotificationServicesPushController/types/push-service-interface.cjs.map +1 -0
  52. package/dist/NotificationServicesPushController/types/push-service-interface.d.cts +30 -0
  53. package/dist/NotificationServicesPushController/types/push-service-interface.d.cts.map +1 -0
  54. package/dist/NotificationServicesPushController/types/push-service-interface.d.mts +30 -0
  55. package/dist/NotificationServicesPushController/types/push-service-interface.d.mts.map +1 -0
  56. package/dist/NotificationServicesPushController/types/push-service-interface.mjs +2 -0
  57. package/dist/NotificationServicesPushController/types/push-service-interface.mjs.map +1 -0
  58. package/dist/NotificationServicesPushController/web/index.cjs +8 -0
  59. package/dist/NotificationServicesPushController/web/index.cjs.map +1 -0
  60. package/dist/NotificationServicesPushController/web/index.d.cts +2 -0
  61. package/dist/NotificationServicesPushController/web/index.d.cts.map +1 -0
  62. package/dist/NotificationServicesPushController/web/index.d.mts +2 -0
  63. package/dist/NotificationServicesPushController/web/index.d.mts.map +1 -0
  64. package/dist/NotificationServicesPushController/web/index.mjs +2 -0
  65. package/dist/NotificationServicesPushController/web/index.mjs.map +1 -0
  66. package/dist/NotificationServicesPushController/{services/push/push-web.cjs → web/push-helpers.cjs} +37 -8
  67. package/dist/NotificationServicesPushController/web/push-helpers.cjs.map +1 -0
  68. package/dist/NotificationServicesPushController/web/push-helpers.d.cts +37 -0
  69. package/dist/NotificationServicesPushController/web/push-helpers.d.cts.map +1 -0
  70. package/dist/NotificationServicesPushController/web/push-helpers.d.mts +37 -0
  71. package/dist/NotificationServicesPushController/web/push-helpers.d.mts.map +1 -0
  72. package/dist/NotificationServicesPushController/{services/push/push-web.mjs → web/push-helpers.mjs} +37 -7
  73. package/dist/NotificationServicesPushController/web/push-helpers.mjs.map +1 -0
  74. package/package.json +14 -4
  75. package/push-services/web/package.json +9 -0
  76. package/dist/NotificationServicesPushController/services/push/index.cjs.map +0 -1
  77. package/dist/NotificationServicesPushController/services/push/index.d.cts +0 -6
  78. package/dist/NotificationServicesPushController/services/push/index.d.cts.map +0 -1
  79. package/dist/NotificationServicesPushController/services/push/index.d.mts +0 -6
  80. package/dist/NotificationServicesPushController/services/push/index.d.mts.map +0 -1
  81. package/dist/NotificationServicesPushController/services/push/index.mjs +0 -2
  82. package/dist/NotificationServicesPushController/services/push/index.mjs.map +0 -1
  83. package/dist/NotificationServicesPushController/services/push/push-web.cjs.map +0 -1
  84. package/dist/NotificationServicesPushController/services/push/push-web.d.cts +0 -33
  85. package/dist/NotificationServicesPushController/services/push/push-web.d.cts.map +0 -1
  86. package/dist/NotificationServicesPushController/services/push/push-web.d.mts +0 -33
  87. package/dist/NotificationServicesPushController/services/push/push-web.d.mts.map +0 -1
  88. package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +0 -1
@@ -5,6 +5,7 @@ import type { AuthenticationController, UserStorageController } from "@metamask/
5
5
  import { TRIGGER_TYPES } from "./constants/notification-schema.cjs";
6
6
  import type { INotification, MarkAsReadNotificationsParam } from "./types/notification/notification.cjs";
7
7
  import type { UserStorage } from "./types/user-storage/user-storage.cjs";
8
+ import type { NotificationServicesPushControllerStateChangeEvent } from "../NotificationServicesPushController/index.cjs";
8
9
  export type NotificationServicesPushControllerEnablePushNotifications = {
9
10
  type: `NotificationServicesPushController:enablePushNotifications`;
10
11
  handler: (UUIDs: string[]) => Promise<void>;
@@ -108,7 +109,7 @@ export type MarkNotificationsAsReadEvent = {
108
109
  payload: [INotification[]];
109
110
  };
110
111
  export type Events = NotificationServicesControllerStateChangeEvent | NotificationListUpdatedEvent | MarkNotificationsAsReadEvent;
111
- export type AllowedEvents = KeyringControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | NotificationServicesPushControllerOnNewNotification;
112
+ export type AllowedEvents = KeyringControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | NotificationServicesPushControllerOnNewNotification | NotificationServicesPushControllerStateChangeEvent;
112
113
  export type NotificationServicesControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
113
114
  type FeatureAnnouncementEnv = {
114
115
  spaceId: string;
@@ -128,14 +129,12 @@ export default class NotificationServicesController extends BaseController<typeo
128
129
  * @param args.state - Initial state to set on this controller.
129
130
  * @param args.env - environment variables for a given controller.
130
131
  * @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;
139
138
  };
140
139
  });
141
140
  /**
@@ -231,6 +230,7 @@ export default class NotificationServicesController extends BaseController<typeo
231
230
  *
232
231
  * @param previewToken - the preview token to use if needed
233
232
  * @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.cts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,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;IACv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I,mCAAmC,IAAI,OAAO;IAmFxC,qBAAqB,CAChC,QAAQ,EAAE,MAAM,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"}
1
+ {"version":3,"file":"NotificationServicesController.d.cts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,0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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"}
@@ -5,6 +5,7 @@ import type { AuthenticationController, UserStorageController } from "@metamask/
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";
8
9
  export type NotificationServicesPushControllerEnablePushNotifications = {
9
10
  type: `NotificationServicesPushController:enablePushNotifications`;
10
11
  handler: (UUIDs: string[]) => Promise<void>;
@@ -108,7 +109,7 @@ export type MarkNotificationsAsReadEvent = {
108
109
  payload: [INotification[]];
109
110
  };
110
111
  export type Events = NotificationServicesControllerStateChangeEvent | NotificationListUpdatedEvent | MarkNotificationsAsReadEvent;
111
- export type AllowedEvents = KeyringControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | NotificationServicesPushControllerOnNewNotification;
112
+ export type AllowedEvents = KeyringControllerStateChangeEvent | KeyringControllerLockEvent | KeyringControllerUnlockEvent | NotificationServicesPushControllerOnNewNotification | NotificationServicesPushControllerStateChangeEvent;
112
113
  export type NotificationServicesControllerMessenger = RestrictedControllerMessenger<typeof controllerName, Actions | AllowedActions, Events | AllowedEvents, AllowedActions['type'], AllowedEvents['type']>;
113
114
  type FeatureAnnouncementEnv = {
114
115
  spaceId: string;
@@ -128,14 +129,12 @@ export default class NotificationServicesController extends BaseController<typeo
128
129
  * @param args.state - Initial state to set on this controller.
129
130
  * @param args.env - environment variables for a given controller.
130
131
  * @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;
139
138
  };
140
139
  });
141
140
  /**
@@ -231,6 +230,7 @@ export default class NotificationServicesController extends BaseController<typeo
231
230
  *
232
231
  * @param previewToken - the preview token to use if needed
233
232
  * @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,6BAA6B,EAC7B,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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C;CA6BjB"}
1
+ {"version":3,"file":"NotificationServicesController.d.mts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,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;AAErE,OAAO,KAAK,EACV,kDAAkD,EAEnD,wDAA8C;AAI/C,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,GAAG;IACvE,IAAI,EAAE,iEAAiE,CAAC;IACxE,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,mDAAmD,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ACjB,OAAO,CAAC,WAAW,CAAC;IA0CvB;;;;;;;;;;;;;;OAcG;IACU,8BAA8B,CACzC,QAAQ,EAAE,MAAM,EAAE,GACjB,OAAO,CAAC,WAAW,CAAC;IA8DvB;;;;;;;;;OASG;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_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;
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;
13
13
  function $importDefault(module) {
14
14
  if (module?.__esModule) {
15
15
  return module.default;
@@ -98,7 +98,6 @@ 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.
102
101
  */
103
102
  constructor({ messenger, state, env, }) {
104
103
  super({
@@ -108,8 +107,6 @@ class NotificationServicesController extends BaseController {
108
107
  state: { ...defaultState, ...state },
109
108
  });
110
109
  _NotificationServicesController_instances.add(this);
111
- // Temporary boolean as push notifications are not yet enabled on mobile
112
- _NotificationServicesController_isPushIntegrated.set(this, true);
113
110
  // Flag to check is notifications have been setup when the browser/extension is initialized.
114
111
  // We want to re-initialize push notifications when the browser/extension is refreshed
115
112
  // To ensure we subscribe to the most up-to-date notifications
@@ -154,13 +151,30 @@ class NotificationServicesController extends BaseController {
154
151
  },
155
152
  });
156
153
  _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
+ },
157
174
  subscribeToPushNotifications: async () => {
158
175
  await this.messagingSystem.call('NotificationServicesPushController:subscribeToPushNotifications');
159
176
  },
160
177
  enablePushNotifications: async (UUIDs) => {
161
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
162
- return;
163
- }
164
178
  try {
165
179
  await this.messagingSystem.call('NotificationServicesPushController:enablePushNotifications', UUIDs);
166
180
  }
@@ -169,9 +183,6 @@ class NotificationServicesController extends BaseController {
169
183
  }
170
184
  },
171
185
  disablePushNotifications: async (UUIDs) => {
172
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
173
- return;
174
- }
175
186
  try {
176
187
  await this.messagingSystem.call('NotificationServicesPushController:disablePushNotifications', UUIDs);
177
188
  }
@@ -180,9 +191,6 @@ class NotificationServicesController extends BaseController {
180
191
  }
181
192
  },
182
193
  updatePushNotifications: async (UUIDs) => {
183
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
184
- return;
185
- }
186
194
  try {
187
195
  await this.messagingSystem.call('NotificationServicesPushController:updateTriggerPushNotifications', UUIDs);
188
196
  }
@@ -191,18 +199,12 @@ class NotificationServicesController extends BaseController {
191
199
  }
192
200
  },
193
201
  subscribe: () => {
194
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
195
- return;
196
- }
197
202
  this.messagingSystem.subscribe('NotificationServicesPushController:onNewNotifications', (notification) => {
198
203
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
199
204
  this.updateMetamaskNotificationsList(notification);
200
205
  });
201
206
  },
202
207
  initializePushNotifications: async () => {
203
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
204
- return;
205
- }
206
208
  if (!this.state.isNotificationServicesEnabled) {
207
209
  return;
208
210
  }
@@ -292,16 +294,6 @@ class NotificationServicesController extends BaseController {
292
294
  },
293
295
  });
294
296
  _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");
305
297
  __classPrivateFieldSet(this, _NotificationServicesController_featureAnnouncementEnv, env.featureAnnouncements, "f");
306
298
  __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_registerMessageHandlers).call(this);
307
299
  __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearLoadingStates).call(this);
@@ -375,7 +367,7 @@ class NotificationServicesController extends BaseController {
375
367
  async createOnChainTriggers(opts) {
376
368
  try {
377
369
  __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
378
- await __classPrivateFieldGet(this, _NotificationServicesController_performEnableProfileSyncing, "f").call(this);
370
+ await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_performEnableProfileSyncing).call(this);
379
371
  const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
380
372
  const { accounts } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
381
373
  // Attempt Get User Storage
@@ -448,30 +440,28 @@ class NotificationServicesController extends BaseController {
448
440
  * @throws {Error} If the user is not authenticated or if there is an error during the process.
449
441
  */
450
442
  async disableNotificationServices() {
443
+ __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
444
+ // Attempt Disable Push Notifications
451
445
  try {
452
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
453
- // Disable Push Notifications
454
446
  const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
455
447
  __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
456
448
  const UUIDs = Utils.getAllUUIDs(userStorage);
457
449
  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
- });
467
- }
468
- catch (e) {
469
- log.error('Unable to disable notifications', e);
470
- throw new Error('Unable to disable notifications');
471
450
  }
472
- finally {
473
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
451
+ catch {
452
+ // Do nothing
474
453
  }
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);
475
465
  }
476
466
  /**
477
467
  * Deletes on-chain triggers associated with a specific account.
@@ -589,6 +579,7 @@ class NotificationServicesController extends BaseController {
589
579
  *
590
580
  * @param previewToken - the preview token to use if needed
591
581
  * @throws {Error} Throws an error if unauthenticated or from other operations.
582
+ * @returns updated notification list
592
583
  */
593
584
  async fetchAndUpdateMetamaskNotifications(previewToken) {
594
585
  try {
@@ -795,7 +786,7 @@ class NotificationServicesController extends BaseController {
795
786
  }
796
787
  }
797
788
  }
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() {
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() {
799
790
  this.messagingSystem.registerActionHandler(`${controllerName}:updateMetamaskNotificationsList`, this.updateMetamaskNotificationsList.bind(this));
800
791
  this.messagingSystem.registerActionHandler(`${controllerName}:disableNotificationServices`, this.disableNotificationServices.bind(this));
801
792
  this.messagingSystem.registerActionHandler(`${controllerName}:selectIsNotificationServicesEnabled`, this.selectIsNotificationServicesEnabled.bind(this));
@@ -823,6 +814,14 @@ _NotificationServicesController_isPushIntegrated = new WeakMap(), _NotificationS
823
814
  throw new Error('Missing BearerToken or storage key');
824
815
  }
825
816
  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
+ }
826
825
  }, _NotificationServicesController_assertUserStorage = function _NotificationServicesController_assertUserStorage(storage) {
827
826
  if (!storage) {
828
827
  throw new Error('User Storage does not exist');
@@ -846,7 +845,7 @@ async function _NotificationServicesController_getUserStorage() {
846
845
  const userStorage = JSON.parse(userStorageString);
847
846
  return userStorage;
848
847
  }
849
- catch (error) {
848
+ catch {
850
849
  log.error('Unable to parse User Storage');
851
850
  return null;
852
851
  }