@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
|
@@ -1,57 +1,39 @@
|
|
|
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 { record } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
5
4
|
import { ConsoleLogger } from '@aws-amplify/core';
|
|
5
|
+
import { resolveCredentials } from '../../../utils';
|
|
6
6
|
import { getAnalyticsEvent } from './getAnalyticsEvent';
|
|
7
7
|
import { getChannelType } from './getChannelType';
|
|
8
|
-
import { resolveConfig
|
|
9
|
-
|
|
8
|
+
import { resolveConfig } from './resolveConfig';
|
|
9
|
+
const logger = new ConsoleLogger('PushNotification.recordMessageEvent');
|
|
10
10
|
/**
|
|
11
11
|
* @internal
|
|
12
12
|
*/
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
credentials: credentials,
|
|
25
|
-
event: event,
|
|
26
|
-
message: message,
|
|
27
|
-
region: region,
|
|
28
|
-
})];
|
|
29
|
-
case 2:
|
|
30
|
-
_b.sent();
|
|
31
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
32
|
-
return [2 /*return*/];
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
}); };
|
|
13
|
+
export const createMessageEventRecorder = (event, callback) => async (message) => {
|
|
14
|
+
const { credentials } = await resolveCredentials();
|
|
15
|
+
const { appId, region } = resolveConfig();
|
|
16
|
+
await recordMessageEvent({
|
|
17
|
+
appId,
|
|
18
|
+
credentials,
|
|
19
|
+
event,
|
|
20
|
+
message,
|
|
21
|
+
region,
|
|
22
|
+
});
|
|
23
|
+
callback?.();
|
|
36
24
|
};
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
channelType: getChannelType(),
|
|
51
|
-
credentials: credentials,
|
|
52
|
-
event: analyticsEvent,
|
|
53
|
-
region: region,
|
|
54
|
-
})];
|
|
55
|
-
});
|
|
25
|
+
const recordMessageEvent = async ({ appId, credentials, event, message, region, }) => {
|
|
26
|
+
const analyticsEvent = getAnalyticsEvent(message, event);
|
|
27
|
+
if (!analyticsEvent) {
|
|
28
|
+
logger.debug('A notification missing event information was not recorded');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
return record({
|
|
32
|
+
appId,
|
|
33
|
+
category: 'PushNotification',
|
|
34
|
+
channelType: getChannelType(),
|
|
35
|
+
credentials,
|
|
36
|
+
event: analyticsEvent,
|
|
37
|
+
region,
|
|
56
38
|
});
|
|
57
39
|
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PinpointAnalyticsEvent } from '@aws-amplify/core/internals/providers/pinpoint';
|
|
2
|
-
import {
|
|
2
|
+
import { PinpointMessageEvent } from '../types';
|
|
3
|
+
import { PushNotificationMessage } from '../../../types';
|
|
3
4
|
/**
|
|
4
5
|
* @internal
|
|
5
6
|
*/
|
|
6
|
-
export declare const getAnalyticsEvent: ({ data }: PushNotificationMessage, event:
|
|
7
|
+
export declare const getAnalyticsEvent: ({ data }: PushNotificationMessage, event: PinpointMessageEvent) => PinpointAnalyticsEvent | null;
|
|
@@ -1,27 +1,29 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const ANDROID_CAMPAIGN_ACTIVITY_ID_KEY = 'pinpoint.campaign.campaign_activity_id';
|
|
4
|
+
const ANDROID_CAMPAIGN_ID_KEY = 'pinpoint.campaign.campaign_id';
|
|
5
|
+
const ANDROID_CAMPAIGN_TREATMENT_ID_KEY = 'pinpoint.campaign.treatment_id';
|
|
6
6
|
/**
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
10
|
-
var data = _a.data;
|
|
9
|
+
export const getAnalyticsEvent = ({ data }, event) => {
|
|
11
10
|
if (!data) {
|
|
12
11
|
return null;
|
|
13
12
|
}
|
|
14
|
-
|
|
13
|
+
const eventAttributes = getAnalyticsEventAttributes(data);
|
|
15
14
|
if (!eventAttributes) {
|
|
16
15
|
return null;
|
|
17
16
|
}
|
|
18
|
-
|
|
17
|
+
const { source, attributes } = eventAttributes;
|
|
19
18
|
return {
|
|
20
|
-
attributes
|
|
21
|
-
name: source
|
|
19
|
+
attributes,
|
|
20
|
+
name: `${source}.${event}`,
|
|
22
21
|
};
|
|
23
22
|
};
|
|
24
|
-
|
|
23
|
+
const getAnalyticsEventAttributes = (data) => {
|
|
24
|
+
if (!data) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
25
27
|
if (data.hasOwnProperty(ANDROID_CAMPAIGN_ID_KEY)) {
|
|
26
28
|
return {
|
|
27
29
|
source: '_campaign',
|
|
@@ -32,16 +34,16 @@ var getAnalyticsEventAttributes = function (data) {
|
|
|
32
34
|
},
|
|
33
35
|
};
|
|
34
36
|
}
|
|
35
|
-
|
|
37
|
+
const pinpoint = typeof data.pinpoint === 'string'
|
|
36
38
|
? JSON.parse(data.pinpoint)
|
|
37
39
|
: data.pinpoint;
|
|
38
|
-
if (pinpoint
|
|
40
|
+
if (pinpoint?.campaign) {
|
|
39
41
|
return {
|
|
40
42
|
source: '_campaign',
|
|
41
43
|
attributes: pinpoint.campaign,
|
|
42
44
|
};
|
|
43
45
|
}
|
|
44
|
-
if (pinpoint
|
|
46
|
+
if (pinpoint?.journey) {
|
|
45
47
|
return {
|
|
46
48
|
source: '_journey',
|
|
47
49
|
attributes: pinpoint.journey,
|
|
@@ -2,20 +2,20 @@
|
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { PlatformNotSupportedError } from '@aws-amplify/core/internals/utils';
|
|
4
4
|
import { getOperatingSystem } from '@aws-amplify/react-native';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
const operatingSystem = getOperatingSystem();
|
|
6
|
+
const isAndroid = operatingSystem === 'android';
|
|
7
|
+
const isIos = operatingSystem === 'ios';
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export const getChannelType = () => {
|
|
12
12
|
if (isAndroid) {
|
|
13
13
|
// FCM was previously known as GCM and continues to be the channel type in Pinpoint
|
|
14
14
|
return 'GCM';
|
|
15
15
|
}
|
|
16
16
|
if (isIos) {
|
|
17
17
|
// If building in debug mode, use the APNs sandbox
|
|
18
|
-
return
|
|
18
|
+
return __DEV__ ? 'APNS_SANDBOX' : 'APNS';
|
|
19
19
|
}
|
|
20
20
|
throw new PlatformNotSupportedError();
|
|
21
21
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { createMessageEventRecorder } from './createMessageEventRecorder';
|
|
2
|
+
export { getAnalyticsEvent } from './getAnalyticsEvent';
|
|
2
3
|
export { getChannelType } from './getChannelType';
|
|
3
|
-
export {
|
|
4
|
+
export { resolveConfig } from './resolveConfig';
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export { createMessageEventRecorder } from './createMessageEventRecorder';
|
|
4
|
+
export { getAnalyticsEvent } from './getAnalyticsEvent';
|
|
4
5
|
export { getChannelType } from './getChannelType';
|
|
5
|
-
export {
|
|
6
|
+
export { resolveConfig } from './resolveConfig';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { Amplify } from '@aws-amplify/core';
|
|
4
|
-
import { assert, PushNotificationValidationErrorCode } from '
|
|
4
|
+
import { assert, PushNotificationValidationErrorCode } from '../../../errors';
|
|
5
5
|
/**
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
var _c = (_b = (_a = Amplify.getConfig().Notifications) === null || _a === void 0 ? void 0 : _a.PushNotification.Pinpoint) !== null && _b !== void 0 ? _b : {}, appId = _c.appId, region = _c.region;
|
|
8
|
+
export const resolveConfig = () => {
|
|
9
|
+
const { appId, region } = Amplify.getConfig().Notifications?.PushNotification?.Pinpoint ?? {};
|
|
11
10
|
assert(!!appId, PushNotificationValidationErrorCode.NoAppId);
|
|
12
11
|
assert(!!region, PushNotificationValidationErrorCode.NoRegion);
|
|
13
|
-
return { appId
|
|
12
|
+
return { appId, region };
|
|
14
13
|
};
|
|
@@ -1,3 +1,8 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
export * from './errors';
|
|
4
|
+
export * from './inputs';
|
|
5
|
+
export * from './module';
|
|
6
|
+
export * from './options';
|
|
7
|
+
export * from './outputs';
|
|
8
|
+
export * from './pushNotifications';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { UserProfile } from '@aws-amplify/core';
|
|
2
2
|
import { PushNotificationServiceOptions } from './options';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { PushNotificationPermissions } from './module';
|
|
4
|
+
import { OnPushNotificationMessageHandler, OnTokenReceivedHandler } from './pushNotifications';
|
|
5
|
+
export type PushNotificationIdentifyUserInput<ServiceOptions extends PushNotificationServiceOptions = PushNotificationServiceOptions> = {
|
|
5
6
|
/**
|
|
6
7
|
* A User ID associated to the current device.
|
|
7
8
|
*/
|
|
@@ -15,9 +16,9 @@ export declare type PushNotificationIdentifyUserInput<ServiceOptions extends Pus
|
|
|
15
16
|
*/
|
|
16
17
|
options?: ServiceOptions;
|
|
17
18
|
};
|
|
18
|
-
export
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
22
|
-
export
|
|
23
|
-
export
|
|
19
|
+
export type PushNotificationRequestPermissionsInput = PushNotificationPermissions;
|
|
20
|
+
export type PushNotificationSetBadgeCountInput = number;
|
|
21
|
+
export type PushNotificationOnNotificationOpenedInput = OnPushNotificationMessageHandler;
|
|
22
|
+
export type PushNotificationOnNotificationReceivedInBackgroundInput = OnPushNotificationMessageHandler;
|
|
23
|
+
export type PushNotificationOnNotificationReceivedInForegroundInput = OnPushNotificationMessageHandler;
|
|
24
|
+
export type PushNotificationOnTokenReceivedInput = OnTokenReceivedHandler;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Types here are duplicated from `rtn-push-notifications` as it is not possible to share a source of truth
|
|
3
|
+
* with a package that may conditionally not exist for developers not using push notifications. Modifications
|
|
4
|
+
* made to these types should be reflected in the native module package and vice-versa!
|
|
5
|
+
*/
|
|
6
|
+
interface ApnsPlatformOptions {
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
}
|
|
9
|
+
interface FcmPlatformOptions {
|
|
10
|
+
channelId: string;
|
|
11
|
+
messageId: string;
|
|
12
|
+
senderId: string;
|
|
13
|
+
sendTime: Date;
|
|
14
|
+
}
|
|
15
|
+
export interface PushNotificationMessage {
|
|
16
|
+
title?: string;
|
|
17
|
+
body?: string;
|
|
18
|
+
imageUrl?: string;
|
|
19
|
+
deeplinkUrl?: string;
|
|
20
|
+
goToUrl?: string;
|
|
21
|
+
fcmOptions?: FcmPlatformOptions;
|
|
22
|
+
apnsOptions?: ApnsPlatformOptions;
|
|
23
|
+
data?: Record<string, unknown>;
|
|
24
|
+
}
|
|
25
|
+
export type PushNotificationPermissionStatus = 'denied' | 'granted' | 'shouldRequest' | 'shouldExplainThenRequest';
|
|
26
|
+
export interface PushNotificationPermissions extends Partial<Record<string, boolean>> {
|
|
27
|
+
alert?: boolean;
|
|
28
|
+
badge?: boolean;
|
|
29
|
+
sound?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { EventListenerRemover } from '../../eventListeners';
|
|
2
2
|
import { PushNotificationMessage, PushNotificationPermissionStatus } from '../types';
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
3
|
+
export type PushNotificationGetBadgeCountOutput = number | null;
|
|
4
|
+
export type PushNotificationGetLaunchNotificationOutput = PushNotificationMessage | null;
|
|
5
|
+
export type PushNotificationGetPermissionStatusOutput = PushNotificationPermissionStatus;
|
|
6
|
+
export type PushNotificationRequestPermissionsOutput = boolean;
|
|
7
|
+
export type PushNotificationOnNotificationOpenedOutput = EventListenerRemover;
|
|
8
|
+
export type PushNotificationOnNotificationReceivedInBackgroundOutput = EventListenerRemover;
|
|
9
|
+
export type PushNotificationOnNotificationReceivedInForegroundOutput = EventListenerRemover;
|
|
10
|
+
export type PushNotificationOnTokenReceivedOutput = EventListenerRemover;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
export type
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export declare type PushNotificationEvent = 'backgroundMessageReceived' | 'foregroundMessageReceived' | 'launchNotificationsOpened' | 'notificationOpened' | 'tokenReceived';
|
|
1
|
+
import { PushNotificationMessage } from './module';
|
|
2
|
+
export type OnTokenReceivedHandler = (token: string) => void;
|
|
3
|
+
export type OnPushNotificationMessageHandler = (message: PushNotificationMessage) => void;
|
|
4
|
+
export type PushNotificationEvent = 'backgroundMessageReceived' | 'foregroundMessageReceived' | 'launchNotificationOpened' | 'notificationOpened' | 'tokenReceived';
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
3
|
import { Category, getAmplifyUserAgent, } from '@aws-amplify/core/internals/utils';
|
|
4
|
-
export
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
});
|
|
9
|
-
};
|
|
4
|
+
export const getPushNotificationUserAgentString = (action) => getAmplifyUserAgent({
|
|
5
|
+
category: Category.PushNotification,
|
|
6
|
+
action,
|
|
7
|
+
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
+
export { getPushNotificationUserAgentString } from './getPushNotificationUserAgentString';
|
|
1
2
|
export { initialize, isInitialized } from './initializationManager';
|
|
2
|
-
export { resolveConfig } from './resolveConfig';
|
|
3
3
|
export { resolveCredentials } from './resolveCredentials';
|
|
4
4
|
export { getToken, setToken } from './tokenManager';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
export { getPushNotificationUserAgentString } from './getPushNotificationUserAgentString';
|
|
3
4
|
export { initialize, isInitialized } from './initializationManager';
|
|
4
|
-
export { resolveConfig } from './resolveConfig';
|
|
5
5
|
export { resolveCredentials } from './resolveCredentials';
|
|
6
6
|
export { getToken, setToken } from './tokenManager';
|
|
@@ -1,21 +1,17 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
4
|
-
var initialized = false;
|
|
3
|
+
let initialized = false;
|
|
5
4
|
/**
|
|
6
5
|
* Sets initialization status to true.
|
|
7
6
|
*
|
|
8
7
|
* @internal
|
|
9
8
|
*/
|
|
10
|
-
export
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return [2 /*return*/];
|
|
14
|
-
});
|
|
15
|
-
}); };
|
|
9
|
+
export const initialize = async () => {
|
|
10
|
+
initialized = true;
|
|
11
|
+
};
|
|
16
12
|
/**
|
|
17
13
|
* Returns the initialization status of push notifications.
|
|
18
14
|
*
|
|
19
15
|
* @internal
|
|
20
16
|
*/
|
|
21
|
-
export
|
|
17
|
+
export const isInitialized = () => initialized;
|
|
@@ -1,20 +1,12 @@
|
|
|
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 { fetchAuthSession } from '@aws-amplify/core';
|
|
5
4
|
import { assert, PushNotificationValidationErrorCode } from '../errors';
|
|
6
5
|
/**
|
|
7
6
|
* @internal
|
|
8
7
|
*/
|
|
9
|
-
export
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
case 1:
|
|
15
|
-
_a = _b.sent(), credentials = _a.credentials, identityId = _a.identityId;
|
|
16
|
-
assert(!!credentials, PushNotificationValidationErrorCode.NoCredentials);
|
|
17
|
-
return [2 /*return*/, { credentials: credentials, identityId: identityId }];
|
|
18
|
-
}
|
|
19
|
-
});
|
|
20
|
-
}); };
|
|
8
|
+
export const resolveCredentials = async () => {
|
|
9
|
+
const { credentials, identityId } = await fetchAuthSession();
|
|
10
|
+
assert(!!credentials, PushNotificationValidationErrorCode.NoCredentials);
|
|
11
|
+
return { credentials, identityId };
|
|
12
|
+
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
|
|
3
|
+
let token;
|
|
4
4
|
/**
|
|
5
5
|
* Sets token.
|
|
6
6
|
*
|
|
7
7
|
* @internal
|
|
8
8
|
*/
|
|
9
|
-
export
|
|
9
|
+
export const setToken = (newToken) => {
|
|
10
10
|
token = newToken;
|
|
11
11
|
};
|
|
12
12
|
/**
|
|
@@ -14,4 +14,4 @@ export var setToken = function (newToken) {
|
|
|
14
14
|
*
|
|
15
15
|
* @internal
|
|
16
16
|
*/
|
|
17
|
-
export
|
|
17
|
+
export const getToken = () => token;
|