@aws-amplify/notifications 2.0.1-api-v6-models.9351bcf.0 → 2.0.1-api-v6-models.58f2536.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,71 +2,52 @@
|
|
|
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
|
-
|
|
12
|
-
function processInAppMessages(messages, event) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (messageQualifies) {
|
|
37
|
-
// have not yet encountered message with priority
|
|
38
|
-
if (!highestPrioritySeen) {
|
|
39
|
-
// this message has priority, so reset the accumulator with this message only
|
|
40
|
-
if (message.Priority) {
|
|
41
|
-
highestPrioritySeen = message.Priority;
|
|
42
|
-
acc = [message];
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
// this message also has no priority, so just add this message to accumulator
|
|
46
|
-
acc.push(message);
|
|
47
|
-
}
|
|
48
|
-
// have previously encountered message with priority, so only messages with priority matter now
|
|
49
|
-
}
|
|
50
|
-
else if (message.Priority) {
|
|
51
|
-
// this message has higher priority (lower number), so reset the accumulator with this message only
|
|
52
|
-
if (message.Priority < highestPrioritySeen) {
|
|
53
|
-
highestPrioritySeen = message.Priority;
|
|
54
|
-
acc = [message];
|
|
55
|
-
// this message has the same priority, so just add this message to accumulator
|
|
56
|
-
}
|
|
57
|
-
else if (message.Priority === highestPrioritySeen) {
|
|
58
|
-
acc.push(message);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
_b.label = 4;
|
|
63
|
-
case 4:
|
|
64
|
-
index++;
|
|
65
|
-
return [3 /*break*/, 1];
|
|
66
|
-
case 5: return [2 /*return*/, normalizeMessages(acc)];
|
|
5
|
+
exports.incrementMessageCounts = exports.sessionStateChangeHandler = exports.processInAppMessages = void 0;
|
|
6
|
+
const helpers_1 = require("./helpers");
|
|
7
|
+
const core_1 = require("@aws-amplify/core");
|
|
8
|
+
const MESSAGE_DAILY_COUNT_KEY = 'pinpointProvider_inAppMessages_dailyCount';
|
|
9
|
+
const MESSAGE_TOTAL_COUNT_KEY = 'pinpointProvider_inAppMessages_totalCount';
|
|
10
|
+
const logger = new core_1.ConsoleLogger('InAppMessaging.processInAppMessages');
|
|
11
|
+
let sessionMessageCountMap = {};
|
|
12
|
+
async function processInAppMessages(messages, event) {
|
|
13
|
+
let highestPrioritySeen;
|
|
14
|
+
let acc = [];
|
|
15
|
+
for (let index = 0; index < messages.length; index++) {
|
|
16
|
+
const message = messages[index];
|
|
17
|
+
const messageQualifies = (0, helpers_1.matchesEventType)(message, event) &&
|
|
18
|
+
(0, helpers_1.matchesAttributes)(message, event) &&
|
|
19
|
+
(0, helpers_1.matchesMetrics)(message, event) &&
|
|
20
|
+
(0, helpers_1.isBeforeEndDate)(message) &&
|
|
21
|
+
(await isBelowCap(message));
|
|
22
|
+
// filter all qualifying messages returning only those that are of (relative) highest priority
|
|
23
|
+
if (messageQualifies) {
|
|
24
|
+
// have not yet encountered message with priority
|
|
25
|
+
if (!highestPrioritySeen) {
|
|
26
|
+
// this message has priority, so reset the accumulator with this message only
|
|
27
|
+
if (message.Priority) {
|
|
28
|
+
highestPrioritySeen = message.Priority;
|
|
29
|
+
acc = [message];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// this message also has no priority, so just add this message to accumulator
|
|
33
|
+
acc.push(message);
|
|
34
|
+
}
|
|
35
|
+
// have previously encountered message with priority, so only messages with priority matter now
|
|
67
36
|
}
|
|
68
|
-
|
|
69
|
-
|
|
37
|
+
else if (message.Priority) {
|
|
38
|
+
// this message has higher priority (lower number), so reset the accumulator with this message only
|
|
39
|
+
if (message.Priority < highestPrioritySeen) {
|
|
40
|
+
highestPrioritySeen = message.Priority;
|
|
41
|
+
acc = [message];
|
|
42
|
+
// this message has the same priority, so just add this message to accumulator
|
|
43
|
+
}
|
|
44
|
+
else if (message.Priority === highestPrioritySeen) {
|
|
45
|
+
acc.push(message);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return normalizeMessages(acc);
|
|
70
51
|
}
|
|
71
52
|
exports.processInAppMessages = processInAppMessages;
|
|
72
53
|
function sessionStateChangeHandler(state) {
|
|
@@ -76,87 +57,66 @@ function sessionStateChangeHandler(state) {
|
|
|
76
57
|
}
|
|
77
58
|
}
|
|
78
59
|
exports.sessionStateChangeHandler = sessionStateChangeHandler;
|
|
79
|
-
function incrementMessageCounts(messageId) {
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
case 0: return [4 /*yield*/, getMessageCounts(messageId)];
|
|
85
|
-
case 1:
|
|
86
|
-
_a = _b.sent(), sessionCount = _a.sessionCount, dailyCount = _a.dailyCount, totalCount = _a.totalCount;
|
|
87
|
-
setSessionCount(messageId, sessionCount + 1);
|
|
88
|
-
setDailyCount(dailyCount + 1);
|
|
89
|
-
return [4 /*yield*/, setTotalCount(messageId, totalCount + 1)];
|
|
90
|
-
case 2:
|
|
91
|
-
_b.sent();
|
|
92
|
-
return [2 /*return*/];
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
});
|
|
60
|
+
async function incrementMessageCounts(messageId) {
|
|
61
|
+
const { sessionCount, dailyCount, totalCount } = await getMessageCounts(messageId);
|
|
62
|
+
setSessionCount(messageId, sessionCount + 1);
|
|
63
|
+
setDailyCount(dailyCount + 1);
|
|
64
|
+
await setTotalCount(messageId, totalCount + 1);
|
|
96
65
|
}
|
|
97
66
|
exports.incrementMessageCounts = incrementMessageCounts;
|
|
98
67
|
function normalizeMessages(messages) {
|
|
99
|
-
return messages.map(
|
|
100
|
-
|
|
68
|
+
return messages.map(message => {
|
|
69
|
+
const { CampaignId, InAppMessage } = message;
|
|
101
70
|
return {
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
71
|
+
// Default to empty string in rare cases we don't have a campaignId
|
|
72
|
+
id: CampaignId ?? '',
|
|
73
|
+
content: (0, helpers_1.extractContent)(message),
|
|
74
|
+
// Default to TOP_BANNER layout in rare cases we don't have a Layout
|
|
75
|
+
layout: InAppMessage?.Layout
|
|
76
|
+
? (0, helpers_1.interpretLayout)(InAppMessage.Layout)
|
|
77
|
+
: 'TOP_BANNER',
|
|
78
|
+
metadata: (0, helpers_1.extractMetadata)(message),
|
|
106
79
|
};
|
|
107
80
|
});
|
|
108
81
|
}
|
|
109
|
-
function isBelowCap(
|
|
110
|
-
|
|
111
|
-
return
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
switch (_c.label) {
|
|
115
|
-
case 0: return [4 /*yield*/, getMessageCounts(CampaignId)];
|
|
116
|
-
case 1:
|
|
117
|
-
_b = _c.sent(), sessionCount = _b.sessionCount, dailyCount = _b.dailyCount, totalCount = _b.totalCount;
|
|
118
|
-
return [2 /*return*/, ((!SessionCap || sessionCount < SessionCap) &&
|
|
119
|
-
(!DailyCap || dailyCount < DailyCap) &&
|
|
120
|
-
(!TotalCap || totalCount < TotalCap))];
|
|
121
|
-
}
|
|
122
|
-
});
|
|
123
|
-
});
|
|
82
|
+
async function isBelowCap({ CampaignId, SessionCap, DailyCap, TotalCap, }) {
|
|
83
|
+
const { sessionCount, dailyCount, totalCount } = await getMessageCounts(CampaignId);
|
|
84
|
+
return ((!SessionCap || sessionCount < SessionCap) &&
|
|
85
|
+
(!DailyCap || dailyCount < DailyCap) &&
|
|
86
|
+
(!TotalCap || totalCount < TotalCap));
|
|
124
87
|
}
|
|
125
|
-
function getMessageCounts(messageId) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
});
|
|
148
|
-
});
|
|
88
|
+
async function getMessageCounts(messageId) {
|
|
89
|
+
let messageCounts = {
|
|
90
|
+
sessionCount: 0,
|
|
91
|
+
dailyCount: 0,
|
|
92
|
+
totalCount: 0,
|
|
93
|
+
};
|
|
94
|
+
try {
|
|
95
|
+
// only return true counts if there is a messageId else default to 0
|
|
96
|
+
if (messageId)
|
|
97
|
+
messageCounts = {
|
|
98
|
+
sessionCount: getSessionCount(messageId),
|
|
99
|
+
dailyCount: await getDailyCount(),
|
|
100
|
+
totalCount: await getTotalCount(messageId),
|
|
101
|
+
};
|
|
102
|
+
return messageCounts;
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
logger.error('Failed to get message counts from storage', err);
|
|
106
|
+
// If there are no cached counts or there is an error,
|
|
107
|
+
// we default to 0 allowing all the messages to be eligible
|
|
108
|
+
return messageCounts;
|
|
109
|
+
}
|
|
149
110
|
}
|
|
150
111
|
function getSessionCount(messageId) {
|
|
151
|
-
|
|
152
|
-
return (_a = sessionMessageCountMap[messageId]) !== null && _a !== void 0 ? _a : 0;
|
|
112
|
+
return sessionMessageCountMap[messageId] ?? 0;
|
|
153
113
|
}
|
|
154
114
|
function setSessionCount(messageId, count) {
|
|
155
115
|
sessionMessageCountMap[messageId] = count;
|
|
156
116
|
}
|
|
157
117
|
function setDailyCount(count) {
|
|
158
|
-
|
|
159
|
-
count
|
|
118
|
+
const dailyCount = {
|
|
119
|
+
count,
|
|
160
120
|
lastCountTimestamp: getStartOfDay(),
|
|
161
121
|
};
|
|
162
122
|
try {
|
|
@@ -174,71 +134,36 @@ function setTotalCountMap(countMap) {
|
|
|
174
134
|
logger.error('Failed to save total count to storage', err);
|
|
175
135
|
}
|
|
176
136
|
}
|
|
177
|
-
function setTotalCount(messageId, count) {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
case 1:
|
|
185
|
-
totalCountMap = _b.sent();
|
|
186
|
-
updatedMap = tslib_1.__assign(tslib_1.__assign({}, totalCountMap), (_a = {}, _a[messageId] = count, _a));
|
|
187
|
-
setTotalCountMap(updatedMap);
|
|
188
|
-
return [2 /*return*/];
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
});
|
|
137
|
+
async function setTotalCount(messageId, count) {
|
|
138
|
+
const totalCountMap = await getTotalCountMap();
|
|
139
|
+
const updatedMap = {
|
|
140
|
+
...totalCountMap,
|
|
141
|
+
[messageId]: count,
|
|
142
|
+
};
|
|
143
|
+
setTotalCountMap(updatedMap);
|
|
192
144
|
}
|
|
193
|
-
function getDailyCount() {
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
item = _a.sent();
|
|
203
|
-
counter = item
|
|
204
|
-
? JSON.parse(item)
|
|
205
|
-
: { count: 0, lastCountTimestamp: today };
|
|
206
|
-
// If the stored counter timestamp is today, use it as the count, otherwise reset to 0
|
|
207
|
-
return [2 /*return*/, counter.lastCountTimestamp === today ? counter.count : 0];
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
});
|
|
145
|
+
async function getDailyCount() {
|
|
146
|
+
const today = getStartOfDay();
|
|
147
|
+
const item = await core_1.defaultStorage.getItem(MESSAGE_DAILY_COUNT_KEY);
|
|
148
|
+
// Parse stored count or initialize as empty count
|
|
149
|
+
const counter = item
|
|
150
|
+
? JSON.parse(item)
|
|
151
|
+
: { count: 0, lastCountTimestamp: today };
|
|
152
|
+
// If the stored counter timestamp is today, use it as the count, otherwise reset to 0
|
|
153
|
+
return counter.lastCountTimestamp === today ? counter.count : 0;
|
|
211
154
|
}
|
|
212
|
-
function getTotalCountMap() {
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
switch (_a.label) {
|
|
217
|
-
case 0: return [4 /*yield*/, core_1.defaultStorage.getItem(MESSAGE_TOTAL_COUNT_KEY)];
|
|
218
|
-
case 1:
|
|
219
|
-
item = _a.sent();
|
|
220
|
-
// Parse stored count map or initialize as empty
|
|
221
|
-
return [2 /*return*/, item ? JSON.parse(item) : {}];
|
|
222
|
-
}
|
|
223
|
-
});
|
|
224
|
-
});
|
|
155
|
+
async function getTotalCountMap() {
|
|
156
|
+
const item = await core_1.defaultStorage.getItem(MESSAGE_TOTAL_COUNT_KEY);
|
|
157
|
+
// Parse stored count map or initialize as empty
|
|
158
|
+
return item ? JSON.parse(item) : {};
|
|
225
159
|
}
|
|
226
|
-
function getTotalCount(messageId) {
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
switch (_a.label) {
|
|
231
|
-
case 0: return [4 /*yield*/, getTotalCountMap()];
|
|
232
|
-
case 1:
|
|
233
|
-
countMap = _a.sent();
|
|
234
|
-
// Return stored count or initialize as empty count
|
|
235
|
-
return [2 /*return*/, countMap[messageId] || 0];
|
|
236
|
-
}
|
|
237
|
-
});
|
|
238
|
-
});
|
|
160
|
+
async function getTotalCount(messageId) {
|
|
161
|
+
const countMap = await getTotalCountMap();
|
|
162
|
+
// Return stored count or initialize as empty count
|
|
163
|
+
return countMap[messageId] || 0;
|
|
239
164
|
}
|
|
240
|
-
|
|
241
|
-
|
|
165
|
+
const getStartOfDay = () => {
|
|
166
|
+
const now = new Date();
|
|
242
167
|
now.setHours(0, 0, 0, 0);
|
|
243
168
|
return now.toISOString();
|
|
244
169
|
};
|
|
@@ -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
|
-
|
|
6
|
-
|
|
5
|
+
exports.resolveConfig = void 0;
|
|
6
|
+
const core_1 = require("@aws-amplify/core");
|
|
7
|
+
const errors_1 = require("../../../errors");
|
|
7
8
|
/**
|
|
8
9
|
* @internal
|
|
9
10
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
errors_1.assertValidationError(!!
|
|
14
|
-
|
|
15
|
-
return { appId: appId, region: region };
|
|
11
|
+
const resolveConfig = () => {
|
|
12
|
+
const { appId, region } = core_1.Amplify.getConfig().Notifications?.InAppMessaging?.Pinpoint ?? {};
|
|
13
|
+
(0, errors_1.assertValidationError)(!!appId, errors_1.InAppMessagingValidationErrorCode.NoAppId);
|
|
14
|
+
(0, errors_1.assertValidationError)(!!region, errors_1.InAppMessagingValidationErrorCode.NoRegion);
|
|
15
|
+
return { appId, region };
|
|
16
16
|
};
|
|
17
|
+
exports.resolveConfig = resolveConfig;
|
|
@@ -2,21 +2,15 @@
|
|
|
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.resolveCredentials = void 0;
|
|
6
|
+
const core_1 = require("@aws-amplify/core");
|
|
7
|
+
const errors_1 = require("../../../errors");
|
|
8
8
|
/**
|
|
9
9
|
* @internal
|
|
10
10
|
*/
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_a = _b.sent(), credentials = _a.credentials, identityId = _a.identityId;
|
|
18
|
-
errors_1.assertValidationError(!!credentials, errors_1.InAppMessagingValidationErrorCode.NoCredentials);
|
|
19
|
-
return [2 /*return*/, { credentials: credentials, identityId: identityId }];
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
}); };
|
|
11
|
+
const resolveCredentials = async () => {
|
|
12
|
+
const { credentials, identityId } = await (0, core_1.fetchAuthSession)();
|
|
13
|
+
(0, errors_1.assertValidationError)(!!credentials, errors_1.InAppMessagingValidationErrorCode.NoCredentials);
|
|
14
|
+
return { credentials, identityId };
|
|
15
|
+
};
|
|
16
|
+
exports.resolveCredentials = resolveCredentials;
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInAppMessagingUserAgentString = exports.getInAppMessagingUserAgent = void 0;
|
|
3
4
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
4
5
|
// SPDX-License-Identifier: Apache-2.0
|
|
5
|
-
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
6
7
|
function getInAppMessagingUserAgent(action) {
|
|
7
|
-
return utils_1.getAmplifyUserAgentObject({
|
|
8
|
+
return (0, utils_1.getAmplifyUserAgentObject)({
|
|
8
9
|
category: utils_1.Category.InAppMessaging,
|
|
9
|
-
action
|
|
10
|
+
action,
|
|
10
11
|
});
|
|
11
12
|
}
|
|
12
13
|
exports.getInAppMessagingUserAgent = getInAppMessagingUserAgent;
|
|
13
14
|
function getInAppMessagingUserAgentString(action) {
|
|
14
|
-
return utils_1.getAmplifyUserAgent({
|
|
15
|
+
return (0, utils_1.getAmplifyUserAgent)({
|
|
15
16
|
category: utils_1.Category.InAppMessaging,
|
|
16
|
-
action
|
|
17
|
+
action,
|
|
17
18
|
});
|
|
18
19
|
}
|
|
19
20
|
exports.getInAppMessagingUserAgentString = getInAppMessagingUserAgentString;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export type InAppMessageInteractionEvent = 'messageReceived' | 'messageDisplayed' | 'messageDismissed' | 'messageActionTaken';
|
|
2
|
+
export type InAppMessagingEvent = {
|
|
3
3
|
name: string;
|
|
4
4
|
attributes?: Record<string, string>;
|
|
5
5
|
metrics?: Record<string, number>;
|
|
@@ -3,7 +3,7 @@ import { InAppMessagingServiceOptions } from '.';
|
|
|
3
3
|
/**
|
|
4
4
|
* Input type for `identifyUser`.
|
|
5
5
|
*/
|
|
6
|
-
export
|
|
6
|
+
export type InAppMessagingIdentifyUserInput<ServiceOptions extends InAppMessagingServiceOptions = InAppMessagingServiceOptions> = {
|
|
7
7
|
/**
|
|
8
8
|
* A User ID associated to the current device.
|
|
9
9
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export type InAppMessageLayout = 'BOTTOM_BANNER' | 'CAROUSEL' | 'FULL_SCREEN' | 'MIDDLE_BANNER' | 'MODAL' | 'TOP_BANNER';
|
|
2
|
+
export type InAppMessageAction = 'CLOSE' | 'DEEP_LINK' | 'LINK';
|
|
3
|
+
export type InAppMessageTextAlign = 'center' | 'left' | 'right';
|
|
4
4
|
interface InAppMessageContainer {
|
|
5
5
|
style?: InAppMessageStyle;
|
|
6
6
|
}
|
|
@@ -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
|
+
exports.initialize = exports.assertIsInitialized = exports.isInitialized = void 0;
|
|
5
6
|
var statusHelpers_1 = require("./statusHelpers");
|
|
6
|
-
exports
|
|
7
|
-
exports
|
|
8
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "isInitialized", { enumerable: true, get: function () { return statusHelpers_1.isInitialized; } });
|
|
8
|
+
Object.defineProperty(exports, "assertIsInitialized", { enumerable: true, get: function () { return statusHelpers_1.assertIsInitialized; } });
|
|
9
|
+
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return statusHelpers_1.initialize; } });
|
|
@@ -2,23 +2,26 @@
|
|
|
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
|
-
|
|
5
|
+
exports.assertIsInitialized = exports.isInitialized = exports.initialize = void 0;
|
|
6
|
+
const errors_1 = require("../errors");
|
|
7
|
+
let initialized = false;
|
|
7
8
|
/**
|
|
8
9
|
* Sets initialization status to true.
|
|
9
10
|
*
|
|
10
11
|
* @internal
|
|
11
12
|
*/
|
|
12
|
-
|
|
13
|
+
const initialize = () => {
|
|
13
14
|
initialized = true;
|
|
14
15
|
};
|
|
16
|
+
exports.initialize = initialize;
|
|
15
17
|
/**
|
|
16
18
|
* Returns the initialization status of In-App Messaging.
|
|
17
19
|
*
|
|
18
20
|
* @internal
|
|
19
21
|
*/
|
|
20
|
-
|
|
22
|
+
const isInitialized = () => initialized;
|
|
23
|
+
exports.isInitialized = isInitialized;
|
|
21
24
|
function assertIsInitialized() {
|
|
22
|
-
errors_1.assertValidationError(exports.isInitialized(), errors_1.InAppMessagingValidationErrorCode.NotInitialized);
|
|
25
|
+
(0, errors_1.assertValidationError)((0, exports.isInitialized)(), errors_1.InAppMessagingValidationErrorCode.NotInitialized);
|
|
23
26
|
}
|
|
24
27
|
exports.assertIsInitialized = assertIsInitialized;
|
package/lib/index.js
CHANGED
|
@@ -2,18 +2,15 @@
|
|
|
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
|
-
var _this = _super.call(this, params) || this;
|
|
5
|
+
exports.PushNotificationError = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
class PushNotificationError extends utils_1.AmplifyError {
|
|
8
|
+
constructor(params) {
|
|
9
|
+
super(params);
|
|
11
10
|
// Hack for making the custom error class work when transpiled to es5
|
|
12
11
|
// TODO: Delete the following 2 lines after we change the build target to >= es2015
|
|
13
|
-
|
|
14
|
-
Object.setPrototypeOf(
|
|
15
|
-
return _this;
|
|
12
|
+
this.constructor = PushNotificationError;
|
|
13
|
+
Object.setPrototypeOf(this, PushNotificationError.prototype);
|
|
16
14
|
}
|
|
17
|
-
|
|
18
|
-
}(utils_1.AmplifyError));
|
|
15
|
+
}
|
|
19
16
|
exports.PushNotificationError = PushNotificationError;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var _a;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
exports.assertIsInitialized = exports.assert = exports.PushNotificationValidationErrorCode = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
const utils_2 = require("../utils");
|
|
8
|
+
const PushNotificationError_1 = require("./PushNotificationError");
|
|
9
9
|
var PushNotificationValidationErrorCode;
|
|
10
10
|
(function (PushNotificationValidationErrorCode) {
|
|
11
11
|
PushNotificationValidationErrorCode["NoAppId"] = "NoAppId";
|
|
@@ -13,22 +13,23 @@ var PushNotificationValidationErrorCode;
|
|
|
13
13
|
PushNotificationValidationErrorCode["NoRegion"] = "NoRegion";
|
|
14
14
|
PushNotificationValidationErrorCode["NotInitialized"] = "NotInitialized";
|
|
15
15
|
})(PushNotificationValidationErrorCode = exports.PushNotificationValidationErrorCode || (exports.PushNotificationValidationErrorCode = {}));
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
const pushNotificationValidationErrorMap = {
|
|
17
|
+
[PushNotificationValidationErrorCode.NoAppId]: {
|
|
18
18
|
message: 'Missing application id.',
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
[PushNotificationValidationErrorCode.NoCredentials]: {
|
|
21
21
|
message: 'Credentials should not be empty.',
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
[PushNotificationValidationErrorCode.NoRegion]: {
|
|
24
24
|
message: 'Missing region.',
|
|
25
25
|
},
|
|
26
|
-
|
|
26
|
+
[PushNotificationValidationErrorCode.NotInitialized]: {
|
|
27
27
|
message: 'Push notification has not been initialized.',
|
|
28
28
|
recoverySuggestion: 'Please make sure to first call `initializePushNotifications`.',
|
|
29
29
|
},
|
|
30
|
-
_a);
|
|
31
|
-
exports.assert = utils_1.createAssertionFunction(pushNotificationValidationErrorMap, PushNotificationError_1.PushNotificationError);
|
|
32
|
-
exports.assertIsInitialized = function () {
|
|
33
|
-
exports.assert(utils_2.isInitialized(), PushNotificationValidationErrorCode.NotInitialized);
|
|
34
30
|
};
|
|
31
|
+
exports.assert = (0, utils_1.createAssertionFunction)(pushNotificationValidationErrorMap, PushNotificationError_1.PushNotificationError);
|
|
32
|
+
const assertIsInitialized = () => {
|
|
33
|
+
(0, exports.assert)((0, utils_2.isInitialized)(), PushNotificationValidationErrorCode.NotInitialized);
|
|
34
|
+
};
|
|
35
|
+
exports.assertIsInitialized = assertIsInitialized;
|
|
@@ -2,8 +2,9 @@
|
|
|
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.PushNotificationValidationErrorCode = exports.assert = exports.PushNotificationError = void 0;
|
|
5
6
|
var PushNotificationError_1 = require("./PushNotificationError");
|
|
6
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "PushNotificationError", { enumerable: true, get: function () { return PushNotificationError_1.PushNotificationError; } });
|
|
7
8
|
var errorHelpers_1 = require("./errorHelpers");
|
|
8
|
-
exports
|
|
9
|
-
exports
|
|
9
|
+
Object.defineProperty(exports, "assert", { enumerable: true, get: function () { return errorHelpers_1.assert; } });
|
|
10
|
+
Object.defineProperty(exports, "PushNotificationValidationErrorCode", { enumerable: true, get: function () { return errorHelpers_1.PushNotificationValidationErrorCode; } });
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { getBadgeCount, getLaunchNotification, GetLaunchNotificationOutput, getPermissionStatus, GetPermissionStatusOutput, identifyUser, IdentifyUserInput, initializePushNotifications, onNotificationOpened, OnNotificationOpenedInput, OnNotificationOpenedOutput, onNotificationReceivedInBackground, OnNotificationReceivedInBackgroundInput, OnNotificationReceivedInBackgroundOutput, onNotificationReceivedInForeground, OnNotificationReceivedInForegroundInput, OnNotificationReceivedInForegroundOutput, onTokenReceived, OnTokenReceivedInput, OnTokenReceivedOutput, requestPermissions, RequestPermissionsInput, setBadgeCount, SetBadgeCountInput, } from './providers/pinpoint';
|
|
1
|
+
export { getBadgeCount, GetBadgeCountOutput, getLaunchNotification, GetLaunchNotificationOutput, getPermissionStatus, GetPermissionStatusOutput, identifyUser, IdentifyUserInput, initializePushNotifications, onNotificationOpened, OnNotificationOpenedInput, OnNotificationOpenedOutput, onNotificationReceivedInBackground, OnNotificationReceivedInBackgroundInput, OnNotificationReceivedInBackgroundOutput, onNotificationReceivedInForeground, OnNotificationReceivedInForegroundInput, OnNotificationReceivedInForegroundOutput, onTokenReceived, OnTokenReceivedInput, OnTokenReceivedOutput, requestPermissions, RequestPermissionsInput, setBadgeCount, SetBadgeCountInput, } from './providers/pinpoint';
|
|
2
2
|
export { PushNotificationMessage } from './types';
|
|
3
3
|
export { PushNotificationError } from './errors';
|