@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,154 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** @import { ServiceWorkerLogger } from '../types.js' */
|
|
14
|
+
/** @import { TrackingDataPayload } from '../types.js' */
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @param {Object} dependencies
|
|
18
|
+
* @param {(logger: ServiceWorkerLogger) => Promise<Object>} dependencies.readFromIndexedDb
|
|
19
|
+
* @param {() => string} dependencies.uuidv4
|
|
20
|
+
* @param {ServiceWorkerLogger} dependencies.logger
|
|
21
|
+
* @param {(url: string, options: object) => Promise<Response>} dependencies.fetch
|
|
22
|
+
* @returns {(options: { xdm: Object, actionLabel?: string, applicationLaunches?: number }) => Promise<boolean>}
|
|
23
|
+
*/
|
|
24
|
+
export const createMakeSendServiceWorkerTrackingData = ({
|
|
25
|
+
readFromIndexedDb,
|
|
26
|
+
uuidv4,
|
|
27
|
+
logger,
|
|
28
|
+
fetch,
|
|
29
|
+
}) => {
|
|
30
|
+
/**
|
|
31
|
+
* @async
|
|
32
|
+
* @function
|
|
33
|
+
* @param {Object} options
|
|
34
|
+
* @param {Object} options.xdm
|
|
35
|
+
* @param {string} [options.actionLabel]
|
|
36
|
+
* @param {number} [options.applicationLaunches=0]
|
|
37
|
+
*
|
|
38
|
+
* @returns {Promise<boolean>}
|
|
39
|
+
* @throws {Error}
|
|
40
|
+
*/
|
|
41
|
+
return async ({ xdm, actionLabel, applicationLaunches = 0 }) => {
|
|
42
|
+
const configData = await readFromIndexedDb(logger);
|
|
43
|
+
const { browser, ecid, edgeDomain, edgeBasePath, datastreamId, datasetId } =
|
|
44
|
+
configData || {};
|
|
45
|
+
let customActionData = {};
|
|
46
|
+
|
|
47
|
+
if (actionLabel) {
|
|
48
|
+
customActionData = {
|
|
49
|
+
customAction: { actionID: actionLabel },
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const requiredFields = [
|
|
54
|
+
{ name: "browser", errorField: "Browser" },
|
|
55
|
+
{ name: "ecid", errorField: "ECID" },
|
|
56
|
+
{
|
|
57
|
+
name: "edgeDomain",
|
|
58
|
+
errorField: "Edge domain",
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: "edgeBasePath",
|
|
62
|
+
errorField: "Edge base path",
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: "datastreamId",
|
|
66
|
+
errorField: "Datastream ID",
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: "datasetId",
|
|
70
|
+
errorField: "Dataset ID",
|
|
71
|
+
},
|
|
72
|
+
];
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
for (const field of requiredFields) {
|
|
76
|
+
if (!configData[field.name]) {
|
|
77
|
+
throw new Error(
|
|
78
|
+
`Cannot send tracking call. ${field.errorField} is missing.`,
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const url = `https://${edgeDomain}/${edgeBasePath}/v1/interact?configId=${datastreamId}&requestId=${uuidv4()}`;
|
|
84
|
+
|
|
85
|
+
/** @type {TrackingDataPayload} */
|
|
86
|
+
const payload = {
|
|
87
|
+
events: [
|
|
88
|
+
{
|
|
89
|
+
xdm: {
|
|
90
|
+
identityMap: {
|
|
91
|
+
ECID: [{ id: ecid }],
|
|
92
|
+
},
|
|
93
|
+
timestamp: new Date().toISOString(),
|
|
94
|
+
pushNotificationTracking: {
|
|
95
|
+
...customActionData,
|
|
96
|
+
pushProviderMessageID: uuidv4(),
|
|
97
|
+
pushProvider: browser.toLowerCase(),
|
|
98
|
+
},
|
|
99
|
+
application: {
|
|
100
|
+
launches: {
|
|
101
|
+
value: applicationLaunches,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
eventType: actionLabel
|
|
105
|
+
? "pushTracking.customAction"
|
|
106
|
+
: "pushTracking.applicationOpened",
|
|
107
|
+
_experience: {
|
|
108
|
+
...xdm._experience,
|
|
109
|
+
customerJourneyManagement: {
|
|
110
|
+
...xdm._experience.customerJourneyManagement,
|
|
111
|
+
pushChannelContext: {
|
|
112
|
+
platform: "web",
|
|
113
|
+
},
|
|
114
|
+
messageProfile: {
|
|
115
|
+
channel: {
|
|
116
|
+
_id: "https://ns.adobe.com/xdm/channels/push",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
},
|
|
120
|
+
},
|
|
121
|
+
},
|
|
122
|
+
meta: {
|
|
123
|
+
collect: {
|
|
124
|
+
datasetId,
|
|
125
|
+
},
|
|
126
|
+
},
|
|
127
|
+
},
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
|
|
131
|
+
const response = await fetch(url, {
|
|
132
|
+
method: "POST",
|
|
133
|
+
headers: {
|
|
134
|
+
"content-type": "text/plain; charset=UTF-8",
|
|
135
|
+
},
|
|
136
|
+
body: JSON.stringify(payload),
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
if (!response.ok) {
|
|
140
|
+
logger.error(
|
|
141
|
+
"Tracking call failed: ",
|
|
142
|
+
response.status,
|
|
143
|
+
response.statusText,
|
|
144
|
+
);
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
return true;
|
|
149
|
+
} catch (error) {
|
|
150
|
+
logger.error("Error sending tracking call:", error);
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
};
|
|
154
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** @import { Identity } from '@adobe/alloy-core/utils/request/types.js' */
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef {Object} PushSubscription
|
|
17
|
+
* @property {string} endpoint - The push service endpoint URL
|
|
18
|
+
* @property {Object} keys - The subscription keys object
|
|
19
|
+
* @property {string|null} keys.p256dh - The P-256 ECDH public key as an ArrayBuffer, or null if not available
|
|
20
|
+
* @property {string|null} keys.auth - The authentication secret as an ArrayBuffer, or null if not available
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @typedef {Object} CustomerJourneyManagement
|
|
25
|
+
* @property {Object} messageExecution
|
|
26
|
+
* @property {string} messageExecution.messageExecutionID
|
|
27
|
+
* @property {string} messageExecution.messageID
|
|
28
|
+
* @property {string} messageExecution.messageType
|
|
29
|
+
* @property {string} messageExecution.campaignID
|
|
30
|
+
* @property {string} messageExecution.campaignVersionID
|
|
31
|
+
* @property {string} messageExecution.batchInstanceID
|
|
32
|
+
* @property {Object} [pushChannelContext]
|
|
33
|
+
* @property {"web"} [pushChannelContext.platform]
|
|
34
|
+
* @property {Object} [messageProfile]
|
|
35
|
+
* @property {Object} [messageProfile.channel]
|
|
36
|
+
* @property {string} [messageProfile.channel._id]
|
|
37
|
+
*/
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @typedef {Object} Decisioning
|
|
41
|
+
* @property {Object[]} propositions
|
|
42
|
+
* @property {Object} propositions[].scopeDetails
|
|
43
|
+
* @property {string} propositions[].scopeDetails.correlationID
|
|
44
|
+
*/
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @typedef {Object} XdmTrackingContext
|
|
48
|
+
* @property {Object} _experience
|
|
49
|
+
* @property {CustomerJourneyManagement} _experience.customerJourneyManagement
|
|
50
|
+
* @property {Decisioning} _experience.decisioning
|
|
51
|
+
*/
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @typedef {Object} PushNotificationData
|
|
55
|
+
* @property {Object} web
|
|
56
|
+
* @property {string} web.title
|
|
57
|
+
* @property {string} web.body
|
|
58
|
+
* @property {string|null} web.media
|
|
59
|
+
* @property {Object} web.interaction
|
|
60
|
+
* @property {string} web.interaction.type
|
|
61
|
+
* @property {string|null} web.interaction.uri
|
|
62
|
+
* @property {Object} web.actions
|
|
63
|
+
* @property {Object[]} web.actions.buttons
|
|
64
|
+
* @property {string} web.actions.buttons[].label
|
|
65
|
+
* @property {string} web.actions.buttons[].type
|
|
66
|
+
* @property {string} web.actions.buttons[].uri
|
|
67
|
+
* @property {string} web.priority
|
|
68
|
+
* @property {Object} web._xdm
|
|
69
|
+
* @property {XdmTrackingContext} web._xdm.mixins
|
|
70
|
+
*/
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @typedef {Object} TrackingDataPayload
|
|
74
|
+
* @property {Object[]} events
|
|
75
|
+
* @property {Object} events[].xdm
|
|
76
|
+
* @property {Object} events[].xdm.identityMap
|
|
77
|
+
* @property {Object[]} events[].xdm.identityMap.ECID
|
|
78
|
+
* @property {string} events[].xdm.identityMap.ECID[].id
|
|
79
|
+
* @property {string} events[].xdm.timestamp
|
|
80
|
+
* @property {Object} events[].xdm.pushNotificationTracking
|
|
81
|
+
* @property {string} events[].xdm.pushNotificationTracking.pushProviderMessageID
|
|
82
|
+
* @property {string} events[].xdm.pushNotificationTracking.pushProvider
|
|
83
|
+
* @property {Object} [events[].xdm.pushNotificationTracking.customAction]
|
|
84
|
+
* @property {string} [events[].xdm.pushNotificationTracking.customAction.actionID]
|
|
85
|
+
* @property {Object} events[].xdm.application
|
|
86
|
+
* @property {Object} events[].xdm.application.launches
|
|
87
|
+
* @property {number} events[].xdm.application.launches.value
|
|
88
|
+
* @property {string} events[].xdm.eventType
|
|
89
|
+
* @property {Object} events[].xdm._experience
|
|
90
|
+
* @property {CustomerJourneyManagement} events[].xdm._experience.customerJourneyManagement
|
|
91
|
+
* @property {Decisioning} events[].xdm._experience.decisioning
|
|
92
|
+
* @property {Object} events[].meta
|
|
93
|
+
* @property {Object} events[].meta.collect
|
|
94
|
+
* @property {string} events[].meta.collect.datasetId
|
|
95
|
+
*/
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* @typedef {Object} ServiceWorkerLogger
|
|
99
|
+
* @property {string} namespace
|
|
100
|
+
* @property {(...args: any[]) => void} info
|
|
101
|
+
* @property {(...args: any[]) => void} error
|
|
102
|
+
*/
|
|
103
|
+
|
|
104
|
+
export const Types = {};
|
|
@@ -0,0 +1,16 @@
|
|
|
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 { default as activityCollector } from "./ActivityCollector/index.js";
|
|
14
|
+
export { default as advertising } from "./Advertising/index.js";
|
|
15
|
+
export { default as personalization } from "./Personalization/index.js";
|
|
16
|
+
export { default as pushNotifications } from "./PushNotifications/index.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
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 { default as context } from "./Context/index.js";
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import serviceWorkerPushListener from "./components/PushNotifications/helpers/serviceWorkerPushListener.js";
|
|
13
|
+
import createServiceWorkerNotificationClickListener from "./components/PushNotifications/helpers/serviceWorkerNotificationClickListener.js";
|
|
14
|
+
import readFromIndexedDb from "./components/PushNotifications/helpers/readFromIndexedDb.js";
|
|
15
|
+
import { createMakeSendServiceWorkerTrackingData } from "./components/PushNotifications/request/makeSendServiceWorkerTrackingData.js";
|
|
16
|
+
import uuidv4 from "@adobe/alloy-core/utils/uuid.js";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @type {Object} PlatformCapabilities
|
|
20
|
+
* @property {Logger} logger
|
|
21
|
+
* @property {(url: string, options: object) => Promise<Response>} fetch
|
|
22
|
+
*
|
|
23
|
+
* TODO: Remove dependency on sw (service worker)
|
|
24
|
+
*/
|
|
25
|
+
const createEventListeners = ({ platform, sw }) => {
|
|
26
|
+
const makeSendServiceWorkerTrackingData =
|
|
27
|
+
createMakeSendServiceWorkerTrackingData({
|
|
28
|
+
readFromIndexedDb,
|
|
29
|
+
uuidv4,
|
|
30
|
+
logger: platform.logger,
|
|
31
|
+
fetch: platform.fetch,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
const serviceWorkerNotificationClickListener =
|
|
35
|
+
createServiceWorkerNotificationClickListener({
|
|
36
|
+
makeSendServiceWorkerTrackingData,
|
|
37
|
+
sw,
|
|
38
|
+
logger: platform.logger,
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
return {
|
|
42
|
+
pushNotifications: {
|
|
43
|
+
/**
|
|
44
|
+
*
|
|
45
|
+
* @param {PushEvent} event
|
|
46
|
+
* @returns Promise<void>
|
|
47
|
+
*/
|
|
48
|
+
onPush(event) {
|
|
49
|
+
return serviceWorkerPushListener({
|
|
50
|
+
event,
|
|
51
|
+
sw,
|
|
52
|
+
logger: platform.logger,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
/**
|
|
56
|
+
* @param {NotificationEvent} event
|
|
57
|
+
*/
|
|
58
|
+
onNotificationClick(event) {
|
|
59
|
+
serviceWorkerNotificationClickListener({ event });
|
|
60
|
+
},
|
|
61
|
+
/**
|
|
62
|
+
*
|
|
63
|
+
* @param {NotificationEvent} event
|
|
64
|
+
*/
|
|
65
|
+
async onNotificationClose(event) {
|
|
66
|
+
const data = event.notification.data;
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
await makeSendServiceWorkerTrackingData({
|
|
70
|
+
/* eslint-disable-next-line no-underscore-dangle */
|
|
71
|
+
xdm: data._xdm.mixins,
|
|
72
|
+
actionLabel: "Dismiss",
|
|
73
|
+
});
|
|
74
|
+
} catch (error) {
|
|
75
|
+
platform.logger.error("Failed to send tracking call:", error);
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
};
|
|
81
|
+
export default createEventListeners;
|
package/src/index.js
CHANGED
|
@@ -9,5 +9,17 @@ the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTA
|
|
|
9
9
|
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
|
|
13
|
-
|
|
12
|
+
import { createCustomInstance } from "@adobe/alloy-core";
|
|
13
|
+
import * as allOptionalComponents from "./allOptionalComponents.js";
|
|
14
|
+
import * as allRequiredComponents from "./components/requiredComponentCreators.js";
|
|
15
|
+
|
|
16
|
+
export { createCustomInstance };
|
|
17
|
+
export const createInstance = (options = {}) =>
|
|
18
|
+
createCustomInstance({
|
|
19
|
+
...options,
|
|
20
|
+
components: [
|
|
21
|
+
...Object.values(allRequiredComponents),
|
|
22
|
+
...Object.values(allOptionalComponents),
|
|
23
|
+
],
|
|
24
|
+
});
|
|
25
|
+
export { allOptionalComponents as components };
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
/** @import { WindowWithAlloy, AlloyQueueItem } from './types.js' */
|
|
14
|
+
|
|
15
|
+
import { createCustomInstance } from "./index.js";
|
|
16
|
+
|
|
17
|
+
const initializeStandalone = ({ components }) => {
|
|
18
|
+
const instanceNames = /** @type {WindowWithAlloy} */ (window).__alloyNS;
|
|
19
|
+
if (!instanceNames) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
for (const name of instanceNames) {
|
|
23
|
+
const instance = createCustomInstance({ name, components });
|
|
24
|
+
const execute = (/** @type {AlloyQueueItem} */ item) => {
|
|
25
|
+
const [resolve, reject, [commandName, options]] = item;
|
|
26
|
+
return instance(commandName, options).then(resolve, reject);
|
|
27
|
+
};
|
|
28
|
+
const queue = window[name].q;
|
|
29
|
+
queue.push = execute;
|
|
30
|
+
queue.forEach(execute);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export default initializeStandalone;
|
package/src/serviceWorker.js
CHANGED
|
@@ -10,14 +10,14 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import createEventListeners from "
|
|
13
|
+
import createEventListeners from "./createEventListeners.js";
|
|
14
14
|
|
|
15
15
|
/* eslint-disable no-console */
|
|
16
16
|
|
|
17
17
|
// @ts-check
|
|
18
18
|
/// <reference lib="webworker" />
|
|
19
19
|
|
|
20
|
-
/** @import { ServiceWorkerLogger } from '
|
|
20
|
+
/** @import { ServiceWorkerLogger } from './components/PushNotifications/types.js' */
|
|
21
21
|
|
|
22
22
|
/** @type {ServiceWorkerGlobalScope} */
|
|
23
23
|
// @ts-ignore
|
package/src/standalone.js
CHANGED
|
@@ -10,31 +10,8 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
10
10
|
governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
import initializeStandalone from "./initializeStandalone.js";
|
|
14
|
+
import * as optionalComponents from "./allOptionalComponents.js";
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
import * as optionalComponents from "@adobe/alloy-core/core/componentCreators.js";
|
|
17
|
-
|
|
18
|
-
// This file is used by rollup to create the browser version that is uploaded to cdn
|
|
19
|
-
|
|
20
|
-
const initializeStandalone = ({ components }) => {
|
|
21
|
-
// eslint-disable-next-line no-underscore-dangle
|
|
22
|
-
const instanceNames = /** @type {WindowWithAlloy} */ (window).__alloyNS;
|
|
23
|
-
if (!instanceNames) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
for (const name of instanceNames) {
|
|
27
|
-
const instance = createCustomInstance({ name, components });
|
|
28
|
-
const execute = (/** @type {AlloyQueueItem} */ item) => {
|
|
29
|
-
const [resolve, reject, [commandName, options]] = item;
|
|
30
|
-
return instance(commandName, options).then(resolve, reject);
|
|
31
|
-
};
|
|
32
|
-
const queue = window[name].q;
|
|
33
|
-
queue.push = execute;
|
|
34
|
-
queue.forEach(execute);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
// If you change this line, check if the custom build script is still working.
|
|
39
|
-
// You might need to change the babel plugin in scripts/helpers/entryPointGeneratorBabelPlugin.js.
|
|
16
|
+
// Custom builds use scripts/helpers/generateEntryPoint.js to generate a modified version of this file.
|
|
40
17
|
initializeStandalone({ components: Object.values(optionalComponents) });
|
package/.browserslistrc
DELETED
package/babel.config.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
Copyright 2021 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
|
-
/*
|
|
14
|
-
* This file is used in 4 scenarios:
|
|
15
|
-
* 1. Building files specified in rollup.config.js
|
|
16
|
-
* 2. Building libEs5/ files when publishing to NPM
|
|
17
|
-
* 3. Building libEs6/ files when publishing to NPM
|
|
18
|
-
* 4. Testcafe compiling clientFunctions. Unfortunately, there is no configuration I've found
|
|
19
|
-
* to tell Testcafe not to use this file.
|
|
20
|
-
*
|
|
21
|
-
* Environments:
|
|
22
|
-
* "rollup" - Used for rollup.config.js
|
|
23
|
-
* "npmEs5" - Used for building libEs5 files when publishing to NPM
|
|
24
|
-
* "npmEs6" - Used for building libEs6 files when publishing to NPM
|
|
25
|
-
*/
|
|
26
|
-
import { dirname } from "path";
|
|
27
|
-
import { fileURLToPath } from "url";
|
|
28
|
-
|
|
29
|
-
const cwd = dirname(fileURLToPath(import.meta.url));
|
|
30
|
-
|
|
31
|
-
const transformTemplateLiteralsPlugin = [
|
|
32
|
-
"@babel/plugin-transform-template-literals",
|
|
33
|
-
{
|
|
34
|
-
loose: true,
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
const versionPlugin = ["./scripts/helpers/versionBabelPlugin", { cwd }];
|
|
38
|
-
|
|
39
|
-
const transformModulesCommonjsPlugin = [
|
|
40
|
-
"@babel/plugin-transform-modules-commonjs",
|
|
41
|
-
{
|
|
42
|
-
strict: true,
|
|
43
|
-
noInterop: true,
|
|
44
|
-
},
|
|
45
|
-
];
|
|
46
|
-
|
|
47
|
-
const npmIgnoreFiles = ["src/baseCode.js"];
|
|
48
|
-
|
|
49
|
-
export default {
|
|
50
|
-
env: {
|
|
51
|
-
rollup: {
|
|
52
|
-
presets: [
|
|
53
|
-
[
|
|
54
|
-
"@babel/preset-env",
|
|
55
|
-
{
|
|
56
|
-
modules: false,
|
|
57
|
-
},
|
|
58
|
-
],
|
|
59
|
-
],
|
|
60
|
-
plugins: [transformTemplateLiteralsPlugin, versionPlugin],
|
|
61
|
-
},
|
|
62
|
-
npmEs5: {
|
|
63
|
-
presets: [["@babel/preset-env"]],
|
|
64
|
-
ignore: npmIgnoreFiles,
|
|
65
|
-
plugins: [
|
|
66
|
-
transformTemplateLiteralsPlugin,
|
|
67
|
-
versionPlugin,
|
|
68
|
-
transformModulesCommonjsPlugin,
|
|
69
|
-
],
|
|
70
|
-
},
|
|
71
|
-
npmEs6: {
|
|
72
|
-
ignore: npmIgnoreFiles,
|
|
73
|
-
plugins: [versionPlugin],
|
|
74
|
-
},
|
|
75
|
-
},
|
|
76
|
-
};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
declare function _default({ payload }: {
|
|
2
|
-
payload: DataCollectionRequestPayload;
|
|
3
|
-
}): Request;
|
|
4
|
-
export default _default;
|
|
5
|
-
import type { DataCollectionRequestPayload } from '../../../utils/request/types.js';
|
|
6
|
-
import type { Request } from '../../../utils/request/types.js';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export const CLICK_ACTIVITY_DATA: "clickData";
|
|
@@ -1,101 +0,0 @@
|
|
|
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
|
-
Unless required by applicable law or agreed to in writing, software distributed under
|
|
7
|
-
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
8
|
-
OF ANY KIND, either express or implied. See the License for the specific language
|
|
9
|
-
governing permissions and limitations under the License.
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
const COMPONENT_SOURCE = "@adobe/alloy-core/core/componentCreators.js";
|
|
13
|
-
|
|
14
|
-
const createComponentArrayExpression = (t, includedModules) => {
|
|
15
|
-
return t.ArrayExpression(
|
|
16
|
-
includedModules.map((module) => t.Identifier(module)),
|
|
17
|
-
);
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const createComponentImport = (t, includedModules) => {
|
|
21
|
-
if (!includedModules.length) {
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const specifiers = includedModules.map((module) =>
|
|
26
|
-
t.importSpecifier(t.identifier(module), t.identifier(module)),
|
|
27
|
-
);
|
|
28
|
-
|
|
29
|
-
return t.importDeclaration(specifiers, t.stringLiteral(COMPONENT_SOURCE));
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const removeOptionalComponentsImport = (path) => {
|
|
33
|
-
const importPaths = path
|
|
34
|
-
.get("body")
|
|
35
|
-
.filter(
|
|
36
|
-
(child) =>
|
|
37
|
-
child.isImportDeclaration() &&
|
|
38
|
-
child.node.source.value === COMPONENT_SOURCE,
|
|
39
|
-
);
|
|
40
|
-
|
|
41
|
-
importPaths.forEach((importPath) => {
|
|
42
|
-
importPath.remove();
|
|
43
|
-
});
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
const insertComponentImport = (path, importNode) => {
|
|
47
|
-
if (!importNode) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
const importDeclarations = path
|
|
52
|
-
.get("body")
|
|
53
|
-
.filter((child) => child.isImportDeclaration());
|
|
54
|
-
|
|
55
|
-
if (importDeclarations.length === 0) {
|
|
56
|
-
path.unshiftContainer("body", importNode);
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
importDeclarations[importDeclarations.length - 1].insertAfter(importNode);
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
export default (t, includedModules) => ({
|
|
64
|
-
visitor: {
|
|
65
|
-
// rewrite the imports
|
|
66
|
-
Program: {
|
|
67
|
-
enter(path, state) {
|
|
68
|
-
state.componentsArray = createComponentArrayExpression(
|
|
69
|
-
t,
|
|
70
|
-
includedModules,
|
|
71
|
-
);
|
|
72
|
-
removeOptionalComponentsImport(path);
|
|
73
|
-
},
|
|
74
|
-
exit(path, state) {
|
|
75
|
-
const importNode = createComponentImport(t, includedModules);
|
|
76
|
-
insertComponentImport(path, importNode);
|
|
77
|
-
state.componentsArray = null;
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
// pass in the new, smaller components array to `initializeStandalone`
|
|
81
|
-
CallExpression(path, state) {
|
|
82
|
-
if (path.node.callee.name !== "initializeStandalone") {
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
const arrayExpression =
|
|
87
|
-
state.componentsArray ||
|
|
88
|
-
createComponentArrayExpression(t, includedModules);
|
|
89
|
-
|
|
90
|
-
path.replaceWith(
|
|
91
|
-
t.CallExpression(t.Identifier("initializeStandalone"), [
|
|
92
|
-
t.ObjectExpression([
|
|
93
|
-
t.ObjectProperty(t.Identifier("components"), arrayExpression),
|
|
94
|
-
]),
|
|
95
|
-
]),
|
|
96
|
-
);
|
|
97
|
-
|
|
98
|
-
path.stop();
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
});
|
|
File without changes
|
|
File without changes
|