@metamask/notification-services-controller 22.0.0 → 23.0.0

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 (78) hide show
  1. package/CHANGELOG.md +43 -1
  2. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.cjs +7 -0
  3. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.cjs.map +1 -0
  4. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.cts +198 -0
  5. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.cts.map +1 -0
  6. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.mts +198 -0
  7. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.mts.map +1 -0
  8. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.mjs +6 -0
  9. package/dist/NotificationServicesController/NotificationServicesController-method-action-types.mjs.map +1 -0
  10. package/dist/NotificationServicesController/NotificationServicesController.cjs +55 -19
  11. package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
  12. package/dist/NotificationServicesController/NotificationServicesController.d.cts +7 -20
  13. package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
  14. package/dist/NotificationServicesController/NotificationServicesController.d.mts +7 -20
  15. package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
  16. package/dist/NotificationServicesController/NotificationServicesController.mjs +55 -19
  17. package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
  18. package/dist/NotificationServicesController/index.cjs +3 -7
  19. package/dist/NotificationServicesController/index.cjs.map +1 -1
  20. package/dist/NotificationServicesController/index.d.cts +3 -3
  21. package/dist/NotificationServicesController/index.d.cts.map +1 -1
  22. package/dist/NotificationServicesController/index.d.mts +3 -3
  23. package/dist/NotificationServicesController/index.d.mts.map +1 -1
  24. package/dist/NotificationServicesController/index.mjs +2 -3
  25. package/dist/NotificationServicesController/index.mjs.map +1 -1
  26. package/dist/NotificationServicesController/mocks/mock-feature-announcements.cjs +2 -2
  27. package/dist/NotificationServicesController/mocks/mock-feature-announcements.cjs.map +1 -1
  28. package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.cts.map +1 -1
  29. package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.mts.map +1 -1
  30. package/dist/NotificationServicesController/mocks/mock-feature-announcements.mjs +2 -2
  31. package/dist/NotificationServicesController/mocks/mock-feature-announcements.mjs.map +1 -1
  32. package/dist/NotificationServicesController/services/feature-announcements.cjs +10 -1
  33. package/dist/NotificationServicesController/services/feature-announcements.cjs.map +1 -1
  34. package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +1 -1
  35. package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +1 -1
  36. package/dist/NotificationServicesController/services/feature-announcements.mjs +10 -1
  37. package/dist/NotificationServicesController/services/feature-announcements.mjs.map +1 -1
  38. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.cjs +7 -0
  39. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.cjs.map +1 -0
  40. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.cts +60 -0
  41. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.cts.map +1 -0
  42. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.mts +60 -0
  43. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.mts.map +1 -0
  44. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.mjs +6 -0
  45. package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.mjs.map +1 -0
  46. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +40 -10
  47. package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
  48. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +13 -19
  49. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
  50. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +13 -19
  51. package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
  52. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +40 -11
  53. package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
  54. package/dist/NotificationServicesPushController/index.cjs +3 -7
  55. package/dist/NotificationServicesPushController/index.cjs.map +1 -1
  56. package/dist/NotificationServicesPushController/index.d.cts +3 -3
  57. package/dist/NotificationServicesPushController/index.d.cts.map +1 -1
  58. package/dist/NotificationServicesPushController/index.d.mts +3 -3
  59. package/dist/NotificationServicesPushController/index.d.mts.map +1 -1
  60. package/dist/NotificationServicesPushController/index.mjs +2 -3
  61. package/dist/NotificationServicesPushController/index.mjs.map +1 -1
  62. package/dist/NotificationServicesPushController/mocks/mockResponse.cjs +9 -1
  63. package/dist/NotificationServicesPushController/mocks/mockResponse.cjs.map +1 -1
  64. package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts +2 -1
  65. package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +1 -1
  66. package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts +2 -1
  67. package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +1 -1
  68. package/dist/NotificationServicesPushController/mocks/mockResponse.mjs +7 -0
  69. package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +1 -1
  70. package/dist/NotificationServicesPushController/services/services.cjs +31 -1
  71. package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
  72. package/dist/NotificationServicesPushController/services/services.d.cts +22 -0
  73. package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
  74. package/dist/NotificationServicesPushController/services/services.d.mts +22 -0
  75. package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
  76. package/dist/NotificationServicesPushController/services/services.mjs +29 -0
  77. package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
  78. package/package.json +14 -9
package/CHANGELOG.md CHANGED
@@ -7,6 +7,45 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [23.0.0]
11
+
12
+ ### Added
13
+
14
+ - Expose missing public `NotificationServicesController` methods through its messenger ([#8176](https://github.com/MetaMask/core/pull/8176))
15
+ - The following actions are now available:
16
+ - `NotificationServicesController:init`
17
+ - `NotificationServicesController:enablePushNotification`
18
+ - `NotificationServicesController:disablePushNotification`
19
+ - `NotificationServicesController:checkAccountsPresence`
20
+ - `NotificationServicesController:setFeatureAnnouncementsEnabled`
21
+ - `NotificationServicesController:createOnChainTriggers`
22
+ - `NotificationServicesController:enableMetamaskNotifications`
23
+ - `NotificationServicesController:disableAccounts`
24
+ - `NotificationServicesController:enableAccounts`
25
+ - `NotificationServicesController:fetchAndUpdateMetamaskNotifications`
26
+ - `NotificationServicesController:deleteNotificationById`
27
+ - `NotificationServicesController:markMetamaskNotificationsAsRead`
28
+ - `NotificationServicesController:sendPerpPlaceOrderNotification`
29
+ - Corresponding action types (e.g. `NotificationServicesControllerEnablePushNotificationAction`) are available as well.
30
+
31
+ ### Changed
32
+
33
+ - **BREAKING:** Standardize names of `NotificationServicesController` and `NotificationServicesPushController` messenger action types ([#8176](https://github.com/MetaMask/core/pull/8176))
34
+ - All existing types for messenger actions have been renamed so they end in `Action` (e.g. `NotificationServicesControllerUpdateMetamaskNotificationsList` -> `NotificationServicesControllerUpdateMetamaskNotificationsListAction`). You will need to update imports appropriately.
35
+ - The `NotificationServicesPushController` action `NotificationServicesPushControllerSubscribeToNotificationsAction` has been renamed to `NotificationServicesPushControllerSubscribeToPushNotificationsAction` so it matches the method name.
36
+ - These changes only affect the types. The action type strings themselves have not changed, so you do not need to update the list of actions you pass when initializing `NotificationServicesController` and `NotificationServicesPushController` messengers.
37
+ - Register notification accounts from all keyrings instead of only the first HD keyring, so notification setup now includes addresses from HD, hardware, imported, and snap keyrings ([#8108](https://github.com/MetaMask/core/pull/8108))
38
+ - Add push token unlink support for account removal by deleting `/api/v2/token` links for `{ address, platform }` pairs when notification accounts are disabled (for example during SRP removal) ([#8108](https://github.com/MetaMask/core/pull/8108))
39
+
40
+ ## [22.1.0]
41
+
42
+ ### Changed
43
+
44
+ - Debounce `KeyringController:stateChange` handler to reduce redundant notification subscription calls during rapid account syncing ([#7980](https://github.com/MetaMask/core/pull/7980))
45
+ - Filter out Product Account announcements notifications older than 3 months ([#7884](https://github.com/MetaMask/core/pull/7884))
46
+ - Bump `@metamask/controller-utils` from `^11.18.0` to `^11.19.0` ([#7995](https://github.com/MetaMask/core/pull/7995))
47
+ - Bump `@metamask/profile-sync-controller` from `^27.1.0` to `^28.0.0` ([#8162](https://github.com/MetaMask/core/pull/8162))
48
+
10
49
  ## [22.0.0]
11
50
 
12
51
  ### Changed
@@ -21,6 +60,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
21
60
  - Note, however, that the versions specified in the client's `package.json` always "win", and you are expected to keep them up to date so as not to break controller and service intercommunication.
22
61
  - Modified background push utilities to handle more edgecases and not throw errors ([#7275](https://github.com/MetaMask/core/pull/7275))
23
62
  - Bump `@metamask/controller-utils` from `^11.16.0` to `^11.18.0` ([#7534](https://github.com/MetaMask/core/pull/7534), [#7583](https://github.com/MetaMask/core/pull/7583))
63
+ - Filter feature announcements older than 3 months ([#7884](https://github.com/MetaMask/core/pull/7884))
24
64
  - Move notifications networks metadata to backend ([#7840](https://github.com/MetaMask/core/pull/7840))
25
65
 
26
66
  ### Removed
@@ -657,7 +697,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
657
697
 
658
698
  - Initial release
659
699
 
660
- [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@22.0.0...HEAD
700
+ [Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@23.0.0...HEAD
701
+ [23.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@22.1.0...@metamask/notification-services-controller@23.0.0
702
+ [22.1.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@22.0.0...@metamask/notification-services-controller@22.1.0
661
703
  [22.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@21.0.0...@metamask/notification-services-controller@22.0.0
662
704
  [21.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@20.0.0...@metamask/notification-services-controller@21.0.0
663
705
  [20.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@19.0.0...@metamask/notification-services-controller@20.0.0
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
4
+ * Do not edit manually.
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ //# sourceMappingURL=NotificationServicesController-method-action-types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationServicesController-method-action-types.cjs","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController-method-action-types.ts"],"names":[],"mappings":";AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { NotificationServicesController } from './NotificationServicesController';\n\nexport type NotificationServicesControllerInitAction = {\n type: `NotificationServicesController:init`;\n handler: NotificationServicesController['init'];\n};\n\n/**\n * Public method to expose enabling push notifications\n */\nexport type NotificationServicesControllerEnablePushNotificationsAction = {\n type: `NotificationServicesController:enablePushNotifications`;\n handler: NotificationServicesController['enablePushNotifications'];\n};\n\n/**\n * Public method to expose disabling push notifications\n */\nexport type NotificationServicesControllerDisablePushNotificationsAction = {\n type: `NotificationServicesController:disablePushNotifications`;\n handler: NotificationServicesController['disablePushNotifications'];\n};\n\nexport type NotificationServicesControllerCheckAccountsPresenceAction = {\n type: `NotificationServicesController:checkAccountsPresence`;\n handler: NotificationServicesController['checkAccountsPresence'];\n};\n\n/**\n * Sets the enabled state of feature announcements.\n *\n * **Action** - used in the notification settings to enable/disable feature announcements.\n *\n * @param featureAnnouncementsEnabled - A boolean value indicating the desired enabled state of the feature announcements.\n * @async\n * @throws {Error} If fails to update\n */\nexport type NotificationServicesControllerSetFeatureAnnouncementsEnabledAction =\n {\n type: `NotificationServicesController:setFeatureAnnouncementsEnabled`;\n handler: NotificationServicesController['setFeatureAnnouncementsEnabled'];\n };\n\n/**\n * This creates/re-creates on-chain triggers defined in User Storage.\n *\n * **Action** - Used during Sign In / Enabling of notifications.\n *\n * @param opts - optional options to mutate this functionality\n * @param opts.resetNotifications - this will not use the users stored preferences, and instead re-create notification triggers\n * It will help in case uses get into a corrupted state or wants to wipe their notifications.\n * @returns The updated or newly created user storage.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\nexport type NotificationServicesControllerCreateOnChainTriggersAction = {\n type: `NotificationServicesController:createOnChainTriggers`;\n handler: NotificationServicesController['createOnChainTriggers'];\n};\n\n/**\n * Enables all MetaMask notifications for the user.\n * This is identical flow when initializing notifications for the first time.\n *\n * @throws {Error} If there is an error during the process of enabling notifications.\n */\nexport type NotificationServicesControllerEnableMetamaskNotificationsAction = {\n type: `NotificationServicesController:enableMetamaskNotifications`;\n handler: NotificationServicesController['enableMetamaskNotifications'];\n};\n\n/**\n * Disables all MetaMask notifications for the user.\n * This method ensures that the user is authenticated, retrieves all linked accounts,\n * and disables on-chain triggers for each account. It also sets the global notification\n * settings for MetaMask, feature announcements to false.\n *\n * @throws {Error} If the user is not authenticated or if there is an error during the process.\n */\nexport type NotificationServicesControllerDisableNotificationServicesAction = {\n type: `NotificationServicesController:disableNotificationServices`;\n handler: NotificationServicesController['disableNotificationServices'];\n};\n\n/**\n * Deletes on-chain triggers associated with a specific account/s.\n * This method performs several key operations:\n * 1. Validates Auth\n * 2. Deletes accounts\n * (note) We do not need to look through push notifications as we've deleted triggers\n *\n * **Action** - When a user disables notifications for a given account in settings.\n *\n * @param accounts - The account for which on-chain triggers are to be deleted.\n * @returns A promise that resolves to void or an object containing a success message.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\nexport type NotificationServicesControllerDisableAccountsAction = {\n type: `NotificationServicesController:disableAccounts`;\n handler: NotificationServicesController['disableAccounts'];\n};\n\n/**\n * Updates/Creates on-chain triggers for a specific account.\n *\n * This method performs several key operations:\n * 1. Validates Auth & Storage\n * 2. Finds and creates any missing triggers associated with the account\n * 3. Enables any related push notifications\n * 4. Updates Storage to reflect new state.\n *\n * **Action** - When a user enables notifications for an account\n *\n * @param accounts - List of accounts you want to update.\n * @returns A promise that resolves to the updated user storage.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\nexport type NotificationServicesControllerEnableAccountsAction = {\n type: `NotificationServicesController:enableAccounts`;\n handler: NotificationServicesController['enableAccounts'];\n};\n\n/**\n * Fetches the list of metamask notifications.\n * This includes OnChain notifications; Feature Announcements; and Snap Notifications.\n *\n * **Action** - When a user views the notification list page/dropdown\n *\n * @param previewToken - the preview token to use if needed\n * @returns A promise that resolves to the list of notifications.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\nexport type NotificationServicesControllerFetchAndUpdateMetamaskNotificationsAction =\n {\n type: `NotificationServicesController:fetchAndUpdateMetamaskNotifications`;\n handler: NotificationServicesController['fetchAndUpdateMetamaskNotifications'];\n };\n\n/**\n * Gets the specified type of notifications from state.\n *\n * @param type - The trigger type.\n * @returns An array of notifications of the passed in type.\n * @throws Throws an error if an invalid trigger type is passed.\n */\nexport type NotificationServicesControllerGetNotificationsByTypeAction = {\n type: `NotificationServicesController:getNotificationsByType`;\n handler: NotificationServicesController['getNotificationsByType'];\n};\n\n/**\n * Used to delete a notification by id.\n *\n * Note: This function should only be used for notifications that are stored\n * in this controller directly, currently only snaps notifications.\n *\n * @param id - The id of the notification to delete.\n */\nexport type NotificationServicesControllerDeleteNotificationByIdAction = {\n type: `NotificationServicesController:deleteNotificationById`;\n handler: NotificationServicesController['deleteNotificationById'];\n};\n\n/**\n * Used to batch delete notifications by id.\n *\n * Note: This function should only be used for notifications that are stored\n * in this controller directly, currently only snaps notifications.\n *\n * @param ids - The ids of the notifications to delete.\n */\nexport type NotificationServicesControllerDeleteNotificationsByIdAction = {\n type: `NotificationServicesController:deleteNotificationsById`;\n handler: NotificationServicesController['deleteNotificationsById'];\n};\n\n/**\n * Marks specified metamask notifications as read.\n *\n * @param notifications - An array of notifications to be marked as read. Each notification should include its type and read status.\n * @returns A promise that resolves when the operation is complete.\n */\nexport type NotificationServicesControllerMarkMetamaskNotificationsAsReadAction =\n {\n type: `NotificationServicesController:markMetamaskNotificationsAsRead`;\n handler: NotificationServicesController['markMetamaskNotificationsAsRead'];\n };\n\n/**\n * Updates the list of MetaMask notifications by adding a new notification at the beginning of the list.\n * This method ensures that the most recent notification is displayed first in the UI.\n *\n * @param notification - The new notification object to be added to the list.\n * @returns A promise that resolves when the notification list has been successfully updated.\n */\nexport type NotificationServicesControllerUpdateMetamaskNotificationsListAction =\n {\n type: `NotificationServicesController:updateMetamaskNotificationsList`;\n handler: NotificationServicesController['updateMetamaskNotificationsList'];\n };\n\n/**\n * Creates an perp order notification subscription.\n * Requires notifications and auth to be enabled to start receiving this notifications\n *\n * @param input perp input\n */\nexport type NotificationServicesControllerSendPerpPlaceOrderNotificationAction =\n {\n type: `NotificationServicesController:sendPerpPlaceOrderNotification`;\n handler: NotificationServicesController['sendPerpPlaceOrderNotification'];\n };\n\n/**\n * Union of all NotificationServicesController action types.\n */\nexport type NotificationServicesControllerMethodActions =\n | NotificationServicesControllerInitAction\n | NotificationServicesControllerEnablePushNotificationsAction\n | NotificationServicesControllerDisablePushNotificationsAction\n | NotificationServicesControllerCheckAccountsPresenceAction\n | NotificationServicesControllerSetFeatureAnnouncementsEnabledAction\n | NotificationServicesControllerCreateOnChainTriggersAction\n | NotificationServicesControllerEnableMetamaskNotificationsAction\n | NotificationServicesControllerDisableNotificationServicesAction\n | NotificationServicesControllerDisableAccountsAction\n | NotificationServicesControllerEnableAccountsAction\n | NotificationServicesControllerFetchAndUpdateMetamaskNotificationsAction\n | NotificationServicesControllerGetNotificationsByTypeAction\n | NotificationServicesControllerDeleteNotificationByIdAction\n | NotificationServicesControllerDeleteNotificationsByIdAction\n | NotificationServicesControllerMarkMetamaskNotificationsAsReadAction\n | NotificationServicesControllerUpdateMetamaskNotificationsListAction\n | NotificationServicesControllerSendPerpPlaceOrderNotificationAction;\n"]}
@@ -0,0 +1,198 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ import type { NotificationServicesController } from "./NotificationServicesController.cjs";
6
+ export type NotificationServicesControllerInitAction = {
7
+ type: `NotificationServicesController:init`;
8
+ handler: NotificationServicesController['init'];
9
+ };
10
+ /**
11
+ * Public method to expose enabling push notifications
12
+ */
13
+ export type NotificationServicesControllerEnablePushNotificationsAction = {
14
+ type: `NotificationServicesController:enablePushNotifications`;
15
+ handler: NotificationServicesController['enablePushNotifications'];
16
+ };
17
+ /**
18
+ * Public method to expose disabling push notifications
19
+ */
20
+ export type NotificationServicesControllerDisablePushNotificationsAction = {
21
+ type: `NotificationServicesController:disablePushNotifications`;
22
+ handler: NotificationServicesController['disablePushNotifications'];
23
+ };
24
+ export type NotificationServicesControllerCheckAccountsPresenceAction = {
25
+ type: `NotificationServicesController:checkAccountsPresence`;
26
+ handler: NotificationServicesController['checkAccountsPresence'];
27
+ };
28
+ /**
29
+ * Sets the enabled state of feature announcements.
30
+ *
31
+ * **Action** - used in the notification settings to enable/disable feature announcements.
32
+ *
33
+ * @param featureAnnouncementsEnabled - A boolean value indicating the desired enabled state of the feature announcements.
34
+ * @async
35
+ * @throws {Error} If fails to update
36
+ */
37
+ export type NotificationServicesControllerSetFeatureAnnouncementsEnabledAction = {
38
+ type: `NotificationServicesController:setFeatureAnnouncementsEnabled`;
39
+ handler: NotificationServicesController['setFeatureAnnouncementsEnabled'];
40
+ };
41
+ /**
42
+ * This creates/re-creates on-chain triggers defined in User Storage.
43
+ *
44
+ * **Action** - Used during Sign In / Enabling of notifications.
45
+ *
46
+ * @param opts - optional options to mutate this functionality
47
+ * @param opts.resetNotifications - this will not use the users stored preferences, and instead re-create notification triggers
48
+ * It will help in case uses get into a corrupted state or wants to wipe their notifications.
49
+ * @returns The updated or newly created user storage.
50
+ * @throws {Error} Throws an error if unauthenticated or from other operations.
51
+ */
52
+ export type NotificationServicesControllerCreateOnChainTriggersAction = {
53
+ type: `NotificationServicesController:createOnChainTriggers`;
54
+ handler: NotificationServicesController['createOnChainTriggers'];
55
+ };
56
+ /**
57
+ * Enables all MetaMask notifications for the user.
58
+ * This is identical flow when initializing notifications for the first time.
59
+ *
60
+ * @throws {Error} If there is an error during the process of enabling notifications.
61
+ */
62
+ export type NotificationServicesControllerEnableMetamaskNotificationsAction = {
63
+ type: `NotificationServicesController:enableMetamaskNotifications`;
64
+ handler: NotificationServicesController['enableMetamaskNotifications'];
65
+ };
66
+ /**
67
+ * Disables all MetaMask notifications for the user.
68
+ * This method ensures that the user is authenticated, retrieves all linked accounts,
69
+ * and disables on-chain triggers for each account. It also sets the global notification
70
+ * settings for MetaMask, feature announcements to false.
71
+ *
72
+ * @throws {Error} If the user is not authenticated or if there is an error during the process.
73
+ */
74
+ export type NotificationServicesControllerDisableNotificationServicesAction = {
75
+ type: `NotificationServicesController:disableNotificationServices`;
76
+ handler: NotificationServicesController['disableNotificationServices'];
77
+ };
78
+ /**
79
+ * Deletes on-chain triggers associated with a specific account/s.
80
+ * This method performs several key operations:
81
+ * 1. Validates Auth
82
+ * 2. Deletes accounts
83
+ * (note) We do not need to look through push notifications as we've deleted triggers
84
+ *
85
+ * **Action** - When a user disables notifications for a given account in settings.
86
+ *
87
+ * @param accounts - The account for which on-chain triggers are to be deleted.
88
+ * @returns A promise that resolves to void or an object containing a success message.
89
+ * @throws {Error} Throws an error if unauthenticated or from other operations.
90
+ */
91
+ export type NotificationServicesControllerDisableAccountsAction = {
92
+ type: `NotificationServicesController:disableAccounts`;
93
+ handler: NotificationServicesController['disableAccounts'];
94
+ };
95
+ /**
96
+ * Updates/Creates on-chain triggers for a specific account.
97
+ *
98
+ * This method performs several key operations:
99
+ * 1. Validates Auth & Storage
100
+ * 2. Finds and creates any missing triggers associated with the account
101
+ * 3. Enables any related push notifications
102
+ * 4. Updates Storage to reflect new state.
103
+ *
104
+ * **Action** - When a user enables notifications for an account
105
+ *
106
+ * @param accounts - List of accounts you want to update.
107
+ * @returns A promise that resolves to the updated user storage.
108
+ * @throws {Error} Throws an error if unauthenticated or from other operations.
109
+ */
110
+ export type NotificationServicesControllerEnableAccountsAction = {
111
+ type: `NotificationServicesController:enableAccounts`;
112
+ handler: NotificationServicesController['enableAccounts'];
113
+ };
114
+ /**
115
+ * Fetches the list of metamask notifications.
116
+ * This includes OnChain notifications; Feature Announcements; and Snap Notifications.
117
+ *
118
+ * **Action** - When a user views the notification list page/dropdown
119
+ *
120
+ * @param previewToken - the preview token to use if needed
121
+ * @returns A promise that resolves to the list of notifications.
122
+ * @throws {Error} Throws an error if unauthenticated or from other operations.
123
+ */
124
+ export type NotificationServicesControllerFetchAndUpdateMetamaskNotificationsAction = {
125
+ type: `NotificationServicesController:fetchAndUpdateMetamaskNotifications`;
126
+ handler: NotificationServicesController['fetchAndUpdateMetamaskNotifications'];
127
+ };
128
+ /**
129
+ * Gets the specified type of notifications from state.
130
+ *
131
+ * @param type - The trigger type.
132
+ * @returns An array of notifications of the passed in type.
133
+ * @throws Throws an error if an invalid trigger type is passed.
134
+ */
135
+ export type NotificationServicesControllerGetNotificationsByTypeAction = {
136
+ type: `NotificationServicesController:getNotificationsByType`;
137
+ handler: NotificationServicesController['getNotificationsByType'];
138
+ };
139
+ /**
140
+ * Used to delete a notification by id.
141
+ *
142
+ * Note: This function should only be used for notifications that are stored
143
+ * in this controller directly, currently only snaps notifications.
144
+ *
145
+ * @param id - The id of the notification to delete.
146
+ */
147
+ export type NotificationServicesControllerDeleteNotificationByIdAction = {
148
+ type: `NotificationServicesController:deleteNotificationById`;
149
+ handler: NotificationServicesController['deleteNotificationById'];
150
+ };
151
+ /**
152
+ * Used to batch delete notifications by id.
153
+ *
154
+ * Note: This function should only be used for notifications that are stored
155
+ * in this controller directly, currently only snaps notifications.
156
+ *
157
+ * @param ids - The ids of the notifications to delete.
158
+ */
159
+ export type NotificationServicesControllerDeleteNotificationsByIdAction = {
160
+ type: `NotificationServicesController:deleteNotificationsById`;
161
+ handler: NotificationServicesController['deleteNotificationsById'];
162
+ };
163
+ /**
164
+ * Marks specified metamask notifications as read.
165
+ *
166
+ * @param notifications - An array of notifications to be marked as read. Each notification should include its type and read status.
167
+ * @returns A promise that resolves when the operation is complete.
168
+ */
169
+ export type NotificationServicesControllerMarkMetamaskNotificationsAsReadAction = {
170
+ type: `NotificationServicesController:markMetamaskNotificationsAsRead`;
171
+ handler: NotificationServicesController['markMetamaskNotificationsAsRead'];
172
+ };
173
+ /**
174
+ * Updates the list of MetaMask notifications by adding a new notification at the beginning of the list.
175
+ * This method ensures that the most recent notification is displayed first in the UI.
176
+ *
177
+ * @param notification - The new notification object to be added to the list.
178
+ * @returns A promise that resolves when the notification list has been successfully updated.
179
+ */
180
+ export type NotificationServicesControllerUpdateMetamaskNotificationsListAction = {
181
+ type: `NotificationServicesController:updateMetamaskNotificationsList`;
182
+ handler: NotificationServicesController['updateMetamaskNotificationsList'];
183
+ };
184
+ /**
185
+ * Creates an perp order notification subscription.
186
+ * Requires notifications and auth to be enabled to start receiving this notifications
187
+ *
188
+ * @param input perp input
189
+ */
190
+ export type NotificationServicesControllerSendPerpPlaceOrderNotificationAction = {
191
+ type: `NotificationServicesController:sendPerpPlaceOrderNotification`;
192
+ handler: NotificationServicesController['sendPerpPlaceOrderNotification'];
193
+ };
194
+ /**
195
+ * Union of all NotificationServicesController action types.
196
+ */
197
+ export type NotificationServicesControllerMethodActions = NotificationServicesControllerInitAction | NotificationServicesControllerEnablePushNotificationsAction | NotificationServicesControllerDisablePushNotificationsAction | NotificationServicesControllerCheckAccountsPresenceAction | NotificationServicesControllerSetFeatureAnnouncementsEnabledAction | NotificationServicesControllerCreateOnChainTriggersAction | NotificationServicesControllerEnableMetamaskNotificationsAction | NotificationServicesControllerDisableNotificationServicesAction | NotificationServicesControllerDisableAccountsAction | NotificationServicesControllerEnableAccountsAction | NotificationServicesControllerFetchAndUpdateMetamaskNotificationsAction | NotificationServicesControllerGetNotificationsByTypeAction | NotificationServicesControllerDeleteNotificationByIdAction | NotificationServicesControllerDeleteNotificationsByIdAction | NotificationServicesControllerMarkMetamaskNotificationsAsReadAction | NotificationServicesControllerUpdateMetamaskNotificationsListAction | NotificationServicesControllerSendPerpPlaceOrderNotificationAction;
198
+ //# sourceMappingURL=NotificationServicesController-method-action-types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationServicesController-method-action-types.d.cts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,8BAA8B,EAAE,6CAAyC;AAEvF,MAAM,MAAM,wCAAwC,GAAG;IACrD,IAAI,EAAE,qCAAqC,CAAC;IAC5C,OAAO,EAAE,8BAA8B,CAAC,MAAM,CAAC,CAAC;CACjD,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;CACpE,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,4DAA4D,GAAG;IACzE,IAAI,EAAE,yDAAyD,CAAC;IAChE,OAAO,EAAE,8BAA8B,CAAC,0BAA0B,CAAC,CAAC;CACrE,CAAC;AAEF,MAAM,MAAM,yDAAyD,GAAG;IACtE,IAAI,EAAE,sDAAsD,CAAC;IAC7D,OAAO,EAAE,8BAA8B,CAAC,uBAAuB,CAAC,CAAC;CAClE,CAAC;AAEF;;;;;;;;GAQG;AACH,MAAM,MAAM,kEAAkE,GAC5E;IACE,IAAI,EAAE,+DAA+D,CAAC;IACtE,OAAO,EAAE,8BAA8B,CAAC,gCAAgC,CAAC,CAAC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;;;;;;GAOG;AACH,MAAM,MAAM,2DAA2D,GAAG;IACxE,IAAI,EAAE,wDAAwD,CAAC;IAC/D,OAAO,EAAE,8BAA8B,CAAC,yBAAyB,CAAC,CAAC;CACpE,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,mEAAmE,GAC7E;IACE,IAAI,EAAE,gEAAgE,CAAC;IACvE,OAAO,EAAE,8BAA8B,CAAC,iCAAiC,CAAC,CAAC;CAC5E,CAAC;AAEJ;;;;;;GAMG;AACH,MAAM,MAAM,mEAAmE,GAC7E;IACE,IAAI,EAAE,gEAAgE,CAAC;IACvE,OAAO,EAAE,8BAA8B,CAAC,iCAAiC,CAAC,CAAC;CAC5E,CAAC;AAEJ;;;;;GAKG;AACH,MAAM,MAAM,kEAAkE,GAC5E;IACE,IAAI,EAAE,+DAA+D,CAAC;IACtE,OAAO,EAAE,8BAA8B,CAAC,gCAAgC,CAAC,CAAC;CAC3E,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,2CAA2C,GACnD,wCAAwC,GACxC,2DAA2D,GAC3D,4DAA4D,GAC5D,yDAAyD,GACzD,kEAAkE,GAClE,yDAAyD,GACzD,+DAA+D,GAC/D,+DAA+D,GAC/D,mDAAmD,GACnD,kDAAkD,GAClD,uEAAuE,GACvE,0DAA0D,GAC1D,0DAA0D,GAC1D,2DAA2D,GAC3D,mEAAmE,GACnE,mEAAmE,GACnE,kEAAkE,CAAC"}
@@ -0,0 +1,198 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ import type { NotificationServicesController } from "./NotificationServicesController.mjs";
6
+ export type NotificationServicesControllerInitAction = {
7
+ type: `NotificationServicesController:init`;
8
+ handler: NotificationServicesController['init'];
9
+ };
10
+ /**
11
+ * Public method to expose enabling push notifications
12
+ */
13
+ export type NotificationServicesControllerEnablePushNotificationsAction = {
14
+ type: `NotificationServicesController:enablePushNotifications`;
15
+ handler: NotificationServicesController['enablePushNotifications'];
16
+ };
17
+ /**
18
+ * Public method to expose disabling push notifications
19
+ */
20
+ export type NotificationServicesControllerDisablePushNotificationsAction = {
21
+ type: `NotificationServicesController:disablePushNotifications`;
22
+ handler: NotificationServicesController['disablePushNotifications'];
23
+ };
24
+ export type NotificationServicesControllerCheckAccountsPresenceAction = {
25
+ type: `NotificationServicesController:checkAccountsPresence`;
26
+ handler: NotificationServicesController['checkAccountsPresence'];
27
+ };
28
+ /**
29
+ * Sets the enabled state of feature announcements.
30
+ *
31
+ * **Action** - used in the notification settings to enable/disable feature announcements.
32
+ *
33
+ * @param featureAnnouncementsEnabled - A boolean value indicating the desired enabled state of the feature announcements.
34
+ * @async
35
+ * @throws {Error} If fails to update
36
+ */
37
+ export type NotificationServicesControllerSetFeatureAnnouncementsEnabledAction = {
38
+ type: `NotificationServicesController:setFeatureAnnouncementsEnabled`;
39
+ handler: NotificationServicesController['setFeatureAnnouncementsEnabled'];
40
+ };
41
+ /**
42
+ * This creates/re-creates on-chain triggers defined in User Storage.
43
+ *
44
+ * **Action** - Used during Sign In / Enabling of notifications.
45
+ *
46
+ * @param opts - optional options to mutate this functionality
47
+ * @param opts.resetNotifications - this will not use the users stored preferences, and instead re-create notification triggers
48
+ * It will help in case uses get into a corrupted state or wants to wipe their notifications.
49
+ * @returns The updated or newly created user storage.
50
+ * @throws {Error} Throws an error if unauthenticated or from other operations.
51
+ */
52
+ export type NotificationServicesControllerCreateOnChainTriggersAction = {
53
+ type: `NotificationServicesController:createOnChainTriggers`;
54
+ handler: NotificationServicesController['createOnChainTriggers'];
55
+ };
56
+ /**
57
+ * Enables all MetaMask notifications for the user.
58
+ * This is identical flow when initializing notifications for the first time.
59
+ *
60
+ * @throws {Error} If there is an error during the process of enabling notifications.
61
+ */
62
+ export type NotificationServicesControllerEnableMetamaskNotificationsAction = {
63
+ type: `NotificationServicesController:enableMetamaskNotifications`;
64
+ handler: NotificationServicesController['enableMetamaskNotifications'];
65
+ };
66
+ /**
67
+ * Disables all MetaMask notifications for the user.
68
+ * This method ensures that the user is authenticated, retrieves all linked accounts,
69
+ * and disables on-chain triggers for each account. It also sets the global notification
70
+ * settings for MetaMask, feature announcements to false.
71
+ *
72
+ * @throws {Error} If the user is not authenticated or if there is an error during the process.
73
+ */
74
+ export type NotificationServicesControllerDisableNotificationServicesAction = {
75
+ type: `NotificationServicesController:disableNotificationServices`;
76
+ handler: NotificationServicesController['disableNotificationServices'];
77
+ };
78
+ /**
79
+ * Deletes on-chain triggers associated with a specific account/s.
80
+ * This method performs several key operations:
81
+ * 1. Validates Auth
82
+ * 2. Deletes accounts
83
+ * (note) We do not need to look through push notifications as we've deleted triggers
84
+ *
85
+ * **Action** - When a user disables notifications for a given account in settings.
86
+ *
87
+ * @param accounts - The account for which on-chain triggers are to be deleted.
88
+ * @returns A promise that resolves to void or an object containing a success message.
89
+ * @throws {Error} Throws an error if unauthenticated or from other operations.
90
+ */
91
+ export type NotificationServicesControllerDisableAccountsAction = {
92
+ type: `NotificationServicesController:disableAccounts`;
93
+ handler: NotificationServicesController['disableAccounts'];
94
+ };
95
+ /**
96
+ * Updates/Creates on-chain triggers for a specific account.
97
+ *
98
+ * This method performs several key operations:
99
+ * 1. Validates Auth & Storage
100
+ * 2. Finds and creates any missing triggers associated with the account
101
+ * 3. Enables any related push notifications
102
+ * 4. Updates Storage to reflect new state.
103
+ *
104
+ * **Action** - When a user enables notifications for an account
105
+ *
106
+ * @param accounts - List of accounts you want to update.
107
+ * @returns A promise that resolves to the updated user storage.
108
+ * @throws {Error} Throws an error if unauthenticated or from other operations.
109
+ */
110
+ export type NotificationServicesControllerEnableAccountsAction = {
111
+ type: `NotificationServicesController:enableAccounts`;
112
+ handler: NotificationServicesController['enableAccounts'];
113
+ };
114
+ /**
115
+ * Fetches the list of metamask notifications.
116
+ * This includes OnChain notifications; Feature Announcements; and Snap Notifications.
117
+ *
118
+ * **Action** - When a user views the notification list page/dropdown
119
+ *
120
+ * @param previewToken - the preview token to use if needed
121
+ * @returns A promise that resolves to the list of notifications.
122
+ * @throws {Error} Throws an error if unauthenticated or from other operations.
123
+ */
124
+ export type NotificationServicesControllerFetchAndUpdateMetamaskNotificationsAction = {
125
+ type: `NotificationServicesController:fetchAndUpdateMetamaskNotifications`;
126
+ handler: NotificationServicesController['fetchAndUpdateMetamaskNotifications'];
127
+ };
128
+ /**
129
+ * Gets the specified type of notifications from state.
130
+ *
131
+ * @param type - The trigger type.
132
+ * @returns An array of notifications of the passed in type.
133
+ * @throws Throws an error if an invalid trigger type is passed.
134
+ */
135
+ export type NotificationServicesControllerGetNotificationsByTypeAction = {
136
+ type: `NotificationServicesController:getNotificationsByType`;
137
+ handler: NotificationServicesController['getNotificationsByType'];
138
+ };
139
+ /**
140
+ * Used to delete a notification by id.
141
+ *
142
+ * Note: This function should only be used for notifications that are stored
143
+ * in this controller directly, currently only snaps notifications.
144
+ *
145
+ * @param id - The id of the notification to delete.
146
+ */
147
+ export type NotificationServicesControllerDeleteNotificationByIdAction = {
148
+ type: `NotificationServicesController:deleteNotificationById`;
149
+ handler: NotificationServicesController['deleteNotificationById'];
150
+ };
151
+ /**
152
+ * Used to batch delete notifications by id.
153
+ *
154
+ * Note: This function should only be used for notifications that are stored
155
+ * in this controller directly, currently only snaps notifications.
156
+ *
157
+ * @param ids - The ids of the notifications to delete.
158
+ */
159
+ export type NotificationServicesControllerDeleteNotificationsByIdAction = {
160
+ type: `NotificationServicesController:deleteNotificationsById`;
161
+ handler: NotificationServicesController['deleteNotificationsById'];
162
+ };
163
+ /**
164
+ * Marks specified metamask notifications as read.
165
+ *
166
+ * @param notifications - An array of notifications to be marked as read. Each notification should include its type and read status.
167
+ * @returns A promise that resolves when the operation is complete.
168
+ */
169
+ export type NotificationServicesControllerMarkMetamaskNotificationsAsReadAction = {
170
+ type: `NotificationServicesController:markMetamaskNotificationsAsRead`;
171
+ handler: NotificationServicesController['markMetamaskNotificationsAsRead'];
172
+ };
173
+ /**
174
+ * Updates the list of MetaMask notifications by adding a new notification at the beginning of the list.
175
+ * This method ensures that the most recent notification is displayed first in the UI.
176
+ *
177
+ * @param notification - The new notification object to be added to the list.
178
+ * @returns A promise that resolves when the notification list has been successfully updated.
179
+ */
180
+ export type NotificationServicesControllerUpdateMetamaskNotificationsListAction = {
181
+ type: `NotificationServicesController:updateMetamaskNotificationsList`;
182
+ handler: NotificationServicesController['updateMetamaskNotificationsList'];
183
+ };
184
+ /**
185
+ * Creates an perp order notification subscription.
186
+ * Requires notifications and auth to be enabled to start receiving this notifications
187
+ *
188
+ * @param input perp input
189
+ */
190
+ export type NotificationServicesControllerSendPerpPlaceOrderNotificationAction = {
191
+ type: `NotificationServicesController:sendPerpPlaceOrderNotification`;
192
+ handler: NotificationServicesController['sendPerpPlaceOrderNotification'];
193
+ };
194
+ /**
195
+ * Union of all NotificationServicesController action types.
196
+ */
197
+ export type NotificationServicesControllerMethodActions = NotificationServicesControllerInitAction | NotificationServicesControllerEnablePushNotificationsAction | NotificationServicesControllerDisablePushNotificationsAction | NotificationServicesControllerCheckAccountsPresenceAction | NotificationServicesControllerSetFeatureAnnouncementsEnabledAction | NotificationServicesControllerCreateOnChainTriggersAction | NotificationServicesControllerEnableMetamaskNotificationsAction | NotificationServicesControllerDisableNotificationServicesAction | NotificationServicesControllerDisableAccountsAction | NotificationServicesControllerEnableAccountsAction | NotificationServicesControllerFetchAndUpdateMetamaskNotificationsAction | NotificationServicesControllerGetNotificationsByTypeAction | NotificationServicesControllerDeleteNotificationByIdAction | NotificationServicesControllerDeleteNotificationsByIdAction | NotificationServicesControllerMarkMetamaskNotificationsAsReadAction | NotificationServicesControllerUpdateMetamaskNotificationsListAction | NotificationServicesControllerSendPerpPlaceOrderNotificationAction;
198
+ //# sourceMappingURL=NotificationServicesController-method-action-types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationServicesController-method-action-types.d.mts","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;G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I,EAAE,+DAA+D,CAAC;IACtE,OAAO,EAAE,8BAA8B,CAAC,gCAAgC,CAAC,CAAC;CAC3E,CAAC;AAEJ;;GAEG;AACH,MAAM,MAAM,2CAA2C,GACnD,wCAAwC,GACxC,2DAA2D,GAC3D,4DAA4D,GAC5D,yDAAyD,GACzD,kEAAkE,GAClE,yDAAyD,GACzD,+DAA+D,GAC/D,+DAA+D,GAC/D,mDAAmD,GACnD,kDAAkD,GAClD,uEAAuE,GACvE,0DAA0D,GAC1D,0DAA0D,GAC1D,2DAA2D,GAC3D,mEAAmE,GACnE,mEAAmE,GACnE,kEAAkE,CAAC"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file is auto generated by `scripts/generate-method-action-types.ts`.
3
+ * Do not edit manually.
4
+ */
5
+ export {};
6
+ //# sourceMappingURL=NotificationServicesController-method-action-types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationServicesController-method-action-types.mjs","sourceRoot":"","sources":["../../src/NotificationServicesController/NotificationServicesController-method-action-types.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/**\n * This file is auto generated by `scripts/generate-method-action-types.ts`.\n * Do not edit manually.\n */\n\nimport type { NotificationServicesController } from './NotificationServicesController';\n\nexport type NotificationServicesControllerInitAction = {\n type: `NotificationServicesController:init`;\n handler: NotificationServicesController['init'];\n};\n\n/**\n * Public method to expose enabling push notifications\n */\nexport type NotificationServicesControllerEnablePushNotificationsAction = {\n type: `NotificationServicesController:enablePushNotifications`;\n handler: NotificationServicesController['enablePushNotifications'];\n};\n\n/**\n * Public method to expose disabling push notifications\n */\nexport type NotificationServicesControllerDisablePushNotificationsAction = {\n type: `NotificationServicesController:disablePushNotifications`;\n handler: NotificationServicesController['disablePushNotifications'];\n};\n\nexport type NotificationServicesControllerCheckAccountsPresenceAction = {\n type: `NotificationServicesController:checkAccountsPresence`;\n handler: NotificationServicesController['checkAccountsPresence'];\n};\n\n/**\n * Sets the enabled state of feature announcements.\n *\n * **Action** - used in the notification settings to enable/disable feature announcements.\n *\n * @param featureAnnouncementsEnabled - A boolean value indicating the desired enabled state of the feature announcements.\n * @async\n * @throws {Error} If fails to update\n */\nexport type NotificationServicesControllerSetFeatureAnnouncementsEnabledAction =\n {\n type: `NotificationServicesController:setFeatureAnnouncementsEnabled`;\n handler: NotificationServicesController['setFeatureAnnouncementsEnabled'];\n };\n\n/**\n * This creates/re-creates on-chain triggers defined in User Storage.\n *\n * **Action** - Used during Sign In / Enabling of notifications.\n *\n * @param opts - optional options to mutate this functionality\n * @param opts.resetNotifications - this will not use the users stored preferences, and instead re-create notification triggers\n * It will help in case uses get into a corrupted state or wants to wipe their notifications.\n * @returns The updated or newly created user storage.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\nexport type NotificationServicesControllerCreateOnChainTriggersAction = {\n type: `NotificationServicesController:createOnChainTriggers`;\n handler: NotificationServicesController['createOnChainTriggers'];\n};\n\n/**\n * Enables all MetaMask notifications for the user.\n * This is identical flow when initializing notifications for the first time.\n *\n * @throws {Error} If there is an error during the process of enabling notifications.\n */\nexport type NotificationServicesControllerEnableMetamaskNotificationsAction = {\n type: `NotificationServicesController:enableMetamaskNotifications`;\n handler: NotificationServicesController['enableMetamaskNotifications'];\n};\n\n/**\n * Disables all MetaMask notifications for the user.\n * This method ensures that the user is authenticated, retrieves all linked accounts,\n * and disables on-chain triggers for each account. It also sets the global notification\n * settings for MetaMask, feature announcements to false.\n *\n * @throws {Error} If the user is not authenticated or if there is an error during the process.\n */\nexport type NotificationServicesControllerDisableNotificationServicesAction = {\n type: `NotificationServicesController:disableNotificationServices`;\n handler: NotificationServicesController['disableNotificationServices'];\n};\n\n/**\n * Deletes on-chain triggers associated with a specific account/s.\n * This method performs several key operations:\n * 1. Validates Auth\n * 2. Deletes accounts\n * (note) We do not need to look through push notifications as we've deleted triggers\n *\n * **Action** - When a user disables notifications for a given account in settings.\n *\n * @param accounts - The account for which on-chain triggers are to be deleted.\n * @returns A promise that resolves to void or an object containing a success message.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\nexport type NotificationServicesControllerDisableAccountsAction = {\n type: `NotificationServicesController:disableAccounts`;\n handler: NotificationServicesController['disableAccounts'];\n};\n\n/**\n * Updates/Creates on-chain triggers for a specific account.\n *\n * This method performs several key operations:\n * 1. Validates Auth & Storage\n * 2. Finds and creates any missing triggers associated with the account\n * 3. Enables any related push notifications\n * 4. Updates Storage to reflect new state.\n *\n * **Action** - When a user enables notifications for an account\n *\n * @param accounts - List of accounts you want to update.\n * @returns A promise that resolves to the updated user storage.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\nexport type NotificationServicesControllerEnableAccountsAction = {\n type: `NotificationServicesController:enableAccounts`;\n handler: NotificationServicesController['enableAccounts'];\n};\n\n/**\n * Fetches the list of metamask notifications.\n * This includes OnChain notifications; Feature Announcements; and Snap Notifications.\n *\n * **Action** - When a user views the notification list page/dropdown\n *\n * @param previewToken - the preview token to use if needed\n * @returns A promise that resolves to the list of notifications.\n * @throws {Error} Throws an error if unauthenticated or from other operations.\n */\nexport type NotificationServicesControllerFetchAndUpdateMetamaskNotificationsAction =\n {\n type: `NotificationServicesController:fetchAndUpdateMetamaskNotifications`;\n handler: NotificationServicesController['fetchAndUpdateMetamaskNotifications'];\n };\n\n/**\n * Gets the specified type of notifications from state.\n *\n * @param type - The trigger type.\n * @returns An array of notifications of the passed in type.\n * @throws Throws an error if an invalid trigger type is passed.\n */\nexport type NotificationServicesControllerGetNotificationsByTypeAction = {\n type: `NotificationServicesController:getNotificationsByType`;\n handler: NotificationServicesController['getNotificationsByType'];\n};\n\n/**\n * Used to delete a notification by id.\n *\n * Note: This function should only be used for notifications that are stored\n * in this controller directly, currently only snaps notifications.\n *\n * @param id - The id of the notification to delete.\n */\nexport type NotificationServicesControllerDeleteNotificationByIdAction = {\n type: `NotificationServicesController:deleteNotificationById`;\n handler: NotificationServicesController['deleteNotificationById'];\n};\n\n/**\n * Used to batch delete notifications by id.\n *\n * Note: This function should only be used for notifications that are stored\n * in this controller directly, currently only snaps notifications.\n *\n * @param ids - The ids of the notifications to delete.\n */\nexport type NotificationServicesControllerDeleteNotificationsByIdAction = {\n type: `NotificationServicesController:deleteNotificationsById`;\n handler: NotificationServicesController['deleteNotificationsById'];\n};\n\n/**\n * Marks specified metamask notifications as read.\n *\n * @param notifications - An array of notifications to be marked as read. Each notification should include its type and read status.\n * @returns A promise that resolves when the operation is complete.\n */\nexport type NotificationServicesControllerMarkMetamaskNotificationsAsReadAction =\n {\n type: `NotificationServicesController:markMetamaskNotificationsAsRead`;\n handler: NotificationServicesController['markMetamaskNotificationsAsRead'];\n };\n\n/**\n * Updates the list of MetaMask notifications by adding a new notification at the beginning of the list.\n * This method ensures that the most recent notification is displayed first in the UI.\n *\n * @param notification - The new notification object to be added to the list.\n * @returns A promise that resolves when the notification list has been successfully updated.\n */\nexport type NotificationServicesControllerUpdateMetamaskNotificationsListAction =\n {\n type: `NotificationServicesController:updateMetamaskNotificationsList`;\n handler: NotificationServicesController['updateMetamaskNotificationsList'];\n };\n\n/**\n * Creates an perp order notification subscription.\n * Requires notifications and auth to be enabled to start receiving this notifications\n *\n * @param input perp input\n */\nexport type NotificationServicesControllerSendPerpPlaceOrderNotificationAction =\n {\n type: `NotificationServicesController:sendPerpPlaceOrderNotification`;\n handler: NotificationServicesController['sendPerpPlaceOrderNotification'];\n };\n\n/**\n * Union of all NotificationServicesController action types.\n */\nexport type NotificationServicesControllerMethodActions =\n | NotificationServicesControllerInitAction\n | NotificationServicesControllerEnablePushNotificationsAction\n | NotificationServicesControllerDisablePushNotificationsAction\n | NotificationServicesControllerCheckAccountsPresenceAction\n | NotificationServicesControllerSetFeatureAnnouncementsEnabledAction\n | NotificationServicesControllerCreateOnChainTriggersAction\n | NotificationServicesControllerEnableMetamaskNotificationsAction\n | NotificationServicesControllerDisableNotificationServicesAction\n | NotificationServicesControllerDisableAccountsAction\n | NotificationServicesControllerEnableAccountsAction\n | NotificationServicesControllerFetchAndUpdateMetamaskNotificationsAction\n | NotificationServicesControllerGetNotificationsByTypeAction\n | NotificationServicesControllerDeleteNotificationByIdAction\n | NotificationServicesControllerDeleteNotificationsByIdAction\n | NotificationServicesControllerMarkMetamaskNotificationsAsReadAction\n | NotificationServicesControllerUpdateMetamaskNotificationsListAction\n | NotificationServicesControllerSendPerpPlaceOrderNotificationAction;\n"]}