@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,141 +1,141 @@
|
|
|
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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
4
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
8
|
+
exports.extractMetadata = exports.extractContent = exports.interpretLayout = exports.clearMemo = exports.isQuietTime = exports.isBeforeEndDate = exports.getComparator = exports.matchesMetrics = exports.matchesAttributes = exports.matchesEventType = exports.getStartOfDay = exports.recordAnalyticsEvent = exports.logger = void 0;
|
|
9
|
+
const core_1 = require("@aws-amplify/core");
|
|
10
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
11
|
+
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
12
|
+
const pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
13
|
+
const resolveConfig_1 = require("./resolveConfig");
|
|
14
|
+
const resolveCredentials_1 = require("./resolveCredentials");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const userAgent_1 = require("./userAgent");
|
|
17
|
+
const DELIVERY_TYPE = 'IN_APP_MESSAGE';
|
|
18
|
+
let eventNameMemo = {};
|
|
19
|
+
let eventAttributesMemo = {};
|
|
20
|
+
let eventMetricsMemo = {};
|
|
18
21
|
exports.logger = new core_1.ConsoleLogger('InAppMessaging.Pinpoint.Utils');
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
resolveCredentials_1.resolveCredentials()
|
|
23
|
-
.then(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
appId: appId,
|
|
22
|
+
const recordAnalyticsEvent = (event, message) => {
|
|
23
|
+
const { appId, region } = (0, resolveConfig_1.resolveConfig)();
|
|
24
|
+
const { id, metadata } = message;
|
|
25
|
+
(0, resolveCredentials_1.resolveCredentials)()
|
|
26
|
+
.then(({ credentials, identityId }) => {
|
|
27
|
+
(0, pinpoint_1.record)({
|
|
28
|
+
appId,
|
|
27
29
|
category: constants_1.CATEGORY,
|
|
28
|
-
credentials
|
|
30
|
+
credentials,
|
|
29
31
|
event: {
|
|
30
32
|
name: event,
|
|
31
33
|
attributes: {
|
|
32
|
-
campaign_id
|
|
34
|
+
// only include campaign_id field if we have one
|
|
35
|
+
...(id && { campaign_id: id }),
|
|
33
36
|
delivery_type: DELIVERY_TYPE,
|
|
34
|
-
treatment_id: metadata
|
|
37
|
+
treatment_id: metadata?.treatmentId,
|
|
35
38
|
},
|
|
36
39
|
},
|
|
37
|
-
identityId
|
|
38
|
-
region
|
|
39
|
-
userAgentValue: userAgent_1.getInAppMessagingUserAgentString(utils_1.InAppMessagingAction.
|
|
40
|
+
identityId,
|
|
41
|
+
region,
|
|
42
|
+
userAgentValue: (0, userAgent_1.getInAppMessagingUserAgentString)(utils_1.InAppMessagingAction.NotifyMessageInteraction),
|
|
40
43
|
});
|
|
41
44
|
})
|
|
42
|
-
.catch(
|
|
45
|
+
.catch(e => {
|
|
43
46
|
// An error occured while fetching credentials or persisting the event to the buffer
|
|
44
47
|
exports.logger.warn('Failed to record event.', e);
|
|
45
48
|
});
|
|
46
49
|
};
|
|
47
|
-
exports.
|
|
48
|
-
|
|
50
|
+
exports.recordAnalyticsEvent = recordAnalyticsEvent;
|
|
51
|
+
const getStartOfDay = () => {
|
|
52
|
+
const now = new Date();
|
|
49
53
|
now.setHours(0, 0, 0, 0);
|
|
50
54
|
return now.toISOString();
|
|
51
55
|
};
|
|
52
|
-
exports.
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
var EventType = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).EventType;
|
|
57
|
-
var memoKey = CampaignId + ":" + eventType;
|
|
56
|
+
exports.getStartOfDay = getStartOfDay;
|
|
57
|
+
const matchesEventType = ({ CampaignId, Schedule }, { name: eventType }) => {
|
|
58
|
+
const { EventType } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
59
|
+
const memoKey = `${CampaignId}:${eventType}`;
|
|
58
60
|
if (!eventNameMemo.hasOwnProperty(memoKey)) {
|
|
59
|
-
eventNameMemo[memoKey] = !!
|
|
61
|
+
eventNameMemo[memoKey] = !!EventType?.Values?.includes(eventType);
|
|
60
62
|
}
|
|
61
63
|
return eventNameMemo[memoKey];
|
|
62
64
|
};
|
|
63
|
-
exports.
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
var Attributes = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).Attributes;
|
|
68
|
-
if (isEmpty_1.default(Attributes)) {
|
|
65
|
+
exports.matchesEventType = matchesEventType;
|
|
66
|
+
const matchesAttributes = ({ CampaignId, Schedule }, { attributes = {} }) => {
|
|
67
|
+
const { Attributes } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
68
|
+
if ((0, isEmpty_1.default)(Attributes)) {
|
|
69
69
|
// if message does not have attributes defined it does not matter what attributes are on the event
|
|
70
70
|
return true;
|
|
71
71
|
}
|
|
72
|
-
if (isEmpty_1.default(attributes)) {
|
|
72
|
+
if ((0, isEmpty_1.default)(attributes)) {
|
|
73
73
|
// if message does have attributes but the event does not then it always fails the check
|
|
74
74
|
return false;
|
|
75
75
|
}
|
|
76
|
-
|
|
76
|
+
const memoKey = `${CampaignId}:${JSON.stringify(attributes)}`;
|
|
77
77
|
if (!eventAttributesMemo.hasOwnProperty(memoKey)) {
|
|
78
|
-
eventAttributesMemo[memoKey] =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
});
|
|
78
|
+
eventAttributesMemo[memoKey] =
|
|
79
|
+
!Attributes ||
|
|
80
|
+
Object.entries(Attributes).every(([key, { Values }]) => Values?.includes(attributes[key]));
|
|
82
81
|
}
|
|
83
82
|
return eventAttributesMemo[memoKey];
|
|
84
83
|
};
|
|
85
|
-
exports.
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
var Metrics = ((_c = Schedule === null || Schedule === void 0 ? void 0 : Schedule.EventFilter) === null || _c === void 0 ? void 0 : _c.Dimensions).Metrics;
|
|
90
|
-
if (isEmpty_1.default(Metrics)) {
|
|
84
|
+
exports.matchesAttributes = matchesAttributes;
|
|
85
|
+
const matchesMetrics = ({ CampaignId, Schedule }, { metrics = {} }) => {
|
|
86
|
+
const { Metrics } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
87
|
+
if ((0, isEmpty_1.default)(Metrics)) {
|
|
91
88
|
// if message does not have metrics defined it does not matter what metrics are on the event
|
|
92
89
|
return true;
|
|
93
90
|
}
|
|
94
|
-
if (isEmpty_1.default(metrics)) {
|
|
91
|
+
if ((0, isEmpty_1.default)(metrics)) {
|
|
95
92
|
// if message does have metrics but the event does not then it always fails the check
|
|
96
93
|
return false;
|
|
97
94
|
}
|
|
98
|
-
|
|
95
|
+
const memoKey = `${CampaignId}:${JSON.stringify(metrics)}`;
|
|
99
96
|
if (!eventMetricsMemo.hasOwnProperty(memoKey)) {
|
|
100
|
-
eventMetricsMemo[memoKey] =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
97
|
+
eventMetricsMemo[memoKey] =
|
|
98
|
+
!Metrics ||
|
|
99
|
+
Object.entries(Metrics).every(([key, { ComparisonOperator, Value }]) => {
|
|
100
|
+
const compare = (0, exports.getComparator)(ComparisonOperator);
|
|
101
|
+
// if there is some unknown comparison operator, treat as a comparison failure
|
|
102
|
+
return compare && !!Value ? compare(Value, metrics[key]) : false;
|
|
103
|
+
});
|
|
106
104
|
}
|
|
107
105
|
return eventMetricsMemo[memoKey];
|
|
108
106
|
};
|
|
109
|
-
exports.
|
|
107
|
+
exports.matchesMetrics = matchesMetrics;
|
|
108
|
+
const getComparator = (operator) => {
|
|
110
109
|
switch (operator) {
|
|
111
110
|
case 'EQUAL':
|
|
112
|
-
return
|
|
111
|
+
return (metricsVal, eventVal) => metricsVal === eventVal;
|
|
113
112
|
case 'GREATER_THAN':
|
|
114
|
-
return
|
|
113
|
+
return (metricsVal, eventVal) => metricsVal < eventVal;
|
|
115
114
|
case 'GREATER_THAN_OR_EQUAL':
|
|
116
|
-
return
|
|
115
|
+
return (metricsVal, eventVal) => metricsVal <= eventVal;
|
|
117
116
|
case 'LESS_THAN':
|
|
118
|
-
return
|
|
117
|
+
return (metricsVal, eventVal) => metricsVal > eventVal;
|
|
119
118
|
case 'LESS_THAN_OR_EQUAL':
|
|
120
|
-
return
|
|
119
|
+
return (metricsVal, eventVal) => metricsVal >= eventVal;
|
|
121
120
|
default:
|
|
122
|
-
return
|
|
121
|
+
return undefined;
|
|
123
122
|
}
|
|
124
123
|
};
|
|
125
|
-
exports.
|
|
126
|
-
|
|
127
|
-
if (!
|
|
124
|
+
exports.getComparator = getComparator;
|
|
125
|
+
const isBeforeEndDate = ({ Schedule, }) => {
|
|
126
|
+
if (!Schedule?.EndDate) {
|
|
128
127
|
return true;
|
|
129
128
|
}
|
|
130
129
|
return new Date() < new Date(Schedule.EndDate);
|
|
131
130
|
};
|
|
132
|
-
exports.
|
|
133
|
-
|
|
134
|
-
|
|
131
|
+
exports.isBeforeEndDate = isBeforeEndDate;
|
|
132
|
+
const isQuietTime = (message) => {
|
|
133
|
+
const { Schedule } = message;
|
|
134
|
+
if (!Schedule?.QuietTime) {
|
|
135
135
|
return false;
|
|
136
136
|
}
|
|
137
|
-
|
|
138
|
-
|
|
137
|
+
const pattern = /^[0-2]\d:[0-5]\d$/; // basic sanity check, not a fully featured HH:MM validation
|
|
138
|
+
const { Start, End } = Schedule.QuietTime;
|
|
139
139
|
if (!Start ||
|
|
140
140
|
!End ||
|
|
141
141
|
Start === End ||
|
|
@@ -143,28 +143,30 @@ exports.isQuietTime = function (message) {
|
|
|
143
143
|
!pattern.test(End)) {
|
|
144
144
|
return false;
|
|
145
145
|
}
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
146
|
+
const now = new Date();
|
|
147
|
+
const start = new Date(now);
|
|
148
|
+
const end = new Date(now);
|
|
149
|
+
const [startHours, startMinutes] = Start.split(':');
|
|
150
|
+
const [endHours, endMinutes] = End.split(':');
|
|
151
151
|
start.setHours(Number.parseInt(startHours, 10), Number.parseInt(startMinutes, 10), 0, 0);
|
|
152
152
|
end.setHours(Number.parseInt(endHours, 10), Number.parseInt(endMinutes, 10), 0, 0);
|
|
153
153
|
// if quiet time includes midnight, bump the end time to the next day
|
|
154
154
|
if (start > end) {
|
|
155
155
|
end.setDate(end.getDate() + 1);
|
|
156
156
|
}
|
|
157
|
-
|
|
157
|
+
const isQuietTime = now >= start && now <= end;
|
|
158
158
|
if (isQuietTime) {
|
|
159
159
|
exports.logger.debug('message filtered due to quiet time', message);
|
|
160
160
|
}
|
|
161
161
|
return isQuietTime;
|
|
162
162
|
};
|
|
163
|
-
exports.
|
|
163
|
+
exports.isQuietTime = isQuietTime;
|
|
164
|
+
const clearMemo = () => {
|
|
164
165
|
eventNameMemo = {};
|
|
165
166
|
eventAttributesMemo = {};
|
|
166
167
|
eventMetricsMemo = {};
|
|
167
168
|
};
|
|
169
|
+
exports.clearMemo = clearMemo;
|
|
168
170
|
// in the pinpoint console when a message is created with a Modal or Full Screen layout,
|
|
169
171
|
// it is assigned a layout value of MOBILE_FEED or OVERLAYS respectively in the message payload.
|
|
170
172
|
// In the future, Pinpoint will be updating the layout values in the aforementioned scenario
|
|
@@ -174,7 +176,7 @@ exports.clearMemo = function () {
|
|
|
174
176
|
// - 1. the usage of MOBILE_FEED and OVERLAYS as values for message layouts are not leaked
|
|
175
177
|
// outside the Pinpoint provider
|
|
176
178
|
// - 2. Amplify correctly handles the legacy layout values from Pinpoint after they are updated
|
|
177
|
-
|
|
179
|
+
const interpretLayout = (layout) => {
|
|
178
180
|
if (layout === 'MOBILE_FEED') {
|
|
179
181
|
return 'MODAL';
|
|
180
182
|
}
|
|
@@ -184,14 +186,13 @@ exports.interpretLayout = function (layout) {
|
|
|
184
186
|
// cast as PinpointInAppMessage['InAppMessage']['Layout'] allows `string` as a value
|
|
185
187
|
return layout;
|
|
186
188
|
};
|
|
187
|
-
exports.
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
var extractedContent = {};
|
|
189
|
+
exports.interpretLayout = interpretLayout;
|
|
190
|
+
const extractContent = ({ InAppMessage: message, }) => {
|
|
191
|
+
return (message?.Content?.map(content => {
|
|
192
|
+
const { BackgroundColor, BodyConfig, HeaderConfig, ImageUrl, PrimaryBtn, SecondaryBtn, } = content;
|
|
193
|
+
const defaultPrimaryButton = PrimaryBtn?.DefaultConfig;
|
|
194
|
+
const defaultSecondaryButton = SecondaryBtn?.DefaultConfig;
|
|
195
|
+
const extractedContent = {};
|
|
195
196
|
if (BackgroundColor) {
|
|
196
197
|
extractedContent.container = {
|
|
197
198
|
style: {
|
|
@@ -201,19 +202,21 @@ exports.extractContent = function (_a) {
|
|
|
201
202
|
}
|
|
202
203
|
if (HeaderConfig) {
|
|
203
204
|
extractedContent.header = {
|
|
204
|
-
|
|
205
|
+
// Default to empty string in rare cases we don't have a Header value
|
|
206
|
+
content: HeaderConfig.Header ?? '',
|
|
205
207
|
style: {
|
|
206
208
|
color: HeaderConfig.TextColor,
|
|
207
|
-
textAlign: HeaderConfig.Alignment
|
|
209
|
+
textAlign: HeaderConfig.Alignment?.toLowerCase(),
|
|
208
210
|
},
|
|
209
211
|
};
|
|
210
212
|
}
|
|
211
213
|
if (BodyConfig) {
|
|
212
214
|
extractedContent.body = {
|
|
213
|
-
|
|
215
|
+
// Default to empty string in rare cases we don't have a Body value
|
|
216
|
+
content: BodyConfig.Body ?? '',
|
|
214
217
|
style: {
|
|
215
218
|
color: BodyConfig.TextColor,
|
|
216
|
-
textAlign: BodyConfig.Alignment
|
|
219
|
+
textAlign: BodyConfig.Alignment?.toLowerCase(),
|
|
217
220
|
},
|
|
218
221
|
};
|
|
219
222
|
}
|
|
@@ -224,7 +227,8 @@ exports.extractContent = function (_a) {
|
|
|
224
227
|
}
|
|
225
228
|
if (defaultPrimaryButton) {
|
|
226
229
|
extractedContent.primaryButton = {
|
|
227
|
-
|
|
230
|
+
// Default to empty string in rare cases we don't have a Text value
|
|
231
|
+
title: defaultPrimaryButton.Text ?? '',
|
|
228
232
|
action: defaultPrimaryButton.ButtonAction,
|
|
229
233
|
url: defaultPrimaryButton.Link,
|
|
230
234
|
style: {
|
|
@@ -236,7 +240,8 @@ exports.extractContent = function (_a) {
|
|
|
236
240
|
}
|
|
237
241
|
if (defaultSecondaryButton) {
|
|
238
242
|
extractedContent.secondaryButton = {
|
|
239
|
-
|
|
243
|
+
// Default to empty string in rare cases we don't have a Text value
|
|
244
|
+
title: defaultSecondaryButton.Text ?? '',
|
|
240
245
|
action: defaultSecondaryButton.ButtonAction,
|
|
241
246
|
url: defaultSecondaryButton.Link,
|
|
242
247
|
style: {
|
|
@@ -247,14 +252,13 @@ exports.extractContent = function (_a) {
|
|
|
247
252
|
};
|
|
248
253
|
}
|
|
249
254
|
return extractedContent;
|
|
250
|
-
})
|
|
251
|
-
};
|
|
252
|
-
exports.extractMetadata = function (_a) {
|
|
253
|
-
var InAppMessage = _a.InAppMessage, Priority = _a.Priority, Schedule = _a.Schedule, TreatmentId = _a.TreatmentId;
|
|
254
|
-
return ({
|
|
255
|
-
customData: InAppMessage === null || InAppMessage === void 0 ? void 0 : InAppMessage.CustomConfig,
|
|
256
|
-
endDate: Schedule === null || Schedule === void 0 ? void 0 : Schedule.EndDate,
|
|
257
|
-
priority: Priority,
|
|
258
|
-
treatmentId: TreatmentId,
|
|
259
|
-
});
|
|
255
|
+
}) ?? []);
|
|
260
256
|
};
|
|
257
|
+
exports.extractContent = extractContent;
|
|
258
|
+
const extractMetadata = ({ InAppMessage, Priority, Schedule, TreatmentId, }) => ({
|
|
259
|
+
customData: InAppMessage?.CustomConfig,
|
|
260
|
+
endDate: Schedule?.EndDate,
|
|
261
|
+
priority: Priority,
|
|
262
|
+
treatmentId: TreatmentId,
|
|
263
|
+
});
|
|
264
|
+
exports.extractMetadata = extractMetadata;
|
|
@@ -2,18 +2,19 @@
|
|
|
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.incrementMessageCounts = exports.sessionStateChangeHandler = exports.processInAppMessages = exports.STORAGE_KEY_SUFFIX = exports.CHANNEL_TYPE = exports.CATEGORY = exports.PINPOINT_KEY_PREFIX = exports.getInAppMessagingUserAgentString = exports.resolveCredentials = exports.resolveConfig = void 0;
|
|
5
6
|
var resolveConfig_1 = require("./resolveConfig");
|
|
6
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });
|
|
7
8
|
var resolveCredentials_1 = require("./resolveCredentials");
|
|
8
|
-
exports
|
|
9
|
+
Object.defineProperty(exports, "resolveCredentials", { enumerable: true, get: function () { return resolveCredentials_1.resolveCredentials; } });
|
|
9
10
|
var userAgent_1 = require("./userAgent");
|
|
10
|
-
exports
|
|
11
|
+
Object.defineProperty(exports, "getInAppMessagingUserAgentString", { enumerable: true, get: function () { return userAgent_1.getInAppMessagingUserAgentString; } });
|
|
11
12
|
var constants_1 = require("./constants");
|
|
12
|
-
exports
|
|
13
|
-
exports
|
|
14
|
-
exports
|
|
15
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "PINPOINT_KEY_PREFIX", { enumerable: true, get: function () { return constants_1.PINPOINT_KEY_PREFIX; } });
|
|
14
|
+
Object.defineProperty(exports, "CATEGORY", { enumerable: true, get: function () { return constants_1.CATEGORY; } });
|
|
15
|
+
Object.defineProperty(exports, "CHANNEL_TYPE", { enumerable: true, get: function () { return constants_1.CHANNEL_TYPE; } });
|
|
16
|
+
Object.defineProperty(exports, "STORAGE_KEY_SUFFIX", { enumerable: true, get: function () { return constants_1.STORAGE_KEY_SUFFIX; } });
|
|
16
17
|
var messageProcessingHelpers_1 = require("./messageProcessingHelpers");
|
|
17
|
-
exports
|
|
18
|
-
exports
|
|
19
|
-
exports
|
|
18
|
+
Object.defineProperty(exports, "processInAppMessages", { enumerable: true, get: function () { return messageProcessingHelpers_1.processInAppMessages; } });
|
|
19
|
+
Object.defineProperty(exports, "sessionStateChangeHandler", { enumerable: true, get: function () { return messageProcessingHelpers_1.sessionStateChangeHandler; } });
|
|
20
|
+
Object.defineProperty(exports, "incrementMessageCounts", { enumerable: true, get: function () { return messageProcessingHelpers_1.incrementMessageCounts; } });
|