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