@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
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/alloy",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.33.0-beta.2",
|
|
4
4
|
"description": "Adobe Experience Platform Web SDK",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"src",
|
|
18
18
|
"dist",
|
|
19
|
+
"components.json",
|
|
19
20
|
"scripts/alloyBuilder.js",
|
|
20
|
-
"scripts/helpers/
|
|
21
|
+
"scripts/helpers/componentMetadata.js",
|
|
22
|
+
"scripts/helpers/generateEntryPoint.js",
|
|
21
23
|
"scripts/helpers/path.js",
|
|
22
24
|
"rollup.config.js",
|
|
23
|
-
"babel.config.js",
|
|
24
|
-
".browserslistrc",
|
|
25
25
|
"LICENSE_BANNER"
|
|
26
26
|
],
|
|
27
27
|
"exports": {
|
|
@@ -56,32 +56,28 @@
|
|
|
56
56
|
"./libEs6/components/EventMerge/createEventMergeId": {
|
|
57
57
|
"types": "./dist/types/browser/src/utils/createEventMergeId.d.ts",
|
|
58
58
|
"default": "./dist/utils/createEventMergeId.js"
|
|
59
|
-
}
|
|
59
|
+
},
|
|
60
|
+
"./components.json": "./components.json"
|
|
60
61
|
},
|
|
61
62
|
"dependencies": {
|
|
62
|
-
"@babel/core": "^7.28.5",
|
|
63
|
-
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
|
|
64
|
-
"@babel/plugin-transform-template-literals": "^7.27.1",
|
|
65
|
-
"@babel/preset-env": "^7.28.5",
|
|
66
63
|
"@inquirer/prompts": "^7.9.0",
|
|
67
|
-
"@rollup/plugin-babel": "^6.1.0",
|
|
68
64
|
"@rollup/plugin-commonjs": "^29.0.0",
|
|
69
65
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
66
|
+
"@rollup/plugin-replace": "^6.0.0",
|
|
70
67
|
"@rollup/plugin-terser": "^0.4.4",
|
|
71
68
|
"commander": "^14.0.2",
|
|
72
69
|
"rollup": "^4.52.5",
|
|
73
70
|
"rollup-plugin-license": "^3.6.0",
|
|
74
|
-
"@adobe/alloy-core": "^1.1.2-beta.
|
|
71
|
+
"@adobe/alloy-core": "^1.1.2-beta.3"
|
|
75
72
|
},
|
|
76
73
|
"devDependencies": {
|
|
77
|
-
"@babel/cli": "^7.28.3",
|
|
78
74
|
"glob": "^11.0.3",
|
|
79
75
|
"msw": "^2.11.6",
|
|
80
76
|
"read-cache": "^1.0.0",
|
|
81
77
|
"rimraf": "^6.1.0",
|
|
82
78
|
"testcafe": "^3.7.2",
|
|
83
79
|
"testcafe-browser-provider-playwright": "^1.1.0",
|
|
84
|
-
"uuid": "^
|
|
80
|
+
"uuid": "^14.0.0",
|
|
85
81
|
"vitest": "^4.0.6"
|
|
86
82
|
},
|
|
87
83
|
"scripts": {
|
package/rollup.config.js
CHANGED
|
@@ -13,13 +13,15 @@ governing permissions and limitations under the License.
|
|
|
13
13
|
import path from "path";
|
|
14
14
|
import resolve from "@rollup/plugin-node-resolve";
|
|
15
15
|
import commonjs from "@rollup/plugin-commonjs";
|
|
16
|
-
import
|
|
16
|
+
import replace from "@rollup/plugin-replace";
|
|
17
17
|
import terser from "@rollup/plugin-terser";
|
|
18
18
|
import license from "rollup-plugin-license";
|
|
19
19
|
import { fileURLToPath } from "url";
|
|
20
20
|
import { gzip, brotliCompress as br, constants as zlibConstants } from "zlib";
|
|
21
21
|
import { promisify } from "util";
|
|
22
22
|
import { readFile, writeFile } from "fs/promises";
|
|
23
|
+
import packageJson from "./package.json" with { type: "json" };
|
|
24
|
+
const { version } = packageJson;
|
|
23
25
|
|
|
24
26
|
const INCLUDE_BUNDLESIZE = process.env.BUNDLESIZE === "true";
|
|
25
27
|
/**
|
|
@@ -148,8 +150,12 @@ export const utilityExportBuilds = [
|
|
|
148
150
|
},
|
|
149
151
|
];
|
|
150
152
|
|
|
151
|
-
const buildPlugins = ({ variant, minify
|
|
153
|
+
const buildPlugins = ({ variant, minify }) => {
|
|
152
154
|
const plugins = [
|
|
155
|
+
replace({
|
|
156
|
+
__VERSION__: version,
|
|
157
|
+
preventAssignment: true,
|
|
158
|
+
}),
|
|
153
159
|
resolve({
|
|
154
160
|
preferBuiltins: false,
|
|
155
161
|
// Support the browser field in dependencies' package.json.
|
|
@@ -159,17 +165,6 @@ const buildPlugins = ({ variant, minify, babelPlugins }) => {
|
|
|
159
165
|
commonjs(),
|
|
160
166
|
];
|
|
161
167
|
|
|
162
|
-
if (variant !== SERVICE_WORKER) {
|
|
163
|
-
plugins.push(
|
|
164
|
-
babel({
|
|
165
|
-
envName: "rollup",
|
|
166
|
-
babelHelpers: "bundled",
|
|
167
|
-
configFile: path.resolve(dirname, "babel.config.js"),
|
|
168
|
-
plugins: babelPlugins,
|
|
169
|
-
}),
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
168
|
if (INCLUDE_BUNDLESIZE) {
|
|
174
169
|
plugins.push(
|
|
175
170
|
bundleSizePlugin({
|
|
@@ -220,11 +215,10 @@ const buildPlugins = ({ variant, minify, babelPlugins }) => {
|
|
|
220
215
|
export const buildConfig = ({
|
|
221
216
|
variant = STANDALONE,
|
|
222
217
|
minify = false,
|
|
223
|
-
babelPlugins = [],
|
|
224
218
|
input = `${dirname}/src/standalone.js`,
|
|
225
219
|
file,
|
|
226
220
|
}) => {
|
|
227
|
-
const plugins = buildPlugins({ variant, minify
|
|
221
|
+
const plugins = buildPlugins({ variant, minify });
|
|
228
222
|
const minifiedExtension = minify ? ".min" : "";
|
|
229
223
|
|
|
230
224
|
if (variant === SERVICE_WORKER) {
|
package/scripts/alloyBuilder.js
CHANGED
|
@@ -11,7 +11,6 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
11
11
|
governing permissions and limitations under the License.
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
import babel from "@babel/core";
|
|
15
14
|
import terser from "@rollup/plugin-terser";
|
|
16
15
|
import resolve from "@rollup/plugin-node-resolve";
|
|
17
16
|
import commonjs from "@rollup/plugin-commonjs";
|
|
@@ -23,11 +22,11 @@ import fs from "fs";
|
|
|
23
22
|
import path from "path";
|
|
24
23
|
import { rollup } from "rollup";
|
|
25
24
|
import { buildConfig } from "../rollup.config.js";
|
|
26
|
-
import
|
|
25
|
+
import { generateEntryPointSource } from "./helpers/generateEntryPoint.js";
|
|
27
26
|
import {
|
|
28
27
|
optionalComponentNames,
|
|
29
28
|
requiredComponentNames,
|
|
30
|
-
} from "
|
|
29
|
+
} from "./helpers/componentMetadata.js";
|
|
31
30
|
import { getBrowserPackageRoot, safePathJoin } from "./helpers/path.js";
|
|
32
31
|
|
|
33
32
|
const dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -40,22 +39,7 @@ const packageJsonContent = fs.readFileSync(
|
|
|
40
39
|
);
|
|
41
40
|
const { version } = JSON.parse(packageJsonContent);
|
|
42
41
|
|
|
43
|
-
const
|
|
44
|
-
const candidates = ["src", "libEs6"];
|
|
45
|
-
|
|
46
|
-
for (const candidate of candidates) {
|
|
47
|
-
const candidatePath = safePathJoin(browserPackageRoot, candidate);
|
|
48
|
-
if (fs.existsSync(candidatePath)) {
|
|
49
|
-
return candidatePath;
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
throw new Error(
|
|
54
|
-
"Unable to locate source directory. Expected to find 'src' or 'libEs6' within the browser package.",
|
|
55
|
-
);
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const sourceRootPath = resolveSourceRootPath();
|
|
42
|
+
const sourceRootPath = safePathJoin(browserPackageRoot, "src");
|
|
59
43
|
|
|
60
44
|
const arrayDifference = (arr1, arr2) => arr1.filter((x) => !arr2.includes(x));
|
|
61
45
|
|
|
@@ -91,14 +75,12 @@ const generateInputEntryFile = ({
|
|
|
91
75
|
outputFile = "input.js",
|
|
92
76
|
includedModules,
|
|
93
77
|
}) => {
|
|
94
|
-
const
|
|
95
|
-
plugins: [entryPointGeneratorBabelPlugin(babel.types, includedModules)],
|
|
96
|
-
}).code;
|
|
78
|
+
const source = generateEntryPointSource(includedModules);
|
|
97
79
|
|
|
98
80
|
const destinationDirectory = path.dirname(inputPath);
|
|
99
81
|
const outputPath = safePathJoin(destinationDirectory, outputFile);
|
|
100
82
|
|
|
101
|
-
fs.writeFileSync(outputPath,
|
|
83
|
+
fs.writeFileSync(outputPath, source);
|
|
102
84
|
|
|
103
85
|
return outputPath;
|
|
104
86
|
};
|
|
@@ -116,16 +98,22 @@ const build = async (argv) => {
|
|
|
116
98
|
minify: argv.minify,
|
|
117
99
|
});
|
|
118
100
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
101
|
+
let bundle;
|
|
102
|
+
try {
|
|
103
|
+
bundle = await rollup(rollupConfig);
|
|
104
|
+
await bundle.write(rollupConfig.output[0]);
|
|
105
|
+
|
|
106
|
+
console.log(
|
|
107
|
+
`🎉 Wrote ${
|
|
108
|
+
path.isAbsolute(argv.outputDir)
|
|
109
|
+
? rollupConfig.output[0].file
|
|
110
|
+
: path.relative(process.cwd(), rollupConfig.output[0].file)
|
|
111
|
+
} (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
|
|
112
|
+
);
|
|
113
|
+
} finally {
|
|
114
|
+
await bundle?.close();
|
|
115
|
+
fs.rmSync(inputFile, { force: true });
|
|
116
|
+
}
|
|
129
117
|
};
|
|
130
118
|
|
|
131
119
|
const buildPushNotificationsServiceWorker = async (argv) => {
|
|
@@ -168,15 +156,19 @@ const buildPushNotificationsServiceWorker = async (argv) => {
|
|
|
168
156
|
};
|
|
169
157
|
|
|
170
158
|
const bundle = await rollup(rollupConfig);
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
159
|
+
try {
|
|
160
|
+
await bundle.write(rollupConfig.output[0]);
|
|
161
|
+
|
|
162
|
+
console.log(
|
|
163
|
+
`🎉 Wrote ${
|
|
164
|
+
path.isAbsolute(argv.outputDir)
|
|
165
|
+
? rollupConfig.output[0].file
|
|
166
|
+
: path.relative(process.cwd(), rollupConfig.output[0].file)
|
|
167
|
+
} (${getFileSizeInKB(rollupConfig.output[0].file)}).`,
|
|
168
|
+
);
|
|
169
|
+
} finally {
|
|
170
|
+
await bundle.close();
|
|
171
|
+
}
|
|
180
172
|
};
|
|
181
173
|
|
|
182
174
|
const getMakeBuildCommand = () => {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2026 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 {
|
|
14
|
+
optionalComponentNames as coreOptional,
|
|
15
|
+
requiredComponentNames,
|
|
16
|
+
} from "@adobe/alloy-core/componentMetadata.js";
|
|
17
|
+
import browserManifest from "../../components.json" with { type: "json" };
|
|
18
|
+
|
|
19
|
+
const browserOptional = browserManifest.optional.map((c) => c.name);
|
|
20
|
+
|
|
21
|
+
export const optionalComponentNames = Object.freeze([
|
|
22
|
+
...new Set([...coreOptional, ...browserOptional]),
|
|
23
|
+
]);
|
|
24
|
+
|
|
25
|
+
export { requiredComponentNames };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2026 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 generateEntryPointSource = (includedModules) => {
|
|
14
|
+
const hasComponents = includedModules.length > 0;
|
|
15
|
+
const componentList = includedModules.join(", ");
|
|
16
|
+
|
|
17
|
+
const importLine = hasComponents
|
|
18
|
+
? `import { ${componentList} } from "./allOptionalComponents.js";`
|
|
19
|
+
: "";
|
|
20
|
+
|
|
21
|
+
const componentsArray = hasComponents ? `[${componentList}]` : "[]";
|
|
22
|
+
|
|
23
|
+
return `\
|
|
24
|
+
import initializeStandalone from "./initializeStandalone.js";
|
|
25
|
+
${importLine}
|
|
26
|
+
|
|
27
|
+
initializeStandalone({ components: ${componentsArray} });
|
|
28
|
+
`;
|
|
29
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2026 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 * from "@adobe/alloy-core/core/componentCreators.js";
|
|
14
|
+
export * from "./components/componentCreators.js";
|
|
@@ -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
|
+
|
|
15
|
+
const createClickHandler = ({ eventManager, lifecycle, handleError }) => {
|
|
16
|
+
return (clickEvent) => {
|
|
17
|
+
// Ignore repropagated clicks from AppMeasurement
|
|
18
|
+
if (clickEvent.s_fe) {
|
|
19
|
+
return Promise.resolve();
|
|
20
|
+
}
|
|
21
|
+
// TODO: Consider safeguarding from the same object being clicked multiple times in rapid succession?
|
|
22
|
+
const clickedElement =
|
|
23
|
+
"composedPath" in clickEvent && clickEvent.composedPath().length > 0
|
|
24
|
+
? clickEvent.composedPath()[0]
|
|
25
|
+
: clickEvent.target;
|
|
26
|
+
const event = eventManager.createEvent();
|
|
27
|
+
// this is to make sure a exit link personalization metric use send beacon
|
|
28
|
+
event.documentMayUnload();
|
|
29
|
+
return (
|
|
30
|
+
lifecycle
|
|
31
|
+
.onClick({ event, clickedElement })
|
|
32
|
+
.then(() => {
|
|
33
|
+
if (event.isEmpty()) {
|
|
34
|
+
return Promise.resolve();
|
|
35
|
+
}
|
|
36
|
+
return eventManager.sendEvent(event);
|
|
37
|
+
})
|
|
38
|
+
// eventManager.sendEvent() will return a promise resolved to an
|
|
39
|
+
// object and we want to avoid returning any value to the customer
|
|
40
|
+
.then(noop)
|
|
41
|
+
.catch((error) => {
|
|
42
|
+
handleError(error, "click collection");
|
|
43
|
+
})
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export default ({ eventManager, lifecycle, handleError }) => {
|
|
49
|
+
const clickHandler = createClickHandler({
|
|
50
|
+
eventManager,
|
|
51
|
+
lifecycle,
|
|
52
|
+
handleError,
|
|
53
|
+
});
|
|
54
|
+
document.addEventListener("click", clickHandler, true);
|
|
55
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
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 {
|
|
14
|
+
boolean,
|
|
15
|
+
callback,
|
|
16
|
+
objectOf,
|
|
17
|
+
string,
|
|
18
|
+
} from "@adobe/alloy-core/utils/validation";
|
|
19
|
+
|
|
20
|
+
const DEFAULT_DOWNLOAD_QUALIFIER =
|
|
21
|
+
"\\.(exe|zip|wav|mp3|mov|mpg|avi|wmv|pdf|doc|docx|xls|xlsx|ppt|pptx)$";
|
|
22
|
+
|
|
23
|
+
export const downloadLinkQualifier = string()
|
|
24
|
+
.regexp()
|
|
25
|
+
.default(DEFAULT_DOWNLOAD_QUALIFIER);
|
|
26
|
+
|
|
27
|
+
const validators = objectOf({
|
|
28
|
+
clickCollectionEnabled: boolean().default(true),
|
|
29
|
+
clickCollection: objectOf({
|
|
30
|
+
internalLinkEnabled: boolean().default(true),
|
|
31
|
+
externalLinkEnabled: boolean().default(true),
|
|
32
|
+
downloadLinkEnabled: boolean().default(true),
|
|
33
|
+
// TODO: Consider moving downloadLinkQualifier here.
|
|
34
|
+
sessionStorageEnabled: boolean().default(false),
|
|
35
|
+
eventGroupingEnabled: boolean().default(false),
|
|
36
|
+
filterClickProperties: callback(),
|
|
37
|
+
}).default({
|
|
38
|
+
internalLinkEnabled: true,
|
|
39
|
+
externalLinkEnabled: true,
|
|
40
|
+
downloadLinkEnabled: true,
|
|
41
|
+
sessionStorageEnabled: false,
|
|
42
|
+
eventGroupingEnabled: false,
|
|
43
|
+
}),
|
|
44
|
+
downloadLinkQualifier,
|
|
45
|
+
onBeforeLinkClickSend: callback().deprecated(
|
|
46
|
+
'The field "onBeforeLinkClickSend" has been deprecated. Use "clickCollection.filterClickDetails" instead.',
|
|
47
|
+
),
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Export both the validators and the default qualifier
|
|
51
|
+
export { DEFAULT_DOWNLOAD_QUALIFIER };
|
|
52
|
+
export default validators;
|
|
@@ -0,0 +1,33 @@
|
|
|
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
|
+
|
|
13
|
+
const CLICK_ACTIVITY_DATA = "clickData";
|
|
14
|
+
|
|
15
|
+
export default ({ storage }) => {
|
|
16
|
+
return {
|
|
17
|
+
save: (data) => {
|
|
18
|
+
const jsonData = JSON.stringify(data);
|
|
19
|
+
storage.setItem(CLICK_ACTIVITY_DATA, jsonData);
|
|
20
|
+
},
|
|
21
|
+
load: () => {
|
|
22
|
+
let jsonData = null;
|
|
23
|
+
const data = storage.getItem(CLICK_ACTIVITY_DATA);
|
|
24
|
+
if (data) {
|
|
25
|
+
jsonData = JSON.parse(data);
|
|
26
|
+
}
|
|
27
|
+
return jsonData;
|
|
28
|
+
},
|
|
29
|
+
remove: () => {
|
|
30
|
+
storage.removeItem(CLICK_ACTIVITY_DATA);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
};
|
|
@@ -0,0 +1,224 @@
|
|
|
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
|
+
const buildXdmFromClickedElementProperties = (props) => {
|
|
14
|
+
return {
|
|
15
|
+
eventType: "web.webinteraction.linkClicks",
|
|
16
|
+
web: {
|
|
17
|
+
webInteraction: {
|
|
18
|
+
name: props.linkName,
|
|
19
|
+
region: props.linkRegion,
|
|
20
|
+
type: props.linkType,
|
|
21
|
+
URL: props.linkUrl,
|
|
22
|
+
linkClicks: {
|
|
23
|
+
value: 1,
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const buildDataFromClickedElementProperties = (props) => {
|
|
31
|
+
return {
|
|
32
|
+
__adobe: {
|
|
33
|
+
analytics: {
|
|
34
|
+
contextData: {
|
|
35
|
+
a: {
|
|
36
|
+
activitymap: {
|
|
37
|
+
page: props.pageName,
|
|
38
|
+
link: props.linkName,
|
|
39
|
+
region: props.linkRegion,
|
|
40
|
+
pageIDType: props.pageIDType,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
const populateClickedElementPropertiesFromOptions = (options, props) => {
|
|
50
|
+
const { xdm, data, clickedElement } = options;
|
|
51
|
+
props.clickedElement = clickedElement;
|
|
52
|
+
if (xdm && xdm.web && xdm.web.webInteraction) {
|
|
53
|
+
const { name, region, type, URL } = xdm.web.webInteraction;
|
|
54
|
+
props.linkName = name;
|
|
55
|
+
props.linkRegion = region;
|
|
56
|
+
props.linkType = type;
|
|
57
|
+
props.linkUrl = URL;
|
|
58
|
+
}
|
|
59
|
+
// DATA has priority over XDM
|
|
60
|
+
/* eslint no-underscore-dangle: 0 */
|
|
61
|
+
if (data && data.__adobe && data.__adobe.analytics) {
|
|
62
|
+
const { contextData } = data.__adobe.analytics;
|
|
63
|
+
if (contextData && contextData.a && contextData.a.activitymap) {
|
|
64
|
+
// Set the properties if they exists
|
|
65
|
+
const { page, link, region, pageIDType } = contextData.a.activitymap;
|
|
66
|
+
props.pageName = page || props.pageName;
|
|
67
|
+
props.linkName = link || props.linkName;
|
|
68
|
+
props.linkRegion = region || props.linkRegion;
|
|
69
|
+
if (pageIDType !== undefined) {
|
|
70
|
+
props.pageIDType = pageIDType;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export default ({ properties, logger } = {}) => {
|
|
77
|
+
let props = properties || {};
|
|
78
|
+
const clickedElementProperties = {
|
|
79
|
+
get pageName() {
|
|
80
|
+
return props.pageName;
|
|
81
|
+
},
|
|
82
|
+
set pageName(value) {
|
|
83
|
+
props.pageName = value;
|
|
84
|
+
},
|
|
85
|
+
get linkName() {
|
|
86
|
+
return props.linkName;
|
|
87
|
+
},
|
|
88
|
+
set linkName(value) {
|
|
89
|
+
props.linkName = value;
|
|
90
|
+
},
|
|
91
|
+
get linkRegion() {
|
|
92
|
+
return props.linkRegion;
|
|
93
|
+
},
|
|
94
|
+
set linkRegion(value) {
|
|
95
|
+
props.linkRegion = value;
|
|
96
|
+
},
|
|
97
|
+
get linkType() {
|
|
98
|
+
return props.linkType;
|
|
99
|
+
},
|
|
100
|
+
set linkType(value) {
|
|
101
|
+
props.linkType = value;
|
|
102
|
+
},
|
|
103
|
+
get linkUrl() {
|
|
104
|
+
return props.linkUrl;
|
|
105
|
+
},
|
|
106
|
+
set linkUrl(value) {
|
|
107
|
+
props.linkUrl = value;
|
|
108
|
+
},
|
|
109
|
+
get pageIDType() {
|
|
110
|
+
return props.pageIDType;
|
|
111
|
+
},
|
|
112
|
+
set pageIDType(value) {
|
|
113
|
+
props.pageIDType = value;
|
|
114
|
+
},
|
|
115
|
+
get clickedElement() {
|
|
116
|
+
return props.clickedElement;
|
|
117
|
+
},
|
|
118
|
+
set clickedElement(value) {
|
|
119
|
+
props.clickedElement = value;
|
|
120
|
+
},
|
|
121
|
+
get properties() {
|
|
122
|
+
return {
|
|
123
|
+
pageName: props.pageName,
|
|
124
|
+
linkName: props.linkName,
|
|
125
|
+
linkRegion: props.linkRegion,
|
|
126
|
+
linkType: props.linkType,
|
|
127
|
+
linkUrl: props.linkUrl,
|
|
128
|
+
pageIDType: props.pageIDType,
|
|
129
|
+
};
|
|
130
|
+
},
|
|
131
|
+
isValidLink() {
|
|
132
|
+
return (
|
|
133
|
+
!!props.linkUrl &&
|
|
134
|
+
!!props.linkType &&
|
|
135
|
+
!!props.linkName &&
|
|
136
|
+
!!props.linkRegion
|
|
137
|
+
);
|
|
138
|
+
},
|
|
139
|
+
isInternalLink() {
|
|
140
|
+
return this.isValidLink() && props.linkType === "other";
|
|
141
|
+
},
|
|
142
|
+
isValidActivityMapData() {
|
|
143
|
+
return (
|
|
144
|
+
!!props.pageName &&
|
|
145
|
+
!!props.linkName &&
|
|
146
|
+
!!props.linkRegion &&
|
|
147
|
+
props.pageIDType !== undefined
|
|
148
|
+
);
|
|
149
|
+
},
|
|
150
|
+
get xdm() {
|
|
151
|
+
if (props.filteredXdm) {
|
|
152
|
+
return props.filteredXdm;
|
|
153
|
+
}
|
|
154
|
+
return buildXdmFromClickedElementProperties(this);
|
|
155
|
+
},
|
|
156
|
+
get data() {
|
|
157
|
+
if (props.filteredData) {
|
|
158
|
+
return props.filteredData;
|
|
159
|
+
}
|
|
160
|
+
return buildDataFromClickedElementProperties(this);
|
|
161
|
+
},
|
|
162
|
+
applyPropertyFilter(filter) {
|
|
163
|
+
if (filter && filter(props) === false) {
|
|
164
|
+
if (logger) {
|
|
165
|
+
logger.info(
|
|
166
|
+
`Clicked element properties were rejected by filter function: ${JSON.stringify(
|
|
167
|
+
this.properties,
|
|
168
|
+
null,
|
|
169
|
+
2,
|
|
170
|
+
)}`,
|
|
171
|
+
);
|
|
172
|
+
}
|
|
173
|
+
props = {};
|
|
174
|
+
}
|
|
175
|
+
},
|
|
176
|
+
applyOptionsFilter(filter) {
|
|
177
|
+
const opts = this.options;
|
|
178
|
+
if (opts && opts.clickedElement && (opts.xdm || opts.data)) {
|
|
179
|
+
// Properties are rejected if filter is explicitly false.
|
|
180
|
+
if (filter && filter(opts) === false) {
|
|
181
|
+
if (logger) {
|
|
182
|
+
logger.info(
|
|
183
|
+
`Clicked element properties were rejected by filter function: ${JSON.stringify(
|
|
184
|
+
this.properties,
|
|
185
|
+
null,
|
|
186
|
+
2,
|
|
187
|
+
)}`,
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
this.options = undefined;
|
|
191
|
+
return;
|
|
192
|
+
}
|
|
193
|
+
this.options = opts;
|
|
194
|
+
// This is just to ensure that any fields outside clicked element properties
|
|
195
|
+
// set by the user filter persists.
|
|
196
|
+
props.filteredXdm = opts.xdm;
|
|
197
|
+
props.filteredData = opts.data;
|
|
198
|
+
}
|
|
199
|
+
},
|
|
200
|
+
get options() {
|
|
201
|
+
const opts = {};
|
|
202
|
+
if (this.isValidLink()) {
|
|
203
|
+
opts.xdm = this.xdm;
|
|
204
|
+
}
|
|
205
|
+
if (this.isValidActivityMapData()) {
|
|
206
|
+
opts.data = this.data;
|
|
207
|
+
}
|
|
208
|
+
if (this.clickedElement) {
|
|
209
|
+
opts.clickedElement = this.clickedElement;
|
|
210
|
+
}
|
|
211
|
+
if (!opts.xdm && !opts.data) {
|
|
212
|
+
return undefined;
|
|
213
|
+
}
|
|
214
|
+
return opts;
|
|
215
|
+
},
|
|
216
|
+
set options(value) {
|
|
217
|
+
props = {};
|
|
218
|
+
if (value) {
|
|
219
|
+
populateClickedElementPropertiesFromOptions(value, props);
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
return clickedElementProperties;
|
|
224
|
+
};
|