@metamask-previews/notification-services-controller 0.17.0-preview-111ffee8 → 0.18.0-preview-c96fc296

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 +54 -41
  3. package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
  4. package/dist/NotificationServicesController/NotificationServicesController.d.cts +4 -4
  5. package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
  6. package/dist/NotificationServicesController/NotificationServicesController.d.mts +4 -4
  7. package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
  8. package/dist/NotificationServicesController/NotificationServicesController.mjs +54 -41
  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 +37 -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 +38 -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 +15 -5
  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 { NotificationServicesPushControllerGetStateAction, NotificationServicesPushControllerStateChangeEvent } from "../NotificationServicesPushController/index.cjs";
8
9
  export type NotificationServicesPushControllerEnablePushNotifications = {
9
10
  type: `NotificationServicesPushController:enablePushNotifications`;
10
11
  handler: (UUIDs: string[]) => Promise<void>;
@@ -97,7 +98,7 @@ export type NotificationServicesControllerDeleteNotificationsById = {
97
98
  handler: NotificationServicesController['deleteNotificationsById'];
98
99
  };
99
100
  export type Actions = NotificationServicesControllerGetStateAction | NotificationServicesControllerUpdateMetamaskNotificationsList | NotificationServicesControllerDisableNotificationServices | NotificationServicesControllerSelectIsNotificationServicesEnabled | NotificationServicesControllerGetNotificationsByType | NotificationServicesControllerDeleteNotificationsById;
100
- export type AllowedActions = KeyringControllerGetAccountsAction | KeyringControllerGetStateAction | AuthenticationController.AuthenticationControllerGetBearerToken | AuthenticationController.AuthenticationControllerIsSignedIn | UserStorageController.UserStorageControllerEnableProfileSyncing | UserStorageController.UserStorageControllerGetStorageKey | UserStorageController.UserStorageControllerPerformGetStorage | UserStorageController.UserStorageControllerPerformSetStorage | NotificationServicesPushControllerEnablePushNotifications | NotificationServicesPushControllerDisablePushNotifications | NotificationServicesPushControllerUpdateTriggerPushNotifications | NotificationServicesPushControllerSubscribeToNotifications;
101
+ export type AllowedActions = KeyringControllerGetAccountsAction | KeyringControllerGetStateAction | AuthenticationController.AuthenticationControllerGetBearerToken | AuthenticationController.AuthenticationControllerIsSignedIn | UserStorageController.UserStorageControllerEnableProfileSyncing | UserStorageController.UserStorageControllerGetStorageKey | UserStorageController.UserStorageControllerPerformGetStorage | UserStorageController.UserStorageControllerPerformSetStorage | NotificationServicesPushControllerGetStateAction | NotificationServicesPushControllerEnablePushNotifications | NotificationServicesPushControllerDisablePushNotifications | NotificationServicesPushControllerUpdateTriggerPushNotifications | NotificationServicesPushControllerSubscribeToNotifications;
101
102
  export type NotificationServicesControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, NotificationServicesControllerState>;
102
103
  export type NotificationListUpdatedEvent = {
103
104
  type: `${typeof controllerName}:notificationsListUpdated`;
@@ -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;IACvE,IAAI,EAAE,6DAA6D,CAAC;IACpE,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,OAAO,CAAC,IA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AC,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,0BAA0B,EAE3B,kCAAkC;AACnC,OAAO,EAAE,cAAc,EAAE,kCAAkC;AAE3D,OAAO,KAAK,EACV,kCAAkC,EACl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,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 { NotificationServicesPushControllerGetStateAction, NotificationServicesPushControllerStateChangeEvent } from "../NotificationServicesPushController/index.mjs";
8
9
  export type NotificationServicesPushControllerEnablePushNotifications = {
9
10
  type: `NotificationServicesPushController:enablePushNotifications`;
10
11
  handler: (UUIDs: string[]) => Promise<void>;
@@ -97,7 +98,7 @@ export type NotificationServicesControllerDeleteNotificationsById = {
97
98
  handler: NotificationServicesController['deleteNotificationsById'];
98
99
  };
99
100
  export type Actions = NotificationServicesControllerGetStateAction | NotificationServicesControllerUpdateMetamaskNotificationsList | NotificationServicesControllerDisableNotificationServices | NotificationServicesControllerSelectIsNotificationServicesEnabled | NotificationServicesControllerGetNotificationsByType | NotificationServicesControllerDeleteNotificationsById;
100
- export type AllowedActions = KeyringControllerGetAccountsAction | KeyringControllerGetStateAction | AuthenticationController.AuthenticationControllerGetBearerToken | AuthenticationController.AuthenticationControllerIsSignedIn | UserStorageController.UserStorageControllerEnableProfileSyncing | UserStorageController.UserStorageControllerGetStorageKey | UserStorageController.UserStorageControllerPerformGetStorage | UserStorageController.UserStorageControllerPerformSetStorage | NotificationServicesPushControllerEnablePushNotifications | NotificationServicesPushControllerDisablePushNotifications | NotificationServicesPushControllerUpdateTriggerPushNotifications | NotificationServicesPushControllerSubscribeToNotifications;
101
+ export type AllowedActions = KeyringControllerGetAccountsAction | KeyringControllerGetStateAction | AuthenticationController.AuthenticationControllerGetBearerToken | AuthenticationController.AuthenticationControllerIsSignedIn | UserStorageController.UserStorageControllerEnableProfileSyncing | UserStorageController.UserStorageControllerGetStorageKey | UserStorageController.UserStorageControllerPerformGetStorage | UserStorageController.UserStorageControllerPerformSetStorage | NotificationServicesPushControllerGetStateAction | NotificationServicesPushControllerEnablePushNotifications | NotificationServicesPushControllerDisablePushNotifications | NotificationServicesPushControllerUpdateTriggerPushNotifications | NotificationServicesPushControllerSubscribeToNotifications;
101
102
  export type NotificationServicesControllerStateChangeEvent = ControllerStateChangeEvent<typeof controllerName, NotificationServicesControllerState>;
102
103
  export type NotificationListUpdatedEvent = {
103
104
  type: `${typeof controllerName}:notificationsListUpdated`;
@@ -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,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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mC,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.mts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6BAA6B,EAC7B,wBAAwB,EACxB,0BAA0B,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B;;;;;;;;;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,11 +151,33 @@ class NotificationServicesController extends BaseController {
154
151
  },
155
152
  });
156
153
  _NotificationServicesController_pushNotifications.set(this, {
154
+ isEnabled: () => this.messagingSystem.call('NotificationServicesPushController:getState')
155
+ ?.isPushEnabled ?? false,
156
+ subscribeToPushEnabled: async () => {
157
+ this.messagingSystem.subscribe('NotificationServicesPushController:stateChange',
158
+ // eslint-disable-next-line @typescript-eslint/no-misused-promises
159
+ async (newVal, prevVal) => {
160
+ try {
161
+ // Push notifications were enabled
162
+ if (prevVal === false && newVal) {
163
+ await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications();
164
+ return;
165
+ }
166
+ // Push notifications were disabled
167
+ if (prevVal === true && !newVal) {
168
+ __classPrivateFieldSet(this, _NotificationServicesController_isPushNotificationsSetup, false, "f");
169
+ }
170
+ }
171
+ catch {
172
+ // Do nothing, silently fail push notifications
173
+ }
174
+ }, (state) => state.isPushEnabled);
175
+ },
157
176
  subscribeToPushNotifications: async () => {
158
177
  await this.messagingSystem.call('NotificationServicesPushController:subscribeToPushNotifications');
159
178
  },
160
179
  enablePushNotifications: async (UUIDs) => {
161
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
180
+ if (!__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isEnabled()) {
162
181
  return;
163
182
  }
164
183
  try {
@@ -169,7 +188,7 @@ class NotificationServicesController extends BaseController {
169
188
  }
170
189
  },
171
190
  disablePushNotifications: async (UUIDs) => {
172
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
191
+ if (!__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isEnabled()) {
173
192
  return;
174
193
  }
175
194
  try {
@@ -180,7 +199,7 @@ class NotificationServicesController extends BaseController {
180
199
  }
181
200
  },
182
201
  updatePushNotifications: async (UUIDs) => {
183
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
202
+ if (!__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isEnabled()) {
184
203
  return;
185
204
  }
186
205
  try {
@@ -191,7 +210,7 @@ class NotificationServicesController extends BaseController {
191
210
  }
192
211
  },
193
212
  subscribe: () => {
194
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
213
+ if (!__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isEnabled()) {
195
214
  return;
196
215
  }
197
216
  this.messagingSystem.subscribe('NotificationServicesPushController:onNewNotifications', (notification) => {
@@ -200,9 +219,6 @@ class NotificationServicesController extends BaseController {
200
219
  });
201
220
  },
202
221
  initializePushNotifications: async () => {
203
- if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
204
- return;
205
- }
206
222
  if (!this.state.isNotificationServicesEnabled) {
207
223
  return;
208
224
  }
@@ -292,16 +308,6 @@ class NotificationServicesController extends BaseController {
292
308
  },
293
309
  });
294
310
  _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
311
  __classPrivateFieldSet(this, _NotificationServicesController_featureAnnouncementEnv, env.featureAnnouncements, "f");
306
312
  __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_registerMessageHandlers).call(this);
307
313
  __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearLoadingStates).call(this);
@@ -375,7 +381,7 @@ class NotificationServicesController extends BaseController {
375
381
  async createOnChainTriggers(opts) {
376
382
  try {
377
383
  __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
378
- await __classPrivateFieldGet(this, _NotificationServicesController_performEnableProfileSyncing, "f").call(this);
384
+ await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_performEnableProfileSyncing).call(this);
379
385
  const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
380
386
  const { accounts } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
381
387
  // Attempt Get User Storage
@@ -448,30 +454,28 @@ class NotificationServicesController extends BaseController {
448
454
  * @throws {Error} If the user is not authenticated or if there is an error during the process.
449
455
  */
450
456
  async disableNotificationServices() {
457
+ __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
458
+ // Attempt Disable Push Notifications
451
459
  try {
452
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
453
- // Disable Push Notifications
454
460
  const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
455
461
  __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
456
462
  const UUIDs = Utils.getAllUUIDs(userStorage);
457
463
  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
464
  }
472
- finally {
473
- __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
465
+ catch {
466
+ // Do nothing
474
467
  }
468
+ // Update State: remove non-permitted notifications & disable flags
469
+ const snapNotifications = this.state.metamaskNotificationsList.filter((notification) => notification.type === TRIGGER_TYPES.SNAP);
470
+ this.update((state) => {
471
+ state.isNotificationServicesEnabled = false;
472
+ state.isFeatureAnnouncementsEnabled = false;
473
+ // reassigning the notifications list with just snaps
474
+ // since the disable shouldn't affect snaps notifications
475
+ state.metamaskNotificationsList = snapNotifications;
476
+ });
477
+ // Finish Updating State
478
+ __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
475
479
  }
476
480
  /**
477
481
  * Deletes on-chain triggers associated with a specific account.
@@ -589,6 +593,7 @@ class NotificationServicesController extends BaseController {
589
593
  *
590
594
  * @param previewToken - the preview token to use if needed
591
595
  * @throws {Error} Throws an error if unauthenticated or from other operations.
596
+ * @returns updated notification list
592
597
  */
593
598
  async fetchAndUpdateMetamaskNotifications(previewToken) {
594
599
  try {
@@ -795,7 +800,7 @@ class NotificationServicesController extends BaseController {
795
800
  }
796
801
  }
797
802
  }
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() {
803
+ _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
804
  this.messagingSystem.registerActionHandler(`${controllerName}:updateMetamaskNotificationsList`, this.updateMetamaskNotificationsList.bind(this));
800
805
  this.messagingSystem.registerActionHandler(`${controllerName}:disableNotificationServices`, this.disableNotificationServices.bind(this));
801
806
  this.messagingSystem.registerActionHandler(`${controllerName}:selectIsNotificationServicesEnabled`, this.selectIsNotificationServicesEnabled.bind(this));
@@ -823,6 +828,14 @@ _NotificationServicesController_isPushIntegrated = new WeakMap(), _NotificationS
823
828
  throw new Error('Missing BearerToken or storage key');
824
829
  }
825
830
  return { bearerToken, storageKey };
831
+ }, _NotificationServicesController_performEnableProfileSyncing = async function _NotificationServicesController_performEnableProfileSyncing() {
832
+ try {
833
+ await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").enableProfileSyncing();
834
+ }
835
+ catch (e) {
836
+ log.error('Failed to enable profile syncing', e);
837
+ throw new Error('Failed to enable profile syncing');
838
+ }
826
839
  }, _NotificationServicesController_assertUserStorage = function _NotificationServicesController_assertUserStorage(storage) {
827
840
  if (!storage) {
828
841
  throw new Error('User Storage does not exist');
@@ -846,7 +859,7 @@ async function _NotificationServicesController_getUserStorage() {
846
859
  const userStorage = JSON.parse(userStorageString);
847
860
  return userStorage;
848
861
  }
849
- catch (error) {
862
+ catch {
850
863
  log.error('Unable to parse User Storage');
851
864
  return null;
852
865
  }