@aws-amplify/notifications 1.6.6-api-v6-models.3f48fe3.0 → 2.0.1-console-preview.deaebd5.0
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/README.md +3 -0
- package/lib/common/AWSPinpointProviderCommon/index.d.ts +6 -1
- package/lib/common/AWSPinpointProviderCommon/index.js +31 -17
- package/lib/common/AWSPinpointProviderCommon/index.js.map +1 -1
- package/lib/common/eventListeners/types.d.ts +2 -2
- package/lib/common/index.d.ts +0 -1
- package/lib/common/index.js +0 -2
- package/lib/common/index.js.map +1 -1
- package/{lib-esm/InAppMessaging → lib/inAppMessaging}/index.d.ts +1 -1
- package/lib/{InAppMessaging → inAppMessaging}/index.js +2 -2
- package/lib/inAppMessaging/index.js.map +1 -0
- package/lib/inAppMessaging/providers/index.d.ts +1 -0
- package/lib/{InAppMessaging/Providers → inAppMessaging/providers}/index.js +2 -2
- package/lib/inAppMessaging/providers/index.js.map +1 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +9 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js.map +1 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/index.js +7 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/index.js.map +1 -0
- package/lib/inAppMessaging/providers/pinpoint/index.d.ts +1 -0
- package/lib/inAppMessaging/providers/pinpoint/index.js +7 -0
- package/lib/inAppMessaging/providers/pinpoint/index.js.map +1 -0
- package/lib/inAppMessaging/providers/pinpoint/types/types.js.map +1 -0
- package/lib/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/utils}/utils.d.ts +3 -4
- package/lib/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/utils}/utils.js +16 -20
- package/lib/inAppMessaging/providers/pinpoint/utils/utils.js.map +1 -0
- package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.js +7 -8
- package/lib/inAppMessaging/sessionTracker/SessionTracker.js.map +1 -0
- package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.native.js +2 -2
- package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.native.js.map +1 -1
- package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/index.js.map +1 -1
- package/lib/inAppMessaging/sessionTracker/types.js.map +1 -0
- package/lib/{InAppMessaging → inAppMessaging}/types.js.map +1 -1
- package/lib/index.d.ts +2 -3
- package/lib/index.js +3 -5
- package/lib/index.js.map +1 -1
- package/lib/pushNotifications/NotEnabledError.js.map +1 -0
- package/lib/pushNotifications/Platform/index.js.map +1 -0
- package/lib/pushNotifications/Platform/index.native.js.map +1 -0
- package/lib/pushNotifications/Platform/types.js.map +1 -0
- package/lib/pushNotifications/PlatformNotSupportedError.js.map +1 -0
- package/lib/{PushNotification → pushNotifications}/index.d.ts +1 -1
- package/lib/{PushNotification → pushNotifications}/index.js +2 -2
- package/lib/pushNotifications/index.js.map +1 -0
- package/lib/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/index.js +3 -52
- package/lib/pushNotifications/providers/AWSPinpointProvider/index.js.map +1 -0
- package/lib/pushNotifications/providers/AWSPinpointProvider/types.js.map +1 -0
- package/{lib-esm/PushNotification/Providers → lib/pushNotifications/providers}/AWSPinpointProvider/utils.d.ts +1 -2
- package/lib/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/utils.js +2 -6
- package/lib/pushNotifications/providers/AWSPinpointProvider/utils.js.map +1 -0
- package/lib/pushNotifications/providers/index.d.ts +1 -0
- package/lib/pushNotifications/providers/index.js +7 -0
- package/lib/pushNotifications/providers/index.js.map +1 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +9 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js.map +1 -0
- package/lib/pushNotifications/providers/pinpoint/apis/index.d.ts +1 -0
- package/lib/pushNotifications/providers/pinpoint/apis/index.js +7 -0
- package/lib/pushNotifications/providers/pinpoint/apis/index.js.map +1 -0
- package/lib/pushNotifications/providers/pinpoint/index.d.ts +1 -0
- package/lib/pushNotifications/providers/pinpoint/index.js +7 -0
- package/lib/pushNotifications/providers/pinpoint/index.js.map +1 -0
- package/lib/pushNotifications/types.js.map +1 -0
- package/lib/pushNotifications/utils.js.map +1 -0
- package/lib/types.d.ts +2 -2
- package/lib-esm/common/AWSPinpointProviderCommon/index.d.ts +6 -1
- package/lib-esm/common/AWSPinpointProviderCommon/index.js +24 -10
- package/lib-esm/common/AWSPinpointProviderCommon/index.js.map +1 -1
- package/lib-esm/common/eventListeners/types.d.ts +2 -2
- package/lib-esm/common/index.d.ts +0 -1
- package/lib-esm/common/index.js +0 -1
- package/lib-esm/common/index.js.map +1 -1
- package/{lib/InAppMessaging → lib-esm/inAppMessaging}/index.d.ts +1 -1
- package/lib-esm/{InAppMessaging → inAppMessaging}/index.js +1 -1
- package/lib-esm/inAppMessaging/index.js.map +1 -0
- package/lib-esm/inAppMessaging/providers/index.d.ts +1 -0
- package/lib-esm/inAppMessaging/providers/index.js +4 -0
- package/lib-esm/inAppMessaging/providers/index.js.map +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +6 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js.map +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +4 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js.map +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/index.js +4 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/index.js.map +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js.map +1 -0
- package/lib-esm/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/utils}/utils.d.ts +3 -4
- package/lib-esm/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/utils}/utils.js +15 -19
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/utils.js.map +1 -0
- package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.js +1 -2
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.js.map +1 -0
- package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.native.js +1 -1
- package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.native.js.map +1 -1
- package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/index.js.map +1 -1
- package/lib-esm/inAppMessaging/sessionTracker/types.js.map +1 -0
- package/lib-esm/{InAppMessaging → inAppMessaging}/types.js.map +1 -1
- package/lib-esm/index.d.ts +2 -3
- package/lib-esm/index.js +2 -3
- package/lib-esm/index.js.map +1 -1
- package/lib-esm/pushNotifications/NotEnabledError.js.map +1 -0
- package/lib-esm/pushNotifications/Platform/index.js.map +1 -0
- package/lib-esm/pushNotifications/Platform/index.native.js.map +1 -0
- package/lib-esm/pushNotifications/Platform/types.js.map +1 -0
- package/lib-esm/pushNotifications/PlatformNotSupportedError.js.map +1 -0
- package/lib-esm/{PushNotification → pushNotifications}/index.d.ts +1 -1
- package/lib-esm/{PushNotification → pushNotifications}/index.js +1 -1
- package/lib-esm/pushNotifications/index.js.map +1 -0
- package/lib-esm/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/index.js +4 -53
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/index.js.map +1 -0
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/types.js.map +1 -0
- package/{lib/PushNotification/Providers → lib-esm/pushNotifications/providers}/AWSPinpointProvider/utils.d.ts +1 -2
- package/lib-esm/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/utils.js +1 -5
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/utils.js.map +1 -0
- package/lib-esm/pushNotifications/providers/index.d.ts +1 -0
- package/lib-esm/pushNotifications/providers/index.js +4 -0
- package/lib-esm/pushNotifications/providers/index.js.map +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +6 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js.map +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/index.d.ts +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js +4 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js.map +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/index.d.ts +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/index.js +4 -0
- package/lib-esm/pushNotifications/providers/pinpoint/index.js.map +1 -0
- package/lib-esm/pushNotifications/types.js.map +1 -0
- package/lib-esm/pushNotifications/utils.js.map +1 -0
- package/lib-esm/types.d.ts +2 -2
- package/package.json +127 -76
- package/src/common/AWSPinpointProviderCommon/index.ts +25 -11
- package/src/common/eventListeners/types.ts +2 -2
- package/src/common/index.ts +0 -1
- package/src/{InAppMessaging → inAppMessaging}/index.ts +1 -1
- package/src/{InAppMessaging/Providers → inAppMessaging/providers}/index.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts +11 -0
- package/src/{PushNotification/Providers → inAppMessaging/providers/pinpoint/apis}/index.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/index.ts +4 -0
- package/src/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/utils}/utils.ts +17 -30
- package/src/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.native.ts +1 -1
- package/src/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.ts +4 -2
- package/src/index.ts +2 -4
- package/src/{PushNotification → pushNotifications}/index.ts +1 -1
- package/src/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/index.ts +4 -41
- package/src/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/utils.ts +1 -15
- package/src/pushNotifications/providers/index.ts +4 -0
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +11 -0
- package/src/pushNotifications/providers/pinpoint/apis/index.ts +4 -0
- package/src/pushNotifications/providers/pinpoint/index.ts +4 -0
- package/src/types.ts +2 -2
- package/lib/InAppMessaging/InAppMessaging.d.ts +0 -57
- package/lib/InAppMessaging/InAppMessaging.js +0 -340
- package/lib/InAppMessaging/InAppMessaging.js.map +0 -1
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +0 -31
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js +0 -266
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib/InAppMessaging/Providers/index.d.ts +0 -1
- package/lib/InAppMessaging/Providers/index.js.map +0 -1
- package/lib/InAppMessaging/SessionTracker/SessionTracker.js.map +0 -1
- package/lib/InAppMessaging/SessionTracker/types.js.map +0 -1
- package/lib/InAppMessaging/index.js.map +0 -1
- package/lib/Notifications.d.ts +0 -24
- package/lib/Notifications.js +0 -94
- package/lib/Notifications.js.map +0 -1
- package/lib/PushNotification/NotEnabledError.js.map +0 -1
- package/lib/PushNotification/Platform/index.js.map +0 -1
- package/lib/PushNotification/Platform/index.native.js.map +0 -1
- package/lib/PushNotification/Platform/types.js.map +0 -1
- package/lib/PushNotification/PlatformNotSupportedError.js.map +0 -1
- package/lib/PushNotification/Providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib/PushNotification/Providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib/PushNotification/Providers/index.d.ts +0 -1
- package/lib/PushNotification/Providers/index.js +0 -7
- package/lib/PushNotification/Providers/index.js.map +0 -1
- package/lib/PushNotification/PushNotification.d.ts +0 -39
- package/lib/PushNotification/PushNotification.js +0 -91
- package/lib/PushNotification/PushNotification.js.map +0 -1
- package/lib/PushNotification/PushNotification.native.d.ts +0 -63
- package/lib/PushNotification/PushNotification.native.js +0 -332
- package/lib/PushNotification/PushNotification.native.js.map +0 -1
- package/lib/PushNotification/index.js.map +0 -1
- package/lib/PushNotification/types.js.map +0 -1
- package/lib/PushNotification/utils.js.map +0 -1
- package/lib/common/constants.d.ts +0 -1
- package/lib/common/constants.js +0 -8
- package/lib/common/constants.js.map +0 -1
- package/lib-esm/InAppMessaging/InAppMessaging.d.ts +0 -57
- package/lib-esm/InAppMessaging/InAppMessaging.js +0 -338
- package/lib-esm/InAppMessaging/InAppMessaging.js.map +0 -1
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +0 -31
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js +0 -264
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib-esm/InAppMessaging/Providers/index.d.ts +0 -1
- package/lib-esm/InAppMessaging/Providers/index.js +0 -4
- package/lib-esm/InAppMessaging/Providers/index.js.map +0 -1
- package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js.map +0 -1
- package/lib-esm/InAppMessaging/SessionTracker/types.js.map +0 -1
- package/lib-esm/InAppMessaging/index.js.map +0 -1
- package/lib-esm/Notifications.d.ts +0 -24
- package/lib-esm/Notifications.js +0 -92
- package/lib-esm/Notifications.js.map +0 -1
- package/lib-esm/PushNotification/NotEnabledError.js.map +0 -1
- package/lib-esm/PushNotification/Platform/index.js.map +0 -1
- package/lib-esm/PushNotification/Platform/index.native.js.map +0 -1
- package/lib-esm/PushNotification/Platform/types.js.map +0 -1
- package/lib-esm/PushNotification/PlatformNotSupportedError.js.map +0 -1
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib-esm/PushNotification/Providers/index.d.ts +0 -1
- package/lib-esm/PushNotification/Providers/index.js +0 -4
- package/lib-esm/PushNotification/Providers/index.js.map +0 -1
- package/lib-esm/PushNotification/PushNotification.d.ts +0 -39
- package/lib-esm/PushNotification/PushNotification.js +0 -89
- package/lib-esm/PushNotification/PushNotification.js.map +0 -1
- package/lib-esm/PushNotification/PushNotification.native.d.ts +0 -63
- package/lib-esm/PushNotification/PushNotification.native.js +0 -330
- package/lib-esm/PushNotification/PushNotification.native.js.map +0 -1
- package/lib-esm/PushNotification/index.js.map +0 -1
- package/lib-esm/PushNotification/types.js.map +0 -1
- package/lib-esm/PushNotification/utils.js.map +0 -1
- package/lib-esm/common/constants.d.ts +0 -1
- package/lib-esm/common/constants.js +0 -6
- package/lib-esm/common/constants.js.map +0 -1
- package/src/InAppMessaging/InAppMessaging.ts +0 -321
- package/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts +0 -323
- package/src/Notifications.ts +0 -90
- package/src/PushNotification/PushNotification.native.ts +0 -386
- package/src/PushNotification/PushNotification.ts +0 -107
- package/src/common/constants.ts +0 -7
- /package/lib/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/types}/types.d.ts +0 -0
- /package/lib/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/types}/types.js +0 -0
- /package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.d.ts +0 -0
- /package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.native.d.ts +0 -0
- /package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/index.d.ts +0 -0
- /package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/index.js +0 -0
- /package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/types.d.ts +0 -0
- /package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/types.js +0 -0
- /package/lib/{InAppMessaging → inAppMessaging}/types.d.ts +0 -0
- /package/lib/{InAppMessaging → inAppMessaging}/types.js +0 -0
- /package/lib/{PushNotification → pushNotifications}/NotEnabledError.d.ts +0 -0
- /package/lib/{PushNotification → pushNotifications}/NotEnabledError.js +0 -0
- /package/lib/{PushNotification → pushNotifications}/Platform/index.d.ts +0 -0
- /package/lib/{PushNotification → pushNotifications}/Platform/index.js +0 -0
- /package/lib/{PushNotification → pushNotifications}/Platform/index.native.d.ts +0 -0
- /package/lib/{PushNotification → pushNotifications}/Platform/index.native.js +0 -0
- /package/lib/{PushNotification → pushNotifications}/Platform/types.d.ts +0 -0
- /package/lib/{PushNotification → pushNotifications}/Platform/types.js +0 -0
- /package/lib/{PushNotification → pushNotifications}/PlatformNotSupportedError.d.ts +0 -0
- /package/lib/{PushNotification → pushNotifications}/PlatformNotSupportedError.js +0 -0
- /package/lib/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/index.d.ts +0 -0
- /package/lib/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/types.d.ts +0 -0
- /package/lib/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/types.js +0 -0
- /package/lib/{PushNotification → pushNotifications}/types.d.ts +0 -0
- /package/lib/{PushNotification → pushNotifications}/types.js +0 -0
- /package/lib/{PushNotification → pushNotifications}/utils.d.ts +0 -0
- /package/lib/{PushNotification → pushNotifications}/utils.js +0 -0
- /package/lib-esm/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/types}/types.d.ts +0 -0
- /package/lib-esm/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/types}/types.js +0 -0
- /package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.d.ts +0 -0
- /package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.native.d.ts +0 -0
- /package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/index.d.ts +0 -0
- /package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/index.js +0 -0
- /package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/types.d.ts +0 -0
- /package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/types.js +0 -0
- /package/lib-esm/{InAppMessaging → inAppMessaging}/types.d.ts +0 -0
- /package/lib-esm/{InAppMessaging → inAppMessaging}/types.js +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/NotEnabledError.d.ts +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/NotEnabledError.js +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/Platform/index.d.ts +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/Platform/index.js +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/Platform/index.native.d.ts +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/Platform/index.native.js +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/Platform/types.d.ts +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/Platform/types.js +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/PlatformNotSupportedError.d.ts +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/PlatformNotSupportedError.js +0 -0
- /package/lib-esm/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/index.d.ts +0 -0
- /package/lib-esm/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/types.d.ts +0 -0
- /package/lib-esm/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/types.js +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/types.d.ts +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/types.js +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/utils.d.ts +0 -0
- /package/lib-esm/{PushNotification → pushNotifications}/utils.js +0 -0
- /package/src/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/types}/types.ts +0 -0
- /package/src/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/index.ts +0 -0
- /package/src/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/types.ts +0 -0
- /package/src/{InAppMessaging → inAppMessaging}/types.ts +0 -0
- /package/src/{PushNotification → pushNotifications}/NotEnabledError.ts +0 -0
- /package/src/{PushNotification → pushNotifications}/Platform/index.native.ts +0 -0
- /package/src/{PushNotification → pushNotifications}/Platform/index.ts +0 -0
- /package/src/{PushNotification → pushNotifications}/Platform/types.ts +0 -0
- /package/src/{PushNotification → pushNotifications}/PlatformNotSupportedError.ts +0 -0
- /package/src/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/types.ts +0 -0
- /package/src/{PushNotification → pushNotifications}/types.ts +0 -0
- /package/src/{PushNotification → pushNotifications}/utils.ts +0 -0
package/src/Notifications.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { Amplify, ConsoleLogger as Logger } from '@aws-amplify/core';
|
|
5
|
-
|
|
6
|
-
import InAppMessagingClass from './InAppMessaging';
|
|
7
|
-
import PushNotificationClass from './PushNotification';
|
|
8
|
-
import { InAppMessagingInterface as InAppMessaging } from './InAppMessaging/types';
|
|
9
|
-
import { PushNotificationInterface as PushNotification } from './PushNotification/types';
|
|
10
|
-
import { NotificationsCategory, NotificationsConfig, UserInfo } from './types';
|
|
11
|
-
|
|
12
|
-
const logger = new Logger('Notifications');
|
|
13
|
-
|
|
14
|
-
class NotificationsClass {
|
|
15
|
-
private config: Record<string, any> = {};
|
|
16
|
-
private inAppMessaging: InAppMessaging;
|
|
17
|
-
private pushNotification?: PushNotification;
|
|
18
|
-
|
|
19
|
-
constructor() {
|
|
20
|
-
this.inAppMessaging = new InAppMessagingClass();
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
/**
|
|
24
|
-
* Get the name of the module category
|
|
25
|
-
* @returns {string} name of the module category
|
|
26
|
-
*/
|
|
27
|
-
getModuleName(): NotificationsCategory {
|
|
28
|
-
return 'Notifications';
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Configure Notifications
|
|
33
|
-
* @param {Object} config - Notifications configuration object
|
|
34
|
-
*/
|
|
35
|
-
configure = ({ Notifications: config }: NotificationsConfig = {}) => {
|
|
36
|
-
this.config = { ...this.config, ...config };
|
|
37
|
-
|
|
38
|
-
logger.debug('configure Notifications', config);
|
|
39
|
-
|
|
40
|
-
// Configure sub-categories
|
|
41
|
-
this.inAppMessaging.configure(this.config.InAppMessaging);
|
|
42
|
-
|
|
43
|
-
if (this.config.Push) {
|
|
44
|
-
try {
|
|
45
|
-
// only instantiate once
|
|
46
|
-
if (!this.pushNotification) {
|
|
47
|
-
this.pushNotification = new PushNotificationClass();
|
|
48
|
-
}
|
|
49
|
-
this.pushNotification.configure(this.config.Push);
|
|
50
|
-
} catch (err) {
|
|
51
|
-
logger.error(err);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return this.config;
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
get InAppMessaging(): InAppMessaging {
|
|
59
|
-
return this.inAppMessaging;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
get Push(): PushNotification {
|
|
63
|
-
return this.pushNotification ?? ({} as PushNotification);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
identifyUser = (userId: string, userInfo: UserInfo): Promise<void[]> => {
|
|
67
|
-
const identifyFunctions: Function[] = [];
|
|
68
|
-
if (this.inAppMessaging) {
|
|
69
|
-
identifyFunctions.push(this.inAppMessaging.identifyUser);
|
|
70
|
-
}
|
|
71
|
-
if (this.pushNotification) {
|
|
72
|
-
identifyFunctions.push(this.pushNotification.identifyUser);
|
|
73
|
-
}
|
|
74
|
-
return Promise.all<void>(
|
|
75
|
-
identifyFunctions.map(async identifyFunction => {
|
|
76
|
-
try {
|
|
77
|
-
await identifyFunction(userId, userInfo);
|
|
78
|
-
} catch (err) {
|
|
79
|
-
logger.error('Failed to identify user', err);
|
|
80
|
-
throw err;
|
|
81
|
-
}
|
|
82
|
-
})
|
|
83
|
-
);
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const Notifications = new NotificationsClass();
|
|
88
|
-
|
|
89
|
-
export default Notifications;
|
|
90
|
-
Amplify.register(Notifications);
|
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import { AppRegistry, NativeEventEmitter } from 'react-native';
|
|
5
|
-
import { ConsoleLogger as Logger } from '@aws-amplify/core';
|
|
6
|
-
import {
|
|
7
|
-
AmplifyRTNPushNotification,
|
|
8
|
-
PushNotificationNativeModule,
|
|
9
|
-
} from '@aws-amplify/rtn-push-notification';
|
|
10
|
-
|
|
11
|
-
import {
|
|
12
|
-
addEventListener,
|
|
13
|
-
EventListener,
|
|
14
|
-
notifyEventListeners,
|
|
15
|
-
notifyEventListenersAndAwaitHandlers,
|
|
16
|
-
} from '../common';
|
|
17
|
-
import { UserInfo } from '../types';
|
|
18
|
-
import NotEnabledError from './NotEnabledError';
|
|
19
|
-
import { AWSPinpointProvider } from './Providers';
|
|
20
|
-
import {
|
|
21
|
-
NotificationsSubCategory,
|
|
22
|
-
OnPushNotificationMessageHandler,
|
|
23
|
-
OnTokenReceivedHandler,
|
|
24
|
-
PushNotificationConfig,
|
|
25
|
-
PushNotificationEvent,
|
|
26
|
-
PushNotificationInterface,
|
|
27
|
-
PushNotificationMessage,
|
|
28
|
-
PushNotificationPermissions,
|
|
29
|
-
PushNotificationPermissionStatus,
|
|
30
|
-
PushNotificationProvider,
|
|
31
|
-
} from './types';
|
|
32
|
-
import {
|
|
33
|
-
normalizeNativePermissionStatus,
|
|
34
|
-
normalizeNativeMessage,
|
|
35
|
-
} from './utils';
|
|
36
|
-
|
|
37
|
-
const logger = new Logger('Notifications.PushNotification');
|
|
38
|
-
const RTN_MODULE = '@aws-amplify/rtn-push-notification';
|
|
39
|
-
const BACKGROUND_TASK_TIMEOUT = 25; // seconds
|
|
40
|
-
|
|
41
|
-
export default class PushNotification implements PushNotificationInterface {
|
|
42
|
-
private isEnabled = false;
|
|
43
|
-
private config: Record<string, any> = {};
|
|
44
|
-
private nativeEvent: Record<string, string>;
|
|
45
|
-
private nativeEventEmitter: NativeEventEmitter;
|
|
46
|
-
private nativeHeadlessTaskKey: string;
|
|
47
|
-
private nativeModule: PushNotificationNativeModule;
|
|
48
|
-
private pluggables: PushNotificationProvider[] = [];
|
|
49
|
-
private token: string;
|
|
50
|
-
|
|
51
|
-
constructor() {
|
|
52
|
-
try {
|
|
53
|
-
this.nativeModule = AmplifyRTNPushNotification;
|
|
54
|
-
// If constructing this, Push is configured in the Amplify root config. If the native module is missing at this
|
|
55
|
-
// point, throw an error to give a hint that the module is missing.
|
|
56
|
-
if (!this.nativeModule) {
|
|
57
|
-
throw new Error();
|
|
58
|
-
}
|
|
59
|
-
const { NativeEvent, NativeHeadlessTaskKey } =
|
|
60
|
-
this.nativeModule.getConstants();
|
|
61
|
-
this.nativeEvent = NativeEvent;
|
|
62
|
-
this.nativeHeadlessTaskKey = NativeHeadlessTaskKey;
|
|
63
|
-
this.nativeEventEmitter = new NativeEventEmitter(
|
|
64
|
-
AmplifyRTNPushNotification
|
|
65
|
-
);
|
|
66
|
-
} catch (err) {
|
|
67
|
-
err.message = `Unable to find ${RTN_MODULE}. ${err.message}`;
|
|
68
|
-
throw err;
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Configure PushNotification
|
|
74
|
-
* @param {Object} config - PushNotification configuration object
|
|
75
|
-
*/
|
|
76
|
-
configure = (config: PushNotificationConfig = {}): PushNotificationConfig => {
|
|
77
|
-
this.config = { ...this.config, ...config };
|
|
78
|
-
|
|
79
|
-
logger.debug('configure PushNotification', this.config);
|
|
80
|
-
|
|
81
|
-
this.pluggables.forEach(pluggable => {
|
|
82
|
-
pluggable.configure(this.config[pluggable.getProviderName()]);
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
if (this.pluggables.length === 0) {
|
|
86
|
-
this.addPluggable(new AWSPinpointProvider());
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
return this.config;
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Get the name of this module
|
|
94
|
-
* @returns {string} name of this module
|
|
95
|
-
*/
|
|
96
|
-
getModuleName(): NotificationsSubCategory {
|
|
97
|
-
return 'PushNotification';
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
/**
|
|
101
|
-
* Get a plugin from added plugins
|
|
102
|
-
* @param {string} providerName - the name of the plugin to get
|
|
103
|
-
*/
|
|
104
|
-
getPluggable = (providerName: string): PushNotificationProvider => {
|
|
105
|
-
const pluggable =
|
|
106
|
-
this.pluggables.find(
|
|
107
|
-
pluggable => pluggable.getProviderName() === providerName
|
|
108
|
-
) ?? null;
|
|
109
|
-
|
|
110
|
-
if (!pluggable) {
|
|
111
|
-
logger.debug(`No plugin found with name ${providerName}`);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
return pluggable;
|
|
115
|
-
};
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Add plugin into PushNotification
|
|
119
|
-
* @param {PushNotificationProvider} pluggable - an instance of the plugin
|
|
120
|
-
*/
|
|
121
|
-
addPluggable = (pluggable: PushNotificationProvider): void => {
|
|
122
|
-
if (
|
|
123
|
-
pluggable &&
|
|
124
|
-
pluggable.getCategory() === 'Notifications' &&
|
|
125
|
-
pluggable.getSubCategory() === 'PushNotification'
|
|
126
|
-
) {
|
|
127
|
-
if (this.getPluggable(pluggable.getProviderName())) {
|
|
128
|
-
throw new Error(
|
|
129
|
-
`Pluggable ${pluggable.getProviderName()} has already been added.`
|
|
130
|
-
);
|
|
131
|
-
}
|
|
132
|
-
this.pluggables.push(pluggable);
|
|
133
|
-
pluggable.configure(this.config[pluggable.getProviderName()]);
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
/**
|
|
138
|
-
* Remove a plugin from added plugins
|
|
139
|
-
* @param {string} providerName - the name of the plugin to remove
|
|
140
|
-
*/
|
|
141
|
-
removePluggable = (providerName: string): void => {
|
|
142
|
-
const index = this.pluggables.findIndex(
|
|
143
|
-
pluggable => pluggable.getProviderName() === providerName
|
|
144
|
-
);
|
|
145
|
-
if (index === -1) {
|
|
146
|
-
logger.debug(`No plugin found with name ${providerName}`);
|
|
147
|
-
} else {
|
|
148
|
-
this.pluggables.splice(index, 1);
|
|
149
|
-
}
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
enable = (): void => {
|
|
153
|
-
if (this.isEnabled) {
|
|
154
|
-
logger.info('Notification listeners have already been enabled');
|
|
155
|
-
return;
|
|
156
|
-
}
|
|
157
|
-
const {
|
|
158
|
-
BACKGROUND_MESSAGE_RECEIVED,
|
|
159
|
-
FOREGROUND_MESSAGE_RECEIVED,
|
|
160
|
-
LAUNCH_NOTIFICATION_OPENED,
|
|
161
|
-
NOTIFICATION_OPENED,
|
|
162
|
-
TOKEN_RECEIVED,
|
|
163
|
-
} = this.nativeEvent;
|
|
164
|
-
if (this.nativeHeadlessTaskKey) {
|
|
165
|
-
// on platforms that can handle headless tasks, register one to broadcast background message received to
|
|
166
|
-
// library listeners
|
|
167
|
-
AppRegistry.registerHeadlessTask(
|
|
168
|
-
this.nativeHeadlessTaskKey,
|
|
169
|
-
() => async message => {
|
|
170
|
-
// keep headless task running until handlers have completed their work
|
|
171
|
-
await notifyEventListenersAndAwaitHandlers(
|
|
172
|
-
PushNotificationEvent.BACKGROUND_MESSAGE_RECEIVED,
|
|
173
|
-
normalizeNativeMessage(message)
|
|
174
|
-
);
|
|
175
|
-
}
|
|
176
|
-
);
|
|
177
|
-
} else if (BACKGROUND_MESSAGE_RECEIVED) {
|
|
178
|
-
// on platforms that can't handle headless tasks, listen for native background message received event and
|
|
179
|
-
// broadcast to library listeners
|
|
180
|
-
this.nativeEventEmitter.addListener(
|
|
181
|
-
BACKGROUND_MESSAGE_RECEIVED,
|
|
182
|
-
async message => {
|
|
183
|
-
// keep background task running until handlers have completed their work
|
|
184
|
-
try {
|
|
185
|
-
await Promise.race([
|
|
186
|
-
notifyEventListenersAndAwaitHandlers(
|
|
187
|
-
PushNotificationEvent.BACKGROUND_MESSAGE_RECEIVED,
|
|
188
|
-
normalizeNativeMessage(message)
|
|
189
|
-
),
|
|
190
|
-
// background tasks will get suspended and all future tasks be deprioritized by the OS if they run for
|
|
191
|
-
// more than 30 seconds so we reject with a error in a shorter amount of time to prevent this from
|
|
192
|
-
// happening
|
|
193
|
-
new Promise((_, reject) => {
|
|
194
|
-
setTimeout(
|
|
195
|
-
() =>
|
|
196
|
-
reject(
|
|
197
|
-
`onNotificationReceivedInBackground handlers should complete their work within ${BACKGROUND_TASK_TIMEOUT} seconds, but they did not.`
|
|
198
|
-
),
|
|
199
|
-
BACKGROUND_TASK_TIMEOUT * 1000
|
|
200
|
-
);
|
|
201
|
-
}),
|
|
202
|
-
]);
|
|
203
|
-
} catch (err) {
|
|
204
|
-
logger.error(err);
|
|
205
|
-
} finally {
|
|
206
|
-
// notify native module that handlers have completed their work (or timed out)
|
|
207
|
-
this.nativeModule.completeNotification?.(
|
|
208
|
-
message.completionHandlerId
|
|
209
|
-
);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
this.nativeEventEmitter.addListener(
|
|
216
|
-
// listen for native foreground message received event and broadcast to library listeners
|
|
217
|
-
FOREGROUND_MESSAGE_RECEIVED,
|
|
218
|
-
message => {
|
|
219
|
-
notifyEventListeners(
|
|
220
|
-
PushNotificationEvent.FOREGROUND_MESSAGE_RECEIVED,
|
|
221
|
-
normalizeNativeMessage(message)
|
|
222
|
-
);
|
|
223
|
-
}
|
|
224
|
-
);
|
|
225
|
-
|
|
226
|
-
const launchNotificationOpenedListener = LAUNCH_NOTIFICATION_OPENED
|
|
227
|
-
? this.nativeEventEmitter.addListener(
|
|
228
|
-
// listen for native notification opened app (user tapped on notification, opening the app from quit -
|
|
229
|
-
// not background - state) event. This is broadcasted to an internal listener only as it is not intended
|
|
230
|
-
// for use otherwise as it produces inconsistent results when used within React Native app context
|
|
231
|
-
LAUNCH_NOTIFICATION_OPENED,
|
|
232
|
-
message => {
|
|
233
|
-
notifyEventListeners(
|
|
234
|
-
PushNotificationEvent.LAUNCH_NOTIFICATION_OPENED,
|
|
235
|
-
normalizeNativeMessage(message)
|
|
236
|
-
);
|
|
237
|
-
// once we are done with it we can remove the listener
|
|
238
|
-
launchNotificationOpenedListener?.remove();
|
|
239
|
-
}
|
|
240
|
-
)
|
|
241
|
-
: null;
|
|
242
|
-
|
|
243
|
-
this.nativeEventEmitter.addListener(
|
|
244
|
-
// listen for native notification opened (user tapped on notification, opening the app from background -
|
|
245
|
-
// not quit - state) event and broadcast to library listeners
|
|
246
|
-
NOTIFICATION_OPENED,
|
|
247
|
-
message => {
|
|
248
|
-
notifyEventListeners(
|
|
249
|
-
PushNotificationEvent.NOTIFICATION_OPENED,
|
|
250
|
-
normalizeNativeMessage(message)
|
|
251
|
-
);
|
|
252
|
-
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
253
|
-
launchNotificationOpenedListener?.remove();
|
|
254
|
-
}
|
|
255
|
-
);
|
|
256
|
-
|
|
257
|
-
this.nativeEventEmitter.addListener(
|
|
258
|
-
// listen for native new token event, automatically re-register device with provider using new token and
|
|
259
|
-
// broadcast to library listeners
|
|
260
|
-
TOKEN_RECEIVED,
|
|
261
|
-
({ token }) => {
|
|
262
|
-
// avoid a race condition where two endpoints are created with the same token on a fresh install
|
|
263
|
-
if (this.token === token) {
|
|
264
|
-
return;
|
|
265
|
-
}
|
|
266
|
-
this.token = token;
|
|
267
|
-
this.registerDevice();
|
|
268
|
-
notifyEventListeners(PushNotificationEvent.TOKEN_RECEIVED, token);
|
|
269
|
-
}
|
|
270
|
-
);
|
|
271
|
-
this.isEnabled = true;
|
|
272
|
-
};
|
|
273
|
-
|
|
274
|
-
identifyUser = (userId: string, userInfo: UserInfo): Promise<void[]> => {
|
|
275
|
-
this.assertIsEnabled();
|
|
276
|
-
return Promise.all<void>(
|
|
277
|
-
this.pluggables.map(async pluggable => {
|
|
278
|
-
try {
|
|
279
|
-
await pluggable.identifyUser(userId, userInfo);
|
|
280
|
-
} catch (err) {
|
|
281
|
-
logger.error('Failed to identify user', err);
|
|
282
|
-
throw err;
|
|
283
|
-
}
|
|
284
|
-
})
|
|
285
|
-
);
|
|
286
|
-
};
|
|
287
|
-
|
|
288
|
-
getLaunchNotification = async (): Promise<PushNotificationMessage | null> => {
|
|
289
|
-
this.assertIsEnabled();
|
|
290
|
-
return normalizeNativeMessage(
|
|
291
|
-
await this.nativeModule.getLaunchNotification?.()
|
|
292
|
-
);
|
|
293
|
-
};
|
|
294
|
-
|
|
295
|
-
getBadgeCount = async (): Promise<number | null> => {
|
|
296
|
-
this.assertIsEnabled();
|
|
297
|
-
return this.nativeModule.getBadgeCount?.();
|
|
298
|
-
};
|
|
299
|
-
|
|
300
|
-
setBadgeCount = (count: number): void => {
|
|
301
|
-
this.assertIsEnabled();
|
|
302
|
-
return this.nativeModule.setBadgeCount?.(count);
|
|
303
|
-
};
|
|
304
|
-
|
|
305
|
-
getPermissionStatus = async (): Promise<PushNotificationPermissionStatus> => {
|
|
306
|
-
this.assertIsEnabled();
|
|
307
|
-
return normalizeNativePermissionStatus(
|
|
308
|
-
await this.nativeModule.getPermissionStatus?.()
|
|
309
|
-
);
|
|
310
|
-
};
|
|
311
|
-
|
|
312
|
-
requestPermissions = async (
|
|
313
|
-
permissions: PushNotificationPermissions = {
|
|
314
|
-
alert: true,
|
|
315
|
-
badge: true,
|
|
316
|
-
sound: true,
|
|
317
|
-
}
|
|
318
|
-
): Promise<boolean> => {
|
|
319
|
-
this.assertIsEnabled();
|
|
320
|
-
return this.nativeModule.requestPermissions?.(permissions);
|
|
321
|
-
};
|
|
322
|
-
|
|
323
|
-
/**
|
|
324
|
-
* Background notifications on will start the app (as a headless JS instance running on a background service on
|
|
325
|
-
* Android) in the background. Handlers registered via `onNotificationReceivedInBackground` should return Promises if
|
|
326
|
-
* it needs to be asynchronous (e.g. to perform some network requests). The app should run in the background as long
|
|
327
|
-
* as there are handlers still running (however, if they run for more than 30 seconds on iOS, subsequent tasks could
|
|
328
|
-
* get deprioritized!). If it is necessary for a handler to execute while the app is in quit state, it should be
|
|
329
|
-
* registered in the application entry point (e.g. index.js) since the application will not fully mount in that case.
|
|
330
|
-
*
|
|
331
|
-
* @param handler a function to be run when a BACKGROUND_MESSAGE_RECEIVED event is received
|
|
332
|
-
* @returns an event listener which should be removed when no longer needed
|
|
333
|
-
*/
|
|
334
|
-
onNotificationReceivedInBackground = (
|
|
335
|
-
handler: OnPushNotificationMessageHandler
|
|
336
|
-
): EventListener<OnPushNotificationMessageHandler> => {
|
|
337
|
-
this.assertIsEnabled();
|
|
338
|
-
return addEventListener(
|
|
339
|
-
PushNotificationEvent.BACKGROUND_MESSAGE_RECEIVED,
|
|
340
|
-
handler
|
|
341
|
-
);
|
|
342
|
-
};
|
|
343
|
-
|
|
344
|
-
onNotificationReceivedInForeground = (
|
|
345
|
-
handler: OnPushNotificationMessageHandler
|
|
346
|
-
): EventListener<OnPushNotificationMessageHandler> => {
|
|
347
|
-
this.assertIsEnabled();
|
|
348
|
-
return addEventListener(
|
|
349
|
-
PushNotificationEvent.FOREGROUND_MESSAGE_RECEIVED,
|
|
350
|
-
handler
|
|
351
|
-
);
|
|
352
|
-
};
|
|
353
|
-
|
|
354
|
-
onNotificationOpened = (
|
|
355
|
-
handler: OnPushNotificationMessageHandler
|
|
356
|
-
): EventListener<OnPushNotificationMessageHandler> => {
|
|
357
|
-
this.assertIsEnabled();
|
|
358
|
-
return addEventListener(PushNotificationEvent.NOTIFICATION_OPENED, handler);
|
|
359
|
-
};
|
|
360
|
-
|
|
361
|
-
onTokenReceived = (
|
|
362
|
-
handler: OnTokenReceivedHandler
|
|
363
|
-
): EventListener<OnTokenReceivedHandler> => {
|
|
364
|
-
this.assertIsEnabled();
|
|
365
|
-
return addEventListener(PushNotificationEvent.TOKEN_RECEIVED, handler);
|
|
366
|
-
};
|
|
367
|
-
|
|
368
|
-
private registerDevice = async (): Promise<void[]> => {
|
|
369
|
-
return Promise.all<void>(
|
|
370
|
-
this.pluggables.map(async pluggable => {
|
|
371
|
-
try {
|
|
372
|
-
await pluggable.registerDevice(this.token);
|
|
373
|
-
} catch (err) {
|
|
374
|
-
logger.error('Failed to register device for push notifications', err);
|
|
375
|
-
throw err;
|
|
376
|
-
}
|
|
377
|
-
})
|
|
378
|
-
);
|
|
379
|
-
};
|
|
380
|
-
|
|
381
|
-
private assertIsEnabled = (): void => {
|
|
382
|
-
if (!this.isEnabled) {
|
|
383
|
-
throw new NotEnabledError();
|
|
384
|
-
}
|
|
385
|
-
};
|
|
386
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
import PlatformNotSupportedError from './PlatformNotSupportedError';
|
|
5
|
-
import {
|
|
6
|
-
NotificationsSubCategory,
|
|
7
|
-
OnPushNotificationMessageHandler,
|
|
8
|
-
OnTokenReceivedHandler,
|
|
9
|
-
PushNotificationConfig,
|
|
10
|
-
PushNotificationInterface,
|
|
11
|
-
PushNotificationMessage,
|
|
12
|
-
PushNotificationPermissions,
|
|
13
|
-
PushNotificationPermissionStatus,
|
|
14
|
-
PushNotificationProvider,
|
|
15
|
-
} from './types';
|
|
16
|
-
|
|
17
|
-
export default class PushNotification implements PushNotificationInterface {
|
|
18
|
-
/**
|
|
19
|
-
* Configure PushNotification
|
|
20
|
-
* @param {Object} config - PushNotification configuration object
|
|
21
|
-
*/
|
|
22
|
-
configure = (_: PushNotificationConfig = {}): PushNotificationConfig => {
|
|
23
|
-
throw new PlatformNotSupportedError();
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Get the name of this module
|
|
28
|
-
* @returns {string} name of this module
|
|
29
|
-
*/
|
|
30
|
-
getModuleName(): NotificationsSubCategory {
|
|
31
|
-
throw new PlatformNotSupportedError();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Get a plugin from added plugins
|
|
36
|
-
* @param {string} providerName - the name of the plugin to get
|
|
37
|
-
*/
|
|
38
|
-
getPluggable = (_: string) => {
|
|
39
|
-
throw new PlatformNotSupportedError();
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Add plugin into PushNotification
|
|
44
|
-
* @param {PushNotificationProvider} pluggable - an instance of the plugin
|
|
45
|
-
*/
|
|
46
|
-
addPluggable = (_: PushNotificationProvider): void => {
|
|
47
|
-
throw new PlatformNotSupportedError();
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Remove a plugin from added plugins
|
|
52
|
-
* @param {string} providerName - the name of the plugin to remove
|
|
53
|
-
*/
|
|
54
|
-
removePluggable = (): void => {
|
|
55
|
-
throw new PlatformNotSupportedError();
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
enable = (): void => {
|
|
59
|
-
throw new PlatformNotSupportedError();
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
identifyUser = (): Promise<void[]> => {
|
|
63
|
-
throw new PlatformNotSupportedError();
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
getLaunchNotification = async (): Promise<PushNotificationMessage> => {
|
|
67
|
-
throw new PlatformNotSupportedError();
|
|
68
|
-
};
|
|
69
|
-
|
|
70
|
-
getBadgeCount = async (): Promise<number | null> => {
|
|
71
|
-
throw new PlatformNotSupportedError();
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
setBadgeCount = (_: number): void => {
|
|
75
|
-
throw new PlatformNotSupportedError();
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
getPermissionStatus = async (): Promise<PushNotificationPermissionStatus> => {
|
|
79
|
-
throw new PlatformNotSupportedError();
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
requestPermissions = async (
|
|
83
|
-
_?: PushNotificationPermissions
|
|
84
|
-
): Promise<boolean> => {
|
|
85
|
-
throw new PlatformNotSupportedError();
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
onNotificationReceivedInBackground = (
|
|
89
|
-
_: OnPushNotificationMessageHandler
|
|
90
|
-
): any => {
|
|
91
|
-
throw new PlatformNotSupportedError();
|
|
92
|
-
};
|
|
93
|
-
|
|
94
|
-
onNotificationReceivedInForeground = (
|
|
95
|
-
_: OnPushNotificationMessageHandler
|
|
96
|
-
): any => {
|
|
97
|
-
throw new PlatformNotSupportedError();
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
onTokenReceived = (_: OnTokenReceivedHandler): any => {
|
|
101
|
-
throw new PlatformNotSupportedError();
|
|
102
|
-
};
|
|
103
|
-
|
|
104
|
-
onNotificationOpened = (_: OnPushNotificationMessageHandler): any => {
|
|
105
|
-
throw new PlatformNotSupportedError();
|
|
106
|
-
};
|
|
107
|
-
}
|
package/src/common/constants.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
-
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
export const AMPLIFY_SYMBOL = (
|
|
4
|
-
typeof Symbol !== 'undefined' && typeof Symbol.for === 'function'
|
|
5
|
-
? Symbol.for('amplify_default')
|
|
6
|
-
: '@@amplify_default'
|
|
7
|
-
) as Symbol;
|
|
File without changes
|
|
File without changes
|
/package/lib/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib/{PushNotification/Providers → pushNotifications/providers}/AWSPinpointProvider/types.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/lib-esm/{InAppMessaging/SessionTracker → inAppMessaging/sessionTracker}/SessionTracker.d.ts
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|