@metamask-previews/notification-services-controller 27.0.2-preview-6eff555ee → 28.0.0-preview-0a30e47
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 -1
- package/dist/NotificationServicesController/{NotificationServicesController-method-action-types.d.mts → NotificationServicesController-method-action-types.d.ts} +2 -2
- package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.ts.map +1 -0
- package/dist/NotificationServicesController/{NotificationServicesController-method-action-types.mjs → NotificationServicesController-method-action-types.js} +1 -1
- package/dist/NotificationServicesController/NotificationServicesController-method-action-types.js.map +1 -0
- package/dist/NotificationServicesController/{NotificationServicesController.d.cts → NotificationServicesController.d.ts} +15 -15
- package/dist/NotificationServicesController/NotificationServicesController.d.ts.map +1 -0
- package/dist/NotificationServicesController/{NotificationServicesController.mjs → NotificationServicesController.js} +411 -386
- package/dist/NotificationServicesController/NotificationServicesController.js.map +1 -0
- package/dist/NotificationServicesController/constants/index.d.ts +2 -0
- package/dist/NotificationServicesController/constants/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/constants/index.js +2 -0
- package/dist/NotificationServicesController/constants/index.js.map +1 -0
- package/dist/NotificationServicesController/constants/{notification-schema.d.cts → notification-schema.d.ts} +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.ts.map +1 -0
- package/dist/NotificationServicesController/constants/{notification-schema.mjs → notification-schema.js} +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.js.map +1 -0
- package/dist/NotificationServicesController/{index.d.cts → index.d.ts} +14 -14
- package/dist/NotificationServicesController/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/index.js +13 -0
- package/dist/NotificationServicesController/index.js.map +1 -0
- package/dist/NotificationServicesController/mocks/index.d.ts +5 -0
- package/dist/NotificationServicesController/mocks/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/mocks/index.js +5 -0
- package/dist/NotificationServicesController/mocks/index.js.map +1 -0
- package/dist/NotificationServicesController/mocks/{mock-feature-announcements.d.cts → mock-feature-announcements.d.ts} +3 -3
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.ts.map +1 -0
- package/dist/NotificationServicesController/mocks/{mock-feature-announcements.mjs → mock-feature-announcements.js} +2 -2
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.js.map +1 -0
- package/dist/NotificationServicesController/mocks/{mock-raw-notifications.d.cts → mock-raw-notifications.d.ts} +2 -2
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.ts.map +1 -0
- package/dist/NotificationServicesController/mocks/{mock-raw-notifications.mjs → mock-raw-notifications.js} +2 -2
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.js.map +1 -0
- package/dist/NotificationServicesController/mocks/{mock-snap-notification.d.cts → mock-snap-notification.d.ts} +2 -2
- package/dist/NotificationServicesController/mocks/mock-snap-notification.d.ts.map +1 -0
- package/dist/NotificationServicesController/mocks/{mock-snap-notification.mjs → mock-snap-notification.js} +2 -2
- package/dist/NotificationServicesController/mocks/mock-snap-notification.js.map +1 -0
- package/dist/NotificationServicesController/mocks/{mockResponses.d.cts → mockResponses.d.ts} +3 -3
- package/dist/NotificationServicesController/mocks/mockResponses.d.ts.map +1 -0
- package/dist/NotificationServicesController/mocks/{mockResponses.mjs → mockResponses.js} +6 -6
- package/dist/NotificationServicesController/mocks/mockResponses.js.map +1 -0
- package/dist/NotificationServicesController/processors/index.d.ts +4 -0
- package/dist/NotificationServicesController/processors/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/processors/index.js +4 -0
- package/dist/NotificationServicesController/processors/index.js.map +1 -0
- package/dist/NotificationServicesController/processors/{process-api-notifications.d.cts → process-api-notifications.d.ts} +3 -3
- package/dist/NotificationServicesController/processors/process-api-notifications.d.ts.map +1 -0
- package/dist/NotificationServicesController/processors/{process-api-notifications.mjs → process-api-notifications.js} +3 -3
- package/dist/NotificationServicesController/processors/process-api-notifications.js.map +1 -0
- package/dist/NotificationServicesController/processors/{process-feature-announcement.d.mts → process-feature-announcement.d.ts} +3 -3
- package/dist/NotificationServicesController/processors/process-feature-announcement.d.ts.map +1 -0
- package/dist/NotificationServicesController/processors/{process-feature-announcement.mjs → process-feature-announcement.js} +3 -3
- package/dist/NotificationServicesController/processors/process-feature-announcement.js.map +1 -0
- package/dist/NotificationServicesController/processors/{process-notifications.d.cts → process-notifications.d.ts} +2 -2
- package/dist/NotificationServicesController/processors/process-notifications.d.ts.map +1 -0
- package/dist/NotificationServicesController/processors/{process-notifications.mjs → process-notifications.js} +5 -5
- package/dist/NotificationServicesController/processors/process-notifications.js.map +1 -0
- package/dist/NotificationServicesController/processors/{process-snap-notifications.d.cts → process-snap-notifications.d.ts} +3 -3
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.ts.map +1 -0
- package/dist/NotificationServicesController/processors/{process-snap-notifications.mjs → process-snap-notifications.js} +3 -3
- package/dist/NotificationServicesController/processors/process-snap-notifications.js.map +1 -0
- package/dist/NotificationServicesController/services/{api-notifications.d.cts → api-notifications.d.ts} +2 -2
- package/dist/NotificationServicesController/services/api-notifications.d.ts.map +1 -0
- package/dist/NotificationServicesController/services/{api-notifications.mjs → api-notifications.js} +5 -12
- package/dist/NotificationServicesController/services/api-notifications.js.map +1 -0
- package/dist/NotificationServicesController/services/{feature-announcements.d.mts → feature-announcements.d.ts} +4 -4
- package/dist/NotificationServicesController/services/feature-announcements.d.ts.map +1 -0
- package/dist/NotificationServicesController/services/{feature-announcements.mjs → feature-announcements.js} +5 -5
- package/dist/NotificationServicesController/services/feature-announcements.js.map +1 -0
- package/dist/NotificationServicesController/services/{notification-config-cache.d.mts → notification-config-cache.d.ts} +1 -1
- package/dist/NotificationServicesController/services/notification-config-cache.d.ts.map +1 -0
- package/dist/NotificationServicesController/services/notification-config-cache.js +43 -0
- package/dist/NotificationServicesController/services/notification-config-cache.js.map +1 -0
- package/dist/NotificationServicesController/services/{perp-notifications.d.cts → perp-notifications.d.ts} +2 -2
- package/dist/NotificationServicesController/services/perp-notifications.d.ts.map +1 -0
- package/dist/NotificationServicesController/services/{perp-notifications.mjs → perp-notifications.js} +2 -2
- package/dist/NotificationServicesController/services/perp-notifications.js.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/{feature-announcement.d.cts → feature-announcement.d.ts} +3 -3
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js +2 -0
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.d.ts +4 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.js +2 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.js.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/{type-feature-announcement.d.cts → type-feature-announcement.d.ts} +3 -3
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js +2 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/{type-links.d.cts → type-links.d.ts} +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-links.js +2 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-links.js.map +1 -0
- package/dist/NotificationServicesController/types/index.d.ts +6 -0
- package/dist/NotificationServicesController/types/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/index.js +2 -0
- package/dist/NotificationServicesController/types/index.js.map +1 -0
- package/dist/NotificationServicesController/types/notification/index.d.ts +2 -0
- package/dist/NotificationServicesController/types/notification/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/notification/index.js +2 -0
- package/dist/NotificationServicesController/types/notification/index.js.map +1 -0
- package/dist/NotificationServicesController/types/notification/{notification.d.cts → notification.d.ts} +5 -5
- package/dist/NotificationServicesController/types/notification/notification.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/notification/notification.js +2 -0
- package/dist/NotificationServicesController/types/notification/notification.js.map +1 -0
- package/dist/NotificationServicesController/types/notification-api/index.d.ts +3 -0
- package/dist/NotificationServicesController/types/notification-api/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/notification-api/index.js +2 -0
- package/dist/NotificationServicesController/types/notification-api/index.js.map +1 -0
- package/dist/NotificationServicesController/types/notification-api/{notification-api.d.mts → notification-api.d.ts} +4 -4
- package/dist/NotificationServicesController/types/notification-api/notification-api.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/notification-api/notification-api.js +2 -0
- package/dist/NotificationServicesController/types/notification-api/notification-api.js.map +1 -0
- package/dist/NotificationServicesController/types/notification-api/{schema.d.cts → schema.d.ts} +1 -1
- package/dist/NotificationServicesController/types/notification-api/schema.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/notification-api/{schema.mjs → schema.js} +1 -1
- package/dist/NotificationServicesController/types/notification-api/schema.js.map +1 -0
- package/dist/NotificationServicesController/types/perps/index.d.ts +2 -0
- package/dist/NotificationServicesController/types/perps/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/perps/index.js +2 -0
- package/dist/NotificationServicesController/types/perps/index.js.map +1 -0
- package/dist/NotificationServicesController/types/perps/perp-types.d.ts +3 -0
- package/dist/NotificationServicesController/types/perps/perp-types.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/perps/perp-types.js +2 -0
- package/dist/NotificationServicesController/types/perps/perp-types.js.map +1 -0
- package/dist/NotificationServicesController/types/perps/{schema.d.cts → schema.d.ts} +1 -1
- package/dist/NotificationServicesController/types/perps/schema.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/perps/{schema.mjs → schema.js} +1 -1
- package/dist/NotificationServicesController/types/perps/schema.js.map +1 -0
- package/dist/NotificationServicesController/types/snaps/index.d.ts +2 -0
- package/dist/NotificationServicesController/types/snaps/index.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/index.js +2 -0
- package/dist/NotificationServicesController/types/snaps/index.js.map +1 -0
- package/dist/NotificationServicesController/types/snaps/{snaps.d.cts → snaps.d.ts} +2 -2
- package/dist/NotificationServicesController/types/snaps/snaps.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/snaps/snaps.js +2 -0
- package/dist/NotificationServicesController/types/snaps/snaps.js.map +1 -0
- package/dist/NotificationServicesController/types/{type-utils.d.cts → type-utils.d.ts} +1 -1
- package/dist/NotificationServicesController/types/type-utils.d.ts.map +1 -0
- package/dist/NotificationServicesController/types/type-utils.js +2 -0
- package/dist/NotificationServicesController/types/type-utils.js.map +1 -0
- package/dist/NotificationServicesController/utils/{get-notification-subtype.d.cts → get-notification-subtype.d.ts} +2 -2
- package/dist/NotificationServicesController/utils/get-notification-subtype.d.ts.map +1 -0
- package/dist/NotificationServicesController/utils/{get-notification-subtype.mjs → get-notification-subtype.js} +3 -3
- package/dist/NotificationServicesController/utils/get-notification-subtype.js.map +1 -0
- package/dist/NotificationServicesController/utils/{isVersionInBounds.d.cts → isVersionInBounds.d.ts} +1 -1
- package/dist/NotificationServicesController/utils/isVersionInBounds.d.ts.map +1 -0
- package/dist/NotificationServicesController/utils/{isVersionInBounds.mjs → isVersionInBounds.js} +2 -2
- package/dist/NotificationServicesController/utils/isVersionInBounds.js.map +1 -0
- package/dist/NotificationServicesController/utils/{should-auto-expire.d.cts → should-auto-expire.d.ts} +1 -1
- package/dist/NotificationServicesController/utils/should-auto-expire.d.ts.map +1 -0
- package/dist/NotificationServicesController/utils/{should-auto-expire.mjs → should-auto-expire.js} +1 -1
- package/dist/NotificationServicesController/utils/should-auto-expire.js.map +1 -0
- package/dist/NotificationServicesController/utils/{utils.d.cts → utils.d.ts} +1 -1
- package/dist/NotificationServicesController/utils/utils.d.ts.map +1 -0
- package/dist/NotificationServicesController/utils/{utils.mjs → utils.js} +1 -1
- package/dist/NotificationServicesController/utils/utils.js.map +1 -0
- package/dist/NotificationServicesPushController/{NotificationServicesPushController-method-action-types.d.cts → NotificationServicesPushController-method-action-types.d.ts} +2 -2
- package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/{NotificationServicesPushController-method-action-types.mjs → NotificationServicesPushController-method-action-types.js} +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.js.map +1 -0
- package/dist/NotificationServicesPushController/{NotificationServicesPushController.d.cts → NotificationServicesPushController.d.ts} +9 -9
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.js +326 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.js.map +1 -0
- package/dist/NotificationServicesPushController/{index.d.cts → index.d.ts} +9 -9
- package/dist/NotificationServicesPushController/index.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/index.js +8 -0
- package/dist/NotificationServicesPushController/index.js.map +1 -0
- package/dist/NotificationServicesPushController/mocks/index.d.ts +2 -0
- package/dist/NotificationServicesPushController/mocks/index.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/index.js +2 -0
- package/dist/NotificationServicesPushController/mocks/index.js.map +1 -0
- package/dist/NotificationServicesPushController/mocks/{mockResponse.d.mts → mockResponse.d.ts} +1 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/mocks/{mockResponse.mjs → mockResponse.js} +2 -2
- package/dist/NotificationServicesPushController/mocks/mockResponse.js.map +1 -0
- package/dist/NotificationServicesPushController/services/{endpoints.d.cts → endpoints.d.ts} +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/services/{endpoints.mjs → endpoints.js} +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.js.map +1 -0
- package/dist/NotificationServicesPushController/services/{services.d.mts → services.d.ts} +4 -4
- package/dist/NotificationServicesPushController/services/services.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/services/{services.mjs → services.js} +2 -2
- package/dist/NotificationServicesPushController/services/services.js.map +1 -0
- package/dist/NotificationServicesPushController/types/{firebase.d.mts → firebase.d.ts} +1 -1
- package/dist/NotificationServicesPushController/types/firebase.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/types/firebase.js +2 -0
- package/dist/NotificationServicesPushController/types/firebase.js.map +1 -0
- package/dist/NotificationServicesPushController/types/index.d.ts +4 -0
- package/dist/NotificationServicesPushController/types/index.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/types/index.js +2 -0
- package/dist/NotificationServicesPushController/types/index.js.map +1 -0
- package/dist/NotificationServicesPushController/types/{push-analytics.d.cts → push-analytics.d.ts} +1 -1
- package/dist/NotificationServicesPushController/types/push-analytics.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/types/{push-analytics.mjs → push-analytics.js} +1 -1
- package/dist/NotificationServicesPushController/types/push-analytics.js.map +1 -0
- package/dist/NotificationServicesPushController/types/{push-service-interface.d.cts → push-service-interface.d.ts} +2 -2
- package/dist/NotificationServicesPushController/types/push-service-interface.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/types/push-service-interface.js +2 -0
- package/dist/NotificationServicesPushController/types/push-service-interface.js.map +1 -0
- package/dist/NotificationServicesPushController/utils/{get-notification-data.d.cts → get-notification-data.d.ts} +2 -2
- package/dist/NotificationServicesPushController/utils/get-notification-data.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/utils/{get-notification-data.mjs → get-notification-data.js} +2 -2
- package/dist/NotificationServicesPushController/utils/get-notification-data.js.map +1 -0
- package/dist/NotificationServicesPushController/utils/{get-notification-message.d.mts → get-notification-message.d.ts} +3 -3
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/utils/{get-notification-message.mjs → get-notification-message.js} +2 -2
- package/dist/NotificationServicesPushController/utils/get-notification-message.js.map +1 -0
- package/dist/NotificationServicesPushController/utils/index.d.ts +4 -0
- package/dist/NotificationServicesPushController/utils/index.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/utils/index.js +4 -0
- package/dist/NotificationServicesPushController/utils/index.js.map +1 -0
- package/dist/NotificationServicesPushController/utils/{to-push-analytics-payload.d.cts → to-push-analytics-payload.d.ts} +2 -2
- package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/utils/{to-push-analytics-payload.mjs → to-push-analytics-payload.js} +1 -1
- package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.js.map +1 -0
- package/dist/NotificationServicesPushController/web/index.d.ts +2 -0
- package/dist/NotificationServicesPushController/web/index.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/web/index.js +2 -0
- package/dist/NotificationServicesPushController/web/index.js.map +1 -0
- package/dist/NotificationServicesPushController/web/{push-utils.d.cts → push-utils.d.ts} +4 -5
- package/dist/NotificationServicesPushController/web/push-utils.d.ts.map +1 -0
- package/dist/NotificationServicesPushController/web/{push-utils.mjs → push-utils.js} +7 -14
- package/dist/NotificationServicesPushController/web/push-utils.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/shared/index.d.ts +4 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/index.js +4 -0
- package/dist/shared/index.js.map +1 -0
- package/dist/shared/{is-onchain-notification.d.cts → is-onchain-notification.d.ts} +2 -2
- package/dist/shared/is-onchain-notification.d.ts.map +1 -0
- package/dist/shared/{is-onchain-notification.mjs → is-onchain-notification.js} +2 -2
- package/dist/shared/is-onchain-notification.js.map +1 -0
- package/dist/shared/{notification-api-type-guards.d.mts → notification-api-type-guards.d.ts} +2 -2
- package/dist/shared/notification-api-type-guards.d.ts.map +1 -0
- package/dist/shared/{notification-api-type-guards.mjs → notification-api-type-guards.js} +1 -1
- package/dist/shared/notification-api-type-guards.js.map +1 -0
- package/dist/shared/{to-raw-notification.d.cts → to-raw-notification.d.ts} +2 -2
- package/dist/shared/to-raw-notification.d.ts.map +1 -0
- package/dist/shared/{to-raw-notification.mjs → to-raw-notification.js} +3 -3
- package/dist/shared/to-raw-notification.js.map +1 -0
- package/package.json +31 -65
- package/dist/NotificationServicesController/NotificationServicesController-method-action-types.cjs +0 -7
- package/dist/NotificationServicesController/NotificationServicesController-method-action-types.cjs.map +0 -1
- package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.cts +0 -206
- package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.cts.map +0 -1
- package/dist/NotificationServicesController/NotificationServicesController-method-action-types.d.mts.map +0 -1
- package/dist/NotificationServicesController/NotificationServicesController-method-action-types.mjs.map +0 -1
- package/dist/NotificationServicesController/NotificationServicesController.cjs +0 -1056
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +0 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +0 -1
- package/dist/NotificationServicesController/NotificationServicesController.d.mts +0 -292
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +0 -1
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +0 -1
- package/dist/NotificationServicesController/constants/index.cjs +0 -18
- package/dist/NotificationServicesController/constants/index.cjs.map +0 -1
- package/dist/NotificationServicesController/constants/index.d.cts +0 -2
- package/dist/NotificationServicesController/constants/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/constants/index.d.mts +0 -2
- package/dist/NotificationServicesController/constants/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/constants/index.mjs +0 -2
- package/dist/NotificationServicesController/constants/index.mjs.map +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.cjs +0 -46
- package/dist/NotificationServicesController/constants/notification-schema.cjs.map +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.d.mts +0 -22
- package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.mjs.map +0 -1
- package/dist/NotificationServicesController/index.cjs +0 -44
- package/dist/NotificationServicesController/index.cjs.map +0 -1
- package/dist/NotificationServicesController/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/index.d.mts +0 -16
- package/dist/NotificationServicesController/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/index.mjs +0 -13
- package/dist/NotificationServicesController/index.mjs.map +0 -1
- package/dist/NotificationServicesController/mocks/index.cjs +0 -21
- package/dist/NotificationServicesController/mocks/index.cjs.map +0 -1
- package/dist/NotificationServicesController/mocks/index.d.cts +0 -5
- package/dist/NotificationServicesController/mocks/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/mocks/index.d.mts +0 -5
- package/dist/NotificationServicesController/mocks/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/mocks/index.mjs +0 -5
- package/dist/NotificationServicesController/mocks/index.mjs.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.cjs +0 -210
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.cjs.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.cts.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.mts +0 -15
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.d.mts.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-feature-announcements.mjs.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs +0 -830
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.cjs.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.cts.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts +0 -104
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.d.mts.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-raw-notifications.mjs.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-snap-notification.cjs +0 -29
- package/dist/NotificationServicesController/mocks/mock-snap-notification.cjs.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-snap-notification.d.cts.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-snap-notification.d.mts +0 -8
- package/dist/NotificationServicesController/mocks/mock-snap-notification.d.mts.map +0 -1
- package/dist/NotificationServicesController/mocks/mock-snap-notification.mjs.map +0 -1
- package/dist/NotificationServicesController/mocks/mockResponses.cjs +0 -61
- package/dist/NotificationServicesController/mocks/mockResponses.cjs.map +0 -1
- package/dist/NotificationServicesController/mocks/mockResponses.d.cts.map +0 -1
- package/dist/NotificationServicesController/mocks/mockResponses.d.mts +0 -15
- package/dist/NotificationServicesController/mocks/mockResponses.d.mts.map +0 -1
- package/dist/NotificationServicesController/mocks/mockResponses.mjs.map +0 -1
- package/dist/NotificationServicesController/processors/index.cjs +0 -20
- package/dist/NotificationServicesController/processors/index.cjs.map +0 -1
- package/dist/NotificationServicesController/processors/index.d.cts +0 -4
- package/dist/NotificationServicesController/processors/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/processors/index.d.mts +0 -4
- package/dist/NotificationServicesController/processors/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/processors/index.mjs +0 -4
- package/dist/NotificationServicesController/processors/index.mjs.map +0 -1
- package/dist/NotificationServicesController/processors/process-api-notifications.cjs +0 -24
- package/dist/NotificationServicesController/processors/process-api-notifications.cjs.map +0 -1
- package/dist/NotificationServicesController/processors/process-api-notifications.d.cts.map +0 -1
- package/dist/NotificationServicesController/processors/process-api-notifications.d.mts +0 -10
- package/dist/NotificationServicesController/processors/process-api-notifications.d.mts.map +0 -1
- package/dist/NotificationServicesController/processors/process-api-notifications.mjs.map +0 -1
- package/dist/NotificationServicesController/processors/process-feature-announcement.cjs +0 -38
- package/dist/NotificationServicesController/processors/process-feature-announcement.cjs.map +0 -1
- package/dist/NotificationServicesController/processors/process-feature-announcement.d.cts +0 -19
- package/dist/NotificationServicesController/processors/process-feature-announcement.d.cts.map +0 -1
- package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts.map +0 -1
- package/dist/NotificationServicesController/processors/process-feature-announcement.mjs.map +0 -1
- package/dist/NotificationServicesController/processors/process-notifications.cjs +0 -60
- package/dist/NotificationServicesController/processors/process-notifications.cjs.map +0 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +0 -1
- package/dist/NotificationServicesController/processors/process-notifications.d.mts +0 -20
- package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +0 -1
- package/dist/NotificationServicesController/processors/process-notifications.mjs.map +0 -1
- package/dist/NotificationServicesController/processors/process-snap-notifications.cjs +0 -25
- package/dist/NotificationServicesController/processors/process-snap-notifications.cjs.map +0 -1
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.cts.map +0 -1
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.mts +0 -10
- package/dist/NotificationServicesController/processors/process-snap-notifications.d.mts.map +0 -1
- package/dist/NotificationServicesController/processors/process-snap-notifications.mjs.map +0 -1
- package/dist/NotificationServicesController/services/api-notifications.cjs +0 -167
- package/dist/NotificationServicesController/services/api-notifications.cjs.map +0 -1
- package/dist/NotificationServicesController/services/api-notifications.d.cts.map +0 -1
- package/dist/NotificationServicesController/services/api-notifications.d.mts +0 -65
- package/dist/NotificationServicesController/services/api-notifications.d.mts.map +0 -1
- package/dist/NotificationServicesController/services/api-notifications.mjs.map +0 -1
- package/dist/NotificationServicesController/services/feature-announcements.cjs +0 -140
- package/dist/NotificationServicesController/services/feature-announcements.cjs.map +0 -1
- package/dist/NotificationServicesController/services/feature-announcements.d.cts +0 -32
- package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +0 -1
- package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +0 -1
- package/dist/NotificationServicesController/services/feature-announcements.mjs.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.cjs +0 -61
- package/dist/NotificationServicesController/services/notification-config-cache.cjs.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.d.cts +0 -15
- package/dist/NotificationServicesController/services/notification-config-cache.d.cts.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.d.mts.map +0 -1
- package/dist/NotificationServicesController/services/notification-config-cache.mjs +0 -57
- package/dist/NotificationServicesController/services/notification-config-cache.mjs.map +0 -1
- package/dist/NotificationServicesController/services/perp-notifications.cjs +0 -31
- package/dist/NotificationServicesController/services/perp-notifications.cjs.map +0 -1
- package/dist/NotificationServicesController/services/perp-notifications.d.cts.map +0 -1
- package/dist/NotificationServicesController/services/perp-notifications.d.mts +0 -11
- package/dist/NotificationServicesController/services/perp-notifications.d.mts.map +0 -1
- package/dist/NotificationServicesController/services/perp-notifications.mjs.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs +0 -3
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts +0 -32
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs +0 -2
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.cjs +0 -3
- package/dist/NotificationServicesController/types/feature-announcement/index.cjs.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.d.cts +0 -4
- package/dist/NotificationServicesController/types/feature-announcement/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.d.mts +0 -4
- package/dist/NotificationServicesController/types/feature-announcement/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.mjs +0 -2
- package/dist/NotificationServicesController/types/feature-announcement/index.mjs.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs +0 -3
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts +0 -43
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs +0 -2
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs +0 -3
- package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts +0 -29
- package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs +0 -2
- package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs.map +0 -1
- package/dist/NotificationServicesController/types/index.cjs +0 -3
- package/dist/NotificationServicesController/types/index.cjs.map +0 -1
- package/dist/NotificationServicesController/types/index.d.cts +0 -6
- package/dist/NotificationServicesController/types/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/index.d.mts +0 -6
- package/dist/NotificationServicesController/types/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/index.mjs +0 -2
- package/dist/NotificationServicesController/types/index.mjs.map +0 -1
- package/dist/NotificationServicesController/types/notification/index.cjs +0 -3
- package/dist/NotificationServicesController/types/notification/index.cjs.map +0 -1
- package/dist/NotificationServicesController/types/notification/index.d.cts +0 -2
- package/dist/NotificationServicesController/types/notification/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/notification/index.d.mts +0 -2
- package/dist/NotificationServicesController/types/notification/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/notification/index.mjs +0 -2
- package/dist/NotificationServicesController/types/notification/index.mjs.map +0 -1
- package/dist/NotificationServicesController/types/notification/notification.cjs +0 -3
- package/dist/NotificationServicesController/types/notification/notification.cjs.map +0 -1
- package/dist/NotificationServicesController/types/notification/notification.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/notification/notification.d.mts +0 -22
- package/dist/NotificationServicesController/types/notification/notification.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/notification/notification.mjs +0 -2
- package/dist/NotificationServicesController/types/notification/notification.mjs.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/index.cjs +0 -3
- package/dist/NotificationServicesController/types/notification-api/index.cjs.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/index.d.cts +0 -3
- package/dist/NotificationServicesController/types/notification-api/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/index.d.mts +0 -3
- package/dist/NotificationServicesController/types/notification-api/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/index.mjs +0 -2
- package/dist/NotificationServicesController/types/notification-api/index.mjs.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/notification-api.cjs +0 -4
- package/dist/NotificationServicesController/types/notification-api/notification-api.cjs.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/notification-api.d.cts +0 -59
- package/dist/NotificationServicesController/types/notification-api/notification-api.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/notification-api.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/notification-api.mjs +0 -2
- package/dist/NotificationServicesController/types/notification-api/notification-api.mjs.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/schema.cjs +0 -6
- package/dist/NotificationServicesController/types/notification-api/schema.cjs.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/schema.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/schema.d.mts +0 -752
- package/dist/NotificationServicesController/types/notification-api/schema.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/notification-api/schema.mjs.map +0 -1
- package/dist/NotificationServicesController/types/perps/index.cjs +0 -3
- package/dist/NotificationServicesController/types/perps/index.cjs.map +0 -1
- package/dist/NotificationServicesController/types/perps/index.d.cts +0 -2
- package/dist/NotificationServicesController/types/perps/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/perps/index.d.mts +0 -2
- package/dist/NotificationServicesController/types/perps/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/perps/index.mjs +0 -2
- package/dist/NotificationServicesController/types/perps/index.mjs.map +0 -1
- package/dist/NotificationServicesController/types/perps/perp-types.cjs +0 -3
- package/dist/NotificationServicesController/types/perps/perp-types.cjs.map +0 -1
- package/dist/NotificationServicesController/types/perps/perp-types.d.cts +0 -3
- package/dist/NotificationServicesController/types/perps/perp-types.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/perps/perp-types.d.mts +0 -3
- package/dist/NotificationServicesController/types/perps/perp-types.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/perps/perp-types.mjs +0 -2
- package/dist/NotificationServicesController/types/perps/perp-types.mjs.map +0 -1
- package/dist/NotificationServicesController/types/perps/schema.cjs +0 -6
- package/dist/NotificationServicesController/types/perps/schema.cjs.map +0 -1
- package/dist/NotificationServicesController/types/perps/schema.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/perps/schema.d.mts +0 -133
- package/dist/NotificationServicesController/types/perps/schema.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/perps/schema.mjs.map +0 -1
- package/dist/NotificationServicesController/types/snaps/index.cjs +0 -3
- package/dist/NotificationServicesController/types/snaps/index.cjs.map +0 -1
- package/dist/NotificationServicesController/types/snaps/index.d.cts +0 -2
- package/dist/NotificationServicesController/types/snaps/index.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/snaps/index.d.mts +0 -2
- package/dist/NotificationServicesController/types/snaps/index.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/snaps/index.mjs +0 -2
- package/dist/NotificationServicesController/types/snaps/index.mjs.map +0 -1
- package/dist/NotificationServicesController/types/snaps/snaps.cjs +0 -3
- package/dist/NotificationServicesController/types/snaps/snaps.cjs.map +0 -1
- package/dist/NotificationServicesController/types/snaps/snaps.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/snaps/snaps.d.mts +0 -23
- package/dist/NotificationServicesController/types/snaps/snaps.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/snaps/snaps.mjs +0 -2
- package/dist/NotificationServicesController/types/snaps/snaps.mjs.map +0 -1
- package/dist/NotificationServicesController/types/type-utils.cjs +0 -3
- package/dist/NotificationServicesController/types/type-utils.cjs.map +0 -1
- package/dist/NotificationServicesController/types/type-utils.d.cts.map +0 -1
- package/dist/NotificationServicesController/types/type-utils.d.mts +0 -7
- package/dist/NotificationServicesController/types/type-utils.d.mts.map +0 -1
- package/dist/NotificationServicesController/types/type-utils.mjs +0 -2
- package/dist/NotificationServicesController/types/type-utils.mjs.map +0 -1
- package/dist/NotificationServicesController/utils/get-notification-subtype.cjs +0 -33
- package/dist/NotificationServicesController/utils/get-notification-subtype.cjs.map +0 -1
- package/dist/NotificationServicesController/utils/get-notification-subtype.d.cts.map +0 -1
- package/dist/NotificationServicesController/utils/get-notification-subtype.d.mts +0 -17
- package/dist/NotificationServicesController/utils/get-notification-subtype.d.mts.map +0 -1
- package/dist/NotificationServicesController/utils/get-notification-subtype.mjs.map +0 -1
- package/dist/NotificationServicesController/utils/isVersionInBounds.cjs +0 -37
- package/dist/NotificationServicesController/utils/isVersionInBounds.cjs.map +0 -1
- package/dist/NotificationServicesController/utils/isVersionInBounds.d.cts.map +0 -1
- package/dist/NotificationServicesController/utils/isVersionInBounds.d.mts +0 -18
- package/dist/NotificationServicesController/utils/isVersionInBounds.d.mts.map +0 -1
- package/dist/NotificationServicesController/utils/isVersionInBounds.mjs.map +0 -1
- package/dist/NotificationServicesController/utils/should-auto-expire.cjs +0 -12
- package/dist/NotificationServicesController/utils/should-auto-expire.cjs.map +0 -1
- package/dist/NotificationServicesController/utils/should-auto-expire.d.cts.map +0 -1
- package/dist/NotificationServicesController/utils/should-auto-expire.d.mts +0 -2
- package/dist/NotificationServicesController/utils/should-auto-expire.d.mts.map +0 -1
- package/dist/NotificationServicesController/utils/should-auto-expire.mjs.map +0 -1
- package/dist/NotificationServicesController/utils/utils.cjs +0 -25
- package/dist/NotificationServicesController/utils/utils.cjs.map +0 -1
- package/dist/NotificationServicesController/utils/utils.d.cts.map +0 -1
- package/dist/NotificationServicesController/utils/utils.d.mts +0 -11
- package/dist/NotificationServicesController/utils/utils.d.mts.map +0 -1
- package/dist/NotificationServicesController/utils/utils.mjs.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.cjs +0 -7
- package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.cjs.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.mts +0 -72
- package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController-method-action-types.mjs.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +0 -342
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +0 -123
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +0 -342
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +0 -1
- package/dist/NotificationServicesPushController/index.cjs +0 -37
- package/dist/NotificationServicesPushController/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/index.d.mts +0 -11
- package/dist/NotificationServicesPushController/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/index.mjs +0 -8
- package/dist/NotificationServicesPushController/index.mjs.map +0 -1
- package/dist/NotificationServicesPushController/mocks/index.cjs +0 -18
- package/dist/NotificationServicesPushController/mocks/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/mocks/index.d.cts +0 -2
- package/dist/NotificationServicesPushController/mocks/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/mocks/index.d.mts +0 -2
- package/dist/NotificationServicesPushController/mocks/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/mocks/index.mjs +0 -2
- package/dist/NotificationServicesPushController/mocks/index.mjs.map +0 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.cjs +0 -48
- package/dist/NotificationServicesPushController/mocks/mockResponse.cjs.map +0 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts +0 -22
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/mocks/mockResponse.mjs.map +0 -1
- package/dist/NotificationServicesPushController/services/endpoints.cjs +0 -13
- package/dist/NotificationServicesPushController/services/endpoints.cjs.map +0 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.mts +0 -4
- package/dist/NotificationServicesPushController/services/endpoints.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/services/endpoints.mjs.map +0 -1
- package/dist/NotificationServicesPushController/services/services.cjs +0 -133
- package/dist/NotificationServicesPushController/services/services.cjs.map +0 -1
- package/dist/NotificationServicesPushController/services/services.d.cts +0 -90
- package/dist/NotificationServicesPushController/services/services.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/services/services.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/services/services.mjs.map +0 -1
- package/dist/NotificationServicesPushController/types/firebase.cjs +0 -3
- package/dist/NotificationServicesPushController/types/firebase.cjs.map +0 -1
- package/dist/NotificationServicesPushController/types/firebase.d.cts +0 -53
- package/dist/NotificationServicesPushController/types/firebase.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/types/firebase.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/types/firebase.mjs +0 -2
- package/dist/NotificationServicesPushController/types/firebase.mjs.map +0 -1
- package/dist/NotificationServicesPushController/types/index.cjs +0 -3
- package/dist/NotificationServicesPushController/types/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/types/index.d.cts +0 -4
- package/dist/NotificationServicesPushController/types/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/types/index.d.mts +0 -4
- package/dist/NotificationServicesPushController/types/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/types/index.mjs +0 -2
- package/dist/NotificationServicesPushController/types/index.mjs.map +0 -1
- package/dist/NotificationServicesPushController/types/push-analytics.cjs +0 -5
- package/dist/NotificationServicesPushController/types/push-analytics.cjs.map +0 -1
- package/dist/NotificationServicesPushController/types/push-analytics.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/types/push-analytics.d.mts +0 -18
- package/dist/NotificationServicesPushController/types/push-analytics.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/types/push-analytics.mjs.map +0 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.cjs +0 -3
- package/dist/NotificationServicesPushController/types/push-service-interface.cjs.map +0 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.d.mts +0 -30
- package/dist/NotificationServicesPushController/types/push-service-interface.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/types/push-service-interface.mjs +0 -2
- package/dist/NotificationServicesPushController/types/push-service-interface.mjs.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-data.cjs +0 -84
- package/dist/NotificationServicesPushController/utils/get-notification-data.cjs.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-data.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts +0 -42
- package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-data.mjs.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +0 -171
- package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts +0 -62
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +0 -1
- package/dist/NotificationServicesPushController/utils/index.cjs +0 -20
- package/dist/NotificationServicesPushController/utils/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/utils/index.d.cts +0 -4
- package/dist/NotificationServicesPushController/utils/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/utils/index.d.mts +0 -4
- package/dist/NotificationServicesPushController/utils/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/utils/index.mjs +0 -4
- package/dist/NotificationServicesPushController/utils/index.mjs.map +0 -1
- package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.cjs +0 -26
- package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.cjs.map +0 -1
- package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.d.mts +0 -12
- package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/utils/to-push-analytics-payload.mjs.map +0 -1
- package/dist/NotificationServicesPushController/web/index.cjs +0 -8
- package/dist/NotificationServicesPushController/web/index.cjs.map +0 -1
- package/dist/NotificationServicesPushController/web/index.d.cts +0 -2
- package/dist/NotificationServicesPushController/web/index.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/web/index.d.mts +0 -2
- package/dist/NotificationServicesPushController/web/index.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/web/index.mjs +0 -2
- package/dist/NotificationServicesPushController/web/index.mjs.map +0 -1
- package/dist/NotificationServicesPushController/web/push-utils.cjs +0 -169
- package/dist/NotificationServicesPushController/web/push-utils.cjs.map +0 -1
- package/dist/NotificationServicesPushController/web/push-utils.d.cts.map +0 -1
- package/dist/NotificationServicesPushController/web/push-utils.d.mts +0 -37
- package/dist/NotificationServicesPushController/web/push-utils.d.mts.map +0 -1
- package/dist/NotificationServicesPushController/web/push-utils.mjs.map +0 -1
- package/dist/index.cjs +0 -34
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -4
- package/dist/index.d.cts.map +0 -1
- package/dist/index.d.mts +0 -4
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -4
- package/dist/index.mjs.map +0 -1
- package/dist/shared/index.cjs +0 -20
- package/dist/shared/index.cjs.map +0 -1
- package/dist/shared/index.d.cts +0 -4
- package/dist/shared/index.d.cts.map +0 -1
- package/dist/shared/index.d.mts +0 -4
- package/dist/shared/index.d.mts.map +0 -1
- package/dist/shared/index.mjs +0 -4
- package/dist/shared/index.mjs.map +0 -1
- package/dist/shared/is-onchain-notification.cjs +0 -15
- package/dist/shared/is-onchain-notification.cjs.map +0 -1
- package/dist/shared/is-onchain-notification.d.cts.map +0 -1
- package/dist/shared/is-onchain-notification.d.mts +0 -9
- package/dist/shared/is-onchain-notification.d.mts.map +0 -1
- package/dist/shared/is-onchain-notification.mjs.map +0 -1
- package/dist/shared/notification-api-type-guards.cjs +0 -24
- package/dist/shared/notification-api-type-guards.cjs.map +0 -1
- package/dist/shared/notification-api-type-guards.d.cts +0 -16
- package/dist/shared/notification-api-type-guards.d.cts.map +0 -1
- package/dist/shared/notification-api-type-guards.d.mts.map +0 -1
- package/dist/shared/notification-api-type-guards.mjs.map +0 -1
- package/dist/shared/to-raw-notification.cjs +0 -30
- package/dist/shared/to-raw-notification.cjs.map +0 -1
- package/dist/shared/to-raw-notification.d.cts.map +0 -1
- package/dist/shared/to-raw-notification.d.mts +0 -11
- package/dist/shared/to-raw-notification.d.mts.map +0 -1
- package/dist/shared/to-raw-notification.mjs.map +0 -1
|
@@ -1,34 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
};
|
|
12
|
-
var _NotificationServicesController_instances, _NotificationServicesController_keyringController, _NotificationServicesController_auth, _NotificationServicesController_pushNotifications, _NotificationServicesController_accounts, _NotificationServicesController_locale, _NotificationServicesController_featureAnnouncementEnv, _NotificationServicesController_env, _NotificationServicesController_clearLoadingStates, _NotificationServicesController_assertAuthEnabled, _NotificationServicesController_enableAuth, _NotificationServicesController_getBearerToken, _NotificationServicesController_registerPushNotifications, _NotificationServicesController_setIsUpdatingMetamaskNotifications, _NotificationServicesController_setIsFetchingMetamaskNotifications, _NotificationServicesController_setIsCheckingAccountsPresence, _NotificationServicesController_updateUpdatingAccountsState, _NotificationServicesController_clearUpdatingAccountsState;
|
|
13
|
-
function $importDefault(module) {
|
|
14
|
-
if (module?.__esModule) {
|
|
15
|
-
return module.default;
|
|
16
|
-
}
|
|
17
|
-
return module;
|
|
18
|
-
}
|
|
19
|
-
import { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES } from "@metamask/authenticated-user-storage";
|
|
20
|
-
import { BaseController } from "@metamask/base-controller";
|
|
21
|
-
import { isValidHexAddress, toChecksumHexAddress } from "@metamask/controller-utils";
|
|
22
|
-
import { assert } from "@metamask/utils";
|
|
23
|
-
import $lodash from "lodash";
|
|
24
|
-
const { debounce } = $lodash;
|
|
25
|
-
import $log from "loglevel";
|
|
26
|
-
const log = $importDefault($log);
|
|
27
|
-
import { TRIGGER_TYPES } from "./constants/notification-schema.mjs";
|
|
28
|
-
import { processAndFilterNotifications, safeProcessNotification } from "./processors/process-notifications.mjs";
|
|
29
|
-
import { getAPINotifications, getNotificationsApiConfigCached, markNotificationsAsRead, updateOnChainNotifications } from "./services/api-notifications.mjs";
|
|
30
|
-
import { getFeatureAnnouncementNotifications } from "./services/feature-announcements.mjs";
|
|
31
|
-
import { createPerpOrderNotification } from "./services/perp-notifications.mjs";
|
|
1
|
+
import { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, } from '@metamask/authenticated-user-storage';
|
|
2
|
+
import { BaseController } from '@metamask/base-controller';
|
|
3
|
+
import { isValidHexAddress, toChecksumHexAddress, } from '@metamask/controller-utils';
|
|
4
|
+
import { assert } from '@metamask/utils';
|
|
5
|
+
import { debounce } from 'lodash-es';
|
|
6
|
+
import log from 'loglevel';
|
|
7
|
+
import { TRIGGER_TYPES } from './constants/notification-schema.js';
|
|
8
|
+
import { processAndFilterNotifications, safeProcessNotification, } from './processors/process-notifications.js';
|
|
9
|
+
import { getAPINotifications, getNotificationsApiConfigCached, markNotificationsAsRead, updateOnChainNotifications, } from './services/api-notifications.js';
|
|
10
|
+
import { getFeatureAnnouncementNotifications } from './services/feature-announcements.js';
|
|
11
|
+
import { createPerpOrderNotification } from './services/perp-notifications.js';
|
|
32
12
|
// Unique name for the controller
|
|
33
13
|
const controllerName = 'NotificationServicesController';
|
|
34
14
|
export const ACCOUNTS_UPDATE_DEBOUNCE_TIME_MS = 1000;
|
|
@@ -127,7 +107,7 @@ export const DEFAULT_SOCIAL_AI_PREFERENCES = {
|
|
|
127
107
|
txAmountLimit: 500,
|
|
128
108
|
mutedTraderProfileIds: [],
|
|
129
109
|
};
|
|
130
|
-
export { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES } from
|
|
110
|
+
export { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, } from '@metamask/authenticated-user-storage';
|
|
131
111
|
/**
|
|
132
112
|
* Returns the subset of `accounts` that has a wallet-activity subscription in
|
|
133
113
|
* the Trigger API, which is the source of truth for the per-address enabled bit.
|
|
@@ -203,6 +183,233 @@ const MESSENGER_EXPOSED_METHODS = [
|
|
|
203
183
|
* Controller that enables wallet notifications and feature announcements
|
|
204
184
|
*/
|
|
205
185
|
export class NotificationServicesController extends BaseController {
|
|
186
|
+
#keyringController = {
|
|
187
|
+
isUnlocked: false,
|
|
188
|
+
setupLockedStateSubscriptions: (onUnlock) => {
|
|
189
|
+
const { isUnlocked } = this.messenger.call('KeyringController:getState');
|
|
190
|
+
this.#keyringController.isUnlocked = isUnlocked;
|
|
191
|
+
this.messenger.subscribe('KeyringController:unlock', () => {
|
|
192
|
+
this.#keyringController.isUnlocked = true;
|
|
193
|
+
// messaging system cannot await promises
|
|
194
|
+
// we don't need to wait for a result on this.
|
|
195
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
196
|
+
onUnlock();
|
|
197
|
+
});
|
|
198
|
+
this.messenger.subscribe('KeyringController:lock', () => {
|
|
199
|
+
this.#keyringController.isUnlocked = false;
|
|
200
|
+
});
|
|
201
|
+
},
|
|
202
|
+
};
|
|
203
|
+
#auth = {
|
|
204
|
+
getBearerToken: async () => {
|
|
205
|
+
return await this.messenger.call('AuthenticationController:getBearerToken');
|
|
206
|
+
},
|
|
207
|
+
isSignedIn: () => {
|
|
208
|
+
return this.messenger.call('AuthenticationController:isSignedIn');
|
|
209
|
+
},
|
|
210
|
+
signIn: async () => {
|
|
211
|
+
return await this.messenger.call('AuthenticationController:performSignIn');
|
|
212
|
+
},
|
|
213
|
+
};
|
|
214
|
+
#pushNotifications = {
|
|
215
|
+
// Flag to check is notifications have been setup when the browser/extension is initialized.
|
|
216
|
+
// We want to re-initialize push notifications when the browser/extension is refreshed
|
|
217
|
+
// To ensure we subscribe to the most up-to-date notifications
|
|
218
|
+
isSetup: false,
|
|
219
|
+
subscribeToPushNotifications: async () => {
|
|
220
|
+
await this.messenger.call('NotificationServicesPushController:subscribeToPushNotifications');
|
|
221
|
+
},
|
|
222
|
+
enablePushNotifications: async (addresses) => {
|
|
223
|
+
try {
|
|
224
|
+
await this.messenger.call('NotificationServicesPushController:enablePushNotifications', addresses);
|
|
225
|
+
}
|
|
226
|
+
catch {
|
|
227
|
+
// Do nothing, failing silently.
|
|
228
|
+
}
|
|
229
|
+
},
|
|
230
|
+
addPushNotificationLinks: async (addresses) => {
|
|
231
|
+
try {
|
|
232
|
+
await this.messenger.call('NotificationServicesPushController:addPushNotificationLinks', addresses);
|
|
233
|
+
}
|
|
234
|
+
catch {
|
|
235
|
+
// Do nothing, failing silently.
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
disablePushNotifications: async () => {
|
|
239
|
+
try {
|
|
240
|
+
await this.messenger.call('NotificationServicesPushController:disablePushNotifications');
|
|
241
|
+
}
|
|
242
|
+
catch {
|
|
243
|
+
// Do nothing, failing silently.
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
deletePushNotificationLinks: async (addresses) => {
|
|
247
|
+
try {
|
|
248
|
+
await this.messenger.call('NotificationServicesPushController:deletePushNotificationLinks', addresses);
|
|
249
|
+
}
|
|
250
|
+
catch {
|
|
251
|
+
// Do nothing, failing silently.
|
|
252
|
+
}
|
|
253
|
+
},
|
|
254
|
+
subscribe: () => {
|
|
255
|
+
// Coalesce pushes: at most one fetch in-flight, one queued.
|
|
256
|
+
// Re-fetch after completion because the new row may not be visible yet when the push arrives.
|
|
257
|
+
let pushFetchInFlight = false;
|
|
258
|
+
let pendingPushRefetch = false;
|
|
259
|
+
const fetchOnPush = async () => {
|
|
260
|
+
pushFetchInFlight = true;
|
|
261
|
+
try {
|
|
262
|
+
await this.fetchAndUpdateMetamaskNotifications();
|
|
263
|
+
}
|
|
264
|
+
finally {
|
|
265
|
+
pushFetchInFlight = false;
|
|
266
|
+
if (pendingPushRefetch) {
|
|
267
|
+
pendingPushRefetch = false;
|
|
268
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
269
|
+
fetchOnPush();
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
};
|
|
273
|
+
this.messenger.subscribe('NotificationServicesPushController:onNewNotifications', () => {
|
|
274
|
+
if (pushFetchInFlight) {
|
|
275
|
+
pendingPushRefetch = true;
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
279
|
+
fetchOnPush();
|
|
280
|
+
});
|
|
281
|
+
},
|
|
282
|
+
initializePushNotifications: async () => {
|
|
283
|
+
if (!this.state.isNotificationServicesEnabled) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
286
|
+
if (this.#pushNotifications.isSetup) {
|
|
287
|
+
return;
|
|
288
|
+
}
|
|
289
|
+
// If wallet is unlocked, we can create a fresh push subscription
|
|
290
|
+
// Otherwise we can subscribe to original subscription
|
|
291
|
+
try {
|
|
292
|
+
if (!this.#keyringController.isUnlocked) {
|
|
293
|
+
throw new Error('Keyring is locked');
|
|
294
|
+
}
|
|
295
|
+
await this.enablePushNotifications();
|
|
296
|
+
this.#pushNotifications.isSetup = true;
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
await this.#pushNotifications
|
|
300
|
+
.subscribeToPushNotifications()
|
|
301
|
+
.catch(() => {
|
|
302
|
+
// do nothing
|
|
303
|
+
});
|
|
304
|
+
}
|
|
305
|
+
},
|
|
306
|
+
};
|
|
307
|
+
#accounts = {
|
|
308
|
+
// Flag to ensure we only setup once
|
|
309
|
+
isNotificationAccountsSetup: false,
|
|
310
|
+
getNotificationAccounts: () => {
|
|
311
|
+
const { keyrings } = this.messenger.call('KeyringController:getState');
|
|
312
|
+
const keyringAccounts = [
|
|
313
|
+
...new Set(keyrings
|
|
314
|
+
.flatMap((keyring) => keyring.accounts)
|
|
315
|
+
.map((address) => {
|
|
316
|
+
try {
|
|
317
|
+
return toChecksumHexAddress(address);
|
|
318
|
+
}
|
|
319
|
+
catch {
|
|
320
|
+
return null;
|
|
321
|
+
}
|
|
322
|
+
})
|
|
323
|
+
.filter((address) => address !== null && isValidHexAddress(address))),
|
|
324
|
+
];
|
|
325
|
+
return keyringAccounts.length > 0 ? keyringAccounts : null;
|
|
326
|
+
},
|
|
327
|
+
/**
|
|
328
|
+
* Used to get list of addresses from keyring (wallet addresses)
|
|
329
|
+
*
|
|
330
|
+
* @returns addresses removed, added, and latest list of addresses
|
|
331
|
+
*/
|
|
332
|
+
listAccounts: () => {
|
|
333
|
+
// Get previous and current account sets
|
|
334
|
+
const nonChecksumAccounts = this.#accounts.getNotificationAccounts();
|
|
335
|
+
if (!nonChecksumAccounts) {
|
|
336
|
+
return {
|
|
337
|
+
accountsAdded: [],
|
|
338
|
+
accountsRemoved: [],
|
|
339
|
+
accounts: [],
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
const accounts = nonChecksumAccounts
|
|
343
|
+
.map((address) => toChecksumHexAddress(address))
|
|
344
|
+
.filter((address) => isValidHexAddress(address));
|
|
345
|
+
const currentAccountsSet = new Set(accounts);
|
|
346
|
+
const prevAccountsSet = new Set(this.state.subscriptionAccountsSeen);
|
|
347
|
+
// Invalid value you cannot have zero accounts
|
|
348
|
+
// Only occurs when the Accounts controller is initializing.
|
|
349
|
+
if (accounts.length === 0) {
|
|
350
|
+
return {
|
|
351
|
+
accountsAdded: [],
|
|
352
|
+
accountsRemoved: [],
|
|
353
|
+
accounts: [],
|
|
354
|
+
};
|
|
355
|
+
}
|
|
356
|
+
// Calculate added and removed addresses
|
|
357
|
+
const accountsAdded = accounts.filter((account) => !prevAccountsSet.has(account));
|
|
358
|
+
const accountsRemoved = [...prevAccountsSet.values()].filter((account) => !currentAccountsSet.has(account));
|
|
359
|
+
// Update accounts seen
|
|
360
|
+
this.update((state) => {
|
|
361
|
+
state.subscriptionAccountsSeen = [...currentAccountsSet];
|
|
362
|
+
});
|
|
363
|
+
return {
|
|
364
|
+
accountsAdded,
|
|
365
|
+
accountsRemoved,
|
|
366
|
+
accounts,
|
|
367
|
+
};
|
|
368
|
+
},
|
|
369
|
+
/**
|
|
370
|
+
* Initializes the cache/previous list. This is handy so we have an accurate in-mem state of the previous list of accounts.
|
|
371
|
+
*/
|
|
372
|
+
initialize: () => {
|
|
373
|
+
if (this.#keyringController.isUnlocked &&
|
|
374
|
+
!this.#accounts.isNotificationAccountsSetup) {
|
|
375
|
+
this.#accounts.listAccounts();
|
|
376
|
+
this.#accounts.isNotificationAccountsSetup = true;
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
/**
|
|
380
|
+
* Subscription to any state change in the keyring controller (aka wallet accounts).
|
|
381
|
+
* We can call the `listAccounts` defined above to find out about any accounts added, removed
|
|
382
|
+
* And call effects to subscribe/unsubscribe to notifications.
|
|
383
|
+
*/
|
|
384
|
+
subscribe: () => {
|
|
385
|
+
const debouncedUpdateAccountNotifications = debounce(async (totalAccounts, prevTotalAccounts) => {
|
|
386
|
+
const hasTotalAccountsChanged = totalAccounts !== prevTotalAccounts;
|
|
387
|
+
if (!this.state.isNotificationServicesEnabled ||
|
|
388
|
+
!hasTotalAccountsChanged) {
|
|
389
|
+
return;
|
|
390
|
+
}
|
|
391
|
+
const { accountsAdded, accountsRemoved } = this.#accounts.listAccounts();
|
|
392
|
+
const promises = [];
|
|
393
|
+
if (accountsAdded.length > 0) {
|
|
394
|
+
promises.push(this.enableAccounts(accountsAdded));
|
|
395
|
+
}
|
|
396
|
+
if (accountsRemoved.length > 0) {
|
|
397
|
+
promises.push(this.disableAccounts(accountsRemoved));
|
|
398
|
+
}
|
|
399
|
+
await Promise.allSettled(promises);
|
|
400
|
+
}, ACCOUNTS_UPDATE_DEBOUNCE_TIME_MS);
|
|
401
|
+
this.messenger.subscribe('KeyringController:stateChange',
|
|
402
|
+
// Using void return for async callback - result is intentionally ignored
|
|
403
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
404
|
+
debouncedUpdateAccountNotifications, (state) => {
|
|
405
|
+
return (state?.keyrings?.flatMap?.((keyring) => keyring.accounts)?.length ??
|
|
406
|
+
0);
|
|
407
|
+
});
|
|
408
|
+
},
|
|
409
|
+
};
|
|
410
|
+
#locale;
|
|
411
|
+
#featureAnnouncementEnv;
|
|
412
|
+
#env;
|
|
206
413
|
/**
|
|
207
414
|
* Creates a NotificationServicesController instance.
|
|
208
415
|
*
|
|
@@ -221,271 +428,158 @@ export class NotificationServicesController extends BaseController {
|
|
|
221
428
|
name: controllerName,
|
|
222
429
|
state: { ...defaultState, ...state },
|
|
223
430
|
});
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
235
|
-
onUnlock();
|
|
236
|
-
});
|
|
237
|
-
this.messenger.subscribe('KeyringController:lock', () => {
|
|
238
|
-
__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked = false;
|
|
239
|
-
});
|
|
240
|
-
},
|
|
431
|
+
this.#featureAnnouncementEnv = env.featureAnnouncements;
|
|
432
|
+
this.#locale = env.locale ?? (() => 'en');
|
|
433
|
+
this.#env = env.env ?? 'prd';
|
|
434
|
+
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
435
|
+
this.#clearLoadingStates();
|
|
436
|
+
}
|
|
437
|
+
init() {
|
|
438
|
+
this.#keyringController.setupLockedStateSubscriptions(async () => {
|
|
439
|
+
this.#accounts.initialize();
|
|
440
|
+
await this.#pushNotifications.initializePushNotifications();
|
|
241
441
|
});
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
442
|
+
this.#accounts.initialize();
|
|
443
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
444
|
+
this.#pushNotifications.initializePushNotifications();
|
|
445
|
+
this.#accounts.subscribe();
|
|
446
|
+
this.#pushNotifications.subscribe();
|
|
447
|
+
}
|
|
448
|
+
#clearLoadingStates() {
|
|
449
|
+
this.update((state) => {
|
|
450
|
+
state.isUpdatingMetamaskNotifications = false;
|
|
451
|
+
state.isCheckingAccountsPresence = false;
|
|
452
|
+
state.isFetchingMetamaskNotifications = false;
|
|
453
|
+
state.isUpdatingMetamaskNotificationsAccount = [];
|
|
252
454
|
});
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
pendingPushRefetch = false;
|
|
307
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
308
|
-
fetchOnPush();
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
|
-
};
|
|
312
|
-
this.messenger.subscribe('NotificationServicesPushController:onNewNotifications', () => {
|
|
313
|
-
if (pushFetchInFlight) {
|
|
314
|
-
pendingPushRefetch = true;
|
|
315
|
-
return;
|
|
316
|
-
}
|
|
317
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
318
|
-
fetchOnPush();
|
|
319
|
-
});
|
|
320
|
-
},
|
|
321
|
-
initializePushNotifications: async () => {
|
|
322
|
-
if (!this.state.isNotificationServicesEnabled) {
|
|
323
|
-
return;
|
|
324
|
-
}
|
|
325
|
-
if (__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isSetup) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
// If wallet is unlocked, we can create a fresh push subscription
|
|
329
|
-
// Otherwise we can subscribe to original subscription
|
|
330
|
-
try {
|
|
331
|
-
if (!__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked) {
|
|
332
|
-
throw new Error('Keyring is locked');
|
|
333
|
-
}
|
|
334
|
-
await this.enablePushNotifications();
|
|
335
|
-
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").isSetup = true;
|
|
336
|
-
}
|
|
337
|
-
catch {
|
|
338
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f")
|
|
339
|
-
.subscribeToPushNotifications()
|
|
340
|
-
.catch(() => {
|
|
341
|
-
// do nothing
|
|
342
|
-
});
|
|
343
|
-
}
|
|
344
|
-
},
|
|
455
|
+
}
|
|
456
|
+
#assertAuthEnabled() {
|
|
457
|
+
if (!this.#auth.isSignedIn()) {
|
|
458
|
+
this.update((state) => {
|
|
459
|
+
state.isNotificationServicesEnabled = false;
|
|
460
|
+
});
|
|
461
|
+
throw new Error('User is not signed in.');
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
async #enableAuth() {
|
|
465
|
+
const isSignedIn = this.#auth.isSignedIn();
|
|
466
|
+
if (!isSignedIn) {
|
|
467
|
+
await this.#auth.signIn();
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
async #getBearerToken() {
|
|
471
|
+
this.#assertAuthEnabled();
|
|
472
|
+
const bearerToken = await this.#auth.getBearerToken();
|
|
473
|
+
if (!bearerToken) {
|
|
474
|
+
throw new Error('Missing BearerToken');
|
|
475
|
+
}
|
|
476
|
+
return { bearerToken };
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* Registers this device for push notifications on the given addresses.
|
|
480
|
+
*
|
|
481
|
+
* An empty list cannot be sent: the push API rejects a registration with no
|
|
482
|
+
* addresses, and because that request is what performs the delete-and-reinsert
|
|
483
|
+
* of the device's links, a rejection leaves the previous links in place and
|
|
484
|
+
* push keeps arriving. So "no addresses" has to mean unregistering the device.
|
|
485
|
+
*
|
|
486
|
+
* @param addresses - The addresses to receive push notifications for.
|
|
487
|
+
*/
|
|
488
|
+
async #registerPushNotifications(addresses) {
|
|
489
|
+
if (addresses.length === 0) {
|
|
490
|
+
await this.#pushNotifications.disablePushNotifications();
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
await this.#pushNotifications.enablePushNotifications(addresses);
|
|
494
|
+
}
|
|
495
|
+
/**
|
|
496
|
+
* Sets the state of notification creation process.
|
|
497
|
+
*
|
|
498
|
+
* This method updates the `isUpdatingMetamaskNotifications` state, which can be used to indicate
|
|
499
|
+
* whether the notification creation process is currently active or not. This is useful
|
|
500
|
+
* for UI elements that need to reflect the state of ongoing operations, such as loading
|
|
501
|
+
* indicators or disabled buttons during processing.
|
|
502
|
+
*
|
|
503
|
+
* @param isUpdatingMetamaskNotifications - A boolean value representing the new state of the notification creation process.
|
|
504
|
+
*/
|
|
505
|
+
#setIsUpdatingMetamaskNotifications(isUpdatingMetamaskNotifications) {
|
|
506
|
+
this.update((state) => {
|
|
507
|
+
state.isUpdatingMetamaskNotifications = isUpdatingMetamaskNotifications;
|
|
345
508
|
});
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
catch {
|
|
359
|
-
return null;
|
|
360
|
-
}
|
|
361
|
-
})
|
|
362
|
-
.filter((address) => address !== null && isValidHexAddress(address))),
|
|
363
|
-
];
|
|
364
|
-
return keyringAccounts.length > 0 ? keyringAccounts : null;
|
|
365
|
-
},
|
|
366
|
-
/**
|
|
367
|
-
* Used to get list of addresses from keyring (wallet addresses)
|
|
368
|
-
*
|
|
369
|
-
* @returns addresses removed, added, and latest list of addresses
|
|
370
|
-
*/
|
|
371
|
-
listAccounts: () => {
|
|
372
|
-
// Get previous and current account sets
|
|
373
|
-
const nonChecksumAccounts = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").getNotificationAccounts();
|
|
374
|
-
if (!nonChecksumAccounts) {
|
|
375
|
-
return {
|
|
376
|
-
accountsAdded: [],
|
|
377
|
-
accountsRemoved: [],
|
|
378
|
-
accounts: [],
|
|
379
|
-
};
|
|
380
|
-
}
|
|
381
|
-
const accounts = nonChecksumAccounts
|
|
382
|
-
.map((address) => toChecksumHexAddress(address))
|
|
383
|
-
.filter((address) => isValidHexAddress(address));
|
|
384
|
-
const currentAccountsSet = new Set(accounts);
|
|
385
|
-
const prevAccountsSet = new Set(this.state.subscriptionAccountsSeen);
|
|
386
|
-
// Invalid value you cannot have zero accounts
|
|
387
|
-
// Only occurs when the Accounts controller is initializing.
|
|
388
|
-
if (accounts.length === 0) {
|
|
389
|
-
return {
|
|
390
|
-
accountsAdded: [],
|
|
391
|
-
accountsRemoved: [],
|
|
392
|
-
accounts: [],
|
|
393
|
-
};
|
|
394
|
-
}
|
|
395
|
-
// Calculate added and removed addresses
|
|
396
|
-
const accountsAdded = accounts.filter((account) => !prevAccountsSet.has(account));
|
|
397
|
-
const accountsRemoved = [...prevAccountsSet.values()].filter((account) => !currentAccountsSet.has(account));
|
|
398
|
-
// Update accounts seen
|
|
399
|
-
this.update((state) => {
|
|
400
|
-
state.subscriptionAccountsSeen = [...currentAccountsSet];
|
|
401
|
-
});
|
|
402
|
-
return {
|
|
403
|
-
accountsAdded,
|
|
404
|
-
accountsRemoved,
|
|
405
|
-
accounts,
|
|
406
|
-
};
|
|
407
|
-
},
|
|
408
|
-
/**
|
|
409
|
-
* Initializes the cache/previous list. This is handy so we have an accurate in-mem state of the previous list of accounts.
|
|
410
|
-
*/
|
|
411
|
-
initialize: () => {
|
|
412
|
-
if (__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").isUnlocked &&
|
|
413
|
-
!__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup) {
|
|
414
|
-
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
415
|
-
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").isNotificationAccountsSetup = true;
|
|
416
|
-
}
|
|
417
|
-
},
|
|
418
|
-
/**
|
|
419
|
-
* Subscription to any state change in the keyring controller (aka wallet accounts).
|
|
420
|
-
* We can call the `listAccounts` defined above to find out about any accounts added, removed
|
|
421
|
-
* And call effects to subscribe/unsubscribe to notifications.
|
|
422
|
-
*/
|
|
423
|
-
subscribe: () => {
|
|
424
|
-
const debouncedUpdateAccountNotifications = debounce(async (totalAccounts, prevTotalAccounts) => {
|
|
425
|
-
const hasTotalAccountsChanged = totalAccounts !== prevTotalAccounts;
|
|
426
|
-
if (!this.state.isNotificationServicesEnabled ||
|
|
427
|
-
!hasTotalAccountsChanged) {
|
|
428
|
-
return;
|
|
429
|
-
}
|
|
430
|
-
const { accountsAdded, accountsRemoved } = __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
431
|
-
const promises = [];
|
|
432
|
-
if (accountsAdded.length > 0) {
|
|
433
|
-
promises.push(this.enableAccounts(accountsAdded));
|
|
434
|
-
}
|
|
435
|
-
if (accountsRemoved.length > 0) {
|
|
436
|
-
promises.push(this.disableAccounts(accountsRemoved));
|
|
437
|
-
}
|
|
438
|
-
await Promise.allSettled(promises);
|
|
439
|
-
}, ACCOUNTS_UPDATE_DEBOUNCE_TIME_MS);
|
|
440
|
-
this.messenger.subscribe('KeyringController:stateChange',
|
|
441
|
-
// Using void return for async callback - result is intentionally ignored
|
|
442
|
-
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
443
|
-
debouncedUpdateAccountNotifications, (state) => {
|
|
444
|
-
return (state?.keyrings?.flatMap?.((keyring) => keyring.accounts)?.length ??
|
|
445
|
-
0);
|
|
446
|
-
});
|
|
447
|
-
},
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Updates the state to indicate whether fetching of MetaMask notifications is in progress.
|
|
512
|
+
*
|
|
513
|
+
* This method is used to set the `isFetchingMetamaskNotifications` state, which can be utilized
|
|
514
|
+
* to show or hide loading indicators in the UI when notifications are being fetched.
|
|
515
|
+
*
|
|
516
|
+
* @param isFetchingMetamaskNotifications - A boolean value representing the fetching state.
|
|
517
|
+
*/
|
|
518
|
+
#setIsFetchingMetamaskNotifications(isFetchingMetamaskNotifications) {
|
|
519
|
+
this.update((state) => {
|
|
520
|
+
state.isFetchingMetamaskNotifications = isFetchingMetamaskNotifications;
|
|
448
521
|
});
|
|
449
|
-
_NotificationServicesController_locale.set(this, void 0);
|
|
450
|
-
_NotificationServicesController_featureAnnouncementEnv.set(this, void 0);
|
|
451
|
-
_NotificationServicesController_env.set(this, void 0);
|
|
452
|
-
__classPrivateFieldSet(this, _NotificationServicesController_featureAnnouncementEnv, env.featureAnnouncements, "f");
|
|
453
|
-
__classPrivateFieldSet(this, _NotificationServicesController_locale, env.locale ?? (() => 'en'), "f");
|
|
454
|
-
__classPrivateFieldSet(this, _NotificationServicesController_env, env.env ?? 'prd', "f");
|
|
455
|
-
this.messenger.registerMethodActionHandlers(this, MESSENGER_EXPOSED_METHODS);
|
|
456
|
-
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearLoadingStates).call(this);
|
|
457
522
|
}
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
523
|
+
/**
|
|
524
|
+
* Updates the state to indicate that the checking of accounts presence is in progress.
|
|
525
|
+
*
|
|
526
|
+
* This method modifies the `isCheckingAccountsPresence` state, which can be used to manage UI elements
|
|
527
|
+
* that depend on the status of account presence checks, such as displaying loading indicators or disabling
|
|
528
|
+
* buttons while the check is ongoing.
|
|
529
|
+
*
|
|
530
|
+
* @param isCheckingAccountsPresence - A boolean value indicating whether the account presence check is currently active.
|
|
531
|
+
*/
|
|
532
|
+
#setIsCheckingAccountsPresence(isCheckingAccountsPresence) {
|
|
533
|
+
this.update((state) => {
|
|
534
|
+
state.isCheckingAccountsPresence = isCheckingAccountsPresence;
|
|
535
|
+
});
|
|
536
|
+
}
|
|
537
|
+
/**
|
|
538
|
+
* Updates the state to indicate that account updates are in progress.
|
|
539
|
+
* Removes duplicate accounts before updating the state.
|
|
540
|
+
*
|
|
541
|
+
* @param accounts - The accounts being updated.
|
|
542
|
+
*/
|
|
543
|
+
#updateUpdatingAccountsState(accounts) {
|
|
544
|
+
this.update((state) => {
|
|
545
|
+
const uniqueAccounts = new Set([
|
|
546
|
+
...state.isUpdatingMetamaskNotificationsAccount,
|
|
547
|
+
...accounts,
|
|
548
|
+
]);
|
|
549
|
+
state.isUpdatingMetamaskNotificationsAccount = Array.from(uniqueAccounts);
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Clears the state indicating that account updates are complete.
|
|
554
|
+
*
|
|
555
|
+
* @param accounts - The accounts that have finished updating.
|
|
556
|
+
*/
|
|
557
|
+
#clearUpdatingAccountsState(accounts) {
|
|
558
|
+
this.update((state) => {
|
|
559
|
+
state.isUpdatingMetamaskNotificationsAccount =
|
|
560
|
+
state.isUpdatingMetamaskNotificationsAccount.filter((existingAccount) => !accounts.includes(existingAccount));
|
|
462
561
|
});
|
|
463
|
-
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").initialize();
|
|
464
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
465
|
-
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications();
|
|
466
|
-
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").subscribe();
|
|
467
|
-
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").subscribe();
|
|
468
562
|
}
|
|
469
563
|
/**
|
|
470
564
|
* Public method to expose enabling push notifications
|
|
471
565
|
*/
|
|
472
566
|
async enablePushNotifications() {
|
|
473
567
|
try {
|
|
474
|
-
const { accounts } =
|
|
475
|
-
if (!
|
|
568
|
+
const { accounts } = this.#accounts.listAccounts();
|
|
569
|
+
if (!this.#keyringController.isUnlocked || accounts.length === 0) {
|
|
476
570
|
// no keyring accounts could be caused by calling this function while keyring is locked
|
|
477
571
|
// it does not mean the user does not have any enabled accounts on Trigger API
|
|
478
572
|
return;
|
|
479
573
|
}
|
|
480
|
-
const { bearerToken } = await
|
|
481
|
-
const enabledAddresses = await getEnabledAccounts(bearerToken, accounts,
|
|
574
|
+
const { bearerToken } = await this.#getBearerToken();
|
|
575
|
+
const enabledAddresses = await getEnabledAccounts(bearerToken, accounts, this.#env);
|
|
482
576
|
if (enabledAddresses === null) {
|
|
483
577
|
// "No addresses" unregisters the device, so an unreadable subscription
|
|
484
578
|
// list must not be treated as an empty one: leave the existing links
|
|
485
579
|
// alone until we can read the real state.
|
|
486
580
|
return;
|
|
487
581
|
}
|
|
488
|
-
await
|
|
582
|
+
await this.#registerPushNotifications(enabledAddresses);
|
|
489
583
|
}
|
|
490
584
|
catch {
|
|
491
585
|
// Do nothing, failing silently.
|
|
@@ -495,13 +589,13 @@ export class NotificationServicesController extends BaseController {
|
|
|
495
589
|
* Public method to expose disabling push notifications
|
|
496
590
|
*/
|
|
497
591
|
async disablePushNotifications() {
|
|
498
|
-
await
|
|
592
|
+
await this.#pushNotifications.disablePushNotifications();
|
|
499
593
|
}
|
|
500
594
|
async checkAccountsPresence(accounts) {
|
|
501
595
|
try {
|
|
502
|
-
|
|
503
|
-
const { bearerToken } = await
|
|
504
|
-
const triggerConfig = await getNotificationsApiConfigCached(bearerToken, accounts,
|
|
596
|
+
this.#setIsCheckingAccountsPresence(true);
|
|
597
|
+
const { bearerToken } = await this.#getBearerToken();
|
|
598
|
+
const triggerConfig = await getNotificationsApiConfigCached(bearerToken, accounts, this.#env);
|
|
505
599
|
if (triggerConfig === null) {
|
|
506
600
|
// Reporting every account as disabled would misrepresent the user's
|
|
507
601
|
// settings, so surface the failure instead.
|
|
@@ -522,7 +616,7 @@ export class NotificationServicesController extends BaseController {
|
|
|
522
616
|
throw error;
|
|
523
617
|
}
|
|
524
618
|
finally {
|
|
525
|
-
|
|
619
|
+
this.#setIsCheckingAccountsPresence(false);
|
|
526
620
|
}
|
|
527
621
|
}
|
|
528
622
|
/**
|
|
@@ -565,14 +659,14 @@ export class NotificationServicesController extends BaseController {
|
|
|
565
659
|
*/
|
|
566
660
|
async createOnChainTriggers(opts = {}) {
|
|
567
661
|
try {
|
|
568
|
-
|
|
569
|
-
const { accounts } =
|
|
570
|
-
if (!
|
|
662
|
+
this.#setIsUpdatingMetamaskNotifications(true);
|
|
663
|
+
const { accounts } = this.#accounts.listAccounts();
|
|
664
|
+
if (!this.#keyringController.isUnlocked || accounts.length === 0) {
|
|
571
665
|
// no keyring accounts could be caused by calling this function while keyring is locked
|
|
572
666
|
// it does not mean the user does not have any enabled accounts on Trigger API
|
|
573
667
|
return;
|
|
574
668
|
}
|
|
575
|
-
const { bearerToken } = await
|
|
669
|
+
const { bearerToken } = await this.#getBearerToken();
|
|
576
670
|
// 1. Read existing AUS notification preferences. Their absence is what
|
|
577
671
|
// marks a first-time setup, and they are initialized in step 3.
|
|
578
672
|
const preferences = await this.messenger.call('AuthenticatedUserStorageService:getNotificationPreferences');
|
|
@@ -589,7 +683,7 @@ export class NotificationServicesController extends BaseController {
|
|
|
589
683
|
// Even at first-time setup, existing subscriptions win: a user upgrading
|
|
590
684
|
// from a client that never wrote a preferences blob keeps whichever
|
|
591
685
|
// accounts they had already disabled.
|
|
592
|
-
let accountsWithNotifications = await getEnabledAccounts(bearerToken, accounts,
|
|
686
|
+
let accountsWithNotifications = await getEnabledAccounts(bearerToken, accounts, this.#env);
|
|
593
687
|
if (accountsWithNotifications === null) {
|
|
594
688
|
// An unreadable subscription list is not an empty one. Subscribing
|
|
595
689
|
// every account here would re-enable ones the user had turned off, and
|
|
@@ -598,7 +692,7 @@ export class NotificationServicesController extends BaseController {
|
|
|
598
692
|
throw new Error('Failed to read wallet-activity subscriptions');
|
|
599
693
|
}
|
|
600
694
|
if (isFirstTimeSetup && accountsWithNotifications.length === 0) {
|
|
601
|
-
await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: true })),
|
|
695
|
+
await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: true })), this.#env);
|
|
602
696
|
// Match the lower-case form the Trigger API echoes back, which is what
|
|
603
697
|
// every other path feeding the push API uses.
|
|
604
698
|
accountsWithNotifications = accounts.map((address) => address.toLowerCase());
|
|
@@ -609,11 +703,11 @@ export class NotificationServicesController extends BaseController {
|
|
|
609
703
|
// failed subscribe leave the user enabled with no accounts subscribed
|
|
610
704
|
// and no second chance to seed them.
|
|
611
705
|
if (isFirstTimeSetup) {
|
|
612
|
-
await this.messenger.call('AuthenticatedUserStorageService:putNotificationPreferences', buildFreshPreferences(hasMarketingConsent, productAnnouncementEnabled),
|
|
706
|
+
await this.messenger.call('AuthenticatedUserStorageService:putNotificationPreferences', buildFreshPreferences(hasMarketingConsent, productAnnouncementEnabled), this.#featureAnnouncementEnv.platform);
|
|
613
707
|
}
|
|
614
708
|
if (opts.registerPushNotifications ?? true) {
|
|
615
709
|
// Attempt FCM/device registration only; clients must request OS permission separately.
|
|
616
|
-
|
|
710
|
+
this.#registerPushNotifications(accountsWithNotifications).catch(() => {
|
|
617
711
|
// Do Nothing
|
|
618
712
|
});
|
|
619
713
|
}
|
|
@@ -637,7 +731,7 @@ export class NotificationServicesController extends BaseController {
|
|
|
637
731
|
throw new Error('Failed to create On Chain triggers');
|
|
638
732
|
}
|
|
639
733
|
finally {
|
|
640
|
-
|
|
734
|
+
this.#setIsUpdatingMetamaskNotifications(false);
|
|
641
735
|
}
|
|
642
736
|
}
|
|
643
737
|
/**
|
|
@@ -649,8 +743,8 @@ export class NotificationServicesController extends BaseController {
|
|
|
649
743
|
*/
|
|
650
744
|
async enableMetamaskNotifications(opts = {}) {
|
|
651
745
|
try {
|
|
652
|
-
|
|
653
|
-
await
|
|
746
|
+
this.#setIsUpdatingMetamaskNotifications(true);
|
|
747
|
+
await this.#enableAuth();
|
|
654
748
|
await this.createOnChainTriggers(opts);
|
|
655
749
|
}
|
|
656
750
|
catch (error) {
|
|
@@ -658,7 +752,7 @@ export class NotificationServicesController extends BaseController {
|
|
|
658
752
|
throw new Error('Unable to enable notifications');
|
|
659
753
|
}
|
|
660
754
|
finally {
|
|
661
|
-
|
|
755
|
+
this.#setIsUpdatingMetamaskNotifications(false);
|
|
662
756
|
}
|
|
663
757
|
}
|
|
664
758
|
/**
|
|
@@ -670,10 +764,10 @@ export class NotificationServicesController extends BaseController {
|
|
|
670
764
|
* @throws {Error} If the user is not authenticated or if there is an error during the process.
|
|
671
765
|
*/
|
|
672
766
|
async disableNotificationServices() {
|
|
673
|
-
|
|
767
|
+
this.#setIsUpdatingMetamaskNotifications(true);
|
|
674
768
|
// Attempt Disable Push Notifications
|
|
675
769
|
try {
|
|
676
|
-
await
|
|
770
|
+
await this.#pushNotifications.disablePushNotifications();
|
|
677
771
|
}
|
|
678
772
|
catch {
|
|
679
773
|
// Do nothing
|
|
@@ -688,7 +782,7 @@ export class NotificationServicesController extends BaseController {
|
|
|
688
782
|
state.metamaskNotificationsList = snapNotifications;
|
|
689
783
|
});
|
|
690
784
|
// Finish Updating State
|
|
691
|
-
|
|
785
|
+
this.#setIsUpdatingMetamaskNotifications(false);
|
|
692
786
|
}
|
|
693
787
|
/**
|
|
694
788
|
* Deletes on-chain triggers associated with a specific account/s.
|
|
@@ -705,16 +799,16 @@ export class NotificationServicesController extends BaseController {
|
|
|
705
799
|
*/
|
|
706
800
|
async disableAccounts(accounts) {
|
|
707
801
|
try {
|
|
708
|
-
|
|
709
|
-
const { bearerToken } = await
|
|
710
|
-
await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: false })),
|
|
711
|
-
await
|
|
802
|
+
this.#updateUpdatingAccountsState(accounts);
|
|
803
|
+
const { bearerToken } = await this.#getBearerToken();
|
|
804
|
+
await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: false })), this.#env);
|
|
805
|
+
await this.#pushNotifications.deletePushNotificationLinks(accounts);
|
|
712
806
|
}
|
|
713
807
|
catch {
|
|
714
808
|
throw new Error('Failed to delete OnChain triggers');
|
|
715
809
|
}
|
|
716
810
|
finally {
|
|
717
|
-
|
|
811
|
+
this.#clearUpdatingAccountsState(accounts);
|
|
718
812
|
}
|
|
719
813
|
}
|
|
720
814
|
/**
|
|
@@ -734,17 +828,17 @@ export class NotificationServicesController extends BaseController {
|
|
|
734
828
|
*/
|
|
735
829
|
async enableAccounts(accounts) {
|
|
736
830
|
try {
|
|
737
|
-
|
|
738
|
-
const { bearerToken } = await
|
|
739
|
-
await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: true })),
|
|
740
|
-
await
|
|
831
|
+
this.#updateUpdatingAccountsState(accounts);
|
|
832
|
+
const { bearerToken } = await this.#getBearerToken();
|
|
833
|
+
await updateOnChainNotifications(bearerToken, accounts.map((address) => ({ address, enabled: true })), this.#env);
|
|
834
|
+
await this.#pushNotifications.addPushNotificationLinks(accounts);
|
|
741
835
|
}
|
|
742
836
|
catch (error) {
|
|
743
837
|
log.error('Failed to update OnChain triggers', error);
|
|
744
838
|
throw new Error('Failed to update OnChain triggers');
|
|
745
839
|
}
|
|
746
840
|
finally {
|
|
747
|
-
|
|
841
|
+
this.#clearUpdatingAccountsState(accounts);
|
|
748
842
|
}
|
|
749
843
|
}
|
|
750
844
|
/**
|
|
@@ -759,7 +853,7 @@ export class NotificationServicesController extends BaseController {
|
|
|
759
853
|
*/
|
|
760
854
|
async fetchAndUpdateMetamaskNotifications(previewToken) {
|
|
761
855
|
try {
|
|
762
|
-
|
|
856
|
+
this.#setIsFetchingMetamaskNotifications(true);
|
|
763
857
|
// This is used by Feature Announcement & On Chain
|
|
764
858
|
// Not used by Snaps
|
|
765
859
|
const isGlobalNotifsEnabled = this.state.isNotificationServicesEnabled;
|
|
@@ -771,20 +865,20 @@ export class NotificationServicesController extends BaseController {
|
|
|
771
865
|
// Raw Feature Notifications
|
|
772
866
|
const rawAnnouncements = isGlobalNotifsEnabled &&
|
|
773
867
|
notificationPreferences?.marketing.inAppNotificationsEnabled
|
|
774
|
-
? await getFeatureAnnouncementNotifications(
|
|
868
|
+
? await getFeatureAnnouncementNotifications(this.#featureAnnouncementEnv, previewToken).catch(() => [])
|
|
775
869
|
: [];
|
|
776
870
|
// Raw On Chain Notifications
|
|
777
871
|
const rawOnChainNotifications = [];
|
|
778
872
|
if (isGlobalNotifsEnabled) {
|
|
779
873
|
try {
|
|
780
|
-
const { bearerToken } = await
|
|
874
|
+
const { bearerToken } = await this.#getBearerToken();
|
|
781
875
|
// Addresses come from the keyring, so this installation can only ever
|
|
782
876
|
// ask for activity on accounts it actually holds. The Trigger API
|
|
783
877
|
// narrows that to the ones the user has enabled.
|
|
784
|
-
const { accounts } =
|
|
785
|
-
const addressesWithNotifications = await getEnabledAccounts(bearerToken, accounts,
|
|
878
|
+
const { accounts } = this.#accounts.listAccounts();
|
|
879
|
+
const addressesWithNotifications = await getEnabledAccounts(bearerToken, accounts, this.#env);
|
|
786
880
|
if (addressesWithNotifications !== null) {
|
|
787
|
-
const notifications = await getAPINotifications(bearerToken, addressesWithNotifications,
|
|
881
|
+
const notifications = await getAPINotifications(bearerToken, addressesWithNotifications, this.#locale(), this.#featureAnnouncementEnv.platform, this.#env).catch(() => []);
|
|
788
882
|
rawOnChainNotifications.push(...notifications);
|
|
789
883
|
}
|
|
790
884
|
}
|
|
@@ -810,11 +904,11 @@ export class NotificationServicesController extends BaseController {
|
|
|
810
904
|
state.metamaskNotificationsList = metamaskNotifications;
|
|
811
905
|
});
|
|
812
906
|
this.messenger.publish(`${controllerName}:notificationsListUpdated`, this.state.metamaskNotificationsList);
|
|
813
|
-
|
|
907
|
+
this.#setIsFetchingMetamaskNotifications(false);
|
|
814
908
|
return metamaskNotifications;
|
|
815
909
|
}
|
|
816
910
|
catch (error) {
|
|
817
|
-
|
|
911
|
+
this.#setIsFetchingMetamaskNotifications(false);
|
|
818
912
|
log.error('Failed to fetch notifications', error);
|
|
819
913
|
throw new Error('Failed to fetch notifications');
|
|
820
914
|
}
|
|
@@ -893,10 +987,10 @@ export class NotificationServicesController extends BaseController {
|
|
|
893
987
|
}, [[], [], []]);
|
|
894
988
|
// Mark On-Chain Notifications as Read
|
|
895
989
|
if (onChainNotifications.length > 0) {
|
|
896
|
-
const bearerToken = await
|
|
990
|
+
const bearerToken = await this.#auth.getBearerToken();
|
|
897
991
|
if (bearerToken) {
|
|
898
992
|
onchainNotificationIds = onChainNotifications.map((notification) => notification.id);
|
|
899
|
-
await markNotificationsAsRead(bearerToken, onchainNotificationIds,
|
|
993
|
+
await markNotificationsAsRead(bearerToken, onchainNotificationIds, this.#env).catch(() => {
|
|
900
994
|
onchainNotificationIds = [];
|
|
901
995
|
log.warn('Unable to mark onchain notifications as read');
|
|
902
996
|
});
|
|
@@ -975,7 +1069,7 @@ export class NotificationServicesController extends BaseController {
|
|
|
975
1069
|
*/
|
|
976
1070
|
async sendPerpPlaceOrderNotification(input) {
|
|
977
1071
|
try {
|
|
978
|
-
const { bearerToken } = await
|
|
1072
|
+
const { bearerToken } = await this.#getBearerToken();
|
|
979
1073
|
await createPerpOrderNotification(bearerToken, input);
|
|
980
1074
|
}
|
|
981
1075
|
catch {
|
|
@@ -983,73 +1077,4 @@ export class NotificationServicesController extends BaseController {
|
|
|
983
1077
|
}
|
|
984
1078
|
}
|
|
985
1079
|
}
|
|
986
|
-
|
|
987
|
-
this.update((state) => {
|
|
988
|
-
state.isUpdatingMetamaskNotifications = false;
|
|
989
|
-
state.isCheckingAccountsPresence = false;
|
|
990
|
-
state.isFetchingMetamaskNotifications = false;
|
|
991
|
-
state.isUpdatingMetamaskNotificationsAccount = [];
|
|
992
|
-
});
|
|
993
|
-
}, _NotificationServicesController_assertAuthEnabled = function _NotificationServicesController_assertAuthEnabled() {
|
|
994
|
-
if (!__classPrivateFieldGet(this, _NotificationServicesController_auth, "f").isSignedIn()) {
|
|
995
|
-
this.update((state) => {
|
|
996
|
-
state.isNotificationServicesEnabled = false;
|
|
997
|
-
});
|
|
998
|
-
throw new Error('User is not signed in.');
|
|
999
|
-
}
|
|
1000
|
-
}, _NotificationServicesController_enableAuth = async function _NotificationServicesController_enableAuth() {
|
|
1001
|
-
const isSignedIn = __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").isSignedIn();
|
|
1002
|
-
if (!isSignedIn) {
|
|
1003
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").signIn();
|
|
1004
|
-
}
|
|
1005
|
-
}, _NotificationServicesController_getBearerToken = async function _NotificationServicesController_getBearerToken() {
|
|
1006
|
-
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertAuthEnabled).call(this);
|
|
1007
|
-
const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken();
|
|
1008
|
-
if (!bearerToken) {
|
|
1009
|
-
throw new Error('Missing BearerToken');
|
|
1010
|
-
}
|
|
1011
|
-
return { bearerToken };
|
|
1012
|
-
}, _NotificationServicesController_registerPushNotifications =
|
|
1013
|
-
/**
|
|
1014
|
-
* Registers this device for push notifications on the given addresses.
|
|
1015
|
-
*
|
|
1016
|
-
* An empty list cannot be sent: the push API rejects a registration with no
|
|
1017
|
-
* addresses, and because that request is what performs the delete-and-reinsert
|
|
1018
|
-
* of the device's links, a rejection leaves the previous links in place and
|
|
1019
|
-
* push keeps arriving. So "no addresses" has to mean unregistering the device.
|
|
1020
|
-
*
|
|
1021
|
-
* @param addresses - The addresses to receive push notifications for.
|
|
1022
|
-
*/
|
|
1023
|
-
async function _NotificationServicesController_registerPushNotifications(addresses) {
|
|
1024
|
-
if (addresses.length === 0) {
|
|
1025
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications();
|
|
1026
|
-
return;
|
|
1027
|
-
}
|
|
1028
|
-
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(addresses);
|
|
1029
|
-
}, _NotificationServicesController_setIsUpdatingMetamaskNotifications = function _NotificationServicesController_setIsUpdatingMetamaskNotifications(isUpdatingMetamaskNotifications) {
|
|
1030
|
-
this.update((state) => {
|
|
1031
|
-
state.isUpdatingMetamaskNotifications = isUpdatingMetamaskNotifications;
|
|
1032
|
-
});
|
|
1033
|
-
}, _NotificationServicesController_setIsFetchingMetamaskNotifications = function _NotificationServicesController_setIsFetchingMetamaskNotifications(isFetchingMetamaskNotifications) {
|
|
1034
|
-
this.update((state) => {
|
|
1035
|
-
state.isFetchingMetamaskNotifications = isFetchingMetamaskNotifications;
|
|
1036
|
-
});
|
|
1037
|
-
}, _NotificationServicesController_setIsCheckingAccountsPresence = function _NotificationServicesController_setIsCheckingAccountsPresence(isCheckingAccountsPresence) {
|
|
1038
|
-
this.update((state) => {
|
|
1039
|
-
state.isCheckingAccountsPresence = isCheckingAccountsPresence;
|
|
1040
|
-
});
|
|
1041
|
-
}, _NotificationServicesController_updateUpdatingAccountsState = function _NotificationServicesController_updateUpdatingAccountsState(accounts) {
|
|
1042
|
-
this.update((state) => {
|
|
1043
|
-
const uniqueAccounts = new Set([
|
|
1044
|
-
...state.isUpdatingMetamaskNotificationsAccount,
|
|
1045
|
-
...accounts,
|
|
1046
|
-
]);
|
|
1047
|
-
state.isUpdatingMetamaskNotificationsAccount = Array.from(uniqueAccounts);
|
|
1048
|
-
});
|
|
1049
|
-
}, _NotificationServicesController_clearUpdatingAccountsState = function _NotificationServicesController_clearUpdatingAccountsState(accounts) {
|
|
1050
|
-
this.update((state) => {
|
|
1051
|
-
state.isUpdatingMetamaskNotificationsAccount =
|
|
1052
|
-
state.isUpdatingMetamaskNotificationsAccount.filter((existingAccount) => !accounts.includes(existingAccount));
|
|
1053
|
-
});
|
|
1054
|
-
};
|
|
1055
|
-
//# sourceMappingURL=NotificationServicesController.mjs.map
|
|
1080
|
+
//# sourceMappingURL=NotificationServicesController.js.map
|