@aws-amplify/notifications 2.0.1-server-generate-client.1e317a1.0 → 2.0.1-unstable.04fd02c.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,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aws-amplify/notifications/in-app-messaging",
|
|
3
|
-
"main": "../lib/inAppMessaging/
|
|
4
|
-
"browser": "../lib-esm/inAppMessaging/
|
|
5
|
-
"module": "../lib-esm/inAppMessaging/
|
|
6
|
-
"typings": "../lib-esm/inAppMessaging/
|
|
3
|
+
"main": "../lib/inAppMessaging/index.js",
|
|
4
|
+
"browser": "../lib-esm/inAppMessaging/index.js",
|
|
5
|
+
"module": "../lib-esm/inAppMessaging/index.js",
|
|
6
|
+
"typings": "../lib-esm/inAppMessaging/index.d.ts"
|
|
7
7
|
}
|
|
@@ -2,55 +2,37 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
args[_i - 1] = arguments[_i];
|
|
11
|
-
}
|
|
12
|
-
var _a;
|
|
13
|
-
(_a = eventListeners[type]) === null || _a === void 0 ? void 0 : _a.forEach(function (listener) {
|
|
14
|
-
listener.handleEvent.apply(listener, tslib_1.__spread(args));
|
|
5
|
+
exports.addEventListener = exports.notifyEventListenersAndAwaitHandlers = exports.notifyEventListeners = void 0;
|
|
6
|
+
const eventListeners = {};
|
|
7
|
+
const notifyEventListeners = (type, ...args) => {
|
|
8
|
+
eventListeners[type]?.forEach(listener => {
|
|
9
|
+
listener.handleEvent(...args);
|
|
15
10
|
});
|
|
16
11
|
};
|
|
17
|
-
exports.
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
args
|
|
12
|
+
exports.notifyEventListeners = notifyEventListeners;
|
|
13
|
+
const notifyEventListenersAndAwaitHandlers = (type, ...args) => Promise.all(Array.from(eventListeners[type] ?? []).map(async (listener) => {
|
|
14
|
+
try {
|
|
15
|
+
await listener.handleEvent(...args);
|
|
21
16
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
_a.trys.push([0, 2, , 3]);
|
|
29
|
-
return [4 /*yield*/, listener.handleEvent.apply(listener, tslib_1.__spread(args))];
|
|
30
|
-
case 1:
|
|
31
|
-
_a.sent();
|
|
32
|
-
return [3 /*break*/, 3];
|
|
33
|
-
case 2:
|
|
34
|
-
err_1 = _a.sent();
|
|
35
|
-
throw err_1;
|
|
36
|
-
case 3: return [2 /*return*/];
|
|
37
|
-
}
|
|
38
|
-
});
|
|
39
|
-
}); }));
|
|
40
|
-
};
|
|
41
|
-
exports.addEventListener = function (type, handler) {
|
|
17
|
+
catch (err) {
|
|
18
|
+
throw err;
|
|
19
|
+
}
|
|
20
|
+
}));
|
|
21
|
+
exports.notifyEventListenersAndAwaitHandlers = notifyEventListenersAndAwaitHandlers;
|
|
22
|
+
const addEventListener = (type, handler) => {
|
|
42
23
|
// If there is no listener set for the event type, just create it
|
|
43
24
|
if (!eventListeners[type]) {
|
|
44
25
|
eventListeners[type] = new Set();
|
|
45
26
|
}
|
|
46
|
-
|
|
27
|
+
const listener = {
|
|
47
28
|
handleEvent: handler,
|
|
48
|
-
remove:
|
|
29
|
+
remove: () => {
|
|
49
30
|
eventListeners[type].delete(listener);
|
|
50
31
|
},
|
|
51
32
|
};
|
|
52
33
|
eventListeners[type].add(listener);
|
|
53
34
|
return {
|
|
54
|
-
remove:
|
|
35
|
+
remove: () => listener.remove(),
|
|
55
36
|
};
|
|
56
37
|
};
|
|
38
|
+
exports.addEventListener = addEventListener;
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.notifyEventListenersAndAwaitHandlers = exports.notifyEventListeners = exports.addEventListener = void 0;
|
|
5
6
|
var eventListeners_1 = require("./eventListeners");
|
|
6
|
-
exports
|
|
7
|
-
exports
|
|
8
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "addEventListener", { enumerable: true, get: function () { return eventListeners_1.addEventListener; } });
|
|
8
|
+
Object.defineProperty(exports, "notifyEventListeners", { enumerable: true, get: function () { return eventListeners_1.notifyEventListeners; } });
|
|
9
|
+
Object.defineProperty(exports, "notifyEventListenersAndAwaitHandlers", { enumerable: true, get: function () { return eventListeners_1.notifyEventListenersAndAwaitHandlers; } });
|
|
@@ -4,7 +4,7 @@ export interface EventListener<EventHandler extends Function> {
|
|
|
4
4
|
handleEvent: EventHandler;
|
|
5
5
|
remove: () => void;
|
|
6
6
|
}
|
|
7
|
-
export
|
|
8
|
-
export
|
|
7
|
+
export type EventType = InAppMessageInteractionEvent | PushNotificationEvent;
|
|
8
|
+
export type EventListenerRemover = {
|
|
9
9
|
remove: () => void;
|
|
10
10
|
};
|
|
@@ -2,21 +2,18 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
exports.InAppMessagingError = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
9
9
|
*/
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
var _this = _super.call(this, params) || this;
|
|
10
|
+
class InAppMessagingError extends utils_1.AmplifyError {
|
|
11
|
+
constructor(params) {
|
|
12
|
+
super(params);
|
|
14
13
|
// Hack for making the custom error class work when transpiled to es5
|
|
15
14
|
// TODO: Delete the following 2 lines after we change the build target to >= es2015
|
|
16
|
-
|
|
17
|
-
Object.setPrototypeOf(
|
|
18
|
-
return _this;
|
|
15
|
+
this.constructor = InAppMessagingError;
|
|
16
|
+
Object.setPrototypeOf(this, InAppMessagingError.prototype);
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
}(utils_1.AmplifyError));
|
|
18
|
+
}
|
|
22
19
|
exports.InAppMessagingError = InAppMessagingError;
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
exports.assertServiceError = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
const InAppMessagingError_1 = require("./InAppMessagingError");
|
|
7
8
|
function assertServiceError(error) {
|
|
8
9
|
if (!error ||
|
|
9
10
|
error.name === 'Error' ||
|
|
@@ -2,15 +2,16 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
exports.assertValidationError = void 0;
|
|
6
|
+
const InAppMessagingError_1 = require("./InAppMessagingError");
|
|
7
|
+
const validation_1 = require("./validation");
|
|
7
8
|
/**
|
|
8
9
|
* @internal
|
|
9
10
|
*/
|
|
10
11
|
function assertValidationError(assertion, name) {
|
|
11
|
-
|
|
12
|
+
const { message, recoverySuggestion } = validation_1.validationErrorMap[name];
|
|
12
13
|
if (!assertion) {
|
|
13
|
-
throw new InAppMessagingError_1.InAppMessagingError({ name
|
|
14
|
+
throw new InAppMessagingError_1.InAppMessagingError({ name, message, recoverySuggestion });
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
exports.assertValidationError = assertValidationError;
|
|
@@ -2,12 +2,13 @@
|
|
|
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.validationErrorMap = exports.InAppMessagingValidationErrorCode = exports.assertServiceError = exports.assertValidationError = exports.InAppMessagingError = void 0;
|
|
5
6
|
var InAppMessagingError_1 = require("./InAppMessagingError");
|
|
6
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "InAppMessagingError", { enumerable: true, get: function () { return InAppMessagingError_1.InAppMessagingError; } });
|
|
7
8
|
var assertValidationError_1 = require("./assertValidationError");
|
|
8
|
-
exports
|
|
9
|
+
Object.defineProperty(exports, "assertValidationError", { enumerable: true, get: function () { return assertValidationError_1.assertValidationError; } });
|
|
9
10
|
var assertServiceError_1 = require("./assertServiceError");
|
|
10
|
-
exports
|
|
11
|
+
Object.defineProperty(exports, "assertServiceError", { enumerable: true, get: function () { return assertServiceError_1.assertServiceError; } });
|
|
11
12
|
var validation_1 = require("./validation");
|
|
12
|
-
exports
|
|
13
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "InAppMessagingValidationErrorCode", { enumerable: true, get: function () { return validation_1.InAppMessagingValidationErrorCode; } });
|
|
14
|
+
Object.defineProperty(exports, "validationErrorMap", { enumerable: true, get: function () { return validation_1.validationErrorMap; } });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
|
-
var _a;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.validationErrorMap = exports.InAppMessagingValidationErrorCode = void 0;
|
|
6
6
|
var InAppMessagingValidationErrorCode;
|
|
7
7
|
(function (InAppMessagingValidationErrorCode) {
|
|
8
8
|
InAppMessagingValidationErrorCode["NoAppId"] = "NoAppId";
|
|
@@ -10,18 +10,18 @@ var InAppMessagingValidationErrorCode;
|
|
|
10
10
|
InAppMessagingValidationErrorCode["NoRegion"] = "NoRegion";
|
|
11
11
|
InAppMessagingValidationErrorCode["NotInitialized"] = "NotInitialized";
|
|
12
12
|
})(InAppMessagingValidationErrorCode = exports.InAppMessagingValidationErrorCode || (exports.InAppMessagingValidationErrorCode = {}));
|
|
13
|
-
exports.validationErrorMap =
|
|
14
|
-
|
|
13
|
+
exports.validationErrorMap = {
|
|
14
|
+
[InAppMessagingValidationErrorCode.NoAppId]: {
|
|
15
15
|
message: 'Missing application id.',
|
|
16
16
|
},
|
|
17
|
-
|
|
17
|
+
[InAppMessagingValidationErrorCode.NoCredentials]: {
|
|
18
18
|
message: 'Credentials should not be empty.',
|
|
19
19
|
},
|
|
20
|
-
|
|
20
|
+
[InAppMessagingValidationErrorCode.NoRegion]: {
|
|
21
21
|
message: 'Missing region.',
|
|
22
22
|
},
|
|
23
|
-
|
|
23
|
+
[InAppMessagingValidationErrorCode.NotInitialized]: {
|
|
24
24
|
message: 'In-app messaging has not been initialized.',
|
|
25
25
|
recoverySuggestion: 'Please make sure to first call `initializePushNotifications`.',
|
|
26
26
|
},
|
|
27
|
-
|
|
27
|
+
};
|
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { identifyUser, syncMessages, dispatchEvent, setConflictHandler, initializeInAppMessaging, onMessageReceived, onMessageDisplayed, onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, IdentifyUserInput, DispatchEventInput, SetConflictHandlerInput, OnMessageActionTakenInput, OnMessageDismissedInput, OnMessageDisplayedInput, OnMessageReceivedInput, NotifyMessageInteractionInput, OnMessageReceivedOutput, OnMessageActionTakenOutput, OnMessageDismissedOutput, OnMessageDisplayedOutput, } from './providers/pinpoint';
|
|
1
|
+
export { identifyUser, syncMessages, dispatchEvent, setConflictHandler, initializeInAppMessaging, onMessageReceived, onMessageDisplayed, onMessageDismissed, onMessageActionTaken, notifyMessageInteraction, clearMessages, IdentifyUserInput, DispatchEventInput, SetConflictHandlerInput, OnMessageActionTakenInput, OnMessageDismissedInput, OnMessageDisplayedInput, OnMessageReceivedInput, NotifyMessageInteractionInput, OnMessageReceivedOutput, OnMessageActionTakenOutput, OnMessageDismissedOutput, OnMessageDisplayedOutput, } from './providers/pinpoint';
|
|
2
|
+
export { InAppMessage, InAppMessageAction, InAppMessageContent, InAppMessageLayout, InAppMessageTextAlign, InAppMessageButton, InAppMessageImage, InAppMessageStyle, } from './types';
|
|
@@ -2,14 +2,16 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDismissed = exports.onMessageDisplayed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.dispatchEvent = exports.syncMessages = exports.identifyUser = void 0;
|
|
5
6
|
var pinpoint_1 = require("./providers/pinpoint");
|
|
6
|
-
exports
|
|
7
|
-
exports
|
|
8
|
-
exports
|
|
9
|
-
exports
|
|
10
|
-
exports
|
|
11
|
-
exports
|
|
12
|
-
exports
|
|
13
|
-
exports
|
|
14
|
-
exports
|
|
15
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return pinpoint_1.identifyUser; } });
|
|
8
|
+
Object.defineProperty(exports, "syncMessages", { enumerable: true, get: function () { return pinpoint_1.syncMessages; } });
|
|
9
|
+
Object.defineProperty(exports, "dispatchEvent", { enumerable: true, get: function () { return pinpoint_1.dispatchEvent; } });
|
|
10
|
+
Object.defineProperty(exports, "setConflictHandler", { enumerable: true, get: function () { return pinpoint_1.setConflictHandler; } });
|
|
11
|
+
Object.defineProperty(exports, "initializeInAppMessaging", { enumerable: true, get: function () { return pinpoint_1.initializeInAppMessaging; } });
|
|
12
|
+
Object.defineProperty(exports, "onMessageReceived", { enumerable: true, get: function () { return pinpoint_1.onMessageReceived; } });
|
|
13
|
+
Object.defineProperty(exports, "onMessageDisplayed", { enumerable: true, get: function () { return pinpoint_1.onMessageDisplayed; } });
|
|
14
|
+
Object.defineProperty(exports, "onMessageDismissed", { enumerable: true, get: function () { return pinpoint_1.onMessageDismissed; } });
|
|
15
|
+
Object.defineProperty(exports, "onMessageActionTaken", { enumerable: true, get: function () { return pinpoint_1.onMessageActionTaken; } });
|
|
16
|
+
Object.defineProperty(exports, "notifyMessageInteraction", { enumerable: true, get: function () { return pinpoint_1.notifyMessageInteraction; } });
|
|
17
|
+
Object.defineProperty(exports, "clearMessages", { enumerable: true, get: function () { return pinpoint_1.clearMessages; } });
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clear locally cached messages.
|
|
3
|
+
*
|
|
4
|
+
* @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown if In App messaging hasn't been initialized.
|
|
5
|
+
* @returns A promise that will resolve when the operation is complete.
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* // Clear locally cached messages.
|
|
9
|
+
* await clearMessages();
|
|
10
|
+
*
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export declare function clearMessages(): Promise<void>;
|
|
@@ -0,0 +1,26 @@
|
|
|
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.clearMessages = void 0;
|
|
6
|
+
const core_1 = require("@aws-amplify/core");
|
|
7
|
+
const utils_1 = require("../utils");
|
|
8
|
+
const utils_2 = require("../../../utils");
|
|
9
|
+
/**
|
|
10
|
+
* Clear locally cached messages.
|
|
11
|
+
*
|
|
12
|
+
* @throws validation: {@link InAppMessagingValidationErrorCode} - Thrown if In App messaging hasn't been initialized.
|
|
13
|
+
* @returns A promise that will resolve when the operation is complete.
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* // Clear locally cached messages.
|
|
17
|
+
* await clearMessages();
|
|
18
|
+
*
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
async function clearMessages() {
|
|
22
|
+
(0, utils_2.assertIsInitialized)();
|
|
23
|
+
const key = `${utils_1.PINPOINT_KEY_PREFIX}${utils_1.STORAGE_KEY_SUFFIX}`;
|
|
24
|
+
return await core_1.defaultStorage.removeItem(key);
|
|
25
|
+
}
|
|
26
|
+
exports.clearMessages = clearMessages;
|
|
@@ -1,15 +1,18 @@
|
|
|
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
|
-
|
|
8
|
+
exports.dispatchEvent = void 0;
|
|
9
|
+
const utils_1 = require("../utils");
|
|
10
|
+
const flatten_1 = __importDefault(require("lodash/flatten"));
|
|
11
|
+
const core_1 = require("@aws-amplify/core");
|
|
12
|
+
const eventListeners_1 = require("../../../../eventListeners");
|
|
13
|
+
const errors_1 = require("../../../errors");
|
|
14
|
+
const setConflictHandler_1 = require("./setConflictHandler");
|
|
15
|
+
const utils_2 = require("../../../utils");
|
|
13
16
|
/**
|
|
14
17
|
* Triggers an In-App message to be displayed. Use this after your campaigns have been synced to the device using
|
|
15
18
|
* {@link syncMessages}. Based on the messages synced and the event passed to this API, it triggers the display
|
|
@@ -34,35 +37,20 @@ var utils_2 = require("../../../utils");
|
|
|
34
37
|
* await dispatchEvent({ name: 'test_event' });
|
|
35
38
|
* ```
|
|
36
39
|
*/
|
|
37
|
-
function dispatchEvent(input) {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
case 3:
|
|
53
|
-
messages = _a.sent();
|
|
54
|
-
flattenedMessages = flatten_1.default(messages);
|
|
55
|
-
if (flattenedMessages.length > 0) {
|
|
56
|
-
eventListeners_1.notifyEventListeners('messageReceived', setConflictHandler_1.conflictHandler(flattenedMessages));
|
|
57
|
-
}
|
|
58
|
-
return [3 /*break*/, 5];
|
|
59
|
-
case 4:
|
|
60
|
-
error_1 = _a.sent();
|
|
61
|
-
errors_1.assertServiceError(error_1);
|
|
62
|
-
throw error_1;
|
|
63
|
-
case 5: return [2 /*return*/];
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
});
|
|
40
|
+
async function dispatchEvent(input) {
|
|
41
|
+
(0, utils_2.assertIsInitialized)();
|
|
42
|
+
try {
|
|
43
|
+
const key = `${utils_1.PINPOINT_KEY_PREFIX}${utils_1.STORAGE_KEY_SUFFIX}`;
|
|
44
|
+
const cachedMessages = await core_1.defaultStorage.getItem(key);
|
|
45
|
+
const messages = await (0, utils_1.processInAppMessages)(cachedMessages ? JSON.parse(cachedMessages) : [], input);
|
|
46
|
+
const flattenedMessages = (0, flatten_1.default)(messages);
|
|
47
|
+
if (flattenedMessages.length > 0) {
|
|
48
|
+
(0, eventListeners_1.notifyEventListeners)('messageReceived', (0, setConflictHandler_1.conflictHandler)(flattenedMessages));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch (error) {
|
|
52
|
+
(0, errors_1.assertServiceError)(error);
|
|
53
|
+
throw error;
|
|
54
|
+
}
|
|
67
55
|
}
|
|
68
56
|
exports.dispatchEvent = dispatchEvent;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IdentifyUserInput } from '../types';
|
|
1
2
|
/**
|
|
2
3
|
* Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
|
|
3
4
|
* profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
|
|
@@ -47,4 +48,4 @@
|
|
|
47
48
|
* },
|
|
48
49
|
* });
|
|
49
50
|
*/
|
|
50
|
-
export declare const identifyUser: ({ userId, userProfile, options, }:
|
|
51
|
+
export declare const identifyUser: ({ userId, userProfile, options, }: IdentifyUserInput) => Promise<void>;
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
exports.identifyUser = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
const pinpoint_1 = require("@aws-amplify/core/internals/providers/pinpoint");
|
|
8
|
+
const utils_2 = require("../utils");
|
|
9
|
+
const utils_3 = require("../../../utils");
|
|
10
10
|
/**
|
|
11
11
|
* Sends information about a user to Pinpoint. Sending user information allows you to associate a user to their user
|
|
12
12
|
* profile and activities or actions in your application. Activity can be tracked across devices & platforms by using
|
|
@@ -56,35 +56,24 @@ var utils_3 = require("../../../utils");
|
|
|
56
56
|
* },
|
|
57
57
|
* });
|
|
58
58
|
*/
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
category: utils_2.CATEGORY,
|
|
78
|
-
credentials: credentials,
|
|
79
|
-
identityId: identityId,
|
|
80
|
-
region: region,
|
|
81
|
-
userAttributes: userAttributes,
|
|
82
|
-
userId: userId,
|
|
83
|
-
userProfile: userProfile,
|
|
84
|
-
userAgentValue: utils_2.getInAppMessagingUserAgentString(utils_1.InAppMessagingAction.IdentifyUser),
|
|
85
|
-
});
|
|
86
|
-
return [2 /*return*/];
|
|
87
|
-
}
|
|
88
|
-
});
|
|
59
|
+
const identifyUser = async ({ userId, userProfile, options, }) => {
|
|
60
|
+
(0, utils_3.assertIsInitialized)();
|
|
61
|
+
const { credentials, identityId } = await (0, utils_2.resolveCredentials)();
|
|
62
|
+
const { appId, region } = (0, utils_2.resolveConfig)();
|
|
63
|
+
const { address, optOut, userAttributes } = options ?? {};
|
|
64
|
+
(0, pinpoint_1.updateEndpoint)({
|
|
65
|
+
address,
|
|
66
|
+
channelType: utils_2.CHANNEL_TYPE,
|
|
67
|
+
optOut,
|
|
68
|
+
appId,
|
|
69
|
+
category: utils_2.CATEGORY,
|
|
70
|
+
credentials,
|
|
71
|
+
identityId,
|
|
72
|
+
region,
|
|
73
|
+
userAttributes,
|
|
74
|
+
userId,
|
|
75
|
+
userProfile,
|
|
76
|
+
userAgentValue: (0, utils_2.getInAppMessagingUserAgentString)(utils_1.InAppMessagingAction.IdentifyUser),
|
|
89
77
|
});
|
|
90
78
|
};
|
|
79
|
+
exports.identifyUser = identifyUser;
|
|
@@ -8,3 +8,4 @@ export { onMessageDismissed } from './onMessageDismissed';
|
|
|
8
8
|
export { onMessageDisplayed } from './onMessageDisplayed';
|
|
9
9
|
export { onMessageActionTaken } from './onMessageActionTaken';
|
|
10
10
|
export { notifyMessageInteraction } from './notifyMessageInteraction';
|
|
11
|
+
export { clearMessages } from './clearMessages';
|
|
@@ -2,23 +2,26 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
+
exports.clearMessages = exports.notifyMessageInteraction = exports.onMessageActionTaken = exports.onMessageDisplayed = exports.onMessageDismissed = exports.onMessageReceived = exports.initializeInAppMessaging = exports.setConflictHandler = exports.dispatchEvent = exports.syncMessages = exports.identifyUser = void 0;
|
|
5
6
|
var identifyUser_1 = require("./identifyUser");
|
|
6
|
-
exports
|
|
7
|
+
Object.defineProperty(exports, "identifyUser", { enumerable: true, get: function () { return identifyUser_1.identifyUser; } });
|
|
7
8
|
var syncMessages_1 = require("./syncMessages");
|
|
8
|
-
exports
|
|
9
|
+
Object.defineProperty(exports, "syncMessages", { enumerable: true, get: function () { return syncMessages_1.syncMessages; } });
|
|
9
10
|
var dispatchEvent_1 = require("./dispatchEvent");
|
|
10
|
-
exports
|
|
11
|
+
Object.defineProperty(exports, "dispatchEvent", { enumerable: true, get: function () { return dispatchEvent_1.dispatchEvent; } });
|
|
11
12
|
var setConflictHandler_1 = require("./setConflictHandler");
|
|
12
|
-
exports
|
|
13
|
+
Object.defineProperty(exports, "setConflictHandler", { enumerable: true, get: function () { return setConflictHandler_1.setConflictHandler; } });
|
|
13
14
|
var initializeInAppMessaging_1 = require("./initializeInAppMessaging");
|
|
14
|
-
exports
|
|
15
|
+
Object.defineProperty(exports, "initializeInAppMessaging", { enumerable: true, get: function () { return initializeInAppMessaging_1.initializeInAppMessaging; } });
|
|
15
16
|
var onMessageReceived_1 = require("./onMessageReceived");
|
|
16
|
-
exports
|
|
17
|
+
Object.defineProperty(exports, "onMessageReceived", { enumerable: true, get: function () { return onMessageReceived_1.onMessageReceived; } });
|
|
17
18
|
var onMessageDismissed_1 = require("./onMessageDismissed");
|
|
18
|
-
exports
|
|
19
|
+
Object.defineProperty(exports, "onMessageDismissed", { enumerable: true, get: function () { return onMessageDismissed_1.onMessageDismissed; } });
|
|
19
20
|
var onMessageDisplayed_1 = require("./onMessageDisplayed");
|
|
20
|
-
exports
|
|
21
|
+
Object.defineProperty(exports, "onMessageDisplayed", { enumerable: true, get: function () { return onMessageDisplayed_1.onMessageDisplayed; } });
|
|
21
22
|
var onMessageActionTaken_1 = require("./onMessageActionTaken");
|
|
22
|
-
exports
|
|
23
|
+
Object.defineProperty(exports, "onMessageActionTaken", { enumerable: true, get: function () { return onMessageActionTaken_1.onMessageActionTaken; } });
|
|
23
24
|
var notifyMessageInteraction_1 = require("./notifyMessageInteraction");
|
|
24
|
-
exports
|
|
25
|
+
Object.defineProperty(exports, "notifyMessageInteraction", { enumerable: true, get: function () { return notifyMessageInteraction_1.notifyMessageInteraction; } });
|
|
26
|
+
var clearMessages_1 = require("./clearMessages");
|
|
27
|
+
Object.defineProperty(exports, "clearMessages", { enumerable: true, get: function () { return clearMessages_1.clearMessages; } });
|
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
5
|
+
exports.initializeInAppMessaging = void 0;
|
|
6
|
+
const utils_1 = require("@aws-amplify/core/internals/utils");
|
|
7
|
+
const eventListeners_1 = require("../../../../eventListeners");
|
|
8
|
+
const helpers_1 = require("../utils/helpers");
|
|
9
|
+
const types_1 = require("../types");
|
|
10
|
+
const core_1 = require("@aws-amplify/core");
|
|
11
|
+
const dispatchEvent_1 = require("./dispatchEvent");
|
|
12
|
+
const utils_2 = require("../utils");
|
|
13
|
+
const utils_3 = require("../../../utils");
|
|
13
14
|
/**
|
|
14
15
|
* Initialize and set up in-app messaging category. This API needs to be called to enable other InAppMessaging APIs.
|
|
15
16
|
*
|
|
@@ -22,33 +23,32 @@ var utils_3 = require("../../../utils");
|
|
|
22
23
|
* ```
|
|
23
24
|
*/
|
|
24
25
|
function initializeInAppMessaging() {
|
|
25
|
-
if (utils_3.isInitialized()) {
|
|
26
|
+
if ((0, utils_3.isInitialized)()) {
|
|
26
27
|
return;
|
|
27
28
|
}
|
|
28
29
|
// register with the session listener
|
|
29
30
|
utils_1.sessionListener.addStateChangeListener(utils_2.sessionStateChangeHandler, true);
|
|
30
31
|
// wire up default Pinpoint message event handling
|
|
31
|
-
eventListeners_1.addEventListener('messageDisplayed',
|
|
32
|
-
helpers_1.recordAnalyticsEvent(types_1.PinpointMessageEvent.MESSAGE_DISPLAYED, message);
|
|
33
|
-
utils_2.incrementMessageCounts(message.id);
|
|
32
|
+
(0, eventListeners_1.addEventListener)('messageDisplayed', (message) => {
|
|
33
|
+
(0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_DISPLAYED, message);
|
|
34
|
+
(0, utils_2.incrementMessageCounts)(message.id);
|
|
34
35
|
});
|
|
35
|
-
eventListeners_1.addEventListener('messageDismissed',
|
|
36
|
-
helpers_1.recordAnalyticsEvent(types_1.PinpointMessageEvent.MESSAGE_DISMISSED, message);
|
|
36
|
+
(0, eventListeners_1.addEventListener)('messageDismissed', (message) => {
|
|
37
|
+
(0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_DISMISSED, message);
|
|
37
38
|
});
|
|
38
|
-
eventListeners_1.addEventListener('messageActionTaken',
|
|
39
|
-
helpers_1.recordAnalyticsEvent(types_1.PinpointMessageEvent.MESSAGE_ACTION_TAKEN, message);
|
|
39
|
+
(0, eventListeners_1.addEventListener)('messageActionTaken', (message) => {
|
|
40
|
+
(0, helpers_1.recordAnalyticsEvent)(types_1.PinpointMessageEvent.MESSAGE_ACTION_TAKEN, message);
|
|
40
41
|
});
|
|
41
42
|
// listen to analytics hub events
|
|
42
43
|
core_1.Hub.listen('analytics', analyticsListener);
|
|
43
|
-
utils_3.initialize();
|
|
44
|
+
(0, utils_3.initialize)();
|
|
44
45
|
}
|
|
45
46
|
exports.initializeInAppMessaging = initializeInAppMessaging;
|
|
46
|
-
function analyticsListener(
|
|
47
|
-
|
|
48
|
-
var event = payload.event, data = payload.data;
|
|
47
|
+
function analyticsListener({ payload, }) {
|
|
48
|
+
const { event, data } = payload;
|
|
49
49
|
switch (event) {
|
|
50
50
|
case 'record': {
|
|
51
|
-
dispatchEvent_1.dispatchEvent(data);
|
|
51
|
+
(0, dispatchEvent_1.dispatchEvent)(data);
|
|
52
52
|
break;
|
|
53
53
|
}
|
|
54
54
|
default:
|
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
|
|
3
3
|
// SPDX-License-Identifier: Apache-2.0
|
|
4
4
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
exports.notifyMessageInteraction = void 0;
|
|
6
|
+
const eventListeners_1 = require("../../../../eventListeners");
|
|
7
|
+
const utils_1 = require("../../../utils");
|
|
7
8
|
/**
|
|
8
9
|
* Notifies the respective listener of the specified type with the message given.
|
|
9
10
|
*
|
|
@@ -18,9 +19,8 @@ var utils_1 = require("../../../utils");
|
|
|
18
19
|
* });
|
|
19
20
|
* ```
|
|
20
21
|
*/
|
|
21
|
-
function notifyMessageInteraction(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
eventListeners_1.notifyEventListeners(type, message);
|
|
22
|
+
function notifyMessageInteraction({ type, message, }) {
|
|
23
|
+
(0, utils_1.assertIsInitialized)();
|
|
24
|
+
(0, eventListeners_1.notifyEventListeners)(type, message);
|
|
25
25
|
}
|
|
26
26
|
exports.notifyMessageInteraction = notifyMessageInteraction;
|