@metamask/notification-services-controller 0.21.0 → 2.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.
- package/CHANGELOG.md +34 -3
- package/README.md +35 -1
- package/dist/NotificationServicesController/NotificationServicesController.cjs +75 -80
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts +10 -34
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts +10 -34
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -1
- package/dist/NotificationServicesController/NotificationServicesController.mjs +76 -81
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
- package/dist/NotificationServicesController/index.cjs +2 -1
- package/dist/NotificationServicesController/index.cjs.map +1 -1
- package/dist/NotificationServicesController/index.d.cts +2 -1
- package/dist/NotificationServicesController/index.d.cts.map +1 -1
- package/dist/NotificationServicesController/index.d.mts +2 -1
- package/dist/NotificationServicesController/index.d.mts.map +1 -1
- package/dist/NotificationServicesController/index.mjs +2 -1
- package/dist/NotificationServicesController/index.mjs.map +1 -1
- package/dist/NotificationServicesController/mocks/index.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/index.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-trigger.mjs.map +1 -0
- package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-user-storage.cjs +1 -1
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.d.mts.map +1 -0
- package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-user-storage.mjs +1 -1
- package/dist/NotificationServicesController/mocks/mock-notification-user-storage.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-snap-notification.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-snap-notification.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-snap-notification.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mock-snap-notification.mjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.cjs.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.d.cts.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.d.mts.map +1 -0
- package/dist/NotificationServicesController/mocks/mockResponses.mjs.map +1 -0
- package/dist/NotificationServicesController/services/onchain-notifications.cjs +1 -0
- package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.mjs +2 -1
- package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/utils/utils.cjs +28 -2
- package/dist/NotificationServicesController/utils/utils.cjs.map +1 -1
- package/dist/NotificationServicesController/utils/utils.d.cts +11 -1
- package/dist/NotificationServicesController/utils/utils.d.cts.map +1 -1
- package/dist/NotificationServicesController/utils/utils.d.mts +11 -1
- package/dist/NotificationServicesController/utils/utils.d.mts.map +1 -1
- package/dist/NotificationServicesController/utils/utils.mjs +26 -1
- package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +99 -57
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +21 -22
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +21 -22
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +100 -58
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/index.cjs +1 -1
- package/dist/NotificationServicesPushController/index.cjs.map +1 -1
- package/dist/NotificationServicesPushController/index.d.cts +1 -1
- package/dist/NotificationServicesPushController/index.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/index.d.mts +1 -1
- package/dist/NotificationServicesPushController/index.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/index.mjs +1 -1
- package/dist/NotificationServicesPushController/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/mocks/index.cjs.map +1 -0
- package/dist/NotificationServicesPushController/mocks/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/index.mjs.map +1 -0
- package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.cjs +2 -2
- package/dist/NotificationServicesPushController/mocks/mockResponse.cjs.map +1 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.mjs +2 -2
- package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +1 -0
- package/dist/NotificationServicesPushController/services/services.cjs +21 -93
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +8 -29
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +8 -29
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +20 -94
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/dist/NotificationServicesPushController/types/index.cjs.map +1 -1
- package/dist/NotificationServicesPushController/types/index.d.cts +1 -0
- package/dist/NotificationServicesPushController/types/index.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/types/index.d.mts +1 -0
- package/dist/NotificationServicesPushController/types/index.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/types/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/{services/push/index.cjs → types/push-service-interface.cjs} +1 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.cjs.map +1 -0
- package/dist/NotificationServicesPushController/types/push-service-interface.d.cts +30 -0
- package/dist/NotificationServicesPushController/types/push-service-interface.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/types/push-service-interface.d.mts +30 -0
- package/dist/NotificationServicesPushController/types/push-service-interface.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/types/push-service-interface.mjs +2 -0
- package/dist/NotificationServicesPushController/types/push-service-interface.mjs.map +1 -0
- package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +1 -19
- package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts +0 -7
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts +0 -7
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +0 -17
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +1 -1
- package/dist/NotificationServicesPushController/web/index.cjs +8 -0
- package/dist/NotificationServicesPushController/web/index.cjs.map +1 -0
- package/dist/NotificationServicesPushController/web/index.d.cts +2 -0
- package/dist/NotificationServicesPushController/web/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/web/index.d.mts +2 -0
- package/dist/NotificationServicesPushController/web/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/web/index.mjs +2 -0
- package/dist/NotificationServicesPushController/web/index.mjs.map +1 -0
- package/dist/NotificationServicesPushController/web/push-utils.cjs +170 -0
- package/dist/NotificationServicesPushController/web/push-utils.cjs.map +1 -0
- package/dist/NotificationServicesPushController/web/push-utils.d.cts +37 -0
- package/dist/NotificationServicesPushController/web/push-utils.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/web/push-utils.d.mts +37 -0
- package/dist/NotificationServicesPushController/web/push-utils.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/web/push-utils.mjs +168 -0
- package/dist/NotificationServicesPushController/web/push-utils.mjs.map +1 -0
- package/dist/shared/index.cjs +19 -0
- package/dist/shared/index.cjs.map +1 -0
- package/dist/shared/index.d.cts +3 -0
- package/dist/shared/index.d.cts.map +1 -0
- package/dist/shared/index.d.mts +3 -0
- package/dist/shared/index.d.mts.map +1 -0
- package/dist/shared/index.mjs +3 -0
- package/dist/shared/index.mjs.map +1 -0
- package/dist/shared/is-onchain-notification.cjs +22 -0
- package/dist/shared/is-onchain-notification.cjs.map +1 -0
- package/dist/shared/is-onchain-notification.d.cts +9 -0
- package/dist/shared/is-onchain-notification.d.cts.map +1 -0
- package/dist/shared/is-onchain-notification.d.mts +9 -0
- package/dist/shared/is-onchain-notification.d.mts.map +1 -0
- package/dist/shared/is-onchain-notification.mjs +18 -0
- package/dist/shared/is-onchain-notification.mjs.map +1 -0
- package/notification-services/mocks/package.json +2 -2
- package/package.json +24 -14
- package/push-services/mocks/package.json +2 -2
- package/push-services/web/package.json +9 -0
- package/dist/NotificationServicesController/__fixtures__/index.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/index.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mock-snap-notification.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockServices.cjs +0 -56
- package/dist/NotificationServicesController/__fixtures__/mockServices.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.cts +0 -12
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts +0 -12
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockServices.mjs +0 -52
- package/dist/NotificationServicesController/__fixtures__/mockServices.mjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.cjs +0 -31
- package/dist/NotificationServicesController/__fixtures__/test-utils.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.cts +0 -14
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts +0 -14
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.mjs +0 -27
- package/dist/NotificationServicesController/__fixtures__/test-utils.mjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.mjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs +0 -31
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts +0 -9
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts +0 -9
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs +0 -30
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs.map +0 -1
- package/dist/NotificationServicesPushController/constants.cjs +0 -14
- package/dist/NotificationServicesPushController/constants.cjs.map +0 -1
- package/dist/NotificationServicesPushController/constants.d.cts +0 -11
- package/dist/NotificationServicesPushController/constants.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/constants.d.mts +0 -11
- package/dist/NotificationServicesPushController/constants.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/constants.mjs +0 -11
- package/dist/NotificationServicesPushController/constants.mjs.map +0 -1
- package/dist/NotificationServicesPushController/services/push/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/services/push/index.d.cts +0 -6
- package/dist/NotificationServicesPushController/services/push/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/services/push/index.d.mts +0 -6
- package/dist/NotificationServicesPushController/services/push/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/services/push/index.mjs +0 -2
- package/dist/NotificationServicesPushController/services/push/index.mjs.map +0 -1
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/index.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/index.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/index.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/index.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-feature-announcements.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-feature-announcements.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-feature-announcements.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-feature-announcements.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-trigger.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-trigger.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-trigger.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-trigger.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-user-storage.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-notification-user-storage.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-raw-notifications.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-raw-notifications.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-raw-notifications.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-raw-notifications.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-snap-notification.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-snap-notification.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-snap-notification.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mock-snap-notification.mjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mockResponses.cjs +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mockResponses.d.cts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mockResponses.d.mts +0 -0
- /package/dist/NotificationServicesController/{__fixtures__ → mocks}/mockResponses.mjs +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/index.cjs +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/index.d.cts +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/index.d.mts +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/index.mjs +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.d.cts +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.d.mts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,35 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [2.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add support for locales on push notifications ([#5392](https://github.com/MetaMask/core/pull/5392))
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- **BREAKING:** Bump `@metamask/keyring-controller` peer dependency to `^20.0.0` ([#5426](https://github.com/MetaMask/core/pull/5426))
|
|
19
|
+
- **BREAKING:** Bump `@metamask/profile-sync-controller` peer dependency to `^9.0.0` ([#5426](https://github.com/MetaMask/core/pull/5426))
|
|
20
|
+
|
|
21
|
+
## [1.0.0]
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- added new public methods `enablePushNotifications` and `disablePushNotification` on `NotificationServicesController` ([#5120](https://github.com/MetaMask/core/pull/5120))
|
|
26
|
+
- added `isPushEnabled` and `isUpdatingFCMToken` to `NotificationServicesPushController` state ([#5120](https://github.com/MetaMask/core/pull/5120))
|
|
27
|
+
- added `/push-services/web` subpath export to make it easier to import web helpers ([#5120](https://github.com/MetaMask/core/pull/5120))
|
|
28
|
+
|
|
29
|
+
### Changed
|
|
30
|
+
|
|
31
|
+
- **BREAKING**: updated `NotificationServicesPushController` constructor config to require a push interface ([#5120](https://github.com/MetaMask/core/pull/5120))
|
|
32
|
+
- Optimized API calls for creating push notification links ([#5358](https://github.com/MetaMask/core/pull/5358))
|
|
33
|
+
- Bump `@metamask/utils` from `^11.1.0` to `^11.2.0` ([#5301](https://github.com/MetaMask/core/pull/5301))
|
|
34
|
+
|
|
35
|
+
### Fixed
|
|
36
|
+
|
|
37
|
+
- only allow hex addresses when creating notifications ([#5343](https://github.com/MetaMask/core/pull/5343))
|
|
38
|
+
|
|
10
39
|
## [0.21.0]
|
|
11
40
|
|
|
12
41
|
### Added
|
|
@@ -48,7 +77,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
48
77
|
|
|
49
78
|
### Changed
|
|
50
79
|
|
|
51
|
-
-
|
|
80
|
+
- Bump `firebase` from `^10.11.0` to `^11.2.0` ([#5196](https://github.com/MetaMask/core/pull/5196))
|
|
52
81
|
|
|
53
82
|
## [0.16.0]
|
|
54
83
|
|
|
@@ -93,7 +122,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
93
122
|
|
|
94
123
|
### Fixed
|
|
95
124
|
|
|
96
|
-
- fix: allow snap notifications to be
|
|
125
|
+
- fix: allow snap notifications to be visible when controller is disabled ([#4890](https://github.com/MetaMask/core/pull/4890))
|
|
97
126
|
- Most notification services are switched off when the controller is disabled, but since snaps are "local notifications", they need to be visible irrespective to the controller disabled state.
|
|
98
127
|
|
|
99
128
|
## [0.12.0]
|
|
@@ -319,7 +348,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
319
348
|
|
|
320
349
|
- Initial release
|
|
321
350
|
|
|
322
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.
|
|
351
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@2.0.0...HEAD
|
|
352
|
+
[2.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@1.0.0...@metamask/notification-services-controller@2.0.0
|
|
353
|
+
[1.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.21.0...@metamask/notification-services-controller@1.0.0
|
|
323
354
|
[0.21.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.20.1...@metamask/notification-services-controller@0.21.0
|
|
324
355
|
[0.20.1]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.20.0...@metamask/notification-services-controller@0.20.1
|
|
325
356
|
[0.20.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.19.0...@metamask/notification-services-controller@0.20.0
|
package/README.md
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
# `@metamask/notification-services-controller`
|
|
2
2
|
|
|
3
|
-
Manages
|
|
3
|
+
Manages the notification and push notification services used in MetaMask. This includes:
|
|
4
|
+
|
|
5
|
+
- Wallet Notifications
|
|
6
|
+
- Feature Announcements
|
|
7
|
+
- Snap Notifications
|
|
4
8
|
|
|
5
9
|
## Installation
|
|
6
10
|
|
|
@@ -10,6 +14,36 @@ or
|
|
|
10
14
|
|
|
11
15
|
`npm install @metamask/notification-services-controller`
|
|
12
16
|
|
|
17
|
+
## Usage
|
|
18
|
+
|
|
19
|
+
This package uses subpath exports, which helps to minimize the amount of code you need to import. It also helps to keep specific modules isolated and can be used to import specific code (e.g., mocks or platform-specific code). You can see all the exports in the [`package.json`](./package.json), but here are a few examples:
|
|
20
|
+
|
|
21
|
+
Importing specific controllers/modules:
|
|
22
|
+
|
|
23
|
+
```ts
|
|
24
|
+
// Import the NotificationServicesController and its associated types/utilities.
|
|
25
|
+
import { ... } from '@metamask/notification-services-controller/notification-services'
|
|
26
|
+
|
|
27
|
+
// Import the NotificationServicesPushController and its associated types/utilities.
|
|
28
|
+
import { ... } from '@metamask/notification-services-controller/push-services'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Importing mock creation functions:
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
// Import and use mock creation functions (designed to mirror the actual types).
|
|
35
|
+
// Useful for testing or Storybook development.
|
|
36
|
+
import { ... } from '@metamask/notification-services-controller/notification-services/mocks'
|
|
37
|
+
import { ... } from '@metamask/notification-services-controller/push-services/mocks'
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Importing platform specific code:
|
|
41
|
+
|
|
42
|
+
```ts
|
|
43
|
+
// Some controllers provide interfaces for injecting platform-specific code, tailored to different clients (e.g., web or mobile).
|
|
44
|
+
import { ... } from '@metamask/notification-services-controller/push-services/web'
|
|
45
|
+
```
|
|
46
|
+
|
|
13
47
|
## Contributing
|
|
14
48
|
|
|
15
49
|
This package is part of a monorepo. Instructions for contributing can be found in the [monorepo README](https://github.com/MetaMask/core#readme).
|
|
@@ -36,7 +36,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
36
36
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
37
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
38
|
};
|
|
39
|
-
var _NotificationServicesController_instances,
|
|
39
|
+
var _NotificationServicesController_instances, _NotificationServicesController_keyringController, _NotificationServicesController_auth, _NotificationServicesController_storage, _NotificationServicesController_pushNotifications, _NotificationServicesController_accounts, _NotificationServicesController_featureAnnouncementEnv, _NotificationServicesController_registerMessageHandlers, _NotificationServicesController_clearLoadingStates, _NotificationServicesController_assertAuthEnabled, _NotificationServicesController_enableAuth, _NotificationServicesController_getValidStorageKeyAndBearerToken, _NotificationServicesController_assertUserStorage, _NotificationServicesController_getUserStorage, _NotificationServicesController_setIsUpdatingMetamaskNotifications, _NotificationServicesController_setIsFetchingMetamaskNotifications, _NotificationServicesController_setIsCheckingAccountsPresence, _NotificationServicesController_updateUpdatingAccountsState, _NotificationServicesController_clearUpdatingAccountsState;
|
|
40
40
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
41
41
|
exports.defaultState = void 0;
|
|
42
42
|
const base_controller_1 = require("@metamask/base-controller");
|
|
@@ -130,26 +130,20 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
130
130
|
state: { ...exports.defaultState, ...state },
|
|
131
131
|
});
|
|
132
132
|
_NotificationServicesController_instances.add(this);
|
|
133
|
-
// Temporary boolean as push notifications are not yet enabled on mobile
|
|
134
|
-
_NotificationServicesController_isPushIntegrated.set(this, true);
|
|
135
|
-
// Flag to check is notifications have been setup when the browser/extension is initialized.
|
|
136
|
-
// We want to re-initialize push notifications when the browser/extension is refreshed
|
|
137
|
-
// To ensure we subscribe to the most up-to-date notifications
|
|
138
|
-
_NotificationServicesController_isPushNotificationsSetup.set(this, false);
|
|
139
|
-
_NotificationServicesController_isUnlocked.set(this, false);
|
|
140
133
|
_NotificationServicesController_keyringController.set(this, {
|
|
134
|
+
isUnlocked: false,
|
|
141
135
|
setupLockedStateSubscriptions: (onUnlock) => {
|
|
142
136
|
const { isUnlocked } = this.messagingSystem.call('KeyringController:getState');
|
|
143
|
-
|
|
137
|
+
__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked = isUnlocked;
|
|
144
138
|
this.messagingSystem.subscribe('KeyringController:unlock', () => {
|
|
145
|
-
|
|
139
|
+
__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked = true;
|
|
146
140
|
// messaging system cannot await promises
|
|
147
141
|
// we don't need to wait for a result on this.
|
|
148
142
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
149
143
|
onUnlock();
|
|
150
144
|
});
|
|
151
145
|
this.messagingSystem.subscribe('KeyringController:lock', () => {
|
|
152
|
-
|
|
146
|
+
__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked = false;
|
|
153
147
|
});
|
|
154
148
|
},
|
|
155
149
|
});
|
|
@@ -176,13 +170,14 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
176
170
|
},
|
|
177
171
|
});
|
|
178
172
|
_NotificationServicesController_pushNotifications.set(this, {
|
|
173
|
+
// Flag to check is notifications have been setup when the browser/extension is initialized.
|
|
174
|
+
// We want to re-initialize push notifications when the browser/extension is refreshed
|
|
175
|
+
// To ensure we subscribe to the most up-to-date notifications
|
|
176
|
+
isSetup: false,
|
|
179
177
|
subscribeToPushNotifications: async () => {
|
|
180
178
|
await this.messagingSystem.call('NotificationServicesPushController:subscribeToPushNotifications');
|
|
181
179
|
},
|
|
182
180
|
enablePushNotifications: async (UUIDs) => {
|
|
183
|
-
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
184
|
-
return;
|
|
185
|
-
}
|
|
186
181
|
try {
|
|
187
182
|
await this.messagingSystem.call('NotificationServicesPushController:enablePushNotifications', UUIDs);
|
|
188
183
|
}
|
|
@@ -190,21 +185,15 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
190
185
|
loglevel_1.default.error('Silently failed to enable push notifications', e);
|
|
191
186
|
}
|
|
192
187
|
},
|
|
193
|
-
disablePushNotifications: async (
|
|
194
|
-
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
195
|
-
return;
|
|
196
|
-
}
|
|
188
|
+
disablePushNotifications: async () => {
|
|
197
189
|
try {
|
|
198
|
-
await this.messagingSystem.call('NotificationServicesPushController:disablePushNotifications'
|
|
190
|
+
await this.messagingSystem.call('NotificationServicesPushController:disablePushNotifications');
|
|
199
191
|
}
|
|
200
192
|
catch (e) {
|
|
201
193
|
loglevel_1.default.error('Silently failed to disable push notifications', e);
|
|
202
194
|
}
|
|
203
195
|
},
|
|
204
196
|
updatePushNotifications: async (UUIDs) => {
|
|
205
|
-
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
197
|
try {
|
|
209
198
|
await this.messagingSystem.call('NotificationServicesPushController:updateTriggerPushNotifications', UUIDs);
|
|
210
199
|
}
|
|
@@ -213,37 +202,33 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
213
202
|
}
|
|
214
203
|
},
|
|
215
204
|
subscribe: () => {
|
|
216
|
-
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
217
|
-
return;
|
|
218
|
-
}
|
|
219
205
|
this.messagingSystem.subscribe('NotificationServicesPushController:onNewNotifications', (notification) => {
|
|
220
206
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
221
207
|
this.updateMetamaskNotificationsList(notification);
|
|
222
208
|
});
|
|
223
209
|
},
|
|
224
210
|
initializePushNotifications: async () => {
|
|
225
|
-
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
226
|
-
return;
|
|
227
|
-
}
|
|
228
211
|
if (!this.state.isNotificationServicesEnabled) {
|
|
229
212
|
return;
|
|
230
213
|
}
|
|
231
|
-
if (__classPrivateFieldGet(this,
|
|
214
|
+
if (__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isSetup) {
|
|
232
215
|
return;
|
|
233
216
|
}
|
|
234
217
|
// If wallet is unlocked, we can create a fresh push subscription
|
|
235
218
|
// Otherwise we can subscribe to original subscription
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return;
|
|
219
|
+
try {
|
|
220
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked) {
|
|
221
|
+
throw new Error('Keyring is locked');
|
|
240
222
|
}
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
__classPrivateFieldSet(this, _NotificationServicesController_isPushNotificationsSetup, true, "f");
|
|
223
|
+
await this.enablePushNotifications();
|
|
224
|
+
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isSetup = true;
|
|
244
225
|
}
|
|
245
|
-
|
|
246
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f")
|
|
226
|
+
catch {
|
|
227
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f")
|
|
228
|
+
.subscribeToPushNotifications()
|
|
229
|
+
.catch(() => {
|
|
230
|
+
// do nothing
|
|
231
|
+
});
|
|
247
232
|
}
|
|
248
233
|
},
|
|
249
234
|
});
|
|
@@ -258,7 +243,9 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
258
243
|
listAccounts: async () => {
|
|
259
244
|
// Get previous and current account sets
|
|
260
245
|
const nonChecksumAccounts = await this.messagingSystem.call('KeyringController:getAccounts');
|
|
261
|
-
const accounts = nonChecksumAccounts
|
|
246
|
+
const accounts = nonChecksumAccounts
|
|
247
|
+
.map((a) => (0, controller_utils_1.toChecksumHexAddress)(a))
|
|
248
|
+
.filter((a) => (0, controller_utils_1.isValidHexAddress)(a));
|
|
262
249
|
const currentAccountsSet = new Set(accounts);
|
|
263
250
|
const prevAccountsSet = new Set(this.state.subscriptionAccountsSeen);
|
|
264
251
|
// Invalid value you cannot have zero accounts
|
|
@@ -289,7 +276,8 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
289
276
|
* @returns result from list accounts
|
|
290
277
|
*/
|
|
291
278
|
initialize: async () => {
|
|
292
|
-
if (__classPrivateFieldGet(this,
|
|
279
|
+
if (__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked &&
|
|
280
|
+
!__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup) {
|
|
293
281
|
await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
294
282
|
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup = true;
|
|
295
283
|
}
|
|
@@ -317,7 +305,6 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
317
305
|
},
|
|
318
306
|
});
|
|
319
307
|
_NotificationServicesController_featureAnnouncementEnv.set(this, void 0);
|
|
320
|
-
__classPrivateFieldSet(this, _NotificationServicesController_isPushIntegrated, env.isPushIntegrated ?? true, "f");
|
|
321
308
|
__classPrivateFieldSet(this, _NotificationServicesController_featureAnnouncementEnv, env.featureAnnouncements, "f");
|
|
322
309
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_registerMessageHandlers).call(this);
|
|
323
310
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearLoadingStates).call(this);
|
|
@@ -333,15 +320,22 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
333
320
|
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").subscribe();
|
|
334
321
|
}
|
|
335
322
|
/**
|
|
336
|
-
*
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
323
|
+
* Public method to expose enabling push notifications
|
|
324
|
+
*/
|
|
325
|
+
async enablePushNotifications() {
|
|
326
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_enableAuth).call(this);
|
|
327
|
+
const storage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
328
|
+
if (!storage) {
|
|
329
|
+
throw new Error('Unable to get triggers');
|
|
330
|
+
}
|
|
331
|
+
const uuids = Utils.getAllUUIDs(storage);
|
|
332
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(uuids);
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Public method to expose disabling push notifications
|
|
342
336
|
*/
|
|
343
|
-
|
|
344
|
-
|
|
337
|
+
async disablePushNotifications() {
|
|
338
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications();
|
|
345
339
|
}
|
|
346
340
|
async checkAccountsPresence(accounts) {
|
|
347
341
|
try {
|
|
@@ -413,9 +407,12 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
413
407
|
// Create the triggers
|
|
414
408
|
const triggers = Utils.traverseUserStorageTriggers(userStorage);
|
|
415
409
|
await OnChainNotifications.createOnChainTriggers(userStorage, storageKey, bearerToken, triggers);
|
|
416
|
-
// Create push notifications triggers
|
|
410
|
+
// Create push notifications triggers in background
|
|
417
411
|
const allUUIDS = Utils.getAllUUIDs(userStorage);
|
|
418
|
-
|
|
412
|
+
// We do not want to wait for this request as it may take a while (e.g. for Firebase to setup)
|
|
413
|
+
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(allUUIDS).catch(() => {
|
|
414
|
+
// Do Nothing
|
|
415
|
+
});
|
|
419
416
|
// Write the new userStorage (triggers are now "enabled")
|
|
420
417
|
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
421
418
|
// Update the state of the controller
|
|
@@ -447,10 +444,7 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
447
444
|
async enableMetamaskNotifications() {
|
|
448
445
|
try {
|
|
449
446
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
450
|
-
|
|
451
|
-
if (!isSignedIn) {
|
|
452
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").signIn();
|
|
453
|
-
}
|
|
447
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_enableAuth).call(this);
|
|
454
448
|
await this.createOnChainTriggers();
|
|
455
449
|
}
|
|
456
450
|
catch (e) {
|
|
@@ -470,30 +464,25 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
470
464
|
* @throws {Error} If the user is not authenticated or if there is an error during the process.
|
|
471
465
|
*/
|
|
472
466
|
async disableNotificationServices() {
|
|
467
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
468
|
+
// Attempt Disable Push Notifications
|
|
473
469
|
try {
|
|
474
|
-
__classPrivateFieldGet(this,
|
|
475
|
-
// Disable Push Notifications
|
|
476
|
-
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
477
|
-
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
478
|
-
const UUIDs = Utils.getAllUUIDs(userStorage);
|
|
479
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications(UUIDs);
|
|
480
|
-
const snapNotifications = this.state.metamaskNotificationsList.filter((notification) => notification.type === notification_schema_1.TRIGGER_TYPES.SNAP);
|
|
481
|
-
// Clear Notification States (toggles and list)
|
|
482
|
-
this.update((state) => {
|
|
483
|
-
state.isNotificationServicesEnabled = false;
|
|
484
|
-
state.isFeatureAnnouncementsEnabled = false;
|
|
485
|
-
// reassigning the notifications list with just snaps
|
|
486
|
-
// since the disable shouldn't affect snaps notifications
|
|
487
|
-
state.metamaskNotificationsList = snapNotifications;
|
|
488
|
-
});
|
|
489
|
-
}
|
|
490
|
-
catch (e) {
|
|
491
|
-
loglevel_1.default.error('Unable to disable notifications', e);
|
|
492
|
-
throw new Error('Unable to disable notifications');
|
|
470
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications();
|
|
493
471
|
}
|
|
494
|
-
|
|
495
|
-
|
|
472
|
+
catch {
|
|
473
|
+
// Do nothing
|
|
496
474
|
}
|
|
475
|
+
// Update State: remove non-permitted notifications & disable flags
|
|
476
|
+
const snapNotifications = this.state.metamaskNotificationsList.filter((notification) => notification.type === notification_schema_1.TRIGGER_TYPES.SNAP);
|
|
477
|
+
this.update((state) => {
|
|
478
|
+
state.isNotificationServicesEnabled = false;
|
|
479
|
+
state.isFeatureAnnouncementsEnabled = false;
|
|
480
|
+
// reassigning the notifications list with just snaps
|
|
481
|
+
// since the disable shouldn't affect snaps notifications
|
|
482
|
+
state.metamaskNotificationsList = snapNotifications;
|
|
483
|
+
});
|
|
484
|
+
// Finish Updating State
|
|
485
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
497
486
|
}
|
|
498
487
|
/**
|
|
499
488
|
* Deletes on-chain triggers associated with a specific account.
|
|
@@ -526,8 +515,9 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
526
515
|
}
|
|
527
516
|
// Delete these UUIDs (Mutates User Storage)
|
|
528
517
|
await OnChainNotifications.deleteOnChainTriggers(userStorage, storageKey, bearerToken, UUIDs);
|
|
529
|
-
//
|
|
530
|
-
|
|
518
|
+
// Update Push Notifications with new list of IDs
|
|
519
|
+
const remainingTriggerIds = Utils.getAllUUIDs(userStorage);
|
|
520
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").updatePushNotifications(remainingTriggerIds);
|
|
531
521
|
// Update User Storage
|
|
532
522
|
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
533
523
|
return userStorage;
|
|
@@ -818,10 +808,9 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
818
808
|
}
|
|
819
809
|
}
|
|
820
810
|
}
|
|
821
|
-
|
|
811
|
+
_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() {
|
|
822
812
|
this.messagingSystem.registerActionHandler(`${controllerName}:updateMetamaskNotificationsList`, this.updateMetamaskNotificationsList.bind(this));
|
|
823
813
|
this.messagingSystem.registerActionHandler(`${controllerName}:disableNotificationServices`, this.disableNotificationServices.bind(this));
|
|
824
|
-
this.messagingSystem.registerActionHandler(`${controllerName}:selectIsNotificationServicesEnabled`, this.selectIsNotificationServicesEnabled.bind(this));
|
|
825
814
|
this.messagingSystem.registerActionHandler(`${controllerName}:getNotificationsByType`, this.getNotificationsByType.bind(this));
|
|
826
815
|
this.messagingSystem.registerActionHandler(`${controllerName}:deleteNotificationsById`, this.deleteNotificationsById.bind(this));
|
|
827
816
|
}, _NotificationServicesController_clearLoadingStates = function _NotificationServicesController_clearLoadingStates() {
|
|
@@ -838,6 +827,11 @@ _NotificationServicesController_isPushIntegrated = new WeakMap(), _NotificationS
|
|
|
838
827
|
});
|
|
839
828
|
throw new Error('User is not signed in.');
|
|
840
829
|
}
|
|
830
|
+
}, _NotificationServicesController_enableAuth = async function _NotificationServicesController_enableAuth() {
|
|
831
|
+
const isSignedIn = __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").isSignedIn();
|
|
832
|
+
if (!isSignedIn) {
|
|
833
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").signIn();
|
|
834
|
+
}
|
|
841
835
|
}, _NotificationServicesController_getValidStorageKeyAndBearerToken = async function _NotificationServicesController_getValidStorageKeyAndBearerToken() {
|
|
842
836
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertAuthEnabled).call(this);
|
|
843
837
|
const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken();
|
|
@@ -867,6 +861,7 @@ async function _NotificationServicesController_getUserStorage() {
|
|
|
867
861
|
}
|
|
868
862
|
try {
|
|
869
863
|
const userStorage = JSON.parse(userStorageString);
|
|
864
|
+
Utils.cleanUserStorage(userStorage);
|
|
870
865
|
return userStorage;
|
|
871
866
|
}
|
|
872
867
|
catch {
|