@metamask-previews/notification-services-controller 0.5.0-preview-9edcf0e0 → 0.5.0-preview-9d310688
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/dist/NotificationServicesController/NotificationServicesController.cjs +803 -0
- package/dist/NotificationServicesController/NotificationServicesController.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/NotificationServicesController.d.ts → NotificationServicesController/NotificationServicesController.d.cts} +7 -7
- package/dist/NotificationServicesController/NotificationServicesController.d.cts.map +1 -0
- package/dist/NotificationServicesController/NotificationServicesController.d.mts +238 -0
- package/dist/NotificationServicesController/NotificationServicesController.d.mts.map +1 -0
- package/dist/NotificationServicesController/NotificationServicesController.mjs +779 -17
- package/dist/NotificationServicesController/NotificationServicesController.mjs.map +1 -1
- package/dist/NotificationServicesController/__fixtures__/index.cjs +22 -0
- package/dist/NotificationServicesController/__fixtures__/index.cjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.d.cts +6 -0
- package/dist/NotificationServicesController/__fixtures__/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.d.mts +6 -0
- package/dist/NotificationServicesController/__fixtures__/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/index.mjs +6 -0
- package/dist/NotificationServicesController/__fixtures__/index.mjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.cjs +210 -0
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/__fixtures__/mock-feature-announcements.d.ts → NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts} +3 -3
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts +15 -0
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.mjs +205 -0
- package/dist/NotificationServicesController/__fixtures__/mock-feature-announcements.mjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.cjs +22 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/__fixtures__/mock-notification-trigger.d.ts → NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts} +2 -2
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts +9 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.mjs +18 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-trigger.mjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs +82 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.ts → NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts} +3 -3
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts +35 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs +76 -0
- package/dist/NotificationServicesController/__fixtures__/mock-notification-user-storage.mjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs +624 -0
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/__fixtures__/mock-raw-notifications.d.ts → NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts} +2 -2
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts +82 -0
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs +605 -0
- package/dist/NotificationServicesController/__fixtures__/mock-raw-notifications.mjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs +50 -0
- package/dist/NotificationServicesController/__fixtures__/mockResponses.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/__fixtures__/mockResponses.d.ts → NotificationServicesController/__fixtures__/mockResponses.d.cts} +5 -5
- package/dist/NotificationServicesController/__fixtures__/mockResponses.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mockResponses.d.mts +28 -0
- package/dist/NotificationServicesController/__fixtures__/mockResponses.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs +42 -0
- package/dist/NotificationServicesController/__fixtures__/mockResponses.mjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mockServices.cjs +56 -0
- package/dist/NotificationServicesController/__fixtures__/mockServices.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/__fixtures__/mockServices.d.ts → NotificationServicesController/__fixtures__/mockServices.d.cts} +2 -2
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts +12 -0
- package/dist/NotificationServicesController/__fixtures__/mockServices.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/mockServices.mjs +52 -0
- package/dist/NotificationServicesController/__fixtures__/mockServices.mjs.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/test-utils.cjs +31 -0
- package/dist/NotificationServicesController/__fixtures__/test-utils.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/__fixtures__/test-utils.d.ts → NotificationServicesController/__fixtures__/test-utils.d.cts} +1 -1
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.cts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts +14 -0
- package/dist/NotificationServicesController/__fixtures__/test-utils.d.mts.map +1 -0
- package/dist/NotificationServicesController/__fixtures__/test-utils.mjs +27 -0
- package/dist/NotificationServicesController/__fixtures__/test-utils.mjs.map +1 -0
- package/dist/NotificationServicesController/constants/constants.cjs +7 -0
- package/dist/NotificationServicesController/constants/constants.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/constants/constants.d.ts → NotificationServicesController/constants/constants.d.cts} +1 -1
- package/dist/NotificationServicesController/constants/constants.d.cts.map +1 -0
- package/dist/NotificationServicesController/constants/constants.d.mts +3 -0
- package/dist/NotificationServicesController/constants/constants.d.mts.map +1 -0
- package/dist/NotificationServicesController/constants/constants.mjs +3 -9
- package/dist/NotificationServicesController/constants/constants.mjs.map +1 -1
- package/dist/NotificationServicesController/constants/index.cjs +19 -0
- package/dist/NotificationServicesController/constants/index.cjs.map +1 -0
- package/dist/NotificationServicesController/constants/index.d.cts +3 -0
- package/dist/NotificationServicesController/constants/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/constants/index.d.mts +3 -0
- package/dist/NotificationServicesController/constants/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/constants/index.mjs +2 -28
- package/dist/NotificationServicesController/constants/index.mjs.map +1 -1
- package/dist/NotificationServicesController/constants/notification-schema.cjs +170 -0
- package/dist/NotificationServicesController/constants/notification-schema.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/constants/notification-schema.d.ts → NotificationServicesController/constants/notification-schema.d.cts} +2 -2
- package/dist/NotificationServicesController/constants/notification-schema.d.cts.map +1 -0
- package/dist/NotificationServicesController/constants/notification-schema.d.mts +48 -0
- package/dist/NotificationServicesController/constants/notification-schema.d.mts.map +1 -0
- package/dist/NotificationServicesController/constants/notification-schema.mjs +165 -20
- package/dist/NotificationServicesController/constants/notification-schema.mjs.map +1 -1
- package/dist/NotificationServicesController/index.cjs +46 -0
- package/dist/NotificationServicesController/index.cjs.map +1 -0
- package/dist/NotificationServicesController/index.d.cts +14 -0
- package/dist/NotificationServicesController/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/index.d.mts +14 -0
- package/dist/NotificationServicesController/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/index.mjs +13 -86
- package/dist/NotificationServicesController/index.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/index.cjs +20 -0
- package/dist/NotificationServicesController/processors/index.cjs.map +1 -0
- package/dist/NotificationServicesController/processors/index.d.cts +4 -0
- package/dist/NotificationServicesController/processors/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/processors/index.d.mts +4 -0
- package/dist/NotificationServicesController/processors/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/processors/index.mjs +3 -21
- package/dist/NotificationServicesController/processors/index.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-feature-announcement.cjs +41 -0
- package/dist/{chunk-52CALMRA.js.map → NotificationServicesController/processors/process-feature-announcement.cjs.map} +1 -1
- package/dist/{types/NotificationServicesController/processors/process-feature-announcement.d.ts → NotificationServicesController/processors/process-feature-announcement.d.cts} +3 -3
- package/dist/NotificationServicesController/processors/process-feature-announcement.d.cts.map +1 -0
- package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts +19 -0
- package/dist/NotificationServicesController/processors/process-feature-announcement.d.mts.map +1 -0
- package/dist/NotificationServicesController/processors/process-feature-announcement.mjs +34 -8
- package/dist/NotificationServicesController/processors/process-feature-announcement.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-notifications.cjs +50 -0
- package/dist/NotificationServicesController/processors/process-notifications.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/processors/process-notifications.d.ts → NotificationServicesController/processors/process-notifications.d.cts} +2 -2
- package/dist/NotificationServicesController/processors/process-notifications.d.cts.map +1 -0
- package/dist/NotificationServicesController/processors/process-notifications.d.mts +19 -0
- package/dist/NotificationServicesController/processors/process-notifications.d.mts.map +1 -0
- package/dist/NotificationServicesController/processors/process-notifications.mjs +44 -12
- package/dist/NotificationServicesController/processors/process-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/processors/process-onchain-notifications.cjs +19 -0
- package/dist/NotificationServicesController/processors/process-onchain-notifications.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/processors/process-onchain-notifications.d.ts → NotificationServicesController/processors/process-onchain-notifications.d.cts} +3 -3
- package/dist/NotificationServicesController/processors/process-onchain-notifications.d.cts.map +1 -0
- package/dist/NotificationServicesController/processors/process-onchain-notifications.d.mts +10 -0
- package/dist/NotificationServicesController/processors/process-onchain-notifications.d.mts.map +1 -0
- package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs +14 -7
- package/dist/NotificationServicesController/processors/process-onchain-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/services/feature-announcements.cjs +97 -0
- package/dist/NotificationServicesController/services/feature-announcements.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/services/feature-announcements.d.ts → NotificationServicesController/services/feature-announcements.d.cts} +4 -4
- package/dist/NotificationServicesController/services/feature-announcements.d.cts.map +1 -0
- package/dist/NotificationServicesController/services/feature-announcements.d.mts +28 -0
- package/dist/NotificationServicesController/services/feature-announcements.d.mts.map +1 -0
- package/dist/NotificationServicesController/services/feature-announcements.mjs +91 -12
- package/dist/NotificationServicesController/services/feature-announcements.mjs.map +1 -1
- package/dist/NotificationServicesController/services/onchain-notifications.cjs +195 -0
- package/dist/NotificationServicesController/services/onchain-notifications.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/services/onchain-notifications.d.ts → NotificationServicesController/services/onchain-notifications.d.cts} +3 -3
- package/dist/NotificationServicesController/services/onchain-notifications.d.cts.map +1 -0
- package/dist/NotificationServicesController/services/onchain-notifications.d.mts +62 -0
- package/dist/NotificationServicesController/services/onchain-notifications.d.mts.map +1 -0
- package/dist/NotificationServicesController/services/onchain-notifications.mjs +190 -29
- package/dist/NotificationServicesController/services/onchain-notifications.mjs.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs +3 -0
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts → NotificationServicesController/types/feature-announcement/feature-announcement.d.cts} +3 -3
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts +32 -0
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.mjs.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.cjs +20 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.d.cts +4 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.d.mts +4 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/index.mjs +3 -4
- package/dist/NotificationServicesController/types/feature-announcement/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs +3 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts → NotificationServicesController/types/feature-announcement/type-feature-announcement.d.cts} +3 -3
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts +39 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.mjs.map +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs +3 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-links.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/types/feature-announcement/type-links.d.ts → NotificationServicesController/types/feature-announcement/type-links.d.cts} +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts +29 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-links.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs +1 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.mjs.map +1 -1
- package/dist/NotificationServicesController/types/index.cjs +21 -0
- package/dist/NotificationServicesController/types/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/index.d.cts +5 -0
- package/dist/NotificationServicesController/types/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/index.d.mts +5 -0
- package/dist/NotificationServicesController/types/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/index.mjs +4 -11
- package/dist/NotificationServicesController/types/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/index.cjs +18 -0
- package/dist/NotificationServicesController/types/notification/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/notification/index.d.cts +2 -0
- package/dist/NotificationServicesController/types/notification/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/notification/index.d.mts +2 -0
- package/dist/NotificationServicesController/types/notification/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/notification/index.mjs +1 -2
- package/dist/NotificationServicesController/types/notification/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/notification/notification.cjs +3 -0
- package/dist/NotificationServicesController/types/notification/notification.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/types/notification/notification.d.ts → NotificationServicesController/types/notification/notification.d.cts} +4 -4
- package/dist/NotificationServicesController/types/notification/notification.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/notification/notification.d.mts +25 -0
- package/dist/NotificationServicesController/types/notification/notification.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/notification/notification.mjs +1 -1
- package/dist/NotificationServicesController/types/notification/notification.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.cjs +18 -0
- package/dist/NotificationServicesController/types/on-chain-notification/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts +2 -0
- package/dist/NotificationServicesController/types/on-chain-notification/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts +2 -0
- package/dist/NotificationServicesController/types/on-chain-notification/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/on-chain-notification/index.mjs +1 -2
- package/dist/NotificationServicesController/types/on-chain-notification/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs +3 -0
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts → NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts} +4 -4
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts +43 -0
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.mjs.map +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs +9 -0
- package/dist/NotificationServicesController/types/on-chain-notification/schema.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/types/on-chain-notification/schema.d.ts → NotificationServicesController/types/on-chain-notification/schema.d.cts} +1 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts +283 -0
- package/dist/NotificationServicesController/types/on-chain-notification/schema.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs +7 -0
- package/dist/NotificationServicesController/types/on-chain-notification/schema.mjs.map +1 -1
- package/dist/NotificationServicesController/types/type-utils.cjs +3 -0
- package/dist/NotificationServicesController/types/type-utils.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/types/type-utils.d.ts → NotificationServicesController/types/type-utils.d.cts} +1 -1
- package/dist/NotificationServicesController/types/type-utils.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/type-utils.d.mts +7 -0
- package/dist/NotificationServicesController/types/type-utils.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/type-utils.mjs +1 -0
- package/dist/NotificationServicesController/types/type-utils.mjs.map +1 -1
- package/dist/NotificationServicesController/types/user-storage/index.cjs +18 -0
- package/dist/NotificationServicesController/types/user-storage/index.cjs.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.cts +2 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.mts +2 -0
- package/dist/NotificationServicesController/types/user-storage/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/index.mjs +1 -2
- package/dist/NotificationServicesController/types/user-storage/index.mjs.map +1 -1
- package/dist/NotificationServicesController/types/user-storage/user-storage.cjs +3 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/types/user-storage/user-storage.d.ts → NotificationServicesController/types/user-storage/user-storage.d.cts} +3 -3
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.cts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts +26 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.d.mts.map +1 -0
- package/dist/NotificationServicesController/types/user-storage/user-storage.mjs +1 -1
- package/dist/NotificationServicesController/types/user-storage/user-storage.mjs.map +1 -1
- package/dist/NotificationServicesController/ui/constants.cjs +62 -0
- package/dist/NotificationServicesController/ui/constants.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/ui/constants.d.ts → NotificationServicesController/ui/constants.d.cts} +2 -2
- package/dist/NotificationServicesController/ui/constants.d.cts.map +1 -0
- package/dist/NotificationServicesController/ui/constants.d.mts +54 -0
- package/dist/NotificationServicesController/ui/constants.d.mts.map +1 -0
- package/dist/NotificationServicesController/ui/constants.mjs +56 -14
- package/dist/NotificationServicesController/ui/constants.mjs.map +1 -1
- package/dist/NotificationServicesController/ui/index.cjs +18 -0
- package/dist/NotificationServicesController/ui/index.cjs.map +1 -0
- package/dist/NotificationServicesController/ui/index.d.cts +2 -0
- package/dist/NotificationServicesController/ui/index.d.cts.map +1 -0
- package/dist/NotificationServicesController/ui/index.d.mts +2 -0
- package/dist/NotificationServicesController/ui/index.d.mts.map +1 -0
- package/dist/NotificationServicesController/ui/index.mjs +1 -16
- package/dist/NotificationServicesController/ui/index.mjs.map +1 -1
- package/dist/NotificationServicesController/utils/utils.cjs +348 -0
- package/dist/NotificationServicesController/utils/utils.cjs.map +1 -0
- package/dist/{types/NotificationServicesController/utils/utils.d.ts → NotificationServicesController/utils/utils.d.cts} +3 -3
- package/dist/NotificationServicesController/utils/utils.d.cts.map +1 -0
- package/dist/NotificationServicesController/utils/utils.d.mts +142 -0
- package/dist/NotificationServicesController/utils/utils.d.mts.map +1 -0
- package/dist/NotificationServicesController/utils/utils.mjs +332 -31
- package/dist/NotificationServicesController/utils/utils.mjs.map +1 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs +215 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/NotificationServicesPushController.d.ts → NotificationServicesPushController/NotificationServicesPushController.d.cts} +6 -6
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts +112 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs +214 -37
- package/dist/NotificationServicesPushController/NotificationServicesPushController.mjs.map +1 -1
- package/dist/NotificationServicesPushController/__fixtures__/index.cjs +18 -0
- package/dist/NotificationServicesPushController/__fixtures__/index.cjs.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/index.d.cts +2 -0
- package/dist/NotificationServicesPushController/__fixtures__/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/index.d.mts +2 -0
- package/dist/NotificationServicesPushController/__fixtures__/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/index.mjs +2 -0
- package/dist/NotificationServicesPushController/__fixtures__/index.mjs.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs +57 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/__fixtures__/mockResponse.d.ts → NotificationServicesPushController/__fixtures__/mockResponse.d.cts} +2 -2
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts +43 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs +50 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockResponse.mjs.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs +31 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/__fixtures__/mockServices.d.ts → NotificationServicesPushController/__fixtures__/mockServices.d.cts} +2 -2
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts +9 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs +30 -0
- package/dist/NotificationServicesPushController/__fixtures__/mockServices.mjs.map +1 -0
- package/dist/NotificationServicesPushController/constants.cjs +14 -0
- package/dist/NotificationServicesPushController/constants.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/constants.d.ts → NotificationServicesPushController/constants.d.cts} +1 -1
- package/dist/NotificationServicesPushController/constants.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/constants.d.mts +11 -0
- package/dist/NotificationServicesPushController/constants.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/constants.mjs +10 -25
- package/dist/NotificationServicesPushController/constants.mjs.map +1 -1
- package/dist/NotificationServicesPushController/index.cjs +43 -0
- package/dist/NotificationServicesPushController/index.cjs.map +1 -0
- package/dist/NotificationServicesPushController/index.d.cts +11 -0
- package/dist/NotificationServicesPushController/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/index.d.mts +11 -0
- package/dist/NotificationServicesPushController/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/index.mjs +10 -71
- package/dist/NotificationServicesPushController/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.cjs +6 -0
- package/dist/NotificationServicesPushController/services/endpoints.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/services/endpoints.d.ts → NotificationServicesPushController/services/endpoints.d.cts} +1 -1
- package/dist/NotificationServicesPushController/services/endpoints.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/services/endpoints.d.mts +2 -0
- package/dist/NotificationServicesPushController/services/endpoints.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/services/endpoints.mjs +2 -7
- package/dist/NotificationServicesPushController/services/endpoints.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/push/index.cjs +3 -0
- package/dist/NotificationServicesPushController/services/push/index.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/services/push/index.d.ts → NotificationServicesPushController/services/push/index.d.cts} +2 -2
- package/dist/NotificationServicesPushController/services/push/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/services/push/index.d.mts +6 -0
- package/dist/NotificationServicesPushController/services/push/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/services/push/index.mjs +1 -0
- package/dist/NotificationServicesPushController/services/push/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/push/push-web.cjs +121 -0
- package/dist/NotificationServicesPushController/services/push/push-web.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/services/push/push-web.d.ts → NotificationServicesPushController/services/push/push-web.d.cts} +3 -3
- package/dist/NotificationServicesPushController/services/push/push-web.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/services/push/push-web.d.mts +32 -0
- package/dist/NotificationServicesPushController/services/push/push-web.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/services/push/push-web.mjs +116 -38
- package/dist/NotificationServicesPushController/services/push/push-web.mjs.map +1 -1
- package/dist/NotificationServicesPushController/services/services.cjs +197 -0
- package/dist/NotificationServicesPushController/services/services.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/services/services.d.ts → NotificationServicesPushController/services/services.d.cts} +4 -4
- package/dist/NotificationServicesPushController/services/services.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/services/services.d.mts +95 -0
- package/dist/NotificationServicesPushController/services/services.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/services/services.mjs +168 -45
- package/dist/NotificationServicesPushController/services/services.mjs.map +1 -1
- package/dist/NotificationServicesPushController/types/firebase.cjs +3 -0
- package/dist/NotificationServicesPushController/types/firebase.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/types/firebase.d.ts → NotificationServicesPushController/types/firebase.d.cts} +1 -1
- package/dist/NotificationServicesPushController/types/firebase.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/types/firebase.d.mts +53 -0
- package/dist/NotificationServicesPushController/types/firebase.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/types/firebase.mjs +1 -1
- package/dist/NotificationServicesPushController/types/firebase.mjs.map +1 -1
- package/dist/NotificationServicesPushController/types/index.cjs +18 -0
- package/dist/NotificationServicesPushController/types/index.cjs.map +1 -0
- package/dist/NotificationServicesPushController/types/index.d.cts +2 -0
- package/dist/NotificationServicesPushController/types/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/types/index.d.mts +2 -0
- package/dist/NotificationServicesPushController/types/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/types/index.mjs +1 -2
- package/dist/NotificationServicesPushController/types/index.mjs.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-data.cjs +84 -0
- package/dist/NotificationServicesPushController/utils/get-notification-data.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/utils/get-notification-data.d.ts → NotificationServicesPushController/utils/get-notification-data.d.cts} +2 -2
- package/dist/NotificationServicesPushController/utils/get-notification-data.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts +42 -0
- package/dist/NotificationServicesPushController/utils/get-notification-data.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/utils/get-notification-data.mjs +76 -12
- package/dist/NotificationServicesPushController/utils/get-notification-data.mjs.map +1 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.cjs +190 -0
- package/dist/NotificationServicesPushController/utils/get-notification-message.cjs.map +1 -0
- package/dist/{types/NotificationServicesPushController/utils/get-notification-message.d.ts → NotificationServicesPushController/utils/get-notification-message.d.cts} +3 -3
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts +67 -0
- package/dist/NotificationServicesPushController/utils/get-notification-message.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs +182 -37
- package/dist/NotificationServicesPushController/utils/get-notification-message.mjs.map +1 -1
- package/dist/NotificationServicesPushController/utils/index.cjs +19 -0
- package/dist/NotificationServicesPushController/utils/index.cjs.map +1 -0
- package/dist/NotificationServicesPushController/utils/index.d.cts +3 -0
- package/dist/NotificationServicesPushController/utils/index.d.cts.map +1 -0
- package/dist/NotificationServicesPushController/utils/index.d.mts +3 -0
- package/dist/NotificationServicesPushController/utils/index.d.mts.map +1 -0
- package/dist/NotificationServicesPushController/utils/index.mjs +2 -48
- package/dist/NotificationServicesPushController/utils/index.mjs.map +1 -1
- package/dist/index.cjs +29 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +2 -45
- package/dist/index.mjs.map +1 -1
- package/dist/shared/to-raw-notification.cjs +19 -0
- package/dist/shared/to-raw-notification.cjs.map +1 -0
- package/dist/{types/shared/to-raw-notification.d.ts → shared/to-raw-notification.d.cts} +2 -2
- package/dist/shared/to-raw-notification.d.cts.map +1 -0
- package/dist/shared/to-raw-notification.d.mts +11 -0
- package/dist/shared/to-raw-notification.d.mts.map +1 -0
- package/dist/shared/to-raw-notification.mjs +14 -7
- package/dist/shared/to-raw-notification.mjs.map +1 -1
- package/package.json +12 -7
- package/dist/NotificationServicesController/NotificationServicesController.js +0 -19
- package/dist/NotificationServicesController/NotificationServicesController.js.map +0 -1
- package/dist/NotificationServicesController/constants/constants.js +0 -10
- package/dist/NotificationServicesController/constants/constants.js.map +0 -1
- package/dist/NotificationServicesController/constants/index.js +0 -29
- package/dist/NotificationServicesController/constants/index.js.map +0 -1
- package/dist/NotificationServicesController/constants/notification-schema.js +0 -22
- package/dist/NotificationServicesController/constants/notification-schema.js.map +0 -1
- package/dist/NotificationServicesController/index.js +0 -87
- package/dist/NotificationServicesController/index.js.map +0 -1
- package/dist/NotificationServicesController/processors/index.js +0 -22
- package/dist/NotificationServicesController/processors/index.js.map +0 -1
- package/dist/NotificationServicesController/processors/process-feature-announcement.js +0 -10
- package/dist/NotificationServicesController/processors/process-feature-announcement.js.map +0 -1
- package/dist/NotificationServicesController/processors/process-notifications.js +0 -13
- package/dist/NotificationServicesController/processors/process-notifications.js.map +0 -1
- package/dist/NotificationServicesController/processors/process-onchain-notifications.js +0 -8
- package/dist/NotificationServicesController/processors/process-onchain-notifications.js.map +0 -1
- package/dist/NotificationServicesController/services/feature-announcements.js +0 -14
- package/dist/NotificationServicesController/services/feature-announcements.js.map +0 -1
- package/dist/NotificationServicesController/services/onchain-notifications.js +0 -30
- package/dist/NotificationServicesController/services/onchain-notifications.js.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js +0 -2
- package/dist/NotificationServicesController/types/feature-announcement/feature-announcement.js.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/index.js +0 -5
- package/dist/NotificationServicesController/types/feature-announcement/index.js.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js +0 -2
- package/dist/NotificationServicesController/types/feature-announcement/type-feature-announcement.js.map +0 -1
- package/dist/NotificationServicesController/types/feature-announcement/type-links.js +0 -2
- package/dist/NotificationServicesController/types/feature-announcement/type-links.js.map +0 -1
- package/dist/NotificationServicesController/types/index.js +0 -12
- package/dist/NotificationServicesController/types/index.js.map +0 -1
- package/dist/NotificationServicesController/types/notification/index.js +0 -3
- package/dist/NotificationServicesController/types/notification/index.js.map +0 -1
- package/dist/NotificationServicesController/types/notification/notification.js +0 -2
- package/dist/NotificationServicesController/types/notification/notification.js.map +0 -1
- package/dist/NotificationServicesController/types/on-chain-notification/index.js +0 -3
- package/dist/NotificationServicesController/types/on-chain-notification/index.js.map +0 -1
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.js +0 -2
- package/dist/NotificationServicesController/types/on-chain-notification/on-chain-notification.js.map +0 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.js +0 -1
- package/dist/NotificationServicesController/types/on-chain-notification/schema.js.map +0 -1
- package/dist/NotificationServicesController/types/type-utils.js +0 -1
- package/dist/NotificationServicesController/types/type-utils.js.map +0 -1
- package/dist/NotificationServicesController/types/user-storage/index.js +0 -3
- package/dist/NotificationServicesController/types/user-storage/index.js.map +0 -1
- package/dist/NotificationServicesController/types/user-storage/user-storage.js +0 -2
- package/dist/NotificationServicesController/types/user-storage/user-storage.js.map +0 -1
- package/dist/NotificationServicesController/ui/constants.js +0 -16
- package/dist/NotificationServicesController/ui/constants.js.map +0 -1
- package/dist/NotificationServicesController/ui/index.js +0 -17
- package/dist/NotificationServicesController/ui/index.js.map +0 -1
- package/dist/NotificationServicesController/utils/utils.js +0 -32
- package/dist/NotificationServicesController/utils/utils.js.map +0 -1
- package/dist/NotificationServicesPushController/NotificationServicesPushController.js +0 -39
- package/dist/NotificationServicesPushController/NotificationServicesPushController.js.map +0 -1
- package/dist/NotificationServicesPushController/constants.js +0 -26
- package/dist/NotificationServicesPushController/constants.js.map +0 -1
- package/dist/NotificationServicesPushController/index.js +0 -72
- package/dist/NotificationServicesPushController/index.js.map +0 -1
- package/dist/NotificationServicesPushController/services/endpoints.js +0 -8
- package/dist/NotificationServicesPushController/services/endpoints.js.map +0 -1
- package/dist/NotificationServicesPushController/services/push/index.js +0 -1
- package/dist/NotificationServicesPushController/services/push/index.js.map +0 -1
- package/dist/NotificationServicesPushController/services/push/push-web.js +0 -40
- package/dist/NotificationServicesPushController/services/push/push-web.js.map +0 -1
- package/dist/NotificationServicesPushController/services/services.js +0 -46
- package/dist/NotificationServicesPushController/services/services.js.map +0 -1
- package/dist/NotificationServicesPushController/types/firebase.js +0 -2
- package/dist/NotificationServicesPushController/types/firebase.js.map +0 -1
- package/dist/NotificationServicesPushController/types/index.js +0 -3
- package/dist/NotificationServicesPushController/types/index.js.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-data.js +0 -14
- package/dist/NotificationServicesPushController/utils/get-notification-data.js.map +0 -1
- package/dist/NotificationServicesPushController/utils/get-notification-message.js +0 -39
- package/dist/NotificationServicesPushController/utils/get-notification-message.js.map +0 -1
- package/dist/NotificationServicesPushController/utils/index.js +0 -49
- package/dist/NotificationServicesPushController/utils/index.js.map +0 -1
- package/dist/chunk-232HZSEV.js +0 -7
- package/dist/chunk-232HZSEV.js.map +0 -1
- package/dist/chunk-2P5WP5NT.mjs +0 -37
- package/dist/chunk-2P5WP5NT.mjs.map +0 -1
- package/dist/chunk-3ZS2HAEG.js +0 -1
- package/dist/chunk-3ZS2HAEG.js.map +0 -1
- package/dist/chunk-4BTNTREI.mjs +0 -1
- package/dist/chunk-4BTNTREI.mjs.map +0 -1
- package/dist/chunk-4QXAPVW3.mjs +0 -1
- package/dist/chunk-4QXAPVW3.mjs.map +0 -1
- package/dist/chunk-52CALMRA.js +0 -28
- package/dist/chunk-53F3SYYM.mjs +0 -178
- package/dist/chunk-53F3SYYM.mjs.map +0 -1
- package/dist/chunk-5FAAZCBK.mjs +0 -29
- package/dist/chunk-5FAAZCBK.mjs.map +0 -1
- package/dist/chunk-6FLC6CJD.js +0 -149
- package/dist/chunk-6FLC6CJD.js.map +0 -1
- package/dist/chunk-6ZDVTRRT.mjs +0 -9
- package/dist/chunk-6ZDVTRRT.mjs.map +0 -1
- package/dist/chunk-77QIITUL.mjs +0 -67
- package/dist/chunk-77QIITUL.mjs.map +0 -1
- package/dist/chunk-7LWR54U7.js +0 -7
- package/dist/chunk-7LWR54U7.js.map +0 -1
- package/dist/chunk-7PWKQSM2.mjs +0 -972
- package/dist/chunk-7PWKQSM2.mjs.map +0 -1
- package/dist/chunk-7RM3YNTD.mjs +0 -1
- package/dist/chunk-7RM3YNTD.mjs.map +0 -1
- package/dist/chunk-A2RPVX47.mjs +0 -1
- package/dist/chunk-A2RPVX47.mjs.map +0 -1
- package/dist/chunk-B25TJ7KS.js +0 -8
- package/dist/chunk-B25TJ7KS.js.map +0 -1
- package/dist/chunk-B4ECJJ5C.mjs +0 -7
- package/dist/chunk-B4ECJJ5C.mjs.map +0 -1
- package/dist/chunk-BONB66A2.mjs +0 -14
- package/dist/chunk-BONB66A2.mjs.map +0 -1
- package/dist/chunk-C62SK2KY.mjs +0 -92
- package/dist/chunk-C62SK2KY.mjs.map +0 -1
- package/dist/chunk-CGPMMFUQ.mjs +0 -96
- package/dist/chunk-CGPMMFUQ.mjs.map +0 -1
- package/dist/chunk-CWZQMK63.mjs +0 -118
- package/dist/chunk-CWZQMK63.mjs.map +0 -1
- package/dist/chunk-D42BBXBM.mjs +0 -28
- package/dist/chunk-D42BBXBM.mjs.map +0 -1
- package/dist/chunk-DINCLRZT.mjs +0 -12
- package/dist/chunk-DINCLRZT.mjs.map +0 -1
- package/dist/chunk-DMH4NSLF.js +0 -1
- package/dist/chunk-DMH4NSLF.js.map +0 -1
- package/dist/chunk-DT6SLUWJ.js +0 -12
- package/dist/chunk-DT6SLUWJ.js.map +0 -1
- package/dist/chunk-EJ52BDLB.js +0 -55
- package/dist/chunk-EJ52BDLB.js.map +0 -1
- package/dist/chunk-ER475D6V.mjs +0 -231
- package/dist/chunk-ER475D6V.mjs.map +0 -1
- package/dist/chunk-G52DNXFH.mjs +0 -1
- package/dist/chunk-G52DNXFH.mjs.map +0 -1
- package/dist/chunk-GETQWOTI.js +0 -1
- package/dist/chunk-GETQWOTI.js.map +0 -1
- package/dist/chunk-HCDICNYK.js +0 -207
- package/dist/chunk-HCDICNYK.js.map +0 -1
- package/dist/chunk-HE3P5RM7.js +0 -178
- package/dist/chunk-HE3P5RM7.js.map +0 -1
- package/dist/chunk-HPUQYDVC.js +0 -1
- package/dist/chunk-HPUQYDVC.js.map +0 -1
- package/dist/chunk-HT6T5R4U.js +0 -96
- package/dist/chunk-HT6T5R4U.js.map +0 -1
- package/dist/chunk-IDO4JFV5.mjs +0 -1
- package/dist/chunk-IDO4JFV5.mjs.map +0 -1
- package/dist/chunk-IGY2S5BC.js +0 -36
- package/dist/chunk-IGY2S5BC.js.map +0 -1
- package/dist/chunk-IKWNHNJQ.mjs +0 -8
- package/dist/chunk-IKWNHNJQ.mjs.map +0 -1
- package/dist/chunk-IOMDG67D.mjs +0 -7
- package/dist/chunk-IOMDG67D.mjs.map +0 -1
- package/dist/chunk-IPI7BAW3.js +0 -1
- package/dist/chunk-IPI7BAW3.js.map +0 -1
- package/dist/chunk-JIJXHO5V.js +0 -885
- package/dist/chunk-JIJXHO5V.js.map +0 -1
- package/dist/chunk-JQ7WKFCI.mjs +0 -1
- package/dist/chunk-JQ7WKFCI.mjs.map +0 -1
- package/dist/chunk-JW3TK3NU.js +0 -221
- package/dist/chunk-JW3TK3NU.js.map +0 -1
- package/dist/chunk-KGLHGLER.js +0 -231
- package/dist/chunk-KGLHGLER.js.map +0 -1
- package/dist/chunk-LGXHJ24K.js +0 -92
- package/dist/chunk-LGXHJ24K.js.map +0 -1
- package/dist/chunk-LYEXYTOI.js +0 -14
- package/dist/chunk-LYEXYTOI.js.map +0 -1
- package/dist/chunk-LZMC2QML.mjs +0 -25
- package/dist/chunk-LZMC2QML.mjs.map +0 -1
- package/dist/chunk-MG5QDUDI.mjs +0 -48
- package/dist/chunk-MG5QDUDI.mjs.map +0 -1
- package/dist/chunk-MNBV5FJI.mjs +0 -31
- package/dist/chunk-MNBV5FJI.mjs.map +0 -1
- package/dist/chunk-NIPCK74T.js +0 -185
- package/dist/chunk-NIPCK74T.js.map +0 -1
- package/dist/chunk-O45HYLIV.js +0 -67
- package/dist/chunk-O45HYLIV.js.map +0 -1
- package/dist/chunk-ODI2BTKS.mjs +0 -55
- package/dist/chunk-ODI2BTKS.mjs.map +0 -1
- package/dist/chunk-OHFX4S6R.mjs +0 -185
- package/dist/chunk-OHFX4S6R.mjs.map +0 -1
- package/dist/chunk-OMBFVTP2.js +0 -37
- package/dist/chunk-OMBFVTP2.js.map +0 -1
- package/dist/chunk-PJMQ2XEG.js +0 -29
- package/dist/chunk-PJMQ2XEG.js.map +0 -1
- package/dist/chunk-PNCS6GEX.mjs +0 -1
- package/dist/chunk-PNCS6GEX.mjs.map +0 -1
- package/dist/chunk-PROWNV4M.js +0 -1
- package/dist/chunk-PROWNV4M.js.map +0 -1
- package/dist/chunk-QAOZN4AX.js +0 -25
- package/dist/chunk-QAOZN4AX.js.map +0 -1
- package/dist/chunk-QB5IFRLA.mjs +0 -1
- package/dist/chunk-QB5IFRLA.mjs.map +0 -1
- package/dist/chunk-RAUV5UV4.mjs +0 -1
- package/dist/chunk-RAUV5UV4.mjs.map +0 -1
- package/dist/chunk-SGLVWM4N.js +0 -48
- package/dist/chunk-SGLVWM4N.js.map +0 -1
- package/dist/chunk-TLX5QQK5.js +0 -9
- package/dist/chunk-TLX5QQK5.js.map +0 -1
- package/dist/chunk-U5UIDVOO.mjs +0 -36
- package/dist/chunk-U5UIDVOO.mjs.map +0 -1
- package/dist/chunk-U74Q3BRP.mjs +0 -1
- package/dist/chunk-U74Q3BRP.mjs.map +0 -1
- package/dist/chunk-UQ6MTYIR.js +0 -972
- package/dist/chunk-UQ6MTYIR.js.map +0 -1
- package/dist/chunk-UZHUVXRM.js +0 -31
- package/dist/chunk-UZHUVXRM.js.map +0 -1
- package/dist/chunk-V5HMYDWE.js +0 -1
- package/dist/chunk-V5HMYDWE.js.map +0 -1
- package/dist/chunk-VZMQIJMK.mjs +0 -149
- package/dist/chunk-VZMQIJMK.mjs.map +0 -1
- package/dist/chunk-W7IP4LDB.js +0 -118
- package/dist/chunk-W7IP4LDB.js.map +0 -1
- package/dist/chunk-WE4RFGT7.mjs +0 -885
- package/dist/chunk-WE4RFGT7.mjs.map +0 -1
- package/dist/chunk-WGBEAP2F.mjs +0 -207
- package/dist/chunk-WGBEAP2F.mjs.map +0 -1
- package/dist/chunk-WRYFIWNK.js +0 -1
- package/dist/chunk-WRYFIWNK.js.map +0 -1
- package/dist/chunk-XZEVRYUE.js +0 -1
- package/dist/chunk-XZEVRYUE.js.map +0 -1
- package/dist/chunk-YUMIJSUD.mjs +0 -221
- package/dist/chunk-YUMIJSUD.mjs.map +0 -1
- package/dist/chunk-ZBNBZN5H.js +0 -1
- package/dist/chunk-ZBNBZN5H.js.map +0 -1
- package/dist/chunk-ZV3DFBO4.js +0 -1
- package/dist/chunk-ZV3DFBO4.js.map +0 -1
- package/dist/index.js +0 -46
- package/dist/index.js.map +0 -1
- package/dist/shared/to-raw-notification.js +0 -8
- package/dist/shared/to-raw-notification.js.map +0 -1
- package/dist/tsconfig.build.tsbuildinfo +0 -1
- package/dist/types/NotificationServicesController/NotificationServicesController.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/index.d.ts +0 -6
- package/dist/types/NotificationServicesController/__fixtures__/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/mock-feature-announcements.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/mock-notification-trigger.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/mock-notification-user-storage.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/mock-raw-notifications.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/mockResponses.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/mockServices.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/__fixtures__/test-utils.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/constants/constants.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/constants/index.d.ts +0 -3
- package/dist/types/NotificationServicesController/constants/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/constants/notification-schema.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/index.d.ts +0 -14
- package/dist/types/NotificationServicesController/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/processors/index.d.ts +0 -4
- package/dist/types/NotificationServicesController/processors/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/processors/process-feature-announcement.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/processors/process-notifications.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/processors/process-onchain-notifications.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/services/feature-announcements.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/services/onchain-notifications.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/feature-announcement/feature-announcement.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/feature-announcement/index.d.ts +0 -4
- package/dist/types/NotificationServicesController/types/feature-announcement/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/feature-announcement/type-feature-announcement.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/feature-announcement/type-links.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/index.d.ts +0 -5
- package/dist/types/NotificationServicesController/types/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/notification/index.d.ts +0 -2
- package/dist/types/NotificationServicesController/types/notification/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/notification/notification.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/on-chain-notification/index.d.ts +0 -2
- package/dist/types/NotificationServicesController/types/on-chain-notification/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/on-chain-notification/on-chain-notification.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/on-chain-notification/schema.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/type-utils.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/user-storage/index.d.ts +0 -2
- package/dist/types/NotificationServicesController/types/user-storage/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/types/user-storage/user-storage.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/ui/constants.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/ui/index.d.ts +0 -2
- package/dist/types/NotificationServicesController/ui/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesController/utils/utils.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/NotificationServicesPushController.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts +0 -2
- package/dist/types/NotificationServicesPushController/__fixtures__/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/__fixtures__/mockResponse.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/__fixtures__/mockServices.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/constants.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/index.d.ts +0 -11
- package/dist/types/NotificationServicesPushController/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/services/endpoints.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/services/push/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/services/push/push-web.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/services/services.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/types/firebase.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/types/index.d.ts +0 -2
- package/dist/types/NotificationServicesPushController/types/index.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/utils/get-notification-data.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/utils/get-notification-message.d.ts.map +0 -1
- package/dist/types/NotificationServicesPushController/utils/index.d.ts +0 -3
- package/dist/types/NotificationServicesPushController/utils/index.d.ts.map +0 -1
- package/dist/types/index.d.ts +0 -3
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/shared/to-raw-notification.d.ts.map +0 -1
|
@@ -1,19 +1,781 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
import "../chunk-BONB66A2.mjs";
|
|
7
|
-
import "../chunk-C62SK2KY.mjs";
|
|
8
|
-
import "../chunk-D42BBXBM.mjs";
|
|
9
|
-
import "../chunk-OHFX4S6R.mjs";
|
|
10
|
-
import "../chunk-YUMIJSUD.mjs";
|
|
11
|
-
import "../chunk-53F3SYYM.mjs";
|
|
12
|
-
import "../chunk-DINCLRZT.mjs";
|
|
13
|
-
import "../chunk-6ZDVTRRT.mjs";
|
|
14
|
-
import "../chunk-U5UIDVOO.mjs";
|
|
15
|
-
export {
|
|
16
|
-
NotificationServicesController as default,
|
|
17
|
-
defaultState
|
|
1
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
|
2
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
|
3
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
|
4
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
|
5
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
|
18
6
|
};
|
|
7
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
8
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
9
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
|
+
};
|
|
12
|
+
var _NotificationServicesController_instances, _NotificationServicesController_isPushIntegrated, _NotificationServicesController_isPushNotificationsSetup, _NotificationServicesController_isUnlocked, _NotificationServicesController_keyringController, _NotificationServicesController_auth, _NotificationServicesController_storage, _NotificationServicesController_pushNotifications, _NotificationServicesController_accounts, _NotificationServicesController_featureAnnouncementEnv, _NotificationServicesController_registerMessageHandlers, _NotificationServicesController_clearLoadingStates, _NotificationServicesController_assertAuthEnabled, _NotificationServicesController_getValidStorageKeyAndBearerToken, _NotificationServicesController_performEnableProfileSyncing, _NotificationServicesController_assertUserStorage, _NotificationServicesController_getUserStorage, _NotificationServicesController_setIsUpdatingMetamaskNotifications, _NotificationServicesController_setIsFetchingMetamaskNotifications, _NotificationServicesController_setIsCheckingAccountsPresence, _NotificationServicesController_updateUpdatingAccountsState, _NotificationServicesController_clearUpdatingAccountsState;
|
|
13
|
+
function $importDefault(module) {
|
|
14
|
+
if (module?.__esModule) {
|
|
15
|
+
return module.default;
|
|
16
|
+
}
|
|
17
|
+
return module;
|
|
18
|
+
}
|
|
19
|
+
import { BaseController } from "@metamask/base-controller";
|
|
20
|
+
import { toChecksumHexAddress } from "@metamask/controller-utils";
|
|
21
|
+
import $log from "loglevel";
|
|
22
|
+
const log = $importDefault($log);
|
|
23
|
+
import { USER_STORAGE_VERSION_KEY } from "./constants/constants.mjs";
|
|
24
|
+
import { TRIGGER_TYPES } from "./constants/notification-schema.mjs";
|
|
25
|
+
import { safeProcessNotification } from "./processors/process-notifications.mjs";
|
|
26
|
+
import * as FeatureNotifications from "./services/feature-announcements.mjs";
|
|
27
|
+
import * as OnChainNotifications from "./services/onchain-notifications.mjs";
|
|
28
|
+
import * as Utils from "./utils/utils.mjs";
|
|
29
|
+
// Unique name for the controller
|
|
30
|
+
const controllerName = 'NotificationServicesController';
|
|
31
|
+
const metadata = {
|
|
32
|
+
subscriptionAccountsSeen: {
|
|
33
|
+
persist: true,
|
|
34
|
+
anonymous: true,
|
|
35
|
+
},
|
|
36
|
+
isMetamaskNotificationsFeatureSeen: {
|
|
37
|
+
persist: true,
|
|
38
|
+
anonymous: false,
|
|
39
|
+
},
|
|
40
|
+
isNotificationServicesEnabled: {
|
|
41
|
+
persist: true,
|
|
42
|
+
anonymous: false,
|
|
43
|
+
},
|
|
44
|
+
isFeatureAnnouncementsEnabled: {
|
|
45
|
+
persist: true,
|
|
46
|
+
anonymous: false,
|
|
47
|
+
},
|
|
48
|
+
metamaskNotificationsList: {
|
|
49
|
+
persist: true,
|
|
50
|
+
anonymous: true,
|
|
51
|
+
},
|
|
52
|
+
metamaskNotificationsReadList: {
|
|
53
|
+
persist: true,
|
|
54
|
+
anonymous: true,
|
|
55
|
+
},
|
|
56
|
+
isUpdatingMetamaskNotifications: {
|
|
57
|
+
persist: false,
|
|
58
|
+
anonymous: false,
|
|
59
|
+
},
|
|
60
|
+
isFetchingMetamaskNotifications: {
|
|
61
|
+
persist: false,
|
|
62
|
+
anonymous: false,
|
|
63
|
+
},
|
|
64
|
+
isUpdatingMetamaskNotificationsAccount: {
|
|
65
|
+
persist: false,
|
|
66
|
+
anonymous: false,
|
|
67
|
+
},
|
|
68
|
+
isCheckingAccountsPresence: {
|
|
69
|
+
persist: false,
|
|
70
|
+
anonymous: false,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
export const defaultState = {
|
|
74
|
+
subscriptionAccountsSeen: [],
|
|
75
|
+
isMetamaskNotificationsFeatureSeen: false,
|
|
76
|
+
isNotificationServicesEnabled: false,
|
|
77
|
+
isFeatureAnnouncementsEnabled: false,
|
|
78
|
+
metamaskNotificationsList: [],
|
|
79
|
+
metamaskNotificationsReadList: [],
|
|
80
|
+
isUpdatingMetamaskNotifications: false,
|
|
81
|
+
isFetchingMetamaskNotifications: false,
|
|
82
|
+
isUpdatingMetamaskNotificationsAccount: [],
|
|
83
|
+
isCheckingAccountsPresence: false,
|
|
84
|
+
};
|
|
85
|
+
/**
|
|
86
|
+
* Controller that enables wallet notifications and feature announcements
|
|
87
|
+
*/
|
|
88
|
+
class NotificationServicesController extends BaseController {
|
|
89
|
+
/**
|
|
90
|
+
* Creates a NotificationServicesController instance.
|
|
91
|
+
*
|
|
92
|
+
* @param args - The arguments to this function.
|
|
93
|
+
* @param args.messenger - Messenger used to communicate with BaseV2 controller.
|
|
94
|
+
* @param args.state - Initial state to set on this controller.
|
|
95
|
+
* @param args.env - environment variables for a given controller.
|
|
96
|
+
* @param args.env.featureAnnouncements - env variables for feature announcements.
|
|
97
|
+
* @param args.env.isPushIntegrated - toggle push notifications on/off if client has integrated them.
|
|
98
|
+
*/
|
|
99
|
+
constructor({ messenger, state, env, }) {
|
|
100
|
+
super({
|
|
101
|
+
messenger,
|
|
102
|
+
metadata,
|
|
103
|
+
name: controllerName,
|
|
104
|
+
state: { ...defaultState, ...state },
|
|
105
|
+
});
|
|
106
|
+
_NotificationServicesController_instances.add(this);
|
|
107
|
+
// Temporary boolean as push notifications are not yet enabled on mobile
|
|
108
|
+
_NotificationServicesController_isPushIntegrated.set(this, true);
|
|
109
|
+
// Flag to check is notifications have been setup when the browser/extension is initialized.
|
|
110
|
+
// We want to re-initialize push notifications when the browser/extension is refreshed
|
|
111
|
+
// To ensure we subscribe to the most up-to-date notifications
|
|
112
|
+
_NotificationServicesController_isPushNotificationsSetup.set(this, false);
|
|
113
|
+
_NotificationServicesController_isUnlocked.set(this, false);
|
|
114
|
+
_NotificationServicesController_keyringController.set(this, {
|
|
115
|
+
setupLockedStateSubscriptions: (onUnlock) => {
|
|
116
|
+
const { isUnlocked } = this.messagingSystem.call('KeyringController:getState');
|
|
117
|
+
__classPrivateFieldSet(this, _NotificationServicesController_isUnlocked, isUnlocked, "f");
|
|
118
|
+
this.messagingSystem.subscribe('KeyringController:unlock', () => {
|
|
119
|
+
__classPrivateFieldSet(this, _NotificationServicesController_isUnlocked, true, "f");
|
|
120
|
+
// messaging system cannot await promises
|
|
121
|
+
// we don't need to wait for a result on this.
|
|
122
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
123
|
+
onUnlock();
|
|
124
|
+
});
|
|
125
|
+
this.messagingSystem.subscribe('KeyringController:lock', () => {
|
|
126
|
+
__classPrivateFieldSet(this, _NotificationServicesController_isUnlocked, false, "f");
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
_NotificationServicesController_auth.set(this, {
|
|
131
|
+
getBearerToken: async () => {
|
|
132
|
+
return await this.messagingSystem.call('AuthenticationController:getBearerToken');
|
|
133
|
+
},
|
|
134
|
+
isSignedIn: () => {
|
|
135
|
+
return this.messagingSystem.call('AuthenticationController:isSignedIn');
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
_NotificationServicesController_storage.set(this, {
|
|
139
|
+
enableProfileSyncing: async () => {
|
|
140
|
+
return await this.messagingSystem.call('UserStorageController:enableProfileSyncing');
|
|
141
|
+
},
|
|
142
|
+
getStorageKey: () => {
|
|
143
|
+
return this.messagingSystem.call('UserStorageController:getStorageKey');
|
|
144
|
+
},
|
|
145
|
+
getNotificationStorage: async () => {
|
|
146
|
+
return await this.messagingSystem.call('UserStorageController:performGetStorage', 'notifications.notificationSettings');
|
|
147
|
+
},
|
|
148
|
+
setNotificationStorage: async (state) => {
|
|
149
|
+
return await this.messagingSystem.call('UserStorageController:performSetStorage', 'notifications.notificationSettings', state);
|
|
150
|
+
},
|
|
151
|
+
});
|
|
152
|
+
_NotificationServicesController_pushNotifications.set(this, {
|
|
153
|
+
subscribeToPushNotifications: async () => {
|
|
154
|
+
await this.messagingSystem.call('NotificationServicesPushController:subscribeToPushNotifications');
|
|
155
|
+
},
|
|
156
|
+
enablePushNotifications: async (UUIDs) => {
|
|
157
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
try {
|
|
161
|
+
await this.messagingSystem.call('NotificationServicesPushController:enablePushNotifications', UUIDs);
|
|
162
|
+
}
|
|
163
|
+
catch (e) {
|
|
164
|
+
log.error('Silently failed to enable push notifications', e);
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
disablePushNotifications: async (UUIDs) => {
|
|
168
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
try {
|
|
172
|
+
await this.messagingSystem.call('NotificationServicesPushController:disablePushNotifications', UUIDs);
|
|
173
|
+
}
|
|
174
|
+
catch (e) {
|
|
175
|
+
log.error('Silently failed to disable push notifications', e);
|
|
176
|
+
}
|
|
177
|
+
},
|
|
178
|
+
updatePushNotifications: async (UUIDs) => {
|
|
179
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
try {
|
|
183
|
+
await this.messagingSystem.call('NotificationServicesPushController:updateTriggerPushNotifications', UUIDs);
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
log.error('Silently failed to update push notifications', e);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
subscribe: () => {
|
|
190
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this.messagingSystem.subscribe('NotificationServicesPushController:onNewNotifications', (notification) => {
|
|
194
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
195
|
+
this.updateMetamaskNotificationsList(notification);
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
initializePushNotifications: async () => {
|
|
199
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_isPushIntegrated, "f")) {
|
|
200
|
+
return;
|
|
201
|
+
}
|
|
202
|
+
if (!this.state.isNotificationServicesEnabled) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
if (__classPrivateFieldGet(this, _NotificationServicesController_isPushNotificationsSetup, "f")) {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
// If wallet is unlocked, we can create a fresh push subscription
|
|
209
|
+
// Otherwise we can subscribe to original subscription
|
|
210
|
+
if (__classPrivateFieldGet(this, _NotificationServicesController_isUnlocked, "f")) {
|
|
211
|
+
const storage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
212
|
+
if (!storage) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
const uuids = Utils.getAllUUIDs(storage);
|
|
216
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(uuids);
|
|
217
|
+
__classPrivateFieldSet(this, _NotificationServicesController_isPushNotificationsSetup, true, "f");
|
|
218
|
+
}
|
|
219
|
+
else {
|
|
220
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").subscribeToPushNotifications();
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
});
|
|
224
|
+
_NotificationServicesController_accounts.set(this, {
|
|
225
|
+
/**
|
|
226
|
+
* Used to get list of addresses from keyring (wallet addresses)
|
|
227
|
+
*
|
|
228
|
+
* @returns addresses removed, added, and latest list of addresses
|
|
229
|
+
*/
|
|
230
|
+
listAccounts: async () => {
|
|
231
|
+
// Get previous and current account sets
|
|
232
|
+
const nonChecksumAccounts = await this.messagingSystem.call('KeyringController:getAccounts');
|
|
233
|
+
const accounts = nonChecksumAccounts.map((a) => toChecksumHexAddress(a));
|
|
234
|
+
const currentAccountsSet = new Set(accounts);
|
|
235
|
+
const prevAccountsSet = new Set(this.state.subscriptionAccountsSeen);
|
|
236
|
+
// Invalid value you cannot have zero accounts
|
|
237
|
+
// Only occurs when the Accounts controller is initializing.
|
|
238
|
+
if (accounts.length === 0) {
|
|
239
|
+
return {
|
|
240
|
+
accountsAdded: [],
|
|
241
|
+
accountsRemoved: [],
|
|
242
|
+
accounts: [],
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
// Calculate added and removed addresses
|
|
246
|
+
const accountsAdded = accounts.filter((a) => !prevAccountsSet.has(a));
|
|
247
|
+
const accountsRemoved = [...prevAccountsSet.values()].filter((a) => !currentAccountsSet.has(a));
|
|
248
|
+
// Update accounts seen
|
|
249
|
+
this.update((state) => {
|
|
250
|
+
state.subscriptionAccountsSeen = [...prevAccountsSet, ...accountsAdded];
|
|
251
|
+
});
|
|
252
|
+
return {
|
|
253
|
+
accountsAdded,
|
|
254
|
+
accountsRemoved,
|
|
255
|
+
accounts,
|
|
256
|
+
};
|
|
257
|
+
},
|
|
258
|
+
/**
|
|
259
|
+
* Initializes the cache/previous list. This is handy so we have an accurate in-mem state of the previous list of accounts.
|
|
260
|
+
*
|
|
261
|
+
* @returns result from list accounts
|
|
262
|
+
*/
|
|
263
|
+
initialize: () => {
|
|
264
|
+
return __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
265
|
+
},
|
|
266
|
+
/**
|
|
267
|
+
* Subscription to any state change in the keyring controller (aka wallet accounts).
|
|
268
|
+
* We can call the `listAccounts` defined above to find out about any accounts added, removed
|
|
269
|
+
* And call effects to subscribe/unsubscribe to notifications.
|
|
270
|
+
*/
|
|
271
|
+
subscribe: () => {
|
|
272
|
+
this.messagingSystem.subscribe('KeyringController:stateChange',
|
|
273
|
+
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
|
274
|
+
async () => {
|
|
275
|
+
if (!this.state.isNotificationServicesEnabled) {
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
const { accountsAdded, accountsRemoved } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
279
|
+
const promises = [];
|
|
280
|
+
if (accountsAdded.length > 0) {
|
|
281
|
+
promises.push(this.updateOnChainTriggersByAccount(accountsAdded));
|
|
282
|
+
}
|
|
283
|
+
if (accountsRemoved.length > 0) {
|
|
284
|
+
promises.push(this.deleteOnChainTriggersByAccount(accountsRemoved));
|
|
285
|
+
}
|
|
286
|
+
await Promise.all(promises);
|
|
287
|
+
});
|
|
288
|
+
},
|
|
289
|
+
});
|
|
290
|
+
_NotificationServicesController_featureAnnouncementEnv.set(this, void 0);
|
|
291
|
+
_NotificationServicesController_performEnableProfileSyncing.set(this, async () => {
|
|
292
|
+
try {
|
|
293
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").enableProfileSyncing();
|
|
294
|
+
}
|
|
295
|
+
catch (e) {
|
|
296
|
+
log.error('Failed to enable profile syncing', e);
|
|
297
|
+
throw new Error('Failed to enable profile syncing');
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
__classPrivateFieldSet(this, _NotificationServicesController_isPushIntegrated, env.isPushIntegrated ?? true, "f");
|
|
301
|
+
__classPrivateFieldSet(this, _NotificationServicesController_featureAnnouncementEnv, env.featureAnnouncements, "f");
|
|
302
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_registerMessageHandlers).call(this);
|
|
303
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearLoadingStates).call(this);
|
|
304
|
+
__classPrivateFieldGet(this, _NotificationServicesController_keyringController, "f").setupLockedStateSubscriptions(__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications);
|
|
305
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
306
|
+
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").initialize();
|
|
307
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
308
|
+
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").initializePushNotifications();
|
|
309
|
+
__classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").subscribe();
|
|
310
|
+
__classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").subscribe();
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Retrieves the current enabled state of MetaMask notifications.
|
|
314
|
+
*
|
|
315
|
+
* This method directly returns the boolean value of `isMetamaskNotificationsEnabled`
|
|
316
|
+
* from the controller's state, indicating whether MetaMask notifications are currently enabled.
|
|
317
|
+
*
|
|
318
|
+
* @returns The enabled state of MetaMask notifications.
|
|
319
|
+
*/
|
|
320
|
+
selectIsNotificationServicesEnabled() {
|
|
321
|
+
return this.state.isNotificationServicesEnabled;
|
|
322
|
+
}
|
|
323
|
+
async checkAccountsPresence(accounts) {
|
|
324
|
+
try {
|
|
325
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsCheckingAccountsPresence).call(this, true);
|
|
326
|
+
// Retrieve user storage
|
|
327
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
328
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
329
|
+
const presence = Utils.checkAccountsPresence(userStorage, accounts);
|
|
330
|
+
return presence;
|
|
331
|
+
}
|
|
332
|
+
catch (error) {
|
|
333
|
+
log.error('Failed to check accounts presence', error);
|
|
334
|
+
throw error;
|
|
335
|
+
}
|
|
336
|
+
finally {
|
|
337
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsCheckingAccountsPresence).call(this, false);
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
/**
|
|
341
|
+
* Sets the enabled state of feature announcements.
|
|
342
|
+
*
|
|
343
|
+
* **Action** - used in the notification settings to enable/disable feature announcements.
|
|
344
|
+
*
|
|
345
|
+
* @param featureAnnouncementsEnabled - A boolean value indicating the desired enabled state of the feature announcements.
|
|
346
|
+
* @async
|
|
347
|
+
* @throws {Error} If fails to update
|
|
348
|
+
*/
|
|
349
|
+
async setFeatureAnnouncementsEnabled(featureAnnouncementsEnabled) {
|
|
350
|
+
try {
|
|
351
|
+
this.update((s) => {
|
|
352
|
+
s.isFeatureAnnouncementsEnabled = featureAnnouncementsEnabled;
|
|
353
|
+
});
|
|
354
|
+
}
|
|
355
|
+
catch (e) {
|
|
356
|
+
log.error('Unable to toggle feature announcements', e);
|
|
357
|
+
throw new Error('Unable to toggle feature announcements');
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
/**
|
|
361
|
+
* This creates/re-creates on-chain triggers defined in User Storage.
|
|
362
|
+
*
|
|
363
|
+
* **Action** - Used during Sign In / Enabling of notifications.
|
|
364
|
+
*
|
|
365
|
+
* @returns The updated or newly created user storage.
|
|
366
|
+
* @throws {Error} Throws an error if unauthenticated or from other operations.
|
|
367
|
+
*/
|
|
368
|
+
async createOnChainTriggers() {
|
|
369
|
+
try {
|
|
370
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
371
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_performEnableProfileSyncing, "f").call(this);
|
|
372
|
+
const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
|
|
373
|
+
const { accounts } = await __classPrivateFieldGet(this, _NotificationServicesController_accounts, "f").listAccounts();
|
|
374
|
+
let userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
375
|
+
// If userStorage does not exist, create a new one
|
|
376
|
+
// All the triggers created are set as: "disabled"
|
|
377
|
+
if (userStorage?.[USER_STORAGE_VERSION_KEY] === undefined) {
|
|
378
|
+
userStorage = Utils.initializeUserStorage(accounts.map((account) => ({ address: account })), false);
|
|
379
|
+
// Write the userStorage
|
|
380
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
381
|
+
}
|
|
382
|
+
// Create the triggers
|
|
383
|
+
const triggers = Utils.traverseUserStorageTriggers(userStorage);
|
|
384
|
+
await OnChainNotifications.createOnChainTriggers(userStorage, storageKey, bearerToken, triggers);
|
|
385
|
+
// Create push notifications triggers
|
|
386
|
+
const allUUIDS = Utils.getAllUUIDs(userStorage);
|
|
387
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").enablePushNotifications(allUUIDS);
|
|
388
|
+
// Write the new userStorage (triggers are now "enabled")
|
|
389
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
390
|
+
// Update the state of the controller
|
|
391
|
+
this.update((state) => {
|
|
392
|
+
state.isNotificationServicesEnabled = true;
|
|
393
|
+
state.isFeatureAnnouncementsEnabled = true;
|
|
394
|
+
state.isMetamaskNotificationsFeatureSeen = true;
|
|
395
|
+
});
|
|
396
|
+
return userStorage;
|
|
397
|
+
}
|
|
398
|
+
catch (err) {
|
|
399
|
+
log.error('Failed to create On Chain triggers', err);
|
|
400
|
+
throw new Error('Failed to create On Chain triggers');
|
|
401
|
+
}
|
|
402
|
+
finally {
|
|
403
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
404
|
+
}
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Enables all MetaMask notifications for the user.
|
|
408
|
+
* This is identical flow when initializing notifications for the first time.
|
|
409
|
+
* 1. Enable Profile Syncing
|
|
410
|
+
* 2. Get or Create Notification User Storage
|
|
411
|
+
* 3. Upsert Triggers
|
|
412
|
+
* 4. Update Push notifications
|
|
413
|
+
*
|
|
414
|
+
* @throws {Error} If there is an error during the process of enabling notifications.
|
|
415
|
+
*/
|
|
416
|
+
async enableMetamaskNotifications() {
|
|
417
|
+
try {
|
|
418
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
419
|
+
await this.createOnChainTriggers();
|
|
420
|
+
}
|
|
421
|
+
catch (e) {
|
|
422
|
+
log.error('Unable to enable notifications', e);
|
|
423
|
+
throw new Error('Unable to enable notifications');
|
|
424
|
+
}
|
|
425
|
+
finally {
|
|
426
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
/**
|
|
430
|
+
* Disables all MetaMask notifications for the user.
|
|
431
|
+
* This method ensures that the user is authenticated, retrieves all linked accounts,
|
|
432
|
+
* and disables on-chain triggers for each account. It also sets the global notification
|
|
433
|
+
* settings for MetaMask, feature announcements to false.
|
|
434
|
+
*
|
|
435
|
+
* @throws {Error} If the user is not authenticated or if there is an error during the process.
|
|
436
|
+
*/
|
|
437
|
+
async disableNotificationServices() {
|
|
438
|
+
try {
|
|
439
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, true);
|
|
440
|
+
// Disable Push Notifications
|
|
441
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
442
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
443
|
+
const UUIDs = Utils.getAllUUIDs(userStorage);
|
|
444
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications(UUIDs);
|
|
445
|
+
// Clear Notification States (toggles and list)
|
|
446
|
+
this.update((state) => {
|
|
447
|
+
state.isNotificationServicesEnabled = false;
|
|
448
|
+
state.isFeatureAnnouncementsEnabled = false;
|
|
449
|
+
state.metamaskNotificationsList = [];
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
catch (e) {
|
|
453
|
+
log.error('Unable to disable notifications', e);
|
|
454
|
+
throw new Error('Unable to disable notifications');
|
|
455
|
+
}
|
|
456
|
+
finally {
|
|
457
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsUpdatingMetamaskNotifications).call(this, false);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
/**
|
|
461
|
+
* Deletes on-chain triggers associated with a specific account.
|
|
462
|
+
* This method performs several key operations:
|
|
463
|
+
* 1. Validates Auth & Storage
|
|
464
|
+
* 2. Finds and deletes all triggers associated with the account
|
|
465
|
+
* 3. Disables any related push notifications
|
|
466
|
+
* 4. Updates Storage to reflect new state.
|
|
467
|
+
*
|
|
468
|
+
* **Action** - When a user disables notifications for a given account in settings.
|
|
469
|
+
*
|
|
470
|
+
* @param accounts - The account for which on-chain triggers are to be deleted.
|
|
471
|
+
* @returns A promise that resolves to void or an object containing a success message.
|
|
472
|
+
* @throws {Error} Throws an error if unauthenticated or from other operations.
|
|
473
|
+
*/
|
|
474
|
+
async deleteOnChainTriggersByAccount(accounts) {
|
|
475
|
+
try {
|
|
476
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_updateUpdatingAccountsState).call(this, accounts);
|
|
477
|
+
// Get and Validate BearerToken and User Storage Key
|
|
478
|
+
const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
|
|
479
|
+
// Get & Validate User Storage
|
|
480
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
481
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
482
|
+
// Get the UUIDs to delete
|
|
483
|
+
const UUIDs = accounts
|
|
484
|
+
.map((a) => Utils.getUUIDsForAccount(userStorage, a.toLowerCase()))
|
|
485
|
+
.flat();
|
|
486
|
+
if (UUIDs.length === 0) {
|
|
487
|
+
return userStorage;
|
|
488
|
+
}
|
|
489
|
+
// Delete these UUIDs (Mutates User Storage)
|
|
490
|
+
await OnChainNotifications.deleteOnChainTriggers(userStorage, storageKey, bearerToken, UUIDs);
|
|
491
|
+
// Delete these UUIDs from the push notifications
|
|
492
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").disablePushNotifications(UUIDs);
|
|
493
|
+
// Update User Storage
|
|
494
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
495
|
+
return userStorage;
|
|
496
|
+
}
|
|
497
|
+
catch (err) {
|
|
498
|
+
log.error('Failed to delete OnChain triggers', err);
|
|
499
|
+
throw new Error('Failed to delete OnChain triggers');
|
|
500
|
+
}
|
|
501
|
+
finally {
|
|
502
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearUpdatingAccountsState).call(this, accounts);
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
/**
|
|
506
|
+
* Updates/Creates on-chain triggers for a specific account.
|
|
507
|
+
*
|
|
508
|
+
* This method performs several key operations:
|
|
509
|
+
* 1. Validates Auth & Storage
|
|
510
|
+
* 2. Finds and creates any missing triggers associated with the account
|
|
511
|
+
* 3. Enables any related push notifications
|
|
512
|
+
* 4. Updates Storage to reflect new state.
|
|
513
|
+
*
|
|
514
|
+
* **Action** - When a user enables notifications for an account
|
|
515
|
+
*
|
|
516
|
+
* @param accounts - List of accounts you want to update.
|
|
517
|
+
* @returns A promise that resolves to the updated user storage.
|
|
518
|
+
* @throws {Error} Throws an error if unauthenticated or from other operations.
|
|
519
|
+
*/
|
|
520
|
+
async updateOnChainTriggersByAccount(accounts) {
|
|
521
|
+
try {
|
|
522
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_updateUpdatingAccountsState).call(this, accounts);
|
|
523
|
+
// Get and Validate BearerToken and User Storage Key
|
|
524
|
+
const { bearerToken, storageKey } = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getValidStorageKeyAndBearerToken).call(this);
|
|
525
|
+
// Get & Validate User Storage
|
|
526
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_getUserStorage).call(this);
|
|
527
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertUserStorage).call(this, userStorage);
|
|
528
|
+
// Add any missing triggers
|
|
529
|
+
accounts.forEach((a) => Utils.upsertAddressTriggers(a, userStorage));
|
|
530
|
+
const newTriggers = Utils.traverseUserStorageTriggers(userStorage, {
|
|
531
|
+
mapTrigger: (t) => {
|
|
532
|
+
if (!t.enabled) {
|
|
533
|
+
return t;
|
|
534
|
+
}
|
|
535
|
+
return undefined;
|
|
536
|
+
},
|
|
537
|
+
});
|
|
538
|
+
// Create any missing triggers.
|
|
539
|
+
if (newTriggers.length > 0) {
|
|
540
|
+
// Write te updated userStorage (where triggers are disabled)
|
|
541
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
542
|
+
// Create the triggers
|
|
543
|
+
const triggers = Utils.traverseUserStorageTriggers(userStorage, {
|
|
544
|
+
mapTrigger: (t) => {
|
|
545
|
+
if (accounts.some((a) => a.toLowerCase() === t.address.toLowerCase())) {
|
|
546
|
+
return t;
|
|
547
|
+
}
|
|
548
|
+
return undefined;
|
|
549
|
+
},
|
|
550
|
+
});
|
|
551
|
+
await OnChainNotifications.createOnChainTriggers(userStorage, storageKey, bearerToken, triggers);
|
|
552
|
+
}
|
|
553
|
+
// Update Push Notifications Triggers
|
|
554
|
+
const UUIDs = Utils.getAllUUIDs(userStorage);
|
|
555
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_pushNotifications, "f").updatePushNotifications(UUIDs);
|
|
556
|
+
// Update the userStorage (where triggers are enabled)
|
|
557
|
+
await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").setNotificationStorage(JSON.stringify(userStorage));
|
|
558
|
+
return userStorage;
|
|
559
|
+
}
|
|
560
|
+
catch (err) {
|
|
561
|
+
log.error('Failed to update OnChain triggers', err);
|
|
562
|
+
throw new Error('Failed to update OnChain triggers');
|
|
563
|
+
}
|
|
564
|
+
finally {
|
|
565
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_clearUpdatingAccountsState).call(this, accounts);
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
/**
|
|
569
|
+
* Fetches the list of metamask notifications.
|
|
570
|
+
* This includes OnChain notifications and Feature Announcements.
|
|
571
|
+
*
|
|
572
|
+
* **Action** - When a user views the notification list page/dropdown
|
|
573
|
+
*
|
|
574
|
+
* @throws {Error} Throws an error if unauthenticated or from other operations.
|
|
575
|
+
*/
|
|
576
|
+
async fetchAndUpdateMetamaskNotifications() {
|
|
577
|
+
try {
|
|
578
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsFetchingMetamaskNotifications).call(this, true);
|
|
579
|
+
// Raw Feature Notifications
|
|
580
|
+
const rawFeatureAnnouncementNotifications = this.state
|
|
581
|
+
.isFeatureAnnouncementsEnabled
|
|
582
|
+
? await FeatureNotifications.getFeatureAnnouncementNotifications(__classPrivateFieldGet(this, _NotificationServicesController_featureAnnouncementEnv, "f")).catch(() => [])
|
|
583
|
+
: [];
|
|
584
|
+
// Raw On Chain Notifications
|
|
585
|
+
const rawOnChainNotifications = [];
|
|
586
|
+
const userStorage = await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f")
|
|
587
|
+
.getNotificationStorage()
|
|
588
|
+
.then((s) => s && JSON.parse(s))
|
|
589
|
+
.catch(() => null);
|
|
590
|
+
const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken().catch(() => null);
|
|
591
|
+
if (userStorage && bearerToken) {
|
|
592
|
+
const notifications = await OnChainNotifications.getOnChainNotifications(userStorage, bearerToken).catch(() => []);
|
|
593
|
+
rawOnChainNotifications.push(...notifications);
|
|
594
|
+
}
|
|
595
|
+
const readIds = this.state.metamaskNotificationsReadList;
|
|
596
|
+
// Combined Notifications
|
|
597
|
+
const isNotUndefined = (t) => Boolean(t);
|
|
598
|
+
const processAndFilter = (ns) => ns
|
|
599
|
+
.map((n) => safeProcessNotification(n, readIds))
|
|
600
|
+
.filter(isNotUndefined);
|
|
601
|
+
const featureAnnouncementNotifications = processAndFilter(rawFeatureAnnouncementNotifications);
|
|
602
|
+
const onChainNotifications = processAndFilter(rawOnChainNotifications);
|
|
603
|
+
const metamaskNotifications = [
|
|
604
|
+
...featureAnnouncementNotifications,
|
|
605
|
+
...onChainNotifications,
|
|
606
|
+
];
|
|
607
|
+
metamaskNotifications.sort((a, b) => new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime());
|
|
608
|
+
// Update State
|
|
609
|
+
this.update((state) => {
|
|
610
|
+
state.metamaskNotificationsList = metamaskNotifications;
|
|
611
|
+
});
|
|
612
|
+
this.messagingSystem.publish(`${controllerName}:notificationsListUpdated`, this.state.metamaskNotificationsList);
|
|
613
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsFetchingMetamaskNotifications).call(this, false);
|
|
614
|
+
return metamaskNotifications;
|
|
615
|
+
}
|
|
616
|
+
catch (err) {
|
|
617
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_setIsFetchingMetamaskNotifications).call(this, false);
|
|
618
|
+
log.error('Failed to fetch notifications', err);
|
|
619
|
+
throw new Error('Failed to fetch notifications');
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
/**
|
|
623
|
+
* Marks specified metamask notifications as read.
|
|
624
|
+
*
|
|
625
|
+
* @param notifications - An array of notifications to be marked as read. Each notification should include its type and read status.
|
|
626
|
+
* @returns A promise that resolves when the operation is complete.
|
|
627
|
+
*/
|
|
628
|
+
async markMetamaskNotificationsAsRead(notifications) {
|
|
629
|
+
let onchainNotificationIds = [];
|
|
630
|
+
let featureAnnouncementNotificationIds = [];
|
|
631
|
+
try {
|
|
632
|
+
// Filter unread on/off chain notifications
|
|
633
|
+
const onChainNotifications = notifications.filter((notification) => notification.type !== TRIGGER_TYPES.FEATURES_ANNOUNCEMENT &&
|
|
634
|
+
!notification.isRead);
|
|
635
|
+
const featureAnnouncementNotifications = notifications.filter((notification) => notification.type === TRIGGER_TYPES.FEATURES_ANNOUNCEMENT &&
|
|
636
|
+
!notification.isRead);
|
|
637
|
+
// Mark On-Chain Notifications as Read
|
|
638
|
+
if (onChainNotifications.length > 0) {
|
|
639
|
+
const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken();
|
|
640
|
+
if (bearerToken) {
|
|
641
|
+
onchainNotificationIds = onChainNotifications.map((notification) => notification.id);
|
|
642
|
+
await OnChainNotifications.markNotificationsAsRead(bearerToken, onchainNotificationIds).catch(() => {
|
|
643
|
+
onchainNotificationIds = [];
|
|
644
|
+
log.warn('Unable to mark onchain notifications as read');
|
|
645
|
+
});
|
|
646
|
+
}
|
|
647
|
+
}
|
|
648
|
+
// Mark Off-Chain notifications as Read
|
|
649
|
+
if (featureAnnouncementNotifications.length > 0) {
|
|
650
|
+
featureAnnouncementNotificationIds =
|
|
651
|
+
featureAnnouncementNotifications.map((notification) => notification.id);
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
catch (err) {
|
|
655
|
+
log.warn('Something failed when marking notifications as read', err);
|
|
656
|
+
}
|
|
657
|
+
// Update the state (state is also used on counter & badge)
|
|
658
|
+
this.update((state) => {
|
|
659
|
+
const currentReadList = state.metamaskNotificationsReadList;
|
|
660
|
+
const newReadIds = [...featureAnnouncementNotificationIds];
|
|
661
|
+
state.metamaskNotificationsReadList = [
|
|
662
|
+
...new Set([...currentReadList, ...newReadIds]),
|
|
663
|
+
];
|
|
664
|
+
state.metamaskNotificationsList = state.metamaskNotificationsList.map((notification) => {
|
|
665
|
+
if (newReadIds.includes(notification.id) ||
|
|
666
|
+
onchainNotificationIds.includes(notification.id)) {
|
|
667
|
+
return { ...notification, isRead: true };
|
|
668
|
+
}
|
|
669
|
+
return notification;
|
|
670
|
+
});
|
|
671
|
+
});
|
|
672
|
+
this.messagingSystem.publish(`${controllerName}:markNotificationsAsRead`, this.state.metamaskNotificationsList);
|
|
673
|
+
}
|
|
674
|
+
/**
|
|
675
|
+
* Updates the list of MetaMask notifications by adding a new notification at the beginning of the list.
|
|
676
|
+
* This method ensures that the most recent notification is displayed first in the UI.
|
|
677
|
+
*
|
|
678
|
+
* @param notification - The new notification object to be added to the list.
|
|
679
|
+
* @returns A promise that resolves when the notification list has been successfully updated.
|
|
680
|
+
*/
|
|
681
|
+
async updateMetamaskNotificationsList(notification) {
|
|
682
|
+
if (this.state.metamaskNotificationsList.some((n) => n.id === notification.id)) {
|
|
683
|
+
return;
|
|
684
|
+
}
|
|
685
|
+
const processedNotification = safeProcessNotification(notification);
|
|
686
|
+
if (processedNotification) {
|
|
687
|
+
this.update((state) => {
|
|
688
|
+
const existingNotificationIds = new Set(state.metamaskNotificationsList.map((n) => n.id));
|
|
689
|
+
// Add the new notification only if its ID is not already present in the list
|
|
690
|
+
if (!existingNotificationIds.has(notification.id)) {
|
|
691
|
+
state.metamaskNotificationsList = [
|
|
692
|
+
notification,
|
|
693
|
+
...state.metamaskNotificationsList,
|
|
694
|
+
];
|
|
695
|
+
this.messagingSystem.publish(`${controllerName}:notificationsListUpdated`, state.metamaskNotificationsList);
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
}
|
|
701
|
+
_NotificationServicesController_isPushIntegrated = new WeakMap(), _NotificationServicesController_isPushNotificationsSetup = new WeakMap(), _NotificationServicesController_isUnlocked = new WeakMap(), _NotificationServicesController_keyringController = new WeakMap(), _NotificationServicesController_auth = new WeakMap(), _NotificationServicesController_storage = new WeakMap(), _NotificationServicesController_pushNotifications = new WeakMap(), _NotificationServicesController_accounts = new WeakMap(), _NotificationServicesController_featureAnnouncementEnv = new WeakMap(), _NotificationServicesController_performEnableProfileSyncing = new WeakMap(), _NotificationServicesController_instances = new WeakSet(), _NotificationServicesController_registerMessageHandlers = function _NotificationServicesController_registerMessageHandlers() {
|
|
702
|
+
this.messagingSystem.registerActionHandler(`${controllerName}:updateMetamaskNotificationsList`, this.updateMetamaskNotificationsList.bind(this));
|
|
703
|
+
this.messagingSystem.registerActionHandler(`${controllerName}:disableNotificationServices`, this.disableNotificationServices.bind(this));
|
|
704
|
+
this.messagingSystem.registerActionHandler(`${controllerName}:selectIsNotificationServicesEnabled`, this.selectIsNotificationServicesEnabled.bind(this));
|
|
705
|
+
}, _NotificationServicesController_clearLoadingStates = function _NotificationServicesController_clearLoadingStates() {
|
|
706
|
+
this.update((state) => {
|
|
707
|
+
state.isUpdatingMetamaskNotifications = false;
|
|
708
|
+
state.isCheckingAccountsPresence = false;
|
|
709
|
+
state.isFetchingMetamaskNotifications = false;
|
|
710
|
+
state.isUpdatingMetamaskNotificationsAccount = [];
|
|
711
|
+
});
|
|
712
|
+
}, _NotificationServicesController_assertAuthEnabled = function _NotificationServicesController_assertAuthEnabled() {
|
|
713
|
+
if (!__classPrivateFieldGet(this, _NotificationServicesController_auth, "f").isSignedIn()) {
|
|
714
|
+
this.update((state) => {
|
|
715
|
+
state.isNotificationServicesEnabled = false;
|
|
716
|
+
});
|
|
717
|
+
throw new Error('User is not signed in.');
|
|
718
|
+
}
|
|
719
|
+
}, _NotificationServicesController_getValidStorageKeyAndBearerToken = async function _NotificationServicesController_getValidStorageKeyAndBearerToken() {
|
|
720
|
+
__classPrivateFieldGet(this, _NotificationServicesController_instances, "m", _NotificationServicesController_assertAuthEnabled).call(this);
|
|
721
|
+
const bearerToken = await __classPrivateFieldGet(this, _NotificationServicesController_auth, "f").getBearerToken();
|
|
722
|
+
const storageKey = await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").getStorageKey();
|
|
723
|
+
if (!bearerToken || !storageKey) {
|
|
724
|
+
throw new Error('Missing BearerToken or storage key');
|
|
725
|
+
}
|
|
726
|
+
return { bearerToken, storageKey };
|
|
727
|
+
}, _NotificationServicesController_assertUserStorage = function _NotificationServicesController_assertUserStorage(storage) {
|
|
728
|
+
if (!storage) {
|
|
729
|
+
throw new Error('User Storage does not exist');
|
|
730
|
+
}
|
|
731
|
+
}, _NotificationServicesController_getUserStorage =
|
|
732
|
+
/**
|
|
733
|
+
* Retrieves and parses the user storage from the storage key.
|
|
734
|
+
*
|
|
735
|
+
* This method attempts to retrieve the user storage using the specified storage key,
|
|
736
|
+
* then parses the JSON string to an object. If the storage is not found or cannot be parsed,
|
|
737
|
+
* it throws an error.
|
|
738
|
+
*
|
|
739
|
+
* @returns The parsed user storage object or null
|
|
740
|
+
*/
|
|
741
|
+
async function _NotificationServicesController_getUserStorage() {
|
|
742
|
+
const userStorageString = await __classPrivateFieldGet(this, _NotificationServicesController_storage, "f").getNotificationStorage();
|
|
743
|
+
if (!userStorageString) {
|
|
744
|
+
return null;
|
|
745
|
+
}
|
|
746
|
+
try {
|
|
747
|
+
const userStorage = JSON.parse(userStorageString);
|
|
748
|
+
return userStorage;
|
|
749
|
+
}
|
|
750
|
+
catch (error) {
|
|
751
|
+
log.error('Unable to parse User Storage');
|
|
752
|
+
return null;
|
|
753
|
+
}
|
|
754
|
+
}, _NotificationServicesController_setIsUpdatingMetamaskNotifications = function _NotificationServicesController_setIsUpdatingMetamaskNotifications(isUpdatingMetamaskNotifications) {
|
|
755
|
+
this.update((state) => {
|
|
756
|
+
state.isUpdatingMetamaskNotifications = isUpdatingMetamaskNotifications;
|
|
757
|
+
});
|
|
758
|
+
}, _NotificationServicesController_setIsFetchingMetamaskNotifications = function _NotificationServicesController_setIsFetchingMetamaskNotifications(isFetchingMetamaskNotifications) {
|
|
759
|
+
this.update((state) => {
|
|
760
|
+
state.isFetchingMetamaskNotifications = isFetchingMetamaskNotifications;
|
|
761
|
+
});
|
|
762
|
+
}, _NotificationServicesController_setIsCheckingAccountsPresence = function _NotificationServicesController_setIsCheckingAccountsPresence(isCheckingAccountsPresence) {
|
|
763
|
+
this.update((state) => {
|
|
764
|
+
state.isCheckingAccountsPresence = isCheckingAccountsPresence;
|
|
765
|
+
});
|
|
766
|
+
}, _NotificationServicesController_updateUpdatingAccountsState = function _NotificationServicesController_updateUpdatingAccountsState(accounts) {
|
|
767
|
+
this.update((state) => {
|
|
768
|
+
const uniqueAccounts = new Set([
|
|
769
|
+
...state.isUpdatingMetamaskNotificationsAccount,
|
|
770
|
+
...accounts,
|
|
771
|
+
]);
|
|
772
|
+
state.isUpdatingMetamaskNotificationsAccount = Array.from(uniqueAccounts);
|
|
773
|
+
});
|
|
774
|
+
}, _NotificationServicesController_clearUpdatingAccountsState = function _NotificationServicesController_clearUpdatingAccountsState(accounts) {
|
|
775
|
+
this.update((state) => {
|
|
776
|
+
state.isUpdatingMetamaskNotificationsAccount =
|
|
777
|
+
state.isUpdatingMetamaskNotificationsAccount.filter((existingAccount) => !accounts.includes(existingAccount));
|
|
778
|
+
});
|
|
779
|
+
};
|
|
780
|
+
export default NotificationServicesController;
|
|
19
781
|
//# sourceMappingURL=NotificationServicesController.mjs.map
|