@adobe/alloy 2.32.1-beta.1 → 2.33.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/components.json +7 -2
- package/dist/alloy.js +11283 -11142
- package/dist/alloy.min.js +1 -1
- package/dist/alloyServiceWorker.js +1 -1
- package/dist/types/{core → browser}/src/components/Advertising/constants/index.d.ts +3 -0
- package/dist/types/{core → browser}/src/components/Advertising/handlers/createOnBeforeSendEventHandler.d.ts +4 -1
- package/dist/types/{core → browser}/src/components/Advertising/handlers/sendAdConversion.d.ts +3 -1
- package/dist/types/{core → browser}/src/components/Advertising/handlers/viewThroughHandler.d.ts +3 -1
- package/dist/types/{core → browser}/src/components/Advertising/identities/collectAllIdentities.d.ts +1 -1
- package/dist/types/browser/src/components/Advertising/identities/collectSurferId.d.ts +15 -0
- package/dist/types/browser/src/components/Advertising/identities/createHashedIpHandler.d.ts +9 -0
- package/dist/types/browser/src/components/Advertising/identities/initiateAdvertisingIdentityCall.d.ts +5 -0
- package/dist/types/{core → browser}/src/components/Advertising/utils/helpers.d.ts +14 -0
- package/dist/types/browser/src/components/Advertising/utils/murmurHash128GuavaHex.d.ts +2 -0
- package/dist/types/browser/src/components/Personalization/constants/surface.d.ts +4 -0
- package/dist/types/browser/src/components/Personalization/dom-actions/dom/isDomElement.d.ts +2 -0
- package/dist/types/browser/src/components/Personalization/utils/addRenderAttemptedToDecisions.d.ts +5 -0
- package/dist/types/browser/src/components/Personalization/utils/surfaceUtils.d.ts +3 -0
- package/dist/types/{core → browser}/src/components/PushNotifications/helpers/saveToIndexedDb.d.ts +1 -1
- package/dist/types/{core → browser}/src/components/PushNotifications/index.d.ts +6 -6
- package/dist/types/{core → browser}/src/components/PushNotifications/request/createSendPushSubscriptionPayload.d.ts +2 -2
- package/dist/types/browser/src/components/PushNotifications/request/createSendPushSubscriptionRequest.d.ts +6 -0
- package/dist/types/{core → browser}/src/components/PushNotifications/request/makeSendPushSubscriptionRequest.d.ts +6 -6
- package/dist/types/{core → browser}/src/components/PushNotifications/types.d.ts +1 -1
- package/dist/types/browser/src/components/componentCreators.d.ts +3 -0
- package/dist/types/browser/src/components/requiredComponentCreators.d.ts +1 -0
- package/dist/types/core/src/components/Identity/injectAddQueryStringIdentityToPayload.d.ts +2 -1
- package/dist/types/core/src/core/componentCreators.d.ts +0 -3
- package/dist/types/core/src/core/requiredComponentCreators.d.ts +0 -1
- package/dist/types/core/src/types.d.ts +0 -4
- package/package.json +2 -2
- package/src/components/Advertising/configValidators.js +32 -0
- package/src/components/Advertising/constants/index.js +80 -0
- package/src/components/Advertising/createComponent.js +24 -0
- package/src/components/Advertising/handlers/clickThroughHandler.js +94 -0
- package/src/components/Advertising/handlers/createAdConversionHandler.js +50 -0
- package/src/components/Advertising/handlers/createOnBeforeSendEventHandler.js +177 -0
- package/src/components/Advertising/handlers/sendAdConversion.js +74 -0
- package/src/components/Advertising/handlers/viewThroughHandler.js +107 -0
- package/src/components/Advertising/identities/collectAllIdentities.js +57 -0
- package/src/components/Advertising/identities/collectID5Id.js +133 -0
- package/src/components/Advertising/identities/collectRampId.js +265 -0
- package/src/components/Advertising/identities/collectSurferId.js +72 -0
- package/src/components/Advertising/identities/createHashedIpHandler.js +36 -0
- package/src/components/Advertising/identities/initiateAdvertisingIdentityCall.js +153 -0
- package/src/components/Advertising/index.js +109 -0
- package/src/components/Advertising/utils/advertisingCookieManager.js +92 -0
- package/src/components/Advertising/utils/helpers.js +190 -0
- package/src/components/Advertising/utils/murmurHash128GuavaHex.js +195 -0
- package/src/components/Context/createComponent.js +35 -0
- package/src/components/Context/implementationDetails.js +23 -0
- package/src/components/Context/index.js +56 -0
- package/src/components/Context/injectDevice.js +77 -0
- package/src/components/Context/injectEnvironment.js +38 -0
- package/src/components/Context/injectHighEntropyUserAgentHints.js +55 -0
- package/src/components/Context/injectOneTimeAnalyticsReferrer.js +61 -0
- package/src/components/Context/injectPlaceContext.js +38 -0
- package/src/components/Context/injectWeb.js +26 -0
- package/src/components/Personalization/constants/loggerMessage.js +14 -0
- package/src/components/Personalization/constants/scopeType.js +15 -0
- package/src/components/Personalization/constants/surface.js +16 -0
- package/src/components/Personalization/createApplyPropositions.js +136 -0
- package/src/components/Personalization/createClickStorage.js +56 -0
- package/src/components/Personalization/createComponent.js +133 -0
- package/src/components/Personalization/createFetchDataHandler.js +149 -0
- package/src/components/Personalization/createGetPageLocation.js +16 -0
- package/src/components/Personalization/createHandleConsentFlicker.js +22 -0
- package/src/components/Personalization/createInteractionStorage.js +104 -0
- package/src/components/Personalization/createNotificationHandler.js +49 -0
- package/src/components/Personalization/createOnClickHandler.js +102 -0
- package/src/components/Personalization/createOnDecisionHandler.js +98 -0
- package/src/components/Personalization/createPersonalizationDetails.js +138 -0
- package/src/components/Personalization/createSetTargetMigration.js +22 -0
- package/src/components/Personalization/createViewCacheManager.js +101 -0
- package/src/components/Personalization/createViewChangeHandler.js +53 -0
- package/src/components/Personalization/dom-actions/action.js +97 -0
- package/src/components/Personalization/dom-actions/addNonceToInlineStyleElements.js +37 -0
- package/src/components/Personalization/dom-actions/appendHtml.js +42 -0
- package/src/components/Personalization/dom-actions/clicks/collectClicks.js +89 -0
- package/src/components/Personalization/dom-actions/clicks/collectInteractions.js +113 -0
- package/src/components/Personalization/dom-actions/collectInteractions.js +15 -0
- package/src/components/Personalization/dom-actions/createPreprocess.js +21 -0
- package/src/components/Personalization/dom-actions/createRedirect.js +23 -0
- package/src/components/Personalization/dom-actions/dom/createFragment.js +18 -0
- package/src/components/Personalization/dom-actions/dom/getAttribute.js +15 -0
- package/src/components/Personalization/dom-actions/dom/getChildNodes.js +23 -0
- package/src/components/Personalization/dom-actions/dom/getChildren.js +23 -0
- package/src/components/Personalization/dom-actions/dom/getElementById.js +21 -0
- package/src/components/Personalization/dom-actions/dom/getFirstChild.js +15 -0
- package/src/components/Personalization/dom-actions/dom/getNextSibling.js +15 -0
- package/src/components/Personalization/dom-actions/dom/getNonce.js +33 -0
- package/src/components/Personalization/dom-actions/dom/getParent.js +15 -0
- package/src/components/Personalization/dom-actions/dom/helperForEq.js +22 -0
- package/src/components/Personalization/dom-actions/dom/index.js +26 -0
- package/src/components/Personalization/dom-actions/dom/insertAfter.js +26 -0
- package/src/components/Personalization/dom-actions/dom/insertBefore.js +25 -0
- package/src/components/Personalization/dom-actions/dom/isDomElement.js +13 -0
- package/src/components/Personalization/dom-actions/dom/matchesSelectorWithEq.js +37 -0
- package/src/components/Personalization/dom-actions/dom/removeAttribute.js +15 -0
- package/src/components/Personalization/dom-actions/dom/selectNodesWithEq.js +101 -0
- package/src/components/Personalization/dom-actions/dom/setAttribute.js +15 -0
- package/src/components/Personalization/dom-actions/dom/setStyle.js +23 -0
- package/src/components/Personalization/dom-actions/dom/util.js +17 -0
- package/src/components/Personalization/dom-actions/images.js +34 -0
- package/src/components/Personalization/dom-actions/index.js +13 -0
- package/src/components/Personalization/dom-actions/initDomActionsModules.js +67 -0
- package/src/components/Personalization/dom-actions/insertHtmlAfter.js +43 -0
- package/src/components/Personalization/dom-actions/insertHtmlBefore.js +40 -0
- package/src/components/Personalization/dom-actions/move.js +28 -0
- package/src/components/Personalization/dom-actions/prependHtml.js +60 -0
- package/src/components/Personalization/dom-actions/rearrangeChildren.js +34 -0
- package/src/components/Personalization/dom-actions/remapCustomCodeOffers.js +33 -0
- package/src/components/Personalization/dom-actions/remapHeadOffers.js +63 -0
- package/src/components/Personalization/dom-actions/replaceHtml.js +20 -0
- package/src/components/Personalization/dom-actions/resize.js +28 -0
- package/src/components/Personalization/dom-actions/scripts.js +106 -0
- package/src/components/Personalization/dom-actions/setAttributes.js +21 -0
- package/src/components/Personalization/dom-actions/setHtml.js +27 -0
- package/src/components/Personalization/dom-actions/setStyles.js +23 -0
- package/src/components/Personalization/dom-actions/setText.js +16 -0
- package/src/components/Personalization/dom-actions/swapImage.js +32 -0
- package/src/components/Personalization/flicker/index.js +106 -0
- package/src/components/Personalization/handlers/createDecorateProposition.js +100 -0
- package/src/components/Personalization/handlers/createProcessDomAction.js +79 -0
- package/src/components/Personalization/handlers/createProcessHtmlContent.js +60 -0
- package/src/components/Personalization/handlers/createProcessInAppMessage.js +91 -0
- package/src/components/Personalization/handlers/createProcessPropositions.js +228 -0
- package/src/components/Personalization/handlers/createProcessRedirect.js +54 -0
- package/src/components/Personalization/handlers/createRenderStatusHandler.js +62 -0
- package/src/components/Personalization/handlers/injectCreateProposition.js +121 -0
- package/src/components/Personalization/handlers/processDefaultContent.js +20 -0
- package/src/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +309 -0
- package/src/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +18 -0
- package/src/components/Personalization/in-app-message-actions/utils.js +55 -0
- package/src/components/Personalization/index.js +223 -0
- package/src/components/Personalization/utils/addRenderAttemptedToDecisions.js +15 -0
- package/src/components/Personalization/utils/createAsyncArray.js +37 -0
- package/src/components/Personalization/utils/isAuthoringModeEnabled.js +15 -0
- package/src/components/Personalization/utils/metaUtils.js +27 -0
- package/src/components/Personalization/utils/surfaceUtils.js +120 -0
- package/src/components/Personalization/validateApplyPropositionsOptions.js +56 -0
- package/src/components/PushNotifications/helpers/constants.js +16 -0
- package/src/components/PushNotifications/helpers/getPushSubscriptionDetails.js +122 -0
- package/src/components/PushNotifications/helpers/readFromIndexedDb.js +50 -0
- package/src/components/PushNotifications/helpers/saveToIndexedDb.js +64 -0
- package/src/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.js +84 -0
- package/src/components/PushNotifications/helpers/serviceWorkerPushListener.js +72 -0
- package/src/components/PushNotifications/index.js +128 -0
- package/src/components/PushNotifications/request/createSendPushSubscriptionPayload.js +66 -0
- package/src/components/PushNotifications/request/createSendPushSubscriptionRequest.js +35 -0
- package/src/components/PushNotifications/request/makeSendPushSubscriptionRequest.js +98 -0
- package/src/components/PushNotifications/request/makeSendServiceWorkerTrackingData.js +154 -0
- package/src/components/PushNotifications/types.js +104 -0
- package/src/components/componentCreators.js +3 -0
- package/src/components/requiredComponentCreators.js +13 -0
- package/src/createEventListeners.js +81 -0
- package/src/index.js +5 -1
- package/src/serviceWorker.js +2 -2
- package/dist/types/core/src/components/Advertising/identities/collectSurferId.d.ts +0 -2
- package/dist/types/core/src/components/PushNotifications/request/createSendPushSubscriptionRequest.d.ts +0 -6
- /package/dist/types/{core → browser}/src/components/Advertising/configValidators.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Advertising/createComponent.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Advertising/handlers/clickThroughHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Advertising/handlers/createAdConversionHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Advertising/identities/collectID5Id.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Advertising/identities/collectRampId.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Advertising/index.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Advertising/utils/advertisingCookieManager.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/createComponent.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/implementationDetails.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/index.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/injectDevice.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/injectEnvironment.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/injectHighEntropyUserAgentHints.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/injectOneTimeAnalyticsReferrer.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/injectPlaceContext.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Context/injectWeb.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/constants/loggerMessage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/constants/scopeType.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createApplyPropositions.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createClickStorage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createComponent.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createFetchDataHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createGetPageLocation.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createHandleConsentFlicker.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createInteractionStorage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createNotificationHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createOnClickHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createOnDecisionHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createPersonalizationDetails.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createSetTargetMigration.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createViewCacheManager.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/createViewChangeHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/action.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/addNonceToInlineStyleElements.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/appendHtml.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/clicks/collectClicks.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/clicks/collectInteractions.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/collectInteractions.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/createPreprocess.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/createRedirect.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/createFragment.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getAttribute.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getChildNodes.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getChildren.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getElementById.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getFirstChild.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getNextSibling.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getNonce.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/getParent.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/helperForEq.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/index.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/insertAfter.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/insertBefore.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/matchesSelectorWithEq.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/removeAttribute.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/selectNodesWithEq.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/setAttribute.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/setStyle.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/dom/util.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/images.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/index.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/initDomActionsModules.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/insertHtmlAfter.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/insertHtmlBefore.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/move.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/prependHtml.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/rearrangeChildren.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/remapCustomCodeOffers.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/remapHeadOffers.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/replaceHtml.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/resize.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/scripts.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/setAttributes.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/setHtml.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/setStyles.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/setText.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/dom-actions/swapImage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/flicker/index.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/createDecorateProposition.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessDomAction.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessHtmlContent.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessInAppMessage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessPropositions.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/createProcessRedirect.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/createRenderStatusHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/injectCreateProposition.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/handlers/processDefaultContent.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/in-app-message-actions/actions/displayIframeContent.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/in-app-message-actions/utils.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/index.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/utils/createAsyncArray.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/utils/isAuthoringModeEnabled.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/utils/metaUtils.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/Personalization/validateApplyPropositionsOptions.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/constants.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/getPushSubscriptionDetails.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/readFromIndexedDb.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/serviceWorkerNotificationClickListener.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/PushNotifications/helpers/serviceWorkerPushListener.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/PushNotifications/request/makeSendServiceWorkerTrackingData.d.ts +0 -0
- /package/dist/types/{core → browser}/src/createEventListeners.d.ts +0 -0
- /package/dist/types/core/src/{components/Context → utils}/injectTimestamp.d.ts +0 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2019 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { toInteger } from "@adobe/alloy-core/utils";
|
|
14
|
+
|
|
15
|
+
export default (window) => {
|
|
16
|
+
return (event) => {
|
|
17
|
+
const {
|
|
18
|
+
document: { documentElement: { clientWidth, clientHeight } = {} },
|
|
19
|
+
} = window;
|
|
20
|
+
|
|
21
|
+
const environment = {
|
|
22
|
+
type: "browser",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const viewportWidth = toInteger(clientWidth);
|
|
26
|
+
if (viewportWidth >= 0) {
|
|
27
|
+
environment.browserDetails = { viewportWidth };
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const viewportHeight = toInteger(clientHeight);
|
|
31
|
+
if (viewportHeight >= 0) {
|
|
32
|
+
environment.browserDetails = environment.browserDetails || {};
|
|
33
|
+
environment.browserDetails.viewportHeight = viewportHeight;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
event.mergeXdm({ environment });
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { noop } from "@adobe/alloy-core/utils";
|
|
14
|
+
import highEntropyUserAgentHints from "@adobe/alloy-core/constants/highEntropyUserAgentClientHints.js";
|
|
15
|
+
|
|
16
|
+
const browserSupportsUserAgentClientHints = (navigator) => {
|
|
17
|
+
return "userAgentData" in navigator;
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default (navigator) => {
|
|
21
|
+
if (!browserSupportsUserAgentClientHints(navigator)) {
|
|
22
|
+
return noop;
|
|
23
|
+
}
|
|
24
|
+
return (event, logger) => {
|
|
25
|
+
try {
|
|
26
|
+
// eslint-disable-next-line compat/compat -- Feature detection performed above
|
|
27
|
+
return navigator.userAgentData
|
|
28
|
+
.getHighEntropyValues(highEntropyUserAgentHints.map((hint) => hint[0]))
|
|
29
|
+
.then((hints) => {
|
|
30
|
+
const userAgentClientHints = {};
|
|
31
|
+
highEntropyUserAgentHints.forEach(([hintName, hintType]) => {
|
|
32
|
+
if (
|
|
33
|
+
Object.prototype.hasOwnProperty.call(hints, hintName) &&
|
|
34
|
+
/* eslint-disable-next-line valid-typeof */
|
|
35
|
+
typeof hints[hintName] === hintType
|
|
36
|
+
) {
|
|
37
|
+
userAgentClientHints[hintName] = hints[hintName];
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
event.mergeXdm({
|
|
41
|
+
environment: {
|
|
42
|
+
browserDetails: {
|
|
43
|
+
userAgentClientHints,
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
} catch (error) {
|
|
49
|
+
logger.warn(
|
|
50
|
+
`Unable to collect user-agent client hints. ${error.message}`,
|
|
51
|
+
);
|
|
52
|
+
return noop;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
// Because these events are originated by the SDK rather than user actions, don't change the referrer
|
|
14
|
+
const IGNORED_EVENT_TYPES = new Set([
|
|
15
|
+
"decisioning.propositionFetch",
|
|
16
|
+
"decisioning.propositionDisplay",
|
|
17
|
+
"decisioning.propositionInteract",
|
|
18
|
+
]);
|
|
19
|
+
|
|
20
|
+
export default (window) => {
|
|
21
|
+
let lastReferrerSent = null;
|
|
22
|
+
|
|
23
|
+
return (event) => {
|
|
24
|
+
const content = event.getContent();
|
|
25
|
+
const eventType = content.xdm?.eventType;
|
|
26
|
+
|
|
27
|
+
if (IGNORED_EVENT_TYPES.has(eventType)) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
// Allow customers to explicitly set the referrer (for SPA view changes)
|
|
32
|
+
// Otherwise, use document.referrer
|
|
33
|
+
// eslint-disable-next-line no-underscore-dangle
|
|
34
|
+
const explicitReferrer = content.data?.__adobe?.analytics?.referrer;
|
|
35
|
+
const currentReferrer =
|
|
36
|
+
explicitReferrer !== undefined
|
|
37
|
+
? explicitReferrer
|
|
38
|
+
: window.document.referrer;
|
|
39
|
+
|
|
40
|
+
if (currentReferrer === lastReferrerSent) {
|
|
41
|
+
event.mergeData({
|
|
42
|
+
__adobe: {
|
|
43
|
+
analytics: {
|
|
44
|
+
referrer: "",
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
event.mergeData({
|
|
52
|
+
__adobe: {
|
|
53
|
+
analytics: {
|
|
54
|
+
referrer: currentReferrer,
|
|
55
|
+
},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
lastReferrerSent = currentReferrer;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2019 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { toISOStringLocal, toInteger } from "@adobe/alloy-core/utils";
|
|
13
|
+
|
|
14
|
+
export default (dateProvider) => {
|
|
15
|
+
return (event) => {
|
|
16
|
+
const date = dateProvider();
|
|
17
|
+
|
|
18
|
+
const placeContext = {};
|
|
19
|
+
|
|
20
|
+
const localTimezoneOffset = toInteger(date.getTimezoneOffset());
|
|
21
|
+
if (localTimezoneOffset !== undefined) {
|
|
22
|
+
placeContext.localTimezoneOffset = localTimezoneOffset;
|
|
23
|
+
}
|
|
24
|
+
// make sure the timezone offset only uses two digits
|
|
25
|
+
if (
|
|
26
|
+
localTimezoneOffset === undefined ||
|
|
27
|
+
Math.abs(localTimezoneOffset) < 6000
|
|
28
|
+
) {
|
|
29
|
+
placeContext.localTime = toISOStringLocal(date);
|
|
30
|
+
}
|
|
31
|
+
const ianaTimezone = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
32
|
+
if (ianaTimezone) {
|
|
33
|
+
placeContext.ianaTimezone = ianaTimezone;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
event.mergeXdm({ placeContext });
|
|
37
|
+
};
|
|
38
|
+
};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2019 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export default (window) => {
|
|
14
|
+
return (event) => {
|
|
15
|
+
event.mergeXdm({
|
|
16
|
+
web: {
|
|
17
|
+
webPageDetails: {
|
|
18
|
+
URL: window.location.href || window.location,
|
|
19
|
+
},
|
|
20
|
+
webReferrer: {
|
|
21
|
+
URL: window.document.referrer,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
export const AUTHORING_ENABLED = "Rendering is disabled for authoring mode.";
|
|
13
|
+
export const REDIRECT_EXECUTION_ERROR =
|
|
14
|
+
"An error occurred while executing the redirect offer.";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const VIEW_SCOPE_TYPE = "view";
|
|
14
|
+
export const PAGE_SCOPE_TYPE = "page";
|
|
15
|
+
export const PROPOSITION_SCOPE_TYPE = "proposition";
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const WEB = "web";
|
|
14
|
+
export const WEBAPP = "webapp";
|
|
15
|
+
export const SURFACE_TYPE_DELIMITER = "://";
|
|
16
|
+
export const FRAGMENT_DELIMITER = "#";
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2022 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { defer, isEmptyObject, isNonEmptyArray } from "@adobe/alloy-core/utils";
|
|
14
|
+
import {
|
|
15
|
+
DEFAULT_CONTENT_ITEM,
|
|
16
|
+
DOM_ACTION,
|
|
17
|
+
HTML_CONTENT_ITEM,
|
|
18
|
+
JSON_CONTENT_ITEM,
|
|
19
|
+
MESSAGE_IN_APP,
|
|
20
|
+
} from "@adobe/alloy-core/constants/schema.js";
|
|
21
|
+
import PAGE_WIDE_SCOPE from "@adobe/alloy-core/constants/pageWideScope.js";
|
|
22
|
+
import { DOM_ACTION_COLLECT_INTERACTIONS } from "./dom-actions/initDomActionsModules.js";
|
|
23
|
+
|
|
24
|
+
const isInteractionTrackingItem = (schema, actionType) =>
|
|
25
|
+
schema === JSON_CONTENT_ITEM &&
|
|
26
|
+
actionType === DOM_ACTION_COLLECT_INTERACTIONS;
|
|
27
|
+
|
|
28
|
+
const SUPPORTED_SCHEMAS = {
|
|
29
|
+
[DOM_ACTION]: () => true,
|
|
30
|
+
[HTML_CONTENT_ITEM]: () => true,
|
|
31
|
+
[JSON_CONTENT_ITEM]: isInteractionTrackingItem,
|
|
32
|
+
[MESSAGE_IN_APP]: () => true,
|
|
33
|
+
[DEFAULT_CONTENT_ITEM]: () => true,
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const filterItemsPredicate = (schema, actionType) =>
|
|
37
|
+
typeof SUPPORTED_SCHEMAS[schema] === "function" &&
|
|
38
|
+
SUPPORTED_SCHEMAS[schema](schema, actionType);
|
|
39
|
+
|
|
40
|
+
export default ({
|
|
41
|
+
processPropositions,
|
|
42
|
+
createProposition,
|
|
43
|
+
renderedPropositions,
|
|
44
|
+
viewCache,
|
|
45
|
+
}) => {
|
|
46
|
+
const updatePropositionItems = ({ items, metadataForScope = {} }) => {
|
|
47
|
+
const { actionType, selector } = metadataForScope;
|
|
48
|
+
|
|
49
|
+
return items
|
|
50
|
+
.filter((item) => filterItemsPredicate(item.schema, actionType))
|
|
51
|
+
.map((item) => {
|
|
52
|
+
const { schema } = item;
|
|
53
|
+
|
|
54
|
+
if (
|
|
55
|
+
schema !== HTML_CONTENT_ITEM &&
|
|
56
|
+
!isInteractionTrackingItem(schema, actionType)
|
|
57
|
+
) {
|
|
58
|
+
return { ...item };
|
|
59
|
+
}
|
|
60
|
+
if (!isEmptyObject(metadataForScope)) {
|
|
61
|
+
return {
|
|
62
|
+
...item,
|
|
63
|
+
schema: isInteractionTrackingItem(schema, actionType)
|
|
64
|
+
? DOM_ACTION
|
|
65
|
+
: schema,
|
|
66
|
+
data: {
|
|
67
|
+
...item.data,
|
|
68
|
+
selector,
|
|
69
|
+
type: actionType,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
return undefined;
|
|
74
|
+
})
|
|
75
|
+
.filter((item) => item);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const filterPropositionsPredicate = (proposition) => {
|
|
79
|
+
return !(
|
|
80
|
+
proposition.scope === PAGE_WIDE_SCOPE && proposition.renderAttempted
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
const preparePropositions = ({ propositions, metadata }) => {
|
|
85
|
+
return propositions
|
|
86
|
+
.filter(filterPropositionsPredicate)
|
|
87
|
+
.map((proposition) => {
|
|
88
|
+
if (isNonEmptyArray(proposition.items)) {
|
|
89
|
+
const { id, scope, scopeDetails } = proposition;
|
|
90
|
+
return {
|
|
91
|
+
id,
|
|
92
|
+
scope,
|
|
93
|
+
scopeDetails,
|
|
94
|
+
items: updatePropositionItems({
|
|
95
|
+
items: proposition.items,
|
|
96
|
+
metadataForScope: metadata[proposition.scope],
|
|
97
|
+
}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
return proposition;
|
|
101
|
+
})
|
|
102
|
+
.filter((proposition) => isNonEmptyArray(proposition.items));
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
return ({ propositions = [], metadata = {}, viewName }) => {
|
|
106
|
+
// We need to immediately call concat so that subsequent sendEvent
|
|
107
|
+
// calls will wait for applyPropositions to complete before executing.
|
|
108
|
+
const renderedPropositionsDeferred = defer();
|
|
109
|
+
renderedPropositions.concat(renderedPropositionsDeferred.promise);
|
|
110
|
+
|
|
111
|
+
const propositionsToExecute = preparePropositions({
|
|
112
|
+
propositions,
|
|
113
|
+
metadata,
|
|
114
|
+
}).map((proposition) => createProposition(proposition));
|
|
115
|
+
|
|
116
|
+
return Promise.resolve()
|
|
117
|
+
.then(() => {
|
|
118
|
+
if (viewName) {
|
|
119
|
+
return viewCache.getView(viewName);
|
|
120
|
+
}
|
|
121
|
+
return [];
|
|
122
|
+
})
|
|
123
|
+
.then((additionalPropositions) => {
|
|
124
|
+
const { render, returnedPropositions } = processPropositions([
|
|
125
|
+
...propositionsToExecute,
|
|
126
|
+
...additionalPropositions,
|
|
127
|
+
]);
|
|
128
|
+
|
|
129
|
+
render().then(renderedPropositionsDeferred.resolve);
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
propositions: returnedPropositions,
|
|
133
|
+
};
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
};
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
const metasToArray = (metas) => {
|
|
14
|
+
return Object.keys(metas).map((key) => {
|
|
15
|
+
return {
|
|
16
|
+
id: key,
|
|
17
|
+
...metas[key],
|
|
18
|
+
};
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default () => {
|
|
23
|
+
const clickStorage = {};
|
|
24
|
+
|
|
25
|
+
const storeClickMeta = ({
|
|
26
|
+
selector,
|
|
27
|
+
meta: { id, scope, scopeDetails, trackingLabel, scopeType },
|
|
28
|
+
}) => {
|
|
29
|
+
if (!clickStorage[selector]) {
|
|
30
|
+
clickStorage[selector] = {};
|
|
31
|
+
}
|
|
32
|
+
clickStorage[selector][id] = {
|
|
33
|
+
scope,
|
|
34
|
+
scopeDetails,
|
|
35
|
+
trackingLabel,
|
|
36
|
+
scopeType,
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const getClickSelectors = () => {
|
|
41
|
+
return Object.keys(clickStorage);
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
const getClickMetas = (selector) => {
|
|
45
|
+
const metas = clickStorage[selector];
|
|
46
|
+
if (!metas) {
|
|
47
|
+
return {};
|
|
48
|
+
}
|
|
49
|
+
return metasToArray(clickStorage[selector]);
|
|
50
|
+
};
|
|
51
|
+
return {
|
|
52
|
+
storeClickMeta,
|
|
53
|
+
getClickSelectors,
|
|
54
|
+
getClickMetas,
|
|
55
|
+
};
|
|
56
|
+
};
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2020 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { noop, isNonEmptyArray } from "@adobe/alloy-core/utils";
|
|
14
|
+
import createPersonalizationDetails from "./createPersonalizationDetails.js";
|
|
15
|
+
import { AUTHORING_ENABLED } from "./constants/loggerMessage.js";
|
|
16
|
+
import { PropositionEventType } from "@adobe/alloy-core/constants/propositionEventType.js";
|
|
17
|
+
import validateApplyPropositionsOptions from "./validateApplyPropositionsOptions.js";
|
|
18
|
+
|
|
19
|
+
export default ({
|
|
20
|
+
getPageLocation,
|
|
21
|
+
logger,
|
|
22
|
+
fetchDataHandler,
|
|
23
|
+
viewChangeHandler,
|
|
24
|
+
onClickHandler,
|
|
25
|
+
isAuthoringModeEnabled,
|
|
26
|
+
mergeQuery,
|
|
27
|
+
viewCache,
|
|
28
|
+
showContainers,
|
|
29
|
+
applyPropositions,
|
|
30
|
+
setTargetMigration,
|
|
31
|
+
mergeDecisionsMeta,
|
|
32
|
+
renderedPropositions,
|
|
33
|
+
onDecisionHandler,
|
|
34
|
+
handleConsentFlicker,
|
|
35
|
+
}) => {
|
|
36
|
+
return {
|
|
37
|
+
lifecycle: {
|
|
38
|
+
onComponentsRegistered() {
|
|
39
|
+
handleConsentFlicker();
|
|
40
|
+
},
|
|
41
|
+
onDecision: onDecisionHandler,
|
|
42
|
+
onBeforeRequest({ request }) {
|
|
43
|
+
setTargetMigration(request);
|
|
44
|
+
return Promise.resolve();
|
|
45
|
+
},
|
|
46
|
+
onBeforeEvent({
|
|
47
|
+
event,
|
|
48
|
+
renderDecisions,
|
|
49
|
+
decisionScopes = [],
|
|
50
|
+
personalization = {},
|
|
51
|
+
onResponse = noop,
|
|
52
|
+
onRequestFailure = noop,
|
|
53
|
+
}) {
|
|
54
|
+
// Include propositions on all responses, overridden with data as needed
|
|
55
|
+
onResponse(() => ({ propositions: [] }));
|
|
56
|
+
onRequestFailure(() => showContainers());
|
|
57
|
+
|
|
58
|
+
if (isAuthoringModeEnabled()) {
|
|
59
|
+
logger.warn(AUTHORING_ENABLED);
|
|
60
|
+
|
|
61
|
+
// If we are in authoring mode we disable personalization
|
|
62
|
+
mergeQuery(event, { enabled: false });
|
|
63
|
+
return Promise.resolve();
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const personalizationDetails = createPersonalizationDetails({
|
|
67
|
+
getPageLocation,
|
|
68
|
+
renderDecisions,
|
|
69
|
+
decisionScopes,
|
|
70
|
+
personalization,
|
|
71
|
+
event,
|
|
72
|
+
isCacheInitialized: viewCache.isInitialized(),
|
|
73
|
+
logger,
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
const decisionsMetaPromises = [];
|
|
77
|
+
if (personalizationDetails.shouldIncludeRenderedPropositions()) {
|
|
78
|
+
decisionsMetaPromises.push(renderedPropositions.clear());
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (personalizationDetails.shouldFetchData()) {
|
|
82
|
+
const cacheUpdate = viewCache.createCacheUpdate(
|
|
83
|
+
personalizationDetails.getViewName(),
|
|
84
|
+
);
|
|
85
|
+
onRequestFailure(() => cacheUpdate.cancel());
|
|
86
|
+
|
|
87
|
+
const identityMap = event.getUserIdentityMap();
|
|
88
|
+
|
|
89
|
+
fetchDataHandler({
|
|
90
|
+
cacheUpdate,
|
|
91
|
+
personalizationDetails,
|
|
92
|
+
event,
|
|
93
|
+
onResponse,
|
|
94
|
+
identityMap,
|
|
95
|
+
});
|
|
96
|
+
} else if (personalizationDetails.shouldUseCachedData()) {
|
|
97
|
+
decisionsMetaPromises.push(
|
|
98
|
+
viewChangeHandler({
|
|
99
|
+
personalizationDetails,
|
|
100
|
+
event,
|
|
101
|
+
onResponse,
|
|
102
|
+
onRequestFailure,
|
|
103
|
+
}),
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// This promise.all waits for both the pending display notifications to be resolved
|
|
108
|
+
// (i.e. the top of page call to finish rendering) and the view change handler to
|
|
109
|
+
// finish rendering anything for this view.
|
|
110
|
+
return Promise.all(decisionsMetaPromises).then((decisionsMetas) => {
|
|
111
|
+
// We only want to call mergeDecisionsMeta once, but we can get the propositions
|
|
112
|
+
// from two places: the pending display notifications and the view change handler.
|
|
113
|
+
const decisionsMeta = decisionsMetas.flatMap((dms) => dms);
|
|
114
|
+
if (isNonEmptyArray(decisionsMeta)) {
|
|
115
|
+
mergeDecisionsMeta(event, decisionsMeta, [
|
|
116
|
+
PropositionEventType.DISPLAY,
|
|
117
|
+
]);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
},
|
|
121
|
+
onClick({ event, clickedElement }) {
|
|
122
|
+
onClickHandler({ event, clickedElement });
|
|
123
|
+
},
|
|
124
|
+
},
|
|
125
|
+
commands: {
|
|
126
|
+
applyPropositions: {
|
|
127
|
+
optionsValidator: (options) =>
|
|
128
|
+
validateApplyPropositionsOptions({ logger, options }),
|
|
129
|
+
run: applyPropositions,
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
};
|