@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,7 +2,8 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
5
|
+
exports.onNotificationReceivedInBackground = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
6
7
|
/**
|
|
7
8
|
* Registers a listener that will be triggered when a notification is received while app is in a background state.
|
|
8
9
|
*
|
|
@@ -44,6 +45,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
|
44
45
|
* });
|
|
45
46
|
* ```
|
|
46
47
|
*/
|
|
47
|
-
|
|
48
|
+
const onNotificationReceivedInBackground = () => {
|
|
48
49
|
throw new utils_1.PlatformNotSupportedError();
|
|
49
50
|
};
|
|
51
|
+
exports.onNotificationReceivedInBackground = onNotificationReceivedInBackground;
|
package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
exports.onNotificationReceivedInBackground = void 0;
|
|
6
|
+
const eventListeners_1 = require("../../../../eventListeners");
|
|
7
|
+
const errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
8
|
+
const onNotificationReceivedInBackground = input => {
|
|
9
|
+
(0, errorHelpers_1.assertIsInitialized)();
|
|
10
|
+
return (0, eventListeners_1.addEventListener)('backgroundMessageReceived', input);
|
|
10
11
|
};
|
|
12
|
+
exports.onNotificationReceivedInBackground = onNotificationReceivedInBackground;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
5
|
+
exports.onNotificationReceivedInForeground = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
6
7
|
/**
|
|
7
8
|
* Registers a listener that will be triggered when a notification is received while app is in a foreground state.
|
|
8
9
|
*
|
|
@@ -28,6 +29,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
|
28
29
|
* });
|
|
29
30
|
* ```
|
|
30
31
|
*/
|
|
31
|
-
|
|
32
|
+
const onNotificationReceivedInForeground = () => {
|
|
32
33
|
throw new utils_1.PlatformNotSupportedError();
|
|
33
34
|
};
|
|
35
|
+
exports.onNotificationReceivedInForeground = onNotificationReceivedInForeground;
|
package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js
CHANGED
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
exports.onNotificationReceivedInForeground = void 0;
|
|
6
|
+
const eventListeners_1 = require("../../../../eventListeners");
|
|
7
|
+
const errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
8
|
+
const onNotificationReceivedInForeground = input => {
|
|
9
|
+
(0, errorHelpers_1.assertIsInitialized)();
|
|
10
|
+
return (0, eventListeners_1.addEventListener)('foregroundMessageReceived', input);
|
|
10
11
|
};
|
|
12
|
+
exports.onNotificationReceivedInForeground = onNotificationReceivedInForeground;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
5
|
+
exports.onTokenReceived = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
6
7
|
/**
|
|
7
8
|
* Registers a listener that will be triggered when a token is received. A token will be received:
|
|
8
9
|
* 1. On every app launch, including the first install
|
|
@@ -29,6 +30,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
|
29
30
|
* });
|
|
30
31
|
* ```
|
|
31
32
|
*/
|
|
32
|
-
|
|
33
|
+
const onTokenReceived = () => {
|
|
33
34
|
throw new utils_1.PlatformNotSupportedError();
|
|
34
35
|
};
|
|
36
|
+
exports.onTokenReceived = onTokenReceived;
|
|
@@ -2,9 +2,11 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
exports.onTokenReceived = void 0;
|
|
6
|
+
const eventListeners_1 = require("../../../../eventListeners");
|
|
7
|
+
const errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
8
|
+
const onTokenReceived = input => {
|
|
9
|
+
(0, errorHelpers_1.assertIsInitialized)();
|
|
10
|
+
return (0, eventListeners_1.addEventListener)('tokenReceived', input);
|
|
10
11
|
};
|
|
12
|
+
exports.onTokenReceived = onTokenReceived;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
5
|
+
exports.requestPermissions = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
6
7
|
/**
|
|
7
8
|
* Requests notification permissions from your user. By default, Amplify requests all supported permissions but you can
|
|
8
9
|
* choose not to request specific permissions. The resulting promise will resolve to true if requested permissions are
|
|
@@ -33,6 +34,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
|
33
34
|
* });
|
|
34
35
|
* ```
|
|
35
36
|
*/
|
|
36
|
-
|
|
37
|
+
const requestPermissions = async () => {
|
|
37
38
|
throw new utils_1.PlatformNotSupportedError();
|
|
38
39
|
};
|
|
40
|
+
exports.requestPermissions = requestPermissions;
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
exports.requestPermissions = void 0;
|
|
6
|
+
const react_native_1 = require("@aws-amplify/react-native");
|
|
7
|
+
const errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
8
|
+
const { requestPermissions: requestPermissionsNative } = (0, react_native_1.loadAmplifyPushNotification)();
|
|
9
|
+
const requestPermissions = async (input) => {
|
|
10
|
+
(0, errorHelpers_1.assertIsInitialized)();
|
|
10
11
|
return requestPermissionsNative(input);
|
|
11
12
|
};
|
|
13
|
+
exports.requestPermissions = requestPermissions;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
5
|
+
exports.setBadgeCount = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
6
7
|
/**
|
|
7
8
|
* Sets the current badge count (the number on the top right corner of your app's icon). Setting the badge count
|
|
8
9
|
* to 0 (zero) will remove the badge from your app's icon. This function is safe to call (but will be ignored) even
|
|
@@ -15,6 +16,7 @@ var utils_1 = require("@aws-amplify/core/internals/utils");
|
|
|
15
16
|
* setBadgeCount(42);
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
|
-
|
|
19
|
+
const setBadgeCount = () => {
|
|
19
20
|
throw new utils_1.PlatformNotSupportedError();
|
|
20
21
|
};
|
|
22
|
+
exports.setBadgeCount = setBadgeCount;
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
exports.setBadgeCount = void 0;
|
|
6
|
+
const react_native_1 = require("@aws-amplify/react-native");
|
|
7
|
+
const errorHelpers_1 = require("../../../errors/errorHelpers");
|
|
8
|
+
const { setBadgeCount: setBadgeCountNative } = (0, react_native_1.loadAmplifyPushNotification)();
|
|
9
|
+
const setBadgeCount = input => {
|
|
10
|
+
(0, errorHelpers_1.assertIsInitialized)();
|
|
10
11
|
setBadgeCountNative(input);
|
|
11
12
|
};
|
|
13
|
+
exports.setBadgeCount = setBadgeCount;
|
|
@@ -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';
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.setBadgeCount = exports.requestPermissions = exports.onTokenReceived = exports.onNotificationReceivedInForeground = exports.onNotificationReceivedInBackground = exports.onNotificationOpened = exports.initializePushNotifications = exports.identifyUser = exports.getPermissionStatus = exports.getLaunchNotification = exports.getBadgeCount = void 0;
|
|
5
6
|
var apis_1 = require("./apis");
|
|
6
|
-
exports
|
|
7
|
-
exports
|
|
8
|
-
exports
|
|
9
|
-
exports
|
|
10
|
-
exports
|
|
11
|
-
exports
|
|
12
|
-
exports
|
|
13
|
-
exports
|
|
14
|
-
exports
|
|
15
|
-
exports
|
|
16
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "getBadgeCount", { enumerable: true, get: function () { return apis_1.getBadgeCount; } });
|
|
8
|
+
Object.defineProperty(exports, "getLaunchNotification", { enumerable: true, get: function () { return apis_1.getLaunchNotification; } });
|
|
9
|
+
Object.defineProperty(exports, "getPermissionStatus", { enumerable: true, get: function () { return apis_1.getPermissionStatus; } });
|
|
10
|
+
Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return apis_1.identifyUser; } });
|
|
11
|
+
Object.defineProperty(exports, "initializePushNotifications", { enumerable: true, get: function () { return apis_1.initializePushNotifications; } });
|
|
12
|
+
Object.defineProperty(exports, "onNotificationOpened", { enumerable: true, get: function () { return apis_1.onNotificationOpened; } });
|
|
13
|
+
Object.defineProperty(exports, "onNotificationReceivedInBackground", { enumerable: true, get: function () { return apis_1.onNotificationReceivedInBackground; } });
|
|
14
|
+
Object.defineProperty(exports, "onNotificationReceivedInForeground", { enumerable: true, get: function () { return apis_1.onNotificationReceivedInForeground; } });
|
|
15
|
+
Object.defineProperty(exports, "onTokenReceived", { enumerable: true, get: function () { return apis_1.onTokenReceived; } });
|
|
16
|
+
Object.defineProperty(exports, "requestPermissions", { enumerable: true, get: function () { return apis_1.requestPermissions; } });
|
|
17
|
+
Object.defineProperty(exports, "setBadgeCount", { enumerable: true, get: function () { return apis_1.setBadgeCount; } });
|
|
@@ -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;
|
|
@@ -2,58 +2,42 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
exports.createMessageEventRecorder = void 0;
|
|
6
|
+
const pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
7
|
+
const core_1 = require("@aws-amplify/core");
|
|
8
|
+
const utils_1 = require("../../../utils");
|
|
9
|
+
const getAnalyticsEvent_1 = require("./getAnalyticsEvent");
|
|
10
|
+
const getChannelType_1 = require("./getChannelType");
|
|
11
|
+
const resolveConfig_1 = require("./resolveConfig");
|
|
12
|
+
const logger = new core_1.ConsoleLogger('PushNotification.recordMessageEvent');
|
|
12
13
|
/**
|
|
13
14
|
* @internal
|
|
14
15
|
*/
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
credentials: credentials,
|
|
27
|
-
event: event,
|
|
28
|
-
message: message,
|
|
29
|
-
region: region,
|
|
30
|
-
})];
|
|
31
|
-
case 2:
|
|
32
|
-
_b.sent();
|
|
33
|
-
callback === null || callback === void 0 ? void 0 : callback();
|
|
34
|
-
return [2 /*return*/];
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}); };
|
|
16
|
+
const createMessageEventRecorder = (event, callback) => async (message) => {
|
|
17
|
+
const { credentials } = await (0, utils_1.resolveCredentials)();
|
|
18
|
+
const { appId, region } = (0, resolveConfig_1.resolveConfig)();
|
|
19
|
+
await recordMessageEvent({
|
|
20
|
+
appId,
|
|
21
|
+
credentials,
|
|
22
|
+
event,
|
|
23
|
+
message,
|
|
24
|
+
region,
|
|
25
|
+
});
|
|
26
|
+
callback?.();
|
|
38
27
|
};
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
credentials: credentials,
|
|
54
|
-
event: analyticsEvent,
|
|
55
|
-
region: region,
|
|
56
|
-
})];
|
|
57
|
-
});
|
|
28
|
+
exports.createMessageEventRecorder = createMessageEventRecorder;
|
|
29
|
+
const recordMessageEvent = async ({ appId, credentials, event, message, region, }) => {
|
|
30
|
+
const analyticsEvent = (0, getAnalyticsEvent_1.getAnalyticsEvent)(message, event);
|
|
31
|
+
if (!analyticsEvent) {
|
|
32
|
+
logger.debug('A notification missing event information was not recorded');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
return (0, pinpoint_1.record)({
|
|
36
|
+
appId,
|
|
37
|
+
category: 'PushNotification',
|
|
38
|
+
channelType: (0, getChannelType_1.getChannelType)(),
|
|
39
|
+
credentials,
|
|
40
|
+
event: analyticsEvent,
|
|
41
|
+
region,
|
|
58
42
|
});
|
|
59
43
|
};
|
|
@@ -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;
|
|
@@ -2,28 +2,32 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
exports.getAnalyticsEvent = void 0;
|
|
6
|
+
const ANDROID_CAMPAIGN_ACTIVITY_ID_KEY = 'pinpoint.campaign.campaign_activity_id';
|
|
7
|
+
const ANDROID_CAMPAIGN_ID_KEY = 'pinpoint.campaign.campaign_id';
|
|
8
|
+
const ANDROID_CAMPAIGN_TREATMENT_ID_KEY = 'pinpoint.campaign.treatment_id';
|
|
8
9
|
/**
|
|
9
10
|
* @internal
|
|
10
11
|
*/
|
|
11
|
-
|
|
12
|
-
var data = _a.data;
|
|
12
|
+
const getAnalyticsEvent = ({ data }, event) => {
|
|
13
13
|
if (!data) {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const eventAttributes = getAnalyticsEventAttributes(data);
|
|
17
17
|
if (!eventAttributes) {
|
|
18
18
|
return null;
|
|
19
19
|
}
|
|
20
|
-
|
|
20
|
+
const { source, attributes } = eventAttributes;
|
|
21
21
|
return {
|
|
22
|
-
attributes
|
|
23
|
-
name: source
|
|
22
|
+
attributes,
|
|
23
|
+
name: `${source}.${event}`,
|
|
24
24
|
};
|
|
25
25
|
};
|
|
26
|
-
|
|
26
|
+
exports.getAnalyticsEvent = getAnalyticsEvent;
|
|
27
|
+
const getAnalyticsEventAttributes = (data) => {
|
|
28
|
+
if (!data) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
27
31
|
if (data.hasOwnProperty(ANDROID_CAMPAIGN_ID_KEY)) {
|
|
28
32
|
return {
|
|
29
33
|
source: '_campaign',
|
|
@@ -34,16 +38,16 @@ var getAnalyticsEventAttributes = function (data) {
|
|
|
34
38
|
},
|
|
35
39
|
};
|
|
36
40
|
}
|
|
37
|
-
|
|
41
|
+
const pinpoint = typeof data.pinpoint === 'string'
|
|
38
42
|
? JSON.parse(data.pinpoint)
|
|
39
43
|
: data.pinpoint;
|
|
40
|
-
if (pinpoint
|
|
44
|
+
if (pinpoint?.campaign) {
|
|
41
45
|
return {
|
|
42
46
|
source: '_campaign',
|
|
43
47
|
attributes: pinpoint.campaign,
|
|
44
48
|
};
|
|
45
49
|
}
|
|
46
|
-
if (pinpoint
|
|
50
|
+
if (pinpoint?.journey) {
|
|
47
51
|
return {
|
|
48
52
|
source: '_journey',
|
|
49
53
|
attributes: pinpoint.journey,
|
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
exports.getChannelType = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
const react_native_1 = require("@aws-amplify/react-native");
|
|
8
|
+
const operatingSystem = (0, react_native_1.getOperatingSystem)();
|
|
9
|
+
const isAndroid = operatingSystem === 'android';
|
|
10
|
+
const isIos = operatingSystem === 'ios';
|
|
10
11
|
/**
|
|
11
12
|
* @internal
|
|
12
13
|
*/
|
|
13
|
-
|
|
14
|
+
const getChannelType = () => {
|
|
14
15
|
if (isAndroid) {
|
|
15
16
|
// FCM was previously known as GCM and continues to be the channel type in Pinpoint
|
|
16
17
|
return 'GCM';
|
|
17
18
|
}
|
|
18
19
|
if (isIos) {
|
|
19
20
|
// If building in debug mode, use the APNs sandbox
|
|
20
|
-
return
|
|
21
|
+
return __DEV__ ? 'APNS_SANDBOX' : 'APNS';
|
|
21
22
|
}
|
|
22
23
|
throw new utils_1.PlatformNotSupportedError();
|
|
23
24
|
};
|
|
25
|
+
exports.getChannelType = getChannelType;
|
|
@@ -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';
|
|
@@ -2,9 +2,12 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resolveConfig = exports.getChannelType = exports.getAnalyticsEvent = exports.createMessageEventRecorder = void 0;
|
|
5
6
|
var createMessageEventRecorder_1 = require("./createMessageEventRecorder");
|
|
6
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "createMessageEventRecorder", { enumerable: true, get: function () { return createMessageEventRecorder_1.createMessageEventRecorder; } });
|
|
8
|
+
var getAnalyticsEvent_1 = require("./getAnalyticsEvent");
|
|
9
|
+
Object.defineProperty(exports, "getAnalyticsEvent", { enumerable: true, get: function () { return getAnalyticsEvent_1.getAnalyticsEvent; } });
|
|
7
10
|
var getChannelType_1 = require("./getChannelType");
|
|
8
|
-
exports
|
|
9
|
-
var
|
|
10
|
-
exports
|
|
11
|
+
Object.defineProperty(exports, "getChannelType", { enumerable: true, get: function () { return getChannelType_1.getChannelType; } });
|
|
12
|
+
var resolveConfig_1 = require("./resolveConfig");
|
|
13
|
+
Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resolveConfig = void 0;
|
|
6
|
+
const core_1 = require("@aws-amplify/core");
|
|
7
|
+
const errors_1 = require("../../../errors");
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const resolveConfig = () => {
|
|
12
|
+
const { appId, region } = core_1.Amplify.getConfig().Notifications?.PushNotification?.Pinpoint ?? {};
|
|
13
|
+
(0, errors_1.assert)(!!appId, errors_1.PushNotificationValidationErrorCode.NoAppId);
|
|
14
|
+
(0, errors_1.assert)(!!region, errors_1.PushNotificationValidationErrorCode.NoRegion);
|
|
15
|
+
return { appId, region };
|
|
16
|
+
};
|
|
17
|
+
exports.resolveConfig = resolveConfig;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.PushNotificationErrorCode = void 0;
|
|
5
6
|
var PushNotificationErrorCode;
|
|
6
7
|
(function (PushNotificationErrorCode) {
|
|
7
8
|
PushNotificationErrorCode["NotInitialized"] = "NotInitialized";
|