@aws-amplify/notifications 2.0.1-console-preview.5a31ca1.0 → 2.0.1-console-preview.8d88eef.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/in-app-messaging/package.json +7 -0
- package/in-app-messaging/pinpoint/package.json +7 -0
- package/lib/{common/eventListeners/index.js → eventListeners/eventListeners.js} +0 -1
- package/lib/eventListeners/index.d.ts +2 -0
- package/lib/{common → eventListeners}/index.js +0 -3
- package/{lib-esm/common → lib}/eventListeners/types.d.ts +2 -2
- package/lib/{common/eventListeners → eventListeners}/types.js +0 -1
- package/lib/inAppMessaging/errors/InAppMessagingError.js +0 -1
- package/lib/inAppMessaging/errors/assertServiceError.js +0 -1
- package/lib/inAppMessaging/errors/assertValidationError.js +0 -1
- package/lib/inAppMessaging/errors/index.js +0 -1
- package/lib/inAppMessaging/errors/validation.d.ts +0 -1
- package/lib/inAppMessaging/errors/validation.js +0 -5
- package/lib/inAppMessaging/index.d.ts +1 -1
- package/lib/inAppMessaging/index.js +0 -1
- package/lib/inAppMessaging/providers/index.d.ts +2 -1
- package/lib/inAppMessaging/providers/index.js +11 -12
- package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +2 -3
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +6 -10
- package/lib/inAppMessaging/providers/pinpoint/apis/index.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +4 -6
- package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +2 -3
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +2 -3
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +2 -3
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +2 -3
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +2 -3
- package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +6 -17
- package/lib/inAppMessaging/providers/pinpoint/index.d.ts +1 -0
- package/lib/inAppMessaging/providers/pinpoint/index.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/index.d.ts +2 -2
- package/lib/inAppMessaging/providers/pinpoint/types/index.js +0 -3
- package/lib/inAppMessaging/providers/pinpoint/types/inputs.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/options.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +1 -1
- package/lib/inAppMessaging/providers/pinpoint/types/outputs.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/types.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/constants.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +1 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +2 -2
- package/lib/inAppMessaging/providers/pinpoint/utils/index.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +1 -4
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js +0 -1
- package/lib/inAppMessaging/sessionTracker/SessionTracker.js +7 -7
- package/lib/inAppMessaging/sessionTracker/SessionTracker.native.js +2 -3
- package/lib/inAppMessaging/sessionTracker/index.js +0 -1
- package/lib/inAppMessaging/sessionTracker/types.js +0 -1
- package/lib/inAppMessaging/types/event.js +0 -1
- package/lib/inAppMessaging/types/index.d.ts +1 -2
- package/lib/inAppMessaging/types/index.js +0 -1
- package/lib/inAppMessaging/types/inputs.d.ts +1 -3
- package/lib/inAppMessaging/types/inputs.js +0 -1
- package/lib/inAppMessaging/types/message.js +0 -1
- package/lib/inAppMessaging/types/options.d.ts +1 -1
- package/lib/inAppMessaging/types/options.js +0 -1
- package/lib/inAppMessaging/utils/index.js +0 -1
- package/lib/inAppMessaging/utils/statusHelpers.js +0 -1
- package/lib/index.d.ts +0 -4
- package/lib/index.js +0 -7
- package/lib/pushNotifications/Platform/index.js +0 -1
- package/lib/pushNotifications/Platform/index.native.js +0 -1
- package/lib/pushNotifications/Platform/types.js +0 -1
- package/lib/pushNotifications/errors/PushNotificationError.d.ts +4 -0
- package/lib/pushNotifications/errors/PushNotificationError.js +19 -0
- package/lib/pushNotifications/errors/errorHelpers.d.ts +8 -0
- package/lib/pushNotifications/errors/errorHelpers.js +30 -0
- package/lib/pushNotifications/errors/index.d.ts +2 -0
- package/lib/pushNotifications/errors/index.js +9 -0
- package/lib/pushNotifications/index.d.ts +3 -2
- package/lib/pushNotifications/index.js +12 -3
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.d.ts +14 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +20 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +10 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.d.ts +18 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +24 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +9 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.d.ts +27 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +33 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +9 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +53 -2
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +55 -5
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +38 -0
- package/lib/pushNotifications/providers/pinpoint/apis/index.d.ts +10 -0
- package/lib/pushNotifications/providers/pinpoint/apis/index.js +20 -1
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.d.ts +17 -0
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +23 -0
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -0
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +157 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.d.ts +27 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +33 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +8 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.d.ts +43 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +49 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +6 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.d.ts +27 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +33 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +6 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.d.ts +28 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +34 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +8 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.d.ts +32 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js +38 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +9 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.d.ts +14 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +20 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +7 -0
- package/lib/pushNotifications/providers/pinpoint/index.d.ts +3 -1
- package/lib/pushNotifications/providers/pinpoint/index.js +10 -1
- package/lib/pushNotifications/providers/pinpoint/types/analytics.d.ts +6 -0
- package/lib/{common/AWSPinpointProviderCommon/types.js → pushNotifications/providers/pinpoint/types/analytics.js} +0 -1
- package/lib/pushNotifications/providers/pinpoint/types/apis.d.ts +13 -0
- package/lib/{types.js → pushNotifications/providers/pinpoint/types/apis.js} +0 -1
- package/lib/pushNotifications/providers/pinpoint/types/index.d.ts +6 -0
- package/lib/pushNotifications/providers/{index.js → pinpoint/types/index.js} +0 -3
- package/lib/pushNotifications/providers/pinpoint/types/inputs.d.ts +9 -0
- package/lib/pushNotifications/providers/pinpoint/types/inputs.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/options.d.ts +5 -0
- package/lib/pushNotifications/providers/pinpoint/types/options.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/outputs.d.ts +9 -0
- package/lib/pushNotifications/providers/pinpoint/types/outputs.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +5 -0
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +60 -0
- package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +6 -0
- package/lib/pushNotifications/providers/{AWSPinpointProvider/utils.js → pinpoint/utils/getAnalyticsEvent.js} +8 -10
- package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +4 -0
- package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js +23 -0
- package/lib/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.js +11 -0
- package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +7 -0
- package/lib/pushNotifications/providers/pinpoint/utils/index.js +20 -0
- package/lib/pushNotifications/providers/pinpoint/utils/initializationManager.d.ts +12 -0
- package/lib/pushNotifications/providers/pinpoint/utils/initializationManager.js +23 -0
- package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
- package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.js +16 -0
- package/lib/pushNotifications/providers/pinpoint/utils/resolveCredentials.d.ts +7 -0
- package/lib/pushNotifications/providers/pinpoint/utils/resolveCredentials.js +22 -0
- package/lib/pushNotifications/providers/pinpoint/utils/tokenManager.d.ts +12 -0
- package/lib/pushNotifications/providers/pinpoint/utils/tokenManager.js +19 -0
- package/lib/pushNotifications/types/errors.d.ts +3 -0
- package/lib/pushNotifications/types/errors.js +8 -0
- package/lib/pushNotifications/types/index.d.ts +5 -0
- package/lib/pushNotifications/types/index.js +6 -0
- package/lib/pushNotifications/types/inputs.d.ts +23 -0
- package/lib/pushNotifications/types/inputs.js +4 -0
- package/lib/pushNotifications/types/options.d.ts +4 -0
- package/lib/pushNotifications/types/options.js +4 -0
- package/lib/pushNotifications/types/outputs.d.ts +10 -0
- package/lib/pushNotifications/types/outputs.js +4 -0
- package/lib/pushNotifications/types/pushNotifications.d.ts +5 -0
- package/lib/pushNotifications/types/pushNotifications.js +4 -0
- package/lib/tsconfig.build.tsbuildinfo +8684 -0
- package/lib-esm/{common/eventListeners/index.js → eventListeners/eventListeners.js} +0 -1
- package/lib-esm/eventListeners/index.d.ts +2 -0
- package/lib-esm/{common → eventListeners}/index.js +0 -2
- package/{lib/common → lib-esm}/eventListeners/types.d.ts +2 -2
- package/lib-esm/{common/AWSPinpointProviderCommon → eventListeners}/types.js +0 -1
- package/lib-esm/inAppMessaging/errors/InAppMessagingError.js +0 -1
- package/lib-esm/inAppMessaging/errors/assertServiceError.js +0 -1
- package/lib-esm/inAppMessaging/errors/assertValidationError.js +0 -1
- package/lib-esm/inAppMessaging/errors/index.js +0 -1
- package/lib-esm/inAppMessaging/errors/validation.d.ts +0 -1
- package/lib-esm/inAppMessaging/errors/validation.js +0 -5
- package/lib-esm/inAppMessaging/index.d.ts +1 -1
- package/lib-esm/inAppMessaging/index.js +0 -1
- package/lib-esm/inAppMessaging/providers/index.d.ts +2 -1
- package/lib-esm/inAppMessaging/providers/index.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +7 -11
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +1 -3
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +8 -19
- package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/index.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/index.d.ts +2 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js +0 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/options.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +2 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +1 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js +0 -1
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.js +8 -8
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.native.js +2 -3
- package/lib-esm/inAppMessaging/sessionTracker/index.js +0 -1
- package/lib-esm/inAppMessaging/sessionTracker/types.js +0 -1
- package/lib-esm/inAppMessaging/types/event.js +0 -1
- package/lib-esm/inAppMessaging/types/index.d.ts +1 -2
- package/lib-esm/inAppMessaging/types/index.js +0 -1
- package/lib-esm/inAppMessaging/types/inputs.d.ts +1 -3
- package/lib-esm/inAppMessaging/types/inputs.js +0 -1
- package/lib-esm/inAppMessaging/types/message.js +0 -1
- package/lib-esm/inAppMessaging/types/options.d.ts +1 -1
- package/lib-esm/inAppMessaging/types/options.js +0 -1
- package/lib-esm/inAppMessaging/utils/index.js +0 -1
- package/lib-esm/inAppMessaging/utils/statusHelpers.js +0 -1
- package/lib-esm/index.d.ts +0 -4
- package/lib-esm/index.js +0 -3
- package/lib-esm/pushNotifications/Platform/index.js +0 -1
- package/lib-esm/pushNotifications/Platform/index.native.js +0 -1
- package/lib-esm/pushNotifications/Platform/types.js +0 -1
- package/lib-esm/pushNotifications/errors/PushNotificationError.d.ts +4 -0
- package/lib-esm/pushNotifications/errors/PushNotificationError.js +17 -0
- package/lib-esm/pushNotifications/errors/errorHelpers.d.ts +8 -0
- package/lib-esm/pushNotifications/errors/errorHelpers.js +28 -0
- package/lib-esm/pushNotifications/errors/index.d.ts +2 -0
- package/lib-esm/pushNotifications/errors/index.js +4 -0
- package/lib-esm/pushNotifications/index.d.ts +3 -2
- package/lib-esm/pushNotifications/index.js +2 -3
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.d.ts +14 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +18 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +8 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.d.ts +18 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +22 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +7 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.d.ts +27 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +31 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +7 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +53 -2
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +55 -4
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +36 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/index.d.ts +10 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js +10 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.d.ts +17 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +21 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +155 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.d.ts +27 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +31 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +6 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.d.ts +43 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +47 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +4 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.d.ts +27 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +31 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +4 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.d.ts +28 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +32 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +6 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.d.ts +32 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js +36 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +7 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.d.ts +14 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +18 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +5 -0
- package/lib-esm/pushNotifications/providers/pinpoint/index.d.ts +3 -1
- package/lib-esm/pushNotifications/providers/pinpoint/index.js +1 -2
- package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.d.ts +6 -0
- package/lib-esm/{common/eventListeners/types.js → pushNotifications/providers/pinpoint/types/analytics.js} +0 -1
- package/lib-esm/pushNotifications/providers/pinpoint/types/apis.d.ts +13 -0
- package/lib-esm/{types.js → pushNotifications/providers/pinpoint/types/apis.js} +0 -1
- package/lib-esm/pushNotifications/providers/pinpoint/types/index.d.ts +6 -0
- package/{src/pushNotifications/providers/index.ts → lib-esm/pushNotifications/providers/pinpoint/types/index.js} +0 -2
- package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.d.ts +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/options.d.ts +5 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/options.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.d.ts +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +5 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +58 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +6 -0
- package/lib-esm/pushNotifications/providers/{AWSPinpointProvider/utils.js → pinpoint/utils/getAnalyticsEvent.js} +8 -10
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +4 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js +21 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.js +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +7 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/initializationManager.d.ts +12 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/initializationManager.js +21 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveConfig.js +14 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveCredentials.d.ts +7 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveCredentials.js +20 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/tokenManager.d.ts +12 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/tokenManager.js +17 -0
- package/lib-esm/pushNotifications/types/errors.d.ts +3 -0
- package/lib-esm/pushNotifications/types/errors.js +6 -0
- package/lib-esm/pushNotifications/types/index.d.ts +5 -0
- package/lib-esm/pushNotifications/types/index.js +3 -0
- package/lib-esm/pushNotifications/types/inputs.d.ts +23 -0
- package/lib-esm/pushNotifications/types/inputs.js +2 -0
- package/lib-esm/pushNotifications/types/options.d.ts +4 -0
- package/lib-esm/pushNotifications/types/options.js +2 -0
- package/lib-esm/pushNotifications/types/outputs.d.ts +10 -0
- package/lib-esm/pushNotifications/types/outputs.js +2 -0
- package/lib-esm/pushNotifications/types/pushNotifications.d.ts +5 -0
- package/lib-esm/pushNotifications/types/pushNotifications.js +2 -0
- package/lib-esm/tsconfig.build.tsbuildinfo +7085 -0
- package/package.json +15 -13
- package/push-notifications/package.json +7 -0
- package/push-notifications/pinpoint/package.json +7 -0
- package/src/{common → eventListeners}/index.ts +1 -6
- package/src/{common/eventListeners → eventListeners}/types.ts +2 -2
- package/src/inAppMessaging/errors/validation.ts +0 -4
- package/src/inAppMessaging/index.ts +12 -0
- package/src/inAppMessaging/providers/index.ts +24 -1
- package/src/inAppMessaging/providers/pinpoint/apis/dispatchEvent.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts +7 -6
- package/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts +1 -2
- package/src/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/apis/onMessageReceived.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/apis/syncMessages.ts +12 -29
- package/src/inAppMessaging/providers/pinpoint/index.ts +15 -0
- package/src/inAppMessaging/providers/pinpoint/types/index.ts +11 -1
- package/src/inAppMessaging/providers/pinpoint/types/outputs.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/utils/helpers.ts +1 -1
- package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +1 -3
- package/src/inAppMessaging/sessionTracker/SessionTracker.native.ts +2 -2
- package/src/inAppMessaging/sessionTracker/SessionTracker.ts +8 -10
- package/src/inAppMessaging/types/index.ts +3 -1
- package/src/inAppMessaging/types/inputs.ts +1 -3
- package/src/inAppMessaging/types/options.ts +1 -1
- package/src/index.ts +0 -9
- package/src/pushNotifications/errors/PushNotificationError.ts +18 -0
- package/src/pushNotifications/errors/errorHelpers.ts +40 -0
- package/src/pushNotifications/errors/index.ts +5 -0
- package/src/pushNotifications/index.ts +27 -5
- package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.ts +9 -0
- package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.ts +21 -0
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +11 -0
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.ts +26 -0
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +11 -0
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.ts +34 -0
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +38 -0
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +58 -7
- package/src/pushNotifications/providers/pinpoint/apis/index.ts +10 -0
- package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +197 -0
- package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.ts +24 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.ts +8 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.ts +39 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.ts +8 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.ts +56 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.ts +8 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.ts +40 -0
- package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.ts +8 -0
- package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.ts +39 -0
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +11 -0
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.ts +39 -0
- package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.ts +9 -0
- package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.ts +21 -0
- package/src/pushNotifications/providers/pinpoint/index.ts +30 -1
- package/src/pushNotifications/providers/pinpoint/types/analytics.ts +14 -0
- package/src/pushNotifications/providers/pinpoint/types/apis.ts +54 -0
- package/src/pushNotifications/providers/pinpoint/types/index.ts +40 -0
- package/src/pushNotifications/providers/pinpoint/types/inputs.ts +31 -0
- package/src/pushNotifications/providers/pinpoint/types/options.ts +9 -0
- package/src/pushNotifications/providers/pinpoint/types/outputs.ts +34 -0
- package/src/pushNotifications/providers/pinpoint/types/pushNotifications.ts +6 -0
- package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +66 -0
- package/src/pushNotifications/providers/{AWSPinpointProvider/utils.ts → pinpoint/utils/getAnalyticsEvent.ts} +19 -21
- package/src/pushNotifications/providers/pinpoint/utils/getChannelType.ts +25 -0
- package/src/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.ts +15 -0
- package/src/pushNotifications/providers/pinpoint/utils/index.ts +10 -0
- package/src/pushNotifications/providers/pinpoint/utils/initializationManager.ts +20 -0
- package/src/pushNotifications/providers/pinpoint/utils/resolveConfig.ts +16 -0
- package/src/pushNotifications/providers/pinpoint/utils/resolveCredentials.ts +14 -0
- package/src/pushNotifications/providers/pinpoint/utils/tokenManager.ts +20 -0
- package/src/pushNotifications/types/errors.ts +6 -0
- package/src/pushNotifications/types/index.ts +8 -0
- package/src/pushNotifications/types/inputs.ts +45 -0
- package/src/pushNotifications/types/options.ts +7 -0
- package/src/pushNotifications/types/outputs.ts +28 -0
- package/src/pushNotifications/types/pushNotifications.ts +22 -0
- package/lib/.tsbuildinfo +0 -3
- package/lib/common/AWSPinpointProviderCommon/index.d.ts +0 -39
- package/lib/common/AWSPinpointProviderCommon/index.js +0 -289
- package/lib/common/AWSPinpointProviderCommon/index.js.map +0 -1
- package/lib/common/AWSPinpointProviderCommon/types.d.ts +0 -10
- package/lib/common/AWSPinpointProviderCommon/types.js.map +0 -1
- package/lib/common/eventListeners/index.js.map +0 -1
- package/lib/common/eventListeners/types.js.map +0 -1
- package/lib/common/index.d.ts +0 -3
- package/lib/common/index.js.map +0 -1
- package/lib/inAppMessaging/errors/InAppMessagingError.js.map +0 -1
- package/lib/inAppMessaging/errors/assertServiceError.js.map +0 -1
- package/lib/inAppMessaging/errors/assertValidationError.js.map +0 -1
- package/lib/inAppMessaging/errors/index.js.map +0 -1
- package/lib/inAppMessaging/errors/validation.js.map +0 -1
- package/lib/inAppMessaging/index.js.map +0 -1
- package/lib/inAppMessaging/providers/index.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/index.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/index.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/errors.d.ts +0 -9
- package/lib/inAppMessaging/providers/pinpoint/types/errors.js +0 -15
- package/lib/inAppMessaging/providers/pinpoint/types/errors.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/index.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/inputs.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/options.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/outputs.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/types.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/constants.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/index.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js.map +0 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js.map +0 -1
- package/lib/inAppMessaging/sessionTracker/SessionTracker.js.map +0 -1
- package/lib/inAppMessaging/sessionTracker/SessionTracker.native.js.map +0 -1
- package/lib/inAppMessaging/sessionTracker/index.js.map +0 -1
- package/lib/inAppMessaging/sessionTracker/types.js.map +0 -1
- package/lib/inAppMessaging/types/config.d.ts +0 -5
- package/lib/inAppMessaging/types/config.js +0 -3
- package/lib/inAppMessaging/types/config.js.map +0 -1
- package/lib/inAppMessaging/types/event.js.map +0 -1
- package/lib/inAppMessaging/types/index.js.map +0 -1
- package/lib/inAppMessaging/types/inputs.js.map +0 -1
- package/lib/inAppMessaging/types/message.js.map +0 -1
- package/lib/inAppMessaging/types/options.js.map +0 -1
- package/lib/inAppMessaging/utils/index.js.map +0 -1
- package/lib/inAppMessaging/utils/statusHelpers.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/pushNotifications/NotEnabledError.d.ts +0 -3
- package/lib/pushNotifications/NotEnabledError.js +0 -16
- package/lib/pushNotifications/NotEnabledError.js.map +0 -1
- package/lib/pushNotifications/Platform/index.js.map +0 -1
- package/lib/pushNotifications/Platform/index.native.js.map +0 -1
- package/lib/pushNotifications/Platform/types.js.map +0 -1
- package/lib/pushNotifications/PlatformNotSupportedError.d.ts +0 -3
- package/lib/pushNotifications/PlatformNotSupportedError.js +0 -16
- package/lib/pushNotifications/PlatformNotSupportedError.js.map +0 -1
- package/lib/pushNotifications/index.js.map +0 -1
- package/lib/pushNotifications/providers/AWSPinpointProvider/index.d.ts +0 -15
- package/lib/pushNotifications/providers/AWSPinpointProvider/index.js +0 -65
- package/lib/pushNotifications/providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib/pushNotifications/providers/AWSPinpointProvider/types.d.ts +0 -9
- package/lib/pushNotifications/providers/AWSPinpointProvider/types.js +0 -16
- package/lib/pushNotifications/providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib/pushNotifications/providers/AWSPinpointProvider/utils.d.ts +0 -6
- package/lib/pushNotifications/providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib/pushNotifications/providers/index.d.ts +0 -1
- package/lib/pushNotifications/providers/index.js.map +0 -1
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js.map +0 -1
- package/lib/pushNotifications/providers/pinpoint/apis/index.js.map +0 -1
- package/lib/pushNotifications/providers/pinpoint/index.js.map +0 -1
- package/lib/pushNotifications/types.d.ts +0 -71
- package/lib/pushNotifications/types.js +0 -12
- package/lib/pushNotifications/types.js.map +0 -1
- package/lib/pushNotifications/utils.d.ts +0 -3
- package/lib/pushNotifications/utils.js +0 -81
- package/lib/pushNotifications/utils.js.map +0 -1
- package/lib/types.d.ts +0 -39
- package/lib/types.js.map +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
- package/lib-esm/common/AWSPinpointProviderCommon/index.d.ts +0 -39
- package/lib-esm/common/AWSPinpointProviderCommon/index.js +0 -287
- package/lib-esm/common/AWSPinpointProviderCommon/index.js.map +0 -1
- package/lib-esm/common/AWSPinpointProviderCommon/types.d.ts +0 -10
- package/lib-esm/common/AWSPinpointProviderCommon/types.js.map +0 -1
- package/lib-esm/common/eventListeners/index.js.map +0 -1
- package/lib-esm/common/eventListeners/types.js.map +0 -1
- package/lib-esm/common/index.d.ts +0 -3
- package/lib-esm/common/index.js.map +0 -1
- package/lib-esm/inAppMessaging/errors/InAppMessagingError.js.map +0 -1
- package/lib-esm/inAppMessaging/errors/assertServiceError.js.map +0 -1
- package/lib-esm/inAppMessaging/errors/assertValidationError.js.map +0 -1
- package/lib-esm/inAppMessaging/errors/index.js.map +0 -1
- package/lib-esm/inAppMessaging/errors/validation.js.map +0 -1
- package/lib-esm/inAppMessaging/index.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/index.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/index.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/errors.d.ts +0 -9
- package/lib-esm/inAppMessaging/providers/pinpoint/types/errors.js +0 -13
- package/lib-esm/inAppMessaging/providers/pinpoint/types/errors.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/options.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js.map +0 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js.map +0 -1
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.js.map +0 -1
- package/lib-esm/inAppMessaging/sessionTracker/SessionTracker.native.js.map +0 -1
- package/lib-esm/inAppMessaging/sessionTracker/index.js.map +0 -1
- package/lib-esm/inAppMessaging/sessionTracker/types.js.map +0 -1
- package/lib-esm/inAppMessaging/types/config.d.ts +0 -5
- package/lib-esm/inAppMessaging/types/config.js +0 -1
- package/lib-esm/inAppMessaging/types/config.js.map +0 -1
- package/lib-esm/inAppMessaging/types/event.js.map +0 -1
- package/lib-esm/inAppMessaging/types/index.js.map +0 -1
- package/lib-esm/inAppMessaging/types/inputs.js.map +0 -1
- package/lib-esm/inAppMessaging/types/message.js.map +0 -1
- package/lib-esm/inAppMessaging/types/options.js.map +0 -1
- package/lib-esm/inAppMessaging/utils/index.js.map +0 -1
- package/lib-esm/inAppMessaging/utils/statusHelpers.js.map +0 -1
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/pushNotifications/NotEnabledError.d.ts +0 -3
- package/lib-esm/pushNotifications/NotEnabledError.js +0 -14
- package/lib-esm/pushNotifications/NotEnabledError.js.map +0 -1
- package/lib-esm/pushNotifications/Platform/index.js.map +0 -1
- package/lib-esm/pushNotifications/Platform/index.native.js.map +0 -1
- package/lib-esm/pushNotifications/Platform/types.js.map +0 -1
- package/lib-esm/pushNotifications/PlatformNotSupportedError.d.ts +0 -3
- package/lib-esm/pushNotifications/PlatformNotSupportedError.js +0 -14
- package/lib-esm/pushNotifications/PlatformNotSupportedError.js.map +0 -1
- package/lib-esm/pushNotifications/index.js.map +0 -1
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/index.d.ts +0 -15
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/index.js +0 -63
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/types.d.ts +0 -9
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/types.js +0 -14
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/utils.d.ts +0 -6
- package/lib-esm/pushNotifications/providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib-esm/pushNotifications/providers/index.d.ts +0 -1
- package/lib-esm/pushNotifications/providers/index.js +0 -4
- package/lib-esm/pushNotifications/providers/index.js.map +0 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js.map +0 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js.map +0 -1
- package/lib-esm/pushNotifications/providers/pinpoint/index.js.map +0 -1
- package/lib-esm/pushNotifications/types.d.ts +0 -71
- package/lib-esm/pushNotifications/types.js +0 -10
- package/lib-esm/pushNotifications/types.js.map +0 -1
- package/lib-esm/pushNotifications/utils.d.ts +0 -3
- package/lib-esm/pushNotifications/utils.js +0 -79
- package/lib-esm/pushNotifications/utils.js.map +0 -1
- package/lib-esm/types.d.ts +0 -39
- package/lib-esm/types.js.map +0 -1
- package/src/common/AWSPinpointProviderCommon/index.ts +0 -300
- package/src/common/AWSPinpointProviderCommon/types.ts +0 -29
- package/src/inAppMessaging/providers/pinpoint/types/errors.ts +0 -12
- package/src/inAppMessaging/types/config.ts +0 -8
- package/src/pushNotifications/NotEnabledError.ts +0 -11
- package/src/pushNotifications/PlatformNotSupportedError.ts +0 -9
- package/src/pushNotifications/providers/AWSPinpointProvider/index.ts +0 -93
- package/src/pushNotifications/providers/AWSPinpointProvider/types.ts +0 -13
- package/src/pushNotifications/types.ts +0 -114
- package/src/pushNotifications/utils.ts +0 -112
- package/src/types.ts +0 -56
- /package/lib/{common/eventListeners/index.d.ts → eventListeners/eventListeners.d.ts} +0 -0
- /package/lib-esm/{common/eventListeners/index.d.ts → eventListeners/eventListeners.d.ts} +0 -0
- /package/src/{common/eventListeners/index.ts → eventListeners/eventListeners.ts} +0 -0
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
export { identifyUser } from './providers/pinpoint';
|
|
5
4
|
export {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
getBadgeCount,
|
|
6
|
+
getLaunchNotification,
|
|
7
|
+
GetLaunchNotificationOutput,
|
|
8
|
+
getPermissionStatus,
|
|
9
|
+
GetPermissionStatusOutput,
|
|
10
|
+
identifyUser,
|
|
11
|
+
IdentifyUserInput,
|
|
12
|
+
initializePushNotifications,
|
|
13
|
+
onNotificationOpened,
|
|
14
|
+
OnNotificationOpenedInput,
|
|
15
|
+
OnNotificationOpenedOutput,
|
|
16
|
+
onNotificationReceivedInBackground,
|
|
17
|
+
OnNotificationReceivedInBackgroundInput,
|
|
18
|
+
OnNotificationReceivedInBackgroundOutput,
|
|
19
|
+
onNotificationReceivedInForeground,
|
|
20
|
+
OnNotificationReceivedInForegroundInput,
|
|
21
|
+
OnNotificationReceivedInForegroundOutput,
|
|
22
|
+
onTokenReceived,
|
|
23
|
+
OnTokenReceivedInput,
|
|
24
|
+
OnTokenReceivedOutput,
|
|
25
|
+
requestPermissions,
|
|
26
|
+
RequestPermissionsInput,
|
|
27
|
+
setBadgeCount,
|
|
28
|
+
SetBadgeCountInput,
|
|
29
|
+
} from './providers/pinpoint';
|
|
30
|
+
export { PushNotificationMessage } from './types';
|
|
31
|
+
export { PushNotificationError } from './errors';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
|
|
5
|
+
import { GetBadgeCount } from '../types';
|
|
6
|
+
|
|
7
|
+
const { getBadgeCount: getBadgeCountNative } = loadAmplifyPushNotification();
|
|
8
|
+
|
|
9
|
+
export const getBadgeCount: GetBadgeCount = async () => getBadgeCountNative();
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
import { GetBadgeCount } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns the current badge count (the number next to your app's icon). This function is safe to call (but will be
|
|
9
|
+
* ignored) even when your React Native app is running on platforms where badges are not supported.
|
|
10
|
+
*
|
|
11
|
+
* @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
|
|
12
|
+
* only React Native is supported by this API.
|
|
13
|
+
* @returns A promise that resolves to a number representing the current count displayed on the app badge.
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const badgeCount = await getBadgeCount();
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export const getBadgeCount: GetBadgeCount = () => {
|
|
20
|
+
throw new PlatformNotSupportedError();
|
|
21
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
|
|
5
|
+
import { GetLaunchNotification } from '../types';
|
|
6
|
+
|
|
7
|
+
const { getLaunchNotification: getLaunchNotificationNative } =
|
|
8
|
+
loadAmplifyPushNotification();
|
|
9
|
+
|
|
10
|
+
export const getLaunchNotification: GetLaunchNotification = () =>
|
|
11
|
+
getLaunchNotificationNative();
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
import { PushNotificationMessage } from '../../../types';
|
|
6
|
+
import { GetLaunchNotification, GetLaunchNotificationOutput } from '../types';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Returns the notification which launched your app from a terminated state. The launch notification is consumed by
|
|
10
|
+
* calls to this function and will yield a null result if:
|
|
11
|
+
* 1. It is more than once (i.e. subsequent calls will be null)
|
|
12
|
+
* 2. Another notification was opened while your app was running (either in foreground or background)
|
|
13
|
+
* 3. Your app was brought back to the foreground by some other means (e.g. user tapped the app icon)
|
|
14
|
+
*
|
|
15
|
+
* @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
|
|
16
|
+
* only React Native is supported by this API.
|
|
17
|
+
* @returns {Promise<GetLaunchNotificationOutput>} - a promise resolving to {@link PushNotificationMessage} if there is
|
|
18
|
+
* a launch notification and `null` otherwise.
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const launchNotification = await getLaunchNotification();
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export const getLaunchNotification: GetLaunchNotification = () => {
|
|
25
|
+
throw new PlatformNotSupportedError();
|
|
26
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
|
|
5
|
+
import { GetPermissionStatus } from '../types';
|
|
6
|
+
|
|
7
|
+
const { getPermissionStatus: getPermissionStatusNative } =
|
|
8
|
+
loadAmplifyPushNotification();
|
|
9
|
+
|
|
10
|
+
export const getPermissionStatus: GetPermissionStatus = () =>
|
|
11
|
+
getPermissionStatusNative();
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
import { GetPermissionStatus, GetPermissionStatusOutput } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Returns a string representing the current status of user permissions to display push notifications. The possible
|
|
9
|
+
* statuses are as follows:
|
|
10
|
+
*
|
|
11
|
+
* * `'shouldRequest'` - No permissions have been requested yet. It is idiomatic at this time to simply request for
|
|
12
|
+
* permissions from the user.
|
|
13
|
+
*
|
|
14
|
+
* * `'shouldExplainThenRequest'` - It is recommended at this time to provide some context or rationale to the user
|
|
15
|
+
* explaining why you want to send them push notifications before requesting for permissions.
|
|
16
|
+
*
|
|
17
|
+
* * `'granted'` - Permissions have been granted by the user. No further actions are needed and their app is ready to
|
|
18
|
+
* display notifications.
|
|
19
|
+
*
|
|
20
|
+
* * `'denied'` - Permissions have been denied by the user. Further attempts to request permissions will no longer
|
|
21
|
+
* trigger a permission dialog. Your app should now either degrade gracefully or prompt your user to grant the
|
|
22
|
+
* permissions needed in their device settings.
|
|
23
|
+
*
|
|
24
|
+
* @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
|
|
25
|
+
* only React Native is supported by this API.
|
|
26
|
+
* @return {Promise<GetPermissionStatusOutput>} a promise resolving to a string representing the current status of user
|
|
27
|
+
* selected notification permissions.
|
|
28
|
+
* @example
|
|
29
|
+
* ```ts
|
|
30
|
+
* const permissionStatus = await getPermissionStatus();
|
|
31
|
+
*/
|
|
32
|
+
export const getPermissionStatus: GetPermissionStatus = () => {
|
|
33
|
+
throw new PlatformNotSupportedError();
|
|
34
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PushNotificationAction } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
6
|
+
import {
|
|
7
|
+
getChannelType,
|
|
8
|
+
getPushNotificationUserAgentString,
|
|
9
|
+
resolveConfig,
|
|
10
|
+
resolveCredentials,
|
|
11
|
+
} from '../utils';
|
|
12
|
+
import { IdentifyUser } from '../types';
|
|
13
|
+
|
|
14
|
+
export const identifyUser: IdentifyUser = async ({
|
|
15
|
+
userId,
|
|
16
|
+
userProfile,
|
|
17
|
+
options,
|
|
18
|
+
}) => {
|
|
19
|
+
const { credentials, identityId } = await resolveCredentials();
|
|
20
|
+
const { appId, region } = resolveConfig();
|
|
21
|
+
const { address, optOut, userAttributes } = options ?? {};
|
|
22
|
+
updateEndpoint({
|
|
23
|
+
address,
|
|
24
|
+
channelType: getChannelType(),
|
|
25
|
+
optOut,
|
|
26
|
+
appId,
|
|
27
|
+
category: 'PushNotification',
|
|
28
|
+
credentials,
|
|
29
|
+
identityId,
|
|
30
|
+
region,
|
|
31
|
+
userAttributes,
|
|
32
|
+
userId,
|
|
33
|
+
userProfile,
|
|
34
|
+
userAgentValue: getPushNotificationUserAgentString(
|
|
35
|
+
PushNotificationAction.IdentifyUser
|
|
36
|
+
),
|
|
37
|
+
});
|
|
38
|
+
};
|
|
@@ -1,11 +1,62 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { UpdateEndpointException } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
5
|
+
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
6
|
+
import { PushNotificationValidationErrorCode } from '../../../errors';
|
|
7
|
+
import { IdentifyUser, IdentifyUserInput } from '../types';
|
|
5
8
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
9
|
+
/**
|
|
10
|
+
* Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
|
|
11
|
+
* profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
|
|
12
|
+
* the same `userId`.
|
|
13
|
+
*
|
|
14
|
+
* @param {IdentifyUserInput} input The input object used to construct requests sent to Pinpoint's UpdateEndpoint
|
|
15
|
+
* API.
|
|
16
|
+
* @throws service: {@link UpdateEndpointException} - Thrown when the underlying Pinpoint service returns an error.
|
|
17
|
+
* @throws validation: {@link PushNotificationValidationErrorCode} - Thrown when the provided parameters or library
|
|
18
|
+
* configuration is incorrect.
|
|
19
|
+
* @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
|
|
20
|
+
* only React Native is supported by this API.
|
|
21
|
+
* @returns A promise that will resolve when the operation is complete.
|
|
22
|
+
* @example
|
|
23
|
+
* ```ts
|
|
24
|
+
* // Identify a user with Pinpoint
|
|
25
|
+
* await identifyUser({
|
|
26
|
+
* userId,
|
|
27
|
+
* userProfile: {
|
|
28
|
+
* email: 'userEmail@example.com'
|
|
29
|
+
* customProperties: {
|
|
30
|
+
* phoneNumber: ['555-555-5555'],
|
|
31
|
+
* },
|
|
32
|
+
* }
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
38
|
+
* // Identify a user with Pinpoint specific options
|
|
39
|
+
* await identifyUser({
|
|
40
|
+
* userId,
|
|
41
|
+
* userProfile: {
|
|
42
|
+
* email: 'userEmail@example.com'
|
|
43
|
+
* customProperties: {
|
|
44
|
+
* phoneNumber: ['555-555-5555'],
|
|
45
|
+
* },
|
|
46
|
+
* demographic: {
|
|
47
|
+
* platform: 'ios',
|
|
48
|
+
* timezone: 'America/Los_Angeles'
|
|
49
|
+
* }
|
|
50
|
+
* },
|
|
51
|
+
* options: {
|
|
52
|
+
* address: 'device-address',
|
|
53
|
+
* optOut: 'NONE',
|
|
54
|
+
* userAttributes: {
|
|
55
|
+
* interests: ['food']
|
|
56
|
+
* },
|
|
57
|
+
* },
|
|
58
|
+
* });
|
|
59
|
+
*/
|
|
60
|
+
export const identifyUser: IdentifyUser = () => {
|
|
61
|
+
throw new PlatformNotSupportedError();
|
|
62
|
+
};
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
|
|
4
|
+
export { getBadgeCount } from './getBadgeCount';
|
|
5
|
+
export { getLaunchNotification } from './getLaunchNotification';
|
|
6
|
+
export { getPermissionStatus } from './getPermissionStatus';
|
|
4
7
|
export { identifyUser } from './identifyUser';
|
|
8
|
+
export { initializePushNotifications } from './initializePushNotifications';
|
|
9
|
+
export { onNotificationOpened } from './onNotificationOpened';
|
|
10
|
+
export { onNotificationReceivedInBackground } from './onNotificationReceivedInBackground';
|
|
11
|
+
export { onNotificationReceivedInForeground } from './onNotificationReceivedInForeground';
|
|
12
|
+
export { onTokenReceived } from './onTokenReceived';
|
|
13
|
+
export { requestPermissions } from './requestPermissions';
|
|
14
|
+
export { setBadgeCount } from './setBadgeCount';
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { ConsoleLogger } from '@aws-amplify/core';
|
|
5
|
+
import { PushNotificationAction } from '@aws-amplify/core/internals/utils';
|
|
6
|
+
import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
7
|
+
import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
|
|
8
|
+
import {
|
|
9
|
+
EventListenerRemover,
|
|
10
|
+
addEventListener,
|
|
11
|
+
notifyEventListeners,
|
|
12
|
+
notifyEventListenersAndAwaitHandlers,
|
|
13
|
+
} from '../../../../eventListeners';
|
|
14
|
+
import {
|
|
15
|
+
createMessageEventRecorder,
|
|
16
|
+
getChannelType,
|
|
17
|
+
getPushNotificationUserAgentString,
|
|
18
|
+
getToken,
|
|
19
|
+
initialize,
|
|
20
|
+
isInitialized,
|
|
21
|
+
resolveConfig,
|
|
22
|
+
resolveCredentials,
|
|
23
|
+
setToken,
|
|
24
|
+
} from '../utils';
|
|
25
|
+
|
|
26
|
+
const {
|
|
27
|
+
addMessageEventListener,
|
|
28
|
+
addTokenEventListener,
|
|
29
|
+
completeNotification,
|
|
30
|
+
getConstants,
|
|
31
|
+
registerHeadlessTask,
|
|
32
|
+
} = loadAmplifyPushNotification();
|
|
33
|
+
|
|
34
|
+
const logger = new ConsoleLogger('Notifications.PushNotification');
|
|
35
|
+
|
|
36
|
+
const BACKGROUND_TASK_TIMEOUT = 25; // seconds
|
|
37
|
+
|
|
38
|
+
export const initializePushNotifications = (): Promise<void> => {
|
|
39
|
+
if (isInitialized()) {
|
|
40
|
+
logger.info('Push notifications have already been enabled');
|
|
41
|
+
return;
|
|
42
|
+
}
|
|
43
|
+
addNativeListeners();
|
|
44
|
+
addAnalyticsListeners();
|
|
45
|
+
initialize();
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
const addAnalyticsListeners = (): void => {
|
|
49
|
+
let launchNotificationOpenedListenerRemover: EventListenerRemover;
|
|
50
|
+
|
|
51
|
+
// wire up default Pinpoint message event handling
|
|
52
|
+
addEventListener(
|
|
53
|
+
'backgroundMessageReceived',
|
|
54
|
+
createMessageEventRecorder('backgroundMessageReceived')
|
|
55
|
+
);
|
|
56
|
+
addEventListener(
|
|
57
|
+
'foregroundMessageReceived',
|
|
58
|
+
createMessageEventRecorder('foregroundMessageReceived')
|
|
59
|
+
);
|
|
60
|
+
launchNotificationOpenedListenerRemover = addEventListener(
|
|
61
|
+
'launchNotificationsOpened',
|
|
62
|
+
createMessageEventRecorder(
|
|
63
|
+
'notificationOpened',
|
|
64
|
+
// once we are done with it we can remove the listener
|
|
65
|
+
launchNotificationOpenedListenerRemover?.remove
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
addEventListener(
|
|
69
|
+
'notificationOpened',
|
|
70
|
+
createMessageEventRecorder(
|
|
71
|
+
'notificationOpened',
|
|
72
|
+
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
73
|
+
launchNotificationOpenedListenerRemover?.remove
|
|
74
|
+
)
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const addNativeListeners = (): void => {
|
|
79
|
+
const { NativeEvent, NativeHeadlessTaskKey } = getConstants();
|
|
80
|
+
const {
|
|
81
|
+
BACKGROUND_MESSAGE_RECEIVED,
|
|
82
|
+
FOREGROUND_MESSAGE_RECEIVED,
|
|
83
|
+
LAUNCH_NOTIFICATION_OPENED,
|
|
84
|
+
NOTIFICATION_OPENED,
|
|
85
|
+
TOKEN_RECEIVED,
|
|
86
|
+
} = NativeEvent;
|
|
87
|
+
// on platforms that can handle headless tasks, register one to broadcast background message received to
|
|
88
|
+
// library listeners
|
|
89
|
+
if (NativeHeadlessTaskKey) {
|
|
90
|
+
registerHeadlessTask(async message => {
|
|
91
|
+
// keep headless task running until handlers have completed their work
|
|
92
|
+
await notifyEventListenersAndAwaitHandlers(
|
|
93
|
+
'backgroundMessageReceived',
|
|
94
|
+
message
|
|
95
|
+
);
|
|
96
|
+
});
|
|
97
|
+
} else if (BACKGROUND_MESSAGE_RECEIVED) {
|
|
98
|
+
// on platforms that can't handle headless tasks, listen for native background message received event and
|
|
99
|
+
// broadcast to library listeners
|
|
100
|
+
addMessageEventListener(
|
|
101
|
+
BACKGROUND_MESSAGE_RECEIVED,
|
|
102
|
+
async (message, completionHandlerId) => {
|
|
103
|
+
// keep background task running until handlers have completed their work
|
|
104
|
+
try {
|
|
105
|
+
await Promise.race([
|
|
106
|
+
notifyEventListenersAndAwaitHandlers(
|
|
107
|
+
'backgroundMessageReceived',
|
|
108
|
+
message
|
|
109
|
+
),
|
|
110
|
+
// background tasks will get suspended and all future tasks be deprioritized by the OS if they run for
|
|
111
|
+
// more than 30 seconds so we reject with a error in a shorter amount of time to prevent this from
|
|
112
|
+
// happening
|
|
113
|
+
new Promise((_, reject) => {
|
|
114
|
+
setTimeout(
|
|
115
|
+
() =>
|
|
116
|
+
reject(
|
|
117
|
+
`onNotificationReceivedInBackground handlers should complete their work within ${BACKGROUND_TASK_TIMEOUT} seconds, but they did not.`
|
|
118
|
+
),
|
|
119
|
+
BACKGROUND_TASK_TIMEOUT * 1000
|
|
120
|
+
);
|
|
121
|
+
}),
|
|
122
|
+
]);
|
|
123
|
+
} catch (err) {
|
|
124
|
+
logger.error(err);
|
|
125
|
+
} finally {
|
|
126
|
+
// notify native module that handlers have completed their work (or timed out)
|
|
127
|
+
completeNotification(completionHandlerId);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
addMessageEventListener(
|
|
134
|
+
// listen for native foreground message received event and broadcast to library listeners
|
|
135
|
+
FOREGROUND_MESSAGE_RECEIVED,
|
|
136
|
+
message => {
|
|
137
|
+
notifyEventListeners('foregroundMessageReceived', message);
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
|
|
141
|
+
const launchNotificationOpenedListener = LAUNCH_NOTIFICATION_OPENED
|
|
142
|
+
? addMessageEventListener(
|
|
143
|
+
// listen for native notification opened app (user tapped on notification, opening the app from quit -
|
|
144
|
+
// not background - state) event. This is broadcasted to an internal listener only as it is not intended
|
|
145
|
+
// for use otherwise as it produces inconsistent results when used within React Native app context
|
|
146
|
+
LAUNCH_NOTIFICATION_OPENED,
|
|
147
|
+
message => {
|
|
148
|
+
notifyEventListeners('launchNotificationsOpened', message);
|
|
149
|
+
// once we are done with it we can remove the listener
|
|
150
|
+
launchNotificationOpenedListener?.remove();
|
|
151
|
+
}
|
|
152
|
+
)
|
|
153
|
+
: null;
|
|
154
|
+
|
|
155
|
+
addMessageEventListener(
|
|
156
|
+
// listen for native notification opened (user tapped on notification, opening the app from background -
|
|
157
|
+
// not quit - state) event and broadcast to library listeners
|
|
158
|
+
NOTIFICATION_OPENED,
|
|
159
|
+
message => {
|
|
160
|
+
notifyEventListeners('notificationOpened', message);
|
|
161
|
+
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
162
|
+
launchNotificationOpenedListener?.remove();
|
|
163
|
+
}
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
addTokenEventListener(
|
|
167
|
+
// listen for native new token event, automatically re-register device with provider using new token and
|
|
168
|
+
// broadcast to library listeners
|
|
169
|
+
TOKEN_RECEIVED,
|
|
170
|
+
token => {
|
|
171
|
+
// avoid a race condition where two endpoints are created with the same token on a fresh install
|
|
172
|
+
if (getToken() === token) {
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
setToken(token);
|
|
176
|
+
registerDevice();
|
|
177
|
+
notifyEventListeners('tokenReceived', token);
|
|
178
|
+
}
|
|
179
|
+
);
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const registerDevice = async (): Promise<void> => {
|
|
183
|
+
const { credentials, identityId } = await resolveCredentials();
|
|
184
|
+
const { appId, region } = resolveConfig();
|
|
185
|
+
return updateEndpoint({
|
|
186
|
+
address: getToken(),
|
|
187
|
+
appId,
|
|
188
|
+
category: 'PushNotification',
|
|
189
|
+
credentials,
|
|
190
|
+
region,
|
|
191
|
+
channelType: getChannelType(),
|
|
192
|
+
identityId,
|
|
193
|
+
userAgentValue: getPushNotificationUserAgentString(
|
|
194
|
+
PushNotificationAction.InitializePushNotifications
|
|
195
|
+
),
|
|
196
|
+
});
|
|
197
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
import { InitializePushNotifications } from '../types';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Initialize and set up the push notification category. The category must be first initialized before all other
|
|
9
|
+
* functionalities become available.
|
|
10
|
+
*
|
|
11
|
+
* @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
|
|
12
|
+
* only React Native is supported by this API.
|
|
13
|
+
* @remarks
|
|
14
|
+
* It is recommended that this be called as early in your app as possible at the root of your application to allow
|
|
15
|
+
* background processing of notifications.
|
|
16
|
+
* @example
|
|
17
|
+
* ```ts
|
|
18
|
+
* Amplify.configure(config);
|
|
19
|
+
* initializePushNotifications();
|
|
20
|
+
* ```
|
|
21
|
+
*/
|
|
22
|
+
export const initializePushNotifications: InitializePushNotifications = () => {
|
|
23
|
+
throw new PlatformNotSupportedError();
|
|
24
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { addEventListener } from '../../../../eventListeners';
|
|
5
|
+
import { OnNotificationOpened } from '../types';
|
|
6
|
+
|
|
7
|
+
export const onNotificationOpened: OnNotificationOpened = input =>
|
|
8
|
+
addEventListener('notificationOpened', input);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
import { PushNotificationMessage } from '../../../types';
|
|
6
|
+
import {
|
|
7
|
+
OnNotificationOpened,
|
|
8
|
+
OnNotificationOpenedInput,
|
|
9
|
+
OnNotificationOpenedOutput,
|
|
10
|
+
} from '../types';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Registers a listener that will be triggered when a notification is opened by user.
|
|
14
|
+
*
|
|
15
|
+
* @param {OnNotificationOpenedInput} input - A callback handler to be invoked with the opened
|
|
16
|
+
* {@link PushNotificationMessage}.
|
|
17
|
+
* @returns {OnNotificationOpenedOutput} - An object with a remove function to remove the listener.
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Register a listener
|
|
21
|
+
* onNotificationOpened(message => {
|
|
22
|
+
* doSomething(message);
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* // Register multiple listeners
|
|
28
|
+
* onNotificationOpened(message => {
|
|
29
|
+
* doSomething(message);
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* onNotificationOpened(message => {
|
|
33
|
+
* doSomethingElse(message);
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export const onNotificationOpened: OnNotificationOpened = () => {
|
|
38
|
+
throw new PlatformNotSupportedError();
|
|
39
|
+
};
|
package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { addEventListener } from '../../../../eventListeners';
|
|
5
|
+
import { OnNotificationReceivedInBackground } from '../types';
|
|
6
|
+
|
|
7
|
+
export const onNotificationReceivedInBackground: OnNotificationReceivedInBackground =
|
|
8
|
+
input => addEventListener('backgroundMessageReceived', input);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
import { PushNotificationMessage } from '../../../types';
|
|
6
|
+
import {
|
|
7
|
+
OnNotificationReceivedInBackground,
|
|
8
|
+
OnNotificationReceivedInBackgroundInput,
|
|
9
|
+
OnNotificationReceivedInBackgroundOutput,
|
|
10
|
+
} from '../types';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Registers a listener that will be triggered when a notification is received while app is in a background state.
|
|
14
|
+
*
|
|
15
|
+
* @throws platform: {@link PlatformNotSupportedError} - Thrown if called against an unsupported platform. Currently,
|
|
16
|
+
* only React Native is supported by this API.
|
|
17
|
+
* @param {OnNotificationReceivedInBackgroundInput} input - A callback handler to be invoked with the received
|
|
18
|
+
* {@link PushNotificationMessage}.
|
|
19
|
+
* @returns {OnNotificationReceivedInBackgroundOutput} - An object with a remove function to remove the listener.
|
|
20
|
+
* @remarks Notifications received while app is in a quit state will start the app (as a headless JS instance running
|
|
21
|
+
* on a background service on Android) in the background. Handlers registered via this function should return promises
|
|
22
|
+
* if it needs to be asynchronous (e.g. to perform some network requests). The app should run in the background as long
|
|
23
|
+
* as there are handlers still running (however, if they run for more than 30 seconds on iOS, subsequent tasks could
|
|
24
|
+
* get deprioritized!). If it is necessary for a handler to execute while the app is in quit state, it should be
|
|
25
|
+
* registered in the application entry point (e.g. index.js) since the application will not fully mount in that case.
|
|
26
|
+
* @example
|
|
27
|
+
* ```ts
|
|
28
|
+
* // Register a listener
|
|
29
|
+
* onNotificationReceivedInBackground(message => {
|
|
30
|
+
* doSomething(message);
|
|
31
|
+
* });
|
|
32
|
+
* ```
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Register multiple listeners
|
|
36
|
+
* onNotificationReceivedInBackground(message => {
|
|
37
|
+
* doSomething(message);
|
|
38
|
+
* });
|
|
39
|
+
*
|
|
40
|
+
* onNotificationReceivedInBackground(message => {
|
|
41
|
+
* doSomethingElse(message);
|
|
42
|
+
* });
|
|
43
|
+
* ```
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* // Register async listener
|
|
47
|
+
* onNotificationReceivedInBackground(async message => {
|
|
48
|
+
* await doSomething(message);
|
|
49
|
+
* console.log(`did something with ${message}`);
|
|
50
|
+
* });
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
export const onNotificationReceivedInBackground: OnNotificationReceivedInBackground =
|
|
54
|
+
() => {
|
|
55
|
+
throw new PlatformNotSupportedError();
|
|
56
|
+
};
|
package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { addEventListener } from '../../../../eventListeners';
|
|
5
|
+
import { OnNotificationReceivedInForeground } from '../types';
|
|
6
|
+
|
|
7
|
+
export const onNotificationReceivedInForeground: OnNotificationReceivedInForeground =
|
|
8
|
+
input => addEventListener('foregroundMessageReceived', input);
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
5
|
+
import { PushNotificationMessage } from '../../../types';
|
|
6
|
+
import {
|
|
7
|
+
OnNotificationReceivedInForeground,
|
|
8
|
+
OnNotificationReceivedInForegroundInput,
|
|
9
|
+
OnNotificationReceivedInForegroundOutput,
|
|
10
|
+
} from '../types';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Registers a listener that will be triggered when a notification is received while app is in a foreground state.
|
|
14
|
+
*
|
|
15
|
+
* @param {OnNotificationReceivedInForegroundInput} input - A callback handler to be invoked with the received
|
|
16
|
+
* {@link PushNotificationMessage}.
|
|
17
|
+
* @returns {OnNotificationReceivedInForegroundOutput} - An object with a remove function to remove the listener.
|
|
18
|
+
* @example
|
|
19
|
+
* ```ts
|
|
20
|
+
* // Register a listener
|
|
21
|
+
* onNotificationReceivedInForeground(message => {
|
|
22
|
+
* doSomething(message);
|
|
23
|
+
* });
|
|
24
|
+
* ```
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* // Register multiple listeners
|
|
28
|
+
* onNotificationReceivedInForeground(message => {
|
|
29
|
+
* doSomething(message);
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* onNotificationReceivedInForeground(message => {
|
|
33
|
+
* doSomethingElse(message);
|
|
34
|
+
* });
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export const onNotificationReceivedInForeground: OnNotificationReceivedInForeground =
|
|
38
|
+
() => {
|
|
39
|
+
throw new PlatformNotSupportedError();
|
|
40
|
+
};
|