@aws-amplify/notifications 2.0.1-api-v6-models.9351bcf.0 → 2.0.1-api-v6-models.891fe0d.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/in-app-messaging/package.json +4 -4
- package/lib/eventListeners/eventListeners.js +19 -37
- package/lib/eventListeners/index.js +4 -3
- package/lib/eventListeners/types.d.ts +2 -2
- package/lib/inAppMessaging/errors/InAppMessagingError.js +8 -11
- package/lib/inAppMessaging/errors/assertServiceError.js +3 -2
- package/lib/inAppMessaging/errors/assertValidationError.js +5 -4
- package/lib/inAppMessaging/errors/index.js +6 -5
- package/lib/inAppMessaging/errors/validation.js +7 -7
- package/lib/inAppMessaging/index.d.ts +2 -1
- package/lib/inAppMessaging/index.js +12 -10
- package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/clearMessages.js +26 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +26 -38
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -1
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +24 -35
- package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/index.js +13 -10
- package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +21 -21
- package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +6 -6
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +5 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +5 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +5 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +5 -4
- package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +6 -6
- package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +46 -76
- package/lib/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
- package/lib/inAppMessaging/providers/pinpoint/index.js +12 -10
- package/lib/inAppMessaging/providers/pinpoint/types/index.js +2 -1
- package/lib/inAppMessaging/providers/pinpoint/types/inputs.d.ts +8 -8
- package/lib/inAppMessaging/providers/pinpoint/types/options.d.ts +1 -1
- package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +4 -4
- package/lib/inAppMessaging/providers/pinpoint/types/types.d.ts +6 -6
- package/lib/inAppMessaging/providers/pinpoint/types/types.js +1 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/constants.js +1 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +3 -3
- package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +114 -110
- package/lib/inAppMessaging/providers/pinpoint/utils/index.js +11 -10
- package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +116 -191
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +9 -8
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +1 -1
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +9 -15
- package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js +6 -5
- package/lib/inAppMessaging/types/event.d.ts +2 -2
- package/lib/inAppMessaging/types/inputs.d.ts +1 -1
- package/lib/inAppMessaging/types/message.d.ts +3 -3
- package/lib/inAppMessaging/types/options.d.ts +1 -1
- package/lib/inAppMessaging/utils/index.js +4 -3
- package/lib/inAppMessaging/utils/statusHelpers.js +8 -5
- package/lib/index.js +1 -0
- package/lib/pushNotifications/errors/PushNotificationError.js +8 -11
- package/lib/pushNotifications/errors/errorHelpers.js +14 -13
- package/lib/pushNotifications/errors/index.js +4 -3
- package/lib/pushNotifications/index.d.ts +1 -1
- package/lib/pushNotifications/index.js +13 -12
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +9 -10
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +25 -36
- package/lib/pushNotifications/providers/pinpoint/apis/index.js +12 -11
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -1
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +90 -115
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +4 -2
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +7 -5
- package/lib/pushNotifications/providers/pinpoint/index.d.ts +1 -1
- package/lib/pushNotifications/providers/pinpoint/index.js +12 -11
- package/lib/pushNotifications/providers/pinpoint/types/analytics.d.ts +3 -3
- package/lib/pushNotifications/providers/pinpoint/types/apis.d.ts +11 -11
- package/lib/pushNotifications/providers/pinpoint/types/inputs.d.ts +7 -7
- package/lib/pushNotifications/providers/pinpoint/types/options.d.ts +1 -1
- package/lib/pushNotifications/providers/pinpoint/types/outputs.d.ts +8 -8
- package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +1 -1
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +3 -2
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +33 -49
- package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +3 -2
- package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +17 -13
- package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +2 -1
- package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js +9 -7
- package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +2 -1
- package/lib/pushNotifications/providers/pinpoint/utils/index.js +7 -4
- package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.js +17 -0
- package/lib/pushNotifications/types/errors.js +1 -0
- package/lib/pushNotifications/types/index.d.ts +1 -0
- package/lib/pushNotifications/types/index.js +20 -2
- package/lib/pushNotifications/types/inputs.d.ts +9 -8
- package/lib/pushNotifications/types/module.d.ts +31 -0
- package/lib/pushNotifications/types/options.d.ts +1 -1
- package/lib/pushNotifications/types/outputs.d.ts +8 -8
- package/lib/pushNotifications/types/pushNotifications.d.ts +4 -5
- package/lib/pushNotifications/utils/getPushNotificationUserAgentString.js +11 -0
- package/lib/pushNotifications/utils/index.d.ts +1 -1
- package/lib/pushNotifications/utils/index.js +8 -7
- package/lib/pushNotifications/utils/initializationManager.js +8 -9
- package/lib/pushNotifications/utils/resolveCredentials.d.ts +1 -1
- package/lib/pushNotifications/utils/resolveCredentials.js +9 -15
- package/lib/pushNotifications/utils/tokenManager.js +6 -3
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib-esm/eventListeners/eventListeners.js +15 -37
- package/lib-esm/eventListeners/types.d.ts +2 -2
- package/lib-esm/eventListeners/types.js +1 -0
- package/lib-esm/inAppMessaging/errors/InAppMessagingError.js +6 -11
- package/lib-esm/inAppMessaging/errors/assertValidationError.js +2 -2
- package/lib-esm/inAppMessaging/errors/validation.js +6 -7
- package/lib-esm/inAppMessaging/index.d.ts +2 -1
- package/lib-esm/inAppMessaging/index.js +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.d.ts +13 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/clearMessages.js +22 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +15 -31
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +2 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +18 -31
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +5 -6
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +1 -2
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +4 -5
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +38 -69
- package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/index.js +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +8 -8
- package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.js +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/options.d.ts +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/options.js +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +4 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.js +1 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/types.d.ts +6 -6
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js +4 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.d.ts +3 -3
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +85 -97
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +111 -187
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +3 -4
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +5 -13
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js +2 -2
- package/lib-esm/inAppMessaging/types/event.d.ts +2 -2
- package/lib-esm/inAppMessaging/types/event.js +1 -0
- package/lib-esm/inAppMessaging/types/index.js +1 -0
- package/lib-esm/inAppMessaging/types/inputs.d.ts +1 -1
- package/lib-esm/inAppMessaging/types/inputs.js +1 -0
- package/lib-esm/inAppMessaging/types/message.d.ts +3 -3
- package/lib-esm/inAppMessaging/types/message.js +1 -0
- package/lib-esm/inAppMessaging/types/options.d.ts +1 -1
- package/lib-esm/inAppMessaging/types/options.js +1 -0
- package/lib-esm/inAppMessaging/utils/statusHelpers.js +3 -3
- package/lib-esm/index.js +1 -0
- package/lib-esm/pushNotifications/errors/PushNotificationError.js +6 -11
- package/lib-esm/pushNotifications/errors/errorHelpers.js +8 -9
- package/lib-esm/pushNotifications/index.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +5 -8
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +2 -2
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +2 -2
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +20 -33
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +76 -103
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +2 -2
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +2 -2
- package/lib-esm/pushNotifications/providers/pinpoint/index.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.d.ts +3 -3
- package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/apis.d.ts +11 -11
- package/lib-esm/pushNotifications/providers/pinpoint/types/apis.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/index.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.d.ts +7 -7
- package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/options.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/types/options.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.d.ts +8 -8
- package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +1 -1
- package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +3 -2
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +27 -45
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +3 -2
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +15 -13
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +2 -1
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js +5 -5
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +2 -1
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +2 -1
- package/lib-esm/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.js +4 -5
- package/lib-esm/pushNotifications/types/index.d.ts +1 -0
- package/lib-esm/pushNotifications/types/index.js +5 -0
- package/lib-esm/pushNotifications/types/inputs.d.ts +9 -8
- package/lib-esm/pushNotifications/types/inputs.js +1 -0
- package/lib-esm/pushNotifications/types/module.d.ts +31 -0
- package/lib-esm/pushNotifications/{Platform/types.js → types/module.js} +1 -0
- package/lib-esm/pushNotifications/types/options.d.ts +1 -1
- package/lib-esm/pushNotifications/types/options.js +1 -0
- package/lib-esm/pushNotifications/types/outputs.d.ts +8 -8
- package/lib-esm/pushNotifications/types/outputs.js +1 -0
- package/lib-esm/pushNotifications/types/pushNotifications.d.ts +4 -5
- package/lib-esm/pushNotifications/types/pushNotifications.js +1 -0
- package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.js +4 -6
- package/lib-esm/pushNotifications/utils/index.d.ts +1 -1
- package/lib-esm/pushNotifications/utils/index.js +1 -1
- package/lib-esm/pushNotifications/utils/initializationManager.js +5 -9
- package/lib-esm/pushNotifications/utils/resolveCredentials.d.ts +1 -1
- package/lib-esm/pushNotifications/utils/resolveCredentials.js +5 -13
- package/lib-esm/pushNotifications/utils/tokenManager.js +3 -3
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -30
- package/src/inAppMessaging/index.ts +12 -0
- package/src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts +26 -0
- package/src/inAppMessaging/providers/pinpoint/apis/index.ts +1 -0
- package/src/inAppMessaging/providers/pinpoint/index.ts +1 -0
- package/src/inAppMessaging/providers/pinpoint/utils/helpers.ts +38 -28
- package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +25 -9
- package/src/inAppMessaging/providers/pinpoint/utils/resolveConfig.ts +1 -1
- package/src/pushNotifications/index.ts +1 -0
- package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +5 -2
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +51 -41
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/index.ts +1 -0
- package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +5 -4
- package/src/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.ts +7 -4
- package/src/pushNotifications/providers/pinpoint/utils/getChannelType.ts +1 -1
- package/src/pushNotifications/providers/pinpoint/utils/index.ts +2 -1
- package/src/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.ts +2 -2
- package/src/pushNotifications/types/index.ts +1 -0
- package/src/pushNotifications/types/inputs.ts +1 -1
- package/src/pushNotifications/types/module.ts +42 -0
- package/src/pushNotifications/types/outputs.ts +1 -1
- package/src/pushNotifications/types/pushNotifications.ts +2 -7
- package/src/pushNotifications/utils/index.ts +1 -1
- package/lib/inAppMessaging/providers/index.d.ts +0 -2
- package/lib/inAppMessaging/providers/index.js +0 -15
- package/lib/pushNotifications/Platform/index.d.ts +0 -2
- package/lib/pushNotifications/Platform/index.js +0 -25
- package/lib/pushNotifications/Platform/index.native.d.ts +0 -2
- package/lib/pushNotifications/Platform/index.native.js +0 -7
- package/lib/pushNotifications/Platform/types.d.ts +0 -5
- package/lib/pushNotifications/providers/pinpoint/utils/getPushNotificationUserAgentString.js +0 -11
- package/lib/pushNotifications/utils/resolveConfig.js +0 -16
- package/lib/tsconfig.build.tsbuildinfo +0 -8667
- package/lib-esm/inAppMessaging/providers/index.d.ts +0 -2
- package/lib-esm/inAppMessaging/providers/index.js +0 -3
- package/lib-esm/pushNotifications/Platform/index.d.ts +0 -2
- package/lib-esm/pushNotifications/Platform/index.js +0 -23
- package/lib-esm/pushNotifications/Platform/index.native.d.ts +0 -2
- package/lib-esm/pushNotifications/Platform/index.native.js +0 -5
- package/lib-esm/pushNotifications/Platform/types.d.ts +0 -5
- package/lib-esm/tsconfig.build.tsbuildinfo +0 -7115
- package/src/inAppMessaging/providers/index.ts +0 -38
- package/src/pushNotifications/Platform/index.native.ts +0 -9
- package/src/pushNotifications/Platform/index.ts +0 -22
- package/src/pushNotifications/Platform/types.ts +0 -15
- /package/lib/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.d.ts +0 -0
- /package/lib/pushNotifications/{Platform/types.js → types/module.js} +0 -0
- /package/lib/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.d.ts +0 -0
- /package/lib-esm/pushNotifications/{utils → providers/pinpoint/utils}/resolveConfig.d.ts +0 -0
- /package/lib-esm/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.d.ts +0 -0
- /package/src/pushNotifications/{providers/pinpoint/utils → utils}/getPushNotificationUserAgentString.ts +0 -0
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
2
2
|
// SPDX-License-Identifier: Apache-2.0
|
|
3
|
-
import { __read } from "tslib";
|
|
4
3
|
import { ConsoleLogger } from '@aws-amplify/core';
|
|
5
4
|
import { InAppMessagingAction } from '@aws-amplify/core/internals/utils';
|
|
6
5
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -9,60 +8,54 @@ import { resolveConfig } from './resolveConfig';
|
|
|
9
8
|
import { resolveCredentials } from './resolveCredentials';
|
|
10
9
|
import { CATEGORY } from './constants';
|
|
11
10
|
import { getInAppMessagingUserAgentString } from './userAgent';
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
const DELIVERY_TYPE = 'IN_APP_MESSAGE';
|
|
12
|
+
let eventNameMemo = {};
|
|
13
|
+
let eventAttributesMemo = {};
|
|
14
|
+
let eventMetricsMemo = {};
|
|
15
|
+
export const logger = new ConsoleLogger('InAppMessaging.Pinpoint.Utils');
|
|
16
|
+
export const recordAnalyticsEvent = (event, message) => {
|
|
17
|
+
const { appId, region } = resolveConfig();
|
|
18
|
+
const { id, metadata } = message;
|
|
20
19
|
resolveCredentials()
|
|
21
|
-
.then(
|
|
22
|
-
var credentials = _a.credentials, identityId = _a.identityId;
|
|
20
|
+
.then(({ credentials, identityId }) => {
|
|
23
21
|
recordCore({
|
|
24
|
-
appId
|
|
22
|
+
appId,
|
|
25
23
|
category: CATEGORY,
|
|
26
|
-
credentials
|
|
24
|
+
credentials,
|
|
27
25
|
event: {
|
|
28
26
|
name: event,
|
|
29
27
|
attributes: {
|
|
30
|
-
campaign_id
|
|
28
|
+
// only include campaign_id field if we have one
|
|
29
|
+
...(id && { campaign_id: id }),
|
|
31
30
|
delivery_type: DELIVERY_TYPE,
|
|
32
|
-
treatment_id: metadata
|
|
31
|
+
treatment_id: metadata?.treatmentId,
|
|
33
32
|
},
|
|
34
33
|
},
|
|
35
|
-
identityId
|
|
36
|
-
region
|
|
37
|
-
userAgentValue: getInAppMessagingUserAgentString(InAppMessagingAction.
|
|
34
|
+
identityId,
|
|
35
|
+
region,
|
|
36
|
+
userAgentValue: getInAppMessagingUserAgentString(InAppMessagingAction.NotifyMessageInteraction),
|
|
38
37
|
});
|
|
39
38
|
})
|
|
40
|
-
.catch(
|
|
39
|
+
.catch(e => {
|
|
41
40
|
// An error occured while fetching credentials or persisting the event to the buffer
|
|
42
41
|
logger.warn('Failed to record event.', e);
|
|
43
42
|
});
|
|
44
43
|
};
|
|
45
|
-
export
|
|
46
|
-
|
|
44
|
+
export const getStartOfDay = () => {
|
|
45
|
+
const now = new Date();
|
|
47
46
|
now.setHours(0, 0, 0, 0);
|
|
48
47
|
return now.toISOString();
|
|
49
48
|
};
|
|
50
|
-
export
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var _c;
|
|
54
|
-
var EventType = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).EventType;
|
|
55
|
-
var memoKey = CampaignId + ":" + eventType;
|
|
49
|
+
export const matchesEventType = ({ CampaignId, Schedule }, { name: eventType }) => {
|
|
50
|
+
const { EventType } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
51
|
+
const memoKey = `${CampaignId}:${eventType}`;
|
|
56
52
|
if (!eventNameMemo.hasOwnProperty(memoKey)) {
|
|
57
|
-
eventNameMemo[memoKey] = !!
|
|
53
|
+
eventNameMemo[memoKey] = !!EventType?.Values?.includes(eventType);
|
|
58
54
|
}
|
|
59
55
|
return eventNameMemo[memoKey];
|
|
60
56
|
};
|
|
61
|
-
export
|
|
62
|
-
|
|
63
|
-
var attributes = _b.attributes;
|
|
64
|
-
var _c;
|
|
65
|
-
var Attributes = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).Attributes;
|
|
57
|
+
export const matchesAttributes = ({ CampaignId, Schedule }, { attributes = {} }) => {
|
|
58
|
+
const { Attributes } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
66
59
|
if (isEmpty(Attributes)) {
|
|
67
60
|
// if message does not have attributes defined it does not matter what attributes are on the event
|
|
68
61
|
return true;
|
|
@@ -71,20 +64,16 @@ export var matchesAttributes = function (_a, _b) {
|
|
|
71
64
|
// if message does have attributes but the event does not then it always fails the check
|
|
72
65
|
return false;
|
|
73
66
|
}
|
|
74
|
-
|
|
67
|
+
const memoKey = `${CampaignId}:${JSON.stringify(attributes)}`;
|
|
75
68
|
if (!eventAttributesMemo.hasOwnProperty(memoKey)) {
|
|
76
|
-
eventAttributesMemo[memoKey] =
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
});
|
|
69
|
+
eventAttributesMemo[memoKey] =
|
|
70
|
+
!Attributes ||
|
|
71
|
+
Object.entries(Attributes).every(([key, { Values }]) => Values?.includes(attributes[key]));
|
|
80
72
|
}
|
|
81
73
|
return eventAttributesMemo[memoKey];
|
|
82
74
|
};
|
|
83
|
-
export
|
|
84
|
-
|
|
85
|
-
var metrics = _b.metrics;
|
|
86
|
-
var _c;
|
|
87
|
-
var Metrics = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).Metrics;
|
|
75
|
+
export const matchesMetrics = ({ CampaignId, Schedule }, { metrics = {} }) => {
|
|
76
|
+
const { Metrics } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
88
77
|
if (isEmpty(Metrics)) {
|
|
89
78
|
// if message does not have metrics defined it does not matter what metrics are on the event
|
|
90
79
|
return true;
|
|
@@ -93,47 +82,47 @@ export var matchesMetrics = function (_a, _b) {
|
|
|
93
82
|
// if message does have metrics but the event does not then it always fails the check
|
|
94
83
|
return false;
|
|
95
84
|
}
|
|
96
|
-
|
|
85
|
+
const memoKey = `${CampaignId}:${JSON.stringify(metrics)}`;
|
|
97
86
|
if (!eventMetricsMemo.hasOwnProperty(memoKey)) {
|
|
98
|
-
eventMetricsMemo[memoKey] =
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
87
|
+
eventMetricsMemo[memoKey] =
|
|
88
|
+
!Metrics ||
|
|
89
|
+
Object.entries(Metrics).every(([key, { ComparisonOperator, Value }]) => {
|
|
90
|
+
const compare = getComparator(ComparisonOperator);
|
|
91
|
+
// if there is some unknown comparison operator, treat as a comparison failure
|
|
92
|
+
return compare && !!Value ? compare(Value, metrics[key]) : false;
|
|
93
|
+
});
|
|
104
94
|
}
|
|
105
95
|
return eventMetricsMemo[memoKey];
|
|
106
96
|
};
|
|
107
|
-
export
|
|
97
|
+
export const getComparator = (operator) => {
|
|
108
98
|
switch (operator) {
|
|
109
99
|
case 'EQUAL':
|
|
110
|
-
return
|
|
100
|
+
return (metricsVal, eventVal) => metricsVal === eventVal;
|
|
111
101
|
case 'GREATER_THAN':
|
|
112
|
-
return
|
|
102
|
+
return (metricsVal, eventVal) => metricsVal < eventVal;
|
|
113
103
|
case 'GREATER_THAN_OR_EQUAL':
|
|
114
|
-
return
|
|
104
|
+
return (metricsVal, eventVal) => metricsVal <= eventVal;
|
|
115
105
|
case 'LESS_THAN':
|
|
116
|
-
return
|
|
106
|
+
return (metricsVal, eventVal) => metricsVal > eventVal;
|
|
117
107
|
case 'LESS_THAN_OR_EQUAL':
|
|
118
|
-
return
|
|
108
|
+
return (metricsVal, eventVal) => metricsVal >= eventVal;
|
|
119
109
|
default:
|
|
120
|
-
return
|
|
110
|
+
return undefined;
|
|
121
111
|
}
|
|
122
112
|
};
|
|
123
|
-
export
|
|
124
|
-
|
|
125
|
-
if (!(Schedule === null || Schedule === void 0 ? void 0 : Schedule.EndDate)) {
|
|
113
|
+
export const isBeforeEndDate = ({ Schedule, }) => {
|
|
114
|
+
if (!Schedule?.EndDate) {
|
|
126
115
|
return true;
|
|
127
116
|
}
|
|
128
117
|
return new Date() < new Date(Schedule.EndDate);
|
|
129
118
|
};
|
|
130
|
-
export
|
|
131
|
-
|
|
132
|
-
if (!
|
|
119
|
+
export const isQuietTime = (message) => {
|
|
120
|
+
const { Schedule } = message;
|
|
121
|
+
if (!Schedule?.QuietTime) {
|
|
133
122
|
return false;
|
|
134
123
|
}
|
|
135
|
-
|
|
136
|
-
|
|
124
|
+
const pattern = /^[0-2]\d:[0-5]\d$/; // basic sanity check, not a fully featured HH:MM validation
|
|
125
|
+
const { Start, End } = Schedule.QuietTime;
|
|
137
126
|
if (!Start ||
|
|
138
127
|
!End ||
|
|
139
128
|
Start === End ||
|
|
@@ -141,24 +130,24 @@ export var isQuietTime = function (message) {
|
|
|
141
130
|
!pattern.test(End)) {
|
|
142
131
|
return false;
|
|
143
132
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
133
|
+
const now = new Date();
|
|
134
|
+
const start = new Date(now);
|
|
135
|
+
const end = new Date(now);
|
|
136
|
+
const [startHours, startMinutes] = Start.split(':');
|
|
137
|
+
const [endHours, endMinutes] = End.split(':');
|
|
149
138
|
start.setHours(Number.parseInt(startHours, 10), Number.parseInt(startMinutes, 10), 0, 0);
|
|
150
139
|
end.setHours(Number.parseInt(endHours, 10), Number.parseInt(endMinutes, 10), 0, 0);
|
|
151
140
|
// if quiet time includes midnight, bump the end time to the next day
|
|
152
141
|
if (start > end) {
|
|
153
142
|
end.setDate(end.getDate() + 1);
|
|
154
143
|
}
|
|
155
|
-
|
|
144
|
+
const isQuietTime = now >= start && now <= end;
|
|
156
145
|
if (isQuietTime) {
|
|
157
146
|
logger.debug('message filtered due to quiet time', message);
|
|
158
147
|
}
|
|
159
148
|
return isQuietTime;
|
|
160
149
|
};
|
|
161
|
-
export
|
|
150
|
+
export const clearMemo = () => {
|
|
162
151
|
eventNameMemo = {};
|
|
163
152
|
eventAttributesMemo = {};
|
|
164
153
|
eventMetricsMemo = {};
|
|
@@ -172,7 +161,7 @@ export var clearMemo = function () {
|
|
|
172
161
|
// - 1. the usage of MOBILE_FEED and OVERLAYS as values for message layouts are not leaked
|
|
173
162
|
// outside the Pinpoint provider
|
|
174
163
|
// - 2. Amplify correctly handles the legacy layout values from Pinpoint after they are updated
|
|
175
|
-
export
|
|
164
|
+
export const interpretLayout = (layout) => {
|
|
176
165
|
if (layout === 'MOBILE_FEED') {
|
|
177
166
|
return 'MODAL';
|
|
178
167
|
}
|
|
@@ -182,14 +171,12 @@ export var interpretLayout = function (layout) {
|
|
|
182
171
|
// cast as PinpointInAppMessage['InAppMessage']['Layout'] allows `string` as a value
|
|
183
172
|
return layout;
|
|
184
173
|
};
|
|
185
|
-
export
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
var defaultSecondaryButton = SecondaryBtn === null || SecondaryBtn === void 0 ? void 0 : SecondaryBtn.DefaultConfig;
|
|
192
|
-
var extractedContent = {};
|
|
174
|
+
export const extractContent = ({ InAppMessage: message, }) => {
|
|
175
|
+
return (message?.Content?.map(content => {
|
|
176
|
+
const { BackgroundColor, BodyConfig, HeaderConfig, ImageUrl, PrimaryBtn, SecondaryBtn, } = content;
|
|
177
|
+
const defaultPrimaryButton = PrimaryBtn?.DefaultConfig;
|
|
178
|
+
const defaultSecondaryButton = SecondaryBtn?.DefaultConfig;
|
|
179
|
+
const extractedContent = {};
|
|
193
180
|
if (BackgroundColor) {
|
|
194
181
|
extractedContent.container = {
|
|
195
182
|
style: {
|
|
@@ -199,19 +186,21 @@ export var extractContent = function (_a) {
|
|
|
199
186
|
}
|
|
200
187
|
if (HeaderConfig) {
|
|
201
188
|
extractedContent.header = {
|
|
202
|
-
|
|
189
|
+
// Default to empty string in rare cases we don't have a Header value
|
|
190
|
+
content: HeaderConfig.Header ?? '',
|
|
203
191
|
style: {
|
|
204
192
|
color: HeaderConfig.TextColor,
|
|
205
|
-
textAlign: HeaderConfig.Alignment
|
|
193
|
+
textAlign: HeaderConfig.Alignment?.toLowerCase(),
|
|
206
194
|
},
|
|
207
195
|
};
|
|
208
196
|
}
|
|
209
197
|
if (BodyConfig) {
|
|
210
198
|
extractedContent.body = {
|
|
211
|
-
|
|
199
|
+
// Default to empty string in rare cases we don't have a Body value
|
|
200
|
+
content: BodyConfig.Body ?? '',
|
|
212
201
|
style: {
|
|
213
202
|
color: BodyConfig.TextColor,
|
|
214
|
-
textAlign: BodyConfig.Alignment
|
|
203
|
+
textAlign: BodyConfig.Alignment?.toLowerCase(),
|
|
215
204
|
},
|
|
216
205
|
};
|
|
217
206
|
}
|
|
@@ -222,7 +211,8 @@ export var extractContent = function (_a) {
|
|
|
222
211
|
}
|
|
223
212
|
if (defaultPrimaryButton) {
|
|
224
213
|
extractedContent.primaryButton = {
|
|
225
|
-
|
|
214
|
+
// Default to empty string in rare cases we don't have a Text value
|
|
215
|
+
title: defaultPrimaryButton.Text ?? '',
|
|
226
216
|
action: defaultPrimaryButton.ButtonAction,
|
|
227
217
|
url: defaultPrimaryButton.Link,
|
|
228
218
|
style: {
|
|
@@ -234,7 +224,8 @@ export var extractContent = function (_a) {
|
|
|
234
224
|
}
|
|
235
225
|
if (defaultSecondaryButton) {
|
|
236
226
|
extractedContent.secondaryButton = {
|
|
237
|
-
|
|
227
|
+
// Default to empty string in rare cases we don't have a Text value
|
|
228
|
+
title: defaultSecondaryButton.Text ?? '',
|
|
238
229
|
action: defaultSecondaryButton.ButtonAction,
|
|
239
230
|
url: defaultSecondaryButton.Link,
|
|
240
231
|
style: {
|
|
@@ -245,14 +236,11 @@ export var extractContent = function (_a) {
|
|
|
245
236
|
};
|
|
246
237
|
}
|
|
247
238
|
return extractedContent;
|
|
248
|
-
})
|
|
249
|
-
};
|
|
250
|
-
export var extractMetadata = function (_a) {
|
|
251
|
-
var InAppMessage = _a.InAppMessage, Priority = _a.Priority, Schedule = _a.Schedule, TreatmentId = _a.TreatmentId;
|
|
252
|
-
return ({
|
|
253
|
-
customData: InAppMessage === null || InAppMessage === void 0 ? void 0 : InAppMessage.CustomConfig,
|
|
254
|
-
endDate: Schedule === null || Schedule === void 0 ? void 0 : Schedule.EndDate,
|
|
255
|
-
priority: Priority,
|
|
256
|
-
treatmentId: TreatmentId,
|
|
257
|
-
});
|
|
239
|
+
}) ?? []);
|
|
258
240
|
};
|
|
241
|
+
export const extractMetadata = ({ InAppMessage, Priority, Schedule, TreatmentId, }) => ({
|
|
242
|
+
customData: InAppMessage?.CustomConfig,
|
|
243
|
+
endDate: Schedule?.EndDate,
|
|
244
|
+
priority: Priority,
|
|
245
|
+
treatmentId: TreatmentId,
|
|
246
|
+
});
|