@metamask-previews/notification-services-controller 0.21.0-preview-dbdf1da → 1.0.0-preview-30bb9023
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 +22 -3
- package/README.md +35 -1
- package/dist/NotificationServicesController/NotificationServicesController.cjs +66 -77
- 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 +66 -77
- 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/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/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/NotificationServicesPushController/NotificationServicesPushController.cjs +95 -46
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts +17 -17
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +17 -17
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +96 -47
- 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__/mockResponse.mjs.map → mocks/mockResponse.cjs.map} +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +1 -0
- package/dist/NotificationServicesPushController/services/services.cjs +9 -28
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +2 -17
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.d.mts +2 -17
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -1
- package/dist/NotificationServicesPushController/services/services.mjs +8 -26
- 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 +21 -11
- 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__/mockAddresses.cjs +0 -6
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.cjs.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.d.cts +0 -3
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.d.cts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.d.mts +0 -3
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.d.mts.map +0 -1
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.mjs +0 -3
- package/dist/NotificationServicesController/__fixtures__/mockAddresses.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__/mockServices.cjs +0 -19
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts +0 -8
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts +0 -8
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs +0 -19
- 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.cjs +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-notification-user-storage.mjs +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.cjs +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.d.cts +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.d.mts +0 -0
- /package/dist/NotificationServicesPushController/{__fixtures__ → mocks}/mockResponse.mjs +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- added new public methods `enablePushNotifications` and `disablePushNotification` on `NotificationServicesController` ([#5120](https://github.com/MetaMask/core/pull/5120))
|
|
15
|
+
- added `isPushEnabled` and `isUpdatingFCMToken` to `NotificationServicesPushController` state ([#5120](https://github.com/MetaMask/core/pull/5120))
|
|
16
|
+
- added `/push-services/web` subpath export to make it easier to import web helpers ([#5120](https://github.com/MetaMask/core/pull/5120))
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- **BREAKING**: updated `NotificationServicesPushController` constructor config to require a push interface ([#5120](https://github.com/MetaMask/core/pull/5120))
|
|
21
|
+
- Optimized API calls for creating push notification links ([#5358](https://github.com/MetaMask/core/pull/5358))
|
|
22
|
+
- Bump `@metamask/utils` from `^11.1.0` to `^11.2.0` ([#5301](https://github.com/MetaMask/core/pull/5301))
|
|
23
|
+
|
|
24
|
+
### Fixed
|
|
25
|
+
|
|
26
|
+
- only allow hex addresses when creating notifications ([#5343](https://github.com/MetaMask/core/pull/5343))
|
|
27
|
+
|
|
10
28
|
## [0.21.0]
|
|
11
29
|
|
|
12
30
|
### Added
|
|
@@ -48,7 +66,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
48
66
|
|
|
49
67
|
### Changed
|
|
50
68
|
|
|
51
|
-
-
|
|
69
|
+
- Bump `firebase` from `^10.11.0` to `^11.2.0` ([#5196](https://github.com/MetaMask/core/pull/5196))
|
|
52
70
|
|
|
53
71
|
## [0.16.0]
|
|
54
72
|
|
|
@@ -93,7 +111,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
93
111
|
|
|
94
112
|
### Fixed
|
|
95
113
|
|
|
96
|
-
- fix: allow snap notifications to be
|
|
114
|
+
- fix: allow snap notifications to be visible when controller is disabled ([#4890](https://github.com/MetaMask/core/pull/4890))
|
|
97
115
|
- 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
116
|
|
|
99
117
|
## [0.12.0]
|
|
@@ -319,7 +337,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
319
337
|
|
|
320
338
|
- Initial release
|
|
321
339
|
|
|
322
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.
|
|
340
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@1.0.0...HEAD
|
|
341
|
+
[1.0.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.21.0...@metamask/notification-services-controller@1.0.0
|
|
323
342
|
[0.21.0]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.20.1...@metamask/notification-services-controller@0.21.0
|
|
324
343
|
[0.20.1]: https://github.com/MetaMask/core/compare/@metamask/notification-services-controller@0.20.0...@metamask/notification-services-controller@0.20.1
|
|
325
344
|
[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
|
});
|
|
@@ -291,7 +276,8 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
291
276
|
* @returns result from list accounts
|
|
292
277
|
*/
|
|
293
278
|
initialize: async () => {
|
|
294
|
-
if (__classPrivateFieldGet(this,
|
|
279
|
+
if (__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked &&
|
|
280
|
+
!__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup) {
|
|
295
281
|
await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
296
282
|
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup = true;
|
|
297
283
|
}
|
|
@@ -319,7 +305,6 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
319
305
|
},
|
|
320
306
|
});
|
|
321
307
|
_NotificationServicesController_featureAnnouncementEnv.set(this, void 0);
|
|
322
|
-
__classPrivateFieldSet(this, _NotificationServicesController_isPushIntegrated, env.isPushIntegrated ?? true, "f");
|
|
323
308
|
__classPrivateFieldSet(this, _NotificationServicesController_featureAnnouncementEnv, env.featureAnnouncements, "f");
|
|
324
309
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_registerMessageHandlers).call(this);
|
|
325
310
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearLoadingStates).call(this);
|
|
@@ -335,15 +320,22 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
335
320
|
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").subscribe();
|
|
336
321
|
}
|
|
337
322
|
/**
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
* This method directly returns the boolean value of `isMetamaskNotificationsEnabled`
|
|
341
|
-
* from the controller's state, indicating whether MetaMask notifications are currently enabled.
|
|
342
|
-
*
|
|
343
|
-
* @returns The enabled state of MetaMask notifications.
|
|
323
|
+
* Public method to expose enabling push notifications
|
|
344
324
|
*/
|
|
345
|
-
|
|
346
|
-
|
|
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
|
|
336
|
+
*/
|
|
337
|
+
async disablePushNotifications() {
|
|
338
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications();
|
|
347
339
|
}
|
|
348
340
|
async checkAccountsPresence(accounts) {
|
|
349
341
|
try {
|
|
@@ -449,10 +441,7 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
449
441
|
async enableMetamaskNotifications() {
|
|
450
442
|
try {
|
|
451
443
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
452
|
-
|
|
453
|
-
if (!isSignedIn) {
|
|
454
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").signIn();
|
|
455
|
-
}
|
|
444
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_enableAuth).call(this);
|
|
456
445
|
await this.createOnChainTriggers();
|
|
457
446
|
}
|
|
458
447
|
catch (e) {
|
|
@@ -472,30 +461,25 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
472
461
|
* @throws {Error} If the user is not authenticated or if there is an error during the process.
|
|
473
462
|
*/
|
|
474
463
|
async disableNotificationServices() {
|
|
464
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
465
|
+
// Attempt Disable Push Notifications
|
|
475
466
|
try {
|
|
476
|
-
__classPrivateFieldGet(this,
|
|
477
|
-
// Disable Push Notifications
|
|
478
|
-
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
479
|
-
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
480
|
-
const UUIDs = Utils.getAllUUIDs(userStorage);
|
|
481
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications(UUIDs);
|
|
482
|
-
const snapNotifications = this.state.metamaskNotificationsList.filter((notification) => notification.type === notification_schema_1.TRIGGER_TYPES.SNAP);
|
|
483
|
-
// Clear Notification States (toggles and list)
|
|
484
|
-
this.update((state) => {
|
|
485
|
-
state.isNotificationServicesEnabled = false;
|
|
486
|
-
state.isFeatureAnnouncementsEnabled = false;
|
|
487
|
-
// reassigning the notifications list with just snaps
|
|
488
|
-
// since the disable shouldn't affect snaps notifications
|
|
489
|
-
state.metamaskNotificationsList = snapNotifications;
|
|
490
|
-
});
|
|
467
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications();
|
|
491
468
|
}
|
|
492
|
-
catch
|
|
493
|
-
|
|
494
|
-
throw new Error('Unable to disable notifications');
|
|
495
|
-
}
|
|
496
|
-
finally {
|
|
497
|
-
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
469
|
+
catch {
|
|
470
|
+
// Do nothing
|
|
498
471
|
}
|
|
472
|
+
// Update State: remove non-permitted notifications & disable flags
|
|
473
|
+
const snapNotifications = this.state.metamaskNotificationsList.filter((notification) => notification.type === notification_schema_1.TRIGGER_TYPES.SNAP);
|
|
474
|
+
this.update((state) => {
|
|
475
|
+
state.isNotificationServicesEnabled = false;
|
|
476
|
+
state.isFeatureAnnouncementsEnabled = false;
|
|
477
|
+
// reassigning the notifications list with just snaps
|
|
478
|
+
// since the disable shouldn't affect snaps notifications
|
|
479
|
+
state.metamaskNotificationsList = snapNotifications;
|
|
480
|
+
});
|
|
481
|
+
// Finish Updating State
|
|
482
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
499
483
|
}
|
|
500
484
|
/**
|
|
501
485
|
* Deletes on-chain triggers associated with a specific account.
|
|
@@ -528,8 +512,9 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
528
512
|
}
|
|
529
513
|
// Delete these UUIDs (Mutates User Storage)
|
|
530
514
|
await OnChainNotifications.deleteOnChainTriggers(userStorage, storageKey, bearerToken, UUIDs);
|
|
531
|
-
//
|
|
532
|
-
|
|
515
|
+
// Update Push Notifications with new list of IDs
|
|
516
|
+
const remainingTriggerIds = Utils.getAllUUIDs(userStorage);
|
|
517
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").updatePushNotifications(remainingTriggerIds);
|
|
533
518
|
// Update User Storage
|
|
534
519
|
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
535
520
|
return userStorage;
|
|
@@ -820,10 +805,9 @@ class NotificationServicesController extends base_controller_1.BaseController {
|
|
|
820
805
|
}
|
|
821
806
|
}
|
|
822
807
|
}
|
|
823
|
-
|
|
808
|
+
_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() {
|
|
824
809
|
this.messagingSystem.registerActionHandler(`${controllerName}:updateMetamaskNotificationsList`, this.updateMetamaskNotificationsList.bind(this));
|
|
825
810
|
this.messagingSystem.registerActionHandler(`${controllerName}:disableNotificationServices`, this.disableNotificationServices.bind(this));
|
|
826
|
-
this.messagingSystem.registerActionHandler(`${controllerName}:selectIsNotificationServicesEnabled`, this.selectIsNotificationServicesEnabled.bind(this));
|
|
827
811
|
this.messagingSystem.registerActionHandler(`${controllerName}:getNotificationsByType`, this.getNotificationsByType.bind(this));
|
|
828
812
|
this.messagingSystem.registerActionHandler(`${controllerName}:deleteNotificationsById`, this.deleteNotificationsById.bind(this));
|
|
829
813
|
}, _NotificationServicesController_clearLoadingStates = function _NotificationServicesController_clearLoadingStates() {
|
|
@@ -840,6 +824,11 @@ _NotificationServicesController_isPushIntegrated = new WeakMap(), _NotificationS
|
|
|
840
824
|
});
|
|
841
825
|
throw new Error('User is not signed in.');
|
|
842
826
|
}
|
|
827
|
+
}, _NotificationServicesController_enableAuth = async function _NotificationServicesController_enableAuth() {
|
|
828
|
+
const isSignedIn = __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").isSignedIn();
|
|
829
|
+
if (!isSignedIn) {
|
|
830
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").signIn();
|
|
831
|
+
}
|
|
843
832
|
}, _NotificationServicesController_getValidStorageKeyAndBearerToken = async function _NotificationServicesController_getValidStorageKeyAndBearerToken() {
|
|
844
833
|
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertAuthEnabled).call(this);
|
|
845
834
|
const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken();
|