@adobe/alloy 2.21.1 → 2.22.0-alpha.1
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/babel.config.cjs +0 -1
- package/libEs5/baseCode/index.js +3 -2
- package/libEs5/components/ActivityCollector/attachClickActivityCollector.js +23 -20
- package/libEs5/components/ActivityCollector/configValidators.js +2 -2
- package/libEs5/components/ActivityCollector/createClickActivityStorage.js +11 -9
- package/libEs5/components/ActivityCollector/createClickedElementProperties.js +39 -32
- package/libEs5/components/ActivityCollector/createGetClickedElementProperties.js +28 -20
- package/libEs5/components/ActivityCollector/createInjectClickedElementProperties.js +24 -21
- package/libEs5/components/ActivityCollector/createRecallAndInjectClickedElementProperties.js +10 -8
- package/libEs5/components/ActivityCollector/createStorePageViewProperties.js +6 -4
- package/libEs5/components/ActivityCollector/getLinkName.js +19 -18
- package/libEs5/components/ActivityCollector/getLinkRegion.js +10 -9
- package/libEs5/components/ActivityCollector/index.js +61 -45
- package/libEs5/components/ActivityCollector/utils/activityMapExtensionEnabled.js +3 -5
- package/libEs5/components/ActivityCollector/utils/createTransientStorage.js +7 -6
- package/libEs5/components/ActivityCollector/utils/determineLinkType.js +4 -3
- package/libEs5/components/ActivityCollector/utils/dom/elementHasClickHandler.js +3 -2
- package/libEs5/components/ActivityCollector/utils/dom/extractDomain.js +5 -4
- package/libEs5/components/ActivityCollector/utils/dom/findClickableElement.js +4 -3
- package/libEs5/components/ActivityCollector/utils/dom/getAbsoluteUrlFromAnchorElement.js +11 -8
- package/libEs5/components/ActivityCollector/utils/dom/isButtonSubmitElement.js +3 -2
- package/libEs5/components/ActivityCollector/utils/dom/isDownloadLink.js +6 -5
- package/libEs5/components/ActivityCollector/utils/dom/isExitLink.js +6 -5
- package/libEs5/components/ActivityCollector/utils/dom/isInputSubmitElement.js +4 -3
- package/libEs5/components/ActivityCollector/utils/dom/isSupportedAnchorElement.js +3 -2
- package/libEs5/components/ActivityCollector/utils/dom/isSupportedTextNode.js +4 -3
- package/libEs5/components/ActivityCollector/utils/hasPageName.js +4 -3
- package/libEs5/components/ActivityCollector/utils/isDifferentDomains.js +5 -4
- package/libEs5/components/ActivityCollector/utils/trimQueryFromUrl.js +5 -4
- package/libEs5/components/ActivityCollector/utils/truncateWhiteSpace.js +3 -2
- package/libEs5/components/ActivityCollector/utils/urlStartsWithScheme.js +3 -2
- package/libEs5/components/Audiences/index.js +13 -12
- package/libEs5/components/Audiences/injectProcessDestinations.js +32 -35
- package/libEs5/components/Audiences/injectProcessResponse.js +19 -16
- package/libEs5/components/Context/createComponent.js +10 -13
- package/libEs5/components/Context/implementationDetails.js +5 -4
- package/libEs5/components/Context/index.js +24 -28
- package/libEs5/components/Context/injectDevice.js +23 -15
- package/libEs5/components/Context/injectEnvironment.js +17 -12
- package/libEs5/components/Context/injectHighEntropyUserAgentHints.js +12 -21
- package/libEs5/components/Context/injectPlaceContext.js +8 -7
- package/libEs5/components/Context/injectTimestamp.js +6 -5
- package/libEs5/components/Context/injectWeb.js +6 -5
- package/libEs5/components/DataCollector/index.js +37 -38
- package/libEs5/components/DataCollector/validateApplyResponse.js +6 -4
- package/libEs5/components/DataCollector/validateUserEventOptions.js +6 -4
- package/libEs5/components/DecisioningEngine/consequenceAdapters/inAppMessageConsequenceAdapter.js +11 -8
- package/libEs5/components/DecisioningEngine/consequenceAdapters/schemaTypeConsequenceAdapter.js +10 -7
- package/libEs5/components/DecisioningEngine/constants.js +3 -3
- package/libEs5/components/DecisioningEngine/createApplyResponse.js +15 -15
- package/libEs5/components/DecisioningEngine/createConsequenceAdapter.js +17 -13
- package/libEs5/components/DecisioningEngine/createContextProvider.js +48 -44
- package/libEs5/components/DecisioningEngine/createDecisionHistory.js +7 -5
- package/libEs5/components/DecisioningEngine/createDecisionProvider.js +16 -21
- package/libEs5/components/DecisioningEngine/createEvaluableRulesetPayload.js +39 -37
- package/libEs5/components/DecisioningEngine/createEvaluateRulesetsCommand.js +21 -19
- package/libEs5/components/DecisioningEngine/createEventRegistry.js +63 -67
- package/libEs5/components/DecisioningEngine/createOnResponseHandler.js +23 -22
- package/libEs5/components/DecisioningEngine/createSubscribeRulesetItems.js +100 -55
- package/libEs5/components/DecisioningEngine/index.js +83 -54
- package/libEs5/components/DecisioningEngine/utils.js +43 -38
- package/libEs5/components/EventMerge/createComponent.js +5 -3
- package/libEs5/components/EventMerge/createEventMergeId.js +3 -2
- package/libEs5/components/EventMerge/index.js +1 -1
- package/libEs5/components/Identity/addEcidQueryToPayload.js +3 -2
- package/libEs5/components/Identity/addEcidToPayload.js +3 -2
- package/libEs5/components/Identity/appendIdentityToUrl/injectAppendIdentityToUrl.js +13 -23
- package/libEs5/components/Identity/configValidators.js +1 -1
- package/libEs5/components/Identity/constants/authState.js +3 -3
- package/libEs5/components/Identity/createComponent.js +39 -33
- package/libEs5/components/Identity/createLegacyIdentity.js +29 -29
- package/libEs5/components/Identity/getEcidFromResponse.js +5 -7
- package/libEs5/components/Identity/getIdentity/createGetIdentity.js +17 -15
- package/libEs5/components/Identity/getIdentity/createIdentityRequest.js +10 -8
- package/libEs5/components/Identity/getIdentity/createIdentityRequestPayload.js +5 -4
- package/libEs5/components/Identity/index.js +61 -62
- package/libEs5/components/Identity/injectAddLegacyEcidToPayload.js +8 -6
- package/libEs5/components/Identity/injectAddQueryStringIdentityToPayload.js +46 -52
- package/libEs5/components/Identity/injectAwaitIdentityCookie.js +14 -11
- package/libEs5/components/Identity/injectEnsureSingleIdentity.js +25 -24
- package/libEs5/components/Identity/injectHandleResponseForIdSyncs.js +6 -4
- package/libEs5/components/Identity/injectProcessIdSyncs.js +20 -22
- package/libEs5/components/Identity/injectSetDomainForInitialIdentityPayload.js +7 -5
- package/libEs5/components/Identity/visitorService/awaitVisitorOptIn.js +8 -6
- package/libEs5/components/Identity/visitorService/getVisitor.js +4 -3
- package/libEs5/components/Identity/visitorService/injectGetEcidFromVisitor.js +15 -13
- package/libEs5/components/LegacyMediaAnalytics/constants/constants.js +9 -9
- package/libEs5/components/LegacyMediaAnalytics/constants/mediaKeysToXdmConverter.js +2 -2
- package/libEs5/components/LegacyMediaAnalytics/createGetInstance.js +61 -63
- package/libEs5/components/LegacyMediaAnalytics/createLegacyMediaComponent.js +38 -37
- package/libEs5/components/LegacyMediaAnalytics/createMediaHelper.js +54 -52
- package/libEs5/components/LegacyMediaAnalytics/index.js +32 -33
- package/libEs5/components/LibraryInfo/index.js +23 -30
- package/libEs5/components/MachineLearning/index.js +1 -1
- package/libEs5/components/MachineLearning/processResponse.js +5 -3
- package/libEs5/components/Personalization/constants/loggerMessage.js +2 -2
- package/libEs5/components/Personalization/constants/scopeType.js +3 -3
- package/libEs5/components/Personalization/constants/surface.js +4 -4
- package/libEs5/components/Personalization/createActionsProvider.js +37 -32
- package/libEs5/components/Personalization/createApplyPropositions.js +71 -81
- package/libEs5/components/Personalization/createClickStorage.js +30 -32
- package/libEs5/components/Personalization/createComponent.js +65 -74
- package/libEs5/components/Personalization/createFetchDataHandler.js +83 -52
- package/libEs5/components/Personalization/createGetPageLocation.js +6 -6
- package/libEs5/components/Personalization/createHandleConsentFlicker.js +15 -14
- package/libEs5/components/Personalization/createInteractionStorage.js +25 -39
- package/libEs5/components/Personalization/createNotificationHandler.js +9 -10
- package/libEs5/components/Personalization/createOnClickHandler.js +29 -25
- package/libEs5/components/Personalization/createOnDecisionHandler.js +23 -21
- package/libEs5/components/Personalization/createPersonalizationDetails.js +39 -45
- package/libEs5/components/Personalization/createPreprocessors.js +7 -7
- package/libEs5/components/Personalization/createSetTargetMigration.js +6 -4
- package/libEs5/components/Personalization/createViewCacheManager.js +29 -32
- package/libEs5/components/Personalization/createViewChangeHandler.js +35 -20
- package/libEs5/components/Personalization/dom-actions/action.js +24 -25
- package/libEs5/components/Personalization/dom-actions/addNonceToInlineStyleElements.js +12 -13
- package/libEs5/components/Personalization/dom-actions/appendHtml.js +8 -7
- package/libEs5/components/Personalization/dom-actions/clicks/collectClicks.js +28 -33
- package/libEs5/components/Personalization/dom-actions/clicks/collectInteractions.js +37 -40
- package/libEs5/components/Personalization/dom-actions/collectInteractions.js +3 -2
- package/libEs5/components/Personalization/dom-actions/createPreprocess.js +10 -11
- package/libEs5/components/Personalization/dom-actions/createRedirect.js +11 -13
- package/libEs5/components/Personalization/dom-actions/dom/createFragment.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/getAttribute.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/getChildNodes.js +6 -3
- package/libEs5/components/Personalization/dom-actions/dom/getChildren.js +6 -3
- package/libEs5/components/Personalization/dom-actions/dom/getElementById.js +3 -3
- package/libEs5/components/Personalization/dom-actions/dom/getFirstChild.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/getNextSibling.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/getNonce.js +7 -6
- package/libEs5/components/Personalization/dom-actions/dom/getParent.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/helperForEq.js +7 -7
- package/libEs5/components/Personalization/dom-actions/dom/index.js +14 -14
- package/libEs5/components/Personalization/dom-actions/dom/insertAfter.js +4 -3
- package/libEs5/components/Personalization/dom-actions/dom/insertBefore.js +4 -3
- package/libEs5/components/Personalization/dom-actions/dom/isDomElement.js +2 -3
- package/libEs5/components/Personalization/dom-actions/dom/matchesSelectorWithEq.js +6 -5
- package/libEs5/components/Personalization/dom-actions/dom/removeAttribute.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/selectNodesWithEq.js +39 -38
- package/libEs5/components/Personalization/dom-actions/dom/setAttribute.js +3 -2
- package/libEs5/components/Personalization/dom-actions/dom/setStyle.js +4 -3
- package/libEs5/components/Personalization/dom-actions/images.js +10 -9
- package/libEs5/components/Personalization/dom-actions/index.js +1 -1
- package/libEs5/components/Personalization/dom-actions/initDomActionsModules.js +40 -25
- package/libEs5/components/Personalization/dom-actions/insertHtmlAfter.js +9 -8
- package/libEs5/components/Personalization/dom-actions/insertHtmlBefore.js +8 -7
- package/libEs5/components/Personalization/dom-actions/prependHtml.js +13 -10
- package/libEs5/components/Personalization/dom-actions/rearrangeChildren.js +9 -7
- package/libEs5/components/Personalization/dom-actions/remapCustomCodeOffers.js +14 -9
- package/libEs5/components/Personalization/dom-actions/remapHeadOffers.js +16 -14
- package/libEs5/components/Personalization/dom-actions/replaceHtml.js +4 -3
- package/libEs5/components/Personalization/dom-actions/scripts.js +58 -38
- package/libEs5/components/Personalization/dom-actions/setAttributes.js +4 -3
- package/libEs5/components/Personalization/dom-actions/setHtml.js +5 -4
- package/libEs5/components/Personalization/dom-actions/setStyles.js +8 -8
- package/libEs5/components/Personalization/dom-actions/setText.js +3 -2
- package/libEs5/components/Personalization/dom-actions/swapImage.js +3 -2
- package/libEs5/components/Personalization/flicker/index.js +66 -49
- package/libEs5/components/Personalization/handlers/createDecorateProposition.js +16 -13
- package/libEs5/components/Personalization/handlers/createProcessDomAction.js +45 -50
- package/libEs5/components/Personalization/handlers/createProcessHtmlContent.js +30 -29
- package/libEs5/components/Personalization/handlers/createProcessInAppMessage.js +35 -31
- package/libEs5/components/Personalization/handlers/createProcessPropositions.js +109 -105
- package/libEs5/components/Personalization/handlers/createProcessRedirect.js +38 -28
- package/libEs5/components/Personalization/handlers/injectCreateProposition.js +59 -67
- package/libEs5/components/Personalization/handlers/processDefaultContent.js +3 -2
- package/libEs5/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +140 -121
- package/libEs5/components/Personalization/in-app-message-actions/initInAppMessageActionsModules.js +4 -5
- package/libEs5/components/Personalization/in-app-message-actions/utils.js +23 -19
- package/libEs5/components/Personalization/index.js +120 -103
- package/libEs5/components/Personalization/utils/addRenderAttemptedToDecisions.js +10 -10
- package/libEs5/components/Personalization/utils/createAsyncArray.js +10 -9
- package/libEs5/components/Personalization/utils/isAuthoringModeEnabled.js +3 -3
- package/libEs5/components/Personalization/utils/metaUtils.js +14 -19
- package/libEs5/components/Personalization/utils/surfaceUtils.js +27 -46
- package/libEs5/components/Personalization/validateApplyPropositionsOptions.js +8 -6
- package/libEs5/components/Privacy/computeConsentHash.js +9 -9
- package/libEs5/components/Privacy/createComponent.js +32 -32
- package/libEs5/components/Privacy/createConsentHashStore.js +27 -24
- package/libEs5/components/Privacy/createConsentRequest.js +10 -8
- package/libEs5/components/Privacy/createConsentRequestPayload.js +9 -8
- package/libEs5/components/Privacy/createStoredConsent.js +11 -9
- package/libEs5/components/Privacy/index.js +26 -23
- package/libEs5/components/Privacy/injectSendSetConsentRequest.js +30 -29
- package/libEs5/components/Privacy/parseConsentCookie.js +6 -14
- package/libEs5/components/StreamingMedia/createMediaEventManager.js +59 -45
- package/libEs5/components/StreamingMedia/createMediaRequest.js +8 -6
- package/libEs5/components/StreamingMedia/createMediaResponseHandler.js +22 -17
- package/libEs5/components/StreamingMedia/createMediaSessionCacheManager.js +22 -18
- package/libEs5/components/StreamingMedia/createStreamingMediaComponent.js +30 -29
- package/libEs5/components/StreamingMedia/createTrackMediaEvent.js +41 -36
- package/libEs5/components/StreamingMedia/createTrackMediaSession.js +25 -22
- package/libEs5/components/StreamingMedia/index.js +33 -34
- package/libEs5/components/StreamingMedia/validateMediaEventOptions.js +9 -12
- package/libEs5/components/StreamingMedia/validateMediaSessionOptions.js +6 -4
- package/libEs5/constants/browser.js +7 -7
- package/libEs5/constants/consentPurpose.js +1 -1
- package/libEs5/constants/consentStatus.js +3 -3
- package/libEs5/constants/contentType.js +2 -2
- package/libEs5/constants/cookieNameKey.js +3 -3
- package/libEs5/constants/coreCommands.js +2 -2
- package/libEs5/constants/decisionProvider.js +4 -3
- package/libEs5/constants/domain.js +2 -2
- package/libEs5/constants/elementAttribute.js +1 -1
- package/libEs5/constants/eventType.js +5 -5
- package/libEs5/constants/handle.js +1 -1
- package/libEs5/constants/httpHeaderNames.js +2 -2
- package/libEs5/constants/httpStatusCode.js +5 -5
- package/libEs5/constants/identityMapAuthenticatedState.js +3 -3
- package/libEs5/constants/legacyCookies.js +3 -3
- package/libEs5/constants/libraryVersion.js +1 -1
- package/libEs5/constants/propositionEventType.js +18 -12
- package/libEs5/constants/propositionInteractionType.js +4 -4
- package/libEs5/constants/schema.js +11 -11
- package/libEs5/constants/sessionDataKeys.js +1 -1
- package/libEs5/constants/tagName.js +7 -7
- package/libEs5/core/buildAndValidateConfig.js +55 -69
- package/libEs5/core/componentCreators.js +70 -41
- package/libEs5/core/config/createConfig.js +4 -3
- package/libEs5/core/config/createCoreConfigs.js +11 -12
- package/libEs5/core/consent/createConsent.js +16 -14
- package/libEs5/core/consent/createConsentStateMachine.js +27 -35
- package/libEs5/core/createComponentRegistry.js +28 -27
- package/libEs5/core/createCookieTransfer.js +18 -18
- package/libEs5/core/createEvent.js +39 -44
- package/libEs5/core/createEventManager.js +64 -69
- package/libEs5/core/createInstanceFunction.js +4 -11
- package/libEs5/core/createLifecycle.js +14 -19
- package/libEs5/core/createLogController.js +30 -29
- package/libEs5/core/createLogger.js +41 -27
- package/libEs5/core/edgeNetwork/handleRequestFailure.js +6 -5
- package/libEs5/core/edgeNetwork/injectApplyResponse.js +29 -32
- package/libEs5/core/edgeNetwork/injectExtractEdgeInfo.js +19 -25
- package/libEs5/core/edgeNetwork/injectGetLocationHint.js +11 -11
- package/libEs5/core/edgeNetwork/injectProcessWarningsAndErrors.js +20 -16
- package/libEs5/core/edgeNetwork/injectSendEdgeNetworkRequest.js +42 -38
- package/libEs5/core/edgeNetwork/mergeLifecycleResponses.js +8 -12
- package/libEs5/core/index.js +137 -133
- package/libEs5/core/initializeComponents.js +17 -15
- package/libEs5/core/injectCreateResponse.js +47 -53
- package/libEs5/core/injectExecuteCommand.js +39 -40
- package/libEs5/core/injectHandleError.js +19 -19
- package/libEs5/core/injectShouldTransferCookie.js +12 -12
- package/libEs5/core/network/getRequestRetryDelay.js +20 -18
- package/libEs5/core/network/injectSendNetworkRequest.js +46 -49
- package/libEs5/core/network/isRequestRetryable.js +9 -8
- package/libEs5/core/network/requestMethods/injectSendBeaconRequest.js +10 -8
- package/libEs5/core/network/requestMethods/injectSendFetchRequest.js +18 -19
- package/libEs5/core/requiredComponentCreators.js +23 -0
- package/libEs5/core/validateCommandOptions.js +14 -11
- package/libEs5/index.js +43 -22
- package/libEs5/standalone.js +6 -1
- package/libEs5/utils/areThirdPartyCookiesSupportedByDefault.js +3 -5
- package/libEs5/utils/assignConcatArrayValues.js +9 -18
- package/libEs5/utils/clone.js +2 -3
- package/libEs5/utils/cookieJar.js +4 -4
- package/libEs5/utils/crc32.js +8 -8
- package/libEs5/utils/createCallbackAggregator.js +7 -11
- package/libEs5/utils/createCollect.js +52 -0
- package/libEs5/utils/createLoggingCookieJar.js +14 -16
- package/libEs5/utils/createMerger.js +9 -10
- package/libEs5/utils/createSubscription.js +48 -48
- package/libEs5/utils/createTaskQueue.js +8 -7
- package/libEs5/utils/deduplicateArray.js +7 -11
- package/libEs5/utils/deepAssign.js +7 -11
- package/libEs5/utils/defer.js +5 -4
- package/libEs5/utils/dom/appendNode.js +3 -2
- package/libEs5/utils/dom/awaitSelector.js +36 -34
- package/libEs5/utils/dom/createNode.js +10 -15
- package/libEs5/utils/dom/index.js +8 -8
- package/libEs5/utils/dom/isShadowSelector.js +2 -3
- package/libEs5/utils/dom/matchesSelector.js +3 -2
- package/libEs5/utils/dom/querySelectorAll.js +5 -13
- package/libEs5/utils/dom/removeNode.js +4 -3
- package/libEs5/utils/dom/selectNodes.js +3 -3
- package/libEs5/utils/dom/selectNodesWithShadow.js +14 -23
- package/libEs5/utils/event.js +49 -0
- package/libEs5/utils/filterObject.js +14 -12
- package/libEs5/utils/fireImage.js +10 -9
- package/libEs5/utils/flattenArray.js +4 -11
- package/libEs5/utils/flattenObject.js +8 -18
- package/libEs5/utils/getApexDomain.js +7 -6
- package/libEs5/utils/getBrowser.js +45 -12
- package/libEs5/utils/getLastArrayItems.js +2 -3
- package/libEs5/utils/getNamespacedCookieName.js +2 -3
- package/libEs5/utils/groupBy.js +6 -5
- package/libEs5/utils/index.js +50 -113
- package/libEs5/utils/injectDoesIdentityCookieExist.js +7 -7
- package/libEs5/utils/injectFireReferrerHideableImage.js +28 -34
- package/libEs5/utils/injectStorage.js +13 -15
- package/libEs5/utils/intersection.js +2 -6
- package/libEs5/utils/isBlankString.js +2 -3
- package/libEs5/utils/isBoolean.js +2 -3
- package/libEs5/utils/isEmptyObject.js +2 -3
- package/libEs5/utils/isFunction.js +2 -3
- package/libEs5/utils/isInteger.js +4 -3
- package/libEs5/utils/isNamespacedCookieName.js +2 -3
- package/libEs5/utils/isNil.js +2 -3
- package/libEs5/utils/isNonEmptyArray.js +2 -3
- package/libEs5/utils/isNonEmptyString.js +2 -3
- package/libEs5/utils/isNumber.js +2 -4
- package/libEs5/utils/isObject.js +3 -4
- package/libEs5/utils/isString.js +2 -3
- package/libEs5/utils/isUnique.js +6 -5
- package/libEs5/utils/isValidRegExp.js +3 -2
- package/libEs5/utils/memoize.js +7 -6
- package/libEs5/utils/noop.js +2 -1
- package/libEs5/utils/parseUrl.js +19 -25
- package/libEs5/utils/prepareConfigOverridesForEdge.js +6 -5
- package/libEs5/utils/request/createAddIdentity.js +4 -3
- package/libEs5/utils/request/createDataCollectionRequest.js +15 -11
- package/libEs5/utils/request/createDataCollectionRequestPayload.js +9 -10
- package/libEs5/utils/request/createGetAssuranceValidationTokenParams.js +17 -15
- package/libEs5/utils/request/createHasIdentity.js +4 -5
- package/libEs5/utils/request/createRequest.js +26 -23
- package/libEs5/utils/request/createRequestParams.js +13 -13
- package/libEs5/utils/request/createRequestPayload.js +13 -12
- package/libEs5/utils/request/index.js +8 -8
- package/libEs5/utils/sanitizeOrgIdForCookieName.js +2 -3
- package/libEs5/utils/stackError.js +8 -6
- package/libEs5/utils/stringToBoolean.js +3 -2
- package/libEs5/utils/toArray.js +3 -2
- package/libEs5/utils/toError.js +3 -2
- package/libEs5/utils/toISOStringLocal.js +29 -14
- package/libEs5/utils/toInteger.js +5 -5
- package/libEs5/utils/updateErrorMessage.js +6 -4
- package/libEs5/utils/validation/booleanValidator.js +3 -2
- package/libEs5/utils/validation/callbackValidator.js +3 -2
- package/libEs5/utils/validation/createAnyOfValidator.js +14 -17
- package/libEs5/utils/validation/createArrayOfValidator.js +16 -18
- package/libEs5/utils/validation/createDefaultValidator.js +7 -8
- package/libEs5/utils/validation/createDeprecatedValidator.js +12 -14
- package/libEs5/utils/validation/createLiteralValidator.js +5 -6
- package/libEs5/utils/validation/createMapOfValuesValidator.js +20 -22
- package/libEs5/utils/validation/createMaximumValidator.js +5 -6
- package/libEs5/utils/validation/createMinimumValidator.js +5 -6
- package/libEs5/utils/validation/createNoUnknownFieldsValidator.js +13 -14
- package/libEs5/utils/validation/createNonEmptyValidator.js +9 -10
- package/libEs5/utils/validation/createObjectOfValidator.js +27 -29
- package/libEs5/utils/validation/createRenamedValidator.js +24 -27
- package/libEs5/utils/validation/createUniqueItemsValidator.js +4 -3
- package/libEs5/utils/validation/createUniqueValidator.js +5 -4
- package/libEs5/utils/validation/domainValidator.js +4 -3
- package/libEs5/utils/validation/index.js +66 -72
- package/libEs5/utils/validation/integerValidator.js +3 -2
- package/libEs5/utils/validation/matchesRegexpValidator.js +5 -6
- package/libEs5/utils/validation/numberValidator.js +3 -2
- package/libEs5/utils/validation/regexpValidator.js +3 -2
- package/libEs5/utils/validation/requiredValidator.js +3 -2
- package/libEs5/utils/validation/stringValidator.js +3 -2
- package/libEs5/utils/validation/utils.js +29 -35
- package/libEs6/components/ActivityCollector/index.js +18 -8
- package/libEs6/components/Context/createComponent.js +1 -3
- package/libEs6/components/DecisioningEngine/createApplyResponse.js +1 -1
- package/libEs6/components/DecisioningEngine/createSubscribeRulesetItems.js +78 -28
- package/libEs6/components/DecisioningEngine/index.js +22 -2
- package/libEs6/components/DecisioningEngine/utils.js +2 -9
- package/libEs6/components/Identity/createComponent.js +4 -2
- package/libEs6/components/Identity/getEcidFromResponse.js +1 -3
- package/libEs6/components/LegacyMediaAnalytics/createGetInstance.js +2 -2
- package/libEs6/components/LibraryInfo/index.js +4 -5
- package/libEs6/components/Personalization/createActionsProvider.js +4 -2
- package/libEs6/components/Personalization/createComponent.js +2 -2
- package/libEs6/components/Personalization/createFetchDataHandler.js +35 -1
- package/libEs6/components/Personalization/createPersonalizationDetails.js +6 -6
- package/libEs6/components/Personalization/createViewCacheManager.js +5 -2
- package/libEs6/components/Personalization/createViewChangeHandler.js +11 -1
- package/libEs6/components/Personalization/dom-actions/createPreprocess.js +5 -2
- package/libEs6/components/Personalization/dom-actions/dom/selectNodesWithEq.js +1 -3
- package/libEs6/components/Personalization/dom-actions/remapCustomCodeOffers.js +6 -4
- package/libEs6/components/Personalization/dom-actions/remapHeadOffers.js +3 -2
- package/libEs6/components/Personalization/dom-actions/scripts.js +18 -2
- package/libEs6/components/Personalization/flicker/index.js +44 -30
- package/libEs6/components/Personalization/handlers/createDecorateProposition.js +2 -2
- package/libEs6/components/Personalization/handlers/createProcessPropositions.js +29 -9
- package/libEs6/components/Personalization/handlers/createProcessRedirect.js +9 -0
- package/libEs6/components/Personalization/handlers/injectCreateProposition.js +0 -3
- package/libEs6/components/Personalization/in-app-message-actions/actions/displayIframeContent.js +8 -5
- package/libEs6/components/Personalization/in-app-message-actions/utils.js +2 -2
- package/libEs6/components/Personalization/index.js +9 -5
- package/libEs6/components/Personalization/utils/addRenderAttemptedToDecisions.js +4 -4
- package/libEs6/components/Personalization/utils/surfaceUtils.js +3 -3
- package/libEs6/constants/decisionProvider.js +1 -0
- package/libEs6/constants/libraryVersion.js +1 -1
- package/libEs6/constants/schema.js +1 -1
- package/libEs6/core/buildAndValidateConfig.js +8 -5
- package/libEs6/core/componentCreators.js +14 -43
- package/libEs6/core/config/createConfig.js +3 -2
- package/libEs6/core/createCookieTransfer.js +1 -3
- package/libEs6/core/createInstanceFunction.js +1 -9
- package/libEs6/core/createLogger.js +17 -2
- package/libEs6/core/edgeNetwork/injectExtractEdgeInfo.js +1 -7
- package/libEs6/core/index.js +11 -10
- package/libEs6/core/injectCreateResponse.js +1 -3
- package/libEs6/core/network/isRequestRetryable.js +1 -2
- package/libEs6/core/network/requestMethods/injectSendFetchRequest.js +1 -2
- package/libEs6/{utils/assignIf.js → core/requiredComponentCreators.js} +4 -8
- package/libEs6/index.js +26 -6
- package/libEs6/standalone.js +7 -1
- package/libEs6/utils/areThirdPartyCookiesSupportedByDefault.js +1 -2
- package/libEs6/utils/assignConcatArrayValues.js +1 -2
- package/libEs6/utils/cookieJar.js +4 -4
- package/libEs6/{components/Personalization → utils}/createCollect.js +3 -3
- package/libEs6/utils/createSubscription.js +20 -3
- package/libEs6/utils/dom/querySelectorAll.js +1 -10
- package/libEs6/utils/dom/selectNodesWithShadow.js +2 -12
- package/libEs6/{components/Personalization → utils}/event.js +1 -1
- package/libEs6/utils/index.js +1 -10
- package/libEs6/utils/injectStorage.js +1 -2
- package/libEs6/utils/intersection.js +1 -4
- package/libEs6/utils/isNumber.js +1 -2
- package/libEs6/utils/toISOStringLocal.js +14 -1
- package/libEs6/utils/toInteger.js +1 -2
- package/libEs6/utils/validation/createAnyOfValidator.js +1 -2
- package/libEs6/utils/validation/utils.js +3 -6
- package/package.json +35 -37
- package/rollup.config.js +115 -7
- package/scripts/alloyBuilder.js +89 -55
- package/scripts/helpers/entryPointGeneratorBabelPlugin.js +39 -0
- package/libEs5/components/Personalization/createCollect.js +0 -53
- package/libEs5/components/Personalization/event.js +0 -49
- package/libEs5/core/network/requestMethods/injectSendXhrRequest.js +0 -50
- package/libEs5/utils/assign.js +0 -16
- package/libEs5/utils/assignIf.js +0 -21
- package/libEs5/utils/endsWith.js +0 -23
- package/libEs5/utils/find.js +0 -30
- package/libEs5/utils/flatMap.js +0 -17
- package/libEs5/utils/includes.js +0 -23
- package/libEs5/utils/padStart.js +0 -27
- package/libEs5/utils/startsWith.js +0 -23
- package/libEs5/utils/values.js +0 -25
- package/libEs6/core/network/requestMethods/injectSendXhrRequest.js +0 -49
- package/libEs6/utils/assign.js +0 -14
- package/libEs6/utils/endsWith.js +0 -19
- package/libEs6/utils/find.js +0 -28
- package/libEs6/utils/flatMap.js +0 -14
- package/libEs6/utils/includes.js +0 -21
- package/libEs6/utils/padStart.js +0 -25
- package/libEs6/utils/startsWith.js +0 -19
- package/libEs6/utils/values.js +0 -21
- package/scripts/helpers/alloyComponents.js +0 -63
- package/scripts/helpers/conditionalBuildBabelPlugin.js +0 -57
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
exports.reverseNullSafeChainJoinErrors = exports.nullSafeChain = exports.chain = exports.assertValid = void 0;
|
|
4
|
-
var _assign = require("../assign.js");
|
|
5
4
|
/*
|
|
6
5
|
Copyright 2023 Adobe. All rights reserved.
|
|
7
6
|
This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
@@ -14,18 +13,14 @@ OF ANY KIND, either express or implied. See the License for the specific languag
|
|
|
14
13
|
governing permissions and limitations under the License.
|
|
15
14
|
*/
|
|
16
15
|
|
|
17
|
-
// This is used to add methods onto a function.
|
|
18
|
-
|
|
19
16
|
/**
|
|
20
17
|
* Wraps a validator returning the value if it is null or undefined, otherwise
|
|
21
18
|
* it will call the original validator and return the result.
|
|
22
19
|
*
|
|
23
20
|
* @param {function} validator - the validator to call if the value is not null
|
|
24
21
|
*/
|
|
25
|
-
|
|
26
|
-
return
|
|
27
|
-
return value == null ? value : validator.call(this, value, path);
|
|
28
|
-
};
|
|
22
|
+
const skipIfNull = validator => function skipIfNullValidator(value, path) {
|
|
23
|
+
return value == null ? value : validator.call(this, value, path);
|
|
29
24
|
};
|
|
30
25
|
|
|
31
26
|
/**
|
|
@@ -37,10 +32,8 @@ var skipIfNull = function skipIfNull(validator) {
|
|
|
37
32
|
* @param {function} secondValidator - validator to call second
|
|
38
33
|
* @returns {function} - a new validator that calls the first and second validators
|
|
39
34
|
*/
|
|
40
|
-
|
|
41
|
-
return
|
|
42
|
-
return secondValidator.call(this, firstValidator.call(this, value, path), path);
|
|
43
|
-
};
|
|
35
|
+
const callSequentially = (firstValidator, secondValidator) => function callSequentiallyValidator(value, path) {
|
|
36
|
+
return secondValidator.call(this, firstValidator.call(this, value, path), path);
|
|
44
37
|
};
|
|
45
38
|
|
|
46
39
|
/**
|
|
@@ -51,23 +44,20 @@ var callSequentially = function callSequentially(firstValidator, secondValidator
|
|
|
51
44
|
* @param {function} secondValidator
|
|
52
45
|
* @returns {function}
|
|
53
46
|
*/
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
errors.push(e);
|
|
63
|
-
return memo;
|
|
64
|
-
}
|
|
65
|
-
}, value);
|
|
66
|
-
if (errors.length) {
|
|
67
|
-
throw new Error(errors.join("\n"));
|
|
47
|
+
const callSequentiallyJoinErrors = (firstValidator, secondValidator) => function callSequentiallyJoinErrorsValidator(value, path) {
|
|
48
|
+
const errors = [];
|
|
49
|
+
const newValue = [firstValidator, secondValidator].reduce((memo, validator) => {
|
|
50
|
+
try {
|
|
51
|
+
return validator.call(this, memo, path);
|
|
52
|
+
} catch (e) {
|
|
53
|
+
errors.push(e);
|
|
54
|
+
return memo;
|
|
68
55
|
}
|
|
69
|
-
|
|
70
|
-
|
|
56
|
+
}, value);
|
|
57
|
+
if (errors.length) {
|
|
58
|
+
throw new Error(errors.join("\n"));
|
|
59
|
+
}
|
|
60
|
+
return newValue;
|
|
71
61
|
};
|
|
72
62
|
|
|
73
63
|
/**
|
|
@@ -82,8 +72,8 @@ var callSequentiallyJoinErrors = function callSequentiallyJoinErrors(firstValida
|
|
|
82
72
|
* validator.
|
|
83
73
|
* @returns {function}
|
|
84
74
|
*/
|
|
85
|
-
|
|
86
|
-
return
|
|
75
|
+
const chain = (baseValidator, newValidator, additionalMethods) => {
|
|
76
|
+
return Object.assign(callSequentially(baseValidator, newValidator), baseValidator, additionalMethods);
|
|
87
77
|
};
|
|
88
78
|
|
|
89
79
|
/**
|
|
@@ -101,8 +91,9 @@ var chain = exports.chain = function chain(baseValidator, newValidator, addition
|
|
|
101
91
|
* validator.
|
|
102
92
|
* @returns {function}
|
|
103
93
|
*/
|
|
104
|
-
|
|
105
|
-
|
|
94
|
+
exports.chain = chain;
|
|
95
|
+
const nullSafeChain = (baseValidator, newValidator, additionalMethods) => {
|
|
96
|
+
return Object.assign(callSequentially(baseValidator, skipIfNull(newValidator)), baseValidator, additionalMethods);
|
|
106
97
|
};
|
|
107
98
|
|
|
108
99
|
/**
|
|
@@ -116,8 +107,9 @@ var nullSafeChain = exports.nullSafeChain = function nullSafeChain(baseValidator
|
|
|
116
107
|
* validator.
|
|
117
108
|
* @returns {function}
|
|
118
109
|
*/
|
|
119
|
-
|
|
120
|
-
|
|
110
|
+
exports.nullSafeChain = nullSafeChain;
|
|
111
|
+
const reverseNullSafeChainJoinErrors = (baseValidator, newValidator, additionalMethods) => {
|
|
112
|
+
return Object.assign(callSequentiallyJoinErrors(skipIfNull(newValidator), baseValidator), baseValidator, additionalMethods);
|
|
121
113
|
};
|
|
122
114
|
|
|
123
115
|
/**
|
|
@@ -130,8 +122,10 @@ var reverseNullSafeChainJoinErrors = exports.reverseNullSafeChainJoinErrors = fu
|
|
|
130
122
|
* @throws {Error} - Throws an error if the value is not valid.
|
|
131
123
|
* @returns {void}
|
|
132
124
|
*/
|
|
133
|
-
|
|
125
|
+
exports.reverseNullSafeChainJoinErrors = reverseNullSafeChainJoinErrors;
|
|
126
|
+
const assertValid = (isValid, value, path, message) => {
|
|
134
127
|
if (!isValid) {
|
|
135
128
|
throw new Error("'" + path + "': Expected " + message + ", but got " + JSON.stringify(value) + ".");
|
|
136
129
|
}
|
|
137
|
-
};
|
|
130
|
+
};
|
|
131
|
+
exports.assertValid = assertValid;
|
|
@@ -34,6 +34,18 @@ const getClickedElementProperties = createGetClickedElementProperties({
|
|
|
34
34
|
determineLinkType
|
|
35
35
|
});
|
|
36
36
|
let clickActivityStorage;
|
|
37
|
+
const initClickActivityStorage = config => {
|
|
38
|
+
if (!clickActivityStorage) {
|
|
39
|
+
const createNamespacedStorage = injectStorage(window);
|
|
40
|
+
const nameSpacedStorage = createNamespacedStorage(config.orgId || "");
|
|
41
|
+
// Use transient in-memory if sessionStorage is disabled
|
|
42
|
+
const transientStorage = createTransientStorage();
|
|
43
|
+
const storage = config.clickCollection.sessionStorageEnabled ? nameSpacedStorage.session : transientStorage;
|
|
44
|
+
clickActivityStorage = createClickActivityStorage({
|
|
45
|
+
storage
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
};
|
|
37
49
|
const createActivityCollector = ({
|
|
38
50
|
config,
|
|
39
51
|
eventManager,
|
|
@@ -41,14 +53,9 @@ const createActivityCollector = ({
|
|
|
41
53
|
logger
|
|
42
54
|
}) => {
|
|
43
55
|
const clickCollection = config.clickCollection;
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const transientStorage = createTransientStorage();
|
|
48
|
-
const storage = clickCollection.sessionStorageEnabled ? nameSpacedStorage.session : transientStorage;
|
|
49
|
-
clickActivityStorage = createClickActivityStorage({
|
|
50
|
-
storage
|
|
51
|
-
});
|
|
56
|
+
if (!clickActivityStorage) {
|
|
57
|
+
initClickActivityStorage(config);
|
|
58
|
+
}
|
|
52
59
|
const injectClickedElementProperties = createInjectClickedElementProperties({
|
|
53
60
|
config,
|
|
54
61
|
logger,
|
|
@@ -102,6 +109,9 @@ createActivityCollector.buildOnInstanceConfiguredExtraParams = ({
|
|
|
102
109
|
config,
|
|
103
110
|
logger
|
|
104
111
|
}) => {
|
|
112
|
+
if (!clickActivityStorage) {
|
|
113
|
+
initClickActivityStorage(config);
|
|
114
|
+
}
|
|
105
115
|
return {
|
|
106
116
|
getLinkDetails: targetElement => {
|
|
107
117
|
return getClickedElementProperties({
|
|
@@ -9,11 +9,9 @@ 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
|
-
import { flatMap } from "../../utils/index.js";
|
|
14
12
|
export default ((config, logger, optionalContexts, requiredContexts) => {
|
|
15
13
|
const configuredContexts = config.context;
|
|
16
|
-
const contexts = flatMap(
|
|
14
|
+
const contexts = configuredContexts.flatMap((context, i) => {
|
|
17
15
|
if (optionalContexts[context]) {
|
|
18
16
|
return [optionalContexts[context]];
|
|
19
17
|
}
|
|
@@ -11,7 +11,7 @@ governing permissions and limitations under the License.
|
|
|
11
11
|
*/
|
|
12
12
|
import { arrayOf, callback as callbackType, objectOf, string } from "../../utils/validation/index.js";
|
|
13
13
|
import createSubscription from "../../utils/createSubscription.js";
|
|
14
|
-
import {
|
|
14
|
+
import { getEventType, PropositionEventType } from "../../constants/propositionEventType.js";
|
|
15
15
|
const validateOptions = ({
|
|
16
16
|
options
|
|
17
17
|
}) => {
|
|
@@ -22,40 +22,86 @@ const validateOptions = ({
|
|
|
22
22
|
}).noUnknownFields();
|
|
23
23
|
return validator(options);
|
|
24
24
|
};
|
|
25
|
-
const
|
|
25
|
+
const getAnalyticsDetail = proposition => {
|
|
26
26
|
const {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
return {
|
|
36
|
-
...payload,
|
|
37
|
-
items: items.filter(item => schemasFilter ? includes(schemasFilter, item.schema) : true)
|
|
38
|
-
};
|
|
39
|
-
}).filter(payload => payload.items.length > 0)
|
|
27
|
+
id,
|
|
28
|
+
scope,
|
|
29
|
+
scopeDetails
|
|
30
|
+
} = proposition;
|
|
31
|
+
return {
|
|
32
|
+
id,
|
|
33
|
+
scope,
|
|
34
|
+
scopeDetails
|
|
40
35
|
};
|
|
41
|
-
return [result];
|
|
42
|
-
};
|
|
43
|
-
const emissionCondition = (params, result) => {
|
|
44
|
-
return result.propositions.length > 0;
|
|
45
36
|
};
|
|
46
|
-
export default ((
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
37
|
+
export default (({
|
|
38
|
+
collect
|
|
39
|
+
}) => {
|
|
40
|
+
let emitPropositions = () => undefined;
|
|
41
|
+
const collectedEventsThisSession = new Set();
|
|
42
|
+
const shouldAlwaysCollect = propositionEventType => [PropositionEventType.INTERACT, PropositionEventType.DISMISS].includes(propositionEventType);
|
|
43
|
+
const shouldCollect = (propositionEventType, analyticsMetaId, collectedEventsThisRequest) => {
|
|
44
|
+
const eventId = [propositionEventType, analyticsMetaId].join("-");
|
|
45
|
+
const result = !collectedEventsThisRequest.has(eventId) && (shouldAlwaysCollect(propositionEventType) || !collectedEventsThisSession.has(eventId));
|
|
46
|
+
collectedEventsThisRequest.add(eventId);
|
|
47
|
+
collectedEventsThisSession.add(eventId);
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
const collectEvent = (propositionEventType, propositions = []) => {
|
|
51
|
+
if (!(propositions instanceof Array)) {
|
|
52
|
+
return Promise.resolve();
|
|
53
|
+
}
|
|
54
|
+
if (!Object.values(PropositionEventType).includes(propositionEventType)) {
|
|
55
|
+
return Promise.resolve();
|
|
56
|
+
}
|
|
57
|
+
const decisionsMeta = [];
|
|
58
|
+
const collectedEventsThisRequest = new Set();
|
|
59
|
+
propositions.forEach(proposition => {
|
|
60
|
+
const analyticsMeta = getAnalyticsDetail(proposition);
|
|
61
|
+
if (!shouldCollect(propositionEventType, analyticsMeta.id, collectedEventsThisRequest)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
decisionsMeta.push(analyticsMeta);
|
|
65
|
+
});
|
|
66
|
+
return decisionsMeta.length > 0 ? collect({
|
|
67
|
+
decisionsMeta,
|
|
68
|
+
eventType: getEventType(propositionEventType),
|
|
69
|
+
documentMayUnload: true
|
|
70
|
+
}) : Promise.resolve();
|
|
71
|
+
};
|
|
72
|
+
const subscriptions = createSubscription();
|
|
73
|
+
const emissionPreprocessor = (params, propositions) => {
|
|
74
|
+
const {
|
|
75
|
+
surfacesFilter,
|
|
76
|
+
schemasFilter
|
|
77
|
+
} = params;
|
|
78
|
+
const result = {
|
|
79
|
+
propositions: propositions.filter(payload => surfacesFilter ? surfacesFilter.includes(payload.scope) : true).map(payload => {
|
|
80
|
+
const {
|
|
81
|
+
items = []
|
|
82
|
+
} = payload;
|
|
83
|
+
return {
|
|
84
|
+
...payload,
|
|
85
|
+
items: items.filter(item => schemasFilter ? schemasFilter.includes(item.schema) : true)
|
|
86
|
+
};
|
|
87
|
+
}).filter(payload => payload.items.length > 0)
|
|
88
|
+
};
|
|
89
|
+
return [result, collectEvent];
|
|
90
|
+
};
|
|
91
|
+
subscriptions.setEmissionPreprocessor(emissionPreprocessor);
|
|
50
92
|
const run = ({
|
|
51
93
|
surfaces,
|
|
52
94
|
schemas,
|
|
53
95
|
callback
|
|
54
96
|
}) => {
|
|
55
|
-
const
|
|
97
|
+
const {
|
|
98
|
+
id,
|
|
99
|
+
unsubscribe
|
|
100
|
+
} = subscriptions.add(callback, {
|
|
56
101
|
surfacesFilter: surfaces instanceof Array ? surfaces : undefined,
|
|
57
102
|
schemasFilter: schemas instanceof Array ? schemas : undefined
|
|
58
103
|
});
|
|
104
|
+
emitPropositions(id);
|
|
59
105
|
return Promise.resolve({
|
|
60
106
|
unsubscribe
|
|
61
107
|
});
|
|
@@ -64,10 +110,14 @@ export default (() => {
|
|
|
64
110
|
options
|
|
65
111
|
});
|
|
66
112
|
const refresh = propositions => {
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
113
|
+
emitPropositions = subscriptionId => {
|
|
114
|
+
if (subscriptionId) {
|
|
115
|
+
subscriptions.emitOne(subscriptionId, propositions);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
subscriptions.emit(propositions);
|
|
119
|
+
};
|
|
120
|
+
emitPropositions();
|
|
71
121
|
};
|
|
72
122
|
return {
|
|
73
123
|
refresh,
|
|
@@ -20,8 +20,11 @@ import { CONTEXT_KEY, CONTEXT_EVENT_SOURCE, CONTEXT_EVENT_TYPE } from "./constan
|
|
|
20
20
|
import createEvaluateRulesetsCommand from "./createEvaluateRulesetsCommand.js";
|
|
21
21
|
import { clearLocalStorage, createInMemoryStorage } from "./utils.js";
|
|
22
22
|
import { objectOf, boolean } from "../../utils/validation/index.js";
|
|
23
|
+
import createCollect from "../../utils/createCollect.js";
|
|
24
|
+
import { mergeDecisionsMeta } from "../../utils/event.js";
|
|
23
25
|
const createDecisioningEngine = ({
|
|
24
26
|
config,
|
|
27
|
+
eventManager,
|
|
25
28
|
createNamespacedStorage,
|
|
26
29
|
consent
|
|
27
30
|
}) => {
|
|
@@ -29,6 +32,10 @@ const createDecisioningEngine = ({
|
|
|
29
32
|
orgId,
|
|
30
33
|
personalizationStorageEnabled
|
|
31
34
|
} = config;
|
|
35
|
+
const collect = createCollect({
|
|
36
|
+
eventManager,
|
|
37
|
+
mergeDecisionsMeta
|
|
38
|
+
});
|
|
32
39
|
const storage = createNamespacedStorage(`${sanitizeOrgIdForCookieName(orgId)}.decisioning.`);
|
|
33
40
|
if (!personalizationStorageEnabled) {
|
|
34
41
|
clearLocalStorage(storage.persistent);
|
|
@@ -47,7 +54,9 @@ const createDecisioningEngine = ({
|
|
|
47
54
|
contextProvider,
|
|
48
55
|
decisionProvider
|
|
49
56
|
});
|
|
50
|
-
const subscribeRulesetItems = createSubscribeRulesetItems(
|
|
57
|
+
const subscribeRulesetItems = createSubscribeRulesetItems({
|
|
58
|
+
collect
|
|
59
|
+
});
|
|
51
60
|
let applyResponse;
|
|
52
61
|
return {
|
|
53
62
|
lifecycle: {
|
|
@@ -89,7 +98,18 @@ const createDecisioningEngine = ({
|
|
|
89
98
|
...decisionContext
|
|
90
99
|
})
|
|
91
100
|
}));
|
|
92
|
-
|
|
101
|
+
},
|
|
102
|
+
onBeforeRequest({
|
|
103
|
+
request
|
|
104
|
+
}) {
|
|
105
|
+
const payload = request.getPayload().toJSON();
|
|
106
|
+
const {
|
|
107
|
+
events = []
|
|
108
|
+
} = payload;
|
|
109
|
+
if (events.length === 0) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
events.forEach(event => eventRegistry.addExperienceEdgeEvent(event));
|
|
93
113
|
}
|
|
94
114
|
},
|
|
95
115
|
commands: {
|
|
@@ -59,18 +59,11 @@ export const createInMemoryStorage = () => {
|
|
|
59
59
|
export const clearLocalStorage = storage => {
|
|
60
60
|
storage.clear();
|
|
61
61
|
};
|
|
62
|
-
export const hasExperienceData = xdm => {
|
|
62
|
+
export const hasExperienceData = (xdm = {}) => {
|
|
63
63
|
const {
|
|
64
|
-
eventType = "",
|
|
65
64
|
_experience
|
|
66
65
|
} = xdm;
|
|
67
|
-
|
|
68
|
-
return false;
|
|
69
|
-
}
|
|
70
|
-
if (!_experience || typeof _experience !== "object") {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
return true;
|
|
66
|
+
return !(!_experience || typeof _experience !== "object");
|
|
74
67
|
};
|
|
75
68
|
export const getDecisionProvider = proposition => {
|
|
76
69
|
const {
|
|
@@ -9,7 +9,6 @@ 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
|
-
import { assign } from "../../utils/index.js";
|
|
13
12
|
import getIdentityOptionsValidator from "./getIdentity/getIdentityOptionsValidator.js";
|
|
14
13
|
import appendIdentityToUrlOptionsValidator from "./appendIdentityToUrl/appendIdentityToUrlOptionsValidator.js";
|
|
15
14
|
export default (({
|
|
@@ -57,7 +56,10 @@ export default (({
|
|
|
57
56
|
}
|
|
58
57
|
// For sendBeacon requests, getEdge() will return {}, so we are using assign here
|
|
59
58
|
// so that sendBeacon requests don't override the edge info from before.
|
|
60
|
-
edge =
|
|
59
|
+
edge = {
|
|
60
|
+
...edge,
|
|
61
|
+
...response.getEdge()
|
|
62
|
+
};
|
|
61
63
|
return handleResponseForIdSyncs(response);
|
|
62
64
|
}
|
|
63
65
|
},
|
|
@@ -9,11 +9,9 @@ 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
|
-
import { find } from "../../utils/index.js";
|
|
14
12
|
import ecidNamespace from "../../constants/ecidNamespace.js";
|
|
15
13
|
export default (response => {
|
|
16
14
|
const identityResultPayloads = response.getPayloadsByType("identity:result");
|
|
17
|
-
const ecidPayload = find(
|
|
15
|
+
const ecidPayload = identityResultPayloads.find(payload => payload.namespace && payload.namespace.code === ecidNamespace);
|
|
18
16
|
return ecidPayload ? ecidPayload.id : undefined;
|
|
19
17
|
});
|
|
@@ -10,7 +10,7 @@ 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
|
import { EVENT, MEDIA_EVENTS_INTERNAL } from "./constants/constants.js";
|
|
13
|
-
import {
|
|
13
|
+
import { isEmptyObject, isNil, isNonEmptyArray, isNumber } from "../../utils/index.js";
|
|
14
14
|
import { adsToXdmKeys, mediaToXdmKeys } from "./constants/mediaKeysToXdmConverter.js";
|
|
15
15
|
export default (({
|
|
16
16
|
logger,
|
|
@@ -198,7 +198,7 @@ export default (({
|
|
|
198
198
|
logger.warn("The Media Session was completed.");
|
|
199
199
|
return {};
|
|
200
200
|
}
|
|
201
|
-
if (!
|
|
201
|
+
if (!Object.values(EVENT).includes(eventType)) {
|
|
202
202
|
logger.warn("Invalid event type");
|
|
203
203
|
return {};
|
|
204
204
|
}
|
|
@@ -39,16 +39,15 @@ const createLibraryInfo = ({
|
|
|
39
39
|
config,
|
|
40
40
|
componentRegistry
|
|
41
41
|
}) => {
|
|
42
|
-
const libraryInfo = prepareLibraryInfo({
|
|
43
|
-
config,
|
|
44
|
-
componentRegistry
|
|
45
|
-
});
|
|
46
42
|
return {
|
|
47
43
|
commands: {
|
|
48
44
|
getLibraryInfo: {
|
|
49
45
|
run: () => {
|
|
50
46
|
return {
|
|
51
|
-
libraryInfo
|
|
47
|
+
libraryInfo: prepareLibraryInfo({
|
|
48
|
+
config,
|
|
49
|
+
componentRegistry
|
|
50
|
+
})
|
|
52
51
|
};
|
|
53
52
|
}
|
|
54
53
|
}
|
|
@@ -10,7 +10,6 @@ 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
|
import createPreprocessors from "./createPreprocessors.js";
|
|
13
|
-
import { assign } from "../../utils/index.js";
|
|
14
13
|
export default (({
|
|
15
14
|
modules,
|
|
16
15
|
preprocessors = createPreprocessors(),
|
|
@@ -47,7 +46,10 @@ export default (({
|
|
|
47
46
|
if (!schema || !(preprocessorsList instanceof Array) || preprocessorsList.length === 0) {
|
|
48
47
|
return action;
|
|
49
48
|
}
|
|
50
|
-
return preprocessorsList.reduce((processed, fn) =>
|
|
49
|
+
return preprocessorsList.reduce((processed, fn) => ({
|
|
50
|
+
...processed,
|
|
51
|
+
...fn(processed)
|
|
52
|
+
}), action);
|
|
51
53
|
};
|
|
52
54
|
const executeAction = action => {
|
|
53
55
|
const processedAction = applyPreprocessors(action);
|
|
@@ -10,7 +10,7 @@ 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 { noop,
|
|
13
|
+
import { noop, isNonEmptyArray } from "../../utils/index.js";
|
|
14
14
|
import createPersonalizationDetails from "./createPersonalizationDetails.js";
|
|
15
15
|
import { AUTHORING_ENABLED } from "./constants/loggerMessage.js";
|
|
16
16
|
import { PropositionEventType } from "../../constants/propositionEventType.js";
|
|
@@ -104,7 +104,7 @@ export default (({
|
|
|
104
104
|
return Promise.all(decisionsMetaPromises).then(decisionsMetas => {
|
|
105
105
|
// We only want to call mergeDecisionsMeta once, but we can get the propositions
|
|
106
106
|
// from two places: the pending display notifications and the view change handler.
|
|
107
|
-
const decisionsMeta = flatMap(
|
|
107
|
+
const decisionsMeta = decisionsMetas.flatMap(dms => dms);
|
|
108
108
|
if (isNonEmptyArray(decisionsMeta)) {
|
|
109
109
|
mergeDecisionsMeta(event, decisionsMeta, [PropositionEventType.DISPLAY]);
|
|
110
110
|
}
|
|
@@ -9,9 +9,11 @@ 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
|
-
import { groupBy } from "../../utils/index.js";
|
|
12
|
+
import { groupBy, isNonEmptyArray } from "../../utils/index.js";
|
|
13
|
+
import PAGE_WIDE_SCOPE from "../../constants/pageWideScope.js";
|
|
13
14
|
const DECISIONS_HANDLE = "personalization:decisions";
|
|
14
15
|
export default (({
|
|
16
|
+
logger,
|
|
15
17
|
prehidingStyle,
|
|
16
18
|
showContainers,
|
|
17
19
|
hideContainers,
|
|
@@ -47,6 +49,16 @@ export default (({
|
|
|
47
49
|
response
|
|
48
50
|
}) => {
|
|
49
51
|
const handles = response.getPayloadsByType(DECISIONS_HANDLE);
|
|
52
|
+
if (!isNonEmptyArray(handles)) {
|
|
53
|
+
logger.logOnContentRendering({
|
|
54
|
+
status: "no-offers",
|
|
55
|
+
message: "No offers were returned.",
|
|
56
|
+
logLevel: "info",
|
|
57
|
+
detail: {
|
|
58
|
+
query: personalizationDetails.createQueryDetails()
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
50
62
|
const propositions = handles.map(handle => createProposition(handle));
|
|
51
63
|
const {
|
|
52
64
|
page: pagePropositions = [],
|
|
@@ -63,6 +75,28 @@ export default (({
|
|
|
63
75
|
returnedPropositions,
|
|
64
76
|
returnedDecisions
|
|
65
77
|
} = processPropositions([...pagePropositions, ...currentViewPropositions], nonRenderedPropositions));
|
|
78
|
+
if (isNonEmptyArray(pagePropositions)) {
|
|
79
|
+
logger.logOnContentRendering({
|
|
80
|
+
status: "rendering-started",
|
|
81
|
+
message: "Started rendering propositions for page-wide scope.",
|
|
82
|
+
logLevel: "info",
|
|
83
|
+
detail: {
|
|
84
|
+
scope: PAGE_WIDE_SCOPE,
|
|
85
|
+
propositions: pagePropositions.map(proposition => proposition.toJSON())
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
if (isNonEmptyArray(currentViewPropositions)) {
|
|
90
|
+
logger.logOnContentRendering({
|
|
91
|
+
status: "rendering-started",
|
|
92
|
+
message: `Rendering propositions started for view scope - ${personalizationDetails.getViewName()}.`,
|
|
93
|
+
logLevel: "info",
|
|
94
|
+
detail: {
|
|
95
|
+
scope: personalizationDetails.getViewName(),
|
|
96
|
+
propositions: currentViewPropositions.map(proposition => proposition.toJSON())
|
|
97
|
+
}
|
|
98
|
+
});
|
|
99
|
+
}
|
|
66
100
|
render().then(handleNotifications);
|
|
67
101
|
|
|
68
102
|
// Render could take a long time especially if one of the renders
|
|
@@ -10,18 +10,18 @@ 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 {
|
|
13
|
+
import { isNonEmptyString, isNonEmptyArray } from "../../utils/index.js";
|
|
14
14
|
import { buildPageSurface, normalizeSurfaces } from "./utils/surfaceUtils.js";
|
|
15
15
|
import PAGE_WIDE_SCOPE from "../../constants/pageWideScope.js";
|
|
16
|
-
import { DEFAULT_CONTENT_ITEM, DOM_ACTION, HTML_CONTENT_ITEM, MESSAGE_IN_APP, JSON_CONTENT_ITEM, REDIRECT_ITEM, RULESET_ITEM,
|
|
16
|
+
import { DEFAULT_CONTENT_ITEM, DOM_ACTION, HTML_CONTENT_ITEM, MESSAGE_IN_APP, JSON_CONTENT_ITEM, REDIRECT_ITEM, RULESET_ITEM, MESSAGE_CONTENT_CARD } from "../../constants/schema.js";
|
|
17
17
|
const addPageWideScope = scopes => {
|
|
18
|
-
if (!includes(
|
|
18
|
+
if (!scopes.includes(PAGE_WIDE_SCOPE)) {
|
|
19
19
|
scopes.push(PAGE_WIDE_SCOPE);
|
|
20
20
|
}
|
|
21
21
|
};
|
|
22
22
|
const addPageSurface = (surfaces, getPageLocation) => {
|
|
23
23
|
const pageSurface = buildPageSurface(getPageLocation);
|
|
24
|
-
if (!includes(
|
|
24
|
+
if (!surfaces.includes(pageSurface)) {
|
|
25
25
|
surfaces.push(pageSurface);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
@@ -68,8 +68,8 @@ export default (({
|
|
|
68
68
|
addPageWideScope(scopes);
|
|
69
69
|
addPageSurface(eventSurfaces, getPageLocation);
|
|
70
70
|
}
|
|
71
|
-
const schemas = [DEFAULT_CONTENT_ITEM, HTML_CONTENT_ITEM, JSON_CONTENT_ITEM, REDIRECT_ITEM, RULESET_ITEM, MESSAGE_IN_APP,
|
|
72
|
-
if (includes(
|
|
71
|
+
const schemas = [DEFAULT_CONTENT_ITEM, HTML_CONTENT_ITEM, JSON_CONTENT_ITEM, REDIRECT_ITEM, RULESET_ITEM, MESSAGE_IN_APP, MESSAGE_CONTENT_CARD];
|
|
72
|
+
if (scopes.includes(PAGE_WIDE_SCOPE)) {
|
|
73
73
|
schemas.push(DOM_ACTION);
|
|
74
74
|
}
|
|
75
75
|
return {
|
|
@@ -10,7 +10,7 @@ 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 {
|
|
13
|
+
import { groupBy } from "../../utils/index.js";
|
|
14
14
|
import defer from "../../utils/defer.js";
|
|
15
15
|
import { DEFAULT_CONTENT_ITEM } from "../../constants/schema.js";
|
|
16
16
|
import { VIEW_SCOPE_TYPE } from "./constants/scopeType.js";
|
|
@@ -49,7 +49,10 @@ export default (({
|
|
|
49
49
|
// propositions the old "cart" view propositions will remain.
|
|
50
50
|
viewStoragePromise = viewStoragePromise.then(oldViewStorage => {
|
|
51
51
|
return updateCacheDeferred.promise.then(newViewStorage => {
|
|
52
|
-
return
|
|
52
|
+
return {
|
|
53
|
+
...oldViewStorage,
|
|
54
|
+
...newViewStorage
|
|
55
|
+
};
|
|
53
56
|
}).catch(() => oldViewStorage);
|
|
54
57
|
});
|
|
55
58
|
return {
|
|
@@ -12,7 +12,8 @@ governing permissions and limitations under the License.
|
|
|
12
12
|
|
|
13
13
|
export default (({
|
|
14
14
|
processPropositions,
|
|
15
|
-
viewCache
|
|
15
|
+
viewCache,
|
|
16
|
+
logger
|
|
16
17
|
}) => {
|
|
17
18
|
return ({
|
|
18
19
|
personalizationDetails,
|
|
@@ -35,6 +36,15 @@ export default (({
|
|
|
35
36
|
returnedPropositions,
|
|
36
37
|
returnedDecisions
|
|
37
38
|
} = processPropositions(propositions));
|
|
39
|
+
logger.logOnContentRendering({
|
|
40
|
+
status: "rendering-started",
|
|
41
|
+
message: `Started rendering propositions for view scope - ${viewName}.`,
|
|
42
|
+
logLevel: "info",
|
|
43
|
+
detail: {
|
|
44
|
+
scope: viewName,
|
|
45
|
+
propositions: propositions.map(proposition => proposition.toJSON())
|
|
46
|
+
}
|
|
47
|
+
});
|
|
38
48
|
return render();
|
|
39
49
|
}
|
|
40
50
|
({
|