@aws-amplify/notifications 2.0.1-api-v6-models.9351bcf.0 → 2.0.1-api-v6-models.891fe0d.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 +4 -4
- package/lib/eventListeners/eventListeners.js +19 -37
- package/lib/eventListeners/index.js +4 -3
- package/lib/eventListeners/types.d.ts +2 -2
- package/lib/inAppMessaging/errors/InAppMessagingError.js +8 -11
- package/lib/inAppMessaging/errors/assertServiceError.js +3 -2
- package/lib/inAppMessaging/errors/assertValidationError.js +5 -4
- package/lib/inAppMessaging/errors/index.js +6 -5
- package/lib/inAppMessaging/errors/validation.js +7 -7
- package/lib/inAppMessaging/index.d.ts +2 -1
- package/lib/inAppMessaging/index.js +12 -10
- package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.js +26 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +26 -38
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +24 -35
- package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/index.js +13 -10
- package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +21 -21
- package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +6 -6
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +5 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +5 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +5 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +5 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +6 -6
- package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +46 -76
- package/lib/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
- package/lib/inAppMessaging/providers/pinpoint/index.js +12 -10
- package/lib/inAppMessaging/providers/pinpoint/types/index.js +2 -1
- package/lib/inAppMessaging/providers/pinpoint/types/inputs.d.ts +8 -8
- package/lib/inAppMessaging/providers/pinpoint/types/options.d.ts +1 -1
- package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +4 -4
- package/lib/inAppMessaging/providers/pinpoint/types/types.d.ts +6 -6
- package/lib/inAppMessaging/providers/pinpoint/types/types.js +1 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/constants.js +1 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +3 -3
- package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +114 -110
- package/lib/inAppMessaging/providers/pinpoint/utils/index.js +11 -10
- package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +116 -191
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +9 -8
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +1 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +9 -15
- package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js +6 -5
- package/lib/inAppMessaging/types/event.d.ts +2 -2
- package/lib/inAppMessaging/types/inputs.d.ts +1 -1
- package/lib/inAppMessaging/types/message.d.ts +3 -3
- package/lib/inAppMessaging/types/options.d.ts +1 -1
- package/lib/inAppMessaging/utils/index.js +4 -3
- package/lib/inAppMessaging/utils/statusHelpers.js +8 -5
- package/lib/index.js +1 -0
- package/lib/pushNotifications/errors/PushNotificationError.js +8 -11
- package/lib/pushNotifications/errors/errorHelpers.js +14 -13
- package/lib/pushNotifications/errors/index.js +4 -3
- package/lib/pushNotifications/index.d.ts +1 -1
- package/lib/pushNotifications/index.js +13 -12
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +9 -10
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +25 -36
- package/lib/pushNotifications/providers/pinpoint/apis/index.js +12 -11
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -1
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +90 -115
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/index.d.ts +1 -1
- package/lib/pushNotifications/providers/pinpoint/index.js +12 -11
- package/lib/pushNotifications/providers/pinpoint/types/analytics.d.ts +3 -3
- package/lib/pushNotifications/providers/pinpoint/types/apis.d.ts +11 -11
- package/lib/pushNotifications/providers/pinpoint/types/inputs.d.ts +7 -7
- package/lib/pushNotifications/providers/pinpoint/types/options.d.ts +1 -1
- package/lib/pushNotifications/providers/pinpoint/types/outputs.d.ts +8 -8
- package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +1 -1
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +3 -2
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +33 -49
- package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +3 -2
- package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +17 -13
- package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +2 -1
- package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js +9 -7
- package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +2 -1
- package/lib/pushNotifications/providers/pinpoint/utils/index.js +7 -4
- package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.js +17 -0
- package/lib/pushNotifications/types/errors.js +1 -0
- package/lib/pushNotifications/types/index.d.ts +1 -0
- package/lib/pushNotifications/types/index.js +20 -2
- package/lib/pushNotifications/types/inputs.d.ts +9 -8
- package/lib/pushNotifications/types/module.d.ts +31 -0
- package/lib/pushNotifications/types/options.d.ts +1 -1
- package/lib/pushNotifications/types/outputs.d.ts +8 -8
- package/lib/pushNotifications/types/pushNotifications.d.ts +4 -5
- package/lib/pushNotifications/utils/getPushNotificationUserAgentString.js +11 -0
- package/lib/pushNotifications/utils/index.d.ts +1 -1
- package/lib/pushNotifications/utils/index.js +8 -7
- package/lib/pushNotifications/utils/initializationManager.js +8 -9
- package/lib/pushNotifications/utils/resolveCredentials.d.ts +1 -1
- package/lib/pushNotifications/utils/resolveCredentials.js +9 -15
- package/lib/pushNotifications/utils/tokenManager.js +6 -3
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib-esm/eventListeners/eventListeners.js +15 -37
- package/lib-esm/eventListeners/types.d.ts +2 -2
- package/lib-esm/eventListeners/types.js +1 -0
- package/lib-esm/inAppMessaging/errors/InAppMessagingError.js +6 -11
- package/lib-esm/inAppMessaging/errors/assertValidationError.js +2 -2
- package/lib-esm/inAppMessaging/errors/validation.js +6 -7
- package/lib-esm/inAppMessaging/index.d.ts +2 -1
- package/lib-esm/inAppMessaging/index.js +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.js +22 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +15 -31
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +18 -31
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +5 -6
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +4 -5
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +38 -69
- package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/index.js +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +8 -8
- package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.js +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/options.d.ts +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/options.js +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +4 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/types.d.ts +6 -6
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js +4 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +3 -3
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +85 -97
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +111 -187
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +3 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +5 -13
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js +2 -2
- package/lib-esm/inAppMessaging/types/event.d.ts +2 -2
- package/lib-esm/inAppMessaging/types/event.js +1 -0
- package/lib-esm/inAppMessaging/types/index.js +1 -0
- package/lib-esm/inAppMessaging/types/inputs.d.ts +1 -1
- package/lib-esm/inAppMessaging/types/inputs.js +1 -0
- package/lib-esm/inAppMessaging/types/message.d.ts +3 -3
- package/lib-esm/inAppMessaging/types/message.js +1 -0
- package/lib-esm/inAppMessaging/types/options.d.ts +1 -1
- package/lib-esm/inAppMessaging/types/options.js +1 -0
- package/lib-esm/inAppMessaging/utils/statusHelpers.js +3 -3
- package/lib-esm/index.js +1 -0
- package/lib-esm/pushNotifications/errors/PushNotificationError.js +6 -11
- package/lib-esm/pushNotifications/errors/errorHelpers.js +8 -9
- package/lib-esm/pushNotifications/index.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +5 -8
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +2 -2
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +2 -2
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +20 -33
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +76 -103
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +2 -2
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +2 -2
- package/lib-esm/pushNotifications/providers/pinpoint/index.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.d.ts +3 -3
- package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/apis.d.ts +11 -11
- package/lib-esm/pushNotifications/providers/pinpoint/types/apis.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/index.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.d.ts +7 -7
- package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/options.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/types/options.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.d.ts +8 -8
- package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +3 -2
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +27 -45
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +3 -2
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +15 -13
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +2 -1
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js +5 -5
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +2 -1
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +2 -1
- package/lib-esm/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.js +4 -5
- package/lib-esm/pushNotifications/types/index.d.ts +1 -0
- package/lib-esm/pushNotifications/types/index.js +5 -0
- package/lib-esm/pushNotifications/types/inputs.d.ts +9 -8
- package/lib-esm/pushNotifications/types/inputs.js +1 -0
- package/lib-esm/pushNotifications/types/module.d.ts +31 -0
- package/lib-esm/pushNotifications/{Platform/types.js → types/module.js} +1 -0
- package/lib-esm/pushNotifications/types/options.d.ts +1 -1
- package/lib-esm/pushNotifications/types/options.js +1 -0
- package/lib-esm/pushNotifications/types/outputs.d.ts +8 -8
- package/lib-esm/pushNotifications/types/outputs.js +1 -0
- package/lib-esm/pushNotifications/types/pushNotifications.d.ts +4 -5
- package/lib-esm/pushNotifications/types/pushNotifications.js +1 -0
- package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.js +4 -6
- package/lib-esm/pushNotifications/utils/index.d.ts +1 -1
- package/lib-esm/pushNotifications/utils/index.js +1 -1
- package/lib-esm/pushNotifications/utils/initializationManager.js +5 -9
- package/lib-esm/pushNotifications/utils/resolveCredentials.d.ts +1 -1
- package/lib-esm/pushNotifications/utils/resolveCredentials.js +5 -13
- package/lib-esm/pushNotifications/utils/tokenManager.js +3 -3
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -30
- package/src/inAppMessaging/index.ts +12 -0
- package/src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts +26 -0
- package/src/inAppMessaging/providers/pinpoint/apis/index.ts +1 -0
- package/src/inAppMessaging/providers/pinpoint/index.ts +1 -0
- package/src/inAppMessaging/providers/pinpoint/utils/helpers.ts +38 -28
- package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +25 -9
- package/src/inAppMessaging/providers/pinpoint/utils/resolveConfig.ts +1 -1
- package/src/pushNotifications/index.ts +1 -0
- package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +5 -2
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +51 -41
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/index.ts +1 -0
- package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +5 -4
- package/src/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.ts +7 -4
- package/src/pushNotifications/providers/pinpoint/utils/getChannelType.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/utils/index.ts +2 -1
- package/src/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.ts +2 -2
- package/src/pushNotifications/types/index.ts +1 -0
- package/src/pushNotifications/types/inputs.ts +1 -1
- package/src/pushNotifications/types/module.ts +42 -0
- package/src/pushNotifications/types/outputs.ts +1 -1
- package/src/pushNotifications/types/pushNotifications.ts +2 -7
- package/src/pushNotifications/utils/index.ts +1 -1
- package/lib/inAppMessaging/providers/index.d.ts +0 -2
- package/lib/inAppMessaging/providers/index.js +0 -15
- package/lib/pushNotifications/Platform/index.d.ts +0 -2
- package/lib/pushNotifications/Platform/index.js +0 -25
- package/lib/pushNotifications/Platform/index.native.d.ts +0 -2
- package/lib/pushNotifications/Platform/index.native.js +0 -7
- package/lib/pushNotifications/Platform/types.d.ts +0 -5
- package/lib/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.js +0 -11
- package/lib/pushNotifications/utils/resolveConfig.js +0 -16
- package/lib/tsconfig.build.tsbuildinfo +0 -8667
- package/lib-esm/inAppMessaging/providers/index.d.ts +0 -2
- package/lib-esm/inAppMessaging/providers/index.js +0 -3
- package/lib-esm/pushNotifications/Platform/index.d.ts +0 -2
- package/lib-esm/pushNotifications/Platform/index.js +0 -23
- package/lib-esm/pushNotifications/Platform/index.native.d.ts +0 -2
- package/lib-esm/pushNotifications/Platform/index.native.js +0 -5
- package/lib-esm/pushNotifications/Platform/types.d.ts +0 -5
- package/lib-esm/tsconfig.build.tsbuildinfo +0 -7115
- package/src/inAppMessaging/providers/index.ts +0 -38
- package/src/pushNotifications/Platform/index.native.ts +0 -9
- package/src/pushNotifications/Platform/index.ts +0 -22
- package/src/pushNotifications/Platform/types.ts +0 -15
- /package/lib/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.d.ts +0 -0
- /package/lib/pushNotifications/{Platform/types.js → types/module.js} +0 -0
- /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.d.ts +0 -0
- /package/lib-esm/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.d.ts +0 -0
- /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.d.ts +0 -0
- /package/src/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.ts +0 -0
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
|
|
4
4
|
import { assertIsInitialized } from '../../../errors/errorHelpers';
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
const { getPermissionStatus: getPermissionStatusNative } = loadAmplifyPushNotification();
|
|
6
|
+
export const getPermissionStatus = async () => {
|
|
7
7
|
assertIsInitialized();
|
|
8
8
|
return getPermissionStatusNative();
|
|
9
9
|
};
|
|
@@ -1,40 +1,27 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { __awaiter, __generator } from "tslib";
|
|
4
3
|
import { PushNotificationAction } from '@aws-amplify/core/internals/utils';
|
|
5
4
|
import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
6
5
|
import { assertIsInitialized } from '../../../errors/errorHelpers';
|
|
7
|
-
import {
|
|
8
|
-
import { getChannelType,
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
category: 'PushNotification',
|
|
28
|
-
credentials: credentials,
|
|
29
|
-
identityId: identityId,
|
|
30
|
-
region: region,
|
|
31
|
-
userAttributes: userAttributes,
|
|
32
|
-
userId: userId,
|
|
33
|
-
userProfile: userProfile,
|
|
34
|
-
userAgentValue: getPushNotificationUserAgentString(PushNotificationAction.IdentifyUser),
|
|
35
|
-
});
|
|
36
|
-
return [2 /*return*/];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
6
|
+
import { getPushNotificationUserAgentString, resolveCredentials, } from '../../../utils';
|
|
7
|
+
import { getChannelType, resolveConfig } from '../utils';
|
|
8
|
+
export const identifyUser = async ({ userId, userProfile, options, }) => {
|
|
9
|
+
assertIsInitialized();
|
|
10
|
+
const { credentials, identityId } = await resolveCredentials();
|
|
11
|
+
const { appId, region } = resolveConfig();
|
|
12
|
+
const { address, optOut, userAttributes } = options ?? {};
|
|
13
|
+
updateEndpoint({
|
|
14
|
+
address,
|
|
15
|
+
channelType: getChannelType(),
|
|
16
|
+
optOut,
|
|
17
|
+
appId,
|
|
18
|
+
category: 'PushNotification',
|
|
19
|
+
credentials,
|
|
20
|
+
identityId,
|
|
21
|
+
region,
|
|
22
|
+
userAttributes,
|
|
23
|
+
userId,
|
|
24
|
+
userProfile,
|
|
25
|
+
userAgentValue: getPushNotificationUserAgentString(PushNotificationAction.IdentifyUser),
|
|
39
26
|
});
|
|
40
27
|
};
|
|
@@ -16,6 +16,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
|
16
16
|
* initializePushNotifications();
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
export
|
|
19
|
+
export const initializePushNotifications = () => {
|
|
20
20
|
throw new PlatformNotSupportedError();
|
|
21
21
|
};
|
package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const initializePushNotifications: () =>
|
|
1
|
+
export declare const initializePushNotifications: () => void;
|
package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { __awaiter, __generator } from "tslib";
|
|
4
3
|
import { ConsoleLogger } from '@aws-amplify/core';
|
|
5
4
|
import { PushNotificationAction } from '@aws-amplify/core/internals/utils';
|
|
6
5
|
import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
7
6
|
import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
|
|
8
7
|
import { addEventListener, notifyEventListeners, notifyEventListenersAndAwaitHandlers, } from '../../../../eventListeners';
|
|
9
|
-
import { getToken, initialize, isInitialized,
|
|
10
|
-
import { createMessageEventRecorder, getChannelType,
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
export
|
|
8
|
+
import { getPushNotificationUserAgentString, getToken, initialize, isInitialized, resolveCredentials, setToken, } from '../../../utils';
|
|
9
|
+
import { createMessageEventRecorder, getChannelType, resolveConfig, } from '../utils';
|
|
10
|
+
const { addMessageEventListener, addTokenEventListener, completeNotification, getConstants, registerHeadlessTask, } = loadAmplifyPushNotification();
|
|
11
|
+
const logger = new ConsoleLogger('Notifications.PushNotification');
|
|
12
|
+
const BACKGROUND_TASK_TIMEOUT = 25; // seconds
|
|
13
|
+
export const initializePushNotifications = () => {
|
|
15
14
|
if (isInitialized()) {
|
|
16
15
|
logger.info('Push notifications have already been enabled');
|
|
17
16
|
return;
|
|
@@ -20,137 +19,111 @@ export var initializePushNotifications = function () {
|
|
|
20
19
|
addAnalyticsListeners();
|
|
21
20
|
initialize();
|
|
22
21
|
};
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
addEventListener('foregroundMessageReceived', createMessageEventRecorder('foregroundMessageReceived'));
|
|
28
|
-
launchNotificationOpenedListenerRemover = addEventListener('launchNotificationsOpened', createMessageEventRecorder('notificationOpened',
|
|
29
|
-
// once we are done with it we can remove the listener
|
|
30
|
-
launchNotificationOpenedListenerRemover === null ||
|
|
31
|
-
// once we are done with it we can remove the listener
|
|
32
|
-
launchNotificationOpenedListenerRemover === void 0 ? void 0 :
|
|
33
|
-
// once we are done with it we can remove the listener
|
|
34
|
-
launchNotificationOpenedListenerRemover.remove));
|
|
35
|
-
addEventListener('notificationOpened', createMessageEventRecorder('notificationOpened',
|
|
36
|
-
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
37
|
-
launchNotificationOpenedListenerRemover === null ||
|
|
38
|
-
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
39
|
-
launchNotificationOpenedListenerRemover === void 0 ? void 0 :
|
|
40
|
-
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
41
|
-
launchNotificationOpenedListenerRemover.remove));
|
|
42
|
-
};
|
|
43
|
-
var addNativeListeners = function () {
|
|
44
|
-
var _a = getConstants(), NativeEvent = _a.NativeEvent, NativeHeadlessTaskKey = _a.NativeHeadlessTaskKey;
|
|
45
|
-
var BACKGROUND_MESSAGE_RECEIVED = NativeEvent.BACKGROUND_MESSAGE_RECEIVED, FOREGROUND_MESSAGE_RECEIVED = NativeEvent.FOREGROUND_MESSAGE_RECEIVED, LAUNCH_NOTIFICATION_OPENED = NativeEvent.LAUNCH_NOTIFICATION_OPENED, NOTIFICATION_OPENED = NativeEvent.NOTIFICATION_OPENED, TOKEN_RECEIVED = NativeEvent.TOKEN_RECEIVED;
|
|
22
|
+
const addNativeListeners = () => {
|
|
23
|
+
let launchNotificationOpenedListener;
|
|
24
|
+
const { NativeEvent, NativeHeadlessTaskKey } = getConstants();
|
|
25
|
+
const { BACKGROUND_MESSAGE_RECEIVED, FOREGROUND_MESSAGE_RECEIVED, LAUNCH_NOTIFICATION_OPENED, NOTIFICATION_OPENED, TOKEN_RECEIVED, } = NativeEvent;
|
|
46
26
|
// on platforms that can handle headless tasks, register one to broadcast background message received to
|
|
47
27
|
// library listeners
|
|
48
28
|
if (NativeHeadlessTaskKey) {
|
|
49
|
-
registerHeadlessTask(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
// keep headless task running until handlers have completed their work
|
|
54
|
-
return [4 /*yield*/, notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message)];
|
|
55
|
-
case 1:
|
|
56
|
-
// keep headless task running until handlers have completed their work
|
|
57
|
-
_a.sent();
|
|
58
|
-
return [2 /*return*/];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}); });
|
|
29
|
+
registerHeadlessTask(async (message) => {
|
|
30
|
+
// keep headless task running until handlers have completed their work
|
|
31
|
+
await notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message);
|
|
32
|
+
});
|
|
62
33
|
}
|
|
63
34
|
else if (BACKGROUND_MESSAGE_RECEIVED) {
|
|
64
35
|
// on platforms that can't handle headless tasks, listen for native background message received event and
|
|
65
36
|
// broadcast to library listeners
|
|
66
|
-
addMessageEventListener(BACKGROUND_MESSAGE_RECEIVED,
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
case 2:
|
|
87
|
-
err_1 = _a.sent();
|
|
88
|
-
logger.error(err_1);
|
|
89
|
-
return [3 /*break*/, 4];
|
|
90
|
-
case 3:
|
|
91
|
-
// notify native module that handlers have completed their work (or timed out)
|
|
92
|
-
completeNotification(completionHandlerId);
|
|
93
|
-
return [7 /*endfinally*/];
|
|
94
|
-
case 4: return [2 /*return*/];
|
|
37
|
+
addMessageEventListener(BACKGROUND_MESSAGE_RECEIVED, async (message, completionHandlerId) => {
|
|
38
|
+
// keep background task running until handlers have completed their work
|
|
39
|
+
try {
|
|
40
|
+
await Promise.race([
|
|
41
|
+
notifyEventListenersAndAwaitHandlers('backgroundMessageReceived', message),
|
|
42
|
+
// background tasks will get suspended and all future tasks be deprioritized by the OS if they run for
|
|
43
|
+
// more than 30 seconds so we reject with a error in a shorter amount of time to prevent this from
|
|
44
|
+
// happening
|
|
45
|
+
new Promise((_, reject) => {
|
|
46
|
+
setTimeout(() => reject(`onNotificationReceivedInBackground handlers should complete their work within ${BACKGROUND_TASK_TIMEOUT} seconds, but they did not.`), BACKGROUND_TASK_TIMEOUT * 1000);
|
|
47
|
+
}),
|
|
48
|
+
]);
|
|
49
|
+
}
|
|
50
|
+
catch (err) {
|
|
51
|
+
logger.error(err);
|
|
52
|
+
}
|
|
53
|
+
finally {
|
|
54
|
+
// notify native module that handlers have completed their work (or timed out)
|
|
55
|
+
if (completionHandlerId) {
|
|
56
|
+
completeNotification(completionHandlerId);
|
|
95
57
|
}
|
|
96
|
-
}
|
|
97
|
-
});
|
|
58
|
+
}
|
|
59
|
+
});
|
|
98
60
|
}
|
|
99
61
|
addMessageEventListener(
|
|
100
62
|
// listen for native foreground message received event and broadcast to library listeners
|
|
101
|
-
FOREGROUND_MESSAGE_RECEIVED,
|
|
63
|
+
FOREGROUND_MESSAGE_RECEIVED, message => {
|
|
102
64
|
notifyEventListeners('foregroundMessageReceived', message);
|
|
103
65
|
});
|
|
104
|
-
|
|
66
|
+
launchNotificationOpenedListener = LAUNCH_NOTIFICATION_OPENED
|
|
105
67
|
? addMessageEventListener(
|
|
106
68
|
// listen for native notification opened app (user tapped on notification, opening the app from quit -
|
|
107
69
|
// not background - state) event. This is broadcasted to an internal listener only as it is not intended
|
|
108
70
|
// for use otherwise as it produces inconsistent results when used within React Native app context
|
|
109
|
-
LAUNCH_NOTIFICATION_OPENED,
|
|
110
|
-
notifyEventListeners('
|
|
71
|
+
LAUNCH_NOTIFICATION_OPENED, message => {
|
|
72
|
+
notifyEventListeners('launchNotificationOpened', message);
|
|
111
73
|
// once we are done with it we can remove the listener
|
|
112
|
-
launchNotificationOpenedListener
|
|
74
|
+
launchNotificationOpenedListener?.remove();
|
|
113
75
|
})
|
|
114
76
|
: null;
|
|
115
77
|
addMessageEventListener(
|
|
116
78
|
// listen for native notification opened (user tapped on notification, opening the app from background -
|
|
117
79
|
// not quit - state) event and broadcast to library listeners
|
|
118
|
-
NOTIFICATION_OPENED,
|
|
80
|
+
NOTIFICATION_OPENED, message => {
|
|
119
81
|
notifyEventListeners('notificationOpened', message);
|
|
120
82
|
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
121
|
-
launchNotificationOpenedListener
|
|
83
|
+
launchNotificationOpenedListener?.remove();
|
|
122
84
|
});
|
|
123
85
|
addTokenEventListener(
|
|
124
86
|
// listen for native new token event, automatically re-register device with provider using new token and
|
|
125
87
|
// broadcast to library listeners
|
|
126
|
-
TOKEN_RECEIVED,
|
|
88
|
+
TOKEN_RECEIVED, async (token) => {
|
|
127
89
|
// avoid a race condition where two endpoints are created with the same token on a fresh install
|
|
128
90
|
if (getToken() === token) {
|
|
129
91
|
return;
|
|
130
92
|
}
|
|
131
93
|
setToken(token);
|
|
132
|
-
registerDevice();
|
|
133
94
|
notifyEventListeners('tokenReceived', token);
|
|
95
|
+
try {
|
|
96
|
+
await registerDevice(token);
|
|
97
|
+
}
|
|
98
|
+
catch (err) {
|
|
99
|
+
logger.error('Failed to register device for push notifications', err);
|
|
100
|
+
throw err;
|
|
101
|
+
}
|
|
134
102
|
});
|
|
135
103
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
104
|
+
const addAnalyticsListeners = () => {
|
|
105
|
+
let launchNotificationOpenedListenerRemover;
|
|
106
|
+
// wire up default Pinpoint message event handling
|
|
107
|
+
addEventListener('backgroundMessageReceived', createMessageEventRecorder('received_background'));
|
|
108
|
+
addEventListener('foregroundMessageReceived', createMessageEventRecorder('received_foreground'));
|
|
109
|
+
launchNotificationOpenedListenerRemover = addEventListener('launchNotificationOpened', createMessageEventRecorder('opened_notification',
|
|
110
|
+
// once we are done with it we can remove the listener
|
|
111
|
+
launchNotificationOpenedListenerRemover?.remove));
|
|
112
|
+
addEventListener('notificationOpened', createMessageEventRecorder('opened_notification',
|
|
113
|
+
// if we are in this state, we no longer need the listener as the app was launched via some other means
|
|
114
|
+
launchNotificationOpenedListenerRemover?.remove));
|
|
115
|
+
};
|
|
116
|
+
const registerDevice = async (address) => {
|
|
117
|
+
const { credentials, identityId } = await resolveCredentials();
|
|
118
|
+
const { appId, region } = resolveConfig();
|
|
119
|
+
await updateEndpoint({
|
|
120
|
+
address,
|
|
121
|
+
appId,
|
|
122
|
+
category: 'PushNotification',
|
|
123
|
+
credentials,
|
|
124
|
+
region,
|
|
125
|
+
channelType: getChannelType(),
|
|
126
|
+
identityId,
|
|
127
|
+
userAgentValue: getPushNotificationUserAgentString(PushNotificationAction.InitializePushNotifications),
|
|
155
128
|
});
|
|
156
|
-
}
|
|
129
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { addEventListener } from '../../../../eventListeners';
|
|
4
4
|
import { assertIsInitialized } from '../../../errors/errorHelpers';
|
|
5
|
-
export
|
|
5
|
+
export const onNotificationOpened = input => {
|
|
6
6
|
assertIsInitialized();
|
|
7
7
|
return addEventListener('notificationOpened', input);
|
|
8
8
|
};
|
package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js
CHANGED
|
@@ -42,6 +42,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
|
42
42
|
* });
|
|
43
43
|
* ```
|
|
44
44
|
*/
|
|
45
|
-
export
|
|
45
|
+
export const onNotificationReceivedInBackground = () => {
|
|
46
46
|
throw new PlatformNotSupportedError();
|
|
47
47
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { addEventListener } from '../../../../eventListeners';
|
|
4
4
|
import { assertIsInitialized } from '../../../errors/errorHelpers';
|
|
5
|
-
export
|
|
5
|
+
export const onNotificationReceivedInBackground = input => {
|
|
6
6
|
assertIsInitialized();
|
|
7
7
|
return addEventListener('backgroundMessageReceived', input);
|
|
8
8
|
};
|
package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js
CHANGED
|
@@ -26,6 +26,6 @@ import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
|
26
26
|
* });
|
|
27
27
|
* ```
|
|
28
28
|
*/
|
|
29
|
-
export
|
|
29
|
+
export const onNotificationReceivedInForeground = () => {
|
|
30
30
|
throw new PlatformNotSupportedError();
|
|
31
31
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { addEventListener } from '../../../../eventListeners';
|
|
4
4
|
import { assertIsInitialized } from '../../../errors/errorHelpers';
|
|
5
|
-
export
|
|
5
|
+
export const onNotificationReceivedInForeground = input => {
|
|
6
6
|
assertIsInitialized();
|
|
7
7
|
return addEventListener('foregroundMessageReceived', input);
|
|
8
8
|
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { addEventListener } from '../../../../eventListeners';
|
|
4
4
|
import { assertIsInitialized } from '../../../errors/errorHelpers';
|
|
5
|
-
export
|
|
5
|
+
export const onTokenReceived = input => {
|
|
6
6
|
assertIsInitialized();
|
|
7
7
|
return addEventListener('tokenReceived', input);
|
|
8
8
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
|
|
4
4
|
import { assertIsInitialized } from '../../../errors/errorHelpers';
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
const { requestPermissions: requestPermissionsNative } = loadAmplifyPushNotification();
|
|
6
|
+
export const requestPermissions = async (input) => {
|
|
7
7
|
assertIsInitialized();
|
|
8
8
|
return requestPermissionsNative(input);
|
|
9
9
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { loadAmplifyPushNotification } from '@aws-amplify/react-native';
|
|
4
4
|
import { assertIsInitialized } from '../../../errors/errorHelpers';
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
const { setBadgeCount: setBadgeCountNative } = loadAmplifyPushNotification();
|
|
6
|
+
export const setBadgeCount = input => {
|
|
7
7
|
assertIsInitialized();
|
|
8
8
|
setBadgeCountNative(input);
|
|
9
9
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export { getBadgeCount, getLaunchNotification, getPermissionStatus, identifyUser, initializePushNotifications, onNotificationOpened, onNotificationReceivedInBackground, onNotificationReceivedInForeground, onTokenReceived, requestPermissions, setBadgeCount, } from './apis';
|
|
2
2
|
export { IdentifyUserInput, OnNotificationOpenedInput, OnNotificationReceivedInBackgroundInput, OnNotificationReceivedInForegroundInput, OnTokenReceivedInput, RequestPermissionsInput, SetBadgeCountInput, } from './types/inputs';
|
|
3
|
-
export { GetLaunchNotificationOutput, GetPermissionStatusOutput, OnNotificationOpenedOutput, OnNotificationReceivedInBackgroundOutput, OnNotificationReceivedInForegroundOutput, OnTokenReceivedOutput, } from './types/outputs';
|
|
3
|
+
export { GetBadgeCountOutput, GetLaunchNotificationOutput, GetPermissionStatusOutput, OnNotificationOpenedOutput, OnNotificationReceivedInBackgroundOutput, OnNotificationReceivedInForegroundOutput, OnTokenReceivedOutput, } from './types/outputs';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type PinpointMessageEvent = 'opened_notification' | 'received_background' | 'received_foreground';
|
|
2
|
+
export type PinpointMessageEventSource = '_campaign' | '_journey';
|
|
3
|
+
export type AnalyticsEventAttributes = {
|
|
4
4
|
source: PinpointMessageEventSource;
|
|
5
5
|
attributes: Record<string, string>;
|
|
6
6
|
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { IdentifyUserInput, OnNotificationOpenedInput, OnNotificationReceivedInBackgroundInput, OnNotificationReceivedInForegroundInput, OnTokenReceivedInput, RequestPermissionsInput, SetBadgeCountInput } from './inputs';
|
|
2
2
|
import { GetBadgeCountOutput, GetLaunchNotificationOutput, GetPermissionStatusOutput, OnNotificationOpenedOutput, OnNotificationReceivedInBackgroundOutput, OnNotificationReceivedInForegroundOutput, OnTokenReceivedOutput, RequestPermissionsOutput } from './outputs';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
3
|
+
export type GetBadgeCount = () => Promise<void | GetBadgeCountOutput>;
|
|
4
|
+
export type GetLaunchNotification = () => Promise<GetLaunchNotificationOutput>;
|
|
5
|
+
export type GetPermissionStatus = () => Promise<GetPermissionStatusOutput>;
|
|
6
|
+
export type IdentifyUser = (input: IdentifyUserInput) => Promise<void>;
|
|
7
|
+
export type InitializePushNotifications = () => void;
|
|
8
|
+
export type RequestPermissions = (input?: RequestPermissionsInput) => Promise<RequestPermissionsOutput>;
|
|
9
|
+
export type SetBadgeCount = (input: SetBadgeCountInput) => void;
|
|
10
|
+
export type OnNotificationOpened = (input: OnNotificationOpenedInput) => OnNotificationOpenedOutput;
|
|
11
|
+
export type OnNotificationReceivedInBackground = (input: OnNotificationReceivedInBackgroundInput) => OnNotificationReceivedInBackgroundOutput;
|
|
12
|
+
export type OnNotificationReceivedInForeground = (input: OnNotificationReceivedInForegroundInput) => OnNotificationReceivedInForegroundOutput;
|
|
13
|
+
export type OnTokenReceived = (input: OnTokenReceivedInput) => OnTokenReceivedOutput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { IdentifyUserOptions } from './options';
|
|
2
2
|
import { PushNotificationIdentifyUserInput, PushNotificationRequestPermissionsInput, PushNotificationSetBadgeCountInput, PushNotificationOnNotificationOpenedInput, PushNotificationOnNotificationReceivedInBackgroundInput, PushNotificationOnNotificationReceivedInForegroundInput, PushNotificationOnTokenReceivedInput } from '../../../types';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
3
|
+
export type IdentifyUserInput = PushNotificationIdentifyUserInput<IdentifyUserOptions>;
|
|
4
|
+
export type RequestPermissionsInput = PushNotificationRequestPermissionsInput;
|
|
5
|
+
export type SetBadgeCountInput = PushNotificationSetBadgeCountInput;
|
|
6
|
+
export type OnNotificationOpenedInput = PushNotificationOnNotificationOpenedInput;
|
|
7
|
+
export type OnNotificationReceivedInBackgroundInput = PushNotificationOnNotificationReceivedInBackgroundInput;
|
|
8
|
+
export type OnNotificationReceivedInForegroundInput = PushNotificationOnNotificationReceivedInForegroundInput;
|
|
9
|
+
export type OnTokenReceivedInput = PushNotificationOnTokenReceivedInput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PushNotificationGetBadgeCountOutput, PushNotificationGetLaunchNotificationOutput, PushNotificationGetPermissionStatusOutput, PushNotificationOnNotificationOpenedOutput, PushNotificationOnNotificationReceivedInBackgroundOutput, PushNotificationOnNotificationReceivedInForegroundOutput, PushNotificationOnTokenReceivedOutput, PushNotificationRequestPermissionsOutput } from '../../../types';
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
2
|
+
export type GetBadgeCountOutput = PushNotificationGetBadgeCountOutput;
|
|
3
|
+
export type GetLaunchNotificationOutput = PushNotificationGetLaunchNotificationOutput;
|
|
4
|
+
export type GetPermissionStatusOutput = PushNotificationGetPermissionStatusOutput;
|
|
5
|
+
export type RequestPermissionsOutput = PushNotificationRequestPermissionsOutput;
|
|
6
|
+
export type OnNotificationOpenedOutput = PushNotificationOnNotificationOpenedOutput;
|
|
7
|
+
export type OnNotificationReceivedInBackgroundOutput = PushNotificationOnNotificationReceivedInBackgroundOutput;
|
|
8
|
+
export type OnNotificationReceivedInForegroundOutput = PushNotificationOnNotificationReceivedInForegroundOutput;
|
|
9
|
+
export type OnTokenReceivedOutput = PushNotificationOnTokenReceivedOutput;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { updateEndpoint } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
2
|
-
export
|
|
2
|
+
export type ChannelType = Parameters<typeof updateEndpoint>[0]['channelType'];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PinpointMessageEvent } from '../types';
|
|
2
|
+
import { OnPushNotificationMessageHandler } from '../../../types';
|
|
2
3
|
/**
|
|
3
4
|
* @internal
|
|
4
5
|
*/
|
|
5
|
-
export declare const createMessageEventRecorder: (event:
|
|
6
|
+
export declare const createMessageEventRecorder: (event: PinpointMessageEvent, callback?: Function) => OnPushNotificationMessageHandler;
|