@adobe/alloy 2.32.1-beta.0 → 2.33.0-beta.2
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 +9 -0
- package/dist/alloy.js +13696 -12143
- package/dist/alloy.min.js +1 -1
- package/dist/alloyServiceWorker.js +8 -20
- package/dist/alloyServiceWorker.min.js +1 -1
- package/dist/types/browser/src/allOptionalComponents.d.ts +2 -0
- 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 +4 -0
- package/dist/types/browser/src/components/requiredComponentCreators.d.ts +1 -0
- package/dist/types/browser/src/index.d.ts +4 -2
- package/dist/types/browser/src/initializeStandalone.d.ts +4 -0
- package/dist/types/core/src/components/Identity/injectAddQueryStringIdentityToPayload.d.ts +2 -1
- package/dist/types/core/src/components/MediaAnalyticsBridge/createGetInstance.d.ts +1 -1
- package/dist/types/core/src/components/MediaAnalyticsBridge/createMediaHelper.d.ts +7 -56
- package/dist/types/core/src/core/componentCreators.d.ts +0 -4
- package/dist/types/core/src/core/requiredComponentCreators.d.ts +0 -1
- package/dist/types/core/src/types.d.ts +0 -4
- package/dist/utils/createEventMergeId.js +38 -30
- package/dist/utils/deepAssign.js +10 -4
- package/package.json +9 -13
- package/rollup.config.js +9 -15
- package/scripts/alloyBuilder.js +34 -42
- package/scripts/helpers/componentMetadata.js +25 -0
- package/scripts/helpers/generateEntryPoint.js +29 -0
- package/src/allOptionalComponents.js +14 -0
- package/src/components/ActivityCollector/attachClickActivityCollector.js +55 -0
- package/src/components/ActivityCollector/configValidators.js +52 -0
- package/src/components/ActivityCollector/createClickActivityStorage.js +33 -0
- package/src/components/ActivityCollector/createClickedElementProperties.js +224 -0
- package/src/components/ActivityCollector/createGetClickedElementProperties.js +68 -0
- package/src/components/ActivityCollector/createInjectClickedElementProperties.js +80 -0
- package/src/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +45 -0
- package/src/components/ActivityCollector/createStorePageViewProperties.js +20 -0
- package/src/components/ActivityCollector/getLinkName.js +145 -0
- package/src/components/ActivityCollector/getLinkRegion.js +65 -0
- package/src/components/ActivityCollector/index.js +132 -0
- package/src/components/ActivityCollector/utils/activityMapExtensionEnabled.js +16 -0
- package/src/components/ActivityCollector/utils/createTransientStorage.js +26 -0
- package/src/components/ActivityCollector/utils/determineLinkType.js +27 -0
- package/src/components/ActivityCollector/utils/dom/elementHasClickHandler.js +15 -0
- package/src/components/ActivityCollector/utils/dom/extractDomain.js +20 -0
- package/src/components/ActivityCollector/utils/dom/findClickableElement.js +36 -0
- package/src/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +25 -0
- package/src/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +15 -0
- package/src/components/ActivityCollector/utils/dom/isDownloadLink.js +27 -0
- package/src/components/ActivityCollector/utils/dom/isExitLink.js +24 -0
- package/src/components/ActivityCollector/utils/dom/isInputSubmitElement.js +26 -0
- package/src/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +24 -0
- package/src/components/ActivityCollector/utils/dom/isSupportedTextNode.js +27 -0
- package/src/components/ActivityCollector/utils/hasPageName.js +23 -0
- package/src/components/ActivityCollector/utils/isDifferentDomains.js +19 -0
- package/src/components/ActivityCollector/utils/trimQueryFromUrl.js +31 -0
- package/src/components/ActivityCollector/utils/truncateWhiteSpace.js +22 -0
- package/src/components/ActivityCollector/validateClickCollectionConfig.js +47 -0
- 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 +16 -0
- package/src/components/requiredComponentCreators.js +13 -0
- package/src/createEventListeners.js +81 -0
- package/src/index.js +14 -2
- package/src/initializeStandalone.js +34 -0
- package/src/serviceWorker.js +2 -2
- package/src/standalone.js +3 -26
- package/.browserslistrc +0 -2
- package/babel.config.js +0 -76
- 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/src/constants/sessionDataKeys.d.ts +0 -1
- package/scripts/helpers/entryPointGeneratorBabelPlugin.js +0 -101
- /package/dist/types/{core → browser}/src/components/ActivityCollector/attachClickActivityCollector.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/configValidators.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createClickActivityStorage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createClickedElementProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createGetClickedElementProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createInjectClickedElementProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createRecallAndInjectClickedElementProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/createStorePageViewProperties.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/getLinkName.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/getLinkRegion.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/index.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/activityMapExtensionEnabled.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/createTransientStorage.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/determineLinkType.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/elementHasClickHandler.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/extractDomain.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/findClickableElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isButtonSubmitElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isDownloadLink.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isExitLink.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isInputSubmitElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isSupportedAnchorElement.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/dom/isSupportedTextNode.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/hasPageName.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/isDifferentDomains.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/trimQueryFromUrl.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/utils/truncateWhiteSpace.d.ts +0 -0
- /package/dist/types/{core → browser}/src/components/ActivityCollector/validateClickCollectionConfig.d.ts +0 -0
- /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,149 @@
|
|
|
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
|
+
import { groupBy, isNonEmptyArray } from "@adobe/alloy-core/utils";
|
|
13
|
+
import PAGE_WIDE_SCOPE from "@adobe/alloy-core/constants/pageWideScope.js";
|
|
14
|
+
import { REDIRECT_ITEM } from "@adobe/alloy-core/constants/schema.js";
|
|
15
|
+
|
|
16
|
+
const DECISIONS_HANDLE = "personalization:decisions";
|
|
17
|
+
|
|
18
|
+
export default ({
|
|
19
|
+
logger,
|
|
20
|
+
prehidingStyle,
|
|
21
|
+
showContainers,
|
|
22
|
+
hideContainers,
|
|
23
|
+
mergeQuery,
|
|
24
|
+
processPropositions,
|
|
25
|
+
createProposition,
|
|
26
|
+
notificationHandler,
|
|
27
|
+
consent,
|
|
28
|
+
}) => {
|
|
29
|
+
return ({
|
|
30
|
+
cacheUpdate,
|
|
31
|
+
personalizationDetails,
|
|
32
|
+
event,
|
|
33
|
+
onResponse,
|
|
34
|
+
identityMap,
|
|
35
|
+
}) => {
|
|
36
|
+
const { state, wasSet } = consent.current();
|
|
37
|
+
if (!(state === "out" && wasSet)) {
|
|
38
|
+
if (personalizationDetails.isRenderDecisions()) {
|
|
39
|
+
hideContainers(prehidingStyle);
|
|
40
|
+
} else {
|
|
41
|
+
showContainers();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
mergeQuery(event, personalizationDetails.createQueryDetails());
|
|
45
|
+
|
|
46
|
+
// This needs to be called before the response so that future sendEvent calls
|
|
47
|
+
// can know to wait until this request is complete for pending display notifications.
|
|
48
|
+
const handleNotifications = notificationHandler(
|
|
49
|
+
personalizationDetails.isRenderDecisions(),
|
|
50
|
+
personalizationDetails.isSendDisplayEvent(),
|
|
51
|
+
personalizationDetails.getViewName(),
|
|
52
|
+
identityMap,
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
onResponse(({ response }) => {
|
|
56
|
+
const handles = response.getPayloadsByType(DECISIONS_HANDLE);
|
|
57
|
+
if (!isNonEmptyArray(handles)) {
|
|
58
|
+
logger.logOnContentRendering({
|
|
59
|
+
status: "no-offers",
|
|
60
|
+
message: "No offers were returned.",
|
|
61
|
+
logLevel: "info",
|
|
62
|
+
detail: {
|
|
63
|
+
query: personalizationDetails.createQueryDetails(),
|
|
64
|
+
},
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
const propositions = handles.map((handle) =>
|
|
68
|
+
createProposition(handle, true, false, identityMap),
|
|
69
|
+
);
|
|
70
|
+
const {
|
|
71
|
+
page: pagePropositions = [],
|
|
72
|
+
view: viewPropositions = [],
|
|
73
|
+
proposition: nonRenderedPropositions = [],
|
|
74
|
+
} = groupBy(propositions, (p) => p.getScopeType());
|
|
75
|
+
|
|
76
|
+
const currentViewPropositions = cacheUpdate.update(viewPropositions);
|
|
77
|
+
|
|
78
|
+
let render;
|
|
79
|
+
let returnedPropositions;
|
|
80
|
+
let returnedDecisions;
|
|
81
|
+
|
|
82
|
+
if (personalizationDetails.isRenderDecisions()) {
|
|
83
|
+
({ render, returnedPropositions, returnedDecisions } =
|
|
84
|
+
processPropositions(
|
|
85
|
+
[...pagePropositions, ...currentViewPropositions],
|
|
86
|
+
nonRenderedPropositions,
|
|
87
|
+
));
|
|
88
|
+
|
|
89
|
+
if (isNonEmptyArray(pagePropositions)) {
|
|
90
|
+
logger.logOnContentRendering({
|
|
91
|
+
status: "rendering-started",
|
|
92
|
+
message: "Started rendering propositions for page-wide scope.",
|
|
93
|
+
logLevel: "info",
|
|
94
|
+
detail: {
|
|
95
|
+
scope: PAGE_WIDE_SCOPE,
|
|
96
|
+
propositions: pagePropositions.map((proposition) =>
|
|
97
|
+
proposition.toJSON(),
|
|
98
|
+
),
|
|
99
|
+
},
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
if (isNonEmptyArray(currentViewPropositions)) {
|
|
104
|
+
logger.logOnContentRendering({
|
|
105
|
+
status: "rendering-started",
|
|
106
|
+
message: `Rendering propositions started for view scope - ${personalizationDetails.getViewName()}.`,
|
|
107
|
+
logLevel: "info",
|
|
108
|
+
detail: {
|
|
109
|
+
scope: personalizationDetails.getViewName(),
|
|
110
|
+
propositions: currentViewPropositions.map((proposition) =>
|
|
111
|
+
proposition.toJSON(),
|
|
112
|
+
),
|
|
113
|
+
},
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
render().then(handleNotifications);
|
|
118
|
+
|
|
119
|
+
// Render could take a long time especially if one of the renders
|
|
120
|
+
// is waiting for html to appear on the page. We show the containers
|
|
121
|
+
// immediately, and whatever renders quickly will not have flicker.
|
|
122
|
+
// However, skip showing containers if there's only one page proposition with a single REDIRECT_ITEM
|
|
123
|
+
const shouldSkipShowContainers =
|
|
124
|
+
pagePropositions.length === 1 &&
|
|
125
|
+
pagePropositions[0]
|
|
126
|
+
.getItems()
|
|
127
|
+
.every((p) => p.getSchema() === REDIRECT_ITEM);
|
|
128
|
+
|
|
129
|
+
if (!shouldSkipShowContainers) {
|
|
130
|
+
showContainers();
|
|
131
|
+
}
|
|
132
|
+
} else {
|
|
133
|
+
({ returnedPropositions, returnedDecisions } = processPropositions(
|
|
134
|
+
[],
|
|
135
|
+
[
|
|
136
|
+
...pagePropositions,
|
|
137
|
+
...currentViewPropositions,
|
|
138
|
+
...nonRenderedPropositions,
|
|
139
|
+
],
|
|
140
|
+
));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
return {
|
|
144
|
+
propositions: returnedPropositions,
|
|
145
|
+
decisions: returnedDecisions,
|
|
146
|
+
};
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
};
|
|
@@ -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 default ({ window }) =>
|
|
14
|
+
() => {
|
|
15
|
+
return window.location;
|
|
16
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2024 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 { OUT } from "@adobe/alloy-core/constants/consentStatus.js";
|
|
13
|
+
|
|
14
|
+
export default ({ showContainers, consent }) =>
|
|
15
|
+
() => {
|
|
16
|
+
const { state, wasSet } = consent.current();
|
|
17
|
+
if (state === OUT && wasSet) {
|
|
18
|
+
showContainers();
|
|
19
|
+
} else {
|
|
20
|
+
consent.awaitConsent().catch(showContainers);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
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
|
+
export default () => {
|
|
14
|
+
const clickMetaStorage = {};
|
|
15
|
+
/*
|
|
16
|
+
clickMetaStorage example.
|
|
17
|
+
`abc' and 'def' are proposition IDs. 1 is an interact id. The object with an id, scope and scopeDetails
|
|
18
|
+
is the notification.
|
|
19
|
+
|
|
20
|
+
{
|
|
21
|
+
1: {
|
|
22
|
+
"abc": { "id": "abc", "scope": "proposition", "scopeDetails": {} },
|
|
23
|
+
"def": { "id": "def", "scope": "proposition", "scopeDetails": {} }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
const clickItemStorage = {};
|
|
29
|
+
/*
|
|
30
|
+
clickItemStorage example.
|
|
31
|
+
`abc' and 'def' are proposition IDs. 1 is an interact id. The sets contain proposition-item IDs which
|
|
32
|
+
are used in notifications that are sent.
|
|
33
|
+
|
|
34
|
+
{
|
|
35
|
+
1: {
|
|
36
|
+
abc: new Set(["itemAAA", "itemCCC"]),
|
|
37
|
+
def: new Set(["itemEEE", "itemFFF"]),
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
*/
|
|
41
|
+
|
|
42
|
+
const storeInteractionMeta = (
|
|
43
|
+
propositionId,
|
|
44
|
+
itemId,
|
|
45
|
+
scopeType,
|
|
46
|
+
notification,
|
|
47
|
+
interactId,
|
|
48
|
+
) => {
|
|
49
|
+
interactId = parseInt(interactId, 10);
|
|
50
|
+
|
|
51
|
+
if (!clickMetaStorage[interactId]) {
|
|
52
|
+
clickMetaStorage[interactId] = {};
|
|
53
|
+
clickItemStorage[interactId] = {};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if (!clickItemStorage[interactId][propositionId]) {
|
|
57
|
+
clickItemStorage[interactId][propositionId] = new Set();
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
clickItemStorage[interactId][propositionId].add(itemId);
|
|
61
|
+
|
|
62
|
+
clickMetaStorage[interactId][propositionId] = {
|
|
63
|
+
...notification,
|
|
64
|
+
scopeType,
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const getInteractionMetas = (interactIds) => {
|
|
69
|
+
if (!Array.isArray(interactIds) || interactIds.length === 0) {
|
|
70
|
+
return [];
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
return Object.values(
|
|
74
|
+
interactIds
|
|
75
|
+
.map((value) => parseInt(value, 10))
|
|
76
|
+
.reduce((metaMap, interactId) => {
|
|
77
|
+
Object.keys(clickMetaStorage[interactId] || {}).forEach(
|
|
78
|
+
(propositionId) => {
|
|
79
|
+
if (!metaMap[propositionId]) {
|
|
80
|
+
metaMap[propositionId] = {
|
|
81
|
+
proposition: clickMetaStorage[interactId][propositionId],
|
|
82
|
+
items: new Set(),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
metaMap[propositionId].items = new Set([
|
|
87
|
+
...metaMap[propositionId].items,
|
|
88
|
+
...clickItemStorage[interactId][propositionId],
|
|
89
|
+
]);
|
|
90
|
+
},
|
|
91
|
+
);
|
|
92
|
+
return metaMap;
|
|
93
|
+
}, {}),
|
|
94
|
+
).map(({ proposition, items }) => ({
|
|
95
|
+
...proposition,
|
|
96
|
+
items: Array.from(items).map((id) => ({ id })),
|
|
97
|
+
}));
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
storeInteractionMeta,
|
|
102
|
+
getInteractionMetas,
|
|
103
|
+
};
|
|
104
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
import { defer } from "@adobe/alloy-core/utils";
|
|
13
|
+
import { SUPPRESS } from "@adobe/alloy-core/constants/eventType.js";
|
|
14
|
+
import isNonEmptyArray from "@adobe/alloy-core/utils/isNonEmptyArray.js";
|
|
15
|
+
|
|
16
|
+
export default (collect, renderedPropositions) => {
|
|
17
|
+
return (isRenderDecisions, isSendDisplayEvent, viewName, identityMap) => {
|
|
18
|
+
if (!isRenderDecisions) {
|
|
19
|
+
// If we aren't rendering anything, then we don't need to sendDisplayEvents.
|
|
20
|
+
return () => undefined;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!isSendDisplayEvent) {
|
|
24
|
+
const renderedPropositionsDeferred = defer();
|
|
25
|
+
renderedPropositions.concat(renderedPropositionsDeferred.promise);
|
|
26
|
+
return renderedPropositionsDeferred.resolve;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (decisionsMetaDisplay = [], decisionsMetaSuppressed = []) => {
|
|
30
|
+
if (isNonEmptyArray(decisionsMetaDisplay)) {
|
|
31
|
+
collect({
|
|
32
|
+
decisionsMeta: decisionsMetaDisplay,
|
|
33
|
+
viewName,
|
|
34
|
+
identityMap,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (isNonEmptyArray(decisionsMetaSuppressed)) {
|
|
39
|
+
collect({
|
|
40
|
+
decisionsMeta: decisionsMetaSuppressed,
|
|
41
|
+
eventType: SUPPRESS,
|
|
42
|
+
propositionAction: { reason: "Conflict" },
|
|
43
|
+
viewName,
|
|
44
|
+
identityMap,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
};
|
|
@@ -0,0 +1,102 @@
|
|
|
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 { isNonEmptyArray } from "@adobe/alloy-core/utils";
|
|
14
|
+
import { INTERACT } from "@adobe/alloy-core/constants/eventType.js";
|
|
15
|
+
import { PropositionEventType } from "@adobe/alloy-core/constants/propositionEventType.js";
|
|
16
|
+
|
|
17
|
+
const createPropositionAction = (clickLabel, clickToken) => {
|
|
18
|
+
if (!clickToken && !clickLabel) {
|
|
19
|
+
return undefined;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const propositionAction = {};
|
|
23
|
+
|
|
24
|
+
if (clickLabel) {
|
|
25
|
+
propositionAction.label = clickLabel;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
if (clickToken) {
|
|
29
|
+
propositionAction.tokens = [clickToken];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return propositionAction;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export default ({
|
|
36
|
+
mergeDecisionsMeta,
|
|
37
|
+
collectInteractions,
|
|
38
|
+
collectClicks,
|
|
39
|
+
getInteractionMetas,
|
|
40
|
+
getClickMetas,
|
|
41
|
+
getClickSelectors,
|
|
42
|
+
autoCollectPropositionInteractions,
|
|
43
|
+
}) => {
|
|
44
|
+
// Called when an element qualifying for conversion within an offer is clicked.
|
|
45
|
+
return ({ event, clickedElement }) => {
|
|
46
|
+
const decisionsMeta = [];
|
|
47
|
+
let propositionActionLabel;
|
|
48
|
+
let propositionActionToken;
|
|
49
|
+
let viewName;
|
|
50
|
+
|
|
51
|
+
[
|
|
52
|
+
collectInteractions(
|
|
53
|
+
clickedElement,
|
|
54
|
+
getInteractionMetas,
|
|
55
|
+
autoCollectPropositionInteractions,
|
|
56
|
+
),
|
|
57
|
+
collectClicks(clickedElement, getClickSelectors(), getClickMetas),
|
|
58
|
+
].forEach(
|
|
59
|
+
({
|
|
60
|
+
decisionsMeta: curDecisionsMeta,
|
|
61
|
+
propositionActionLabel: curPropositionActionLabel,
|
|
62
|
+
propositionActionToken: curPropositionActionToken,
|
|
63
|
+
viewName: curViewName,
|
|
64
|
+
}) => {
|
|
65
|
+
Array.prototype.push.apply(decisionsMeta, curDecisionsMeta);
|
|
66
|
+
|
|
67
|
+
if (!propositionActionLabel && curPropositionActionLabel) {
|
|
68
|
+
propositionActionLabel = curPropositionActionLabel;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!propositionActionToken && curPropositionActionToken) {
|
|
72
|
+
propositionActionToken = curPropositionActionToken;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if (!viewName && curViewName) {
|
|
76
|
+
viewName = curViewName;
|
|
77
|
+
}
|
|
78
|
+
},
|
|
79
|
+
);
|
|
80
|
+
|
|
81
|
+
if (isNonEmptyArray(decisionsMeta)) {
|
|
82
|
+
const xdm = { eventType: INTERACT };
|
|
83
|
+
|
|
84
|
+
if (viewName) {
|
|
85
|
+
xdm.web = {
|
|
86
|
+
webPageDetails: {
|
|
87
|
+
viewName,
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
event.mergeXdm(xdm);
|
|
93
|
+
|
|
94
|
+
mergeDecisionsMeta(
|
|
95
|
+
event,
|
|
96
|
+
decisionsMeta,
|
|
97
|
+
[PropositionEventType.INTERACT],
|
|
98
|
+
createPropositionAction(propositionActionLabel, propositionActionToken),
|
|
99
|
+
);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
};
|
|
@@ -0,0 +1,98 @@
|
|
|
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
|
+
|
|
13
|
+
import { MESSAGE_IN_APP } from "@adobe/alloy-core/constants/schema.js";
|
|
14
|
+
|
|
15
|
+
// When multiple In-App messages propositions are returned, we need to show only one
|
|
16
|
+
// of them (the one with lowest rank). This function keep track of the number of
|
|
17
|
+
// times it was called. It returns false for the first proposition that contains
|
|
18
|
+
// In-App messages items, true afterwards.
|
|
19
|
+
const createShouldSuppressDisplay = () => {
|
|
20
|
+
let count = 0;
|
|
21
|
+
return (proposition) => {
|
|
22
|
+
const { items = [] } = proposition;
|
|
23
|
+
|
|
24
|
+
if (!items.some((item) => item.schema === MESSAGE_IN_APP)) {
|
|
25
|
+
return false;
|
|
26
|
+
}
|
|
27
|
+
count += 1;
|
|
28
|
+
|
|
29
|
+
return count > 1;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default ({
|
|
34
|
+
processPropositions,
|
|
35
|
+
createProposition,
|
|
36
|
+
notificationHandler,
|
|
37
|
+
}) => {
|
|
38
|
+
return ({
|
|
39
|
+
renderDecisions,
|
|
40
|
+
propositions,
|
|
41
|
+
event,
|
|
42
|
+
personalization = {},
|
|
43
|
+
identityMap,
|
|
44
|
+
}) => {
|
|
45
|
+
if (!renderDecisions) {
|
|
46
|
+
return Promise.resolve();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { sendDisplayEvent = true } = personalization;
|
|
50
|
+
const viewName = event ? event.getViewName() : undefined;
|
|
51
|
+
|
|
52
|
+
const shouldSuppressDisplay = createShouldSuppressDisplay();
|
|
53
|
+
|
|
54
|
+
const propositionsToExecute = propositions.map((proposition) =>
|
|
55
|
+
createProposition(
|
|
56
|
+
proposition,
|
|
57
|
+
true,
|
|
58
|
+
shouldSuppressDisplay(proposition),
|
|
59
|
+
identityMap,
|
|
60
|
+
),
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
const { render, returnedPropositions } = processPropositions(
|
|
64
|
+
propositionsToExecute,
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const handleNotifications = notificationHandler(
|
|
68
|
+
renderDecisions,
|
|
69
|
+
sendDisplayEvent,
|
|
70
|
+
viewName,
|
|
71
|
+
identityMap,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
const propositionsById = propositionsToExecute.reduce(
|
|
75
|
+
(tot, proposition) => {
|
|
76
|
+
tot[proposition.getId()] = proposition;
|
|
77
|
+
return tot;
|
|
78
|
+
},
|
|
79
|
+
{},
|
|
80
|
+
);
|
|
81
|
+
|
|
82
|
+
render().then((decisionsMeta) => {
|
|
83
|
+
const decisionsMetaDisplay = decisionsMeta.filter(
|
|
84
|
+
(meta) => !propositionsById[meta.id].shouldSuppressDisplay(),
|
|
85
|
+
);
|
|
86
|
+
|
|
87
|
+
const decisionsMetaSuppressed = decisionsMeta.filter((meta) =>
|
|
88
|
+
propositionsById[meta.id].shouldSuppressDisplay(),
|
|
89
|
+
);
|
|
90
|
+
|
|
91
|
+
handleNotifications(decisionsMetaDisplay, decisionsMetaSuppressed);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
return Promise.resolve({
|
|
95
|
+
propositions: returnedPropositions,
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
};
|
|
@@ -0,0 +1,138 @@
|
|
|
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 { isNonEmptyString, isNonEmptyArray } from "@adobe/alloy-core/utils";
|
|
14
|
+
import PAGE_WIDE_SCOPE from "@adobe/alloy-core/constants/pageWideScope.js";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_CONTENT_ITEM,
|
|
17
|
+
DOM_ACTION,
|
|
18
|
+
HTML_CONTENT_ITEM,
|
|
19
|
+
MESSAGE_IN_APP,
|
|
20
|
+
JSON_CONTENT_ITEM,
|
|
21
|
+
REDIRECT_ITEM,
|
|
22
|
+
RULESET_ITEM,
|
|
23
|
+
MESSAGE_CONTENT_CARD,
|
|
24
|
+
} from "@adobe/alloy-core/constants/schema.js";
|
|
25
|
+
import {
|
|
26
|
+
buildPageSurface,
|
|
27
|
+
normalizeSurfaces,
|
|
28
|
+
} from "@adobe/alloy-core/utils/surfaceUtils.js";
|
|
29
|
+
|
|
30
|
+
const addPageWideScope = (scopes) => {
|
|
31
|
+
if (!scopes.includes(PAGE_WIDE_SCOPE)) {
|
|
32
|
+
scopes.push(PAGE_WIDE_SCOPE);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const addPageSurface = (surfaces, getPageLocation) => {
|
|
37
|
+
const pageSurface = buildPageSurface(getPageLocation);
|
|
38
|
+
if (!surfaces.includes(pageSurface)) {
|
|
39
|
+
surfaces.push(pageSurface);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const dedupe = (array) =>
|
|
44
|
+
array.filter((item, pos) => array.indexOf(item) === pos);
|
|
45
|
+
|
|
46
|
+
export default ({
|
|
47
|
+
getPageLocation,
|
|
48
|
+
renderDecisions,
|
|
49
|
+
decisionScopes,
|
|
50
|
+
personalization,
|
|
51
|
+
event,
|
|
52
|
+
isCacheInitialized,
|
|
53
|
+
logger,
|
|
54
|
+
}) => {
|
|
55
|
+
const viewName = event.getViewName();
|
|
56
|
+
return {
|
|
57
|
+
isRenderDecisions() {
|
|
58
|
+
return renderDecisions;
|
|
59
|
+
},
|
|
60
|
+
isSendDisplayEvent() {
|
|
61
|
+
return !!personalization.sendDisplayEvent;
|
|
62
|
+
},
|
|
63
|
+
shouldIncludeRenderedPropositions() {
|
|
64
|
+
return !!personalization.includeRenderedPropositions;
|
|
65
|
+
},
|
|
66
|
+
getViewName() {
|
|
67
|
+
return viewName;
|
|
68
|
+
},
|
|
69
|
+
hasScopes() {
|
|
70
|
+
return (
|
|
71
|
+
decisionScopes.length > 0 ||
|
|
72
|
+
isNonEmptyArray(personalization.decisionScopes)
|
|
73
|
+
);
|
|
74
|
+
},
|
|
75
|
+
hasSurfaces() {
|
|
76
|
+
return isNonEmptyArray(personalization.surfaces);
|
|
77
|
+
},
|
|
78
|
+
hasViewName() {
|
|
79
|
+
return isNonEmptyString(viewName);
|
|
80
|
+
},
|
|
81
|
+
createQueryDetails() {
|
|
82
|
+
const scopes = [...decisionScopes];
|
|
83
|
+
if (isNonEmptyArray(personalization.decisionScopes)) {
|
|
84
|
+
scopes.push(...personalization.decisionScopes);
|
|
85
|
+
}
|
|
86
|
+
const eventSurfaces = normalizeSurfaces(
|
|
87
|
+
personalization.surfaces,
|
|
88
|
+
getPageLocation,
|
|
89
|
+
logger,
|
|
90
|
+
);
|
|
91
|
+
|
|
92
|
+
if (this.shouldRequestDefaultPersonalization()) {
|
|
93
|
+
addPageWideScope(scopes);
|
|
94
|
+
addPageSurface(eventSurfaces, getPageLocation);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
const schemas = [
|
|
98
|
+
DEFAULT_CONTENT_ITEM,
|
|
99
|
+
HTML_CONTENT_ITEM,
|
|
100
|
+
JSON_CONTENT_ITEM,
|
|
101
|
+
REDIRECT_ITEM,
|
|
102
|
+
RULESET_ITEM,
|
|
103
|
+
MESSAGE_IN_APP,
|
|
104
|
+
MESSAGE_CONTENT_CARD,
|
|
105
|
+
];
|
|
106
|
+
|
|
107
|
+
if (scopes.includes(PAGE_WIDE_SCOPE)) {
|
|
108
|
+
schemas.push(DOM_ACTION);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
return {
|
|
112
|
+
schemas,
|
|
113
|
+
decisionScopes: dedupe(scopes),
|
|
114
|
+
surfaces: dedupe(eventSurfaces),
|
|
115
|
+
};
|
|
116
|
+
},
|
|
117
|
+
isCacheInitialized() {
|
|
118
|
+
return isCacheInitialized;
|
|
119
|
+
},
|
|
120
|
+
shouldFetchData() {
|
|
121
|
+
return (
|
|
122
|
+
this.hasScopes() ||
|
|
123
|
+
this.hasSurfaces() ||
|
|
124
|
+
this.shouldRequestDefaultPersonalization()
|
|
125
|
+
);
|
|
126
|
+
},
|
|
127
|
+
shouldUseCachedData() {
|
|
128
|
+
return this.hasViewName() && !this.shouldFetchData();
|
|
129
|
+
},
|
|
130
|
+
shouldRequestDefaultPersonalization() {
|
|
131
|
+
return (
|
|
132
|
+
personalization.defaultPersonalizationEnabled ||
|
|
133
|
+
(!this.isCacheInitialized() &&
|
|
134
|
+
personalization.defaultPersonalizationEnabled !== false)
|
|
135
|
+
);
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
};
|