@aws-amplify/notifications 1.6.6-api-v6-models.b3abc9b.0 → 2.0.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/README.md +3 -0
- package/in-app-messaging/package.json +7 -0
- package/in-app-messaging/pinpoint/package.json +7 -0
- package/lib/{common/eventListeners/index.d.ts → eventListeners/eventListeners.d.ts} +2 -2
- package/lib/eventListeners/eventListeners.js +38 -0
- package/lib/eventListeners/index.d.ts +2 -0
- package/lib/eventListeners/index.js +9 -0
- package/lib/eventListeners/types.d.ts +10 -0
- package/lib/{InAppMessaging/SessionTracker → eventListeners}/types.js +0 -1
- package/lib/inAppMessaging/errors/InAppMessagingError.d.ts +7 -0
- package/lib/inAppMessaging/errors/InAppMessagingError.js +19 -0
- package/lib/inAppMessaging/errors/assertServiceError.d.ts +2 -0
- package/lib/inAppMessaging/errors/assertServiceError.js +19 -0
- package/lib/inAppMessaging/errors/assertValidationError.d.ts +5 -0
- package/lib/inAppMessaging/errors/assertValidationError.js +17 -0
- package/lib/inAppMessaging/errors/index.d.ts +4 -0
- package/lib/inAppMessaging/errors/index.js +14 -0
- package/lib/inAppMessaging/errors/validation.d.ts +8 -0
- package/lib/inAppMessaging/errors/validation.js +27 -0
- package/lib/inAppMessaging/index.d.ts +2 -0
- package/lib/inAppMessaging/index.js +17 -0
- 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.d.ts +26 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +56 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +51 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/identifyUser.js +79 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/index.d.ts +11 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/index.js +27 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.d.ts +12 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +57 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.d.ts +16 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +26 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.d.ts +18 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +27 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.d.ts +18 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +27 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.d.ts +18 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +27 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.d.ts +18 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +27 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.d.ts +32 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +65 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.d.ts +16 -0
- package/lib/inAppMessaging/providers/pinpoint/apis/syncMessages.js +69 -0
- package/lib/inAppMessaging/providers/pinpoint/index.d.ts +2 -0
- package/lib/inAppMessaging/providers/pinpoint/index.js +17 -0
- package/lib/inAppMessaging/providers/pinpoint/types/index.d.ts +4 -0
- package/lib/{InAppMessaging → inAppMessaging/providers/pinpoint/types}/index.js +2 -4
- package/lib/inAppMessaging/providers/pinpoint/types/inputs.d.ts +37 -0
- package/lib/{PushNotification/Platform/types.js → inAppMessaging/providers/pinpoint/types/inputs.js} +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/options.d.ts +5 -0
- package/lib/{common/AWSPinpointProviderCommon/types.js → inAppMessaging/providers/pinpoint/types/options.js} +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/outputs.d.ts +17 -0
- package/lib/{common/eventListeners/types.js → inAppMessaging/providers/pinpoint/types/outputs.js} +0 -1
- package/lib/inAppMessaging/providers/pinpoint/types/types.d.ts +19 -0
- package/lib/inAppMessaging/providers/pinpoint/types/types.js +11 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/constants.d.ts +4 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/constants.js +9 -0
- package/lib/{InAppMessaging/Providers/AWSPinpointProvider/utils.d.ts → inAppMessaging/providers/pinpoint/utils/helpers.d.ts} +6 -7
- package/lib/inAppMessaging/providers/pinpoint/utils/helpers.js +264 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/index.d.ts +5 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/index.js +20 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +6 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +169 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +17 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +7 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +16 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.d.ts +4 -0
- package/lib/inAppMessaging/providers/pinpoint/utils/userAgent.js +20 -0
- package/lib/inAppMessaging/types/event.d.ts +6 -0
- package/lib/inAppMessaging/types/event.js +4 -0
- package/lib/inAppMessaging/types/index.d.ts +4 -0
- package/lib/inAppMessaging/types/index.js +4 -0
- package/lib/inAppMessaging/types/inputs.d.ts +19 -0
- package/lib/inAppMessaging/types/inputs.js +4 -0
- package/lib/inAppMessaging/types/message.d.ts +44 -0
- package/lib/inAppMessaging/types/message.js +4 -0
- package/lib/inAppMessaging/types/options.d.ts +4 -0
- package/lib/inAppMessaging/types/options.js +4 -0
- package/lib/inAppMessaging/utils/index.d.ts +1 -0
- package/lib/inAppMessaging/utils/index.js +9 -0
- package/lib/inAppMessaging/utils/statusHelpers.d.ts +13 -0
- package/lib/inAppMessaging/utils/statusHelpers.js +27 -0
- package/lib/index.d.ts +0 -6
- package/lib/index.js +0 -10
- package/lib/pushNotifications/errors/PushNotificationError.d.ts +4 -0
- package/lib/pushNotifications/errors/PushNotificationError.js +16 -0
- package/lib/pushNotifications/errors/errorHelpers.d.ts +9 -0
- package/lib/pushNotifications/errors/errorHelpers.js +35 -0
- package/lib/pushNotifications/errors/index.d.ts +2 -0
- package/lib/pushNotifications/errors/index.js +10 -0
- package/lib/pushNotifications/index.d.ts +3 -0
- package/lib/pushNotifications/index.js +19 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.d.ts +14 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +22 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +13 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.d.ts +18 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +26 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +13 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.d.ts +27 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +35 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +13 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +53 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.js +61 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +31 -0
- package/lib/pushNotifications/providers/pinpoint/apis/index.d.ts +11 -0
- package/lib/pushNotifications/providers/pinpoint/apis/index.js +27 -0
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.d.ts +17 -0
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +25 -0
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -0
- package/lib/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +133 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.d.ts +27 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +35 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +12 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.d.ts +43 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +51 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +12 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.d.ts +27 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +35 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +12 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.d.ts +28 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +36 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +12 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.d.ts +32 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.js +40 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +13 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.d.ts +14 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +22 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +13 -0
- package/lib/pushNotifications/providers/pinpoint/index.d.ts +3 -0
- package/lib/pushNotifications/providers/pinpoint/index.js +17 -0
- package/lib/pushNotifications/providers/pinpoint/types/analytics.d.ts +6 -0
- package/lib/pushNotifications/providers/pinpoint/types/analytics.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/apis.d.ts +13 -0
- package/lib/pushNotifications/providers/pinpoint/types/apis.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/index.d.ts +6 -0
- package/lib/pushNotifications/providers/pinpoint/types/index.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/inputs.d.ts +9 -0
- package/lib/pushNotifications/providers/pinpoint/types/inputs.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/options.d.ts +5 -0
- package/lib/pushNotifications/providers/pinpoint/types/options.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/outputs.d.ts +9 -0
- package/lib/pushNotifications/providers/pinpoint/types/outputs.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +2 -0
- package/lib/pushNotifications/providers/pinpoint/types/pushNotifications.js +4 -0
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +6 -0
- package/lib/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +43 -0
- package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +7 -0
- package/lib/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +56 -0
- package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +5 -0
- package/lib/pushNotifications/providers/pinpoint/utils/getChannelType.js +25 -0
- package/lib/pushNotifications/providers/pinpoint/utils/index.d.ts +4 -0
- package/lib/pushNotifications/providers/pinpoint/utils/index.js +13 -0
- package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
- package/lib/pushNotifications/providers/pinpoint/utils/resolveConfig.js +17 -0
- package/lib/pushNotifications/types/errors.d.ts +3 -0
- package/lib/pushNotifications/types/errors.js +9 -0
- package/lib/pushNotifications/types/index.d.ts +6 -0
- package/lib/pushNotifications/types/index.js +24 -0
- package/lib/pushNotifications/types/inputs.d.ts +24 -0
- package/lib/pushNotifications/types/inputs.js +4 -0
- package/lib/pushNotifications/types/module.d.ts +31 -0
- package/lib/pushNotifications/types/module.js +4 -0
- package/lib/pushNotifications/types/options.d.ts +4 -0
- package/lib/pushNotifications/types/options.js +4 -0
- package/lib/pushNotifications/types/outputs.d.ts +10 -0
- package/lib/pushNotifications/types/outputs.js +4 -0
- package/lib/pushNotifications/types/pushNotifications.d.ts +4 -0
- package/lib/pushNotifications/types/pushNotifications.js +4 -0
- package/lib/pushNotifications/utils/getPushNotificationUserAgentString.d.ts +2 -0
- package/lib/pushNotifications/utils/getPushNotificationUserAgentString.js +11 -0
- package/lib/pushNotifications/utils/index.d.ts +4 -0
- package/lib/pushNotifications/utils/index.js +15 -0
- package/lib/pushNotifications/utils/initializationManager.d.ts +12 -0
- package/lib/pushNotifications/utils/initializationManager.js +22 -0
- package/lib/pushNotifications/utils/resolveCredentials.d.ts +7 -0
- package/lib/pushNotifications/utils/resolveCredentials.js +16 -0
- package/lib/pushNotifications/utils/tokenManager.d.ts +12 -0
- package/lib/pushNotifications/utils/tokenManager.js +22 -0
- package/lib/tsconfig.tsbuildinfo +1 -0
- package/lib-esm/{common/eventListeners/index.d.ts → eventListeners/eventListeners.d.ts} +2 -2
- package/lib-esm/eventListeners/eventListeners.js +32 -0
- package/lib-esm/eventListeners/index.d.ts +2 -0
- package/lib-esm/{common → eventListeners}/index.js +0 -3
- package/lib-esm/eventListeners/types.d.ts +10 -0
- package/lib-esm/{PushNotification/Platform → eventListeners}/types.js +1 -1
- package/lib-esm/inAppMessaging/errors/InAppMessagingError.d.ts +7 -0
- package/lib-esm/inAppMessaging/errors/InAppMessagingError.js +15 -0
- package/lib-esm/inAppMessaging/errors/assertServiceError.d.ts +2 -0
- package/lib-esm/inAppMessaging/errors/assertServiceError.js +15 -0
- package/lib-esm/inAppMessaging/errors/assertValidationError.d.ts +5 -0
- package/lib-esm/inAppMessaging/errors/assertValidationError.js +13 -0
- package/lib-esm/inAppMessaging/errors/index.d.ts +4 -0
- package/lib-esm/inAppMessaging/errors/index.js +6 -0
- package/lib-esm/inAppMessaging/errors/validation.d.ts +8 -0
- package/lib-esm/inAppMessaging/errors/validation.js +24 -0
- package/lib-esm/inAppMessaging/index.d.ts +2 -0
- package/lib-esm/inAppMessaging/index.js +3 -0
- 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.d.ts +26 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/dispatchEvent.js +49 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.d.ts +51 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/identifyUser.js +75 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.d.ts +11 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/index.js +13 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.d.ts +12 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.js +53 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.d.ts +16 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.js +22 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.d.ts +18 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.js +23 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.d.ts +18 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.js +23 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.d.ts +18 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.js +23 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.d.ts +18 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/onMessageReceived.js +23 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.d.ts +32 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/setConflictHandler.js +61 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.d.ts +16 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/apis/syncMessages.js +65 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/index.d.ts +2 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/index.js +3 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/index.d.ts +4 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/index.js +3 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/inputs.d.ts +37 -0
- package/lib-esm/{common/AWSPinpointProviderCommon/types.js → inAppMessaging/providers/pinpoint/types/inputs.js} +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/options.d.ts +5 -0
- package/lib-esm/{common/eventListeners/types.js → inAppMessaging/providers/pinpoint/types/options.js} +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/outputs.d.ts +17 -0
- package/lib-esm/{InAppMessaging/SessionTracker/types.js → inAppMessaging/providers/pinpoint/types/outputs.js} +1 -1
- package/lib-esm/inAppMessaging/providers/pinpoint/types/types.d.ts +19 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/types/types.js +8 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.d.ts +4 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/constants.js +6 -0
- package/lib-esm/{InAppMessaging/Providers/AWSPinpointProvider/utils.d.ts → inAppMessaging/providers/pinpoint/utils/helpers.d.ts} +6 -7
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/helpers.js +246 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.d.ts +5 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/index.js +7 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.d.ts +6 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.js +163 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveConfig.js +13 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.d.ts +7 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/resolveCredentials.js +12 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.d.ts +4 -0
- package/lib-esm/inAppMessaging/providers/pinpoint/utils/userAgent.js +15 -0
- package/lib-esm/inAppMessaging/types/event.d.ts +6 -0
- package/lib-esm/inAppMessaging/types/event.js +3 -0
- package/lib-esm/inAppMessaging/types/index.d.ts +4 -0
- package/lib-esm/inAppMessaging/types/index.js +3 -0
- package/lib-esm/inAppMessaging/types/inputs.d.ts +19 -0
- package/lib-esm/inAppMessaging/types/inputs.js +3 -0
- package/lib-esm/inAppMessaging/types/message.d.ts +44 -0
- package/lib-esm/inAppMessaging/types/message.js +3 -0
- package/lib-esm/inAppMessaging/types/options.d.ts +4 -0
- package/lib-esm/inAppMessaging/types/options.js +3 -0
- package/lib-esm/inAppMessaging/utils/index.d.ts +1 -0
- package/lib-esm/inAppMessaging/utils/index.js +3 -0
- package/lib-esm/inAppMessaging/utils/statusHelpers.d.ts +13 -0
- package/lib-esm/inAppMessaging/utils/statusHelpers.js +21 -0
- package/lib-esm/index.d.ts +0 -6
- package/lib-esm/index.js +1 -5
- package/lib-esm/pushNotifications/errors/PushNotificationError.d.ts +4 -0
- package/lib-esm/pushNotifications/errors/PushNotificationError.js +12 -0
- package/lib-esm/pushNotifications/errors/errorHelpers.d.ts +9 -0
- package/lib-esm/pushNotifications/errors/errorHelpers.js +31 -0
- package/lib-esm/pushNotifications/errors/index.d.ts +2 -0
- package/lib-esm/pushNotifications/errors/index.js +4 -0
- package/lib-esm/pushNotifications/index.d.ts +3 -0
- package/lib-esm/pushNotifications/index.js +4 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.d.ts +14 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.js +18 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.js +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.d.ts +18 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.js +22 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.js +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.d.ts +27 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.js +31 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.js +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.d.ts +53 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.js +57 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/identifyUser.native.js +27 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/index.d.ts +11 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/index.js +13 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.d.ts +17 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.js +21 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.d.ts +1 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.js +129 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.d.ts +27 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.js +31 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.js +8 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.d.ts +43 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.js +47 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.js +8 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.d.ts +27 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.js +31 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.js +8 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.d.ts +28 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.js +32 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.js +8 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.d.ts +32 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.js +36 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/requestPermissions.native.js +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.d.ts +14 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.js +18 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.js +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/index.d.ts +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/index.js +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.d.ts +6 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/analytics.js +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/apis.d.ts +13 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/apis.js +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/index.d.ts +6 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/index.js +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.d.ts +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/inputs.js +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/options.d.ts +5 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/options.js +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.d.ts +9 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/outputs.js +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.d.ts +2 -0
- package/lib-esm/pushNotifications/providers/pinpoint/types/pushNotifications.js +3 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.d.ts +6 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.js +39 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.d.ts +7 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.js +52 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.d.ts +5 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/getChannelType.js +21 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.d.ts +4 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/index.js +6 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveConfig.d.ts +7 -0
- package/lib-esm/pushNotifications/providers/pinpoint/utils/resolveConfig.js +13 -0
- package/lib-esm/pushNotifications/types/errors.d.ts +3 -0
- package/lib-esm/pushNotifications/types/errors.js +6 -0
- package/lib-esm/pushNotifications/types/index.d.ts +6 -0
- package/lib-esm/pushNotifications/types/index.js +8 -0
- package/lib-esm/pushNotifications/types/inputs.d.ts +24 -0
- package/lib-esm/pushNotifications/types/inputs.js +3 -0
- package/lib-esm/pushNotifications/types/module.d.ts +31 -0
- package/lib-esm/pushNotifications/types/module.js +3 -0
- package/lib-esm/pushNotifications/types/options.d.ts +4 -0
- package/lib-esm/pushNotifications/types/options.js +3 -0
- package/lib-esm/pushNotifications/types/outputs.d.ts +10 -0
- package/lib-esm/pushNotifications/types/outputs.js +3 -0
- package/lib-esm/pushNotifications/types/pushNotifications.d.ts +4 -0
- package/lib-esm/pushNotifications/types/pushNotifications.js +3 -0
- package/lib-esm/pushNotifications/utils/getPushNotificationUserAgentString.d.ts +2 -0
- package/lib-esm/pushNotifications/utils/getPushNotificationUserAgentString.js +7 -0
- package/lib-esm/pushNotifications/utils/index.d.ts +4 -0
- package/lib-esm/pushNotifications/utils/index.js +6 -0
- package/lib-esm/pushNotifications/utils/initializationManager.d.ts +12 -0
- package/lib-esm/pushNotifications/utils/initializationManager.js +17 -0
- package/lib-esm/pushNotifications/utils/resolveCredentials.d.ts +7 -0
- package/lib-esm/pushNotifications/utils/resolveCredentials.js +12 -0
- package/lib-esm/pushNotifications/utils/tokenManager.d.ts +12 -0
- package/lib-esm/pushNotifications/utils/tokenManager.js +17 -0
- package/lib-esm/tsconfig.tsbuildinfo +1 -0
- package/package.json +104 -38
- package/push-notifications/package.json +7 -0
- package/push-notifications/pinpoint/package.json +7 -0
- package/src/{common/eventListeners/index.ts → eventListeners/eventListeners.ts} +5 -3
- package/src/{common → eventListeners}/index.ts +1 -3
- package/src/{common/eventListeners → eventListeners}/types.ts +6 -2
- package/src/inAppMessaging/errors/InAppMessagingError.ts +21 -0
- package/src/inAppMessaging/errors/assertServiceError.ts +24 -0
- package/src/inAppMessaging/errors/assertValidationError.ts +22 -0
- package/src/inAppMessaging/errors/index.ts +10 -0
- package/src/inAppMessaging/errors/validation.ts +29 -0
- package/src/inAppMessaging/index.ts +39 -0
- package/src/inAppMessaging/providers/pinpoint/apis/clearMessages.ts +26 -0
- package/src/inAppMessaging/providers/pinpoint/apis/dispatchEvent.ts +63 -0
- package/src/inAppMessaging/providers/pinpoint/apis/identifyUser.ts +94 -0
- package/src/inAppMessaging/providers/pinpoint/apis/index.ts +14 -0
- package/src/inAppMessaging/providers/pinpoint/apis/initializeInAppMessaging.ts +62 -0
- package/src/inAppMessaging/providers/pinpoint/apis/notifyMessageInteraction.ts +28 -0
- package/src/inAppMessaging/providers/pinpoint/apis/onMessageActionTaken.ts +29 -0
- package/src/inAppMessaging/providers/pinpoint/apis/onMessageDismissed.ts +29 -0
- package/src/inAppMessaging/providers/pinpoint/apis/onMessageDisplayed.ts +29 -0
- package/src/inAppMessaging/providers/pinpoint/apis/onMessageReceived.ts +29 -0
- package/src/inAppMessaging/providers/pinpoint/apis/setConflictHandler.ts +68 -0
- package/src/inAppMessaging/providers/pinpoint/apis/syncMessages.ts +88 -0
- package/src/inAppMessaging/providers/pinpoint/index.ts +31 -0
- package/src/inAppMessaging/providers/pinpoint/types/index.ts +29 -0
- package/src/inAppMessaging/providers/pinpoint/types/inputs.ts +58 -0
- package/src/inAppMessaging/providers/pinpoint/types/options.ts +9 -0
- package/src/inAppMessaging/providers/pinpoint/types/outputs.ts +24 -0
- package/src/{InAppMessaging/Providers/AWSPinpointProvider → inAppMessaging/providers/pinpoint/types}/types.ts +9 -1
- package/src/inAppMessaging/providers/pinpoint/utils/constants.ts +6 -0
- package/src/{InAppMessaging/Providers/AWSPinpointProvider/utils.ts → inAppMessaging/providers/pinpoint/utils/helpers.ts} +74 -58
- package/src/inAppMessaging/providers/pinpoint/utils/index.ts +18 -0
- package/src/inAppMessaging/providers/pinpoint/utils/messageProcessingHelpers.ts +210 -0
- package/src/inAppMessaging/providers/pinpoint/utils/resolveConfig.ts +19 -0
- package/src/inAppMessaging/providers/pinpoint/utils/resolveCredentials.ts +20 -0
- package/src/inAppMessaging/providers/pinpoint/utils/userAgent.ts +25 -0
- package/src/inAppMessaging/types/event.ts +14 -0
- package/src/{InAppMessaging → inAppMessaging/types}/index.ts +7 -8
- package/src/inAppMessaging/types/inputs.ts +27 -0
- package/src/inAppMessaging/types/message.ts +62 -0
- package/src/inAppMessaging/types/options.ts +7 -0
- package/src/{PushNotification/Providers → inAppMessaging/utils}/index.ts +5 -1
- package/src/inAppMessaging/utils/statusHelpers.ts +32 -0
- package/src/index.ts +0 -24
- package/src/pushNotifications/errors/PushNotificationError.ts +18 -0
- package/src/pushNotifications/errors/errorHelpers.ts +45 -0
- package/src/pushNotifications/errors/index.ts +5 -0
- package/src/pushNotifications/index.ts +32 -0
- package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.native.ts +13 -0
- package/src/pushNotifications/providers/pinpoint/apis/getBadgeCount.ts +21 -0
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.native.ts +14 -0
- package/src/pushNotifications/providers/pinpoint/apis/getLaunchNotification.ts +26 -0
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.native.ts +14 -0
- package/src/pushNotifications/providers/pinpoint/apis/getPermissionStatus.ts +34 -0
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.native.ts +39 -0
- package/src/pushNotifications/providers/pinpoint/apis/identifyUser.ts +62 -0
- package/src/pushNotifications/providers/pinpoint/apis/index.ts +14 -0
- package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.native.ts +209 -0
- package/src/pushNotifications/providers/pinpoint/apis/initializePushNotifications.ts +24 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.native.ts +11 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationOpened.ts +39 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.native.ts +12 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInBackground.ts +56 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.native.ts +12 -0
- package/src/pushNotifications/providers/pinpoint/apis/onNotificationReceivedInForeground.ts +40 -0
- package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.native.ts +11 -0
- package/src/pushNotifications/providers/pinpoint/apis/onTokenReceived.ts +39 -0
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.native.ts +14 -0
- package/src/pushNotifications/providers/pinpoint/apis/requestPermissions.ts +39 -0
- package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.native.ts +13 -0
- package/src/pushNotifications/providers/pinpoint/apis/setBadgeCount.ts +21 -0
- package/src/pushNotifications/providers/pinpoint/index.ts +34 -0
- package/src/pushNotifications/providers/pinpoint/types/analytics.ts +14 -0
- package/src/pushNotifications/providers/pinpoint/types/apis.ts +54 -0
- package/src/pushNotifications/providers/pinpoint/types/index.ts +40 -0
- package/src/pushNotifications/providers/pinpoint/types/inputs.ts +31 -0
- package/src/pushNotifications/providers/pinpoint/types/options.ts +9 -0
- package/src/pushNotifications/providers/pinpoint/types/outputs.ts +34 -0
- package/src/pushNotifications/providers/pinpoint/types/pushNotifications.ts +6 -0
- package/src/pushNotifications/providers/pinpoint/utils/createMessageEventRecorder.ts +66 -0
- package/src/pushNotifications/providers/pinpoint/utils/getAnalyticsEvent.ts +66 -0
- package/src/pushNotifications/providers/pinpoint/utils/getChannelType.ts +25 -0
- package/src/pushNotifications/providers/pinpoint/utils/index.ts +7 -0
- package/src/pushNotifications/providers/pinpoint/utils/resolveConfig.ts +16 -0
- package/src/{InAppMessaging/Providers/index.ts → pushNotifications/types/errors.ts} +3 -1
- package/src/pushNotifications/types/index.ts +9 -0
- package/src/pushNotifications/types/inputs.ts +45 -0
- package/src/pushNotifications/types/module.ts +42 -0
- package/src/pushNotifications/types/options.ts +7 -0
- package/src/pushNotifications/types/outputs.ts +28 -0
- package/src/pushNotifications/types/pushNotifications.ts +17 -0
- package/src/pushNotifications/utils/getPushNotificationUserAgentString.ts +15 -0
- package/src/pushNotifications/utils/index.ts +7 -0
- package/src/pushNotifications/utils/initializationManager.ts +20 -0
- package/src/pushNotifications/utils/resolveCredentials.ts +14 -0
- package/src/pushNotifications/utils/tokenManager.ts +20 -0
- package/lib/.tsbuildinfo +0 -3
- package/lib/InAppMessaging/InAppMessaging.d.ts +0 -57
- package/lib/InAppMessaging/InAppMessaging.js +0 -340
- package/lib/InAppMessaging/InAppMessaging.js.map +0 -1
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +0 -31
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js +0 -266
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.d.ts +0 -16
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js +0 -11
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js +0 -247
- package/lib/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib/InAppMessaging/Providers/index.d.ts +0 -1
- package/lib/InAppMessaging/Providers/index.js +0 -7
- package/lib/InAppMessaging/Providers/index.js.map +0 -1
- package/lib/InAppMessaging/SessionTracker/SessionTracker.d.ts +0 -9
- package/lib/InAppMessaging/SessionTracker/SessionTracker.js +0 -68
- package/lib/InAppMessaging/SessionTracker/SessionTracker.js.map +0 -1
- package/lib/InAppMessaging/SessionTracker/SessionTracker.native.d.ts +0 -10
- package/lib/InAppMessaging/SessionTracker/SessionTracker.native.js +0 -53
- package/lib/InAppMessaging/SessionTracker/SessionTracker.native.js.map +0 -1
- package/lib/InAppMessaging/SessionTracker/index.d.ts +0 -3
- package/lib/InAppMessaging/SessionTracker/index.js +0 -8
- package/lib/InAppMessaging/SessionTracker/index.js.map +0 -1
- package/lib/InAppMessaging/SessionTracker/types.d.ts +0 -6
- package/lib/InAppMessaging/SessionTracker/types.js.map +0 -1
- package/lib/InAppMessaging/index.d.ts +0 -2
- package/lib/InAppMessaging/index.js.map +0 -1
- package/lib/InAppMessaging/types.d.ts +0 -87
- package/lib/InAppMessaging/types.js +0 -12
- package/lib/InAppMessaging/types.js.map +0 -1
- package/lib/Notifications.d.ts +0 -24
- package/lib/Notifications.js +0 -94
- package/lib/Notifications.js.map +0 -1
- package/lib/PushNotification/NotEnabledError.d.ts +0 -3
- package/lib/PushNotification/NotEnabledError.js +0 -16
- package/lib/PushNotification/NotEnabledError.js.map +0 -1
- package/lib/PushNotification/Platform/index.d.ts +0 -2
- package/lib/PushNotification/Platform/index.js +0 -26
- package/lib/PushNotification/Platform/index.js.map +0 -1
- package/lib/PushNotification/Platform/index.native.d.ts +0 -2
- package/lib/PushNotification/Platform/index.native.js +0 -8
- package/lib/PushNotification/Platform/index.native.js.map +0 -1
- package/lib/PushNotification/Platform/types.d.ts +0 -5
- package/lib/PushNotification/Platform/types.js.map +0 -1
- package/lib/PushNotification/PlatformNotSupportedError.d.ts +0 -3
- package/lib/PushNotification/PlatformNotSupportedError.js +0 -16
- package/lib/PushNotification/PlatformNotSupportedError.js.map +0 -1
- package/lib/PushNotification/Providers/AWSPinpointProvider/index.d.ts +0 -15
- package/lib/PushNotification/Providers/AWSPinpointProvider/index.js +0 -114
- package/lib/PushNotification/Providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib/PushNotification/Providers/AWSPinpointProvider/types.d.ts +0 -9
- package/lib/PushNotification/Providers/AWSPinpointProvider/types.js +0 -16
- package/lib/PushNotification/Providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib/PushNotification/Providers/AWSPinpointProvider/utils.d.ts +0 -7
- package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js +0 -58
- package/lib/PushNotification/Providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib/PushNotification/Providers/index.d.ts +0 -1
- package/lib/PushNotification/Providers/index.js +0 -7
- package/lib/PushNotification/Providers/index.js.map +0 -1
- package/lib/PushNotification/PushNotification.d.ts +0 -39
- package/lib/PushNotification/PushNotification.js +0 -91
- package/lib/PushNotification/PushNotification.js.map +0 -1
- package/lib/PushNotification/PushNotification.native.d.ts +0 -63
- package/lib/PushNotification/PushNotification.native.js +0 -332
- package/lib/PushNotification/PushNotification.native.js.map +0 -1
- package/lib/PushNotification/index.d.ts +0 -2
- package/lib/PushNotification/index.js +0 -9
- package/lib/PushNotification/index.js.map +0 -1
- package/lib/PushNotification/types.d.ts +0 -77
- package/lib/PushNotification/types.js +0 -12
- package/lib/PushNotification/types.js.map +0 -1
- package/lib/PushNotification/utils.d.ts +0 -3
- package/lib/PushNotification/utils.js +0 -81
- package/lib/PushNotification/utils.js.map +0 -1
- package/lib/common/AWSPinpointProviderCommon/index.d.ts +0 -35
- package/lib/common/AWSPinpointProviderCommon/index.js +0 -280
- package/lib/common/AWSPinpointProviderCommon/index.js.map +0 -1
- package/lib/common/AWSPinpointProviderCommon/types.d.ts +0 -10
- package/lib/common/AWSPinpointProviderCommon/types.js.map +0 -1
- package/lib/common/constants.d.ts +0 -1
- package/lib/common/constants.js +0 -8
- package/lib/common/constants.js.map +0 -1
- package/lib/common/eventListeners/index.js +0 -55
- package/lib/common/eventListeners/index.js.map +0 -1
- package/lib/common/eventListeners/types.d.ts +0 -7
- package/lib/common/eventListeners/types.js.map +0 -1
- package/lib/common/index.d.ts +0 -4
- package/lib/common/index.js +0 -13
- package/lib/common/index.js.map +0 -1
- package/lib/index.js.map +0 -1
- package/lib/types.d.ts +0 -39
- package/lib/types.js +0 -5
- package/lib/types.js.map +0 -1
- package/lib-esm/.tsbuildinfo +0 -3
- package/lib-esm/InAppMessaging/InAppMessaging.d.ts +0 -57
- package/lib-esm/InAppMessaging/InAppMessaging.js +0 -338
- package/lib-esm/InAppMessaging/InAppMessaging.js.map +0 -1
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.d.ts +0 -31
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js +0 -264
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.d.ts +0 -16
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js +0 -9
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js +0 -245
- package/lib-esm/InAppMessaging/Providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib-esm/InAppMessaging/Providers/index.d.ts +0 -1
- package/lib-esm/InAppMessaging/Providers/index.js +0 -4
- package/lib-esm/InAppMessaging/Providers/index.js.map +0 -1
- package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.d.ts +0 -9
- package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js +0 -65
- package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.js.map +0 -1
- package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.d.ts +0 -10
- package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.js +0 -50
- package/lib-esm/InAppMessaging/SessionTracker/SessionTracker.native.js.map +0 -1
- package/lib-esm/InAppMessaging/SessionTracker/index.d.ts +0 -3
- package/lib-esm/InAppMessaging/SessionTracker/index.js +0 -5
- package/lib-esm/InAppMessaging/SessionTracker/index.js.map +0 -1
- package/lib-esm/InAppMessaging/SessionTracker/types.d.ts +0 -6
- package/lib-esm/InAppMessaging/SessionTracker/types.js.map +0 -1
- package/lib-esm/InAppMessaging/index.d.ts +0 -2
- package/lib-esm/InAppMessaging/index.js +0 -5
- package/lib-esm/InAppMessaging/index.js.map +0 -1
- package/lib-esm/InAppMessaging/types.d.ts +0 -87
- package/lib-esm/InAppMessaging/types.js +0 -10
- package/lib-esm/InAppMessaging/types.js.map +0 -1
- package/lib-esm/Notifications.d.ts +0 -24
- package/lib-esm/Notifications.js +0 -92
- package/lib-esm/Notifications.js.map +0 -1
- package/lib-esm/PushNotification/NotEnabledError.d.ts +0 -3
- package/lib-esm/PushNotification/NotEnabledError.js +0 -14
- package/lib-esm/PushNotification/NotEnabledError.js.map +0 -1
- package/lib-esm/PushNotification/Platform/index.d.ts +0 -2
- package/lib-esm/PushNotification/Platform/index.js +0 -24
- package/lib-esm/PushNotification/Platform/index.js.map +0 -1
- package/lib-esm/PushNotification/Platform/index.native.d.ts +0 -2
- package/lib-esm/PushNotification/Platform/index.native.js +0 -6
- package/lib-esm/PushNotification/Platform/index.native.js.map +0 -1
- package/lib-esm/PushNotification/Platform/types.d.ts +0 -5
- package/lib-esm/PushNotification/Platform/types.js.map +0 -1
- package/lib-esm/PushNotification/PlatformNotSupportedError.d.ts +0 -3
- package/lib-esm/PushNotification/PlatformNotSupportedError.js +0 -14
- package/lib-esm/PushNotification/PlatformNotSupportedError.js.map +0 -1
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.d.ts +0 -15
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js +0 -112
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/index.js.map +0 -1
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.d.ts +0 -9
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js +0 -14
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/types.js.map +0 -1
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.d.ts +0 -7
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js +0 -56
- package/lib-esm/PushNotification/Providers/AWSPinpointProvider/utils.js.map +0 -1
- package/lib-esm/PushNotification/Providers/index.d.ts +0 -1
- package/lib-esm/PushNotification/Providers/index.js +0 -4
- package/lib-esm/PushNotification/Providers/index.js.map +0 -1
- package/lib-esm/PushNotification/PushNotification.d.ts +0 -39
- package/lib-esm/PushNotification/PushNotification.js +0 -89
- package/lib-esm/PushNotification/PushNotification.js.map +0 -1
- package/lib-esm/PushNotification/PushNotification.native.d.ts +0 -63
- package/lib-esm/PushNotification/PushNotification.native.js +0 -330
- package/lib-esm/PushNotification/PushNotification.native.js.map +0 -1
- package/lib-esm/PushNotification/index.d.ts +0 -2
- package/lib-esm/PushNotification/index.js +0 -5
- package/lib-esm/PushNotification/index.js.map +0 -1
- package/lib-esm/PushNotification/types.d.ts +0 -77
- package/lib-esm/PushNotification/types.js +0 -10
- package/lib-esm/PushNotification/types.js.map +0 -1
- package/lib-esm/PushNotification/utils.d.ts +0 -3
- package/lib-esm/PushNotification/utils.js +0 -79
- package/lib-esm/PushNotification/utils.js.map +0 -1
- package/lib-esm/common/AWSPinpointProviderCommon/index.d.ts +0 -35
- package/lib-esm/common/AWSPinpointProviderCommon/index.js +0 -278
- package/lib-esm/common/AWSPinpointProviderCommon/index.js.map +0 -1
- package/lib-esm/common/AWSPinpointProviderCommon/types.d.ts +0 -10
- package/lib-esm/common/AWSPinpointProviderCommon/types.js.map +0 -1
- package/lib-esm/common/constants.d.ts +0 -1
- package/lib-esm/common/constants.js +0 -6
- package/lib-esm/common/constants.js.map +0 -1
- package/lib-esm/common/eventListeners/index.js +0 -53
- package/lib-esm/common/eventListeners/index.js.map +0 -1
- package/lib-esm/common/eventListeners/types.d.ts +0 -7
- package/lib-esm/common/eventListeners/types.js.map +0 -1
- package/lib-esm/common/index.d.ts +0 -4
- package/lib-esm/common/index.js.map +0 -1
- package/lib-esm/index.js.map +0 -1
- package/lib-esm/types.d.ts +0 -39
- package/lib-esm/types.js +0 -3
- package/lib-esm/types.js.map +0 -1
- package/src/InAppMessaging/InAppMessaging.ts +0 -321
- package/src/InAppMessaging/Providers/AWSPinpointProvider/index.ts +0 -323
- package/src/InAppMessaging/SessionTracker/SessionTracker.native.ts +0 -60
- package/src/InAppMessaging/SessionTracker/SessionTracker.ts +0 -78
- package/src/InAppMessaging/SessionTracker/index.ts +0 -6
- package/src/InAppMessaging/SessionTracker/types.ts +0 -11
- package/src/InAppMessaging/types.ts +0 -142
- package/src/Notifications.ts +0 -90
- package/src/PushNotification/NotEnabledError.ts +0 -11
- package/src/PushNotification/Platform/index.native.ts +0 -9
- package/src/PushNotification/Platform/index.ts +0 -22
- package/src/PushNotification/Platform/types.ts +0 -15
- package/src/PushNotification/PlatformNotSupportedError.ts +0 -9
- package/src/PushNotification/Providers/AWSPinpointProvider/index.ts +0 -137
- package/src/PushNotification/Providers/AWSPinpointProvider/types.ts +0 -13
- package/src/PushNotification/Providers/AWSPinpointProvider/utils.ts +0 -79
- package/src/PushNotification/PushNotification.native.ts +0 -386
- package/src/PushNotification/PushNotification.ts +0 -107
- package/src/PushNotification/index.ts +0 -9
- package/src/PushNotification/types.ts +0 -115
- package/src/PushNotification/utils.ts +0 -112
- package/src/common/AWSPinpointProviderCommon/index.ts +0 -291
- package/src/common/AWSPinpointProviderCommon/types.ts +0 -29
- package/src/common/constants.ts +0 -7
- package/src/types.ts +0 -56
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
5
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
6
|
+
};
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
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 = {};
|
|
21
|
+
exports.logger = new core_1.ConsoleLogger('InAppMessaging.Pinpoint.Utils');
|
|
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,
|
|
29
|
+
category: constants_1.CATEGORY,
|
|
30
|
+
credentials,
|
|
31
|
+
event: {
|
|
32
|
+
name: event,
|
|
33
|
+
attributes: {
|
|
34
|
+
// only include campaign_id field if we have one
|
|
35
|
+
...(id && { campaign_id: id }),
|
|
36
|
+
delivery_type: DELIVERY_TYPE,
|
|
37
|
+
treatment_id: metadata?.treatmentId,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
identityId,
|
|
41
|
+
region,
|
|
42
|
+
userAgentValue: (0, userAgent_1.getInAppMessagingUserAgentString)(utils_1.InAppMessagingAction.NotifyMessageInteraction),
|
|
43
|
+
});
|
|
44
|
+
})
|
|
45
|
+
.catch(e => {
|
|
46
|
+
// An error occured while fetching credentials or persisting the event to the buffer
|
|
47
|
+
exports.logger.warn('Failed to record event.', e);
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
exports.recordAnalyticsEvent = recordAnalyticsEvent;
|
|
51
|
+
const getStartOfDay = () => {
|
|
52
|
+
const now = new Date();
|
|
53
|
+
now.setHours(0, 0, 0, 0);
|
|
54
|
+
return now.toISOString();
|
|
55
|
+
};
|
|
56
|
+
exports.getStartOfDay = getStartOfDay;
|
|
57
|
+
const matchesEventType = ({ CampaignId, Schedule }, { name: eventType }) => {
|
|
58
|
+
const { EventType } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
59
|
+
const memoKey = `${CampaignId}:${eventType}`;
|
|
60
|
+
if (!eventNameMemo.hasOwnProperty(memoKey)) {
|
|
61
|
+
eventNameMemo[memoKey] = !!EventType?.Values?.includes(eventType);
|
|
62
|
+
}
|
|
63
|
+
return eventNameMemo[memoKey];
|
|
64
|
+
};
|
|
65
|
+
exports.matchesEventType = matchesEventType;
|
|
66
|
+
const matchesAttributes = ({ CampaignId, Schedule }, { attributes = {} }) => {
|
|
67
|
+
const { Attributes } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
68
|
+
if ((0, isEmpty_1.default)(Attributes)) {
|
|
69
|
+
// if message does not have attributes defined it does not matter what attributes are on the event
|
|
70
|
+
return true;
|
|
71
|
+
}
|
|
72
|
+
if ((0, isEmpty_1.default)(attributes)) {
|
|
73
|
+
// if message does have attributes but the event does not then it always fails the check
|
|
74
|
+
return false;
|
|
75
|
+
}
|
|
76
|
+
const memoKey = `${CampaignId}:${JSON.stringify(attributes)}`;
|
|
77
|
+
if (!eventAttributesMemo.hasOwnProperty(memoKey)) {
|
|
78
|
+
eventAttributesMemo[memoKey] =
|
|
79
|
+
!Attributes ||
|
|
80
|
+
Object.entries(Attributes).every(([key, { Values }]) => Values?.includes(attributes[key]));
|
|
81
|
+
}
|
|
82
|
+
return eventAttributesMemo[memoKey];
|
|
83
|
+
};
|
|
84
|
+
exports.matchesAttributes = matchesAttributes;
|
|
85
|
+
const matchesMetrics = ({ CampaignId, Schedule }, { metrics = {} }) => {
|
|
86
|
+
const { Metrics } = Schedule?.EventFilter?.Dimensions ?? {};
|
|
87
|
+
if ((0, isEmpty_1.default)(Metrics)) {
|
|
88
|
+
// if message does not have metrics defined it does not matter what metrics are on the event
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
if ((0, isEmpty_1.default)(metrics)) {
|
|
92
|
+
// if message does have metrics but the event does not then it always fails the check
|
|
93
|
+
return false;
|
|
94
|
+
}
|
|
95
|
+
const memoKey = `${CampaignId}:${JSON.stringify(metrics)}`;
|
|
96
|
+
if (!eventMetricsMemo.hasOwnProperty(memoKey)) {
|
|
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
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return eventMetricsMemo[memoKey];
|
|
106
|
+
};
|
|
107
|
+
exports.matchesMetrics = matchesMetrics;
|
|
108
|
+
const getComparator = (operator) => {
|
|
109
|
+
switch (operator) {
|
|
110
|
+
case 'EQUAL':
|
|
111
|
+
return (metricsVal, eventVal) => metricsVal === eventVal;
|
|
112
|
+
case 'GREATER_THAN':
|
|
113
|
+
return (metricsVal, eventVal) => metricsVal < eventVal;
|
|
114
|
+
case 'GREATER_THAN_OR_EQUAL':
|
|
115
|
+
return (metricsVal, eventVal) => metricsVal <= eventVal;
|
|
116
|
+
case 'LESS_THAN':
|
|
117
|
+
return (metricsVal, eventVal) => metricsVal > eventVal;
|
|
118
|
+
case 'LESS_THAN_OR_EQUAL':
|
|
119
|
+
return (metricsVal, eventVal) => metricsVal >= eventVal;
|
|
120
|
+
default:
|
|
121
|
+
return undefined;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
exports.getComparator = getComparator;
|
|
125
|
+
const isBeforeEndDate = ({ Schedule, }) => {
|
|
126
|
+
if (!Schedule?.EndDate) {
|
|
127
|
+
return true;
|
|
128
|
+
}
|
|
129
|
+
return new Date() < new Date(Schedule.EndDate);
|
|
130
|
+
};
|
|
131
|
+
exports.isBeforeEndDate = isBeforeEndDate;
|
|
132
|
+
const isQuietTime = (message) => {
|
|
133
|
+
const { Schedule } = message;
|
|
134
|
+
if (!Schedule?.QuietTime) {
|
|
135
|
+
return false;
|
|
136
|
+
}
|
|
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
|
+
if (!Start ||
|
|
140
|
+
!End ||
|
|
141
|
+
Start === End ||
|
|
142
|
+
!pattern.test(Start) ||
|
|
143
|
+
!pattern.test(End)) {
|
|
144
|
+
return false;
|
|
145
|
+
}
|
|
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
|
+
start.setHours(Number.parseInt(startHours, 10), Number.parseInt(startMinutes, 10), 0, 0);
|
|
152
|
+
end.setHours(Number.parseInt(endHours, 10), Number.parseInt(endMinutes, 10), 0, 0);
|
|
153
|
+
// if quiet time includes midnight, bump the end time to the next day
|
|
154
|
+
if (start > end) {
|
|
155
|
+
end.setDate(end.getDate() + 1);
|
|
156
|
+
}
|
|
157
|
+
const isQuietTime = now >= start && now <= end;
|
|
158
|
+
if (isQuietTime) {
|
|
159
|
+
exports.logger.debug('message filtered due to quiet time', message);
|
|
160
|
+
}
|
|
161
|
+
return isQuietTime;
|
|
162
|
+
};
|
|
163
|
+
exports.isQuietTime = isQuietTime;
|
|
164
|
+
const clearMemo = () => {
|
|
165
|
+
eventNameMemo = {};
|
|
166
|
+
eventAttributesMemo = {};
|
|
167
|
+
eventMetricsMemo = {};
|
|
168
|
+
};
|
|
169
|
+
exports.clearMemo = clearMemo;
|
|
170
|
+
// in the pinpoint console when a message is created with a Modal or Full Screen layout,
|
|
171
|
+
// it is assigned a layout value of MOBILE_FEED or OVERLAYS respectively in the message payload.
|
|
172
|
+
// In the future, Pinpoint will be updating the layout values in the aforementioned scenario
|
|
173
|
+
// to MODAL and FULL_SCREEN.
|
|
174
|
+
//
|
|
175
|
+
// This utility acts as a safeguard to ensure that:
|
|
176
|
+
// - 1. the usage of MOBILE_FEED and OVERLAYS as values for message layouts are not leaked
|
|
177
|
+
// outside the Pinpoint provider
|
|
178
|
+
// - 2. Amplify correctly handles the legacy layout values from Pinpoint after they are updated
|
|
179
|
+
const interpretLayout = (layout) => {
|
|
180
|
+
if (layout === 'MOBILE_FEED') {
|
|
181
|
+
return 'MODAL';
|
|
182
|
+
}
|
|
183
|
+
if (layout === 'OVERLAYS') {
|
|
184
|
+
return 'FULL_SCREEN';
|
|
185
|
+
}
|
|
186
|
+
// cast as PinpointInAppMessage['InAppMessage']['Layout'] allows `string` as a value
|
|
187
|
+
return layout;
|
|
188
|
+
};
|
|
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 = {};
|
|
196
|
+
if (BackgroundColor) {
|
|
197
|
+
extractedContent.container = {
|
|
198
|
+
style: {
|
|
199
|
+
backgroundColor: BackgroundColor,
|
|
200
|
+
},
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
if (HeaderConfig) {
|
|
204
|
+
extractedContent.header = {
|
|
205
|
+
// Default to empty string in rare cases we don't have a Header value
|
|
206
|
+
content: HeaderConfig.Header ?? '',
|
|
207
|
+
style: {
|
|
208
|
+
color: HeaderConfig.TextColor,
|
|
209
|
+
textAlign: HeaderConfig.Alignment?.toLowerCase(),
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
if (BodyConfig) {
|
|
214
|
+
extractedContent.body = {
|
|
215
|
+
// Default to empty string in rare cases we don't have a Body value
|
|
216
|
+
content: BodyConfig.Body ?? '',
|
|
217
|
+
style: {
|
|
218
|
+
color: BodyConfig.TextColor,
|
|
219
|
+
textAlign: BodyConfig.Alignment?.toLowerCase(),
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
if (ImageUrl) {
|
|
224
|
+
extractedContent.image = {
|
|
225
|
+
src: ImageUrl,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
if (defaultPrimaryButton) {
|
|
229
|
+
extractedContent.primaryButton = {
|
|
230
|
+
// Default to empty string in rare cases we don't have a Text value
|
|
231
|
+
title: defaultPrimaryButton.Text ?? '',
|
|
232
|
+
action: defaultPrimaryButton.ButtonAction,
|
|
233
|
+
url: defaultPrimaryButton.Link,
|
|
234
|
+
style: {
|
|
235
|
+
backgroundColor: defaultPrimaryButton.BackgroundColor,
|
|
236
|
+
borderRadius: defaultPrimaryButton.BorderRadius,
|
|
237
|
+
color: defaultPrimaryButton.TextColor,
|
|
238
|
+
},
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
if (defaultSecondaryButton) {
|
|
242
|
+
extractedContent.secondaryButton = {
|
|
243
|
+
// Default to empty string in rare cases we don't have a Text value
|
|
244
|
+
title: defaultSecondaryButton.Text ?? '',
|
|
245
|
+
action: defaultSecondaryButton.ButtonAction,
|
|
246
|
+
url: defaultSecondaryButton.Link,
|
|
247
|
+
style: {
|
|
248
|
+
backgroundColor: defaultSecondaryButton.BackgroundColor,
|
|
249
|
+
borderRadius: defaultSecondaryButton.BorderRadius,
|
|
250
|
+
color: defaultSecondaryButton.TextColor,
|
|
251
|
+
},
|
|
252
|
+
};
|
|
253
|
+
}
|
|
254
|
+
return extractedContent;
|
|
255
|
+
}) ?? []);
|
|
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;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { resolveConfig } from './resolveConfig';
|
|
2
|
+
export { resolveCredentials } from './resolveCredentials';
|
|
3
|
+
export { getInAppMessagingUserAgentString } from './userAgent';
|
|
4
|
+
export { PINPOINT_KEY_PREFIX, CATEGORY, CHANNEL_TYPE, STORAGE_KEY_SUFFIX, } from './constants';
|
|
5
|
+
export { processInAppMessages, sessionStateChangeHandler, incrementMessageCounts, } from './messageProcessingHelpers';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.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;
|
|
6
|
+
var resolveConfig_1 = require("./resolveConfig");
|
|
7
|
+
Object.defineProperty(exports, "resolveConfig", { enumerable: true, get: function () { return resolveConfig_1.resolveConfig; } });
|
|
8
|
+
var resolveCredentials_1 = require("./resolveCredentials");
|
|
9
|
+
Object.defineProperty(exports, "resolveCredentials", { enumerable: true, get: function () { return resolveCredentials_1.resolveCredentials; } });
|
|
10
|
+
var userAgent_1 = require("./userAgent");
|
|
11
|
+
Object.defineProperty(exports, "getInAppMessagingUserAgentString", { enumerable: true, get: function () { return userAgent_1.getInAppMessagingUserAgentString; } });
|
|
12
|
+
var constants_1 = require("./constants");
|
|
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; } });
|
|
17
|
+
var messageProcessingHelpers_1 = require("./messageProcessingHelpers");
|
|
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; } });
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { InAppMessage, InAppMessagingEvent } from '../../../types';
|
|
2
|
+
import type { InAppMessageCampaign as PinpointInAppMessage } from '@aws-amplify/core/internals/aws-clients/pinpoint';
|
|
3
|
+
import { SessionState } from '@aws-amplify/core/internals/utils';
|
|
4
|
+
export declare function processInAppMessages(messages: PinpointInAppMessage[], event: InAppMessagingEvent): Promise<InAppMessage[]>;
|
|
5
|
+
export declare function sessionStateChangeHandler(state: SessionState): void;
|
|
6
|
+
export declare function incrementMessageCounts(messageId: string): Promise<void>;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.incrementMessageCounts = exports.sessionStateChangeHandler = exports.processInAppMessages = void 0;
|
|
6
|
+
const helpers_1 = require("./helpers");
|
|
7
|
+
const core_1 = require("@aws-amplify/core");
|
|
8
|
+
const MESSAGE_DAILY_COUNT_KEY = 'pinpointProvider_inAppMessages_dailyCount';
|
|
9
|
+
const MESSAGE_TOTAL_COUNT_KEY = 'pinpointProvider_inAppMessages_totalCount';
|
|
10
|
+
const logger = new core_1.ConsoleLogger('InAppMessaging.processInAppMessages');
|
|
11
|
+
let sessionMessageCountMap = {};
|
|
12
|
+
async function processInAppMessages(messages, event) {
|
|
13
|
+
let highestPrioritySeen;
|
|
14
|
+
let acc = [];
|
|
15
|
+
for (let index = 0; index < messages.length; index++) {
|
|
16
|
+
const message = messages[index];
|
|
17
|
+
const messageQualifies = (0, helpers_1.matchesEventType)(message, event) &&
|
|
18
|
+
(0, helpers_1.matchesAttributes)(message, event) &&
|
|
19
|
+
(0, helpers_1.matchesMetrics)(message, event) &&
|
|
20
|
+
(0, helpers_1.isBeforeEndDate)(message) &&
|
|
21
|
+
(await isBelowCap(message));
|
|
22
|
+
// filter all qualifying messages returning only those that are of (relative) highest priority
|
|
23
|
+
if (messageQualifies) {
|
|
24
|
+
// have not yet encountered message with priority
|
|
25
|
+
if (!highestPrioritySeen) {
|
|
26
|
+
// this message has priority, so reset the accumulator with this message only
|
|
27
|
+
if (message.Priority) {
|
|
28
|
+
highestPrioritySeen = message.Priority;
|
|
29
|
+
acc = [message];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
// this message also has no priority, so just add this message to accumulator
|
|
33
|
+
acc.push(message);
|
|
34
|
+
}
|
|
35
|
+
// have previously encountered message with priority, so only messages with priority matter now
|
|
36
|
+
}
|
|
37
|
+
else if (message.Priority) {
|
|
38
|
+
// this message has higher priority (lower number), so reset the accumulator with this message only
|
|
39
|
+
if (message.Priority < highestPrioritySeen) {
|
|
40
|
+
highestPrioritySeen = message.Priority;
|
|
41
|
+
acc = [message];
|
|
42
|
+
// this message has the same priority, so just add this message to accumulator
|
|
43
|
+
}
|
|
44
|
+
else if (message.Priority === highestPrioritySeen) {
|
|
45
|
+
acc.push(message);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return normalizeMessages(acc);
|
|
51
|
+
}
|
|
52
|
+
exports.processInAppMessages = processInAppMessages;
|
|
53
|
+
function sessionStateChangeHandler(state) {
|
|
54
|
+
if (state === 'started') {
|
|
55
|
+
// reset all session counts
|
|
56
|
+
sessionMessageCountMap = {};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.sessionStateChangeHandler = sessionStateChangeHandler;
|
|
60
|
+
async function incrementMessageCounts(messageId) {
|
|
61
|
+
const { sessionCount, dailyCount, totalCount } = await getMessageCounts(messageId);
|
|
62
|
+
setSessionCount(messageId, sessionCount + 1);
|
|
63
|
+
setDailyCount(dailyCount + 1);
|
|
64
|
+
await setTotalCount(messageId, totalCount + 1);
|
|
65
|
+
}
|
|
66
|
+
exports.incrementMessageCounts = incrementMessageCounts;
|
|
67
|
+
function normalizeMessages(messages) {
|
|
68
|
+
return messages.map(message => {
|
|
69
|
+
const { CampaignId, InAppMessage } = message;
|
|
70
|
+
return {
|
|
71
|
+
// Default to empty string in rare cases we don't have a campaignId
|
|
72
|
+
id: CampaignId ?? '',
|
|
73
|
+
content: (0, helpers_1.extractContent)(message),
|
|
74
|
+
// Default to TOP_BANNER layout in rare cases we don't have a Layout
|
|
75
|
+
layout: InAppMessage?.Layout
|
|
76
|
+
? (0, helpers_1.interpretLayout)(InAppMessage.Layout)
|
|
77
|
+
: 'TOP_BANNER',
|
|
78
|
+
metadata: (0, helpers_1.extractMetadata)(message),
|
|
79
|
+
};
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async function isBelowCap({ CampaignId, SessionCap, DailyCap, TotalCap, }) {
|
|
83
|
+
const { sessionCount, dailyCount, totalCount } = await getMessageCounts(CampaignId);
|
|
84
|
+
return ((!SessionCap || sessionCount < SessionCap) &&
|
|
85
|
+
(!DailyCap || dailyCount < DailyCap) &&
|
|
86
|
+
(!TotalCap || totalCount < TotalCap));
|
|
87
|
+
}
|
|
88
|
+
async function getMessageCounts(messageId) {
|
|
89
|
+
let messageCounts = {
|
|
90
|
+
sessionCount: 0,
|
|
91
|
+
dailyCount: 0,
|
|
92
|
+
totalCount: 0,
|
|
93
|
+
};
|
|
94
|
+
try {
|
|
95
|
+
// only return true counts if there is a messageId else default to 0
|
|
96
|
+
if (messageId)
|
|
97
|
+
messageCounts = {
|
|
98
|
+
sessionCount: getSessionCount(messageId),
|
|
99
|
+
dailyCount: await getDailyCount(),
|
|
100
|
+
totalCount: await getTotalCount(messageId),
|
|
101
|
+
};
|
|
102
|
+
return messageCounts;
|
|
103
|
+
}
|
|
104
|
+
catch (err) {
|
|
105
|
+
logger.error('Failed to get message counts from storage', err);
|
|
106
|
+
// If there are no cached counts or there is an error,
|
|
107
|
+
// we default to 0 allowing all the messages to be eligible
|
|
108
|
+
return messageCounts;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
function getSessionCount(messageId) {
|
|
112
|
+
return sessionMessageCountMap[messageId] ?? 0;
|
|
113
|
+
}
|
|
114
|
+
function setSessionCount(messageId, count) {
|
|
115
|
+
sessionMessageCountMap[messageId] = count;
|
|
116
|
+
}
|
|
117
|
+
function setDailyCount(count) {
|
|
118
|
+
const dailyCount = {
|
|
119
|
+
count,
|
|
120
|
+
lastCountTimestamp: getStartOfDay(),
|
|
121
|
+
};
|
|
122
|
+
try {
|
|
123
|
+
core_1.defaultStorage.setItem(MESSAGE_DAILY_COUNT_KEY, JSON.stringify(dailyCount));
|
|
124
|
+
}
|
|
125
|
+
catch (err) {
|
|
126
|
+
logger.error('Failed to save daily message count to storage', err);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
function setTotalCountMap(countMap) {
|
|
130
|
+
try {
|
|
131
|
+
core_1.defaultStorage.setItem(MESSAGE_TOTAL_COUNT_KEY, JSON.stringify(countMap));
|
|
132
|
+
}
|
|
133
|
+
catch (err) {
|
|
134
|
+
logger.error('Failed to save total count to storage', err);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
async function setTotalCount(messageId, count) {
|
|
138
|
+
const totalCountMap = await getTotalCountMap();
|
|
139
|
+
const updatedMap = {
|
|
140
|
+
...totalCountMap,
|
|
141
|
+
[messageId]: count,
|
|
142
|
+
};
|
|
143
|
+
setTotalCountMap(updatedMap);
|
|
144
|
+
}
|
|
145
|
+
async function getDailyCount() {
|
|
146
|
+
const today = getStartOfDay();
|
|
147
|
+
const item = await core_1.defaultStorage.getItem(MESSAGE_DAILY_COUNT_KEY);
|
|
148
|
+
// Parse stored count or initialize as empty count
|
|
149
|
+
const counter = item
|
|
150
|
+
? JSON.parse(item)
|
|
151
|
+
: { count: 0, lastCountTimestamp: today };
|
|
152
|
+
// If the stored counter timestamp is today, use it as the count, otherwise reset to 0
|
|
153
|
+
return counter.lastCountTimestamp === today ? counter.count : 0;
|
|
154
|
+
}
|
|
155
|
+
async function getTotalCountMap() {
|
|
156
|
+
const item = await core_1.defaultStorage.getItem(MESSAGE_TOTAL_COUNT_KEY);
|
|
157
|
+
// Parse stored count map or initialize as empty
|
|
158
|
+
return item ? JSON.parse(item) : {};
|
|
159
|
+
}
|
|
160
|
+
async function getTotalCount(messageId) {
|
|
161
|
+
const countMap = await getTotalCountMap();
|
|
162
|
+
// Return stored count or initialize as empty count
|
|
163
|
+
return countMap[messageId] || 0;
|
|
164
|
+
}
|
|
165
|
+
const getStartOfDay = () => {
|
|
166
|
+
const now = new Date();
|
|
167
|
+
now.setHours(0, 0, 0, 0);
|
|
168
|
+
return now.toISOString();
|
|
169
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resolveConfig = void 0;
|
|
6
|
+
const core_1 = require("@aws-amplify/core");
|
|
7
|
+
const errors_1 = require("../../../errors");
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const resolveConfig = () => {
|
|
12
|
+
const { appId, region } = core_1.Amplify.getConfig().Notifications?.InAppMessaging?.Pinpoint ?? {};
|
|
13
|
+
(0, errors_1.assertValidationError)(!!appId, errors_1.InAppMessagingValidationErrorCode.NoAppId);
|
|
14
|
+
(0, errors_1.assertValidationError)(!!region, errors_1.InAppMessagingValidationErrorCode.NoRegion);
|
|
15
|
+
return { appId, region };
|
|
16
|
+
};
|
|
17
|
+
exports.resolveConfig = resolveConfig;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.resolveCredentials = void 0;
|
|
6
|
+
const core_1 = require("@aws-amplify/core");
|
|
7
|
+
const errors_1 = require("../../../errors");
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
11
|
+
const resolveCredentials = async () => {
|
|
12
|
+
const { credentials, identityId } = await (0, core_1.fetchAuthSession)();
|
|
13
|
+
(0, errors_1.assertValidationError)(!!credentials, errors_1.InAppMessagingValidationErrorCode.NoCredentials);
|
|
14
|
+
return { credentials, identityId };
|
|
15
|
+
};
|
|
16
|
+
exports.resolveCredentials = resolveCredentials;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { InAppMessagingAction } from '@aws-amplify/core/internals/utils';
|
|
2
|
+
import { UserAgent } from '@aws-sdk/types';
|
|
3
|
+
export declare function getInAppMessagingUserAgent(action: InAppMessagingAction): UserAgent;
|
|
4
|
+
export declare function getInAppMessagingUserAgentString(action: InAppMessagingAction): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getInAppMessagingUserAgentString = exports.getInAppMessagingUserAgent = void 0;
|
|
4
|
+
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
5
|
+
// SPDX-License-Identifier: Apache-2.0
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
function getInAppMessagingUserAgent(action) {
|
|
8
|
+
return (0, utils_1.getAmplifyUserAgentObject)({
|
|
9
|
+
category: utils_1.Category.InAppMessaging,
|
|
10
|
+
action,
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
exports.getInAppMessagingUserAgent = getInAppMessagingUserAgent;
|
|
14
|
+
function getInAppMessagingUserAgentString(action) {
|
|
15
|
+
return (0, utils_1.getAmplifyUserAgent)({
|
|
16
|
+
category: utils_1.Category.InAppMessaging,
|
|
17
|
+
action,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
exports.getInAppMessagingUserAgentString = getInAppMessagingUserAgentString;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { InAppMessagingServiceOptions } from './options';
|
|
2
|
+
export { InAppMessagingIdentifyUserInput } from './inputs';
|
|
3
|
+
export { InAppMessageInteractionEvent, InAppMessagingEvent } from './event';
|
|
4
|
+
export { InAppMessage, InAppMessageAction, InAppMessageContent, InAppMessageLayout, InAppMessageTextAlign, InAppMessageButton, InAppMessageImage, InAppMessageStyle, } from './message';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { UserProfile } from '@aws-amplify/core';
|
|
2
|
+
import { InAppMessagingServiceOptions } from '.';
|
|
3
|
+
/**
|
|
4
|
+
* Input type for `identifyUser`.
|
|
5
|
+
*/
|
|
6
|
+
export type InAppMessagingIdentifyUserInput<ServiceOptions extends InAppMessagingServiceOptions = InAppMessagingServiceOptions> = {
|
|
7
|
+
/**
|
|
8
|
+
* A User ID associated to the current device.
|
|
9
|
+
*/
|
|
10
|
+
userId: string;
|
|
11
|
+
/**
|
|
12
|
+
* Additional information about the user and their device.
|
|
13
|
+
*/
|
|
14
|
+
userProfile: UserProfile;
|
|
15
|
+
/**
|
|
16
|
+
* Options to be passed to the API.
|
|
17
|
+
*/
|
|
18
|
+
options?: ServiceOptions;
|
|
19
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
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
|
+
interface InAppMessageContainer {
|
|
5
|
+
style?: InAppMessageStyle;
|
|
6
|
+
}
|
|
7
|
+
interface InAppMessageHeader {
|
|
8
|
+
content: string;
|
|
9
|
+
style?: InAppMessageStyle;
|
|
10
|
+
}
|
|
11
|
+
interface InAppMessageBody {
|
|
12
|
+
content: string;
|
|
13
|
+
style?: InAppMessageStyle;
|
|
14
|
+
}
|
|
15
|
+
export interface InAppMessageImage {
|
|
16
|
+
src: string;
|
|
17
|
+
}
|
|
18
|
+
export interface InAppMessageButton {
|
|
19
|
+
title: string;
|
|
20
|
+
action: InAppMessageAction;
|
|
21
|
+
url?: string;
|
|
22
|
+
style?: InAppMessageStyle;
|
|
23
|
+
}
|
|
24
|
+
export interface InAppMessageStyle {
|
|
25
|
+
backgroundColor?: string;
|
|
26
|
+
borderRadius?: number;
|
|
27
|
+
color?: string;
|
|
28
|
+
textAlign?: InAppMessageTextAlign;
|
|
29
|
+
}
|
|
30
|
+
export interface InAppMessageContent {
|
|
31
|
+
container?: InAppMessageContainer;
|
|
32
|
+
header?: InAppMessageHeader;
|
|
33
|
+
body?: InAppMessageBody;
|
|
34
|
+
image?: InAppMessageImage;
|
|
35
|
+
primaryButton?: InAppMessageButton;
|
|
36
|
+
secondaryButton?: InAppMessageButton;
|
|
37
|
+
}
|
|
38
|
+
export interface InAppMessage {
|
|
39
|
+
id: string;
|
|
40
|
+
layout: InAppMessageLayout;
|
|
41
|
+
content: InAppMessageContent[];
|
|
42
|
+
metadata?: any;
|
|
43
|
+
}
|
|
44
|
+
export {};
|