@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
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/types/index.ts"],"names":[],"mappings":"","sourcesContent":["export type * from './firebase.js';\nexport type * from './push-analytics.js';\nexport type * from './push-service-interface.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-analytics.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/types/push-analytics.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe,EAAE,MAAM,CAAC;IACxB,sDAAsD;IACtD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,oDAAoD;IACpD,oBAAoB,EAAE,MAAM,CAAC;IAC7B,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oEAAoE;IACpE,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-analytics.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/types/push-analytics.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAC7D,yDAAyD","sourcesContent":["// snake_case mirrors the FCM payload and Segment schema keys\n/* eslint-disable @typescript-eslint/naming-convention */\n\n/**\n * Analytics fields carried by the `NotificationServicesPushController` messenger\n * events (`onNewNotifications`, `pushNotificationClicked`). Read directly from\n * top-level FCM payload keys, so clients build Segment events without fallback\n * chains or parsing a `metadata` blob.\n */\nexport type PushAnalyticsPayload = {\n notification_id: string;\n /** Free-form snake_case label set by the producer. */\n notification_type: string;\n /** Team-owned, open-ended (e.g. `eth_received`). */\n notification_subtype: string;\n /** Only present when the notification has a chain context. */\n chain_id?: number;\n /** Platform notifications only; the CTA link to route to on tap. */\n deeplink?: string;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PushNotificationEnv } from
|
|
1
|
+
import type { PushNotificationEnv } from './index.js';
|
|
2
2
|
type Unsubscribe = () => void;
|
|
3
3
|
/**
|
|
4
4
|
* Firebase - allows creating of a registration token for push notifications
|
|
@@ -27,4 +27,4 @@ export type PushService = {
|
|
|
27
27
|
subscribeToPushNotifications: SubscribeToPushNotifications;
|
|
28
28
|
};
|
|
29
29
|
export {};
|
|
30
|
-
//# sourceMappingURL=push-service-interface.d.
|
|
30
|
+
//# sourceMappingURL=push-service-interface.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-service-interface.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/types/push-service-interface.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtD,KAAK,WAAW,GAAG,MAAM,IAAI,CAAC;AAE9B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,GAAG,EAAE,mBAAmB,KACrB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE5B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,GAAG,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAE5E;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,4BAA4B,GAAG,CACzC,GAAG,EAAE,mBAAmB,KACrB,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;AAEjC,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,EAAE,cAAc,CAAC;IAE/B,cAAc,EAAE,cAAc,CAAC;IAE/B,4BAA4B,EAAE,4BAA4B,CAAC;CAC5D,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-service-interface.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/types/push-service-interface.ts"],"names":[],"mappings":"","sourcesContent":["import type { PushNotificationEnv } from './index.js';\n\ntype Unsubscribe = () => void;\n\n/**\n * Firebase - allows creating of a registration token for push notifications\n */\nexport type CreateRegToken = (\n env: PushNotificationEnv,\n) => Promise<string | null>;\n\n/**\n * Firebase - allows deleting a reg token. Returns true if successful, otherwise false if failed\n */\nexport type DeleteRegToken = (env: PushNotificationEnv) => Promise<boolean>;\n\n/**\n * Firebase + Platform Specific Logic.\n * Will be used to subscribe to the `onMessage` and `onBackgroundMessage` handlers\n * But will also need client specific logic for showing a notification and clicking a notification\n * (browser APIs for web, and Notifee on mobile)\n *\n * We can either create \"creator\"/\"builder\" function in platform specific files (see push-web.ts),\n * Or the platform needs to correctly handle:\n * - subscriptions\n * - click events\n * - publishing PushController events using it's messenger\n */\nexport type SubscribeToPushNotifications = (\n env: PushNotificationEnv,\n) => Promise<Unsubscribe | null>;\n\nexport type PushService = {\n createRegToken: CreateRegToken;\n\n deleteRegToken: DeleteRegToken;\n\n subscribeToPushNotifications: SubscribeToPushNotifications;\n};\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BigNumber } from
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
type FormatOptions = {
|
|
3
3
|
decimalPlaces?: number;
|
|
4
4
|
shouldEllipse?: boolean;
|
|
@@ -39,4 +39,4 @@ export declare const getLeadingZeroCount: (numericValue: number | string) => num
|
|
|
39
39
|
export declare const formatAmount: (numericAmount: number, opts?: FormatOptions) => string;
|
|
40
40
|
export declare const getAmount: (amount: string, decimals: string, options?: FormatOptions) => string;
|
|
41
41
|
export {};
|
|
42
|
-
//# sourceMappingURL=get-notification-data.d.
|
|
42
|
+
//# sourceMappingURL=get-notification-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-notification-data.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,KAAK,aAAa,GAAG;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAKF;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,CAG1E;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,mBAAmB,iBAAkB,MAAM,GAAG,MAAM,KAAG,MAInE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,kBACR,MAAM,SACd,aAAa,KACnB,MA+BF,CAAC;AAEF,eAAO,MAAM,SAAS,WACZ,MAAM,YACJ,MAAM,YACN,aAAa,KACtB,MAWF,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BigNumber } from
|
|
1
|
+
import { BigNumber } from 'bignumber.js';
|
|
2
2
|
const defaultFormatOptions = {
|
|
3
3
|
decimalPlaces: 4,
|
|
4
4
|
};
|
|
@@ -74,4 +74,4 @@ export const getAmount = (amount, decimals, options) => {
|
|
|
74
74
|
const numericAmount = calcTokenAmount(amount, parseFloat(decimals)).toNumber();
|
|
75
75
|
return formatAmount(numericAmount, options);
|
|
76
76
|
};
|
|
77
|
-
//# sourceMappingURL=get-notification-data.
|
|
77
|
+
//# sourceMappingURL=get-notification-data.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-notification-data.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAMzC,MAAM,oBAAoB,GAAG;IAC3B,aAAa,EAAE,CAAC;CACjB,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,UAAU,eAAe,CAAC,KAAa,EAAE,QAAgB;IAC7D,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,MAAM,CAAC,QAAQ,IAAI,CAAC,CAAC,CAAC,CAAC;IACvD,OAAO,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,UAAU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BAAmB,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAC3D,MAAM,cAAc,GAAG,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;YAChD,qBAAqB,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS;YAClE,qBAAqB,EAAE,OAAO,CAAC,aAAa;SAC7C,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;QAEzB,OAAO,OAAO,CAAC,CAAC,CAAC,GAAG,cAAc,KAAK,CAAC,CAAC,CAAC,cAAc,CAAC;IAC3D,CAAC;IAED,oCAAoC;IACpC,OAAO,aAAa,CAAC,QAAQ,EAAE,CAAC;AAClC,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,MAAc,EACd,QAAgB,EAChB,OAAuB,EACf,EAAE;IACV,IAAI,CAAC,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACzB,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,MAAM,aAAa,GAAG,eAAe,CACnC,MAAM,EACN,UAAU,CAAC,QAAQ,CAAC,CACrB,CAAC,QAAQ,EAAE,CAAC;IAEb,OAAO,YAAY,CAAC,aAAa,EAAE,OAAO,CAAC,CAAC;AAC9C,CAAC,CAAC","sourcesContent":["import { BigNumber } from 'bignumber.js';\n\ntype FormatOptions = {\n decimalPlaces?: number;\n shouldEllipse?: boolean;\n};\nconst defaultFormatOptions = {\n decimalPlaces: 4,\n};\n\n/**\n * Calculates the token amount based on the given value and decimals.\n *\n * @param value - The value to calculate the token amount from.\n * @param decimals - The number of decimals to use for the calculation.\n * @returns The calculated token amount.\n */\nexport function calcTokenAmount(value: string, decimals: number): BigNumber {\n const multiplier = Math.pow(10, Number(decimals || 0));\n return new BigNumber(String(value)).div(multiplier);\n}\n\n/**\n * Calculates the number of leading zeros in the fractional part of a number.\n *\n * This function converts a number or a string representation of a number into\n * its decimal form and then counts the number of leading zeros present in the\n * fractional part of the number. This is useful for determining the precision\n * of very small numbers.\n *\n * @param numericValue - The number to analyze, which can be in the form\n * of a number or a string.\n * @returns The count of leading zeros in the fractional part of the number.\n */\nexport const getLeadingZeroCount = (numericValue: number | string): number => {\n const numToString = new BigNumber(numericValue, 10).toString(10);\n const fractionalPart = numToString.split('.')[1] ?? '';\n return fractionalPart.match(/^0*/u)?.[0]?.length ?? 0;\n};\n\n/**\n * This formats a number using Intl\n * It abbreviates large numbers (using K, M, B, T)\n * And abbreviates small numbers in 2 ways:\n * - Will format to the given number of decimal places\n * - Will format up to 4 decimal places\n * - Will ellipse the number if longer than given decimal places\n *\n * @param numericAmount - The number to format\n * @param opts - The options to use when formatting\n * @returns The formatted number\n */\nexport const formatAmount = (\n numericAmount: number,\n opts?: FormatOptions,\n): string => {\n // create options with defaults\n const options = { ...defaultFormatOptions, ...opts };\n\n const leadingZeros = getLeadingZeroCount(numericAmount);\n const isDecimal = numericAmount.toString().includes('.') || leadingZeros > 0;\n const isLargeNumber = numericAmount > 999;\n\n const handleShouldEllipse = (decimalPlaces: number): boolean =>\n Boolean(options?.shouldEllipse) && leadingZeros >= decimalPlaces;\n\n if (isLargeNumber) {\n return Intl.NumberFormat('en-US', {\n notation: 'compact',\n compactDisplay: 'short',\n maximumFractionDigits: 2,\n }).format(numericAmount);\n }\n\n if (isDecimal) {\n const ellipse = handleShouldEllipse(options.decimalPlaces);\n const formattedValue = Intl.NumberFormat('en-US', {\n minimumFractionDigits: ellipse ? options.decimalPlaces : undefined,\n maximumFractionDigits: options.decimalPlaces,\n }).format(numericAmount);\n\n return ellipse ? `${formattedValue}...` : formattedValue;\n }\n\n // Default to showing the raw amount\n return numericAmount.toString();\n};\n\nexport const getAmount = (\n amount: string,\n decimals: string,\n options?: FormatOptions,\n): string => {\n if (!amount || !decimals) {\n return '';\n }\n\n const numericAmount = calcTokenAmount(\n amount,\n parseFloat(decimals),\n ).toNumber();\n\n return formatAmount(numericAmount, options);\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { Types } from
|
|
2
|
-
import type { Constants } from
|
|
1
|
+
import type { Types } from '../../NotificationServicesController/index.js';
|
|
2
|
+
import type { Constants } from '../../NotificationServicesController/index.js';
|
|
3
3
|
export type TranslationKeys = {
|
|
4
4
|
pushPlatformNotificationsFundsSentTitle: () => string;
|
|
5
5
|
pushPlatformNotificationsFundsSentDescriptionDefault: () => string;
|
|
@@ -59,4 +59,4 @@ export declare const createOnChainPushNotificationMessages: (translationKeys: Tr
|
|
|
59
59
|
*/
|
|
60
60
|
export declare function createOnChainPushNotificationMessage(notification: Types.INotification, translations: TranslationKeys): PushNotificationMessage | null;
|
|
61
61
|
export {};
|
|
62
|
-
//# sourceMappingURL=get-notification-message.d.
|
|
62
|
+
//# sourceMappingURL=get-notification-message.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-notification-message.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-message.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,+CAA+C,CAAC;AAC3E,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+CAA+C,CAAC;AAG/E,MAAM,MAAM,eAAe,GAAG;IAC5B,uCAAuC,EAAE,MAAM,MAAM,CAAC;IACtD,oDAAoD,EAAE,MAAM,MAAM,CAAC;IACnE,6CAA6C,EAAE,CAC7C,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC;IACZ,2CAA2C,EAAE,MAAM,MAAM,CAAC;IAC1D,wDAAwD,EAAE,MAAM,MAAM,CAAC;IACvE,iDAAiD,EAAE,CACjD,GAAG,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,KACtB,MAAM,CAAC;IACZ,2CAA2C,EAAE,MAAM,MAAM,CAAC;IAC1D,iDAAiD,EAAE,MAAM,MAAM,CAAC;IAChE,qCAAqC,EAAE,MAAM,MAAM,CAA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AC,aAAa,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC,CACpD;CACF,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,qCAAqC,oBAC/B,eAAe,KAC/B,uBAwMF,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,oCAAoC,CAClD,YAAY,EAAE,KAAK,CAAC,aAAa,EACjC,YAAY,EAAE,eAAe,GAC5B,uBAAuB,GAAG,IAAI,CA8BhC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { getAmount, formatAmount } from
|
|
1
|
+
import { getAmount, formatAmount } from './get-notification-data.js';
|
|
2
2
|
/**
|
|
3
3
|
* On Chain Push Notification Messages.
|
|
4
4
|
* This is a list of all the push notifications we support. Update this for synced notifications on mobile and extension
|
|
@@ -163,4 +163,4 @@ export function createOnChainPushNotificationMessage(notification, translations)
|
|
|
163
163
|
description: description ?? '', // Fallback to empty string if null
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
|
-
//# sourceMappingURL=get-notification-message.
|
|
166
|
+
//# sourceMappingURL=get-notification-message.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-notification-message.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/get-notification-message.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAoDrE;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,CACnD,eAAgC,EACP,EAAE;IAI3B,MAAM,SAAS,GAAkB,CAAC,GAAG,IAAI,EAAE,EAAE;QAC3C,MAAM,CAAC,GAAG,EAAE,GAAG,SAAS,CAAC,GAAG,IAAI,CAAC;QAEjC,4CAA4C;QAC5C,8DAA8D;QAC9D,MAAM,EAAE,GAAQ,eAAe,CAAC,GAAG,CAAC,CAAC;QACrC,OAAO,EAAE,CAAC,GAAG,SAAS,CAAC,CAAC;IAC1B,CAAC,CAAC;IAE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C;IACD,MAAM,mBAAmB,GACvB,qCAAqC,CAAC,YAAY,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;IAEzE,IAAI,CAAC,mBAAmB,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,WAAW,GAAkB,IAAI,CAAC;IACtC,IAAI,CAAC;QACH,WAAW;YACT,8DAA8D;YAC9D,mBAAmB,EAAE,cAAc,EAAE,CAAC,YAAmB,CAAC;gBAC1D,8DAA8D;gBAC9D,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,YAAmB,CAAC;gBAC7D,IAAI,CAAC;IACT,CAAC;IAAC,MAAM,CAAC;QACP,WAAW;YACT,8DAA8D;YAC9D,mBAAmB,CAAC,kBAAkB,EAAE,CAAC,YAAmB,CAAC,IAAI,IAAI,CAAC;IAC1E,CAAC;IAED,OAAO;QACL,8DAA8D;QAC9D,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,CAAC,YAAmB,CAAC,IAAI,EAAE,EAAE,kCAAkC;QAClG,WAAW,EAAE,WAAW,IAAI,EAAE,EAAE,mCAAmC;KACpE,CAAC;AACJ,CAAC","sourcesContent":["import type { Types } from '../../NotificationServicesController/index.js';\nimport type { Constants } from '../../NotificationServicesController/index.js';\nimport { getAmount, formatAmount } from './get-notification-data.js';\n\nexport type TranslationKeys = {\n pushPlatformNotificationsFundsSentTitle: () => string;\n pushPlatformNotificationsFundsSentDescriptionDefault: () => string;\n pushPlatformNotificationsFundsSentDescription: (\n ...args: [string, string]\n ) => string;\n pushPlatformNotificationsFundsReceivedTitle: () => string;\n pushPlatformNotificationsFundsReceivedDescriptionDefault: () => string;\n pushPlatformNotificationsFundsReceivedDescription: (\n ...args: [string, string]\n ) => string;\n pushPlatformNotificationsSwapCompletedTitle: () => string;\n pushPlatformNotificationsSwapCompletedDescription: () => string;\n pushPlatformNotificationsNftSentTitle: () => string;\n pushPlatformNotificationsNftSentDescription: () => string;\n pushPlatformNotificationsNftReceivedTitle: () => string;\n pushPlatformNotificationsNftReceivedDescription: () => string;\n pushPlatformNotificationsStakingRocketpoolStakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingRocketpoolStakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingRocketpoolUnstakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingRocketpoolUnstakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingLidoStakeCompletedTitle: () => string;\n pushPlatformNotificationsStakingLidoStakeCompletedDescription: () => string;\n pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnTitle: () => string;\n pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnDescription: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalRequestedTitle: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalRequestedDescription: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalCompletedTitle: () => string;\n pushPlatformNotificationsStakingLidoWithdrawalCompletedDescription: () => string;\n};\n\ntype PushNotificationMessage = {\n title: string;\n description: string;\n ctaLink?: string;\n};\n\ntype NotificationMessage<TNotification extends Types.INotification> = {\n title: (notification: TNotification) => string | null;\n defaultDescription: (notification: TNotification) => string | null;\n getDescription?: (notification: TNotification) => string | null;\n link?: (notification: TNotification) => string | null;\n};\n\ntype NotificationMessageDict = {\n [TriggerType in Constants.TRIGGER_TYPES]?: NotificationMessage<\n Extract<Types.INotification, { type: TriggerType }>\n >;\n};\n\n/**\n * On Chain Push Notification Messages.\n * This is a list of all the push notifications we support. Update this for synced notifications on mobile and extension\n *\n * @param translationKeys - all translations supported\n * @returns A translation push message object.\n */\nexport const createOnChainPushNotificationMessages = (\n translationKeys: TranslationKeys,\n): NotificationMessageDict => {\n type TranslationFn = <TKey extends keyof TranslationKeys>(\n ...args: [TKey, ...Parameters<TranslationKeys[TKey]>]\n ) => string;\n const translate: TranslationFn = (...args) => {\n const [key, ...otherArgs] = args;\n\n // Coerce types for the translation function\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n const fn: any = translationKeys[key];\n return fn(...otherArgs);\n };\n\n return {\n erc20_sent: {\n title: (): string | null =>\n translate('pushPlatformNotificationsFundsSentTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsFundsSentDescriptionDefault'),\n getDescription: (notification): string | null => {\n const symbol = notification?.payload?.data?.token?.symbol;\n const tokenAmount = notification?.payload?.data?.token?.amount;\n const tokenDecimals = notification?.payload?.data?.token?.decimals;\n if (!symbol || !tokenAmount || !tokenDecimals) {\n return null;\n }\n\n const amount = getAmount(tokenAmount, tokenDecimals, {\n shouldEllipse: true,\n });\n return translate(\n 'pushPlatformNotificationsFundsSentDescription',\n amount,\n symbol,\n );\n },\n },\n eth_sent: {\n title: (): string | null =>\n translate('pushPlatformNotificationsFundsSentTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsFundsSentDescriptionDefault'),\n getDescription: (notification): string | null => {\n const symbol = notification?.payload?.network?.native_symbol;\n const tokenAmount = notification?.payload?.data?.amount?.eth;\n if (!symbol || !tokenAmount) {\n return null;\n }\n\n const amount = formatAmount(parseFloat(tokenAmount), {\n shouldEllipse: true,\n });\n return translate(\n 'pushPlatformNotificationsFundsSentDescription',\n amount,\n symbol,\n );\n },\n },\n erc20_received: {\n title: (): string | null =>\n translate('pushPlatformNotificationsFundsReceivedTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsFundsReceivedDescriptionDefault'),\n getDescription: (notification): string | null => {\n const symbol = notification?.payload?.data?.token?.symbol;\n const tokenAmount = notification?.payload?.data?.token?.amount;\n const tokenDecimals = notification?.payload?.data?.token?.decimals;\n if (!symbol || !tokenAmount || !tokenDecimals) {\n return null;\n }\n\n const amount = getAmount(tokenAmount, tokenDecimals, {\n shouldEllipse: true,\n });\n return translate(\n 'pushPlatformNotificationsFundsReceivedDescription',\n amount,\n symbol,\n );\n },\n },\n eth_received: {\n title: (): string | null =>\n translate('pushPlatformNotificationsFundsReceivedTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsFundsReceivedDescriptionDefault'),\n getDescription: (notification): string | null => {\n const symbol = notification?.payload?.network?.native_symbol;\n const tokenAmount = notification?.payload?.data?.amount?.eth;\n if (!symbol || !tokenAmount) {\n return null;\n }\n\n const amount = formatAmount(parseFloat(tokenAmount), {\n shouldEllipse: true,\n });\n return translate(\n 'pushPlatformNotificationsFundsReceivedDescription',\n amount,\n symbol,\n );\n },\n },\n metamask_swap_completed: {\n title: (): string | null =>\n translate('pushPlatformNotificationsSwapCompletedTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsSwapCompletedDescription'),\n },\n erc721_sent: {\n title: (): string | null =>\n translate('pushPlatformNotificationsNftSentTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsNftSentDescription'),\n },\n erc1155_sent: {\n title: (): string | null =>\n translate('pushPlatformNotificationsNftSentTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsNftSentDescription'),\n },\n erc721_received: {\n title: (): string | null =>\n translate('pushPlatformNotificationsNftReceivedTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsNftReceivedDescription'),\n },\n erc1155_received: {\n title: (): string | null =>\n translate('pushPlatformNotificationsNftReceivedTitle'),\n defaultDescription: (): string | null =>\n translate('pushPlatformNotificationsNftReceivedDescription'),\n },\n rocketpool_stake_completed: {\n title: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingRocketpoolStakeCompletedTitle',\n ),\n defaultDescription: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingRocketpoolStakeCompletedDescription',\n ),\n },\n rocketpool_unstake_completed: {\n title: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingRocketpoolUnstakeCompletedTitle',\n ),\n defaultDescription: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingRocketpoolUnstakeCompletedDescription',\n ),\n },\n lido_stake_completed: {\n title: (): string | null =>\n translate('pushPlatformNotificationsStakingLidoStakeCompletedTitle'),\n defaultDescription: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingLidoStakeCompletedDescription',\n ),\n },\n lido_stake_ready_to_be_withdrawn: {\n title: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnTitle',\n ),\n defaultDescription: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingLidoStakeReadyToBeWithdrawnDescription',\n ),\n },\n lido_withdrawal_requested: {\n title: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingLidoWithdrawalRequestedTitle',\n ),\n defaultDescription: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingLidoWithdrawalRequestedDescription',\n ),\n },\n lido_withdrawal_completed: {\n title: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingLidoWithdrawalCompletedTitle',\n ),\n defaultDescription: (): string | null =>\n translate(\n 'pushPlatformNotificationsStakingLidoWithdrawalCompletedDescription',\n ),\n },\n platform: {\n title: (notification): string | null => notification.template.title,\n defaultDescription: (notification): string | null =>\n notification.template.body,\n getDescription: (notification): string | null =>\n notification.template.body,\n },\n };\n};\n\n/**\n * Creates a push notification message based on the given on-chain raw notification.\n *\n * @param notification - processed notification.\n * @param translations - translates keys into text\n * @returns The push notification message object, or null if the notification is invalid.\n */\nexport function createOnChainPushNotificationMessage(\n notification: Types.INotification,\n translations: TranslationKeys,\n): PushNotificationMessage | null {\n if (!notification?.type) {\n return null;\n }\n const notificationMessage =\n createOnChainPushNotificationMessages(translations)[notification.type];\n\n if (!notificationMessage) {\n return null;\n }\n\n let description: string | null = null;\n try {\n description =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n notificationMessage?.getDescription?.(notification as any) ??\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n notificationMessage.defaultDescription?.(notification as any) ??\n null;\n } catch {\n description =\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n notificationMessage.defaultDescription?.(notification as any) ?? null;\n }\n\n return {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n title: notificationMessage?.title?.(notification as any) ?? '', // Ensure title is always a string\n description: description ?? '', // Fallback to empty string if null\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,+BAA+B,CAAC;AAC9C,cAAc,gCAAgC,CAAC","sourcesContent":["export * from './get-notification-data.js';\nexport * from './get-notification-message.js';\nexport * from './to-push-analytics-payload.js';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PushAnalyticsPayload } from
|
|
1
|
+
import type { PushAnalyticsPayload } from '../types/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Builds the first-class push analytics payload from the top-level FCM `data`
|
|
4
4
|
* keys written by push-services. Returns `null` when the required identity
|
|
@@ -9,4 +9,4 @@ import type { PushAnalyticsPayload } from "../types/index.cjs";
|
|
|
9
9
|
* @returns the analytics payload, or `null` if required fields are absent.
|
|
10
10
|
*/
|
|
11
11
|
export declare function toPushAnalyticsPayload(data: Record<string, string> | undefined): PushAnalyticsPayload | null;
|
|
12
|
-
//# sourceMappingURL=to-push-analytics-payload.d.
|
|
12
|
+
//# sourceMappingURL=to-push-analytics-payload.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-push-analytics-payload.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/to-push-analytics-payload.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAE9D;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,GACvC,oBAAoB,GAAG,IAAI,CAY7B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-push-analytics-payload.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/utils/to-push-analytics-payload.ts"],"names":[],"mappings":"AAEA;;;;;;;;GAQG;AACH,MAAM,UAAU,sBAAsB,CACpC,IAAwC;IAExC,IAAI,CAAC,IAAI,EAAE,eAAe,IAAI,CAAC,IAAI,EAAE,iBAAiB,EAAE,CAAC;QACvD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO;QACL,eAAe,EAAE,IAAI,CAAC,eAAe;QACrC,iBAAiB,EAAE,IAAI,CAAC,iBAAiB;QACzC,oBAAoB,EAAE,IAAI,CAAC,oBAAoB,IAAI,EAAE;QACrD,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS;QAC3D,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,SAAS;KACrC,CAAC;AACJ,CAAC","sourcesContent":["import type { PushAnalyticsPayload } from '../types/index.js';\n\n/**\n * Builds the first-class push analytics payload from the top-level FCM `data`\n * keys written by push-services. Returns `null` when the required identity\n * fields are missing (e.g. a malformed or legacy payload), so callers can\n * safely bail out.\n *\n * @param data - the top-level FCM `data` map (all values are strings).\n * @returns the analytics payload, or `null` if required fields are absent.\n */\nexport function toPushAnalyticsPayload(\n data: Record<string, string> | undefined,\n): PushAnalyticsPayload | null {\n if (!data?.notification_id || !data?.notification_type) {\n return null;\n }\n\n return {\n notification_id: data.notification_id,\n notification_type: data.notification_type,\n notification_subtype: data.notification_subtype ?? '',\n chain_id: data.chain_id ? Number(data.chain_id) : undefined,\n deeplink: data.deeplink || undefined,\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,kCAAkC,GACnC,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/web/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,kCAAkC,GACnC,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n createRegToken,\n deleteRegToken,\n createSubscribeToPushNotifications,\n} from './push-utils.js';\n"]}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
4
|
-
import type { PushAnalyticsPayload } from "../types/index.cjs";
|
|
1
|
+
import type { NotificationServicesPushControllerMessenger } from '../NotificationServicesPushController.js';
|
|
2
|
+
import type { PushNotificationEnv } from '../types/firebase.js';
|
|
3
|
+
import type { PushAnalyticsPayload } from '../types/index.js';
|
|
5
4
|
export declare let supportedCache: boolean | null;
|
|
6
5
|
/**
|
|
7
6
|
* Creates a registration token for Firebase Cloud Messaging.
|
|
@@ -34,4 +33,4 @@ export declare function createSubscribeToPushNotifications(props: {
|
|
|
34
33
|
onClickHandler: (e: NotificationEvent, payload: PushAnalyticsPayload) => void;
|
|
35
34
|
messenger: NotificationServicesPushControllerMessenger;
|
|
36
35
|
}): (env: PushNotificationEnv) => Promise<() => void>;
|
|
37
|
-
//# sourceMappingURL=push-utils.d.
|
|
36
|
+
//# sourceMappingURL=push-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-utils.d.ts","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/web/push-utils.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,2CAA2C,EAAE,MAAM,0CAA0C,CAAC;AAC5G,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAO9D,eAAO,IAAI,cAAc,EAAE,OAAO,GAAG,IAAW,CAAC;AAyCjD;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,mBAAmB,GACvB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAexB;AAED;;;;;GAKG;AACH,wBAAsB,cAAc,CAClC,GAAG,EAAE,mBAAmB,GACvB,OAAO,CAAC,OAAO,CAAC,CAYlB;AAiED;;;;;;;;;;;GAWG;AACH,wBAAgB,kCAAkC,CAAC,KAAK,EAAE;IACxD,iBAAiB,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3E,cAAc,EAAE,CAAC,CAAC,EAAE,iBAAiB,EAAE,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC9E,SAAS,EAAE,2CAA2C,CAAC;CACxD,GAAG,CAAC,GAAG,EAAE,mBAAmB,KAAK,OAAO,CAAC,MAAM,IAAI,CAAC,CA6BpD"}
|
|
@@ -1,15 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
7
|
-
import { getApp, initializeApp } from "firebase/app";
|
|
8
|
-
import { getToken, deleteToken } from "firebase/messaging";
|
|
9
|
-
import { getMessaging, onBackgroundMessage, isSupported } from "firebase/messaging/sw";
|
|
10
|
-
import $log from "loglevel";
|
|
11
|
-
const log = $importDefault($log);
|
|
12
|
-
import { toPushAnalyticsPayload } from "../utils/to-push-analytics-payload.mjs";
|
|
1
|
+
import { getApp, initializeApp } from 'firebase/app';
|
|
2
|
+
import { getToken, deleteToken } from 'firebase/messaging';
|
|
3
|
+
import { getMessaging, onBackgroundMessage, isSupported, } from 'firebase/messaging/sw';
|
|
4
|
+
import log from 'loglevel';
|
|
5
|
+
import { toPushAnalyticsPayload } from '../utils/to-push-analytics-payload.js';
|
|
13
6
|
// Exported to help testing
|
|
14
7
|
// eslint-disable-next-line import-x/no-mutable-exports
|
|
15
8
|
export let supportedCache = null;
|
|
@@ -17,7 +10,7 @@ const getPushAvailability = async () => {
|
|
|
17
10
|
// Race condition is acceptable here - worst case is isSupported() is called
|
|
18
11
|
// multiple times during initialization, which is harmless for caching a boolean
|
|
19
12
|
// eslint-disable-next-line require-atomic-updates
|
|
20
|
-
supportedCache
|
|
13
|
+
supportedCache ??= await isSupported();
|
|
21
14
|
return supportedCache;
|
|
22
15
|
};
|
|
23
16
|
const createFirebaseApp = async (env) => {
|
|
@@ -164,4 +157,4 @@ export function createSubscribeToPushNotifications(props) {
|
|
|
164
157
|
return unsubscribe;
|
|
165
158
|
};
|
|
166
159
|
}
|
|
167
|
-
//# sourceMappingURL=push-utils.
|
|
160
|
+
//# sourceMappingURL=push-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"push-utils.js","sourceRoot":"","sources":["../../../src/NotificationServicesPushController/web/push-utils.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,YAAY,EACZ,mBAAmB,EACnB,WAAW,GACZ,MAAM,uBAAuB,CAAC;AAE/B,OAAO,GAAG,MAAM,UAAU,CAAC;AAK3B,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAI/E,2BAA2B;AAC3B,uDAAuD;AACvD,MAAM,CAAC,IAAI,cAAc,GAAmB,IAAI,CAAC;AAEjD,MAAM,mBAAmB,GAAG,KAAK,IAAsB,EAAE;IACvD,4EAA4E;IAC5E,gFAAgF;IAChF,kDAAkD;IAClD,cAAc,KAAK,MAAM,WAAW,EAAE,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int-disable-next-line spaced-comment\n/// <reference lib=\"webworker\" />\nimport type { FirebaseApp } from 'firebase/app';\nimport { getApp, initializeApp } from 'firebase/app';\nimport { getToken, deleteToken } from 'firebase/messaging';\nimport {\n getMessaging,\n onBackgroundMessage,\n isSupported,\n} from 'firebase/messaging/sw';\nimport type { Messaging, MessagePayload } from 'firebase/messaging/sw';\nimport log from 'loglevel';\n\nimport type { NotificationServicesPushControllerMessenger } from '../NotificationServicesPushController.js';\nimport type { PushNotificationEnv } from '../types/firebase.js';\nimport type { PushAnalyticsPayload } from '../types/index.js';\nimport { toPushAnalyticsPayload } from '../utils/to-push-analytics-payload.js';\n\ndeclare const self: ServiceWorkerGlobalScope;\n\n// Exported to help testing\n// eslint-disable-next-line import-x/no-mutable-exports\nexport let supportedCache: boolean | null = null;\n\nconst getPushAvailability = async (): Promise<boolean> => {\n // Race condition is acceptable here - worst case is isSupported() is called\n // multiple times during initialization, which is harmless for caching a boolean\n // eslint-disable-next-line require-atomic-updates\n supportedCache ??= await isSupported();\n return supportedCache;\n};\n\nconst createFirebaseApp = async (\n env: PushNotificationEnv,\n): Promise<FirebaseApp> => {\n try {\n return getApp();\n } catch {\n const firebaseConfig = {\n apiKey: env.apiKey,\n authDomain: env.authDomain,\n storageBucket: env.storageBucket,\n projectId: env.projectId,\n messagingSenderId: env.messagingSenderId,\n appId: env.appId,\n measurementId: env.measurementId,\n };\n return initializeApp(firebaseConfig);\n }\n};\n\nconst getFirebaseMessaging = async (\n env: PushNotificationEnv,\n): Promise<Messaging | null> => {\n const supported = await getPushAvailability();\n if (!supported) {\n return null;\n }\n\n const app = await createFirebaseApp(env);\n return getMessaging(app);\n};\n\n/**\n * Creates a registration token for Firebase Cloud Messaging.\n *\n * @param env - env to configure push notifications\n * @returns A promise that resolves with the registration token or null if an error occurs.\n */\nexport async function createRegToken(\n env: PushNotificationEnv,\n): Promise<string | null> {\n try {\n const messaging = await getFirebaseMessaging(env);\n if (!messaging) {\n return null;\n }\n\n const token = await getToken(messaging, {\n serviceWorkerRegistration: self.registration,\n vapidKey: env.vapidKey,\n });\n return token;\n } catch {\n return null;\n }\n}\n\n/**\n * Deletes the Firebase Cloud Messaging registration token.\n *\n * @param env - env to configure push notifications\n * @returns A promise that resolves with true if the token was successfully deleted, false otherwise.\n */\nexport async function deleteRegToken(\n env: PushNotificationEnv,\n): Promise<boolean> {\n try {\n const messaging = await getFirebaseMessaging(env);\n if (!messaging) {\n return true;\n }\n\n await deleteToken(messaging);\n return true;\n } catch {\n return false;\n }\n}\n\n/**\n * Service Worker Listener for when push notifications are received.\n *\n * @param env - push notification environment\n * @param handler - handler to actually showing notification, MUST BE PROVIDED\n * @returns unsubscribe handler\n */\nasync function listenToPushNotificationsReceived(\n env: PushNotificationEnv,\n handler?: (payload: PushAnalyticsPayload) => void | Promise<void>,\n): Promise<(() => void) | null> {\n const messaging = await getFirebaseMessaging(env);\n if (!messaging) {\n return null;\n }\n\n const unsubscribePushNotifications = onBackgroundMessage(\n messaging,\n // eslint-disable-next-line @typescript-eslint/no-misused-promises\n async (payload: MessagePayload): Promise<void> => {\n try {\n const analyticsPayload = toPushAnalyticsPayload(payload?.data);\n\n if (!analyticsPayload) {\n return;\n }\n\n await handler?.(analyticsPayload);\n } catch (error) {\n // Do Nothing, cannot handle a bad notification\n log.error('Unable to handle push notification:', {\n notification: payload?.data,\n error,\n });\n }\n },\n );\n\n const unsubscribe = (): void => unsubscribePushNotifications();\n return unsubscribe;\n}\n\n/**\n * Service Worker Listener for when a notification is clicked\n *\n * @param handler - listen to NotificationEvent from the service worker\n * @returns unsubscribe handler\n */\nfunction listenToPushNotificationsClicked(\n handler: (e: NotificationEvent, payload: PushAnalyticsPayload) => void,\n): () => void {\n const clickHandler = (event: NotificationEvent): void => {\n // Get Data\n const data: PushAnalyticsPayload = event?.notification?.data;\n handler(event, data);\n };\n\n self.addEventListener('notificationclick', clickHandler);\n const unsubscribe = (): void =>\n self.removeEventListener('notificationclick', clickHandler);\n return unsubscribe;\n}\n\n/**\n * A creator function that assists creating web-specific push notification subscription:\n * 1. Creates subscriptions for receiving and clicking notifications\n * 2. Creates click events when a notification is clicked\n * 3. Publishes controller messenger events\n *\n * @param props - props for this creator function.\n * @param props.onReceivedHandler - allows the developer to handle showing a notification\n * @param props.onClickHandler - allows the developer to handle clicking the notification\n * @param props.messenger - the controller messenger to publish the `onNewNotifications` and `pushNotificationsClicked` events\n * @returns a function that can be used by the controller\n */\nexport function createSubscribeToPushNotifications(props: {\n onReceivedHandler: (payload: PushAnalyticsPayload) => void | Promise<void>;\n onClickHandler: (e: NotificationEvent, payload: PushAnalyticsPayload) => void;\n messenger: NotificationServicesPushControllerMessenger;\n}): (env: PushNotificationEnv) => Promise<() => void> {\n return async function (env: PushNotificationEnv): Promise<() => void> {\n const onBackgroundMessageSub = await listenToPushNotificationsReceived(\n env,\n async (analyticsPayload): Promise<void> => {\n props.messenger.publish(\n 'NotificationServicesPushController:onNewNotifications',\n analyticsPayload,\n );\n await props.onReceivedHandler(analyticsPayload);\n },\n );\n const onClickSub = listenToPushNotificationsClicked(\n (event, analyticsPayload): void => {\n props.messenger.publish(\n 'NotificationServicesPushController:pushNotificationClicked',\n analyticsPayload,\n );\n props.onClickHandler(event, analyticsPayload);\n },\n );\n\n const unsubscribe = (): void => {\n onBackgroundMessageSub?.();\n onClickSub();\n };\n\n return unsubscribe;\n };\n}\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * as NotificationServicesController from './NotificationServicesController/index.js';
|
|
2
|
+
export * as NotificationServicesPushController from './NotificationServicesPushController/index.js';
|
|
3
|
+
export { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PERPS_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, DEFAULT_SOCIAL_AI_PREFERENCES, } from './NotificationServicesController/index.js';
|
|
4
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,8BAA8B,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,kCAAkC,MAAM,+CAA+C,CAAC;AACpG,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,2CAA2C,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export * as NotificationServicesController from './NotificationServicesController/index.js';
|
|
2
|
+
export * as NotificationServicesPushController from './NotificationServicesPushController/index.js';
|
|
3
|
+
export { DEFAULT_AGENTIC_CLI_PREFERENCES, DEFAULT_PERPS_PREFERENCES, DEFAULT_PRICE_ALERT_PREFERENCES, DEFAULT_SOCIAL_AI_PREFERENCES, } from './NotificationServicesController/index.js';
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,8BAA8B,MAAM,2CAA2C,CAAC;AAC5F,OAAO,KAAK,kCAAkC,MAAM,+CAA+C,CAAC;AACpG,OAAO,EACL,+BAA+B,EAC/B,yBAAyB,EACzB,+BAA+B,EAC/B,6BAA6B,GAC9B,MAAM,2CAA2C,CAAC","sourcesContent":["export * as NotificationServicesController from './NotificationServicesController/index.js';\nexport * as NotificationServicesPushController from './NotificationServicesPushController/index.js';\nexport {\n DEFAULT_AGENTIC_CLI_PREFERENCES,\n DEFAULT_PERPS_PREFERENCES,\n DEFAULT_PRICE_ALERT_PREFERENCES,\n DEFAULT_SOCIAL_AI_PREFERENCES,\n} from './NotificationServicesController/index.js';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,0BAA0B,CAAC","sourcesContent":["export * from './is-onchain-notification.js';\nexport * from './notification-api-type-guards.js';\nexport * from './to-raw-notification.js';\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { OnChainNotification } from
|
|
1
|
+
import type { OnChainNotification } from '../NotificationServicesController/types/notification-api/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.
|
|
4
4
|
*
|
|
@@ -6,4 +6,4 @@ import type { OnChainNotification } from "../NotificationServicesController/type
|
|
|
6
6
|
* @returns True if the value is an on-chain notification, false otherwise.
|
|
7
7
|
*/
|
|
8
8
|
export declare function isOnChainRawNotification(notification: unknown): notification is OnChainNotification;
|
|
9
|
-
//# sourceMappingURL=is-onchain-notification.d.
|
|
9
|
+
//# sourceMappingURL=is-onchain-notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-onchain-notification.d.ts","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAEV,mBAAmB,EACpB,MAAM,mEAAmE,CAAC;AAG3E;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,OAAO,GACpB,YAAY,IAAI,mBAAmB,CAErC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isOnChainNotification } from
|
|
1
|
+
import { isOnChainNotification } from './notification-api-type-guards.js';
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.
|
|
4
4
|
*
|
|
@@ -8,4 +8,4 @@ import { isOnChainNotification } from "./notification-api-type-guards.mjs";
|
|
|
8
8
|
export function isOnChainRawNotification(notification) {
|
|
9
9
|
return isOnChainNotification(notification);
|
|
10
10
|
}
|
|
11
|
-
//# sourceMappingURL=is-onchain-notification.
|
|
11
|
+
//# sourceMappingURL=is-onchain-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"is-onchain-notification.js","sourceRoot":"","sources":["../../src/shared/is-onchain-notification.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;GAKG;AACH,MAAM,UAAU,wBAAwB,CACtC,YAAqB;IAErB,OAAO,qBAAqB,CAAC,YAA0C,CAAC,CAAC;AAC3E,CAAC","sourcesContent":["import type {\n UnprocessedRawNotification,\n OnChainNotification,\n} from '../NotificationServicesController/types/notification-api/index.js';\nimport { isOnChainNotification } from './notification-api-type-guards.js';\n\n/**\n * Checks if the given value is an on-chain notification using the v4 `notification_type` discriminator.\n *\n * @param notification - The value to check.\n * @returns True if the value is an on-chain notification, false otherwise.\n */\nexport function isOnChainRawNotification(\n notification: unknown,\n): notification is OnChainNotification {\n return isOnChainNotification(notification as UnprocessedRawNotification);\n}\n"]}
|
package/dist/shared/{notification-api-type-guards.d.mts → notification-api-type-guards.d.ts}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UnprocessedRawNotification, OnChainNotification, PlatformNotification } from
|
|
1
|
+
import type { UnprocessedRawNotification, OnChainNotification, PlatformNotification } from '../NotificationServicesController/types/notification-api/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* Narrows a v4 API notification to an on-chain notification.
|
|
4
4
|
*
|
|
@@ -13,4 +13,4 @@ export declare function isOnChainNotification(notification: UnprocessedRawNotifi
|
|
|
13
13
|
* @returns Whether the notification is a platform notification.
|
|
14
14
|
*/
|
|
15
15
|
export declare function isPlatformNotification(notification: UnprocessedRawNotification): notification is PlatformNotification;
|
|
16
|
-
//# sourceMappingURL=notification-api-type-guards.d.
|
|
16
|
+
//# sourceMappingURL=notification-api-type-guards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-api-type-guards.d.ts","sourceRoot":"","sources":["../../src/shared/notification-api-type-guards.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,0BAA0B,EAC1B,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,mEAAmE,CAAC;AAE3E;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,0BAA0B,GACvC,YAAY,IAAI,mBAAmB,CAErC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACpC,YAAY,EAAE,0BAA0B,GACvC,YAAY,IAAI,oBAAoB,CAEtC"}
|
|
@@ -16,4 +16,4 @@ export function isOnChainNotification(notification) {
|
|
|
16
16
|
export function isPlatformNotification(notification) {
|
|
17
17
|
return !isOnChainNotification(notification);
|
|
18
18
|
}
|
|
19
|
-
//# sourceMappingURL=notification-api-type-guards.
|
|
19
|
+
//# sourceMappingURL=notification-api-type-guards.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notification-api-type-guards.js","sourceRoot":"","sources":["../../src/shared/notification-api-type-guards.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AACH,MAAM,UAAU,qBAAqB,CACnC,YAAwC;IAExC,OAAO,YAAY,CAAC,iBAAiB,KAAK,iBAAiB,CAAC;AAC9D,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAAwC;IAExC,OAAO,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;AAC9C,CAAC","sourcesContent":["import type {\n UnprocessedRawNotification,\n OnChainNotification,\n PlatformNotification,\n} from '../NotificationServicesController/types/notification-api/index.js';\n\n/**\n * Narrows a v4 API notification to an on-chain notification.\n *\n * @param notification - Unprocessed v4 API notification.\n * @returns Whether the notification is an on-chain notification.\n */\nexport function isOnChainNotification(\n notification: UnprocessedRawNotification,\n): notification is OnChainNotification {\n return notification.notification_type === 'wallet_activity';\n}\n\n/**\n * Narrows a v4 API notification to a platform notification.\n *\n * @param notification - Unprocessed v4 API notification.\n * @returns Whether the notification is a platform notification.\n */\nexport function isPlatformNotification(\n notification: UnprocessedRawNotification,\n): notification is PlatformNotification {\n return !isOnChainNotification(notification);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { UnprocessedRawNotification, NormalisedAPINotification } from
|
|
1
|
+
import type { UnprocessedRawNotification, NormalisedAPINotification } from '../NotificationServicesController/types/notification-api/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* A true "raw notification" does not have some fields that exist on this type. E.g. the `type` field.
|
|
4
4
|
* This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.
|
|
@@ -8,4 +8,4 @@ import type { UnprocessedRawNotification, NormalisedAPINotification } from "src/
|
|
|
8
8
|
* @returns a complete raw onchain notification
|
|
9
9
|
*/
|
|
10
10
|
export declare function toRawAPINotification(data: UnprocessedRawNotification): NormalisedAPINotification;
|
|
11
|
-
//# sourceMappingURL=to-raw-notification.d.
|
|
11
|
+
//# sourceMappingURL=to-raw-notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-raw-notification.d.ts","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,0BAA0B,EAC1B,yBAAyB,EAG1B,MAAM,mEAAmE,CAAC;AAG3E;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,0BAA0B,GAC/B,yBAAyB,CAiB3B"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { TRIGGER_TYPES } from
|
|
2
|
-
import { isOnChainNotification } from
|
|
1
|
+
import { TRIGGER_TYPES } from '../NotificationServicesController/constants/notification-schema.js';
|
|
2
|
+
import { isOnChainNotification } from './notification-api-type-guards.js';
|
|
3
3
|
/**
|
|
4
4
|
* A true "raw notification" does not have some fields that exist on this type. E.g. the `type` field.
|
|
5
5
|
* This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.
|
|
@@ -23,4 +23,4 @@ export function toRawAPINotification(data) {
|
|
|
23
23
|
type: TRIGGER_TYPES.PLATFORM,
|
|
24
24
|
};
|
|
25
25
|
}
|
|
26
|
-
//# sourceMappingURL=to-raw-notification.
|
|
26
|
+
//# sourceMappingURL=to-raw-notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"to-raw-notification.js","sourceRoot":"","sources":["../../src/shared/to-raw-notification.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oEAAoE,CAAC;AAOnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;;;GAOG;AACH,MAAM,UAAU,oBAAoB,CAClC,IAAgC;IAEhC,IAAI,qBAAqB,CAAC,IAAI,CAAC,EAAE,CAAC;QAChC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC;YAC7B,MAAM,IAAI,KAAK,CACb,gEAAgE,CACjE,CAAC;QACJ,CAAC;QACD,OAAO;YACL,GAAG,IAAI;YACP,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI;SACH,CAAC;IAC9B,CAAC;IAED,OAAO;QACL,GAAG,IAAI;QACP,IAAI,EAAE,aAAa,CAAC,QAAQ;KACF,CAAC;AAC/B,CAAC","sourcesContent":["import { TRIGGER_TYPES } from '../NotificationServicesController/constants/notification-schema.js';\nimport type {\n UnprocessedRawNotification,\n NormalisedAPINotification,\n OnChainRawNotification,\n PlatformRawNotification,\n} from '../NotificationServicesController/types/notification-api/index.js';\nimport { isOnChainNotification } from './notification-api-type-guards.js';\n\n/**\n * A true \"raw notification\" does not have some fields that exist on this type. E.g. the `type` field.\n * This is retro-actively added when we fetch notifications to be able to easily type-discriminate notifications.\n * We use this to ensure that the correct missing fields are added to the raw shapes\n *\n * @param data - raw onchain notification\n * @returns a complete raw onchain notification\n */\nexport function toRawAPINotification(\n data: UnprocessedRawNotification,\n): NormalisedAPINotification {\n if (isOnChainNotification(data)) {\n if (!data.payload.data?.kind) {\n throw new Error(\n 'toRawAPINotification - No kind found for on-chain notification',\n );\n }\n return {\n ...data,\n type: data.payload.data.kind,\n } as OnChainRawNotification;\n }\n\n return {\n ...data,\n type: TRIGGER_TYPES.PLATFORM,\n } as PlatformRawNotification;\n}\n"]}
|