@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,121 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import PAGE_WIDE_SCOPE from "@adobe/alloy-core/constants/pageWideScope.js";
|
|
14
|
+
import {
|
|
15
|
+
PAGE_SCOPE_TYPE,
|
|
16
|
+
PROPOSITION_SCOPE_TYPE,
|
|
17
|
+
VIEW_SCOPE_TYPE,
|
|
18
|
+
} from "../constants/scopeType.js";
|
|
19
|
+
|
|
20
|
+
export default ({ preprocess, isPageWideSurface }) => {
|
|
21
|
+
const createItem = (item, proposition) => {
|
|
22
|
+
const { id, schema, data, characteristics: { trackingLabel } = {} } = item;
|
|
23
|
+
|
|
24
|
+
const schemaType = data ? data.type : undefined;
|
|
25
|
+
|
|
26
|
+
const processedData = preprocess(data);
|
|
27
|
+
|
|
28
|
+
return {
|
|
29
|
+
getId() {
|
|
30
|
+
return id;
|
|
31
|
+
},
|
|
32
|
+
getSchema() {
|
|
33
|
+
return schema;
|
|
34
|
+
},
|
|
35
|
+
getSchemaType() {
|
|
36
|
+
return schemaType;
|
|
37
|
+
},
|
|
38
|
+
getData() {
|
|
39
|
+
return processedData;
|
|
40
|
+
},
|
|
41
|
+
getProposition() {
|
|
42
|
+
return proposition;
|
|
43
|
+
},
|
|
44
|
+
getTrackingLabel() {
|
|
45
|
+
return trackingLabel;
|
|
46
|
+
},
|
|
47
|
+
getOriginalItem() {
|
|
48
|
+
return item;
|
|
49
|
+
},
|
|
50
|
+
toString() {
|
|
51
|
+
return JSON.stringify(item);
|
|
52
|
+
},
|
|
53
|
+
toJSON() {
|
|
54
|
+
return item;
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
return (
|
|
60
|
+
payload,
|
|
61
|
+
visibleInReturnedItems = true,
|
|
62
|
+
shouldSuppressDisplay = false,
|
|
63
|
+
identityMap = undefined,
|
|
64
|
+
) => {
|
|
65
|
+
const { id, scope, scopeDetails, items = [] } = payload;
|
|
66
|
+
const { characteristics: { scopeType } = {} } = scopeDetails || {};
|
|
67
|
+
|
|
68
|
+
return {
|
|
69
|
+
getScope() {
|
|
70
|
+
return scope;
|
|
71
|
+
},
|
|
72
|
+
getScopeType() {
|
|
73
|
+
if (scope === PAGE_WIDE_SCOPE || isPageWideSurface(scope)) {
|
|
74
|
+
return PAGE_SCOPE_TYPE;
|
|
75
|
+
}
|
|
76
|
+
if (scopeType === VIEW_SCOPE_TYPE) {
|
|
77
|
+
return VIEW_SCOPE_TYPE;
|
|
78
|
+
}
|
|
79
|
+
return PROPOSITION_SCOPE_TYPE;
|
|
80
|
+
},
|
|
81
|
+
getItems() {
|
|
82
|
+
return items.map((item) => createItem(item, this));
|
|
83
|
+
},
|
|
84
|
+
getNotification() {
|
|
85
|
+
return { id, scope, scopeDetails };
|
|
86
|
+
},
|
|
87
|
+
getId() {
|
|
88
|
+
return id;
|
|
89
|
+
},
|
|
90
|
+
getIdentityMap() {
|
|
91
|
+
return identityMap;
|
|
92
|
+
},
|
|
93
|
+
toJSON() {
|
|
94
|
+
return payload;
|
|
95
|
+
},
|
|
96
|
+
shouldSuppressDisplay() {
|
|
97
|
+
return shouldSuppressDisplay;
|
|
98
|
+
},
|
|
99
|
+
addToReturnValues(
|
|
100
|
+
propositions,
|
|
101
|
+
decisions,
|
|
102
|
+
includedItems,
|
|
103
|
+
renderAttempted,
|
|
104
|
+
) {
|
|
105
|
+
if (visibleInReturnedItems) {
|
|
106
|
+
propositions.push({
|
|
107
|
+
...payload,
|
|
108
|
+
items: includedItems.map((i) => i.getOriginalItem()),
|
|
109
|
+
renderAttempted,
|
|
110
|
+
});
|
|
111
|
+
if (!renderAttempted) {
|
|
112
|
+
decisions.push({
|
|
113
|
+
...payload,
|
|
114
|
+
items: includedItems.map((i) => i.getOriginalItem()),
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import noop from "@adobe/alloy-core/utils/noop.js";
|
|
13
|
+
|
|
14
|
+
export default () => {
|
|
15
|
+
return {
|
|
16
|
+
render: noop,
|
|
17
|
+
setRenderAttempted: true,
|
|
18
|
+
includeInNotification: true,
|
|
19
|
+
};
|
|
20
|
+
};
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import { getNonce } from "../../dom-actions/dom/index.js";
|
|
14
|
+
import { parseAnchor, removeElementById } from "../utils.js";
|
|
15
|
+
import { TEXT_HTML } from "@adobe/alloy-core/constants/contentType.js";
|
|
16
|
+
import { isNonEmptyString } from "@adobe/alloy-core/utils";
|
|
17
|
+
import { createNode } from "@adobe/alloy-core/utils/dom";
|
|
18
|
+
import { objectOf } from "@adobe/alloy-core/utils/validation";
|
|
19
|
+
import { PropositionEventType } from "@adobe/alloy-core/constants/propositionEventType.js";
|
|
20
|
+
import {
|
|
21
|
+
EVENT_TYPE_TRUE,
|
|
22
|
+
INTERACT,
|
|
23
|
+
} from "@adobe/alloy-core/constants/eventType.js";
|
|
24
|
+
import createRedirect from "../../dom-actions/createRedirect.js";
|
|
25
|
+
|
|
26
|
+
const MESSAGING_CONTAINER_ID = "alloy-messaging-container";
|
|
27
|
+
const OVERLAY_CONTAINER_ID = "alloy-overlay-container";
|
|
28
|
+
const IFRAME_ID = "alloy-content-iframe";
|
|
29
|
+
|
|
30
|
+
const dismissMessage = () =>
|
|
31
|
+
[MESSAGING_CONTAINER_ID, OVERLAY_CONTAINER_ID].forEach(removeElementById);
|
|
32
|
+
export const createIframeClickHandler = (
|
|
33
|
+
interact,
|
|
34
|
+
navigateToUrl = createRedirect(window),
|
|
35
|
+
) => {
|
|
36
|
+
return (event) => {
|
|
37
|
+
event.preventDefault();
|
|
38
|
+
event.stopImmediatePropagation();
|
|
39
|
+
|
|
40
|
+
const { target } = event;
|
|
41
|
+
|
|
42
|
+
const anchor =
|
|
43
|
+
target.tagName.toLowerCase() === "a" ? target : target.closest("a");
|
|
44
|
+
|
|
45
|
+
if (!anchor) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const { action, interaction, link, label, uuid } = parseAnchor(anchor);
|
|
50
|
+
|
|
51
|
+
interact(action, {
|
|
52
|
+
label,
|
|
53
|
+
id: interaction,
|
|
54
|
+
uuid,
|
|
55
|
+
link,
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
if (action === "dismiss") {
|
|
59
|
+
dismissMessage();
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (isNonEmptyString(link) && link.length > 0) {
|
|
63
|
+
navigateToUrl(link, true);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const createIframe = (htmlContent, clickHandler) => {
|
|
69
|
+
const parser = new DOMParser();
|
|
70
|
+
const htmlDocument = parser.parseFromString(htmlContent, TEXT_HTML);
|
|
71
|
+
const scriptTag = htmlDocument.querySelector("script");
|
|
72
|
+
|
|
73
|
+
if (scriptTag) {
|
|
74
|
+
scriptTag.setAttribute("nonce", getNonce());
|
|
75
|
+
}
|
|
76
|
+
const element = createNode("iframe", {
|
|
77
|
+
src: URL.createObjectURL(
|
|
78
|
+
new Blob([htmlDocument.documentElement.outerHTML], { type: "text/html" }),
|
|
79
|
+
),
|
|
80
|
+
id: IFRAME_ID,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
element.addEventListener("load", () => {
|
|
84
|
+
const { addEventListener } =
|
|
85
|
+
element.contentDocument || element.contentWindow.document;
|
|
86
|
+
addEventListener("click", clickHandler);
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
return element;
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
const renderMessage = (iframe, webParameters, container, overlay) => {
|
|
93
|
+
[
|
|
94
|
+
{ id: OVERLAY_CONTAINER_ID, element: overlay },
|
|
95
|
+
{ id: MESSAGING_CONTAINER_ID, element: container },
|
|
96
|
+
{ id: IFRAME_ID, element: iframe },
|
|
97
|
+
].forEach(({ id, element }) => {
|
|
98
|
+
const { style = {}, params = {} } = webParameters[id];
|
|
99
|
+
|
|
100
|
+
Object.assign(element.style, style);
|
|
101
|
+
|
|
102
|
+
const {
|
|
103
|
+
parentElement = "body",
|
|
104
|
+
insertionMethod = "appendChild",
|
|
105
|
+
enabled = true,
|
|
106
|
+
} = params;
|
|
107
|
+
|
|
108
|
+
const parent = document.querySelector(parentElement);
|
|
109
|
+
if (enabled && parent && typeof parent[insertionMethod] === "function") {
|
|
110
|
+
parent[insertionMethod](element);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export const buildStyleFromMobileParameters = (mobileParameters) => {
|
|
116
|
+
const {
|
|
117
|
+
verticalAlign,
|
|
118
|
+
width,
|
|
119
|
+
horizontalAlign,
|
|
120
|
+
backdropColor,
|
|
121
|
+
height,
|
|
122
|
+
cornerRadius,
|
|
123
|
+
horizontalInset,
|
|
124
|
+
verticalInset,
|
|
125
|
+
uiTakeover = false,
|
|
126
|
+
} = mobileParameters;
|
|
127
|
+
|
|
128
|
+
const style = {
|
|
129
|
+
width: width ? `${width}%` : "100%",
|
|
130
|
+
backgroundColor: backdropColor || "rgba(0, 0, 0, 0.5)",
|
|
131
|
+
borderRadius: cornerRadius ? `${cornerRadius}px` : "0px",
|
|
132
|
+
border: "none",
|
|
133
|
+
position: uiTakeover ? "fixed" : "relative",
|
|
134
|
+
overflow: "hidden",
|
|
135
|
+
};
|
|
136
|
+
if (horizontalAlign === "left") {
|
|
137
|
+
style.left = horizontalInset ? `${horizontalInset}%` : "0";
|
|
138
|
+
} else if (horizontalAlign === "right") {
|
|
139
|
+
style.right = horizontalInset ? `${horizontalInset}%` : "0";
|
|
140
|
+
} else if (horizontalAlign === "center") {
|
|
141
|
+
style.left = "50%";
|
|
142
|
+
style.transform = "translateX(-50%)";
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (verticalAlign === "top") {
|
|
146
|
+
style.top = verticalInset ? `${verticalInset}%` : "0";
|
|
147
|
+
} else if (verticalAlign === "bottom") {
|
|
148
|
+
style.position = "fixed";
|
|
149
|
+
style.bottom = verticalInset ? `${verticalInset}%` : "0";
|
|
150
|
+
} else if (verticalAlign === "center") {
|
|
151
|
+
style.top = "50%";
|
|
152
|
+
style.transform = `${
|
|
153
|
+
horizontalAlign === "center" ? `${style.transform} ` : ""
|
|
154
|
+
}translateY(-50%)`;
|
|
155
|
+
style.display = "flex";
|
|
156
|
+
style.alignItems = "center";
|
|
157
|
+
style.justifyContent = "center";
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (height) {
|
|
161
|
+
style.height = `${height}vh`;
|
|
162
|
+
} else {
|
|
163
|
+
style.height = "100%";
|
|
164
|
+
}
|
|
165
|
+
return style;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
export const mobileOverlay = (mobileParameters) => {
|
|
169
|
+
const { backdropOpacity, backdropColor } = mobileParameters;
|
|
170
|
+
const opacity = backdropOpacity || 0.5;
|
|
171
|
+
const color = backdropColor || "#FFFFFF";
|
|
172
|
+
const style = {
|
|
173
|
+
position: "fixed",
|
|
174
|
+
top: "0",
|
|
175
|
+
left: "0",
|
|
176
|
+
width: "100%",
|
|
177
|
+
height: "100%",
|
|
178
|
+
background: "transparent",
|
|
179
|
+
opacity,
|
|
180
|
+
backgroundColor: color,
|
|
181
|
+
};
|
|
182
|
+
return style;
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
const REQUIRED_PARAMS = ["enabled", "parentElement", "insertionMethod"];
|
|
186
|
+
|
|
187
|
+
const isValidWebParameters = (webParameters) => {
|
|
188
|
+
if (!webParameters) {
|
|
189
|
+
return false;
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const ids = Object.keys(webParameters);
|
|
193
|
+
|
|
194
|
+
if (!ids.includes(MESSAGING_CONTAINER_ID)) {
|
|
195
|
+
return false;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
if (!ids.includes(OVERLAY_CONTAINER_ID)) {
|
|
199
|
+
return false;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const valuesArray = Object.values(webParameters);
|
|
203
|
+
|
|
204
|
+
for (let i = 0; i < valuesArray.length; i += 1) {
|
|
205
|
+
if (!objectOf(valuesArray[i], "style")) {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
if (!objectOf(valuesArray[i], "params")) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
for (let j = 0; j < REQUIRED_PARAMS.length; j += 1) {
|
|
214
|
+
if (!objectOf(valuesArray[i].params, REQUIRED_PARAMS[j])) {
|
|
215
|
+
return false;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return true;
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
const generateWebParameters = (mobileParameters) => {
|
|
224
|
+
if (!mobileParameters) {
|
|
225
|
+
return undefined;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
const { uiTakeover = false } = mobileParameters;
|
|
229
|
+
|
|
230
|
+
return {
|
|
231
|
+
[IFRAME_ID]: {
|
|
232
|
+
style: {
|
|
233
|
+
border: "none",
|
|
234
|
+
width: "100%",
|
|
235
|
+
height: "100%",
|
|
236
|
+
},
|
|
237
|
+
params: {
|
|
238
|
+
enabled: true,
|
|
239
|
+
parentElement: "#alloy-messaging-container",
|
|
240
|
+
insertionMethod: "appendChild",
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
[MESSAGING_CONTAINER_ID]: {
|
|
244
|
+
style: buildStyleFromMobileParameters(mobileParameters),
|
|
245
|
+
params: {
|
|
246
|
+
enabled: true,
|
|
247
|
+
parentElement: "body",
|
|
248
|
+
insertionMethod: "appendChild",
|
|
249
|
+
},
|
|
250
|
+
},
|
|
251
|
+
[OVERLAY_CONTAINER_ID]: {
|
|
252
|
+
style: mobileOverlay(mobileParameters),
|
|
253
|
+
params: {
|
|
254
|
+
enabled: uiTakeover === true,
|
|
255
|
+
parentElement: "body",
|
|
256
|
+
insertionMethod: "appendChild",
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// eslint-disable-next-line default-param-last
|
|
263
|
+
export const displayHTMLContentInIframe = (settings = {}, interact) => {
|
|
264
|
+
dismissMessage();
|
|
265
|
+
const { content, contentType, mobileParameters } = settings;
|
|
266
|
+
let { webParameters } = settings;
|
|
267
|
+
|
|
268
|
+
if (contentType !== TEXT_HTML) {
|
|
269
|
+
return;
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
const container = createNode("div", { id: MESSAGING_CONTAINER_ID });
|
|
273
|
+
const iframe = createIframe(content, createIframeClickHandler(interact));
|
|
274
|
+
const overlay = createNode("div", { id: OVERLAY_CONTAINER_ID });
|
|
275
|
+
|
|
276
|
+
if (!isValidWebParameters(webParameters)) {
|
|
277
|
+
webParameters = generateWebParameters(mobileParameters);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
if (!webParameters) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
renderMessage(iframe, webParameters, container, overlay);
|
|
285
|
+
};
|
|
286
|
+
|
|
287
|
+
export default (settings, collect) => {
|
|
288
|
+
return new Promise((resolve) => {
|
|
289
|
+
const { meta, identityMap } = settings;
|
|
290
|
+
displayHTMLContentInIframe(settings, (action, propositionAction) => {
|
|
291
|
+
const propositionEventTypes = {};
|
|
292
|
+
propositionEventTypes[PropositionEventType.INTERACT] = EVENT_TYPE_TRUE;
|
|
293
|
+
|
|
294
|
+
if (Object.values(PropositionEventType).indexOf(action) !== -1) {
|
|
295
|
+
propositionEventTypes[action] = EVENT_TYPE_TRUE;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
collect({
|
|
299
|
+
decisionsMeta: [meta],
|
|
300
|
+
propositionAction,
|
|
301
|
+
eventType: INTERACT,
|
|
302
|
+
propositionEventTypes: Object.keys(propositionEventTypes),
|
|
303
|
+
identityMap,
|
|
304
|
+
});
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
resolve({ meta });
|
|
308
|
+
});
|
|
309
|
+
};
|
package/src/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import displayIframeContent from "./actions/displayIframeContent.js";
|
|
13
|
+
|
|
14
|
+
export default (collect) => {
|
|
15
|
+
return {
|
|
16
|
+
defaultContent: (settings) => displayIframeContent(settings, collect),
|
|
17
|
+
};
|
|
18
|
+
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright 2023 Adobe. All rights reserved.
|
|
3
|
+
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
|
|
7
|
+
Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
import { isNonEmptyArray, queryString } from "@adobe/alloy-core/utils";
|
|
13
|
+
import { removeNode, selectNodes } from "@adobe/alloy-core/utils/dom";
|
|
14
|
+
import decodeUriComponentSafely from "@adobe/alloy-core/utils/decodeUriComponentSafely.js";
|
|
15
|
+
|
|
16
|
+
export const removeElementById = (id) => {
|
|
17
|
+
const element = selectNodes(`#${id}`, document);
|
|
18
|
+
if (element && element.length > 0) {
|
|
19
|
+
removeNode(element[0]);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
export const parseAnchor = (anchor) => {
|
|
23
|
+
const nothing = {};
|
|
24
|
+
|
|
25
|
+
if (!anchor || anchor.tagName.toLowerCase() !== "a") {
|
|
26
|
+
return nothing;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const { href } = anchor;
|
|
30
|
+
if (!href || !href.startsWith("adbinapp://")) {
|
|
31
|
+
return nothing;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const hrefParts = href.split("?");
|
|
35
|
+
|
|
36
|
+
const action = hrefParts[0].split("://")[1];
|
|
37
|
+
const label = anchor.innerText;
|
|
38
|
+
const uuid = anchor.getAttribute("data-uuid") || "";
|
|
39
|
+
|
|
40
|
+
let interaction;
|
|
41
|
+
let link;
|
|
42
|
+
|
|
43
|
+
if (isNonEmptyArray(hrefParts)) {
|
|
44
|
+
const queryParams = queryString.parse(hrefParts[1]);
|
|
45
|
+
interaction = queryParams.interaction || "";
|
|
46
|
+
link = decodeUriComponentSafely(queryParams.link || "");
|
|
47
|
+
}
|
|
48
|
+
return {
|
|
49
|
+
action,
|
|
50
|
+
interaction,
|
|
51
|
+
link,
|
|
52
|
+
label,
|
|
53
|
+
uuid,
|
|
54
|
+
};
|
|
55
|
+
};
|