@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 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NotificationServicesPushController/NotificationServicesPushController.ts"],"names":[],"mappings":"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","sourcesContent":["import type {\n RestrictedControllerMessenger,\n ControllerGetStateAction,\n ControllerStateChangeEvent,\n StateMetadata,\n} from '@metamask/base-controller';\nimport { BaseController } from '@metamask/base-controller';\nimport type { AuthenticationController } from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport type { Types } from '../NotificationServicesController';\nimport { createRegToken, deleteRegToken } from './services/push/push-web';\nimport {\n activatePushNotifications,\n deactivatePushNotifications,\n listenToPushNotifications,\n updateTriggerPushNotifications,\n} from './services/services';\nimport type { PushNotificationEnv } from './types';\n\nconst controllerName = 'NotificationServicesPushController';\n\nexport type NotificationServicesPushControllerState = {\n fcmToken: string;\n};\n\nexport type NotificationServicesPushControllerGetStateAction =\n ControllerGetStateAction<\n typeof controllerName,\n NotificationServicesPushControllerState\n >;\n\nexport type NotificationServicesPushControllerEnablePushNotificationsAction = {\n type: `${typeof controllerName}:enablePushNotifications`;\n handler: NotificationServicesPushController['enablePushNotifications'];\n};\nexport type NotificationServicesPushControllerDisablePushNotificationsAction = {\n type: `${typeof controllerName}:disablePushNotifications`;\n handler: NotificationServicesPushController['disablePushNotifications'];\n};\nexport type NotificationServicesPushControllerUpdateTriggerPushNotificationsAction =\n {\n type: `${typeof controllerName}:updateTriggerPushNotifications`;\n handler: NotificationServicesPushController['updateTriggerPushNotifications'];\n };\nexport type NotificationServicesPushControllerSubscribeToNotificationsAction = {\n type: `${typeof controllerName}:subscribeToPushNotifications`;\n handler: NotificationServicesPushController['subscribeToPushNotifications'];\n};\n\nexport type Actions =\n | NotificationServicesPushControllerGetStateAction\n | NotificationServicesPushControllerEnablePushNotificationsAction\n | NotificationServicesPushControllerDisablePushNotificationsAction\n | NotificationServicesPushControllerUpdateTriggerPushNotificationsAction\n | NotificationServicesPushControllerSubscribeToNotificationsAction;\n\nexport type AllowedActions =\n AuthenticationController.AuthenticationControllerGetBearerToken;\n\nexport type NotificationServicesPushControllerStateChangeEvent =\n ControllerStateChangeEvent<\n typeof controllerName,\n NotificationServicesPushControllerState\n >;\n\nexport type NotificationServicesPushControllerOnNewNotificationEvent = {\n type: `${typeof controllerName}:onNewNotifications`;\n payload: [Types.INotification];\n};\n\nexport type NotificationServicesPushControllerPushNotificationClickedEvent = {\n type: `${typeof controllerName}:pushNotificationClicked`;\n payload: [Types.INotification];\n};\n\nexport type Events =\n | NotificationServicesPushControllerStateChangeEvent\n | NotificationServicesPushControllerOnNewNotificationEvent\n | NotificationServicesPushControllerPushNotificationClickedEvent;\n\nexport type AllowedEvents = never;\n\nexport type NotificationServicesPushControllerMessenger =\n RestrictedControllerMessenger<\n typeof controllerName,\n Actions | AllowedActions,\n Events | AllowedEvents,\n AllowedActions['type'],\n AllowedEvents['type']\n >;\n\nexport const defaultState: NotificationServicesPushControllerState = {\n fcmToken: '',\n};\nconst metadata: StateMetadata<NotificationServicesPushControllerState> = {\n fcmToken: {\n persist: true,\n anonymous: true,\n },\n};\n\ntype ControllerConfig = {\n /**\n * Config to turn on/off push notifications.\n * This is currently linked to MV3 builds on extension.\n */\n isPushEnabled: boolean;\n\n /**\n * Must handle when a push notification is received.\n * You must call `registration.showNotification` or equivalent to show the notification on web/mobile\n */\n onPushNotificationReceived: (\n notification: Types.INotification,\n ) => void | Promise<void>;\n\n /**\n * Must handle when a push notification is clicked.\n * You must call `event.notification.close();` or equivalent for closing and opening notification in a new window.\n */\n onPushNotificationClicked: (\n event: NotificationEvent,\n notification?: Types.INotification,\n ) => void;\n\n /**\n * determine the config used for push notification services\n */\n platform: 'extension' | 'mobile';\n};\n\n/**\n * Manages push notifications for the application, including enabling, disabling, and updating triggers for push notifications.\n * This controller integrates with Firebase Cloud Messaging (FCM) to handle the registration and management of push notifications.\n * It is responsible for registering and unregistering the service worker that listens for push notifications,\n * managing the FCM token, and communicating with the server to register or unregister the device for push notifications.\n * Additionally, it provides functionality to update the server with new UUIDs that should trigger push notifications.\n *\n * @augments {BaseController<typeof controllerName, NotificationServicesPushControllerState, NotificationServicesPushControllerMessenger>}\n */\nexport default class NotificationServicesPushController extends BaseController<\n typeof controllerName,\n NotificationServicesPushControllerState,\n NotificationServicesPushControllerMessenger\n> {\n #pushListenerUnsubscribe: (() => void) | undefined = undefined;\n\n #env: PushNotificationEnv;\n\n #config: ControllerConfig;\n\n constructor({\n messenger,\n state,\n env,\n config,\n }: {\n messenger: NotificationServicesPushControllerMessenger;\n state: NotificationServicesPushControllerState;\n env: PushNotificationEnv;\n config: ControllerConfig;\n }) {\n super({\n messenger,\n metadata,\n name: controllerName,\n state: { ...defaultState, ...state },\n });\n\n this.#env = env;\n this.#config = config;\n\n this.#registerMessageHandlers();\n }\n\n #registerMessageHandlers(): void {\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:enablePushNotifications',\n this.enablePushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:disablePushNotifications',\n this.disablePushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:updateTriggerPushNotifications',\n this.updateTriggerPushNotifications.bind(this),\n );\n this.messagingSystem.registerActionHandler(\n 'NotificationServicesPushController:subscribeToPushNotifications',\n this.subscribeToPushNotifications.bind(this),\n );\n }\n\n async #getAndAssertBearerToken() {\n const bearerToken = await this.messagingSystem.call(\n 'AuthenticationController:getBearerToken',\n );\n if (!bearerToken) {\n log.error(\n 'Failed to enable push notifications: BearerToken token is missing.',\n );\n throw new Error('BearerToken token is missing');\n }\n\n return bearerToken;\n }\n\n async subscribeToPushNotifications() {\n if (this.#pushListenerUnsubscribe) {\n this.#pushListenerUnsubscribe();\n this.#pushListenerUnsubscribe = undefined;\n }\n\n try {\n this.#pushListenerUnsubscribe = await listenToPushNotifications({\n env: this.#env,\n listenToPushReceived: async (n) => {\n this.messagingSystem.publish(\n 'NotificationServicesPushController:onNewNotifications',\n n,\n );\n await this.#config.onPushNotificationReceived(n);\n },\n listenToPushClicked: (e, n) => {\n if (n) {\n this.messagingSystem.publish(\n 'NotificationServicesPushController:pushNotificationClicked',\n n,\n );\n }\n\n this.#config.onPushNotificationClicked(e, n);\n },\n });\n } catch (e) {\n // Do nothing, we are silently failing if push notification registration fails\n }\n }\n\n /**\n * Enables push notifications for the application.\n *\n * This method sets up the necessary infrastructure for handling push notifications by:\n * 1. Registering the service worker to listen for messages.\n * 2. Fetching the Firebase Cloud Messaging (FCM) token from Firebase.\n * 3. Sending the FCM token to the server responsible for sending notifications, to register the device.\n *\n * @param UUIDs - An array of UUIDs to enable push notifications for.\n */\n async enablePushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n // Handle creating new reg token (if available)\n try {\n const bearerToken = await this.#getAndAssertBearerToken().catch(\n () => null,\n );\n\n // If there is a bearer token, lets try to refresh/create new reg token\n if (bearerToken) {\n // Activate Push Notifications\n const regToken = await activatePushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n createRegToken,\n platform: this.#config.platform,\n }).catch(() => null);\n\n if (regToken) {\n this.update((state) => {\n state.fcmToken = regToken;\n });\n }\n }\n } catch {\n // Do nothing, we are silently failing\n }\n\n // New token created, (re)subscribe to push notifications\n await this.subscribeToPushNotifications();\n }\n\n /**\n * Disables push notifications for the application.\n * This method handles the process of disabling push notifications by:\n * 1. Unregistering the service worker to stop listening for messages.\n * 2. Sending a request to the server to unregister the device using the FCM token.\n * 3. Removing the FCM token from the state to complete the process.\n *\n * @param UUIDs - An array of UUIDs for which push notifications should be disabled.\n */\n async disablePushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n let isPushNotificationsDisabled: boolean;\n\n try {\n // Send a request to the server to unregister the token/device\n isPushNotificationsDisabled = await deactivatePushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n deleteRegToken,\n regToken: this.state.fcmToken,\n });\n } catch (error) {\n const errorMessage = `Failed to disable push notifications: ${\n error as string\n }`;\n log.error(errorMessage);\n throw new Error(errorMessage);\n }\n\n // Remove the FCM token from the state\n if (!isPushNotificationsDisabled) {\n return;\n }\n\n // Unsubscribe from push notifications\n this.#pushListenerUnsubscribe?.();\n\n // Update State\n if (isPushNotificationsDisabled) {\n this.update((state) => {\n state.fcmToken = '';\n });\n }\n }\n\n /**\n * Updates the triggers for push notifications.\n * This method is responsible for updating the server with the new set of UUIDs that should trigger push notifications.\n * It uses the current FCM token and a BearerToken for authentication.\n *\n * @param UUIDs - An array of UUIDs that should trigger push notifications.\n */\n async updateTriggerPushNotifications(UUIDs: string[]) {\n if (!this.#config.isPushEnabled) {\n return;\n }\n\n const bearerToken = await this.#getAndAssertBearerToken();\n\n try {\n const { fcmToken } = await updateTriggerPushNotifications({\n bearerToken,\n triggers: UUIDs,\n env: this.#env,\n createRegToken,\n deleteRegToken,\n platform: this.#config.platform,\n regToken: this.state.fcmToken,\n });\n\n // update the state with the new FCM token\n if (fcmToken) {\n this.update((state) => {\n state.fcmToken = fcmToken;\n });\n }\n } catch (error) {\n const errorMessage = `Failed to update triggers for push notifications: ${\n error as string\n }`;\n log.error(errorMessage);\n throw new Error(errorMessage);\n }\n }\n}\n"]}
|
package/dist/chunk-LGXHJ24K.js
DELETED
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunk52CALMRAjs = require('./chunk-52CALMRA.js');
|
|
4
|
-
|
|
5
|
-
// src/NotificationServicesController/services/feature-announcements.ts
|
|
6
|
-
var _richtexthtmlrenderer = require('@contentful/rich-text-html-renderer');
|
|
7
|
-
var DEFAULT_SPACE_ID = ":space_id";
|
|
8
|
-
var DEFAULT_ACCESS_TOKEN = ":access_token";
|
|
9
|
-
var DEFAULT_CLIENT_ID = ":client_id";
|
|
10
|
-
var FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;
|
|
11
|
-
var FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;
|
|
12
|
-
var getFeatureAnnouncementUrl = (env) => FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId).replace(DEFAULT_ACCESS_TOKEN, env.accessToken).replace(DEFAULT_CLIENT_ID, env.platform);
|
|
13
|
-
var fetchFeatureAnnouncementNotifications = async (env) => {
|
|
14
|
-
const url = getFeatureAnnouncementUrl(env);
|
|
15
|
-
const data = await fetch(url).then((r) => r.json()).catch(() => null);
|
|
16
|
-
if (!data) {
|
|
17
|
-
return [];
|
|
18
|
-
}
|
|
19
|
-
const findIncludedItem = (sysId) => {
|
|
20
|
-
const typedData = data;
|
|
21
|
-
const item = typedData?.includes?.Entry?.find((i) => i?.sys?.id === sysId) || typedData?.includes?.Asset?.find((i) => i?.sys?.id === sysId);
|
|
22
|
-
return item ? item?.fields : null;
|
|
23
|
-
};
|
|
24
|
-
const contentfulNotifications = data?.items ?? [];
|
|
25
|
-
const rawNotifications = contentfulNotifications.map((n) => {
|
|
26
|
-
const { fields } = n;
|
|
27
|
-
const imageFields = fields.image ? findIncludedItem(fields.image.sys.id) : void 0;
|
|
28
|
-
const externalLinkFields = fields.externalLink ? findIncludedItem(
|
|
29
|
-
fields.externalLink.sys.id
|
|
30
|
-
) : void 0;
|
|
31
|
-
const portfolioLinkFields = fields.portfolioLink ? findIncludedItem(
|
|
32
|
-
fields.portfolioLink.sys.id
|
|
33
|
-
) : void 0;
|
|
34
|
-
const extensionLinkFields = fields.extensionLink ? findIncludedItem(
|
|
35
|
-
fields.extensionLink.sys.id
|
|
36
|
-
) : void 0;
|
|
37
|
-
const mobileLinkFields = fields.mobileLink ? findIncludedItem(
|
|
38
|
-
fields.mobileLink.sys.id
|
|
39
|
-
) : void 0;
|
|
40
|
-
const notification = {
|
|
41
|
-
type: "features_announcement" /* FEATURES_ANNOUNCEMENT */,
|
|
42
|
-
createdAt: new Date(n.sys.createdAt).toString(),
|
|
43
|
-
data: {
|
|
44
|
-
id: fields.id,
|
|
45
|
-
category: fields.category,
|
|
46
|
-
title: fields.title,
|
|
47
|
-
longDescription: _richtexthtmlrenderer.documentToHtmlString.call(void 0, fields.longDescription),
|
|
48
|
-
shortDescription: fields.shortDescription,
|
|
49
|
-
image: {
|
|
50
|
-
title: imageFields?.title,
|
|
51
|
-
description: imageFields?.description,
|
|
52
|
-
url: imageFields?.file?.url ?? ""
|
|
53
|
-
},
|
|
54
|
-
externalLink: externalLinkFields && {
|
|
55
|
-
externalLinkText: externalLinkFields?.externalLinkText,
|
|
56
|
-
externalLinkUrl: externalLinkFields?.externalLinkUrl
|
|
57
|
-
},
|
|
58
|
-
portfolioLink: portfolioLinkFields && {
|
|
59
|
-
portfolioLinkText: portfolioLinkFields?.portfolioLinkText,
|
|
60
|
-
portfolioLinkUrl: portfolioLinkFields?.portfolioLinkUrl
|
|
61
|
-
},
|
|
62
|
-
extensionLink: extensionLinkFields && {
|
|
63
|
-
extensionLinkText: extensionLinkFields?.extensionLinkText,
|
|
64
|
-
extensionLinkRoute: extensionLinkFields?.extensionLinkRoute
|
|
65
|
-
},
|
|
66
|
-
mobileLink: mobileLinkFields && {
|
|
67
|
-
mobileLinkText: mobileLinkFields?.mobileLinkText,
|
|
68
|
-
mobileLinkUrl: mobileLinkFields?.mobileLinkUrl
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
return notification;
|
|
73
|
-
});
|
|
74
|
-
return rawNotifications;
|
|
75
|
-
};
|
|
76
|
-
async function getFeatureAnnouncementNotifications(env) {
|
|
77
|
-
if (env?.accessToken && env?.spaceId && env?.platform) {
|
|
78
|
-
const rawNotifications = await fetchFeatureAnnouncementNotifications(env);
|
|
79
|
-
const notifications = rawNotifications.map(
|
|
80
|
-
(notification) => _chunk52CALMRAjs.processFeatureAnnouncement.call(void 0, notification)
|
|
81
|
-
);
|
|
82
|
-
return notifications;
|
|
83
|
-
}
|
|
84
|
-
return [];
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
exports.FEATURE_ANNOUNCEMENT_API = FEATURE_ANNOUNCEMENT_API; exports.FEATURE_ANNOUNCEMENT_URL = FEATURE_ANNOUNCEMENT_URL; exports.getFeatureAnnouncementNotifications = getFeatureAnnouncementNotifications;
|
|
92
|
-
//# sourceMappingURL=chunk-LGXHJ24K.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NotificationServicesController/services/feature-announcements.ts"],"names":[],"mappings":"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","sourcesContent":["import { documentToHtmlString } from '@contentful/rich-text-html-renderer';\nimport type { Entry, Asset, EntryCollection } from 'contentful';\n\nimport { TRIGGER_TYPES } from '../constants/notification-schema';\nimport { processFeatureAnnouncement } from '../processors/process-feature-announcement';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n ImageFields,\n TypeFeatureAnnouncement,\n} from '../types/feature-announcement/type-feature-announcement';\nimport type {\n TypeExternalLinkFields,\n TypePortfolioLinkFields,\n TypeExtensionLinkFields,\n TypeMobileLinkFields,\n} from '../types/feature-announcement/type-links';\nimport type { INotification } from '../types/notification/notification';\n\nconst DEFAULT_SPACE_ID = ':space_id';\nconst DEFAULT_ACCESS_TOKEN = ':access_token';\nconst DEFAULT_CLIENT_ID = ':client_id';\nexport const FEATURE_ANNOUNCEMENT_API = `https://cdn.contentful.com/spaces/${DEFAULT_SPACE_ID}/environments/master/entries`;\nexport const FEATURE_ANNOUNCEMENT_URL = `${FEATURE_ANNOUNCEMENT_API}?access_token=${DEFAULT_ACCESS_TOKEN}&content_type=productAnnouncement&include=10&fields.clients=${DEFAULT_CLIENT_ID}`;\n\ntype Env = {\n spaceId: string;\n accessToken: string;\n platform: string;\n};\n\n/**\n * Contentful API Response Shape\n */\nexport type ContentfulResult = {\n includes?: {\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Entry?: Entry[];\n // eslint-disable-next-line @typescript-eslint/naming-convention\n Asset?: Asset[];\n };\n items?: TypeFeatureAnnouncement[];\n};\n\nconst getFeatureAnnouncementUrl = (env: Env) =>\n FEATURE_ANNOUNCEMENT_URL.replace(DEFAULT_SPACE_ID, env.spaceId)\n .replace(DEFAULT_ACCESS_TOKEN, env.accessToken)\n .replace(DEFAULT_CLIENT_ID, env.platform);\n\nconst fetchFeatureAnnouncementNotifications = async (\n env: Env,\n): Promise<FeatureAnnouncementRawNotification[]> => {\n const url = getFeatureAnnouncementUrl(env);\n\n const data = await fetch(url)\n .then((r) => r.json())\n .catch(() => null);\n\n if (!data) {\n return [];\n }\n\n const findIncludedItem = (sysId: string) => {\n const typedData: EntryCollection<\n | ImageFields\n | TypeExtensionLinkFields\n | TypePortfolioLinkFields\n | TypeMobileLinkFields\n | TypeExternalLinkFields\n > = data;\n const item =\n typedData?.includes?.Entry?.find((i: Entry) => i?.sys?.id === sysId) ||\n typedData?.includes?.Asset?.find((i: Asset) => i?.sys?.id === sysId);\n return item ? item?.fields : null;\n };\n\n const contentfulNotifications = data?.items ?? [];\n const rawNotifications: FeatureAnnouncementRawNotification[] =\n contentfulNotifications.map((n: TypeFeatureAnnouncement) => {\n const { fields } = n;\n const imageFields = fields.image\n ? (findIncludedItem(fields.image.sys.id) as ImageFields['fields'])\n : undefined;\n\n const externalLinkFields = fields.externalLink\n ? (findIncludedItem(\n fields.externalLink.sys.id,\n ) as TypeExternalLinkFields['fields'])\n : undefined;\n const portfolioLinkFields = fields.portfolioLink\n ? (findIncludedItem(\n fields.portfolioLink.sys.id,\n ) as TypePortfolioLinkFields['fields'])\n : undefined;\n const extensionLinkFields = fields.extensionLink\n ? (findIncludedItem(\n fields.extensionLink.sys.id,\n ) as TypeExtensionLinkFields['fields'])\n : undefined;\n const mobileLinkFields = fields.mobileLink\n ? (findIncludedItem(\n fields.mobileLink.sys.id,\n ) as TypeMobileLinkFields['fields'])\n : undefined;\n\n const notification: FeatureAnnouncementRawNotification = {\n type: TRIGGER_TYPES.FEATURES_ANNOUNCEMENT,\n createdAt: new Date(n.sys.createdAt).toString(),\n data: {\n id: fields.id,\n category: fields.category,\n title: fields.title,\n longDescription: documentToHtmlString(fields.longDescription),\n shortDescription: fields.shortDescription,\n image: {\n title: imageFields?.title,\n description: imageFields?.description,\n url: imageFields?.file?.url ?? '',\n },\n externalLink: externalLinkFields && {\n externalLinkText: externalLinkFields?.externalLinkText,\n externalLinkUrl: externalLinkFields?.externalLinkUrl,\n },\n portfolioLink: portfolioLinkFields && {\n portfolioLinkText: portfolioLinkFields?.portfolioLinkText,\n portfolioLinkUrl: portfolioLinkFields?.portfolioLinkUrl,\n },\n extensionLink: extensionLinkFields && {\n extensionLinkText: extensionLinkFields?.extensionLinkText,\n extensionLinkRoute: extensionLinkFields?.extensionLinkRoute,\n },\n mobileLink: mobileLinkFields && {\n mobileLinkText: mobileLinkFields?.mobileLinkText,\n mobileLinkUrl: mobileLinkFields?.mobileLinkUrl,\n },\n },\n };\n\n return notification;\n });\n\n return rawNotifications;\n};\n\n/**\n * Gets Feature Announcement from our services\n * @param env - environment for feature announcements\n * @returns Raw Feature Announcements\n */\nexport async function getFeatureAnnouncementNotifications(\n env: Env,\n): Promise<INotification[]> {\n if (env?.accessToken && env?.spaceId && env?.platform) {\n const rawNotifications = await fetchFeatureAnnouncementNotifications(env);\n const notifications = rawNotifications.map((notification) =>\n processFeatureAnnouncement(notification),\n );\n\n return notifications;\n }\n\n return [];\n}\n"]}
|
package/dist/chunk-LYEXYTOI.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});// src/NotificationServicesController/processors/process-onchain-notifications.ts
|
|
2
|
-
function processOnChainNotification(notification) {
|
|
3
|
-
return {
|
|
4
|
-
...notification,
|
|
5
|
-
id: notification.id,
|
|
6
|
-
createdAt: new Date(notification.created_at).toISOString(),
|
|
7
|
-
isRead: !notification.unread
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
exports.processOnChainNotification = processOnChainNotification;
|
|
14
|
-
//# sourceMappingURL=chunk-LYEXYTOI.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NotificationServicesController/processors/process-onchain-notifications.ts"],"names":[],"mappings":";AASO,SAAS,2BACd,cACe;AACf,SAAO;AAAA,IACL,GAAG;AAAA,IACH,IAAI,aAAa;AAAA,IACjB,WAAW,IAAI,KAAK,aAAa,UAAU,EAAE,YAAY;AAAA,IACzD,QAAQ,CAAC,aAAa;AAAA,EACxB;AACF","sourcesContent":["import type { INotification } from '../types/notification/notification';\nimport type { OnChainRawNotification } from '../types/on-chain-notification/on-chain-notification';\n\n/**\n * Processes On-Chain notifications to a normalized notification\n *\n * @param notification - On-Chain Notification\n * @returns Normalized Notification\n */\nexport function processOnChainNotification(\n notification: OnChainRawNotification,\n): INotification {\n return {\n ...notification,\n id: notification.id,\n createdAt: new Date(notification.created_at).toISOString(),\n isRead: !notification.unread,\n };\n}\n"]}
|
package/dist/chunk-LZMC2QML.mjs
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
NOTIFICATION_NETWORK_CURRENCY_NAME,
|
|
3
|
-
NOTIFICATION_NETWORK_CURRENCY_SYMBOL,
|
|
4
|
-
SUPPORTED_NOTIFICATION_BLOCK_EXPLORERS
|
|
5
|
-
} from "./chunk-77QIITUL.mjs";
|
|
6
|
-
import {
|
|
7
|
-
NOTIFICATION_CHAINS_ID
|
|
8
|
-
} from "./chunk-53F3SYYM.mjs";
|
|
9
|
-
import {
|
|
10
|
-
__export
|
|
11
|
-
} from "./chunk-U5UIDVOO.mjs";
|
|
12
|
-
|
|
13
|
-
// src/NotificationServicesController/ui/index.ts
|
|
14
|
-
var ui_exports = {};
|
|
15
|
-
__export(ui_exports, {
|
|
16
|
-
NOTIFICATION_CHAINS_ID: () => NOTIFICATION_CHAINS_ID,
|
|
17
|
-
NOTIFICATION_NETWORK_CURRENCY_NAME: () => NOTIFICATION_NETWORK_CURRENCY_NAME,
|
|
18
|
-
NOTIFICATION_NETWORK_CURRENCY_SYMBOL: () => NOTIFICATION_NETWORK_CURRENCY_SYMBOL,
|
|
19
|
-
SUPPORTED_NOTIFICATION_BLOCK_EXPLORERS: () => SUPPORTED_NOTIFICATION_BLOCK_EXPLORERS
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
export {
|
|
23
|
-
ui_exports
|
|
24
|
-
};
|
|
25
|
-
//# sourceMappingURL=chunk-LZMC2QML.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NotificationServicesController/ui/index.ts"],"sourcesContent":["export * from './constants';\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
|
package/dist/chunk-MG5QDUDI.mjs
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
processOnChainNotification
|
|
3
|
-
} from "./chunk-BONB66A2.mjs";
|
|
4
|
-
import {
|
|
5
|
-
isFeatureAnnouncementRead,
|
|
6
|
-
processFeatureAnnouncement
|
|
7
|
-
} from "./chunk-D42BBXBM.mjs";
|
|
8
|
-
import {
|
|
9
|
-
TRIGGER_TYPES
|
|
10
|
-
} from "./chunk-53F3SYYM.mjs";
|
|
11
|
-
|
|
12
|
-
// src/NotificationServicesController/processors/process-notifications.ts
|
|
13
|
-
var isOnChainNotification = (n) => Object.values(TRIGGER_TYPES).includes(n.type);
|
|
14
|
-
var isFeatureAnnouncement = (n) => n.type === "features_announcement" /* FEATURES_ANNOUNCEMENT */;
|
|
15
|
-
function processNotification(notification, readNotifications = []) {
|
|
16
|
-
const exhaustedAllCases = (_) => {
|
|
17
|
-
const type = notification?.type;
|
|
18
|
-
throw new Error(`No processor found for notification kind ${type}`);
|
|
19
|
-
};
|
|
20
|
-
if (isFeatureAnnouncement(notification)) {
|
|
21
|
-
const n = processFeatureAnnouncement(
|
|
22
|
-
notification
|
|
23
|
-
);
|
|
24
|
-
n.isRead = isFeatureAnnouncementRead(n, readNotifications);
|
|
25
|
-
return n;
|
|
26
|
-
}
|
|
27
|
-
if (isOnChainNotification(notification)) {
|
|
28
|
-
return processOnChainNotification(notification);
|
|
29
|
-
}
|
|
30
|
-
return exhaustedAllCases(notification);
|
|
31
|
-
}
|
|
32
|
-
function safeProcessNotification(notification, readNotifications = []) {
|
|
33
|
-
try {
|
|
34
|
-
const processedNotification = processNotification(
|
|
35
|
-
notification,
|
|
36
|
-
readNotifications
|
|
37
|
-
);
|
|
38
|
-
return processedNotification;
|
|
39
|
-
} catch {
|
|
40
|
-
return void 0;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
processNotification,
|
|
46
|
-
safeProcessNotification
|
|
47
|
-
};
|
|
48
|
-
//# sourceMappingURL=chunk-MG5QDUDI.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NotificationServicesController/processors/process-notifications.ts"],"sourcesContent":["import { TRIGGER_TYPES } from '../constants/notification-schema';\nimport type { FeatureAnnouncementRawNotification } from '../types/feature-announcement/feature-announcement';\nimport type {\n INotification,\n NotificationUnion,\n} from '../types/notification/notification';\nimport type { OnChainRawNotification } from '../types/on-chain-notification/on-chain-notification';\nimport {\n isFeatureAnnouncementRead,\n processFeatureAnnouncement,\n} from './process-feature-announcement';\nimport { processOnChainNotification } from './process-onchain-notifications';\n\nconst isOnChainNotification = (\n n: NotificationUnion,\n): n is OnChainRawNotification => Object.values(TRIGGER_TYPES).includes(n.type);\n\nconst isFeatureAnnouncement = (\n n: NotificationUnion,\n): n is FeatureAnnouncementRawNotification =>\n n.type === TRIGGER_TYPES.FEATURES_ANNOUNCEMENT;\n\n/**\n * Process feature announcement and wallet notifications into a shared/normalised notification shape.\n * We can still differentiate notifications by the `type` property\n *\n * @param notification - a feature announcement or on chain notification\n * @param readNotifications - all read notifications currently\n * @returns a processed notification\n */\nexport function processNotification(\n notification: NotificationUnion,\n readNotifications: string[] = [],\n): INotification {\n const exhaustedAllCases = (_: never) => {\n const type: string = notification?.type;\n throw new Error(`No processor found for notification kind ${type}`);\n };\n\n if (isFeatureAnnouncement(notification)) {\n const n = processFeatureAnnouncement(\n notification as FeatureAnnouncementRawNotification,\n );\n n.isRead = isFeatureAnnouncementRead(n, readNotifications);\n return n;\n }\n\n if (isOnChainNotification(notification)) {\n return processOnChainNotification(notification as OnChainRawNotification);\n }\n\n return exhaustedAllCases(notification as never);\n}\n\n/**\n * Safe version of processing a notification. Rather than throwing an error if failed to process, it will return the Notification or undefined\n *\n * @param notification - notification to processes\n * @param readNotifications - all read notifications currently\n * @returns a process notification or undefined if failed to process\n */\nexport function safeProcessNotification(\n notification: NotificationUnion,\n readNotifications: string[] = [],\n): INotification | undefined {\n try {\n const processedNotification = processNotification(\n notification,\n readNotifications,\n );\n return processedNotification;\n } catch {\n return undefined;\n }\n}\n"],"mappings":";;;;;;;;;;;;AAaA,IAAM,wBAAwB,CAC5B,MACgC,OAAO,OAAO,aAAa,EAAE,SAAS,EAAE,IAAI;AAE9E,IAAM,wBAAwB,CAC5B,MAEA,EAAE;AAUG,SAAS,oBACd,cACA,oBAA8B,CAAC,GAChB;AACf,QAAM,oBAAoB,CAAC,MAAa;AACtC,UAAM,OAAe,cAAc;AACnC,UAAM,IAAI,MAAM,4CAA4C,IAAI,EAAE;AAAA,EACpE;AAEA,MAAI,sBAAsB,YAAY,GAAG;AACvC,UAAM,IAAI;AAAA,MACR;AAAA,IACF;AACA,MAAE,SAAS,0BAA0B,GAAG,iBAAiB;AACzD,WAAO;AAAA,EACT;AAEA,MAAI,sBAAsB,YAAY,GAAG;AACvC,WAAO,2BAA2B,YAAsC;AAAA,EAC1E;AAEA,SAAO,kBAAkB,YAAqB;AAChD;AASO,SAAS,wBACd,cACA,oBAA8B,CAAC,GACJ;AAC3B,MAAI;AACF,UAAM,wBAAwB;AAAA,MAC5B;AAAA,MACA;AAAA,IACF;AACA,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;","names":[]}
|
package/dist/chunk-MNBV5FJI.mjs
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createOnChainPushNotificationMessage,
|
|
3
|
-
createOnChainPushNotificationMessages,
|
|
4
|
-
isOnChainNotification
|
|
5
|
-
} from "./chunk-WGBEAP2F.mjs";
|
|
6
|
-
import {
|
|
7
|
-
calcTokenAmount,
|
|
8
|
-
formatAmount,
|
|
9
|
-
getAmount,
|
|
10
|
-
getLeadingZeroCount
|
|
11
|
-
} from "./chunk-ODI2BTKS.mjs";
|
|
12
|
-
import {
|
|
13
|
-
__export
|
|
14
|
-
} from "./chunk-U5UIDVOO.mjs";
|
|
15
|
-
|
|
16
|
-
// src/NotificationServicesPushController/utils/index.ts
|
|
17
|
-
var utils_exports = {};
|
|
18
|
-
__export(utils_exports, {
|
|
19
|
-
calcTokenAmount: () => calcTokenAmount,
|
|
20
|
-
createOnChainPushNotificationMessage: () => createOnChainPushNotificationMessage,
|
|
21
|
-
createOnChainPushNotificationMessages: () => createOnChainPushNotificationMessages,
|
|
22
|
-
formatAmount: () => formatAmount,
|
|
23
|
-
getAmount: () => getAmount,
|
|
24
|
-
getLeadingZeroCount: () => getLeadingZeroCount,
|
|
25
|
-
isOnChainNotification: () => isOnChainNotification
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
utils_exports
|
|
30
|
-
};
|
|
31
|
-
//# sourceMappingURL=chunk-MNBV5FJI.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NotificationServicesPushController/utils/index.ts"],"sourcesContent":["export * from './get-notification-data';\nexport * from './get-notification-message';\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;","names":[]}
|
package/dist/chunk-NIPCK74T.js
DELETED
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var _chunkJW3TK3NUjs = require('./chunk-JW3TK3NU.js');
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkDT6SLUWJjs = require('./chunk-DT6SLUWJ.js');
|
|
9
|
-
|
|
10
|
-
// src/NotificationServicesController/services/onchain-notifications.ts
|
|
11
|
-
var _profilesynccontroller = require('@metamask/profile-sync-controller');
|
|
12
|
-
var _loglevel = require('loglevel'); var _loglevel2 = _interopRequireDefault(_loglevel);
|
|
13
|
-
var TRIGGER_API = "https://trigger.api.cx.metamask.io";
|
|
14
|
-
var NOTIFICATION_API = "https://notification.api.cx.metamask.io";
|
|
15
|
-
var TRIGGER_API_BATCH_ENDPOINT = `${TRIGGER_API}/api/v1/triggers/batch`;
|
|
16
|
-
var NOTIFICATION_API_LIST_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications`;
|
|
17
|
-
var NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = (page) => `${NOTIFICATION_API_LIST_ENDPOINT}?page=${page}&per_page=100`;
|
|
18
|
-
var NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications/mark-as-read`;
|
|
19
|
-
async function createOnChainTriggers(userStorage, storageKey, bearerToken, triggers) {
|
|
20
|
-
const triggersToCreate = triggers.map((t) => ({
|
|
21
|
-
id: t.id,
|
|
22
|
-
token: _profilesynccontroller.UserStorageController.createSHA256Hash(t.id + storageKey),
|
|
23
|
-
config: {
|
|
24
|
-
kind: t.kind,
|
|
25
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
26
|
-
chain_id: Number(t.chainId),
|
|
27
|
-
address: t.address
|
|
28
|
-
}
|
|
29
|
-
}));
|
|
30
|
-
if (triggersToCreate.length === 0) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
const response = await _chunkJW3TK3NUjs.makeApiCall.call(void 0,
|
|
34
|
-
bearerToken,
|
|
35
|
-
TRIGGER_API_BATCH_ENDPOINT,
|
|
36
|
-
"POST",
|
|
37
|
-
triggersToCreate
|
|
38
|
-
);
|
|
39
|
-
if (!response.ok) {
|
|
40
|
-
const errorData = await response.json().catch(() => void 0);
|
|
41
|
-
_loglevel2.default.error("Error creating triggers:", errorData);
|
|
42
|
-
throw new Error("OnChain Notifications - unable to create triggers");
|
|
43
|
-
}
|
|
44
|
-
for (const trigger of triggersToCreate) {
|
|
45
|
-
_chunkJW3TK3NUjs.toggleUserStorageTriggerStatus.call(void 0,
|
|
46
|
-
userStorage,
|
|
47
|
-
trigger.config.address,
|
|
48
|
-
String(trigger.config.chain_id),
|
|
49
|
-
trigger.id,
|
|
50
|
-
true
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
async function deleteOnChainTriggers(userStorage, storageKey, bearerToken, uuids) {
|
|
55
|
-
const triggersToDelete = uuids.map((uuid) => ({
|
|
56
|
-
id: uuid,
|
|
57
|
-
token: _profilesynccontroller.UserStorageController.createSHA256Hash(uuid + storageKey)
|
|
58
|
-
}));
|
|
59
|
-
try {
|
|
60
|
-
const response = await _chunkJW3TK3NUjs.makeApiCall.call(void 0,
|
|
61
|
-
bearerToken,
|
|
62
|
-
TRIGGER_API_BATCH_ENDPOINT,
|
|
63
|
-
"DELETE",
|
|
64
|
-
triggersToDelete
|
|
65
|
-
);
|
|
66
|
-
if (!response.ok) {
|
|
67
|
-
throw new Error(
|
|
68
|
-
`Failed to delete on-chain notifications for uuids ${uuids.join(", ")}`
|
|
69
|
-
);
|
|
70
|
-
}
|
|
71
|
-
for (const uuid of uuids) {
|
|
72
|
-
for (const address in userStorage) {
|
|
73
|
-
if (address in userStorage) {
|
|
74
|
-
for (const chainId in userStorage[address]) {
|
|
75
|
-
if (userStorage?.[address]?.[chainId]?.[uuid]) {
|
|
76
|
-
delete userStorage[address][chainId][uuid];
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
const isEmpty = (obj = {}) => Object.keys(obj).length === 0;
|
|
83
|
-
for (const address in userStorage) {
|
|
84
|
-
if (address in userStorage) {
|
|
85
|
-
for (const chainId in userStorage[address]) {
|
|
86
|
-
if (isEmpty(userStorage?.[address]?.[chainId])) {
|
|
87
|
-
delete userStorage[address][chainId];
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
if (isEmpty(userStorage?.[address])) {
|
|
91
|
-
delete userStorage[address];
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
} catch (err) {
|
|
96
|
-
_loglevel2.default.error(
|
|
97
|
-
`Error deleting on-chain notifications for uuids ${uuids.join(", ")}:`,
|
|
98
|
-
err
|
|
99
|
-
);
|
|
100
|
-
throw err;
|
|
101
|
-
}
|
|
102
|
-
return userStorage;
|
|
103
|
-
}
|
|
104
|
-
async function getOnChainNotifications(userStorage, bearerToken) {
|
|
105
|
-
const triggerIds = _chunkJW3TK3NUjs.traverseUserStorageTriggers.call(void 0, userStorage, {
|
|
106
|
-
mapTrigger: (t) => {
|
|
107
|
-
if (!t.enabled) {
|
|
108
|
-
return void 0;
|
|
109
|
-
}
|
|
110
|
-
return t.id;
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
if (triggerIds.length === 0) {
|
|
114
|
-
return [];
|
|
115
|
-
}
|
|
116
|
-
const onChainNotifications = [];
|
|
117
|
-
const PAGE_LIMIT = 2;
|
|
118
|
-
for (let page = 1; page <= PAGE_LIMIT; page++) {
|
|
119
|
-
try {
|
|
120
|
-
const response = await _chunkJW3TK3NUjs.makeApiCall.call(void 0,
|
|
121
|
-
bearerToken,
|
|
122
|
-
NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY(page),
|
|
123
|
-
"POST",
|
|
124
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
125
|
-
{ trigger_ids: triggerIds }
|
|
126
|
-
);
|
|
127
|
-
const notifications = await response.json();
|
|
128
|
-
const transformedNotifications = notifications.map((n) => {
|
|
129
|
-
if (!n.data?.kind) {
|
|
130
|
-
return void 0;
|
|
131
|
-
}
|
|
132
|
-
return _chunkDT6SLUWJjs.toRawOnChainNotification.call(void 0, n);
|
|
133
|
-
}).filter((n) => Boolean(n));
|
|
134
|
-
onChainNotifications.push(...transformedNotifications);
|
|
135
|
-
if (notifications.length < 100) {
|
|
136
|
-
page = PAGE_LIMIT + 1;
|
|
137
|
-
break;
|
|
138
|
-
}
|
|
139
|
-
} catch (err) {
|
|
140
|
-
_loglevel2.default.error(
|
|
141
|
-
`Error fetching on-chain notifications for trigger IDs ${triggerIds.join(
|
|
142
|
-
", "
|
|
143
|
-
)}:`,
|
|
144
|
-
err
|
|
145
|
-
);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return onChainNotifications;
|
|
149
|
-
}
|
|
150
|
-
async function markNotificationsAsRead(bearerToken, notificationIds) {
|
|
151
|
-
if (notificationIds.length === 0) {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
try {
|
|
155
|
-
const response = await _chunkJW3TK3NUjs.makeApiCall.call(void 0,
|
|
156
|
-
bearerToken,
|
|
157
|
-
NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,
|
|
158
|
-
"POST",
|
|
159
|
-
{ ids: notificationIds }
|
|
160
|
-
);
|
|
161
|
-
if (response.status !== 200) {
|
|
162
|
-
const errorData = await response.json().catch(() => void 0);
|
|
163
|
-
throw new Error(
|
|
164
|
-
`Error marking notifications as read: ${errorData?.message}`
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
} catch (err) {
|
|
168
|
-
_loglevel2.default.error("Error marking notifications as read:", err);
|
|
169
|
-
throw err;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
exports.TRIGGER_API = TRIGGER_API; exports.NOTIFICATION_API = NOTIFICATION_API; exports.TRIGGER_API_BATCH_ENDPOINT = TRIGGER_API_BATCH_ENDPOINT; exports.NOTIFICATION_API_LIST_ENDPOINT = NOTIFICATION_API_LIST_ENDPOINT; exports.NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY; exports.NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT; exports.createOnChainTriggers = createOnChainTriggers; exports.deleteOnChainTriggers = deleteOnChainTriggers; exports.getOnChainNotifications = getOnChainNotifications; exports.markNotificationsAsRead = markNotificationsAsRead;
|
|
185
|
-
//# sourceMappingURL=chunk-NIPCK74T.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NotificationServicesController/services/onchain-notifications.ts"],"names":[],"mappings":"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","sourcesContent":["import { UserStorageController } from '@metamask/profile-sync-controller';\nimport log from 'loglevel';\n\nimport { toRawOnChainNotification } from '../../shared/to-raw-notification';\nimport type {\n OnChainRawNotification,\n UnprocessedOnChainRawNotification,\n} from '../types/on-chain-notification/on-chain-notification';\nimport type { UserStorage } from '../types/user-storage/user-storage';\nimport {\n makeApiCall,\n toggleUserStorageTriggerStatus,\n traverseUserStorageTriggers,\n} from '../utils/utils';\n\nexport type NotificationTrigger = {\n id: string;\n chainId: string;\n kind: string;\n address: string;\n};\n\nexport const TRIGGER_API = 'https://trigger.api.cx.metamask.io';\nexport const NOTIFICATION_API = 'https://notification.api.cx.metamask.io';\nexport const TRIGGER_API_BATCH_ENDPOINT = `${TRIGGER_API}/api/v1/triggers/batch`;\nexport const NOTIFICATION_API_LIST_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications`;\nexport const NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY = (page: number) =>\n `${NOTIFICATION_API_LIST_ENDPOINT}?page=${page}&per_page=100`;\nexport const NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT = `${NOTIFICATION_API}/api/v1/notifications/mark-as-read`;\n\n/**\n * Creates on-chain triggers based on the provided notification triggers.\n * This method generates a unique token for each trigger using the trigger ID and storage key,\n * proving ownership of the trigger being updated. It then makes an API call to create these triggers.\n * Upon successful creation, it updates the userStorage to reflect the new trigger status.\n *\n * @param userStorage - The user's storage object where triggers and their statuses are stored.\n * @param storageKey - A key used along with the trigger ID to generate a unique token for each trigger.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param triggers - An array of notification triggers to be created. Each trigger includes an ID, chain ID, kind, and address.\n * @returns A promise that resolves to void. Throws an error if the API call fails or if there's an issue creating the triggers.\n */\nexport async function createOnChainTriggers(\n userStorage: UserStorage,\n storageKey: string,\n bearerToken: string,\n triggers: NotificationTrigger[],\n): Promise<void> {\n type RequestPayloadTrigger = {\n id: string;\n // this is the trigger token, generated by using the uuid + storage key. It proves you own the trigger you are updating\n token: string;\n config: {\n kind: string;\n // eslint-disable-next-line @typescript-eslint/naming-convention\n chain_id: number;\n address: string;\n };\n };\n const triggersToCreate: RequestPayloadTrigger[] = triggers.map((t) => ({\n id: t.id,\n token: UserStorageController.createSHA256Hash(t.id + storageKey),\n config: {\n kind: t.kind,\n // eslint-disable-next-line @typescript-eslint/naming-convention\n chain_id: Number(t.chainId),\n address: t.address,\n },\n }));\n\n if (triggersToCreate.length === 0) {\n return;\n }\n\n const response = await makeApiCall(\n bearerToken,\n TRIGGER_API_BATCH_ENDPOINT,\n 'POST',\n triggersToCreate,\n );\n\n if (!response.ok) {\n const errorData = await response.json().catch(() => undefined);\n log.error('Error creating triggers:', errorData);\n throw new Error('OnChain Notifications - unable to create triggers');\n }\n\n // If the trigger creation was fine\n // then update the userStorage\n for (const trigger of triggersToCreate) {\n toggleUserStorageTriggerStatus(\n userStorage,\n trigger.config.address,\n String(trigger.config.chain_id),\n trigger.id,\n true,\n );\n }\n}\n\n/**\n * Deletes on-chain triggers based on the provided UUIDs.\n * This method generates a unique token for each trigger using the UUID and storage key,\n * proving ownership of the trigger being deleted. It then makes an API call to delete these triggers.\n * Upon successful deletion, it updates the userStorage to remove the deleted trigger statuses.\n *\n * @param userStorage - The user's storage object where triggers and their statuses are stored.\n * @param storageKey - A key used along with the UUID to generate a unique token for each trigger.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param uuids - An array of UUIDs representing the triggers to be deleted.\n * @returns A promise that resolves to the updated UserStorage object. Throws an error if the API call fails or if there's an issue deleting the triggers.\n */\nexport async function deleteOnChainTriggers(\n userStorage: UserStorage,\n storageKey: string,\n bearerToken: string,\n uuids: string[],\n): Promise<UserStorage> {\n const triggersToDelete = uuids.map((uuid) => ({\n id: uuid,\n token: UserStorageController.createSHA256Hash(uuid + storageKey),\n }));\n\n try {\n const response = await makeApiCall(\n bearerToken,\n TRIGGER_API_BATCH_ENDPOINT,\n 'DELETE',\n triggersToDelete,\n );\n\n if (!response.ok) {\n throw new Error(\n `Failed to delete on-chain notifications for uuids ${uuids.join(', ')}`,\n );\n }\n\n // Update the state of the deleted trigger to false\n for (const uuid of uuids) {\n for (const address in userStorage) {\n if (address in userStorage) {\n for (const chainId in userStorage[address]) {\n if (userStorage?.[address]?.[chainId]?.[uuid]) {\n delete userStorage[address][chainId][uuid];\n }\n }\n }\n }\n }\n\n // Follow-up cleanup, if an address had no triggers whatsoever, then we can delete the address\n const isEmpty = (obj = {}) => Object.keys(obj).length === 0;\n for (const address in userStorage) {\n if (address in userStorage) {\n for (const chainId in userStorage[address]) {\n // Chain isEmpty Check\n if (isEmpty(userStorage?.[address]?.[chainId])) {\n delete userStorage[address][chainId];\n }\n }\n\n // Address isEmpty Check\n if (isEmpty(userStorage?.[address])) {\n delete userStorage[address];\n }\n }\n }\n } catch (err) {\n log.error(\n `Error deleting on-chain notifications for uuids ${uuids.join(', ')}:`,\n err,\n );\n throw err;\n }\n\n return userStorage;\n}\n\n/**\n * Fetches on-chain notifications for the given user storage and BearerToken.\n * This method iterates through the userStorage to find enabled triggers and fetches notifications for those triggers.\n * It makes paginated API calls to the notifications service, transforming and aggregating the notifications into a single array.\n * The process stops either when all pages have been fetched or when a page has less than 100 notifications, indicating the end of the data.\n *\n * @param userStorage - The user's storage object containing trigger information.\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @returns A promise that resolves to an array of OnChainRawNotification objects. If no triggers are enabled or an error occurs, it may return an empty array.\n */\nexport async function getOnChainNotifications(\n userStorage: UserStorage,\n bearerToken: string,\n): Promise<OnChainRawNotification[]> {\n const triggerIds = traverseUserStorageTriggers(userStorage, {\n mapTrigger: (t) => {\n if (!t.enabled) {\n return undefined;\n }\n return t.id;\n },\n });\n\n if (triggerIds.length === 0) {\n return [];\n }\n\n const onChainNotifications: OnChainRawNotification[] = [];\n const PAGE_LIMIT = 2;\n for (let page = 1; page <= PAGE_LIMIT; page++) {\n try {\n const response = await makeApiCall(\n bearerToken,\n NOTIFICATION_API_LIST_ENDPOINT_PAGE_QUERY(page),\n 'POST',\n // eslint-disable-next-line @typescript-eslint/naming-convention\n { trigger_ids: triggerIds },\n );\n\n const notifications =\n (await response.json()) as UnprocessedOnChainRawNotification[];\n\n // Transform and sort notifications\n const transformedNotifications = notifications\n .map((n): OnChainRawNotification | undefined => {\n if (!n.data?.kind) {\n return undefined;\n }\n\n return toRawOnChainNotification(n);\n })\n .filter((n): n is OnChainRawNotification => Boolean(n));\n\n onChainNotifications.push(...transformedNotifications);\n\n // if less than 100 notifications on page, then means we reached end\n if (notifications.length < 100) {\n page = PAGE_LIMIT + 1;\n break;\n }\n } catch (err) {\n log.error(\n `Error fetching on-chain notifications for trigger IDs ${triggerIds.join(\n ', ',\n )}:`,\n err,\n );\n // do nothing\n }\n }\n\n return onChainNotifications;\n}\n\n/**\n * Marks the specified notifications as read.\n * This method sends a POST request to the notifications service to mark the provided notification IDs as read.\n * If the operation is successful, it completes without error. If the operation fails, it throws an error with details.\n *\n * @param bearerToken - The JSON Web Token used for authentication in the API call.\n * @param notificationIds - An array of notification IDs to be marked as read.\n * @returns A promise that resolves to void. The promise will reject if there's an error during the API call or if the response status is not 200.\n */\nexport async function markNotificationsAsRead(\n bearerToken: string,\n notificationIds: string[],\n): Promise<void> {\n if (notificationIds.length === 0) {\n return;\n }\n\n try {\n const response = await makeApiCall(\n bearerToken,\n NOTIFICATION_API_MARK_ALL_AS_READ_ENDPOINT,\n 'POST',\n { ids: notificationIds },\n );\n\n if (response.status !== 200) {\n const errorData = await response.json().catch(() => undefined);\n throw new Error(\n `Error marking notifications as read: ${errorData?.message as string}`,\n );\n }\n } catch (err) {\n log.error('Error marking notifications as read:', err);\n throw err;\n }\n}\n"]}
|
package/dist/chunk-O45HYLIV.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
-
|
|
3
|
-
var _chunkHE3P5RM7js = require('./chunk-HE3P5RM7.js');
|
|
4
|
-
|
|
5
|
-
// src/NotificationServicesController/ui/constants.ts
|
|
6
|
-
var NOTIFICATION_NETWORK_CURRENCY_NAME = {
|
|
7
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.ETHEREUM]: "Ethereum",
|
|
8
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.ARBITRUM]: "Arbitrum",
|
|
9
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.AVALANCHE]: "Avalanche",
|
|
10
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.BSC]: "Binance",
|
|
11
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.LINEA]: "Linea",
|
|
12
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.OPTIMISM]: "Optimism",
|
|
13
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.POLYGON]: "Polygon"
|
|
14
|
-
};
|
|
15
|
-
var NOTIFICATION_NETWORK_CURRENCY_SYMBOL = {
|
|
16
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.ETHEREUM]: "ETH",
|
|
17
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.ARBITRUM]: "ETH",
|
|
18
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.AVALANCHE]: "AVAX",
|
|
19
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.BSC]: "BNB",
|
|
20
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.LINEA]: "ETH",
|
|
21
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.OPTIMISM]: "ETH",
|
|
22
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.POLYGON]: "MATIC"
|
|
23
|
-
};
|
|
24
|
-
var SUPPORTED_NOTIFICATION_BLOCK_EXPLORERS = {
|
|
25
|
-
// ETHEREUM
|
|
26
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.ETHEREUM]: {
|
|
27
|
-
url: "https://etherscan.io",
|
|
28
|
-
name: "Etherscan"
|
|
29
|
-
},
|
|
30
|
-
// OPTIMISM
|
|
31
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.OPTIMISM]: {
|
|
32
|
-
url: "https://optimistic.etherscan.io",
|
|
33
|
-
name: "Optimistic Etherscan"
|
|
34
|
-
},
|
|
35
|
-
// BSC
|
|
36
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.BSC]: {
|
|
37
|
-
url: "https://bscscan.com",
|
|
38
|
-
name: "BscScan"
|
|
39
|
-
},
|
|
40
|
-
// POLYGON
|
|
41
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.POLYGON]: {
|
|
42
|
-
url: "https://polygonscan.com",
|
|
43
|
-
name: "PolygonScan"
|
|
44
|
-
},
|
|
45
|
-
// ARBITRUM
|
|
46
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.ARBITRUM]: {
|
|
47
|
-
url: "https://arbiscan.io",
|
|
48
|
-
name: "Arbiscan"
|
|
49
|
-
},
|
|
50
|
-
// AVALANCHE
|
|
51
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.AVALANCHE]: {
|
|
52
|
-
url: "https://snowtrace.io",
|
|
53
|
-
name: "Snowtrace"
|
|
54
|
-
},
|
|
55
|
-
// LINEA
|
|
56
|
-
[_chunkHE3P5RM7js.NOTIFICATION_CHAINS_ID.LINEA]: {
|
|
57
|
-
url: "https://lineascan.build",
|
|
58
|
-
name: "LineaScan"
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
exports.NOTIFICATION_NETWORK_CURRENCY_NAME = NOTIFICATION_NETWORK_CURRENCY_NAME; exports.NOTIFICATION_NETWORK_CURRENCY_SYMBOL = NOTIFICATION_NETWORK_CURRENCY_SYMBOL; exports.SUPPORTED_NOTIFICATION_BLOCK_EXPLORERS = SUPPORTED_NOTIFICATION_BLOCK_EXPLORERS;
|
|
67
|
-
//# sourceMappingURL=chunk-O45HYLIV.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/NotificationServicesController/ui/constants.ts"],"names":[],"mappings":";;;;;AAEO,IAAM,qCAAqC;AAAA,EAChD,CAAC,uBAAuB,QAAQ,GAAG;AAAA,EACnC,CAAC,uBAAuB,QAAQ,GAAG;AAAA,EACnC,CAAC,uBAAuB,SAAS,GAAG;AAAA,EACpC,CAAC,uBAAuB,GAAG,GAAG;AAAA,EAC9B,CAAC,uBAAuB,KAAK,GAAG;AAAA,EAChC,CAAC,uBAAuB,QAAQ,GAAG;AAAA,EACnC,CAAC,uBAAuB,OAAO,GAAG;AACpC;AAEO,IAAM,uCAAuC;AAAA,EAClD,CAAC,uBAAuB,QAAQ,GAAG;AAAA,EACnC,CAAC,uBAAuB,QAAQ,GAAG;AAAA,EACnC,CAAC,uBAAuB,SAAS,GAAG;AAAA,EACpC,CAAC,uBAAuB,GAAG,GAAG;AAAA,EAC9B,CAAC,uBAAuB,KAAK,GAAG;AAAA,EAChC,CAAC,uBAAuB,QAAQ,GAAG;AAAA,EACnC,CAAC,uBAAuB,OAAO,GAAG;AACpC;AAOO,IAAM,yCAAyC;AAAA;AAAA,EAEpD,CAAC,uBAAuB,QAAQ,GAAG;AAAA,IACjC,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AAAA;AAAA,EAEA,CAAC,uBAAuB,QAAQ,GAAG;AAAA,IACjC,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AAAA;AAAA,EAEA,CAAC,uBAAuB,GAAG,GAAG;AAAA,IAC5B,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AAAA;AAAA,EAEA,CAAC,uBAAuB,OAAO,GAAG;AAAA,IAChC,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AAAA;AAAA,EAEA,CAAC,uBAAuB,QAAQ,GAAG;AAAA,IACjC,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AAAA;AAAA,EAEA,CAAC,uBAAuB,SAAS,GAAG;AAAA,IAClC,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AAAA;AAAA,EAEA,CAAC,uBAAuB,KAAK,GAAG;AAAA,IAC9B,KAAK;AAAA,IACL,MAAM;AAAA,EACR;AACF","sourcesContent":["import { NOTIFICATION_CHAINS_ID } from '../constants/notification-schema';\n\nexport const NOTIFICATION_NETWORK_CURRENCY_NAME = {\n [NOTIFICATION_CHAINS_ID.ETHEREUM]: 'Ethereum',\n [NOTIFICATION_CHAINS_ID.ARBITRUM]: 'Arbitrum',\n [NOTIFICATION_CHAINS_ID.AVALANCHE]: 'Avalanche',\n [NOTIFICATION_CHAINS_ID.BSC]: 'Binance',\n [NOTIFICATION_CHAINS_ID.LINEA]: 'Linea',\n [NOTIFICATION_CHAINS_ID.OPTIMISM]: 'Optimism',\n [NOTIFICATION_CHAINS_ID.POLYGON]: 'Polygon',\n} as const;\n\nexport const NOTIFICATION_NETWORK_CURRENCY_SYMBOL = {\n [NOTIFICATION_CHAINS_ID.ETHEREUM]: 'ETH',\n [NOTIFICATION_CHAINS_ID.ARBITRUM]: 'ETH',\n [NOTIFICATION_CHAINS_ID.AVALANCHE]: 'AVAX',\n [NOTIFICATION_CHAINS_ID.BSC]: 'BNB',\n [NOTIFICATION_CHAINS_ID.LINEA]: 'ETH',\n [NOTIFICATION_CHAINS_ID.OPTIMISM]: 'ETH',\n [NOTIFICATION_CHAINS_ID.POLYGON]: 'MATIC',\n};\n\nexport type BlockExplorerConfig = {\n url: string;\n name: string;\n};\n\nexport const SUPPORTED_NOTIFICATION_BLOCK_EXPLORERS = {\n // ETHEREUM\n [NOTIFICATION_CHAINS_ID.ETHEREUM]: {\n url: 'https://etherscan.io',\n name: 'Etherscan',\n },\n // OPTIMISM\n [NOTIFICATION_CHAINS_ID.OPTIMISM]: {\n url: 'https://optimistic.etherscan.io',\n name: 'Optimistic Etherscan',\n },\n // BSC\n [NOTIFICATION_CHAINS_ID.BSC]: {\n url: 'https://bscscan.com',\n name: 'BscScan',\n },\n // POLYGON\n [NOTIFICATION_CHAINS_ID.POLYGON]: {\n url: 'https://polygonscan.com',\n name: 'PolygonScan',\n },\n // ARBITRUM\n [NOTIFICATION_CHAINS_ID.ARBITRUM]: {\n url: 'https://arbiscan.io',\n name: 'Arbiscan',\n },\n // AVALANCHE\n [NOTIFICATION_CHAINS_ID.AVALANCHE]: {\n url: 'https://snowtrace.io',\n name: 'Snowtrace',\n },\n // LINEA\n [NOTIFICATION_CHAINS_ID.LINEA]: {\n url: 'https://lineascan.build',\n name: 'LineaScan',\n },\n} satisfies Record<string, BlockExplorerConfig>;\n\nexport { NOTIFICATION_CHAINS_ID } from '../constants/notification-schema';\n"]}
|
package/dist/chunk-ODI2BTKS.mjs
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
// src/NotificationServicesPushController/utils/get-notification-data.ts
|
|
2
|
-
import { BigNumber } from "bignumber.js";
|
|
3
|
-
var defaultFormatOptions = {
|
|
4
|
-
decimalPlaces: 4
|
|
5
|
-
};
|
|
6
|
-
function calcTokenAmount(value, decimals) {
|
|
7
|
-
const multiplier = Math.pow(10, Number(decimals || 0));
|
|
8
|
-
return new BigNumber(String(value)).div(multiplier);
|
|
9
|
-
}
|
|
10
|
-
var getLeadingZeroCount = (num) => {
|
|
11
|
-
const numToString = new BigNumber(num, 10).toString(10);
|
|
12
|
-
const fractionalPart = numToString.split(".")[1] ?? "";
|
|
13
|
-
return fractionalPart.match(/^0*/u)?.[0]?.length || 0;
|
|
14
|
-
};
|
|
15
|
-
var formatAmount = (numericAmount, opts) => {
|
|
16
|
-
const options = { ...defaultFormatOptions, ...opts };
|
|
17
|
-
const leadingZeros = getLeadingZeroCount(numericAmount);
|
|
18
|
-
const isDecimal = numericAmount.toString().includes(".") || leadingZeros > 0;
|
|
19
|
-
const isLargeNumber = numericAmount > 999;
|
|
20
|
-
const handleShouldEllipse = (decimalPlaces) => Boolean(options?.shouldEllipse) && leadingZeros >= decimalPlaces;
|
|
21
|
-
if (isLargeNumber) {
|
|
22
|
-
return Intl.NumberFormat("en-US", {
|
|
23
|
-
notation: "compact",
|
|
24
|
-
compactDisplay: "short",
|
|
25
|
-
maximumFractionDigits: 2
|
|
26
|
-
}).format(numericAmount);
|
|
27
|
-
}
|
|
28
|
-
if (isDecimal) {
|
|
29
|
-
const ellipse = handleShouldEllipse(options.decimalPlaces);
|
|
30
|
-
const formattedValue = Intl.NumberFormat("en-US", {
|
|
31
|
-
minimumFractionDigits: ellipse ? options.decimalPlaces : void 0,
|
|
32
|
-
maximumFractionDigits: options.decimalPlaces
|
|
33
|
-
}).format(numericAmount);
|
|
34
|
-
return ellipse ? `${formattedValue}...` : formattedValue;
|
|
35
|
-
}
|
|
36
|
-
return numericAmount.toString();
|
|
37
|
-
};
|
|
38
|
-
var getAmount = (amount, decimals, options) => {
|
|
39
|
-
if (!amount || !decimals) {
|
|
40
|
-
return "";
|
|
41
|
-
}
|
|
42
|
-
const numericAmount = calcTokenAmount(
|
|
43
|
-
amount,
|
|
44
|
-
parseFloat(decimals)
|
|
45
|
-
).toNumber();
|
|
46
|
-
return formatAmount(numericAmount, options);
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
export {
|
|
50
|
-
calcTokenAmount,
|
|
51
|
-
getLeadingZeroCount,
|
|
52
|
-
formatAmount,
|
|
53
|
-
getAmount
|
|
54
|
-
};
|
|
55
|
-
//# sourceMappingURL=chunk-ODI2BTKS.mjs.map
|